Skip to content

Commit

Permalink
ethtool: replace struct ethtool_eee with a new struct ethtool_keee on…
Browse files Browse the repository at this point in the history
… kernel side

In order to pass EEE link modes beyond bit 32 to userspace we have to
complement the 32 bit bitmaps in struct ethtool_eee with linkmode
bitmaps. Therefore, similar to ethtool_link_settings and
ethtool_link_ksettings, add a struct ethtool_keee. In a first step
it's an identical copy of ethtool_eee. This patch simply does a
s/ethtool_eee/ethtool_keee/g for all users.
No functional change intended.

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
Heiner Kallweit authored and David S. Miller committed Jan 31, 2024
1 parent 2acfd58 commit d80a523
Show file tree
Hide file tree
Showing 54 changed files with 159 additions and 147 deletions.
10 changes: 5 additions & 5 deletions drivers/net/dsa/b53/b53_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1257,7 +1257,7 @@ static void b53_adjust_link(struct dsa_switch *ds, int port,
struct phy_device *phydev)
{
struct b53_device *dev = ds->priv;
struct ethtool_eee *p = &dev->ports[port].eee;
struct ethtool_keee *p = &dev->ports[port].eee;
u8 rgmii_ctrl = 0, reg = 0, off;
bool tx_pause = false;
bool rx_pause = false;
Expand Down Expand Up @@ -2224,10 +2224,10 @@ int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy)
}
EXPORT_SYMBOL(b53_eee_init);

int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
{
struct b53_device *dev = ds->priv;
struct ethtool_eee *p = &dev->ports[port].eee;
struct ethtool_keee *p = &dev->ports[port].eee;
u16 reg;

if (is5325(dev) || is5365(dev))
Expand All @@ -2241,10 +2241,10 @@ int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
}
EXPORT_SYMBOL(b53_get_mac_eee);

int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e)
int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e)
{
struct b53_device *dev = ds->priv;
struct ethtool_eee *p = &dev->ports[port].eee;
struct ethtool_keee *p = &dev->ports[port].eee;

if (is5325(dev) || is5365(dev))
return -EOPNOTSUPP;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/dsa/b53/b53_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct b53_pcs {

struct b53_port {
u16 vlan_ctl_mask;
struct ethtool_eee eee;
struct ethtool_keee eee;
};

struct b53_vlan {
Expand Down Expand Up @@ -397,7 +397,7 @@ void b53_disable_port(struct dsa_switch *ds, int port);
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port);
void b53_eee_enable_set(struct dsa_switch *ds, int port, bool enable);
int b53_eee_init(struct dsa_switch *ds, int port, struct phy_device *phy);
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
int b53_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);
int b53_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);

#endif
2 changes: 1 addition & 1 deletion drivers/net/dsa/bcm_sf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ static void bcm_sf2_sw_mac_link_up(struct dsa_switch *ds, int port,
bool tx_pause, bool rx_pause)
{
struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
struct ethtool_eee *p = &priv->dev->ports[port].eee;
struct ethtool_keee *p = &priv->dev->ports[port].eee;
u32 reg_rgmii_ctrl = 0;
u32 reg, offset;

Expand Down
4 changes: 2 additions & 2 deletions drivers/net/dsa/microchip/ksz_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@ static int ksz_validate_eee(struct dsa_switch *ds, int port)
}

static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
int ret;

Expand All @@ -2872,7 +2872,7 @@ static int ksz_get_mac_eee(struct dsa_switch *ds, int port,
}

static int ksz_set_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
struct ksz_device *dev = ds->priv;
int ret;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/dsa/mt7530.c
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ mt753x_setup(struct dsa_switch *ds)
}

static int mt753x_get_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
struct mt7530_priv *priv = ds->priv;
u32 eeecr = mt7530_read(priv, MT7530_PMEEECR_P(port));
Expand All @@ -3060,7 +3060,7 @@ static int mt753x_get_mac_eee(struct dsa_switch *ds, int port,
}

static int mt753x_set_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
struct mt7530_priv *priv = ds->priv;
u32 set, mask = LPI_THRESH_MASK | LPI_MODE_EN;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1451,14 +1451,14 @@ static void mv88e6xxx_get_regs(struct dsa_switch *ds, int port,
}

static int mv88e6xxx_get_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
/* Nothing to do on the port's MAC */
return 0;
}

static int mv88e6xxx_set_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
/* Nothing to do on the port's MAC */
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/dsa/qca/qca8k-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ int qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset)
}

int qca8k_set_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *eee)
struct ethtool_keee *eee)
{
u32 lpi_en = QCA8K_REG_EEE_CTRL_LPI_EN(port);
struct qca8k_priv *priv = ds->priv;
Expand All @@ -558,7 +558,7 @@ int qca8k_set_mac_eee(struct dsa_switch *ds, int port,
}

int qca8k_get_mac_eee(struct dsa_switch *ds, int port,
struct ethtool_eee *e)
struct ethtool_keee *e)
{
/* Nothing to do on the port's MAC */
return 0;
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/dsa/qca/qca8k.h
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ void qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
int qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset);

/* Common eee function */
int qca8k_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *eee);
int qca8k_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
int qca8k_set_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *eee);
int qca8k_get_mac_eee(struct dsa_switch *ds, int port, struct ethtool_keee *e);

/* Common bridge function */
void qca8k_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ static u32 eee_mask_to_ethtool_mask(u32 speed)
return rate;
}

static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_eee *eee)
static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_keee *eee)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
u32 rate, supported_rates;
Expand Down Expand Up @@ -729,7 +729,7 @@ static int aq_ethtool_get_eee(struct net_device *ndev, struct ethtool_eee *eee)
return 0;
}

static int aq_ethtool_set_eee(struct net_device *ndev, struct ethtool_eee *eee)
static int aq_ethtool_set_eee(struct net_device *ndev, struct ethtool_keee *eee)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
u32 rate, supported_rates;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/asp2/bcmasp.h
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ struct bcmasp_intf {
int wol_irq;
unsigned int wol_irq_enabled:1;

struct ethtool_eee eee;
struct ethtool_keee eee;
};

#define NUM_NET_FILTERS 32
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ void bcmasp_eee_enable_set(struct bcmasp_intf *intf, bool enable)
intf->eee.eee_active = enable;
}

static int bcmasp_get_eee(struct net_device *dev, struct ethtool_eee *e)
static int bcmasp_get_eee(struct net_device *dev, struct ethtool_keee *e)
{
struct bcmasp_intf *intf = netdev_priv(dev);
struct ethtool_eee *p = &intf->eee;
struct ethtool_keee *p = &intf->eee;

if (!dev->phydev)
return -ENODEV;
Expand All @@ -379,10 +379,10 @@ static int bcmasp_get_eee(struct net_device *dev, struct ethtool_eee *e)
return phy_ethtool_get_eee(dev->phydev, e);
}

static int bcmasp_set_eee(struct net_device *dev, struct ethtool_eee *e)
static int bcmasp_set_eee(struct net_device *dev, struct ethtool_keee *e)
{
struct bcmasp_intf *intf = netdev_priv(dev);
struct ethtool_eee *p = &intf->eee;
struct ethtool_keee *p = &intf->eee;
int ret;

if (!dev->phydev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2108,7 +2108,7 @@ static u32 bnx2x_adv_to_eee(u32 modes, u32 shift)
return eee_adv << shift;
}

static int bnx2x_get_eee(struct net_device *dev, struct ethtool_eee *edata)
static int bnx2x_get_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct bnx2x *bp = netdev_priv(dev);
u32 eee_cfg;
Expand Down Expand Up @@ -2141,7 +2141,7 @@ static int bnx2x_get_eee(struct net_device *dev, struct ethtool_eee *edata)
return 0;
}

static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata)
static int bnx2x_set_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct bnx2x *bp = netdev_priv(dev);
u32 eee_cfg;
Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -10621,7 +10621,7 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)

bp->phy_flags = resp->flags | (le16_to_cpu(resp->flags2) << 8);
if (resp->flags & PORT_PHY_QCAPS_RESP_FLAGS_EEE_SUPPORTED) {
struct ethtool_eee *eee = &bp->eee;
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);
Expand Down Expand Up @@ -10766,7 +10766,7 @@ int bnxt_update_link(struct bnxt *bp, bool chng_link_state)
link_info->module_status = resp->module_status;

if (bp->phy_flags & BNXT_PHY_FL_EEE_CAP) {
struct ethtool_eee *eee = &bp->eee;
struct ethtool_keee *eee = &bp->eee;
u16 fw_speeds;

eee->eee_active = 0;
Expand Down Expand Up @@ -10957,7 +10957,7 @@ int bnxt_hwrm_set_pause(struct bnxt *bp)
static void bnxt_hwrm_set_eee(struct bnxt *bp,
struct hwrm_port_phy_cfg_input *req)
{
struct ethtool_eee *eee = &bp->eee;
struct ethtool_keee *eee = &bp->eee;

if (eee->eee_enabled) {
u16 eee_speeds;
Expand Down Expand Up @@ -11322,7 +11322,7 @@ static void bnxt_get_wol_settings(struct bnxt *bp)

static bool bnxt_eee_config_ok(struct bnxt *bp)
{
struct ethtool_eee *eee = &bp->eee;
struct ethtool_keee *eee = &bp->eee;
struct bnxt_link_info *link_info = &bp->link_info;

if (!(bp->phy_flags & BNXT_PHY_FL_EEE_CAP))
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bnxt/bnxt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2442,7 +2442,7 @@ struct bnxt {
*/
struct mutex link_lock;
struct bnxt_link_info link_info;
struct ethtool_eee eee;
struct ethtool_keee eee;
u32 lpi_tmr_lo;
u32 lpi_tmr_hi;

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -3884,10 +3884,10 @@ static int bnxt_set_eeprom(struct net_device *dev,
eeprom->len);
}

static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
static int bnxt_set_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct bnxt *bp = netdev_priv(dev);
struct ethtool_eee *eee = &bp->eee;
struct ethtool_keee *eee = &bp->eee;
struct bnxt_link_info *link_info = &bp->link_info;
u32 advertising;
int rc = 0;
Expand Down Expand Up @@ -3942,7 +3942,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
return rc;
}

static int bnxt_get_eee(struct net_device *dev, struct ethtool_eee *edata)
static int bnxt_get_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct bnxt *bp = netdev_priv(dev);

Expand Down
8 changes: 4 additions & 4 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,10 @@ void bcmgenet_eee_enable_set(struct net_device *dev, bool enable,
priv->eee.tx_lpi_enabled = tx_lpi_enabled;
}

static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e)
static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_keee *e)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct ethtool_eee *p = &priv->eee;
struct ethtool_keee *p = &priv->eee;

if (GENET_IS_V1(priv))
return -EOPNOTSUPP;
Expand All @@ -1336,10 +1336,10 @@ static int bcmgenet_get_eee(struct net_device *dev, struct ethtool_eee *e)
return phy_ethtool_get_eee(dev->phydev, e);
}

static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_eee *e)
static int bcmgenet_set_eee(struct net_device *dev, struct ethtool_keee *e)
{
struct bcmgenet_priv *priv = netdev_priv(dev);
struct ethtool_eee *p = &priv->eee;
struct ethtool_keee *p = &priv->eee;

if (GENET_IS_V1(priv))
return -EOPNOTSUPP;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/genet/bcmgenet.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ struct bcmgenet_priv {

struct bcmgenet_mib_counters mib;

struct ethtool_eee eee;
struct ethtool_keee eee;
};

#define GENET_IO_MACRO(name, offset) \
Expand Down
10 changes: 5 additions & 5 deletions drivers/net/ethernet/broadcom/tg3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2338,10 +2338,10 @@ static void tg3_phy_apply_otp(struct tg3 *tp)
tg3_phy_toggle_auxctl_smdsp(tp, false);
}

static void tg3_eee_pull_config(struct tg3 *tp, struct ethtool_eee *eee)
static void tg3_eee_pull_config(struct tg3 *tp, struct ethtool_keee *eee)
{
u32 val;
struct ethtool_eee *dest = &tp->eee;
struct ethtool_keee *dest = &tp->eee;

if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
return;
Expand Down Expand Up @@ -4618,7 +4618,7 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)

static bool tg3_phy_eee_config_ok(struct tg3 *tp)
{
struct ethtool_eee eee;
struct ethtool_keee eee;

if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
return true;
Expand Down Expand Up @@ -14180,7 +14180,7 @@ static int tg3_set_coalesce(struct net_device *dev,
return 0;
}

static int tg3_set_eee(struct net_device *dev, struct ethtool_eee *edata)
static int tg3_set_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct tg3 *tp = netdev_priv(dev);

Expand Down Expand Up @@ -14217,7 +14217,7 @@ static int tg3_set_eee(struct net_device *dev, struct ethtool_eee *edata)
return 0;
}

static int tg3_get_eee(struct net_device *dev, struct ethtool_eee *edata)
static int tg3_get_eee(struct net_device *dev, struct ethtool_keee *edata)
{
struct tg3 *tp = netdev_priv(dev);

Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/tg3.h
Original file line number Diff line number Diff line change
Expand Up @@ -3419,7 +3419,7 @@ struct tg3 {
unsigned int irq_cnt;

struct ethtool_coalesce coal;
struct ethtool_eee eee;
struct ethtool_keee eee;

/* firmware info */
const char *fw_needed;
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/engleder/tsnep_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ static int tsnep_phy_loopback(struct tsnep_adapter *adapter, bool enable)
static int tsnep_phy_open(struct tsnep_adapter *adapter)
{
struct phy_device *phydev;
struct ethtool_eee ethtool_eee;
struct ethtool_keee ethtool_keee;
int retval;

retval = phy_connect_direct(adapter->netdev, adapter->phydev,
Expand All @@ -259,8 +259,8 @@ static int tsnep_phy_open(struct tsnep_adapter *adapter)
phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_1000baseT_Half_BIT);

/* disable EEE autoneg, EEE not supported by TSNEP */
memset(&ethtool_eee, 0, sizeof(ethtool_eee));
phy_ethtool_set_eee(adapter->phydev, &ethtool_eee);
memset(&ethtool_keee, 0, sizeof(ethtool_keee));
phy_ethtool_set_eee(adapter->phydev, &ethtool_keee);

adapter->phydev->irq = PHY_MAC_INTERRUPT;
phy_start(adapter->phydev);
Expand Down
Loading

0 comments on commit d80a523

Please sign in to comment.