[ovs-dev] [PATCH v3] netdev-dpdk: Configure flow control only when necessary.

Chandran, Sugesh sugesh.chandran at intel.com
Fri Sep 30 13:42:05 UTC 2016



Regards
_Sugesh


> -----Original Message-----
> From: Ilya Maximets [mailto:i.maximets at samsung.com]
> Sent: Friday, September 30, 2016 8:49 AM
> To: dev at openvswitch.org; Daniele Di Proietto <diproiettod at vmware.com>;
> Chandran, Sugesh <sugesh.chandran at intel.com>
> Cc: Dyasly Sergey <s.dyasly at samsung.com>; Heetae Ahn
> <heetae82.ahn at samsung.com>; Bodireddy, Bhanuprakash
> <bhanuprakash.bodireddy at intel.com>; Loftus, Ciara
> <ciara.loftus at intel.com>; Ilya Maximets <i.maximets at samsung.com>
> Subject: [PATCH v3] netdev-dpdk: Configure flow control only when
> necessary.
> 
> It is not necessary to touch the physical device each time, if the configuration
> has not been changed. Also, few style issues fixed.
> 
> Thread-safety annotation added to 'dpdk_set_rxq_config()'. It was missed
> while previous refactoring of the flow control configuration.
> 
> Signed-off-by: Ilya Maximets <i.maximets at samsung.com>
> ---
> Note: I guess, that the following tag should be added while applying
>       because v3 is actually just a style fix:
> 
>       'Tested-by: Sugesh Chandran <sugesh.chandran at intel.com>'
> 
>       Of course, If Sugesh has no objections.
[Sugesh] I am fine with it Ilya :)
> 
> Version 3:
> 
> 	* Removed explicit type conversion from 'bool' to 'uint8_t'.
> 	  It's not necessary for results of 'smap_get_bool()' in
> 	  current implementation of this function.
> 
> Version 2:
> 
> 	* Only commit-message updated. (thread-safety annotation)
> 
>  lib/netdev-dpdk.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 3847b1f..a6af4a9
> 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -1077,6 +1077,7 @@ netdev_dpdk_get_config(const struct netdev
> *netdev, struct smap *args)
> 
>  static void
>  dpdk_set_rxq_config(struct netdev_dpdk *dev, const struct smap *args)
> +    OVS_REQUIRES(dev->mutex)
>  {
>      int new_n_rxq;
> 
> @@ -1091,24 +1092,27 @@ static int
>  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;
> +    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},
> +        {RTE_FC_RX_PAUSE, RTE_FC_FULL    }
> +    };
> 
>      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];
> +    autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false);
> 
> -    dpdk_eth_flow_ctrl_setup(dev);
> +    fc_mode = fc_mode_set[tx_fc_en][rx_fc_en];
> +    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);
> +    }
> 
>      ovs_mutex_unlock(&dev->mutex);
> 
> --
> 2.7.4




More information about the dev mailing list