diff options
author | Tomasz Konieczny <tomaszx.konieczny@intel.com> | 2019-09-12 12:43:20 +0200 |
---|---|---|
committer | Ilya Maximets <i.maximets@ovn.org> | 2019-11-04 17:20:18 +0100 |
commit | 1bfdf778a909896aa7d4d5c138677bd50aca4121 (patch) | |
tree | e0c0c3cd5716c75b4c92aea0a779b106574d0803 | |
parent | b6bb25fa2d337c4af67c13cdc3c504d15eb97ce3 (diff) | |
download | openvswitch-1bfdf778a909896aa7d4d5c138677bd50aca4121.tar.gz |
netdev-dpdk: Fix flow control not configuring.
Currently OVS is unable to change flow control configuration in DPDK
because new settings are being overwritten by current settings with
rte_eth_dev_flow_ctrl_get(). The fix restores correct order of
operations and at the same time does not trigger error on devices
without flow control support when flow control not requested.
Fixes: 7e1de65e8dfb ("netdev-dpdk: Fix failure to configure flow control at netdev-init.")
Signed-off-by: Tomasz Konieczny <tomaszx.konieczny@intel.com>
Co-authored-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r-- | lib/netdev-dpdk.c | 51 |
1 files changed, 36 insertions, 15 deletions
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 087f936e9..3bedb4cf4 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1213,6 +1213,7 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); bool rx_fc_en, tx_fc_en, autoneg, lsc_interrupt_mode; + bool flow_control_requested = true; enum rte_eth_fc_mode fc_mode; static const enum rte_eth_fc_mode fc_mode_set[2][2] = { {RTE_FC_NONE, RTE_FC_TX_PAUSE}, @@ -1292,32 +1293,52 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, netdev_request_reconfigure(netdev); } + /* Rx checksum offload configuration */ + /* By default the Rx checksum offload is ON */ + rx_chksm_ofld = smap_get_bool(args, "rx-checksum-offload", true); + temp_flag = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) + != 0; + if (temp_flag != rx_chksm_ofld) { + dev->hw_ol_features ^= NETDEV_RX_CHECKSUM_OFFLOAD; + dpdk_eth_checksum_offload_configure(dev); + } + rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false); tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false); autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false); 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); + + if (!smap_get(args, "rx-flow-ctrl") && !smap_get(args, "tx-flow-ctrl") + && !smap_get(args, "flow-ctrl-autoneg")) { + /* FIXME: User didn't ask for flow control configuration. + * For now we'll not print a warning if flow control is not + * supported by the DPDK port. */ + flow_control_requested = false; + } + + /* Get the Flow control configuration. */ + err = -rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf); + if (err) { + if (err == ENOTSUP) { + if (flow_control_requested) { + VLOG_WARN("%s: Flow control is not supported.", + netdev_get_name(netdev)); + } + err = 0; /* Not fatal. */ + } else { + VLOG_WARN("%s: Cannot get flow control parameters: %s", + netdev_get_name(netdev), rte_strerror(err)); } + goto out; + } + + if (dev->fc_conf.mode != fc_mode || autoneg != dev->fc_conf.autoneg) { dev->fc_conf.mode = fc_mode; dev->fc_conf.autoneg = autoneg; dpdk_eth_flow_ctrl_setup(dev); } - /* Rx checksum offload configuration */ - /* By default the Rx checksum offload is ON */ - rx_chksm_ofld = smap_get_bool(args, "rx-checksum-offload", true); - temp_flag = (dev->hw_ol_features & NETDEV_RX_CHECKSUM_OFFLOAD) - != 0; - if (temp_flag != rx_chksm_ofld) { - dev->hw_ol_features ^= NETDEV_RX_CHECKSUM_OFFLOAD; - dpdk_eth_checksum_offload_configure(dev); - } - out: ovs_mutex_unlock(&dev->mutex); ovs_mutex_unlock(&dpdk_mutex); |