diff --git a/.gitignore b/.gitignore index 94720069..02278daa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.so *.o build/ +.history diff --git a/Dockerfile b/Dockerfile index 9dc987ad..3340df40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ RUN git clone -b 'stable-v40' --single-branch --depth 1 https://github.com/linux ENV RTE_SDK /root/dpdk # Build DPDK -RUN git clone --depth 1 --branch 'v21.11' https://github.com/DPDK/dpdk.git ${RTE_SDK} && \ +RUN git clone --depth 1 --branch 'v23.11' https://github.com/DPDK/dpdk.git ${RTE_SDK} && \ cd ${RTE_SDK} && \ meson build -Dexamples='' -Dplatform=generic -Denable_kmods=false -Dtests=false -Ddisable_drivers='raw/*,crypto/*,baseband/*,dma/*' && \ cd build/ && \ diff --git a/docs/INTERNAL.md b/docs/INTERNAL.md index dd243b21..4d287bd0 100644 --- a/docs/INTERNAL.md +++ b/docs/INTERNAL.md @@ -41,10 +41,10 @@ ldconfig ### Build DPDK -We use DPDK v21.11 LTS, like so: +We use DPDK v23.11 LTS, like so: ```bash -export RTE_SDK=/path/to/dpdk-21.11/ +export RTE_SDK=/path/to/dpdk-23.11/ cd ${RTE_SDK} && meson build && cd build && ninja && DESTDIR=${PWD}/install ninja install ``` diff --git a/src/core/drivers/dpdk/pmd.cc b/src/core/drivers/dpdk/pmd.cc index d685ad3c..0a0fefc6 100644 --- a/src/core/drivers/dpdk/pmd.cc +++ b/src/core/drivers/dpdk/pmd.cc @@ -18,7 +18,7 @@ __attribute__((unused)) static void ReportLinkStatus(uint8_t port_id) { LOG(WARNING) << "rte_eth_link_get_nowait() failed."; } - if (link.link_status == ETH_LINK_UP) { + if (link.link_status == RTE_ETH_LINK_UP) { LOG(INFO) << "[PMDPORT: " << static_cast(port_id) << "] " << "Link is UP " << link.link_speed << (link.link_autoneg ? "(AutoNeg)" : "(Fixed)") @@ -38,18 +38,17 @@ static rte_eth_conf DefaultEthConf(const rte_eth_dev_info *devinfo) { // offloads so return a very basic ethernet configuration. if (std::string(devinfo->driver_name) == "net_null") return port_conf; - port_conf.link_speeds = ETH_LINK_SPEED_AUTONEG; - uint64_t rss_hf = ETH_RSS_IP | ETH_RSS_UDP | ETH_RSS_TCP | ETH_RSS_SCTP; + port_conf.link_speeds = RTE_ETH_LINK_SPEED_AUTONEG; + uint64_t rss_hf = RTE_ETH_RSS_IP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_TCP | RTE_ETH_RSS_SCTP; if (devinfo->flow_type_rss_offloads) { rss_hf &= devinfo->flow_type_rss_offloads; } port_conf.lpbk_mode = 1; - port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; + port_conf.rxmode.mq_mode = RTE_ETH_MQ_RX_RSS; port_conf.rxmode.mtu = PmdRing::kDefaultFrameSize; port_conf.rxmode.max_lro_pkt_size = PmdRing::kDefaultFrameSize; - port_conf.rxmode.split_hdr_size = 0; const auto rx_offload_capa = devinfo->rx_offload_capa; port_conf.rxmode.offloads |= ((RTE_ETH_RX_OFFLOAD_CHECKSUM)&rx_offload_capa); @@ -60,21 +59,21 @@ static rte_eth_conf DefaultEthConf(const rte_eth_dev_info *devinfo) { }; const auto tx_offload_capa = devinfo->tx_offload_capa; - if (!(tx_offload_capa & DEV_TX_OFFLOAD_IPV4_CKSUM) || - !(tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM)) { + if (!(tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) || + !(tx_offload_capa & RTE_ETH_TX_OFFLOAD_UDP_CKSUM)) { // Making this fatal; not sure what NIC does not support checksum offloads. LOG(FATAL) << "Hardware does not support checksum offloads."; } - port_conf.txmode.mq_mode = ETH_MQ_TX_NONE; + port_conf.txmode.mq_mode = RTE_ETH_MQ_TX_NONE; port_conf.txmode.offloads = - (DEV_TX_OFFLOAD_IPV4_CKSUM | DEV_TX_OFFLOAD_UDP_CKSUM); + (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | RTE_ETH_TX_OFFLOAD_UDP_CKSUM); - if (tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) { + if (tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) { // TODO(ilias): Add option to the constructor to enable this offload. LOG(WARNING) << "Enabling FAST FREE: use always the same mempool for each queue."; - port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + port_conf.txmode.offloads |= RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; } return port_conf; @@ -100,7 +99,7 @@ void RxRing::Init() { void PmdPort::InitDriver(uint16_t mtu) { if (is_dpdk_primary_process_) { // Get DPDK port info. - FetchDpdkPortInfo(port_id_, &devinfo_, &l2_addr_, &pci_info_); + FetchDpdkPortInfo(port_id_, &devinfo_, &l2_addr_); device_ = devinfo_.device; if (std::string(devinfo_.driver_name) == "net_netvsc") { @@ -115,9 +114,7 @@ void PmdPort::InitDriver(uint16_t mtu) { // Get DPDK port info. struct rte_eth_dev_info vf_devinfo_; struct net::Ethernet::Address vf_l2_addr_; - std::string vf_pci_info_; - FetchDpdkPortInfo(vf_port_id.value(), &vf_devinfo_, &vf_l2_addr_, - &vf_pci_info_); + FetchDpdkPortInfo(vf_port_id.value(), &vf_devinfo_, &vf_l2_addr_); // If the VF is using an 'mlx4*' driver, we need extra checks. if (std::string(vf_devinfo_.driver_name).find("mlx4") != @@ -282,7 +279,7 @@ void PmdPort::InitDriver(uint16_t mtu) { struct rte_eth_link link; memset(&link, '0', sizeof(link)); int nsecs = 30; - while (nsecs-- && link.link_status == ETH_LINK_DOWN) { + while (nsecs-- && link.link_status == RTE_ETH_LINK_DOWN) { memset(&link, '0', sizeof(link)); int ret = rte_eth_link_get_nowait(port_id_, &link); if (ret != 0) { @@ -292,7 +289,7 @@ void PmdPort::InitDriver(uint16_t mtu) { sleep(1); } - if (link.link_status == ETH_LINK_UP) { + if (link.link_status == RTE_ETH_LINK_UP) { LOG(INFO) << "[PMDPORT: " << static_cast(port_id_) << "] " << "Link is UP " << link.link_speed << (link.link_autoneg ? " (AutoNeg)" : " (Fixed)") @@ -302,7 +299,7 @@ void PmdPort::InitDriver(uint16_t mtu) { << "Link is DOWN."; } } else { - FetchDpdkPortInfo(port_id_, &devinfo_, &l2_addr_, &pci_info_); + FetchDpdkPortInfo(port_id_, &devinfo_, &l2_addr_); // For the rings, just set port and queue IDs here, which have been // pre-initialized by the DPDK primary process diff --git a/src/include/channel.h b/src/include/channel.h index 0b535325..ea6ab856 100644 --- a/src/include/channel.h +++ b/src/include/channel.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/src/include/dpdk.h b/src/include/dpdk.h index 35bec447..ffdd1928 100644 --- a/src/include/dpdk.h +++ b/src/include/dpdk.h @@ -5,7 +5,7 @@ #include #include #include -#include + #include #include @@ -18,7 +18,8 @@ namespace dpdk { [[maybe_unused]] static void FetchDpdkPortInfo( uint8_t port_id, struct rte_eth_dev_info *devinfo, - juggler::net::Ethernet::Address *lladdr, std::string *pci_string) { + juggler::net::Ethernet::Address *lladdr) { + if (!rte_eth_dev_is_valid_port(port_id)) { LOG(INFO) << "Port id " << static_cast(port_id) << " is not valid."; return; @@ -36,21 +37,11 @@ namespace dpdk { rte_eth_macaddr_get(port_id, reinterpret_cast(lladdr->bytes)); - struct rte_bus *bus = rte_bus_find_by_device(devinfo->device); - if (bus && !strcmp(bus->name, "pci")) { - const struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(devinfo->device); - *pci_string = juggler::utils::Format( - "%08x:%02hhx:%02hhx.%02hhx %04hx:%04hx", pci_dev->addr.domain, - pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function, - pci_dev->id.vendor_id, pci_dev->id.device_id); - } - LOG(INFO) << "[PMDPORT] [port_id: " << static_cast(port_id) << ", driver: " << devinfo->driver_name << ", RXQ: " << devinfo->max_rx_queues << ", TXQ: " << devinfo->max_tx_queues - << ", l2addr: " << lladdr->ToString() - << ", pci_info: " << *pci_string << "]"; + << ", l2addr: " << lladdr->ToString() << "]"; } [[maybe_unused]] static std::optional FindSlaveVfPortId( @@ -59,7 +50,7 @@ namespace dpdk { std::string pci_info; juggler::net::Ethernet::Address lladdr; - FetchDpdkPortInfo(port_id, &devinfo, &lladdr, &pci_info); + FetchDpdkPortInfo(port_id, &devinfo, &lladdr); uint16_t slave_port_id = 0; while (slave_port_id < RTE_MAX_ETHPORTS) { @@ -73,10 +64,8 @@ namespace dpdk { } struct rte_eth_dev_info slave_devinfo; - std::string slave_pci_info; juggler::net::Ethernet::Address slave_lladdr; - FetchDpdkPortInfo(slave_port_id, &slave_devinfo, &slave_lladdr, - &slave_pci_info); + FetchDpdkPortInfo(slave_port_id, &slave_devinfo, &slave_lladdr); if (slave_lladdr == lladdr) { return slave_port_id; } @@ -97,7 +86,7 @@ namespace dpdk { std::string pci_info; juggler::net::Ethernet::Address lladdr; - FetchDpdkPortInfo(port_id, &devinfo, &lladdr, &pci_info); + FetchDpdkPortInfo(port_id, &devinfo, &lladdr); } } diff --git a/src/include/pmd.h b/src/include/pmd.h index 76f08906..222199f9 100644 --- a/src/include/pmd.h +++ b/src/include/pmd.h @@ -475,7 +475,6 @@ class PmdPort { std::vector rss_reta_conf_; struct rte_eth_stats port_stats_; std::vector rss_hash_key_; - std::string pci_info_; bool initialized_; }; } // namespace dpdk