[ovs-dev] [PATCH v4] netdev-dpdk: use rte_eth_dev_set_mtu
Mark Kavanagh
mark.b.kavanagh at intel.com
Thu Jul 13 10:10:27 UTC 2017
DPDK provides an API to set the MTU of compatible physical devices -
rte_eth_dev_set_mtu(). Prior to DPDK v16.07 however, this API was not
implemented in some DPDK PMDs (i40e, specifically). To allow the use
of jumbo frames with affected NICs in OvS-DPDK, MTU configuration was
achieved by setting the jumbo frame flag, and corresponding maximum
permitted Rx frame size, in an rte_eth_conf structure for the NIC
port, and subsequently invoking rte_eth_dev_configure() with that
configuration.
However, that method does not set the MTU field of the underlying DPDK
structure (rte_eth_dev) for the corresponding physical device;
consequently, rte_eth_dev_get_mtu() reports the incorrect MTU for an
OvS-DPDK phy device with non-standard MTU.
Resolve this issue by invoking rte_eth_dev_set_mtu() when setting up
or modifying the MTU of a DPDK phy port.
Fixes: 0072e93 ("netdev-dpdk: add support for jumbo frames")
Reported-by: Aaron Conole <aconole at redhat.com>
Reported-by: Vipin Varghese <vipin.varghese at intel.com>
Reviewed-by: Aaron Conole <aconole at redhat.com>
Acked-by: Sugesh Chandran <sugesh.chandran at intel.com>
Acked-by: Darrell Ball <dball at vmware.com>
Tested-by: Sugesh Chandran <sugesh.chandran at intel.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh at intel.com>
---
v4->v3:
- rebase to HEAD of master
- add 'acked-by' tags for S. Chandran, D. Ball
- add 'tested-by' tag for S. Chandran
v3->v2:
- enable scatter_rx explicitly for jumbo MTU
v2->v1:
- add 'reported-by' tag for Aaron Conole
- change VLOG_INFO to VLOG_ERR
lib/netdev-dpdk.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index ea17b97..2194638 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -650,13 +650,12 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
int i;
struct rte_eth_conf conf = port_conf;
+ /* For some NICs (e.g. Niantic), scatter_rx mode needs to be explicitly
+ * enabled. */
if (dev->mtu > ETHER_MTU) {
- conf.rxmode.jumbo_frame = 1;
- conf.rxmode.max_rx_pkt_len = dev->max_packet_len;
- } else {
- conf.rxmode.jumbo_frame = 0;
- conf.rxmode.max_rx_pkt_len = 0;
+ conf.rxmode.enable_scatter = 1;
}
+
conf.rxmode.hw_ip_checksum = (dev->hw_ol_features &
NETDEV_RX_CHECKSUM_OFFLOAD) != 0;
/* A device may report more queues than it makes available (this has
@@ -676,6 +675,13 @@ dpdk_eth_dev_queue_setup(struct netdev_dpdk *dev, int n_rxq, int n_txq)
break;
}
+ diag = rte_eth_dev_set_mtu(dev->port_id, dev->mtu);
+ if (diag) {
+ VLOG_ERR("Interface %s MTU (%d) setup error: %s",
+ dev->up.name, dev->mtu, rte_strerror(-diag));
+ break;
+ }
+
for (i = 0; i < n_txq; i++) {
diag = rte_eth_tx_queue_setup(dev->port_id, i, dev->txq_size,
dev->socket_id, NULL);
--
1.9.3
More information about the dev
mailing list