[ovs-dev,Branch2.7] netdev-dpdk: Fix failure to configure flow control at netdev-init.

Message ID 20180809122128.4267-1-sugesh.chandran@intel.com
State New
Delegated to: Ian Stokes
Headers show
Series
  • [ovs-dev,Branch2.7] netdev-dpdk: Fix failure to configure flow control at netdev-init.
Related show

Commit Message

Chandran, Sugesh Aug. 9, 2018, 12:21 p.m.
This patch backports the commit from the latest OVS master to OVS-2.7.

Configuring flow control at ixgbe netdev-init is throwing error in port
start.
For eg: without this fix, user cannot configure flow control on ixgbe dpdk
port as below,

"
    ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk \
        options:dpdk-devargs=0000:05:00.1 options:rx-flow-ctrl=true
"

Instead,  it must be configured as two different commands,

"
    ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk \
               options:dpdk-devargs=0000:05:00.1
    ovs-vsctl set Interface dpdk0 options:rx-flow-ctrl=true
"

The DPDK ixgbe driver is now validating all the 'rte_eth_fc_conf' fields before
trying to configuring the dpdk ethdev. Hence OVS can no longer set the
'dont care' fields to just '0' as before. This commit make sure all the
'rte_eth_fc_conf' fields are populated with default values before the dev
init.
Also to avoid read error on unsupported ports, the flow control parameters
are now read only when user is trying to configure/update it.

Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
---
 lib/netdev-dpdk.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index d82c9e2ae..5d3867508 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -830,14 +830,6 @@  dpdk_eth_dev_init(struct netdev_dpdk *dev)
 
     mbp_priv = rte_mempool_get_priv(dev->dpdk_mp->mp);
     dev->buf_size = mbp_priv->mbuf_data_room_size - RTE_PKTMBUF_HEADROOM;
-
-    /* Get the Flow control configuration for DPDK-ETH */
-    diag = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf);
-    if (diag) {
-        VLOG_DBG("cannot get flow control parameters on port=%d, err=%d",
-                 dev->port_id, diag);
-    }
-
     return 0;
 }
 
@@ -1306,6 +1298,11 @@  netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
 
     fc_mode = fc_mode_set[tx_fc_en][rx_fc_en];
     if (dev->fc_conf.mode != fc_mode || autoneg != dev->fc_conf.autoneg) {
+        err = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf);
+        if (err) {
+            VLOG_WARN("Cannot get flow control parameters on port "
+                "%"PRIu16", err=%d", dev->port_id, err);
+        }
         dev->fc_conf.mode = fc_mode;
         dev->fc_conf.autoneg = autoneg;
         dpdk_eth_flow_ctrl_setup(dev);