aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/dpdk/device/common.c20
-rw-r--r--src/plugins/dpdk/device/dpdk.h2
-rw-r--r--src/plugins/dpdk/device/format.c156
-rw-r--r--src/plugins/dpdk/device/init.c31
4 files changed, 115 insertions, 94 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index af1108f3d1e..c64f1d0246b 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -43,6 +43,8 @@ dpdk_device_setup (dpdk_device_t * xd)
vnet_main_t *vnm = vnet_get_main ();
vnet_sw_interface_t *sw = vnet_get_sw_interface (vnm, xd->sw_if_index);
vnet_hw_interface_t *hi = vnet_get_hw_interface (vnm, xd->hw_if_index);
+ struct rte_eth_dev_info dev_info;
+ u64 bitmap;
int rv;
int j;
@@ -66,6 +68,24 @@ dpdk_device_setup (dpdk_device_t * xd)
xd->port_conf.fdir_conf.mode = RTE_FDIR_MODE_NONE;
}
+ rte_eth_dev_info_get (xd->port_id, &dev_info);
+
+ bitmap = xd->port_conf.txmode.offloads & ~dev_info.tx_offload_capa;
+ if (bitmap)
+ {
+ dpdk_log_warn ("unsupported tx offloads requested on port %u: %U",
+ xd->port_id, format_dpdk_tx_offload_caps, bitmap);
+ xd->port_conf.txmode.offloads ^= bitmap;
+ }
+
+ bitmap = xd->port_conf.rxmode.offloads & ~dev_info.rx_offload_capa;
+ if (bitmap)
+ {
+ dpdk_log_warn ("unsupported rx offloads requested on port %u: %U",
+ xd->port_id, format_dpdk_rx_offload_caps, bitmap);
+ xd->port_conf.rxmode.offloads ^= bitmap;
+ }
+
rv = rte_eth_dev_configure (xd->port_id, xd->rx_q_used,
xd->tx_q_used, &xd->port_conf);
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index c5a9f94e458..680425bc861 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -513,6 +513,8 @@ format_function_t format_dpdk_rte_mbuf;
format_function_t format_dpdk_rx_rte_mbuf;
format_function_t format_dpdk_flow;
format_function_t format_dpdk_rss_hf_name;
+format_function_t format_dpdk_rx_offload_caps;
+format_function_t format_dpdk_tx_offload_caps;
unformat_function_t unformat_dpdk_log_level;
vnet_flow_dev_ops_function_t dpdk_flow_ops_fn;
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 70306a8bb06..1b0fbb9ffe9 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -69,24 +69,40 @@
_(ETH_RSS_NVGRE, "nvgre")
-#define foreach_dpdk_rx_offload_caps \
- _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \
- _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
- _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
- _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
- _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \
- _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip")
-
-#define foreach_dpdk_tx_offload_caps \
- _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \
- _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
- _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
- _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
- _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \
- _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \
- _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \
- _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \
- _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert")
+#define foreach_dpdk_rx_offload_caps \
+ _(DEV_RX_OFFLOAD_VLAN_STRIP, "vlan-strip") \
+ _(DEV_RX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
+ _(DEV_RX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
+ _(DEV_RX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
+ _(DEV_RX_OFFLOAD_TCP_LRO , "rcp-lro") \
+ _(DEV_RX_OFFLOAD_QINQ_STRIP, "qinq-strip") \
+ _(DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \
+ _(DEV_RX_OFFLOAD_MACSEC_STRIP, "macsec-strip") \
+ _(DEV_RX_OFFLOAD_HEADER_SPLIT, "header-split") \
+ _(DEV_RX_OFFLOAD_VLAN_FILTER, "vlan-filter") \
+ _(DEV_RX_OFFLOAD_VLAN_EXTEND, "vlan-extend") \
+ _(DEV_RX_OFFLOAD_JUMBO_FRAME, "jumbo-frame") \
+ _(DEV_RX_OFFLOAD_CRC_STRIP, "crc-strip") \
+ _(DEV_RX_OFFLOAD_SCATTER, "scatter") \
+ _(DEV_RX_OFFLOAD_TIMESTAMP, "timestamp") \
+ _(DEV_RX_OFFLOAD_SECURITY, "security")
+
+#define foreach_dpdk_tx_offload_caps \
+ _(DEV_TX_OFFLOAD_VLAN_INSERT, "vlan-insert") \
+ _(DEV_TX_OFFLOAD_IPV4_CKSUM, "ipv4-cksum") \
+ _(DEV_TX_OFFLOAD_UDP_CKSUM , "udp-cksum") \
+ _(DEV_TX_OFFLOAD_TCP_CKSUM , "tcp-cksum") \
+ _(DEV_TX_OFFLOAD_SCTP_CKSUM , "sctp-cksum") \
+ _(DEV_TX_OFFLOAD_TCP_TSO , "tcp-tso") \
+ _(DEV_TX_OFFLOAD_UDP_TSO , "udp-tso") \
+ _(DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM, "outer-ipv4-cksum") \
+ _(DEV_TX_OFFLOAD_QINQ_INSERT, "qinq-insert") \
+ _(DEV_TX_OFFLOAD_VXLAN_TNL_TSO, "vxlan-tnl-tso") \
+ _(DEV_TX_OFFLOAD_GRE_TNL_TSO, "gre-tnl-tso") \
+ _(DEV_TX_OFFLOAD_IPIP_TNL_TSO, "ipip-tnl-tso") \
+ _(DEV_TX_OFFLOAD_GENEVE_TNL_TSO, "geneve-tnl-tso") \
+ _(DEV_TX_OFFLOAD_MACSEC_INSERT, "macsec-insert") \
+ _(DEV_TX_OFFLOAD_MT_LOCKFREE, "mt-lockfree") \
#define foreach_dpdk_pkt_rx_offload_flag \
_ (PKT_RX_VLAN, "RX packet is a 802.1q VLAN packet") \
@@ -422,13 +438,10 @@ format_dpdk_link_status (u8 * s, va_list * args)
return s;
}
-#define _line_len 72
#define _(v, str) \
if (bitmap & v) { \
- if (format_get_indent (s) > next_split ) { \
- next_split += _line_len; \
+ if (format_get_indent (s) > 72) \
s = format(s,"\n%U", format_white_space, indent); \
- } \
s = format(s, "%s ", str); \
}
@@ -436,7 +449,6 @@ u8 *
format_dpdk_rss_hf_name (u8 * s, va_list * args)
{
u64 bitmap = va_arg (*args, u64);
- int next_split = _line_len;
u32 indent = format_get_indent (s);
if (!bitmap)
@@ -445,11 +457,10 @@ format_dpdk_rss_hf_name (u8 * s, va_list * args)
foreach_dpdk_rss_hf return s;
}
-static u8 *
+u8 *
format_dpdk_rx_offload_caps (u8 * s, va_list * args)
{
- u32 bitmap = va_arg (*args, u32);
- int next_split = _line_len;
+ u64 bitmap = va_arg (*args, u32);
u32 indent = format_get_indent (s);
if (!bitmap)
@@ -458,11 +469,10 @@ format_dpdk_rx_offload_caps (u8 * s, va_list * args)
foreach_dpdk_rx_offload_caps return s;
}
-static u8 *
+u8 *
format_dpdk_tx_offload_caps (u8 * s, va_list * args)
{
- u32 bitmap = va_arg (*args, u32);
- int next_split = _line_len;
+ u64 bitmap = va_arg (*args, u32);
u32 indent = format_get_indent (s);
if (!bitmap)
return format (s, "none");
@@ -470,7 +480,6 @@ format_dpdk_tx_offload_caps (u8 * s, va_list * args)
foreach_dpdk_tx_offload_caps return s;
}
-#undef _line_len
#undef _
u8 *
@@ -511,16 +520,25 @@ format_dpdk_device (u8 * s, va_list * args)
dpdk_update_counters (xd, now);
dpdk_update_link_state (xd, now);
+ rte_eth_dev_info_get (xd->port_id, &di);
s = format (s, "%U\n%Ucarrier %U",
format_dpdk_device_type, xd->port_id,
format_white_space, indent + 2, format_dpdk_link_status, xd);
s = format (s, "%Uflags: %U\n",
format_white_space, indent + 2, format_dpdk_device_flags, xd);
-
- rte_eth_dev_info_get (xd->port_id, &di);
-
- if (verbose > 1 && xd->flags & DPDK_DEVICE_FLAG_PMD)
+ s = format (s, "%Urx: queues %d (max %d), desc %d "
+ "(min %d max %d align %d)\n",
+ format_white_space, indent + 2, xd->rx_q_used, di.max_rx_queues,
+ xd->nb_rx_desc, di.rx_desc_lim.nb_min, di.rx_desc_lim.nb_max,
+ di.rx_desc_lim.nb_align);
+ s = format (s, "%Utx: queues %d (max %d), desc %d "
+ "(min %d max %d align %d)\n",
+ format_white_space, indent + 2, xd->tx_q_used, di.max_tx_queues,
+ xd->nb_tx_desc, di.tx_desc_lim.nb_min, di.tx_desc_lim.nb_max,
+ di.tx_desc_lim.nb_align);
+
+ if (xd->flags & DPDK_DEVICE_FLAG_PMD)
{
struct rte_pci_device *pci;
struct rte_eth_rss_conf rss_conf;
@@ -534,45 +552,51 @@ format_dpdk_device (u8 * s, va_list * args)
pci = RTE_DEV_TO_PCI (di.device);
if (pci)
- s =
- format (s,
- "%Upci id: device %04x:%04x subsystem %04x:%04x\n"
- "%Upci address: %04x:%02x:%02x.%02x\n",
- format_white_space, indent + 2, pci->id.vendor_id,
- pci->id.device_id, pci->id.subsystem_vendor_id,
- pci->id.subsystem_device_id, format_white_space, indent + 2,
- pci->addr.domain, pci->addr.bus, pci->addr.devid,
- pci->addr.function);
- s =
- format (s, "%Umax rx packet len: %d\n", format_white_space,
- indent + 2, di.max_rx_pktlen);
- s =
- format (s, "%Umax num of queues: rx %d tx %d\n", format_white_space,
- indent + 2, di.max_rx_queues, di.max_tx_queues);
- s =
- format (s, "%Upromiscuous: unicast %s all-multicast %s\n",
- format_white_space, indent + 2,
- rte_eth_promiscuous_get (xd->port_id) ?
- "on" : "off",
- rte_eth_allmulticast_get (xd->port_id) ? "on" : "off");
+ {
+ u8 *s2;
+ if (xd->cpu_socket > -1)
+ s2 = format (0, "%d", xd->cpu_socket);
+ else
+ s2 = format (0, "unknown");
+ s = format (s, "%Upci: device %04x:%04x subsystem %04x:%04x "
+ "address %04x:%02x:%02x.%02x numa %v\n",
+ format_white_space, indent + 2, pci->id.vendor_id,
+ pci->id.device_id, pci->id.subsystem_vendor_id,
+ pci->id.subsystem_device_id, pci->addr.domain,
+ pci->addr.bus, pci->addr.devid, pci->addr.function, s2);
+ vec_free (s2);
+ }
+
+ s = format (s, "%Umax rx packet len: %d\n", format_white_space,
+ indent + 2, di.max_rx_pktlen);
+ s = format (s, "%Upromiscuous: unicast %s all-multicast %s\n",
+ format_white_space, indent + 2,
+ rte_eth_promiscuous_get (xd->port_id) ? "on" : "off",
+ rte_eth_allmulticast_get (xd->port_id) ? "on" : "off");
vlan_off = rte_eth_dev_get_vlan_offload (xd->port_id);
- s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n",
+ s = format (s, "%Uvlan offload: strip %s filter %s qinq %s\n",
format_white_space, indent + 2,
vlan_off & ETH_VLAN_STRIP_OFFLOAD ? "on" : "off",
vlan_off & ETH_VLAN_FILTER_OFFLOAD ? "on" : "off",
vlan_off & ETH_VLAN_EXTEND_OFFLOAD ? "on" : "off");
- s = format (s, "%Urx offload caps: %U\n",
+ s = format (s, "%Urx offload avail: %U\n",
format_white_space, indent + 2,
format_dpdk_rx_offload_caps, di.rx_offload_capa);
- s = format (s, "%Utx offload caps: %U\n",
+ s = format (s, "%Urx offload active: %U\n",
+ format_white_space, indent + 2,
+ format_dpdk_rx_offload_caps, xd->port_conf.rxmode.offloads);
+ s = format (s, "%Utx offload avail: %U\n",
format_white_space, indent + 2,
format_dpdk_tx_offload_caps, di.tx_offload_capa);
- s = format (s, "%Urss active: %U\n"
- "%Urss supported: %U\n",
+ s = format (s, "%Utx offload active: %U\n",
+ format_white_space, indent + 2,
+ format_dpdk_tx_offload_caps, xd->port_conf.txmode.offloads);
+ s = format (s, "%Urss avail: %U\n"
+ "%Urss active: %U\n",
format_white_space, indent + 2,
- format_dpdk_rss_hf_name, rss_conf.rss_hf,
+ format_dpdk_rss_hf_name, di.flow_type_rss_offloads,
format_white_space, indent + 2,
- format_dpdk_rss_hf_name, di.flow_type_rss_offloads);
+ format_dpdk_rss_hf_name, rss_conf.rss_hf);
s = format (s, "%Utx burst function: %s\n",
format_white_space, indent + 2,
ptr2sname (rte_eth_devices[xd->port_id].tx_pkt_burst));
@@ -581,14 +605,6 @@ format_dpdk_device (u8 * s, va_list * args)
ptr2sname (rte_eth_devices[xd->port_id].rx_pkt_burst));
}
- s = format (s, "%Urx queues %d, rx desc %d, tx queues %d, tx desc %d\n",
- format_white_space, indent + 2,
- xd->rx_q_used, xd->nb_rx_desc, xd->tx_q_used, xd->nb_tx_desc);
-
- if (xd->cpu_socket > -1)
- s = format (s, "%Ucpu socket %d\n",
- format_white_space, indent + 2, xd->cpu_socket);
-
/* $$$ MIB counters */
{
#define _(N, V) \
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index bb761c09c61..efa27eb4a01 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -46,17 +46,6 @@ dpdk_config_main_t dpdk_config_main;
/* Port configuration, mildly modified Intel app values */
-#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
-static struct rte_eth_conf port_conf_template = {
- .rxmode = {
- .split_hdr_size = 0,
- },
- .txmode = {
- .mq_mode = ETH_MQ_TX_NONE,
- },
-};
-#endif
-
static dpdk_port_type_t
port_type_from_speed_capa (struct rte_eth_dev_info *dev_info)
{
@@ -285,7 +274,7 @@ dpdk_lib_init (dpdk_main_t * dm)
if (dev_info.device == 0)
{
- clib_warning ("DPDK bug: missing device info. Skipping %s device",
+ clib_warning ("DPDK bug: missing device info. Skipping %s device",
dev_info.driver_name);
continue;
}
@@ -297,9 +286,8 @@ dpdk_lib_init (dpdk_main_t * dm)
pci_addr.bus = pci_dev->addr.bus;
pci_addr.slot = pci_dev->addr.devid;
pci_addr.function = pci_dev->addr.function;
- p =
- hash_get (dm->conf->device_config_index_by_pci_addr,
- pci_addr.as_u32);
+ p = hash_get (dm->conf->device_config_index_by_pci_addr,
+ pci_addr.as_u32);
}
if (p)
@@ -349,8 +337,8 @@ dpdk_lib_init (dpdk_main_t * dm)
{
#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;
+ xd->port_conf.rxmode.jumbo_frame = 0;
+ xd->port_conf.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;
@@ -361,8 +349,8 @@ dpdk_lib_init (dpdk_main_t * dm)
{
#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;
+ xd->port_conf.rxmode.jumbo_frame = 1;
+ xd->port_conf.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;
@@ -371,11 +359,6 @@ dpdk_lib_init (dpdk_main_t * dm)
xd->flags |= DPDK_DEVICE_FLAG_MAYBE_MULTISEG;
}
-#if RTE_VERSION < RTE_VERSION_NUM(18, 8, 0, 0)
- clib_memcpy (&xd->port_conf, &port_conf_template,
- sizeof (struct rte_eth_conf));
-#endif
-
xd->tx_q_used = clib_min (dev_info.max_tx_queues, tm->n_vlib_mains);
if (devconf->num_tx_queues > 0