Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
ethtool: add suffix _u32 to legacy bitmap members of struct ethtool_keee
Browse files Browse the repository at this point in the history
This is in preparation of using the existing names for linkmode
bitmaps.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
hkallweit authored and davem330 committed Jan 31, 2024
1 parent 285cc15 commit 1d756ff
Show file tree
Hide file tree
Showing 17 changed files with 116 additions and 116 deletions.
8 changes: 4 additions & 4 deletions drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,14 +713,14 @@ static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_keee *eee)
if (err < 0)
return err;

eee->supported = eee_mask_to_ethtool_mask(supported_rates);
eee->supported_u32 = eee_mask_to_ethtool_mask(supported_rates);

if (aq_nic->aq_nic_cfg.eee_speeds)
eee->advertised = eee->supported;
eee->advertised_u32 = eee->supported_u32;

eee->lp_advertised = eee_mask_to_ethtool_mask(rate);
eee->lp_advertised_u32 = eee_mask_to_ethtool_mask(rate);

eee->eee_enabled = !!eee->advertised;
eee->eee_enabled = !!eee->advertised_u32;

eee->tx_lpi_enabled = eee->eee_enabled;
if ((supported_rates & rate) & AQ_NIC_RATE_EEE_MSK)
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2120,14 +2120,14 @@ static int bnx2x_get_eee(struct net_device *dev, struct ethtool_keee *edata)

eee_cfg = bp->link_vars.eee_status;

edata->supported =
edata->supported_u32 =
bnx2x_eee_to_adv((eee_cfg & SHMEM_EEE_SUPPORTED_MASK) >>
SHMEM_EEE_SUPPORTED_SHIFT);

edata->advertised =
edata->advertised_u32 =
bnx2x_eee_to_adv((eee_cfg & SHMEM_EEE_ADV_STATUS_MASK) >>
SHMEM_EEE_ADV_STATUS_SHIFT);
edata->lp_advertised =
edata->lp_advertised_u32 =
bnx2x_eee_to_adv((eee_cfg & SHMEM_EEE_LP_ADV_STATUS_MASK) >>
SHMEM_EEE_LP_ADV_STATUS_SHIFT);

Expand Down Expand Up @@ -2162,7 +2162,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_keee *edata)
return -EOPNOTSUPP;
}

advertised = bnx2x_adv_to_eee(edata->advertised,
advertised = bnx2x_adv_to_eee(edata->advertised_u32,
SHMEM_EEE_ADV_STATUS_SHIFT);
if ((advertised != (eee_cfg & SHMEM_EEE_ADV_STATUS_MASK))) {
DP(BNX2X_MSG_ETHTOOL,
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = _bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);
eee->supported_u32 = _bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);
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) &
Expand Down Expand Up @@ -10775,7 +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 =
eee->lp_advertised_u32 =
_bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);
}

Expand All @@ -10786,7 +10786,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 =
eee->advertised_u32 =
_bnxt_fw_to_ethtool_adv_spds(fw_speeds, 0);

if (resp->eee_config_phy_addr &
Expand Down Expand Up @@ -10969,7 +10969,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);
eee_speeds = bnxt_get_fw_auto_link_speeds(eee->advertised_u32);
req->eee_link_speed_mask = cpu_to_le16(eee_speeds);
req->tx_lpi_timer = cpu_to_le32(eee->tx_lpi_timer);
} else {
Expand Down Expand Up @@ -11336,8 +11336,8 @@ static bool bnxt_eee_config_ok(struct bnxt *bp)
eee->eee_enabled = 0;
return false;
}
if (eee->advertised & ~advertising) {
eee->advertised = advertising & eee->supported;
if (eee->advertised_u32 & ~advertising) {
eee->advertised_u32 = advertising & eee->supported_u32;
return false;
}
}
Expand Down
14 changes: 7 additions & 7 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3919,16 +3919,16 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_keee *edata)
edata->tx_lpi_timer = eee->tx_lpi_timer;
}
}
if (!edata->advertised) {
edata->advertised = advertising & eee->supported;
} else if (edata->advertised & ~advertising) {
if (!edata->advertised_u32) {
edata->advertised_u32 = advertising & eee->supported_u32;
} else if (edata->advertised_u32 & ~advertising) {
netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
edata->advertised, advertising);
edata->advertised_u32, advertising);
rc = -EINVAL;
goto eee_exit;
}

eee->advertised = edata->advertised;
eee->advertised_u32 = edata->advertised_u32;
eee->tx_lpi_enabled = edata->tx_lpi_enabled;
eee->tx_lpi_timer = edata->tx_lpi_timer;
eee_ok:
Expand All @@ -3954,12 +3954,12 @@ static int bnxt_get_eee(struct net_device *dev, struct ethtool_keee *edata)
/* Preserve tx_lpi_timer so that the last value will be used
* by default when it is re-enabled.
*/
edata->advertised = 0;
edata->advertised_u32 = 0;
edata->tx_lpi_enabled = 0;
}

if (!bp->eee.eee_active)
edata->lp_advertised = 0;
edata->lp_advertised_u32 = 0;

return 0;
}
Expand Down
22 changes: 11 additions & 11 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2362,13 +2362,13 @@ static void tg3_eee_pull_config(struct tg3 *tp, struct ethtool_keee *eee)
/* Pull lp advertised settings */
if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_LPABLE, &val))
return;
dest->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(val);
dest->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val);

/* Pull advertised and eee_enabled settings */
if (tg3_phy_cl45_read(tp, MDIO_MMD_AN, MDIO_AN_EEE_ADV, &val))
return;
dest->eee_enabled = !!val;
dest->advertised = mmd_eee_adv_to_ethtool_adv_t(val);
dest->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(val);

/* Pull tx_lpi_enabled */
val = tr32(TG3_CPMU_EEE_MODE);
Expand Down Expand Up @@ -4364,9 +4364,9 @@ static int tg3_phy_autoneg_cfg(struct tg3 *tp, u32 advertise, u32 flowctrl)

if (!tp->eee.eee_enabled) {
val = 0;
tp->eee.advertised = 0;
tp->eee.advertised_u32 = 0;
} else {
tp->eee.advertised = advertise &
tp->eee.advertised_u32 = advertise &
(ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Full);
}
Expand Down Expand Up @@ -4626,13 +4626,13 @@ static bool tg3_phy_eee_config_ok(struct tg3 *tp)
tg3_eee_pull_config(tp, &eee);

if (tp->eee.eee_enabled) {
if (tp->eee.advertised != eee.advertised ||
if (tp->eee.advertised_u32 != eee.advertised_u32 ||
tp->eee.tx_lpi_timer != eee.tx_lpi_timer ||
tp->eee.tx_lpi_enabled != eee.tx_lpi_enabled)
return false;
} else {
/* EEE is disabled but we're advertising */
if (eee.advertised)
if (eee.advertised_u32)
return false;
}

Expand Down Expand Up @@ -14189,7 +14189,7 @@ static int tg3_set_eee(struct net_device *dev, struct ethtool_keee *edata)
return -EOPNOTSUPP;
}

if (edata->advertised != tp->eee.advertised) {
if (edata->advertised_u32 != tp->eee.advertised_u32) {
netdev_warn(tp->dev,
"Direct manipulation of EEE advertisement is not supported\n");
return -EINVAL;
Expand Down Expand Up @@ -15655,10 +15655,10 @@ static int tg3_phy_probe(struct tg3 *tp)
tg3_chip_rev_id(tp) != CHIPREV_ID_57765_A0))) {
tp->phy_flags |= TG3_PHYFLG_EEE_CAP;

tp->eee.supported = SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full;
tp->eee.advertised = ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Full;
tp->eee.supported_u32 = SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full;
tp->eee.advertised_u32 = ADVERTISED_100baseT_Full |
ADVERTISED_1000baseT_Full;
tp->eee.eee_enabled = 1;
tp->eee.tx_lpi_enabled = 1;
tp->eee.tx_lpi_timer = TG3_CPMU_DBTMR1_LNKIDLE_2047US;
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/intel/e1000e/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2223,16 +2223,16 @@ static int e1000e_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
ret_val = e1000_read_emi_reg_locked(hw, cap_addr, &phy_data);
if (ret_val)
goto release;
edata->supported = mmd_eee_cap_to_ethtool_sup_t(phy_data);
edata->supported_u32 = mmd_eee_cap_to_ethtool_sup_t(phy_data);

/* EEE Advertised */
edata->advertised = mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert);
edata->advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert);

/* EEE Link Partner Advertised */
ret_val = e1000_read_emi_reg_locked(hw, lpa_addr, &phy_data);
if (ret_val)
goto release;
edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data);

/* EEE PCS Status */
ret_val = e1000_read_emi_reg_locked(hw, pcs_stat_addr, &phy_data);
Expand Down Expand Up @@ -2283,12 +2283,12 @@ static int e1000e_set_eee(struct net_device *netdev, struct ethtool_keee *edata)
return -EINVAL;
}

if (edata->advertised & ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) {
if (edata->advertised_u32 & ~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL)) {
e_err("EEE advertisement supports only 100TX and/or 1000T full-duplex\n");
return -EINVAL;
}

adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32);

hw->dev_spec.ich8lan.eee_disable = !edata->eee_enabled;

Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/intel/i40e/i40e_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -5664,16 +5664,16 @@ static int i40e_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
if (phy_cfg.eee_capability == 0)
return -EOPNOTSUPP;

edata->supported = SUPPORTED_Autoneg;
edata->lp_advertised = edata->supported;
edata->supported_u32 = SUPPORTED_Autoneg;
edata->lp_advertised_u32 = edata->supported_u32;

/* Get current configuration */
status = i40e_aq_get_phy_capabilities(hw, false, false, &phy_cfg, NULL);
if (status)
return -EAGAIN;

edata->advertised = phy_cfg.eee_capability ? SUPPORTED_Autoneg : 0U;
edata->eee_enabled = !!edata->advertised;
edata->advertised_u32 = phy_cfg.eee_capability ? SUPPORTED_Autoneg : 0U;
edata->eee_enabled = !!edata->advertised_u32;
edata->tx_lpi_enabled = pf->stats.tx_lpi_status;

edata->eee_active = pf->stats.tx_lpi_status && pf->stats.rx_lpi_status;
Expand All @@ -5691,7 +5691,7 @@ static int i40e_is_eee_param_supported(struct net_device *netdev,
u32 value;
const char *name;
} param[] = {
{edata->advertised & ~SUPPORTED_Autoneg, "advertise"},
{edata->advertised_u32 & ~SUPPORTED_Autoneg, "advertise"},
{edata->tx_lpi_timer, "tx-timer"},
{edata->tx_lpi_enabled != pf->stats.tx_lpi_status, "tx-lpi"}
};
Expand Down
20 changes: 10 additions & 10 deletions drivers/net/ethernet/intel/igb/igb_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3038,10 +3038,10 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
(hw->phy.media_type != e1000_media_type_copper))
return -EOPNOTSUPP;

edata->supported = (SUPPORTED_1000baseT_Full |
SUPPORTED_100baseT_Full);
edata->supported_u32 = (SUPPORTED_1000baseT_Full |
SUPPORTED_100baseT_Full);
if (!hw->dev_spec._82575.eee_disable)
edata->advertised =
edata->advertised_u32 =
mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert);

/* The IPCNFG and EEER registers are not supported on I354. */
Expand All @@ -3068,7 +3068,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
if (ret_val)
return -ENODATA;

edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data);
break;
case e1000_i354:
case e1000_i210:
Expand All @@ -3079,7 +3079,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
if (ret_val)
return -ENODATA;

edata->lp_advertised = mmd_eee_adv_to_ethtool_adv_t(phy_data);
edata->lp_advertised_u32 = mmd_eee_adv_to_ethtool_adv_t(phy_data);

break;
default:
Expand All @@ -3099,7 +3099,7 @@ static int igb_get_eee(struct net_device *netdev, struct ethtool_keee *edata)
edata->eee_enabled = false;
edata->eee_active = false;
edata->tx_lpi_enabled = false;
edata->advertised &= ~edata->advertised;
edata->advertised_u32 &= ~edata->advertised_u32;
}

return 0;
Expand Down Expand Up @@ -3138,22 +3138,22 @@ static int igb_set_eee(struct net_device *netdev,
return -EINVAL;
}

if (!edata->advertised || (edata->advertised &
if (!edata->advertised_u32 || (edata->advertised_u32 &
~(ADVERTISE_100_FULL | ADVERTISE_1000_FULL))) {
dev_err(&adapter->pdev->dev,
"EEE Advertisement supports only 100Tx and/or 100T full duplex\n");
return -EINVAL;
}
adv100m_eee = !!(edata->advertised & ADVERTISE_100_FULL);
adv1g_eee = !!(edata->advertised & ADVERTISE_1000_FULL);
adv100m_eee = !!(edata->advertised_u32 & ADVERTISE_100_FULL);
adv1g_eee = !!(edata->advertised_u32 & ADVERTISE_1000_FULL);

} else if (!edata->eee_enabled) {
dev_err(&adapter->pdev->dev,
"Setting EEE options are not supported with EEE disabled\n");
return -EINVAL;
}

adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32);
if (hw->dev_spec._82575.eee_disable != !edata->eee_enabled) {
hw->dev_spec._82575.eee_disable = !edata->eee_enabled;
adapter->flags |= IGB_FLAG_EEE;
Expand Down
12 changes: 6 additions & 6 deletions drivers/net/ethernet/intel/igc/igc_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1630,11 +1630,11 @@ static int igc_ethtool_get_eee(struct net_device *netdev,
u32 eeer;

if (hw->dev_spec._base.eee_enable)
edata->advertised =
edata->advertised_u32 =
mmd_eee_adv_to_ethtool_adv_t(adapter->eee_advert);

*edata = adapter->eee;
edata->supported = SUPPORTED_Autoneg;
edata->supported_u32 = SUPPORTED_Autoneg;

eeer = rd32(IGC_EEER);

Expand All @@ -1647,8 +1647,8 @@ static int igc_ethtool_get_eee(struct net_device *netdev,

edata->eee_enabled = hw->dev_spec._base.eee_enable;

edata->advertised = SUPPORTED_Autoneg;
edata->lp_advertised = SUPPORTED_Autoneg;
edata->advertised_u32 = SUPPORTED_Autoneg;
edata->lp_advertised_u32 = SUPPORTED_Autoneg;

/* Report correct negotiated EEE status for devices that
* wrongly report EEE at half-duplex
Expand All @@ -1657,7 +1657,7 @@ static int igc_ethtool_get_eee(struct net_device *netdev,
edata->eee_enabled = false;
edata->eee_active = false;
edata->tx_lpi_enabled = false;
edata->advertised &= ~edata->advertised;
edata->advertised_u32 &= ~edata->advertised_u32;
}

return 0;
Expand Down Expand Up @@ -1699,7 +1699,7 @@ static int igc_ethtool_set_eee(struct net_device *netdev,
return -EINVAL;
}

adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised);
adapter->eee_advert = ethtool_adv_to_mmd_eee_adv_t(edata->advertised_u32);
if (hw->dev_spec._base.eee_enable != edata->eee_enabled) {
hw->dev_spec._base.eee_enable = edata->eee_enabled;
adapter->flags |= IGC_FLAG_EEE;
Expand Down
Loading

0 comments on commit 1d756ff

Please sign in to comment.