bnxt: convert EEE handling to use linkmode bitmaps
PATCH v2 1/1 bnxt: convert EEE handling to use linkmode bitmaps
Convert EEE handling to use linkmode bitmaps. This prepares for removing the legacy bitmaps from struct ethtool_keee. No functional change intended. When replacing _bnxt_fw_to_ethtool_adv_spds() with _bnxt_fw_to_linkmode(), remove the fw_pause argument because it's always passed as 0.
Note:
There's a discussion on whether the underlying implementation is correct, but it's independent of this mechanical conversion w/o functional change.
---
v2:
- add missing conversions
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 21 +++--- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 65 ++++++++----------- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.h | 4 +- 3 files changed, 40 insertions(+), 50 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +11 -10
@@ -10624,7 +10624,7 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)struct ethtool_keee *eee = &bp->eee;u16 fw_speeds =le16_to_cpu (resp->supported_speeds_eee_mode); - eee->supported_u32 =_bnxt_fw_to_ethtool_adv_spds (fw_speeds,0 ); +_bnxt_fw_to_linkmode (eee->supported, fw_speeds); bp->lpi_tmr_lo =le32_to_cpu (resp->tx_lpi_timer_low) &PORT_PHY_QCAPS_RESP_TX_LPI_TIMER_LOW_MASK ; bp->lpi_tmr_hi = le32_to_cpu(resp->valid_tx_lpi_timer_high) &
@@ -10775,8 +10775,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state) eee->eee_active =1 ; fw_speeds =le16_to_cpu ( resp->link_partner_adv_eee_link_speed_mask); - eee->lp_advertised_u32 = -_bnxt_fw_to_ethtool_adv_spds (fw_speeds,0 ); +_bnxt_fw_to_linkmode (eee->lp_advertised, fw_speeds); }/* Pull initial EEE config */
@@ -10786,8 +10785,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state) eee->eee_enabled =1 ; fw_speeds =le16_to_cpu (resp->adv_eee_link_speed_mask); - eee->advertised_u32 = -_bnxt_fw_to_ethtool_adv_spds (fw_speeds,0 ); +_bnxt_fw_to_linkmode (eee->advertised, fw_speeds);if (resp->eee_config_phy_addr &PORT_PHY_QCFG_RESP_EEE_CONFIG_EEE_TX_LPI ) {
@@ -10969,7 +10967,7 @@ static void bnxt_hwrm_set_eee(struct bnxt *bp, flags |=PORT_PHY_CFG_REQ_FLAGS_EEE_TX_LPI_DISABLE ; req->flags |=cpu_to_le32 (flags); - eee_speeds =bnxt_get_fw_auto_link_speeds (eee->advertised_u32); + eee_speeds =bnxt_get_fw_auto_link_speeds (eee->advertised); req->eee_link_speed_mask =cpu_to_le16 (eee_speeds); req->tx_lpi_timer =cpu_to_le32 (eee->tx_lpi_timer); }else {
@@ -11329,15 +11327,18 @@ static bool bnxt_eee_config_ok(struct bnxt *bp)return true;if (eee->eee_enabled) { -u32 advertising = -_bnxt_fw_to_ethtool_adv_spds (link_info->advertising,0 ); +__ETHTOOL_DECLARE_LINK_MODE_MASK (advertising); +__ETHTOOL_DECLARE_LINK_MODE_MASK (tmp); + +_bnxt_fw_to_linkmode (advertising, link_info->advertising);if (!(link_info->autoneg &BNXT_AUTONEG_SPEED )) { eee->eee_enabled =0 ;return false; } -if (eee->advertised_u32 & ~advertising) { - eee->advertised_u32 = advertising & eee->supported_u32; +if (linkmode_andnot (tmp, eee->advertised, advertising)) { +linkmode_and (eee->advertised, advertising, + eee->supported);return false; } }
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +27 -38
126 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.h +2 -2
@@ -46,9 +46,9 @@ struct bnxt_led_cfg {extern const struct ethtool_ops bnxt_ethtool_ops;u32 bnxt_get_rxfh_indir_size (struct net_device *dev); -u32 _bnxt_fw_to_ethtool_adv_spds (u16 ,u8 ); +void _bnxt_fw_to_linkmode (unsigned long *mode,u16 fw_speeds);u32 bnxt_fw_to_ethtool_speed (u16 ); -u16 bnxt_get_fw_auto_link_speeds (u32 ); +u16 bnxt_get_fw_auto_link_speeds (const unsigned long *mode);int bnxt_hwrm_nvm_get_dev_info (struct bnxt *bp,struct hwrm_nvm_get_dev_info_output *nvm_dev_info); int bnxt_hwrm_firmware_reset(struct net_device *dev, u8 proc_type,
Signature · 1 line
2.43.0
Quoted 7 lines · Heiner Kallweit
Convert EEE handling to use linkmode bitmaps. This prepares for removing the legacy bitmaps from struct
ethtool_keee. No functional change intended. When replacing_bnxt_fw_to_ethtool_adv_spds()with_bnxt_fw_to_linkmode(), remove thefw_pauseargument because it's always passed as 0.
Quoted 5 lines
Note:
There's a discussion on whether the underlying implementation is correct, but it's independent of this mechanical conversion w/o functional change.Signed-off-by Heiner Kallweit <[email protected]>
Thanks.
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 11 lines · On Wed, 7 Feb 2024 17:47:35 +0100 you wrote:
Convert EEE handling to use linkmode bitmaps. This prepares for removing the legacy bitmaps from struct
ethtool_keee. No functional change intended. When replacing_bnxt_fw_to_ethtool_adv_spds()with_bnxt_fw_to_linkmode(), remove thefw_pauseargument because it's always passed as 0.Note:
There's a discussion on whether the underlying implementation is correct, but it's independent of this mechanical conversion w/o functional change.[...]
Here is the summary with links:
- [v2,RESUBMIT,net-next] bnxt: convert EEE handling to use linkmode bitmaps
https://git.kernel.org/netdev/net-next/c/6fb5dfee274c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html