diff mbox series

[ovs-dev,branch-2.9,1/1] netdev-dpdk: Fix flow control configuration.

Message ID 1544653108-15964-1-git-send-email-ian.stokes@intel.com
State Accepted
Delegated to: Ian Stokes
Headers show
Series [ovs-dev,branch-2.9,1/1] netdev-dpdk: Fix flow control configuration. | expand

Commit Message

Stokes, Ian Dec. 12, 2018, 10:18 p.m. UTC
From: Sugesh Chandran <sugesh.chandran@intel.com>

Currently devices that do not support configuring flow control via the eth_dev
API (e.g. SRIOV VFs) will fail during configuration setup when the interface
is added even if flow control is not requested. This is due to
rte_eth_dev_flow_ctrl_get() being called regardless of whether a flow
control configuration is required.

Fix this by moving the rte_eth_dev_flow_ctrl_get() call to be part of
the control block that avoids configuring flow control when no change
has occurred.

Fixes: 413c85a24353 ("netdev-dpdk: Fix failure to configure flow control at netdev-init.")
Reported-by: liang-min.wang@intel.com
Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
Co-authored-by: Ian Stokes <ian.stokes@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 lib/netdev-dpdk.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

Comments

Lam, Tiago Jan. 15, 2019, 5:15 p.m. UTC | #1
On 12/12/2018 22:18, Ian Stokes wrote:
> From: Sugesh Chandran <sugesh.chandran@intel.com>
> 
> Currently devices that do not support configuring flow control via the eth_dev
> API (e.g. SRIOV VFs) will fail during configuration setup when the interface
> is added even if flow control is not requested. This is due to
> rte_eth_dev_flow_ctrl_get() being called regardless of whether a flow
> control configuration is required.
> 
> Fix this by moving the rte_eth_dev_flow_ctrl_get() call to be part of
> the control block that avoids configuring flow control when no change
> has occurred.
> 
> Fixes: 413c85a24353 ("netdev-dpdk: Fix failure to configure flow control at netdev-init.")
> Reported-by: liang-min.wang@intel.com
> Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
> Co-authored-by: Ian Stokes <ian.stokes@intel.com>
> Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> ---

Hi Ian,

I've given this a go and it looks good to me. I can see this is already
in master as well, so:
Acked-by: Tiago Lam <tiago.lam@intel.com>
Tested-by: Tiago Lam <tiago.lam@intel.com>

Before the patch I get the error below when trying to add  VF, even
without enabling flow control, as mentioned in a previous thread:
2019-01-15T16:38:17.487Z|00096|netdev|WARN|dpdk0: could not set
configuration (Unknown error -95)
2019-01-15T16:38:17.507Z|00097|netdev_dpdk|INFO|cannot get flow control
parameters on port 1, err=-95

With the patch applied on top of branch-2.9 I no longer see the error,
and OvS receives the packets.

I also run the userspace testsuite and see no regressions.

Tiago.
Stokes, Ian Jan. 16, 2019, 12:24 p.m. UTC | #2
> On 12/12/2018 22:18, Ian Stokes wrote:
> > From: Sugesh Chandran <sugesh.chandran@intel.com>
> >
> > Currently devices that do not support configuring flow control via the
> > eth_dev API (e.g. SRIOV VFs) will fail during configuration setup when
> > the interface is added even if flow control is not requested. This is
> > due to
> > rte_eth_dev_flow_ctrl_get() being called regardless of whether a flow
> > control configuration is required.
> >
> > Fix this by moving the rte_eth_dev_flow_ctrl_get() call to be part of
> > the control block that avoids configuring flow control when no change
> > has occurred.
> >
> > Fixes: 413c85a24353 ("netdev-dpdk: Fix failure to configure flow
> > control at netdev-init.")
> > Reported-by: liang-min.wang@intel.com
> > Signed-off-by: Sugesh Chandran <sugesh.chandran@intel.com>
> > Co-authored-by: Ian Stokes <ian.stokes@intel.com>
> > Signed-off-by: Ian Stokes <ian.stokes@intel.com>
> > ---
> 
> Hi Ian,
> 
> I've given this a go and it looks good to me. I can see this is already in
> master as well, so:
> Acked-by: Tiago Lam <tiago.lam@intel.com>
> Tested-by: Tiago Lam <tiago.lam@intel.com>
> 
> Before the patch I get the error below when trying to add  VF, even
> without enabling flow control, as mentioned in a previous thread:
> 2019-01-15T16:38:17.487Z|00096|netdev|WARN|dpdk0: could not set
> configuration (Unknown error -95) 2019-01-
> 15T16:38:17.507Z|00097|netdev_dpdk|INFO|cannot get flow control parameters
> on port 1, err=-95
> 
> With the patch applied on top of branch-2.9 I no longer see the error, and
> OvS receives the packets.
> 
> I also run the userspace testsuite and see no regressions.
> 
> Tiago.

Thanks for reviewing and testing Tiago. I've pushed this to branch 2.9.

Thanks
Ian
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 762209dbb..428e6e155 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1634,16 +1634,15 @@  netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args,
     autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false);
 
     fc_mode = fc_mode_set[tx_fc_en][rx_fc_en];
-    /* Get the Flow control configuration for DPDK-ETH */
-    err = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf);
-    if (err) {
-        VLOG_INFO("cannot get flow control parameters on port "DPDK_PORT_ID_FMT
-                 ", err=%d", dev->port_id, err);
-    }
-
     if (dev->fc_conf.mode != fc_mode || autoneg != dev->fc_conf.autoneg) {
         dev->fc_conf.mode = fc_mode;
         dev->fc_conf.autoneg = autoneg;
+        /* Get the Flow control configuration for DPDK-ETH */
+        err = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf);
+        if (err) {
+            VLOG_INFO("cannot get flow control parameters on port "
+                      DPDK_PORT_ID_FMT", err=%d", dev->port_id, err);
+        }
         dpdk_eth_flow_ctrl_setup(dev);
     }