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.
---
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.Signed-off-by Heiner Kallweit <[email protected]>
Quoted 9 lines
---
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(-)
This patch has been set to "Not applicable" in patchwork. Why that?
The follow-up discussion with Michael on how exactly certain EEE aspects are handled in the driver is independent of the mechanical conversion in this patch. As stated in the commit message this patch doesn't change functionality.
Jakub Kicinski
maintainerQuoted 6 lines · On Wed, 7 Feb 2024 11:43:39 +0100 Heiner Kallweit wrote:
Quoted 5 lines
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(-)This patch has been set to "Not applicable" in patchwork. Why that?
I'm guessing Dave did that because the conversation on v1 was happening while v2 was already on the list. Repost.
Quoted 10 lines · Jakub Kicinski
Quoted 6 lines · On Wed, 7 Feb 2024 11:43:39 +0100 Heiner Kallweit wrote:
Quoted 5 lines
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(-)This patch has been set to "Not applicable" in patchwork. Why that?
I'm guessing Dave did that because the conversation on v1 was happening while v2 was already on the list. Repost.
OK, done. Thanks