[dpdk-dev] [PATCH] net/mlx5: fix inconsistent link status query
Nélio Laranjeiro
nelio.laranjeiro at 6wind.com
Tue Jul 25 11:41:37 CEST 2017
On Tue, Jul 25, 2017 at 01:37:39PM +0530, Gowrishankar wrote:
> From: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
>
> ETHTOOL_GLINKSETTINGS ioctl call in mlx5 pmd returns inconsistent
> link status due to which any application relying on it would not
> function correctly.
>
> Fixes: 188408719888 ("net/mlx5: fix support for newer link speeds")
> Cc: stable at dpdk.org
>
> Signed-off-by: Gowrishankar Muthukrishnan <gowrishankar.m at linux.vnet.ibm.com>
> ---
> v3:
> - stick with C standard for uint32_t
>
> drivers/net/mlx5/mlx5_ethdev.c | 28 ++++++++++++++++++++--------
> 1 file changed, 20 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
> index b70b7b9..01f881e 100644
> --- a/drivers/net/mlx5/mlx5_ethdev.c
> +++ b/drivers/net/mlx5/mlx5_ethdev.c
> @@ -119,6 +119,7 @@ struct ethtool_link_settings {
> #define ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT 38
> #define ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT 39
> #endif
> +#define ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32 (SCHAR_MAX)
As I have another comment about compilation stuff, I would also ask to
remove those extra spaces.
> /**
> * Return private structure associated with an Ethernet device.
> @@ -807,9 +808,12 @@ struct priv *
> mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev, int wait_to_complete)
> {
> struct priv *priv = mlx5_get_priv(dev);
> - struct ethtool_link_settings edata = {
> - .cmd = ETHTOOL_GLINKSETTINGS,
> - };
> + struct {
Misses the __extension__ before struct here.
struct ethtool_link_settings is finishing with a flexible array (e.g.
[0]) which avoids it to be included in another structure as it breaks
the standard.
> + struct ethtool_link_settings edata;
> + uint32_t link_mode_data[3 *
> + ETHTOOL_LINK_MODE_MASK_MAX_KERNEL_NU32];
> + } ecmd;
Please add this __extension__ and it will be good ;)
Thanks,
--
Nélio Laranjeiro
6WIND
More information about the dev
mailing list