dpdk: require DPDK 21.11

Raise the minimum supported DPDK version to 21.11 and remove compatibility
paths for older releases, including legacy bond library detection and RSS
configuration. Update the documented version requirement.
pull/16292/head
Lukas Sismis 1 month ago
parent 16e442d59f
commit 9f7bcd5af6

@ -1434,10 +1434,10 @@
fi
AC_DEFINE([HAVE_DPDK],[1],(DPDK support enabled))
PKG_CHECK_EXISTS(libdpdk >= 19.11, , [with_pkgconfig_libdpdk=no])
PKG_CHECK_EXISTS(libdpdk >= 21.11, , [with_pkgconfig_libdpdk=no])
if test "$with_pkgconfig_libdpdk" = "no"; then
echo
echo " ERROR! libdpdk >= 19.11 not found by pkg-config, go get it"
echo " ERROR! libdpdk >= 21.11 not found by pkg-config, go get it"
echo " from https://www.dpdk.org/ or your distribution:"
echo
echo " Ubuntu: apt-get install dpdk-dev"
@ -1452,11 +1452,7 @@
if test ! -z "$(ldconfig -p | grep librte_net_bond)"; then
AC_DEFINE([HAVE_DPDK_BOND],[1],(DPDK Bond PMD support enabled))
enable_dpdk_bond_pmd="yes"
LIBS="${LIBS} -lrte_net_bond" # 20.11+
elif test ! -z "$(ldconfig -p | grep librte_pmd_bond)"; then
AC_DEFINE([HAVE_DPDK_BOND],[1],(DPDK Bond PMD support enabled))
enable_dpdk_bond_pmd="yes"
LIBS="${LIBS} -lrte_pmd_bond"
LIBS="${LIBS} -lrte_net_bond"
else
echo
echo " WARNING: DPDK Bond PMD was not found on your system, "

@ -2526,8 +2526,7 @@ Other NICs using the same driver as mentioned above should work as well.
The DPDK capture interface has not been tested neither with the virtual
interfaces nor in the virtual environments like VMs, Docker or similar.
The minimal supported DPDK is version 19.11 which should be available in most
repositories of major distributions.
The minimal supported DPDK version is 21.11.
Alternatively, it is also possible to use ``meson`` and ``ninja`` to build and
install DPDK from source files.
It is required to have correctly configured tool ``pkg-config`` as it is used to

@ -1331,10 +1331,8 @@ static void DumpRXOffloadCapabilities(const uint64_t rx_offld_capa)
rx_offld_capa & RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM ? "" : "NOT ");
SCLogConfig("RTE_ETH_RX_OFFLOAD_RSS_HASH - %savailable",
rx_offld_capa & RTE_ETH_RX_OFFLOAD_RSS_HASH ? "" : "NOT ");
#if RTE_VERSION >= RTE_VERSION_NUM(20, 11, 0, 0)
SCLogConfig("RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT - %savailable",
rx_offld_capa & RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT ? "" : "NOT ");
#endif
}
static int DeviceValidateMTU(const DPDKIfaceConfig *iconf, const struct rte_eth_dev_info *dev_info)
@ -1347,28 +1345,12 @@ static int DeviceValidateMTU(const DPDKIfaceConfig *iconf, const struct rte_eth_
SCReturnInt(-ERANGE);
}
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
// check if jumbo frames are set and are available
if (iconf->mtu > RTE_ETHER_MAX_LEN &&
!(dev_info->rx_offload_capa & DEV_RX_OFFLOAD_JUMBO_FRAME)) {
SCLogError("%s: jumbo frames not supported, set MTU to 1500", iconf->iface);
SCReturnInt(-EINVAL);
}
#endif
SCReturnInt(0);
}
static void DeviceSetMTU(struct rte_eth_conf *port_conf, uint16_t mtu)
{
#if RTE_VERSION >= RTE_VERSION_NUM(21, 11, 0, 0)
port_conf->rxmode.mtu = mtu;
#else
port_conf->rxmode.max_rx_pkt_len = mtu;
if (mtu > RTE_ETHER_MAX_LEN) {
port_conf->rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
}
#endif
}
static void PortConfSetInterruptMode(const DPDKIfaceConfig *iconf, struct rte_eth_conf *port_conf)

@ -210,12 +210,8 @@ static void DevicePreClosePMDSpecificActions(DPDKThreadVars *ptv, const char *dr
driver_name = BondingDeviceDriverGet(ptv->port_id);
}
if (
#if RTE_VERSION > RTE_VERSION_NUM(20, 0, 0, 0)
strcmp(driver_name, "net_i40e") == 0 ||
#endif /* RTE_VERSION > RTE_VERSION_NUM(20, 0, 0, 0) */
strcmp(driver_name, "net_ixgbe") == 0 || strcmp(driver_name, "net_ice") == 0 ||
strcmp(driver_name, "mlx5_pci") == 0) {
if (strcmp(driver_name, "net_i40e") == 0 || strcmp(driver_name, "net_ixgbe") == 0 ||
strcmp(driver_name, "net_ice") == 0 || strcmp(driver_name, "mlx5_pci") == 0) {
// Flush the RSS rules that have been inserted in the post start section
struct rte_flow_error flush_error = { 0 };
int32_t retval = rte_flow_flush(ptv->port_id, &flush_error);
@ -710,17 +706,10 @@ static TmEcode ReceiveDPDKThreadInit(ThreadVars *tv, const void *initdata, void
}
if (link.link_status) {
char link_status_str[RTE_ETH_LINK_MAX_STR_LEN];
#if RTE_VERSION >= RTE_VERSION_NUM(20, 11, 0, 0)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
rte_eth_link_to_str(link_status_str, sizeof(link_status_str), &link);
#pragma GCC diagnostic pop
#else
snprintf(link_status_str, sizeof(link_status_str),
"Link Up, speed %u Mbps, %s", // 22 chars + 10 for digits + 11 for duplex
link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ? "full-duplex" : "half-duplex");
#endif
SCLogInfo("%s: %s", dpdk_config->iface, link_status_str);
break;

@ -29,24 +29,6 @@
#include "util-dpdk.h"
#include "util-debug.h"
/**
* Determines if the port is Bond or not by evaluating device driver name
* @param pid port ID
* @return 0 - the device si Bond PMD, 1 - regular device, <0 error
*/
int32_t BondingIsBond(uint16_t pid)
{
struct rte_eth_dev_info di;
int32_t ret = rte_eth_dev_info_get(pid, &di);
if (ret < 0) {
SCLogError("%s: unable to get device info (err: %s)", DPDKGetPortNameByPortID(pid),
rte_strerror(-ret));
return ret;
}
return strcmp(di.driver_name, "net_bonding") == 0 ? 0 : 1;
}
uint16_t BondingMemberDevicesGet(
uint16_t bond_pid, uint16_t bonded_devs[], uint16_t bonded_devs_length)
{

@ -29,7 +29,6 @@
#ifdef HAVE_DPDK
int32_t BondingIsBond(uint16_t pid);
uint16_t BondingMemberDevicesGet(
uint16_t bond_pid, uint16_t bonded_devs[], uint16_t bonded_devs_length);
uint32_t BondingMempoolSizeCalculate(

@ -44,80 +44,6 @@
#define RTE_ETH_MQ_RX_RSS ETH_MQ_RX_RSS
#endif
#if RTE_VERSION < RTE_VERSION_NUM(21, 11, 0, 0)
#define RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE DEV_TX_OFFLOAD_MBUF_FAST_FREE
#define RTE_ETH_RX_OFFLOAD_CHECKSUM DEV_RX_OFFLOAD_CHECKSUM
#define RTE_ETH_RX_OFFLOAD_VLAN_STRIP DEV_RX_OFFLOAD_VLAN_STRIP
#define RTE_ETH_RX_OFFLOAD_IPV4_CKSUM DEV_RX_OFFLOAD_IPV4_CKSUM
#define RTE_ETH_RX_OFFLOAD_UDP_CKSUM DEV_RX_OFFLOAD_UDP_CKSUM
#define RTE_ETH_RX_OFFLOAD_TCP_CKSUM DEV_RX_OFFLOAD_TCP_CKSUM
#define RTE_ETH_RX_OFFLOAD_TCP_LRO DEV_RX_OFFLOAD_TCP_LRO
#define RTE_ETH_RX_OFFLOAD_QINQ_STRIP DEV_RX_OFFLOAD_QINQ_STRIP
#define RTE_ETH_RX_OFFLOAD_OUTER_IPV4_CKSUM DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM
#define RTE_ETH_RX_OFFLOAD_MACSEC_STRIP DEV_RX_OFFLOAD_MACSEC_STRIP
#define RTE_ETH_RX_OFFLOAD_HEADER_SPLIT DEV_RX_OFFLOAD_HEADER_SPLIT
#define RTE_ETH_RX_OFFLOAD_VLAN_FILTER DEV_RX_OFFLOAD_VLAN_FILTER
#define RTE_ETH_RX_OFFLOAD_VLAN_EXTEND DEV_RX_OFFLOAD_VLAN_EXTEND
#define RTE_ETH_RX_OFFLOAD_SCATTER DEV_RX_OFFLOAD_SCATTER
#define RTE_ETH_RX_OFFLOAD_TIMESTAMP DEV_RX_OFFLOAD_TIMESTAMP
#define RTE_ETH_RX_OFFLOAD_SECURITY DEV_RX_OFFLOAD_SECURITY
#define RTE_ETH_RX_OFFLOAD_KEEP_CRC DEV_RX_OFFLOAD_KEEP_CRC
#define RTE_ETH_RX_OFFLOAD_SCTP_CKSUM DEV_RX_OFFLOAD_SCTP_CKSUM
#define RTE_ETH_RX_OFFLOAD_OUTER_UDP_CKSUM DEV_RX_OFFLOAD_OUTER_UDP_CKSUM
#define RTE_ETH_RX_OFFLOAD_RSS_HASH DEV_RX_OFFLOAD_RSS_HASH
#define RTE_ETH_MQ_TX_NONE ETH_MQ_TX_NONE
#define RTE_ETH_MQ_RX_NONE ETH_MQ_RX_NONE
#define RTE_ETH_RSS_IP ETH_RSS_IP
#define RTE_ETH_RSS_UDP ETH_RSS_UDP
#define RTE_ETH_RSS_TCP ETH_RSS_TCP
#define RTE_ETH_RSS_SCTP ETH_RSS_SCTP
#define RTE_ETH_RSS_TUNNEL ETH_RSS_TUNNEL
#define RTE_ETH_RSS_L3_SRC_ONLY ETH_RSS_L3_SRC_ONLY
#define RTE_ETH_RSS_L3_DST_ONLY ETH_RSS_L3_DST_ONLY
#define RTE_ETH_RSS_L4_SRC_ONLY ETH_RSS_L4_SRC_ONLY
#define RTE_ETH_RSS_L4_DST_ONLY ETH_RSS_L4_DST_ONLY
#define RTE_ETH_RSS_IPV4 ETH_RSS_IPV4
#define RTE_ETH_RSS_FRAG_IPV4 ETH_RSS_FRAG_IPV4
#define RTE_ETH_RSS_NONFRAG_IPV4_TCP ETH_RSS_NONFRAG_IPV4_TCP
#define RTE_ETH_RSS_NONFRAG_IPV4_UDP ETH_RSS_NONFRAG_IPV4_UDP
#define RTE_ETH_RSS_NONFRAG_IPV4_SCTP ETH_RSS_NONFRAG_IPV4_SCTP
#define RTE_ETH_RSS_NONFRAG_IPV4_OTHER ETH_RSS_NONFRAG_IPV4_OTHER
#define RTE_ETH_RSS_IPV6 ETH_RSS_IPV6
#define RTE_ETH_RSS_FRAG_IPV6 ETH_RSS_FRAG_IPV6
#define RTE_ETH_RSS_NONFRAG_IPV6_TCP ETH_RSS_NONFRAG_IPV6_TCP
#define RTE_ETH_RSS_NONFRAG_IPV6_UDP ETH_RSS_NONFRAG_IPV6_UDP
#define RTE_ETH_RSS_NONFRAG_IPV6_SCTP ETH_RSS_NONFRAG_IPV6_SCTP
#define RTE_ETH_RSS_NONFRAG_IPV6_OTHER ETH_RSS_NONFRAG_IPV6_OTHER
#define RTE_ETH_RSS_L2_PAYLOAD ETH_RSS_L2_PAYLOAD
#define RTE_ETH_RSS_IPV6_EX ETH_RSS_IPV6_EX
#define RTE_ETH_RSS_IPV6_TCP_EX ETH_RSS_IPV6_TCP_EX
#define RTE_ETH_RSS_IPV6_UDP_EX ETH_RSS_IPV6_UDP_EX
#define RTE_ETH_RSS_PORT ETH_RSS_PORT
#define RTE_ETH_RSS_VXLAN ETH_RSS_VXLAN
#define RTE_ETH_RSS_NVGRE ETH_RSS_NVGRE
#define RTE_ETH_RSS_GTPU ETH_RSS_GTPU
#define RTE_MBUF_F_RX_IP_CKSUM_MASK PKT_RX_IP_CKSUM_MASK
#define RTE_MBUF_F_RX_IP_CKSUM_NONE PKT_RX_IP_CKSUM_NONE
#define RTE_MBUF_F_RX_IP_CKSUM_GOOD PKT_RX_IP_CKSUM_GOOD
#define RTE_MBUF_F_RX_IP_CKSUM_BAD PKT_RX_IP_CKSUM_BAD
#define RTE_MBUF_F_RX_L4_CKSUM_MASK PKT_RX_L4_CKSUM_MASK
#define RTE_MBUF_F_RX_L4_CKSUM_GOOD PKT_RX_L4_CKSUM_GOOD
#define RTE_MBUF_F_RX_L4_CKSUM_BAD PKT_RX_L4_CKSUM_BAD
#endif
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
#define RTE_ETH_LINK_MAX_STR_LEN 40
#endif
typedef struct {
struct rte_mempool **pkt_mp;
uint16_t pkt_mp_cnt;

@ -33,145 +33,12 @@
#include "util-dpdk-i40e.h"
#include "util-dpdk.h"
#include "util-debug.h"
#include "util-dpdk-bonding.h"
#include "util-dpdk-rss.h"
#ifdef HAVE_DPDK
#if RTE_VERSION < RTE_VERSION_NUM(21, 0, 0, 0)
#define I40E_RSS_HKEY_LEN 40
#define I40E_RSS_HASH_FUNCTION RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ
#else
#define I40E_RSS_HKEY_LEN 52
#define I40E_RSS_HASH_FUNCTION RTE_ETH_HASH_FUNCTION_TOEPLITZ
#endif // RTE_VERSION < RTE_VERSION_NUM(21, 0, 0, 0)
#if RTE_VERSION < RTE_VERSION_NUM(20, 0, 0, 0)
static int i40eDeviceEnableSymHash(
int port_id, const char *port_name, uint32_t ftype, enum rte_eth_hash_function function)
{
struct rte_eth_hash_filter_info info;
int retval;
uint32_t idx, offset;
memset(&info, 0, sizeof(info));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
retval = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_HASH);
#pragma GCC diagnostic pop
if (retval < 0) {
SCLogError("%s: RTE_ETH_FILTER_HASH not supported", port_name);
return retval;
}
info.info_type = RTE_ETH_HASH_FILTER_GLOBAL_CONFIG;
info.info.global_conf.hash_func = function;
idx = ftype / UINT64_BIT;
offset = ftype % UINT64_BIT;
info.info.global_conf.valid_bit_mask[idx] |= (1ULL << offset);
info.info.global_conf.sym_hash_enable_mask[idx] |= (1ULL << offset);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
retval = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_HASH, RTE_ETH_FILTER_SET, &info);
#pragma GCC diagnostic pop
if (retval < 0) {
SCLogError("%s: cannot set global hash configurations", port_name);
return retval;
}
return 0;
}
static int i40eDeviceSetSymHash(int port_id, const char *port_name, int enable)
{
int ret;
struct rte_eth_hash_filter_info info;
memset(&info, 0, sizeof(info));
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ret = rte_eth_dev_filter_supported(port_id, RTE_ETH_FILTER_HASH);
#pragma GCC diagnostic pop
if (ret < 0) {
SCLogError("%s: RTE_ETH_FILTER_HASH not supported", port_name);
return ret;
}
info.info_type = RTE_ETH_HASH_FILTER_SYM_HASH_ENA_PER_PORT;
info.info.enable = enable;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
ret = rte_eth_dev_filter_ctrl(port_id, RTE_ETH_FILTER_HASH, RTE_ETH_FILTER_SET, &info);
#pragma GCC diagnostic pop
if (ret < 0) {
SCLogError("%s: cannot set symmetric hash enable per port", port_name);
return ret;
}
return 0;
}
static int i40eDeviceApplyRSSFilter(int port_id, const char *port_name)
{
int retval = 0;
// Behavior of RTE_FLOW in DPDK version 19.xx and less is different than on versions
// above. For that reason RSS on i40e driver is set differently.
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_FRAG_IPV4, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV4_TCP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV4_UDP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV4_SCTP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV4_OTHER, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_FRAG_IPV6, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV6_TCP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV6_UDP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV6_SCTP, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceEnableSymHash(
port_id, port_name, RTE_ETH_FLOW_NONFRAG_IPV6_OTHER, RTE_ETH_HASH_FUNCTION_TOEPLITZ);
retval |= i40eDeviceSetSymHash(port_id, port_name, 1);
return retval;
}
static int32_t i40eDeviceSetRSSWithFilter(int port_id, const char *port_name)
{
int32_t ret = BondingIsBond(port_id);
if (ret < 0)
return -ret;
if (ret == 1) { // regular device
i40eDeviceApplyRSSFilter(port_id, port_name);
} else if (ret == 0) { // the device is Bond PMD
uint16_t bonded_devs[RTE_MAX_ETHPORTS];
ret = BondingMemberDevicesGet(port_id, bonded_devs, RTE_MAX_ETHPORTS);
for (int i = 0; i < ret; i++) {
i40eDeviceApplyRSSFilter(bonded_devs[i], port_name);
}
} else {
FatalError("Unknown return value from BondingIsBond()");
}
return 0;
}
#else
static int i40eDeviceSetRSSFlowIPv4(
int port_id, const char *port_name, struct rte_flow_action_rss rss_conf)
@ -297,34 +164,18 @@ static int i40eDeviceSetRSSWithFlows(int port_id, const char *port_name, int nb_
return 0;
}
#endif /* RTE_VERSION < RTE_VERSION_NUM(20,0,0,0) */
int i40eDeviceSetRSS(int port_id, uint16_t nb_rx_queues, char *port_name)
{
(void)nb_rx_queues; // avoid unused variable warnings
#if RTE_VERSION >= RTE_VERSION_NUM(20, 0, 0, 0)
i40eDeviceSetRSSWithFlows(port_id, port_name, nb_rx_queues);
#else
i40eDeviceSetRSSWithFilter(port_id, port_name);
#endif
return 0;
}
void i40eDeviceSetRSSConf(struct rte_eth_rss_conf *rss_conf)
{
#if RTE_VERSION >= RTE_VERSION_NUM(20, 0, 0, 0)
rss_conf->rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_OTHER;
rss_conf->rss_key = NULL;
rss_conf->rss_key_len = 0;
#else
rss_conf->rss_hf =
RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV4_UDP |
RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_FRAG_IPV6 |
RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_NONFRAG_IPV6_UDP |
RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_SCTP;
#endif
}
#endif /* HAVE_DPDK */

@ -34,19 +34,13 @@
#include "util-dpdk.h"
#include "util-dpdk-rss.h"
#include "util-debug.h"
#include "util-dpdk-bonding.h"
#ifdef HAVE_DPDK
static void iceDeviceSetRSSHashFunction(uint64_t *rss_hf)
{
#if RTE_VERSION < RTE_VERSION_NUM(20, 0, 0, 0)
*rss_hf = RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_FRAG_IPV6 |
RTE_ETH_RSS_NONFRAG_IPV6_OTHER;
#else
*rss_hf = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER |
RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_OTHER;
#endif
}
/**

Loading…
Cancel
Save