diff --git a/.gitmodules b/.gitmodules index 0eba41e3..a6683ad1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,7 +1,7 @@ [submodule "dependencies/dpdk"] path = dependencies/dpdk url = https://github.com/cjdoucette/dpdk - branch = gkv1.2b + branch = gkv1.2c [submodule "dependencies/luajit-2.0"] path = dependencies/luajit-2.0 url = https://github.com/AltraMayor/luajit.git diff --git a/README.md b/README.md index a0d82d09..0d29e09f 100644 --- a/README.md +++ b/README.md @@ -292,7 +292,7 @@ above. Gatekeeper and the submodules will be automatically compiled during the package build process. ```console -$ tar --exclude-vcs -Jcvf ../gatekeeper_1.1.0.orig.tar.xz -C .. gatekeeper +$ tar --exclude-vcs -Jcvf ../gatekeeper_1.2.0.orig.tar.xz -C .. gatekeeper $ debuild -uc -us ``` diff --git a/bpf/Makefile b/bpf/Makefile index d98f52b5..c4262143 100644 --- a/bpf/Makefile +++ b/bpf/Makefile @@ -14,7 +14,7 @@ copy: all $(INSTALL) -m660 $(TARGETS) $(DESTDIR) %.bpf: %.c - $(CC) $(CFLAGS) -o $@ -c $^ + $(CC) $(CFLAGS) -o $@ -D RTE_FORCE_INTRINSICS -c $^ PHONY: cscope clean diff --git a/cps/kni.c b/cps/kni.c index 9da9cec6..2d808d6a 100644 --- a/cps/kni.c +++ b/cps/kni.c @@ -22,24 +22,6 @@ #include "gatekeeper_main.h" #include "kni.h" -/* - * XXX #677 Adopt RTE_ETHER_ADDR_PRT_FMT and RTE_ETHER_ADDR_BYTES - * once DPDK is updated. - */ -/** - * Macro to print six-bytes of MAC address in hex format - */ -#define RTE_ETHER_ADDR_PRT_FMT "%02X:%02X:%02X:%02X:%02X:%02X" -/** - * Macro to extract the MAC address bytes from rte_ether_addr struct - */ -#define RTE_ETHER_ADDR_BYTES(mac_addrs) ((mac_addrs)->addr_bytes[0]), \ - ((mac_addrs)->addr_bytes[1]), \ - ((mac_addrs)->addr_bytes[2]), \ - ((mac_addrs)->addr_bytes[3]), \ - ((mac_addrs)->addr_bytes[4]), \ - ((mac_addrs)->addr_bytes[5]) - #define KNI_BUS_NAME "vdev" void @@ -62,7 +44,12 @@ static int setup_dpdk_interface(struct cps_kni *kni, const struct gatekeeper_if *iface, struct rte_mempool *mp, uint16_t queue_size) { - struct rte_eth_conf port_conf = {}; + struct rte_eth_conf port_conf = { + .rxmode = { + .mtu = iface->mtu, + .offloads = RTE_ETH_RX_OFFLOAD_SCATTER, + }, + }; int ret = rte_eth_dev_get_port_by_name(kni->cps_name, &kni->cps_portid); if (unlikely(ret < 0)) { @@ -73,14 +60,6 @@ setup_dpdk_interface(struct cps_kni *kni, const struct gatekeeper_if *iface, return ret; } - ret = rte_eth_dev_set_mtu(kni->cps_portid, iface->mtu); - if (unlikely(ret < 0)) { - G_LOG(ERR, "%s(%s): cannot set the MTU=%u (errno=%i): %s\n", - __func__, iface->name, iface->mtu, - -ret, rte_strerror(-ret)); - return ret; - } - ret = rte_eth_dev_configure(kni->cps_portid, 1, 1, &port_conf); if (unlikely(ret < 0)) { G_LOG(ERR, "%s(%s): failed to configure port (errno=%i): %s\n", diff --git a/cps/main.c b/cps/main.c index 57368b35..8bf8b5f4 100644 --- a/cps/main.c +++ b/cps/main.c @@ -118,8 +118,8 @@ send_arp_reply_kni(struct cps_config *cps_conf, struct cps_arp_req *arp) * the Ethernet and ARP headers. */ eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_ether_addr_copy(&arp->ha, ð_hdr->s_addr); - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->dst_addr); + rte_ether_addr_copy(&arp->ha, ð_hdr->src_addr); eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_ARP); /* Set-up ARP header. */ @@ -177,8 +177,8 @@ send_nd_reply_kni(struct cps_config *cps_conf, struct cps_nd_req *nd) * the Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_ether_addr_copy(&nd->ha, ð_hdr->s_addr); - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->dst_addr); + rte_ether_addr_copy(&nd->ha, ð_hdr->src_addr); eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6); /* Set-up IPv6 header. */ diff --git a/dependencies/dpdk b/dependencies/dpdk index 9ede2e2e..eeb0605f 160000 --- a/dependencies/dpdk +++ b/dependencies/dpdk @@ -1 +1 @@ -Subproject commit 9ede2e2efe5d8cf28bd08ffe6e0c02a087e3ad43 +Subproject commit eeb0605f118dae66e80faa44f7b3e88748032353 diff --git a/gk/main.c b/gk/main.c index aed982a1..a176187b 100644 --- a/gk/main.c +++ b/gk/main.c @@ -1144,9 +1144,9 @@ xmit_icmp(struct gatekeeper_if *iface, struct ipacket *packet, } } - rte_ether_addr_copy(&icmp_eth->s_addr, ð_addr_tmp); - rte_ether_addr_copy(&icmp_eth->d_addr, &icmp_eth->s_addr); - rte_ether_addr_copy(ð_addr_tmp, &icmp_eth->d_addr); + rte_ether_addr_copy(&icmp_eth->src_addr, ð_addr_tmp); + rte_ether_addr_copy(&icmp_eth->dst_addr, &icmp_eth->src_addr); + rte_ether_addr_copy(ð_addr_tmp, &icmp_eth->dst_addr); if (iface->vlan_insert) { fill_vlan_hdr(icmp_eth, iface->ipv4_vlan_tag_be, RTE_ETHER_TYPE_IPV4); @@ -1217,9 +1217,9 @@ xmit_icmpv6(struct gatekeeper_if *iface, struct ipacket *packet, } } - rte_ether_addr_copy(&icmp_eth->s_addr, ð_addr_tmp); - rte_ether_addr_copy(&icmp_eth->d_addr, &icmp_eth->s_addr); - rte_ether_addr_copy(ð_addr_tmp, &icmp_eth->d_addr); + rte_ether_addr_copy(&icmp_eth->src_addr, ð_addr_tmp); + rte_ether_addr_copy(&icmp_eth->dst_addr, &icmp_eth->src_addr); + rte_ether_addr_copy(ð_addr_tmp, &icmp_eth->dst_addr); if (iface->vlan_insert) { fill_vlan_hdr(icmp_eth, iface->ipv6_vlan_tag_be, RTE_ETHER_TYPE_IPV6); @@ -2739,8 +2739,8 @@ get_responsible_gk_mailbox(uint32_t flow_hash_val, * Identify which GK block is responsible for the * pair in the decision. */ - idx = rss_hash_val / RTE_RETA_GROUP_SIZE; - shift = rss_hash_val % RTE_RETA_GROUP_SIZE; + idx = rss_hash_val / RTE_ETH_RETA_GROUP_SIZE; + shift = rss_hash_val % RTE_ETH_RETA_GROUP_SIZE; queue_id = gk_conf->rss_conf_front.reta_conf[idx].reta[shift]; block_idx = gk_conf->queue_id_to_instance[queue_id]; diff --git a/gk/rt.c b/gk/rt.c index 580c8f3e..81cb84b6 100644 --- a/gk/rt.c +++ b/gk/rt.c @@ -82,7 +82,7 @@ gk_arp_and_nd_req_cb(const struct lls_map *map, void *arg, * on the nexthop entry. */ write_seqlock(ð_cache->lock); - rte_ether_addr_copy(&map->ha, ð_cache->l2_hdr.eth_hdr.d_addr); + rte_ether_addr_copy(&map->ha, ð_cache->l2_hdr.eth_hdr.dst_addr); eth_cache->stale = map->stale; write_sequnlock(ð_cache->lock); @@ -123,7 +123,7 @@ get_new_ether_cache_locked(struct neighbor_hash_table *neigh, rte_cpu_to_be_16(addr->proto); } rte_ether_addr_copy(&iface->eth_addr, - ð_cache->l2_hdr.eth_hdr.s_addr); + ð_cache->l2_hdr.eth_hdr.src_addr); rte_atomic32_set(ð_cache->ref_cnt, 1); return eth_cache; @@ -2010,7 +2010,7 @@ fillup_gk_fib_dump_entry_ether(struct fib_dump_addr_set *addr_set, { addr_set->stale = eth_cache->stale; addr_set->nexthop_ip = eth_cache->ip_addr; - rte_ether_addr_copy(ð_cache->l2_hdr.eth_hdr.d_addr, + rte_ether_addr_copy(ð_cache->l2_hdr.eth_hdr.dst_addr, &addr_set->d_addr); } @@ -2278,7 +2278,7 @@ fillup_gk_neighbor_dump_entry(struct gk_neighbor_dump_entry *dentry, dentry->stale = eth_cache->stale; rte_memcpy(&dentry->neigh_ip, ð_cache->ip_addr, sizeof(dentry->neigh_ip)); - rte_memcpy(&dentry->d_addr, ð_cache->l2_hdr.eth_hdr.d_addr, + rte_memcpy(&dentry->d_addr, ð_cache->l2_hdr.eth_hdr.dst_addr, sizeof(dentry->d_addr)); } diff --git a/gt/main.c b/gt/main.c index 5f44f9df..cceb7d14 100644 --- a/gt/main.c +++ b/gt/main.c @@ -476,7 +476,7 @@ gt_arp_and_nd_req_cb(const struct lls_map *map, void *arg, * on the nexthop entry. */ write_seqlock(ð_cache->lock); - rte_ether_addr_copy(&map->ha, ð_cache->l2_hdr.eth_hdr.d_addr); + rte_ether_addr_copy(&map->ha, ð_cache->l2_hdr.eth_hdr.dst_addr); eth_cache->stale = map->stale; write_sequnlock(ð_cache->lock); @@ -516,7 +516,7 @@ gt_fill_up_ether_cache_locked(struct ether_cache *eth_cache, } rte_ether_addr_copy(&iface->eth_addr, - ð_cache->l2_hdr.eth_hdr.s_addr); + ð_cache->l2_hdr.eth_hdr.src_addr); rte_atomic32_set(ð_cache->ref_cnt, 1); if (inner_ip_ver == RTE_ETHER_TYPE_IPV4) { @@ -723,8 +723,8 @@ decap_and_fill_eth(struct rte_mbuf *m, struct gt_config *gt_conf, rte_pktmbuf_mtod(m, struct rte_ether_hdr *); struct rte_ether_hdr *raw_eth = pkt_info->l2_hdr; - rte_ether_addr_copy(&raw_eth->s_addr, ð_hdr->d_addr); - rte_ether_addr_copy(&raw_eth->d_addr, ð_hdr->s_addr); + rte_ether_addr_copy(&raw_eth->src_addr, ð_hdr->dst_addr); + rte_ether_addr_copy(&raw_eth->dst_addr, ð_hdr->src_addr); m->l2_len = iface->l2_len_out; if (iface->vlan_insert) @@ -763,8 +763,8 @@ fill_eth_hdr_reverse(struct gatekeeper_if *iface, struct rte_ether_hdr *eth_hdr, { struct rte_ether_hdr *raw_eth = (struct rte_ether_hdr *)pkt_info->l2_hdr; - rte_ether_addr_copy(&raw_eth->s_addr, ð_hdr->d_addr); - rte_ether_addr_copy(&raw_eth->d_addr, ð_hdr->s_addr); + rte_ether_addr_copy(&raw_eth->src_addr, ð_hdr->dst_addr); + rte_ether_addr_copy(&raw_eth->dst_addr, ð_hdr->src_addr); if (iface->vlan_insert) { uint16_t vlan_tag_be = pkt_info->outer_ethertype == RTE_ETHER_TYPE_IPV4 ? @@ -843,7 +843,7 @@ fill_notify_pkt_hdr(struct rte_mbuf *notify_pkt, notify_ipv4->dst_addr = ipv4_hdr->src_addr; notify_pkt->l3_len = sizeof(struct rte_ipv4_hdr); - notify_pkt->ol_flags |= PKT_TX_IPV4; + notify_pkt->ol_flags |= RTE_MBUF_F_TX_IPV4; /* IPv4 checksum set in prep_notify_pkt(). */ } else if (likely(ethertype == RTE_ETHER_TYPE_IPV6)) { @@ -861,7 +861,7 @@ fill_notify_pkt_hdr(struct rte_mbuf *notify_pkt, sizeof(notify_ipv6->dst_addr)); notify_pkt->l3_len = sizeof(struct rte_ipv6_hdr); - notify_pkt->ol_flags |= PKT_TX_IPV6; + notify_pkt->ol_flags |= RTE_MBUF_F_TX_IPV6; } /* Fill up the UDP header. */ @@ -1011,7 +1011,7 @@ prep_notify_pkt(struct ggu_notify_pkt *ggu_pkt, struct gatekeeper_if *iface) notify_udp->dgram_len = dgram_len_be; if (likely(iface->ipv4_hw_udp_cksum)) { /* Offload the UDP checksum. */ - ggu_pkt->buf->ol_flags |= PKT_TX_UDP_CKSUM; + ggu_pkt->buf->ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; notify_udp->dgram_cksum = rte_ipv4_phdr_cksum(notify_ipv4, ggu_pkt->buf->ol_flags); @@ -1040,7 +1040,7 @@ prep_notify_pkt(struct ggu_notify_pkt *ggu_pkt, struct gatekeeper_if *iface) notify_udp->dgram_len = dgram_len_be; if (likely(iface->ipv6_hw_udp_cksum)) { /* Offload the UDP checksum. */ - ggu_pkt->buf->ol_flags |= PKT_TX_UDP_CKSUM; + ggu_pkt->buf->ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; notify_udp->dgram_cksum = rte_ipv6_phdr_cksum(notify_ipv6, ggu_pkt->buf->ol_flags); @@ -1787,8 +1787,8 @@ gt_proc(void *arg) if (reassembling_enabled && cur_tsc - last_tsc >= frag_scan_timeout_cycles) { RTE_VERIFY(death_row.cnt == 0); - rte_frag_table_del_expired_entries(instance->frag_tbl, - &death_row, cur_tsc); + rte_ip_frag_table_del_expired_entries( + instance->frag_tbl, &death_row, cur_tsc); /* Process the death packets. */ process_death_row(true, &death_row, diff --git a/include/gatekeeper_net.h b/include/gatekeeper_net.h index e60a0550..e7b036ac 100644 --- a/include/gatekeeper_net.h +++ b/include/gatekeeper_net.h @@ -67,7 +67,8 @@ struct ipaddr { * of the table. To configure more than 64 entries supported by hardware, * an array of this structure is needed. */ -#define GATEKEEPER_RETA_MAX_SIZE (ETH_RSS_RETA_SIZE_512 / RTE_RETA_GROUP_SIZE) +#define GATEKEEPER_RETA_MAX_SIZE \ + (RTE_ETH_RSS_RETA_SIZE_512 / RTE_ETH_RETA_GROUP_SIZE) struct gatekeeper_rss_config { uint16_t reta_size; @@ -654,9 +655,9 @@ set_ipv4_checksum(struct gatekeeper_if *iface, struct rte_mbuf *pkt, * computing the checksum (in hardware or software). */ ipv4->hdr_checksum = 0; - pkt->ol_flags |= PKT_TX_IPV4; + pkt->ol_flags |= RTE_MBUF_F_TX_IPV4; if (likely(iface->ipv4_hw_cksum)) - pkt->ol_flags |= PKT_TX_IP_CKSUM; + pkt->ol_flags |= RTE_MBUF_F_TX_IP_CKSUM; else ipv4->hdr_checksum = rte_ipv4_cksum(ipv4); } diff --git a/lib/net.c b/lib/net.c index 307edf40..bcfaf5a7 100644 --- a/lib/net.c +++ b/lib/net.c @@ -563,7 +563,7 @@ rm_slave_ports(struct gatekeeper_if *iface, uint8_t nb_slave_ports) { uint8_t i; for (i = 0; i < nb_slave_ports; i++) - rte_eth_bond_slave_remove(iface->id, iface->ports[i]); + rte_eth_bond_member_remove(iface->id, iface->ports[i]); } static void @@ -1003,25 +1003,25 @@ i40e_disable_ipv6_tcp_udp_ports_from_inset(uint16_t port_id) } /* - * Split up ETH_RSS_IP into IPv4-related and IPv6-related hash functions. + * Split up RTE_ETH_RSS_IP into IPv4-related and IPv6-related hash functions. * For each type of IP being used in Gatekeeper, check the supported - * hashes of the device. If none are supported, disable RSS. If - * ETH_RSS_IPV{4,6} is not supported, issue a warning since we expect + * hashes of the device. If none are supported, disable RSS. + * If RTE_ETH_RSS_IPV{4,6} is not supported, issue a warning since we expect * this to be a common and critical hash function. Some devices (i40e - * and AVF) do not support the ETH_RSS_IPV{4,6} hashes, but the hashes + * and AVF) do not support the RTE_ETH_RSS_IPV{4,6} hashes, but the hashes * they do support may be enough. */ #define GATEKEEPER_IPV4_RSS_HF ( \ - ETH_RSS_IPV4 | \ - ETH_RSS_FRAG_IPV4 | \ - ETH_RSS_NONFRAG_IPV4_OTHER) + RTE_ETH_RSS_IPV4 | \ + RTE_ETH_RSS_FRAG_IPV4 | \ + RTE_ETH_RSS_NONFRAG_IPV4_OTHER) #define GATEKEEPER_IPV6_RSS_HF ( \ - ETH_RSS_IPV6 | \ - ETH_RSS_FRAG_IPV6 | \ - ETH_RSS_NONFRAG_IPV6_OTHER | \ - ETH_RSS_IPV6_EX) + RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_FRAG_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV6_OTHER | \ + RTE_ETH_RSS_IPV6_EX) static int check_port_rss(struct gatekeeper_if *iface, unsigned int port_idx, @@ -1105,7 +1105,7 @@ check_port_rss(struct gatekeeper_if *iface, unsigned int port_idx, port_id); if (ret < 0) goto disable_rss; - } else if ((rss_off & ETH_RSS_IPV4) == 0) { + } else if ((rss_off & RTE_ETH_RSS_IPV4) == 0) { /* * The IPv4 hash that we think is typically * used is not supported, so warn the user. @@ -1131,7 +1131,7 @@ check_port_rss(struct gatekeeper_if *iface, unsigned int port_idx, port_id); if (ret < 0) goto disable_rss; - } else if ((rss_off & ETH_RSS_IPV6) == 0) { + } else if ((rss_off & RTE_ETH_RSS_IPV6) == 0) { /* * The IPv6 hash that we think is typically * used is not supported, so warn the user. @@ -1167,34 +1167,33 @@ check_port_rss(struct gatekeeper_if *iface, unsigned int port_idx, static int check_port_mtu(struct gatekeeper_if *iface, unsigned int port_idx, - const struct rte_eth_dev_info *dev_info, - struct rte_eth_conf *port_conf) + const struct rte_eth_dev_info *dev_info, struct rte_eth_conf *port_conf) { - if (dev_info->max_rx_pktlen < port_conf->rxmode.max_rx_pkt_len) { - G_LOG(ERR, - "net: port %hu (%s) on the %s interface only supports MTU of size %"PRIu32", but Gatekeeper is configured to be %"PRIu16"\n", + if (dev_info->min_mtu > port_conf->rxmode.mtu) { + G_LOG(ERR, "%s(%s): the minimum MTU %"PRIu32" of port %hu (%s) is larger than the configured MTU %"PRIu32"\n", + __func__, iface->name, + dev_info->min_mtu, iface->ports[port_idx], iface->pci_addrs[port_idx], - iface->name, dev_info->max_rx_pktlen, - port_conf->rxmode.max_rx_pkt_len); + port_conf->rxmode.mtu); return -1; } - if ((port_conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) && - !(dev_info->rx_offload_capa & - DEV_RX_OFFLOAD_JUMBO_FRAME)) { - G_LOG(NOTICE, "net: port %hu (%s) on the %s interface doesn't support offloading for jumbo frames\n", + if (dev_info->max_mtu < port_conf->rxmode.mtu) { + G_LOG(ERR, "%s(%s): the maximum MTU %"PRIu32" of port %hu (%s) is smaller than the configured MTU %"PRIu32"\n", + __func__, iface->name, + dev_info->max_mtu, iface->ports[port_idx], iface->pci_addrs[port_idx], - iface->name); + port_conf->rxmode.mtu); return -1; } - if ((port_conf->txmode.offloads & DEV_TX_OFFLOAD_MULTI_SEGS) && + if ((port_conf->txmode.offloads & RTE_ETH_TX_OFFLOAD_MULTI_SEGS) && !(dev_info->tx_offload_capa & - DEV_TX_OFFLOAD_MULTI_SEGS)) { - G_LOG(NOTICE, "net: port %hu (%s) on the %s interface doesn't support offloading multi-segment TX buffers\n", - iface->ports[port_idx], iface->pci_addrs[port_idx], - iface->name); - port_conf->txmode.offloads &= ~DEV_TX_OFFLOAD_MULTI_SEGS; + RTE_ETH_TX_OFFLOAD_MULTI_SEGS)) { + G_LOG(NOTICE, "%s(%s): port %hu (%s) doesn't support offloading multi-segment TX buffers\n", + __func__, iface->name, + iface->ports[port_idx], iface->pci_addrs[port_idx]); + port_conf->txmode.offloads &= ~RTE_ETH_TX_OFFLOAD_MULTI_SEGS; } return 0; @@ -1202,26 +1201,25 @@ check_port_mtu(struct gatekeeper_if *iface, unsigned int port_idx, static int check_port_cksum(struct gatekeeper_if *iface, unsigned int port_idx, - const struct rte_eth_dev_info *dev_info, - struct rte_eth_conf *port_conf) + const struct rte_eth_dev_info *dev_info, struct rte_eth_conf *port_conf) { - if ((port_conf->txmode.offloads & DEV_TX_OFFLOAD_IPV4_CKSUM) && + if ((port_conf->txmode.offloads & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) && !(dev_info->tx_offload_capa & - DEV_TX_OFFLOAD_IPV4_CKSUM)) { - G_LOG(NOTICE, "net: port %hu (%s) on the %s interface doesn't support offloading IPv4 checksumming; will use software IPv4 checksums\n", - iface->ports[port_idx], iface->pci_addrs[port_idx], - iface->name); - port_conf->txmode.offloads &= ~DEV_TX_OFFLOAD_IPV4_CKSUM; + RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)) { + G_LOG(NOTICE, "%s(%s): port %hu (%s) doesn't support offloading IPv4 checksumming; will use software IPv4 checksums\n", + __func__, iface->name, + iface->ports[port_idx], iface->pci_addrs[port_idx]); + port_conf->txmode.offloads &= ~RTE_ETH_TX_OFFLOAD_IPV4_CKSUM; iface->ipv4_hw_cksum = false; } - if ((port_conf->txmode.offloads & DEV_TX_OFFLOAD_UDP_CKSUM) && + if ((port_conf->txmode.offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) && !(dev_info->tx_offload_capa & - DEV_TX_OFFLOAD_UDP_CKSUM)) { - G_LOG(NOTICE, "net: port %hu (%s) on the %s interface doesn't support offloading UDP checksumming; will use software UDP checksums\n", - iface->ports[port_idx], iface->pci_addrs[port_idx], - iface->name); - port_conf->txmode.offloads &= ~DEV_TX_OFFLOAD_UDP_CKSUM; + RTE_ETH_TX_OFFLOAD_UDP_CKSUM)) { + G_LOG(NOTICE, "%s(%s): port %hu (%s) doesn't support offloading UDP checksumming; will use software UDP checksums\n", + __func__, iface->name, + iface->ports[port_idx], iface->pci_addrs[port_idx]); + port_conf->txmode.offloads &= ~RTE_ETH_TX_OFFLOAD_UDP_CKSUM; iface->ipv4_hw_udp_cksum = false; iface->ipv6_hw_udp_cksum = false; } @@ -1279,7 +1277,7 @@ check_port_offloads(struct gatekeeper_if *iface, int ret; RTE_BUILD_BUG_ON((GATEKEEPER_IPV4_RSS_HF | GATEKEEPER_IPV6_RSS_HF) != - ETH_RSS_IP); + RTE_ETH_RSS_IP); /* * Set up device RSS. @@ -1303,34 +1301,28 @@ check_port_offloads(struct gatekeeper_if *iface, GATEKEEPER_IPV4_RSS_HF; if (iface->alternative_rss_hash) port_conf->rx_adv_conf.rss_conf.rss_hf |= - ETH_RSS_NONFRAG_IPV4_TCP | - ETH_RSS_NONFRAG_IPV4_UDP; + RTE_ETH_RSS_NONFRAG_IPV4_TCP | + RTE_ETH_RSS_NONFRAG_IPV4_UDP; } if (ipv6_if_configured(iface)) { port_conf->rx_adv_conf.rss_conf.rss_hf |= GATEKEEPER_IPV6_RSS_HF; if (iface->alternative_rss_hash) port_conf->rx_adv_conf.rss_conf.rss_hf |= - ETH_RSS_NONFRAG_IPV6_TCP | - ETH_RSS_NONFRAG_IPV6_UDP; + RTE_ETH_RSS_NONFRAG_IPV6_TCP | + RTE_ETH_RSS_NONFRAG_IPV6_UDP; } /* * Set up device MTU. * - * If greater than the traditional MTU, then add the - * jumbo frame RX offload flag. All ports must support - * this offload in this case. - * * If greater than the size of the mbufs, then add the * multi-segment buffer flag. This is optional and * if any ports don't support it, it will be removed. */ - port_conf->rxmode.max_rx_pkt_len = iface->mtu; - if (iface->mtu > RTE_ETHER_MTU) - port_conf->rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME; + port_conf->rxmode.mtu = iface->mtu; if (iface->mtu > RTE_MBUF_DEFAULT_BUF_SIZE) - port_conf->txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS; + port_conf->txmode.offloads |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS; /* * Set up checksumming. @@ -1353,10 +1345,10 @@ check_port_offloads(struct gatekeeper_if *iface, * and can be configured as hardware or software independently. */ if (ipv4_if_configured(iface) && iface->ipv4_hw_cksum) - port_conf->txmode.offloads |= DEV_TX_OFFLOAD_IPV4_CKSUM; + port_conf->txmode.offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM; if (!config.back_iface_enabled && (iface->ipv4_hw_udp_cksum || iface->ipv6_hw_udp_cksum)) - port_conf->txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM; + port_conf->txmode.offloads |= RTE_ETH_TX_OFFLOAD_UDP_CKSUM; for (i = 0; i < iface->num_ports; i++) { struct rte_eth_dev_info dev_info; @@ -1400,7 +1392,7 @@ check_port_offloads(struct gatekeeper_if *iface, rte_convert_rss_key((uint32_t *)iface->rss_key, (uint32_t *)iface->rss_key_be, iface->rss_key_len); - port_conf->rxmode.mq_mode = ETH_MQ_RX_RSS; + port_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_RSS; port_conf->rx_adv_conf.rss_conf.rss_key = iface->rss_key; port_conf->rx_adv_conf.rss_conf.rss_key_len = iface->rss_key_len; @@ -1437,7 +1429,7 @@ gatekeeper_setup_rss(uint16_t port_id, uint16_t *queues, uint16_t num_queues) goto out; } - if (dev_info.reta_size > ETH_RSS_RETA_SIZE_512) { + if (dev_info.reta_size > RTE_ETH_RSS_RETA_SIZE_512) { G_LOG(ERR, "net: failed to setup RSS at port %hhu (invalid RETA size = %u)\n", port_id, dev_info.reta_size); @@ -1449,8 +1441,8 @@ gatekeeper_setup_rss(uint16_t port_id, uint16_t *queues, uint16_t num_queues) memset(reta_conf, 0, sizeof(reta_conf)); for (i = 0; i < dev_info.reta_size; i++) { - uint32_t idx = i / RTE_RETA_GROUP_SIZE; - uint32_t shift = i % RTE_RETA_GROUP_SIZE; + uint32_t idx = i / RTE_ETH_RETA_GROUP_SIZE; + uint32_t shift = i % RTE_ETH_RETA_GROUP_SIZE; uint32_t queue_idx = i % num_queues; /* Select all fields to set. */ @@ -1510,7 +1502,7 @@ gatekeeper_get_rss_config(uint16_t port_id, } rss_conf->reta_size = dev_info.reta_size; if (rss_conf->reta_size == 0 || - rss_conf->reta_size > ETH_RSS_RETA_SIZE_512) { + rss_conf->reta_size > RTE_ETH_RSS_RETA_SIZE_512) { G_LOG(ERR, "net: failed to setup RSS at port %hhu (invalid RETA size = %hu)\n", port_id, rss_conf->reta_size); @@ -1519,7 +1511,7 @@ gatekeeper_get_rss_config(uint16_t port_id, } for (i = 0; i < dev_info.reta_size; i++) { - uint32_t idx = i / RTE_RETA_GROUP_SIZE; + uint32_t idx = i / RTE_ETH_RETA_GROUP_SIZE; /* Select all fields to query. */ rss_conf->reta_conf[idx].mask = ~0LL; } @@ -1590,7 +1582,7 @@ init_iface(struct gatekeeper_if *iface) { struct rte_eth_conf port_conf = { .rxmode = { - .mq_mode = ETH_MQ_RX_NONE, + .mq_mode = RTE_ETH_MQ_RX_NONE, }, /* Other offloads configured below. */ }; @@ -1686,7 +1678,7 @@ init_iface(struct gatekeeper_if *iface) */ num_slaves_added = 0; for (i = 0; i < iface->num_ports; i++) { - ret = rte_eth_bond_slave_add(iface->id, + ret = rte_eth_bond_member_add(iface->id, iface->ports[i]); if (ret < 0) { G_LOG(ERR, "%s(%s): failed to add slave port %hhu to bonded port %hhu (errno=%i): %s\n", @@ -1919,18 +1911,6 @@ start_iface(struct gatekeeper_if *iface, unsigned int num_attempts_link_get) uint8_t i; uint8_t num_succ_ports; - /* - * The MTU of the device should be changed while the device - * is down. Otherwise, drivers for some NICs and in some cases - * (when multiple ports are bonded) fail to set the MTU. - */ - ret = rte_eth_dev_set_mtu(iface->id, iface->mtu); - if (ret < 0) { - G_LOG(ERR, "%s(%s): cannot set the MTU (errno=%i): %s\n", - __func__, iface->name, -ret, rte_strerror(-ret)); - goto destroy_init; - } - num_succ_ports = 0; for (i = 0; i < iface->num_ports; i++) { ret = start_port(iface->ports[i], @@ -1975,7 +1955,6 @@ start_iface(struct gatekeeper_if *iface, unsigned int num_attempts_link_get) stop_partial: stop_iface_ports(iface, num_succ_ports); -destroy_init: destroy_iface(iface, IFACE_DESTROY_INIT); return ret; } diff --git a/lls/arp.c b/lls/arp.c index e9422246..977b7ac6 100644 --- a/lls/arp.c +++ b/lls/arp.c @@ -65,11 +65,11 @@ xmit_arp_req(struct gatekeeper_if *iface, const struct ipaddr *addr, /* Set-up Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->s_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->src_addr); if (ha == NULL) - memset(ð_hdr->d_addr, 0xFF, RTE_ETHER_ADDR_LEN); + memset(ð_hdr->dst_addr, 0xFF, RTE_ETHER_ADDR_LEN); else - rte_ether_addr_copy(ha, ð_hdr->d_addr); + rte_ether_addr_copy(ha, ð_hdr->dst_addr); /* Set-up VLAN header. */ if (iface->vlan_insert) @@ -169,8 +169,8 @@ process_arp(struct lls_config *lls_conf, struct gatekeeper_if *iface, */ /* Set-up Ethernet header. */ - rte_ether_addr_copy(ð_hdr->s_addr, ð_hdr->d_addr); - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->s_addr); + rte_ether_addr_copy(ð_hdr->src_addr, ð_hdr->dst_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->src_addr); /* Set-up ARP header. */ arp_hdr->arp_opcode = rte_cpu_to_be_16(RTE_ARP_OP_REPLY); diff --git a/lls/main.c b/lls/main.c index dc8d0550..9a071ad1 100644 --- a/lls/main.c +++ b/lls/main.c @@ -619,12 +619,12 @@ process_pkts(struct lls_config *lls_conf, struct gatekeeper_if *iface, * accepts the assigned MAC address, broadcast address, * and any MAC added (for example, for IPv6 Ethernet multicast). */ - if (unlikely(!rte_is_broadcast_ether_addr(ð_hdr->d_addr) && - !rte_is_same_ether_addr(ð_hdr->d_addr, + if (unlikely(!rte_is_broadcast_ether_addr(ð_hdr->dst_addr) && + !rte_is_same_ether_addr(ð_hdr->dst_addr, &iface->eth_mc_addr) && - !rte_is_same_ether_addr(ð_hdr->d_addr, + !rte_is_same_ether_addr(ð_hdr->dst_addr, &iface->ll_eth_mc_addr) && - !rte_is_same_ether_addr(ð_hdr->d_addr, + !rte_is_same_ether_addr(ð_hdr->dst_addr, &iface->eth_addr))) goto free_buf; diff --git a/lls/nd.c b/lls/nd.c index 3f5d761f..adb63df7 100644 --- a/lls/nd.c +++ b/lls/nd.c @@ -154,7 +154,7 @@ xmit_nd_req(struct gatekeeper_if *iface, const struct ipaddr *addr, /* Set-up Ethernet header. */ eth_hdr = rte_pktmbuf_mtod(created_pkt, struct rte_ether_hdr *); - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->s_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->src_addr); if (ha == NULL) { /* * Need to use IPv6 multicast Ethernet address. @@ -168,9 +168,9 @@ xmit_nd_req(struct gatekeeper_if *iface, const struct ipaddr *addr, 0x33, 0x33, 0xFF, ipv6_addr[13], ipv6_addr[14], ipv6_addr[15], } }; - rte_ether_addr_copy(ð_mc_daddr, ð_hdr->d_addr); + rte_ether_addr_copy(ð_mc_daddr, ð_hdr->dst_addr); } else - rte_ether_addr_copy(ha, ð_hdr->d_addr); + rte_ether_addr_copy(ha, ð_hdr->dst_addr); /* Set-up VLAN header. */ if (iface->vlan_insert) @@ -417,8 +417,8 @@ process_nd_neigh_solicitation(struct lls_config *lls_conf, struct rte_mbuf *buf, */ /* Set-up Ethernet header. */ - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->s_addr); - rte_ether_addr_copy(src_eth_addr, ð_hdr->d_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->src_addr); + rte_ether_addr_copy(src_eth_addr, ð_hdr->dst_addr); /* Set-up IPv6 header. */ nd_msg->flags = 0; @@ -504,8 +504,8 @@ process_nd_neigh_solicitation(struct lls_config *lls_conf, struct rte_mbuf *buf, if (src_unspec) return -1; - rte_ether_addr_copy(&iface->eth_addr, ð_hdr->s_addr); - rte_ether_addr_copy(ð_mc_daddr, ð_hdr->d_addr); + rte_ether_addr_copy(&iface->eth_addr, ð_hdr->src_addr); + rte_ether_addr_copy(ð_mc_daddr, ð_hdr->dst_addr); /* Set-up IPv6 header. */ ipv6_hdr->payload_len = diff --git a/sol/main.c b/sol/main.c index c82a2463..39fd14a2 100644 --- a/sol/main.c +++ b/sol/main.c @@ -389,7 +389,8 @@ iface_speed_bytes(struct gatekeeper_if *iface, uint64_t *link_speed_bytes) goto err; } - if (link.link_speed == ETH_SPEED_NUM_NONE) { + if (link.link_speed == RTE_ETH_SPEED_NUM_NONE || + link.link_speed == RTE_ETH_SPEED_NUM_UNKNOWN) { ret = -ENOTSUP; goto err; }