Skip to contentSkip to conversation

Questions about reporting auto-negotiation capability

dpdk-dev Applied Huisong Li 4 participants 9 messages Mar 29, 2021 – Apr 1, 2021 Network drivers

lore
Share & tools
lore

Huisong Li

author
#0 lore raw

Hi, all

        'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa;  /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

      Most PMD drivers use this field to report the speeds capability supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report

their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on

the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

#1 lore raw

29/03/2021 06:02, Huisong Li:

Quoted 16 lines

Hi, all

'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

Most PMD drivers use this field to report the speeds capability
supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report

their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on

Quoted 6 lines

the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

ETH_LINK_SPEED_AUTONEG is not for capabilities. Anyway, if it is set, it changes nothing (0) in the bitmap. I see mlx5 is wrongly using it.

speed_capa is only for enumerating speeds.

#2 lore raw

29/03/2021 09:03, Thomas Monjalon:

Quoted 16 lines

29/03/2021 06:02, Huisong Li:

Quoted 15 lines

'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

Most PMD drivers use this field to report the speeds capability
supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report
their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on
the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

Quoted 8 lines
Quoted 2 lines

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

ETH_LINK_SPEED_AUTONEG is not for capabilities. Anyway, if it is set, it changes nothing (0) in the bitmap. I see mlx5 is wrongly using it.

speed_capa is only for enumerating speeds.

I see some drivers are advertising ETH_LINK_SPEED_FIXED in speed_capa if the device cannot support autonegotiation.
Should we add a note in doxygen?

author
#3 lore raw
Quoted 19 lines · Thomas Monjalon

29/03/2021 09:03, Thomas Monjalon:

Quoted 18 lines

29/03/2021 06:02, Huisong Li:

Quoted 17 lines

'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

Most PMD drivers use this field to report the speeds capability
supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report
their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on
the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

Quoted 8 lines
Quoted 5 lines

ETH_LINK_SPEED_AUTONEG is not for capabilities. Anyway, if it is set, it changes nothing (0) in the bitmap. I see mlx5 is wrongly using it.

speed_capa is only for enumerating speeds.

I see some drivers are advertising ETH_LINK_SPEED_FIXED in speed_capa if the device cannot support autonegotiation.
Should we add a note in doxygen?

Can we use bit 0 to indicate whether the device supports auto-negotiation?

Like,

1/ If device doesn't support auto-negotiation, set bit(0) of the 'speed_capa' to 1, namely, "speed_capa |= ETH_LINK_SPEED_FIXED".

2/ Other bits of the 'speed_capa' report all the speed capabilities supported by the device regardless of the value of bit(0) .

The above behavior is similar to cxgbe, bnxt, and mlx5. In this way, users can know whether the device supports auto-negotiation

based on bit(0) and detect the supported speed capabilities based on other bits.

After all, this 'speed_capa' and the 'link_speeds' in "rte_eth_conf" struct have different purposes.

Quoted 3 lines

.

#4 lore raw

29/03/2021 13:44, Huisong Li:

Quoted 30 lines · Thomas Monjalon
Quoted 19 lines

29/03/2021 09:03, Thomas Monjalon:

Quoted 18 lines

29/03/2021 06:02, Huisong Li:

Quoted 17 lines

'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

Most PMD drivers use this field to report the speeds capability
supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report
their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on
the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

Quoted 8 lines
Quoted 5 lines

ETH_LINK_SPEED_AUTONEG is not for capabilities. Anyway, if it is set, it changes nothing (0) in the bitmap. I see mlx5 is wrongly using it.

speed_capa is only for enumerating speeds.

I see some drivers are advertising ETH_LINK_SPEED_FIXED in speed_capa if the device cannot support autonegotiation.
Should we add a note in doxygen?

Quoted 6 lines

Can we use bit 0 to indicate whether the device supports auto-negotiation?

Like,

1/ If device doesn't support auto-negotiation, set bit(0) of the 'speed_capa' to 1, namely, "speed_capa |= ETH_LINK_SPEED_FIXED".

Yes I think this is what FIXED means: cannot negotiate.

Quoted 11 lines

2/ Other bits of the 'speed_capa' report all the speed capabilities supported by the device regardless of the value of bit(0) .

The above behavior is similar to cxgbe, bnxt, and mlx5. In this way, users can know whether the device supports auto-negotiation

based on bit(0) and detect the supported speed capabilities based on other bits.

After all, this 'speed_capa' and the 'link_speeds' in "rte_eth_conf" struct have different purposes.

#5 lore raw
In reply to Thomas Monjalon
Quoted 25 lines · Thomas Monjalon

29/03/2021 09:03, Thomas Monjalon:

Quoted 23 lines

29/03/2021 06:02, Huisong Li:

Quoted 15 lines

'speed_capa' in struct rte_eth_dev_info is defined as follows:

uint32_t speed_capa; /**< Supported speeds bitmap (ETH_LINK_SPEED_). */

Most PMD drivers use this field to report the speeds capability
supported by the device to the upper-layer app.

But it seems that few NICs report their auto-negotiation capability through this field. If NIC also uses it to report
their auto-negotiation capability through this field, and should set it to ETH_LINK_SPEED_AUTONEG(0) based on
the definition of ETH_LINK_SPEED_xxx. In this case, it conflicts the report of the speeds capability .

Quoted 2 lines

I don't know how to correctly report the auto-negotiation capability of the device. Thanks for your reply.

ETH_LINK_SPEED_AUTONEG is not for capabilities. Anyway, if it is set, it changes nothing (0) in the bitmap. I see mlx5 is wrongly using it.

Quoted 5 lines
Quoted 1 line

speed_capa is only for enumerating speeds.

I see some drivers are advertising ETH_LINK_SPEED_FIXED in speed_capa if the device cannot support autonegotiation.
Should we add a note in doxygen?

I think we should do that.

Quoted 2 lines
#6 lore raw

PATCH 1/1 drivers/net: remove useless autoneg capability

In reply to Huisong Li

The flag ETH_LINK_SPEED_AUTONEG is 0,
so it cannot be used in a capability bitmap.

Having 0 in speed capability means all speeds are accepted.

---
 drivers/net/bnxt/bnxt_ethdev.c          | 2 --
 drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 ----
 2 files changed, 6 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +0 -2
index f1dd40591f..a2debdbb64 100644
@@ -889,8 +889,6 @@ uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
 	if (bp->link_info->auto_mode ==
 	    HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)
 		speed_capa |= ETH_LINK_SPEED_FIXED;
-	else
-		speed_capa |= ETH_LINK_SPEED_AUTONEG;
 
 	return speed_capa;
 }
drivers/net/mlx5/linux/mlx5_ethdev_os.c +0 -4
index 0e8de9439e..58d56913ae 100644
@@ -409,8 +409,6 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
 	else
 		dev_link.link_speed = link_speed;
 	priv->link_speed_capa = 0;
-	if (edata.supported & SUPPORTED_Autoneg)
-		priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG;
 	if (edata.supported & (SUPPORTED_1000baseT_Full |
 			       SUPPORTED_1000baseKX_Full))
 		priv->link_speed_capa |= ETH_LINK_SPEED_1G;
@@ -517,8 +515,6 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
 	sc = ecmd->link_mode_masks[0] |
 		((uint64_t)ecmd->link_mode_masks[1] << 32);
 	priv->link_speed_capa = 0;
-	if (sc & MLX5_BITSHIFT(ETHTOOL_LINK_MODE_Autoneg_BIT))
-		priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG;
 	if (sc & (MLX5_BITSHIFT(ETHTOOL_LINK_MODE_1000baseT_Full_BIT) |
 		  MLX5_BITSHIFT(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT)))
 		priv->link_speed_capa |= ETH_LINK_SPEED_1G;
Signature · 1 line
2.30.1
Acked-by on v1 1/1
#7 lore raw

Re: [dpdk-dev] [PATCH] drivers/net: remove useless autoneg capability

Quoted 9 lines · Thomas Monjalon

The flag ETH_LINK_SPEED_AUTONEG is 0,
so it cannot be used in a capability bitmap.

Having 0 in speed capability means all speeds are accepted.

---
 drivers/net/bnxt/bnxt_ethdev.c          | 2 --

For bnxt

Quoted 41 lines
 drivers/net/mlx5/linux/mlx5_ethdev_os.c | 4 ----
 2 files changed, 6 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +0 -2
index f1dd40591f..a2debdbb64 100644
@@ -889,8 +889,6 @@ uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
        if (bp->link_info->auto_mode ==
            HWRM_PORT_PHY_QCFG_OUTPUT_AUTO_MODE_NONE)
                speed_capa |= ETH_LINK_SPEED_FIXED;
-       else
-               speed_capa |= ETH_LINK_SPEED_AUTONEG;
 
        return speed_capa;
 }
drivers/net/mlx5/linux/mlx5_ethdev_os.c +0 -5
index 0e8de9439e..58d56913ae 100644
@@ -409,8 +409,6 @@ mlx5_link_update_unlocked_gset(struct rte_eth_dev *dev,
        else
                dev_link.link_speed = link_speed;
        priv->link_speed_capa = 0;
-       if (edata.supported & SUPPORTED_Autoneg)
-               priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG;
        if (edata.supported & (SUPPORTED_1000baseT_Full |
                               SUPPORTED_1000baseKX_Full))
                priv->link_speed_capa |= ETH_LINK_SPEED_1G;
@@ -517,8 +515,6 @@ mlx5_link_update_unlocked_gs(struct rte_eth_dev *dev,
        sc = ecmd->link_mode_masks[0] |
                ((uint64_t)ecmd->link_mode_masks[1] << 32);
        priv->link_speed_capa = 0;
-       if (sc & MLX5_BITSHIFT(ETHTOOL_LINK_MODE_Autoneg_BIT))
-               priv->link_speed_capa |= ETH_LINK_SPEED_AUTONEG;
        if (sc & (MLX5_BITSHIFT(ETHTOOL_LINK_MODE_1000baseT_Full_BIT) |
                  MLX5_BITSHIFT(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT)))
                priv->link_speed_capa |= ETH_LINK_SPEED_1G;
--

2.30.1

Reviewed-by Applied
#8 lore raw

Re: [dpdk-dev] [PATCH] drivers/net: remove useless autoneg capability

Quoted 5 lines · Ajit Khaparde
Quoted 4 lines · Thomas Monjalon

The flag ETH_LINK_SPEED_AUTONEG is 0,
so it cannot be used in a capability bitmap.

Quoted 8 lines
Quoted 5 lines

Having 0 in speed capability means all speeds are accepted.

---
  drivers/net/bnxt/bnxt_ethdev.c          | 2 --

For bnxt

Applied to dpdk-next-net/main, thanks.