aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/buffer.c30
-rw-r--r--src/plugins/dpdk/device/cli.c12
-rw-r--r--src/plugins/dpdk/device/format.c8
-rw-r--r--src/plugins/dpdk/device/init.c83
-rw-r--r--src/plugins/dpdk/ipsec/ipsec.c8
5 files changed, 75 insertions, 66 deletions
diff --git a/src/plugins/dpdk/buffer.c b/src/plugins/dpdk/buffer.c
index 2ce3d87fdff..10646de68a7 100644
--- a/src/plugins/dpdk/buffer.c
+++ b/src/plugins/dpdk/buffer.c
@@ -461,33 +461,33 @@ dpdk_pool_create (vlib_main_t * vm, u8 * pool_name, u32 elt_size,
vlib_physmem_region_t *pr;
dpdk_mempool_private_t priv;
clib_error_t *error = 0;
- u32 size, obj_size;
+ size_t min_chunk_size, align;
+ u32 size;
i32 ret;
uword i;
- obj_size = rte_mempool_calc_obj_size (elt_size, 0, 0);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- size = rte_mempool_xmem_size (num_elts, obj_size, 21, 0);
-#else
- size = rte_mempool_calc_mem_size_helper (num_elts, obj_size, 21);
-#endif
+ mp = rte_mempool_create_empty ((char *) pool_name, num_elts, elt_size,
+ 512, pool_priv_size, numa, 0);
+ if (!mp)
+ return clib_error_return (0, "failed to create %s", pool_name);
+
+ rte_mempool_set_ops_byname (mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
+
+ size = rte_mempool_op_calc_mem_size_default (mp, num_elts, 21,
+ &min_chunk_size, &align);
error = vlib_physmem_region_alloc (vm, (char *) pool_name, size, numa,
VLIB_PHYSMEM_F_HUGETLB |
VLIB_PHYSMEM_F_SHARED, pri);
if (error)
- return error;
+ {
+ rte_mempool_free (mp);
+ return error;
+ }
pr = vlib_physmem_get_region (vm, pri[0]);
- mp = rte_mempool_create_empty ((char *) pool_name, num_elts, elt_size,
- 512, pool_priv_size, numa, 0);
- if (!mp)
- return clib_error_return (0, "failed to create %s", pool_name);
-
- rte_mempool_set_ops_byname (mp, RTE_MBUF_DEFAULT_MEMPOOL_OPS, NULL);
-
/* Call the mempool priv initializer */
priv.mbp_priv.mbuf_data_room_size = VLIB_BUFFER_PRE_DATA_SIZE +
VLIB_BUFFER_DATA_SIZE;
diff --git a/src/plugins/dpdk/device/cli.c b/src/plugins/dpdk/device/cli.c
index 40ec32325e4..cac27dee639 100644
--- a/src/plugins/dpdk/device/cli.c
+++ b/src/plugins/dpdk/device/cli.c
@@ -68,11 +68,7 @@ get_hqos (u32 hw_if_index, u32 subport_id, dpdk_device_t ** xd,
rte_eth_dev_info_get ((*xd)->port_id, &dev_info);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci_dev = dev_info.pci_dev;
-#else
pci_dev = RTE_DEV_TO_PCI (dev_info.device);
-#endif
if (pci_dev)
{ /* bonded interface has no pci info */
@@ -1290,11 +1286,7 @@ set_dpdk_if_hqos_pktfield (vlib_main_t * vm, unformat_input_t * input,
rte_eth_dev_info_get (xd->port_id, &dev_info);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci_dev = dev_info.pci_dev;
-#else
pci_dev = RTE_DEV_TO_PCI (dev_info.device);
-#endif
if (pci_dev)
{ /* bonded interface has no pci info */
@@ -1489,11 +1481,7 @@ show_dpdk_if_hqos (vlib_main_t * vm, unformat_input_t * input,
rte_eth_dev_info_get (xd->port_id, &dev_info);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci_dev = dev_info.pci_dev;
-#else
pci_dev = RTE_DEV_TO_PCI (dev_info.device);
-#endif
if (pci_dev)
{ /* bonded interface has no pci info */
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index afd2a506436..2c9a7d30513 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -250,11 +250,7 @@ format_dpdk_device_name (u8 * s, va_list * args)
}
rte_eth_dev_info_get (i, &dev_info);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci_dev = dev_info.pci_dev;
-#else
pci_dev = RTE_DEV_TO_PCI (dev_info.device);
-#endif
if (pci_dev && dm->devices[i].port_type != VNET_DPDK_PORT_TYPE_FAILSAFE)
ret = format (s, devname_format, device_name, pci_dev->addr.bus,
@@ -529,11 +525,7 @@ format_dpdk_device (u8 * s, va_list * args)
retval = rte_eth_dev_rss_hash_conf_get (xd->port_id, &rss_conf);
if (retval < 0)
clib_warning ("rte_eth_dev_rss_hash_conf_get returned %d", retval);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci = di.pci_dev;
-#else
pci = RTE_DEV_TO_PCI (di.device);
-#endif
if (pci)
s =
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 69a80814987..5dd15ab3c98 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -49,10 +49,6 @@ dpdk_config_main_t dpdk_config_main;
static struct rte_eth_conf port_conf_template = {
.rxmode = {
.split_hdr_size = 0,
- .header_split = 0, /**< Header Split disabled */
- .hw_ip_checksum = 0, /**< IP checksum offload disabled */
- .hw_vlan_filter = 0, /**< VLAN filtering disabled */
- .hw_strip_crc = 0, /**< CRC stripped by hardware */
},
.txmode = {
.mq_mode = ETH_MQ_TX_NONE,
@@ -187,6 +183,18 @@ dpdk_ring_alloc (struct rte_mempool *mp)
return 0;
}
+static int
+dpdk_port_crc_strip_enabled (dpdk_device_t * xd)
+{
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
+ if (xd->port_conf.rxmode.hw_strip_crc)
+#else
+ if (xd->port_conf.rxmode.offloads & DEV_RX_OFFLOAD_CRC_STRIP)
+#endif
+ return 1;
+ return 0;
+}
+
static clib_error_t *
dpdk_lib_init (dpdk_main_t * dm)
{
@@ -227,11 +235,7 @@ dpdk_lib_init (dpdk_main_t * dm)
vec_validate_aligned (dm->devices_by_hqos_cpu, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- nports = rte_eth_dev_count ();
-#else
nports = rte_eth_dev_count_avail ();
-#endif
if (nports < 1)
{
@@ -277,9 +281,6 @@ dpdk_lib_init (dpdk_main_t * dm)
rte_eth_link_get_nowait (i, &l);
rte_eth_dev_info_get (i, &dev_info);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- pci_dev = dev_info.pci_dev;
-#else
if (dev_info.device == 0)
{
clib_warning ("DPDK bug: missing device info. Skipping %s device",
@@ -287,7 +288,6 @@ dpdk_lib_init (dpdk_main_t * dm)
continue;
}
pci_dev = RTE_DEV_TO_PCI (dev_info.device);
-#endif
if (pci_dev) /* bonded interface has no pci info */
{
@@ -317,11 +317,7 @@ dpdk_lib_init (dpdk_main_t * dm)
struct rte_eth_dev_info di = { 0 };
struct rte_pci_device *next_pci_dev;
rte_eth_dev_info_get (i + 1, &di);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- next_pci_dev = di.pci_dev;
-#else
next_pci_dev = di.device ? RTE_DEV_TO_PCI (di.device) : 0;
-#endif
if (pci_dev && next_pci_dev &&
pci_addr.as_u32 != last_pci_addr.as_u32 &&
memcmp (&pci_dev->addr, &next_pci_dev->addr,
@@ -349,15 +345,27 @@ dpdk_lib_init (dpdk_main_t * dm)
if (dm->conf->no_multi_seg)
{
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->tx_conf.txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS;
port_conf_template.rxmode.jumbo_frame = 0;
port_conf_template.rxmode.enable_scatter = 0;
+#else
+ xd->port_conf.txmode.offloads &= ~DEV_TX_OFFLOAD_MULTI_SEGS;
+ xd->port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+ xd->port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_SCATTER;
+#endif
}
else
{
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->tx_conf.txq_flags &= ~ETH_TXQ_FLAGS_NOMULTSEGS;
port_conf_template.rxmode.jumbo_frame = 1;
port_conf_template.rxmode.enable_scatter = 1;
+#else
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
+#endif
xd->flags |= DPDK_DEVICE_FLAG_MAYBE_MULTISEG;
}
@@ -425,7 +433,13 @@ dpdk_lib_init (dpdk_main_t * dm)
if (dm->conf->no_tx_checksum_offload == 0)
{
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->tx_conf.txq_flags &= ~ETH_TXQ_FLAGS_NOXSUMS;
+#else
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_SCTP_CKSUM;
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_CKSUM;
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_UDP_CKSUM;
+#endif
xd->flags |=
DPDK_DEVICE_FLAG_TX_OFFLOAD |
DPDK_DEVICE_FLAG_INTEL_PHDR_CKSUM;
@@ -445,17 +459,29 @@ dpdk_lib_init (dpdk_main_t * dm)
case VNET_DPDK_PMD_IXGBEVF:
case VNET_DPDK_PMD_I40EVF:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_VF;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->port_conf.rxmode.hw_strip_crc = 1;
+#else
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+#endif
break;
case VNET_DPDK_PMD_THUNDERX:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_VF;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->port_conf.rxmode.hw_strip_crc = 1;
+#else
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+#endif
break;
case VNET_DPDK_PMD_ENA:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_VF;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->port_conf.rxmode.enable_scatter = 0;
+#else
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_SCATTER;
+#endif
break;
case VNET_DPDK_PMD_DPAA2:
@@ -473,7 +499,11 @@ dpdk_lib_init (dpdk_main_t * dm)
/* Intel Red Rock Canyon */
case VNET_DPDK_PMD_FM10K:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_SWITCH;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->port_conf.rxmode.hw_strip_crc = 1;
+#else
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+#endif
break;
/* virtio */
@@ -486,7 +516,11 @@ dpdk_lib_init (dpdk_main_t * dm)
/* vmxnet3 */
case VNET_DPDK_PMD_VMXNET3:
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_1G;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->tx_conf.txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS;
+#else
+ xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MULTI_SEGS;
+#endif
break;
case VNET_DPDK_PMD_AF_PACKET:
@@ -625,7 +659,7 @@ dpdk_lib_init (dpdk_main_t * dm)
* MTU calculations. To interop with them increase mru but only
* if the device's settings can support it.
*/
- if (xd->port_conf.rxmode.hw_strip_crc &&
+ if (dpdk_port_crc_strip_enabled (xd) &&
(dev_info.max_rx_pktlen >= (ETHERNET_MAX_PACKET_BYTES +
sizeof (ethernet_header_t) +
4)))
@@ -638,7 +672,7 @@ dpdk_lib_init (dpdk_main_t * dm)
max_rx_frame = ETHERNET_MAX_PACKET_BYTES;
mtu = ETHERNET_MAX_PACKET_BYTES - sizeof (ethernet_header_t);
- if (xd->port_conf.rxmode.hw_strip_crc &&
+ if (dpdk_port_crc_strip_enabled (xd) &&
(dev_info.max_rx_pktlen >= (ETHERNET_MAX_PACKET_BYTES + 4)))
{
max_rx_frame += 4;
@@ -658,7 +692,7 @@ dpdk_lib_init (dpdk_main_t * dm)
mtu = dev_mtu;
max_rx_frame = mtu + sizeof (ethernet_header_t);
- if (xd->port_conf.rxmode.hw_strip_crc)
+ if (dpdk_port_crc_strip_enabled (xd))
{
max_rx_frame += 4;
}
@@ -740,7 +774,14 @@ dpdk_lib_init (dpdk_main_t * dm)
int vlan_off;
vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id);
vlan_off |= ETH_VLAN_STRIP_OFFLOAD;
+#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
xd->port_conf.rxmode.hw_vlan_strip = vlan_off;
+#else
+ if (vlan_off)
+ xd->port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ else
+ xd->port_conf.rxmode.offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+#endif
if (rte_eth_dev_set_vlan_offload (xd->port_id, vlan_off) == 0)
dpdk_log_info ("VLAN strip enabled for interface\n");
else
@@ -1600,11 +1641,7 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
* 2. Set up info and register slave link state change callback handling.
* 3. Set up info for bond interface related CLI support.
*/
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- int nports = rte_eth_dev_count ();
-#else
int nports = rte_eth_dev_count_avail ();
-#endif
if (nports > 0)
{
/* *INDENT-OFF* */
diff --git a/src/plugins/dpdk/ipsec/ipsec.c b/src/plugins/dpdk/ipsec/ipsec.c
index b2d8611cc9c..a7f501f9d9d 100644
--- a/src/plugins/dpdk/ipsec/ipsec.c
+++ b/src/plugins/dpdk/ipsec/ipsec.c
@@ -878,11 +878,7 @@ crypto_create_session_h_pool (vlib_main_t * vm, u8 numa)
pool_name = format (0, "session_h_pool_numa%u%c", numa, 0);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- elt_size = rte_cryptodev_get_header_session_size ();
-#else
elt_size = rte_cryptodev_sym_get_header_session_size ();
-#endif
error =
dpdk_pool_create (vm, pool_name, elt_size, DPDK_CRYPTO_NB_SESS_OBJS,
@@ -922,11 +918,7 @@ crypto_create_session_drv_pool (vlib_main_t * vm, crypto_dev_t * dev)
pool_name = format (0, "session_drv%u_pool_numa%u%c", dev->drv_id, numa, 0);
-#if RTE_VERSION < RTE_VERSION_NUM(18, 5, 0, 0)
- elt_size = rte_cryptodev_get_private_session_size (dev->id);
-#else
elt_size = rte_cryptodev_sym_get_private_session_size (dev->id);
-#endif
error =
dpdk_pool_create (vm, pool_name, elt_size, DPDK_CRYPTO_NB_SESS_OBJS,