Message ID | 1471253779-29872-1-git-send-email-ciara.loftus@intel.com |
---|---|
State | Accepted |
Delegated to: | Daniele Di Proietto |
Headers | show |
Applied to master, thanks 2016-08-15 2:36 GMT-07:00 Ciara Loftus <ciara.loftus@intel.com>: > Only 'dpdk' ports support flow control. This patch stops 'dpdkr' ports > from attempting to initialise this feature as this port type does not > support it. > > Fixes: 9fd39370c12c ("netdev-dpdk: Add Flow Control support.") > Signed-off-by: Ciara Loftus <ciara.loftus@intel.com> > --- > lib/netdev-dpdk.c | 61 ++++++++++++++++++++++++++++++ > ++++++------------------- > 1 file changed, 40 insertions(+), 21 deletions(-) > > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c > index c767fd4..a17db77 100644 > --- a/lib/netdev-dpdk.c > +++ b/lib/netdev-dpdk.c > @@ -1061,34 +1061,53 @@ netdev_dpdk_get_config(const struct netdev > *netdev, struct smap *args) > return 0; > } > > -static int > -netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args) > +static void > +dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args) > { > - struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > int new_n_rxq; > > - ovs_mutex_lock(&dev->mutex); > new_n_rxq = MAX(smap_get_int(args, "n_rxq", dev->requested_n_rxq), 1); > if (new_n_rxq != dev->requested_n_rxq) { > dev->requested_n_rxq = new_n_rxq; > - netdev_request_reconfigure(netdev); > + netdev_request_reconfigure(&dev->up); > } > +} > + > +static int > +netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args) > +{ > + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > + > + ovs_mutex_lock(&dev->mutex); > + > + dpdk_set_rxq_config(dev, args); > + > + /* Flow control support is only available for DPDK Ethernet ports. */ > + bool rx_fc_en = false; > + bool tx_fc_en = false; > + enum rte_eth_fc_mode fc_mode_set[2][2] = > + {{RTE_FC_NONE, RTE_FC_TX_PAUSE}, > + {RTE_FC_RX_PAUSE, RTE_FC_FULL} > + }; > + rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false); > + tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false); > + dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", > false); > + dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en]; > + > + dpdk_eth_flow_ctrl_setup(dev); > > - /* Flow control configuration for DPDK Ethernet ports. */ > - if (dev->type == DPDK_DEV_ETH) { > - bool rx_fc_en = false; > - bool tx_fc_en = false; > - enum rte_eth_fc_mode fc_mode_set[2][2] = > - {{RTE_FC_NONE, > RTE_FC_TX_PAUSE}, > - {RTE_FC_RX_PAUSE, RTE_FC_FULL} > - }; > - rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false); > - tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false); > - dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", > false); > - dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en]; > - > - dpdk_eth_flow_ctrl_setup(dev); > - } > + ovs_mutex_unlock(&dev->mutex); > + > + return 0; > +} > + > +static int > +netdev_dpdk_ring_set_config(struct netdev *netdev, const struct smap > *args) > +{ > + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); > + > + ovs_mutex_lock(&dev->mutex); > + dpdk_set_rxq_config(dev, args); > ovs_mutex_unlock(&dev->mutex); > > return 0; > @@ -3512,7 +3531,7 @@ static const struct netdev_class dpdk_ring_class = > NULL, > netdev_dpdk_ring_construct, > netdev_dpdk_destruct, > - netdev_dpdk_set_config, > + netdev_dpdk_ring_set_config, > netdev_dpdk_set_tx_multiq, > netdev_dpdk_ring_send, > netdev_dpdk_get_carrier, > -- > 2.4.3 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev >
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index c767fd4..a17db77 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1061,34 +1061,53 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args) return 0; } -static int -netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args) +static void +dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args) { - struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); int new_n_rxq; - ovs_mutex_lock(&dev->mutex); new_n_rxq = MAX(smap_get_int(args, "n_rxq", dev->requested_n_rxq), 1); if (new_n_rxq != dev->requested_n_rxq) { dev->requested_n_rxq = new_n_rxq; - netdev_request_reconfigure(netdev); + netdev_request_reconfigure(&dev->up); } +} + +static int +netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + + ovs_mutex_lock(&dev->mutex); + + dpdk_set_rxq_config(dev, args); + + /* Flow control support is only available for DPDK Ethernet ports. */ + bool rx_fc_en = false; + bool tx_fc_en = false; + enum rte_eth_fc_mode fc_mode_set[2][2] = + {{RTE_FC_NONE, RTE_FC_TX_PAUSE}, + {RTE_FC_RX_PAUSE, RTE_FC_FULL} + }; + rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false); + tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false); + dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false); + dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en]; + + dpdk_eth_flow_ctrl_setup(dev); - /* Flow control configuration for DPDK Ethernet ports. */ - if (dev->type == DPDK_DEV_ETH) { - bool rx_fc_en = false; - bool tx_fc_en = false; - enum rte_eth_fc_mode fc_mode_set[2][2] = - {{RTE_FC_NONE, RTE_FC_TX_PAUSE}, - {RTE_FC_RX_PAUSE, RTE_FC_FULL} - }; - rx_fc_en = smap_get_bool(args, "rx-flow-ctrl", false); - tx_fc_en = smap_get_bool(args, "tx-flow-ctrl", false); - dev->fc_conf.autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false); - dev->fc_conf.mode = fc_mode_set[tx_fc_en][rx_fc_en]; - - dpdk_eth_flow_ctrl_setup(dev); - } + ovs_mutex_unlock(&dev->mutex); + + return 0; +} + +static int +netdev_dpdk_ring_set_config(struct netdev *netdev, const struct smap *args) +{ + struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); + + ovs_mutex_lock(&dev->mutex); + dpdk_set_rxq_config(dev, args); ovs_mutex_unlock(&dev->mutex); return 0; @@ -3512,7 +3531,7 @@ static const struct netdev_class dpdk_ring_class = NULL, netdev_dpdk_ring_construct, netdev_dpdk_destruct, - netdev_dpdk_set_config, + netdev_dpdk_ring_set_config, netdev_dpdk_set_tx_multiq, netdev_dpdk_ring_send, netdev_dpdk_get_carrier,
Only 'dpdk' ports support flow control. This patch stops 'dpdkr' ports from attempting to initialise this feature as this port type does not support it. Fixes: 9fd39370c12c ("netdev-dpdk: Add Flow Control support.") Signed-off-by: Ciara Loftus <ciara.loftus@intel.com> --- lib/netdev-dpdk.c | 61 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 21 deletions(-)