net: dsa: Pass stringset to ethtool operations
Up until now we largely assumed that we were interested in ETH_SS_STATS type of strings for all ethtool operations, this is about to change with the introduction of additional string sets, e.g: ETH_SS_PHY_STATS. Update all functions to take an appropriate stringset argument and act on it when it is different than ETH_SS_STATS for now. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
1d1e79f1c6
commit
89f0904834
@@ -806,13 +806,17 @@ static unsigned int b53_get_mib_size(struct b53_device *dev)
|
||||
return B53_MIBS_SIZE;
|
||||
}
|
||||
|
||||
void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
|
||||
void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
|
||||
uint8_t *data)
|
||||
{
|
||||
struct b53_device *dev = ds->priv;
|
||||
const struct b53_mib_desc *mibs = b53_get_mib(dev);
|
||||
unsigned int mib_size = b53_get_mib_size(dev);
|
||||
unsigned int i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < mib_size; i++)
|
||||
strlcpy(data + i * ETH_GSTRING_LEN,
|
||||
mibs[i].name, ETH_GSTRING_LEN);
|
||||
@@ -852,10 +856,13 @@ void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data)
|
||||
}
|
||||
EXPORT_SYMBOL(b53_get_ethtool_stats);
|
||||
|
||||
int b53_get_sset_count(struct dsa_switch *ds, int port)
|
||||
int b53_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
struct b53_device *dev = ds->priv;
|
||||
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return b53_get_mib_size(dev);
|
||||
}
|
||||
EXPORT_SYMBOL(b53_get_sset_count);
|
||||
|
@@ -286,9 +286,10 @@ static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
|
||||
/* Exported functions towards other drivers */
|
||||
void b53_imp_vlan_setup(struct dsa_switch *ds, int cpu_port);
|
||||
int b53_configure_vlan(struct dsa_switch *ds);
|
||||
void b53_get_strings(struct dsa_switch *ds, int port, uint8_t *data);
|
||||
void b53_get_strings(struct dsa_switch *ds, int port, u32 stringset,
|
||||
uint8_t *data);
|
||||
void b53_get_ethtool_stats(struct dsa_switch *ds, int port, uint64_t *data);
|
||||
int b53_get_sset_count(struct dsa_switch *ds, int port);
|
||||
int b53_get_sset_count(struct dsa_switch *ds, int port, int sset);
|
||||
int b53_br_join(struct dsa_switch *ds, int port, struct net_device *bridge);
|
||||
void b53_br_leave(struct dsa_switch *ds, int port, struct net_device *bridge);
|
||||
void b53_br_set_stp_state(struct dsa_switch *ds, int port, u8 state);
|
||||
|
@@ -86,16 +86,23 @@ static int dsa_loop_setup(struct dsa_switch *ds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port)
|
||||
static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return __DSA_LOOP_CNT_MAX;
|
||||
}
|
||||
|
||||
static void dsa_loop_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
|
||||
static void dsa_loop_get_strings(struct dsa_switch *ds, int port,
|
||||
u32 stringset, uint8_t *data)
|
||||
{
|
||||
struct dsa_loop_priv *ps = ds->priv;
|
||||
unsigned int i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < __DSA_LOOP_CNT_MAX; i++)
|
||||
memcpy(data + i * ETH_GSTRING_LEN,
|
||||
ps->ports[port].mib[i].name, ETH_GSTRING_LEN);
|
||||
|
@@ -977,10 +977,14 @@ static const struct lan9303_mib_desc lan9303_mib[] = {
|
||||
{ .offset = LAN9303_MAC_TX_LATECOL_0, .name = "TxLateCol", },
|
||||
};
|
||||
|
||||
static void lan9303_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
|
||||
static void lan9303_get_strings(struct dsa_switch *ds, int port,
|
||||
u32 stringset, uint8_t *data)
|
||||
{
|
||||
unsigned int u;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
|
||||
strncpy(data + u * ETH_GSTRING_LEN, lan9303_mib[u].name,
|
||||
ETH_GSTRING_LEN);
|
||||
@@ -1007,8 +1011,11 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port,
|
||||
}
|
||||
}
|
||||
|
||||
static int lan9303_get_sset_count(struct dsa_switch *ds, int port)
|
||||
static int lan9303_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return ARRAY_SIZE(lan9303_mib);
|
||||
}
|
||||
|
||||
|
@@ -439,15 +439,22 @@ static void ksz_disable_port(struct dsa_switch *ds, int port,
|
||||
ksz_port_cfg(dev, port, REG_PORT_CTRL_0, PORT_MAC_LOOPBACK, true);
|
||||
}
|
||||
|
||||
static int ksz_sset_count(struct dsa_switch *ds, int port)
|
||||
static int ksz_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return TOTAL_SWITCH_COUNTER_NUM;
|
||||
}
|
||||
|
||||
static void ksz_get_strings(struct dsa_switch *ds, int port, uint8_t *buf)
|
||||
static void ksz_get_strings(struct dsa_switch *ds, int port,
|
||||
u32 stringset, uint8_t *buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < TOTAL_SWITCH_COUNTER_NUM; i++) {
|
||||
memcpy(buf + i * ETH_GSTRING_LEN, mib_names[i].string,
|
||||
ETH_GSTRING_LEN);
|
||||
|
@@ -573,10 +573,14 @@ static int mt7530_phy_write(struct dsa_switch *ds, int port, int regnum,
|
||||
}
|
||||
|
||||
static void
|
||||
mt7530_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
|
||||
mt7530_get_strings(struct dsa_switch *ds, int port, u32 stringset,
|
||||
uint8_t *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(mt7530_mib); i++)
|
||||
strncpy(data + i * ETH_GSTRING_LEN, mt7530_mib[i].name,
|
||||
ETH_GSTRING_LEN);
|
||||
@@ -604,8 +608,11 @@ mt7530_get_ethtool_stats(struct dsa_switch *ds, int port,
|
||||
}
|
||||
|
||||
static int
|
||||
mt7530_get_sset_count(struct dsa_switch *ds, int port)
|
||||
mt7530_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return ARRAY_SIZE(mt7530_mib);
|
||||
}
|
||||
|
||||
|
@@ -742,11 +742,14 @@ static void mv88e6xxx_atu_vtu_get_strings(uint8_t *data)
|
||||
}
|
||||
|
||||
static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port,
|
||||
uint8_t *data)
|
||||
u32 stringset, uint8_t *data)
|
||||
{
|
||||
struct mv88e6xxx_chip *chip = ds->priv;
|
||||
int count = 0;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
|
||||
if (chip->info->ops->stats_get_strings)
|
||||
@@ -789,12 +792,15 @@ static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip)
|
||||
STATS_TYPE_BANK1);
|
||||
}
|
||||
|
||||
static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port)
|
||||
static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
struct mv88e6xxx_chip *chip = ds->priv;
|
||||
int serdes_count = 0;
|
||||
int count = 0;
|
||||
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&chip->reg_lock);
|
||||
if (chip->info->ops->stats_get_sset_count)
|
||||
count = chip->info->ops->stats_get_sset_count(chip);
|
||||
|
@@ -600,10 +600,13 @@ qca8k_phy_write(struct dsa_switch *ds, int phy, int regnum, u16 val)
|
||||
}
|
||||
|
||||
static void
|
||||
qca8k_get_strings(struct dsa_switch *ds, int port, uint8_t *data)
|
||||
qca8k_get_strings(struct dsa_switch *ds, int port, u32 stringset, uint8_t *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (stringset != ETH_SS_STATS)
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ar8327_mib); i++)
|
||||
strncpy(data + i * ETH_GSTRING_LEN, ar8327_mib[i].name,
|
||||
ETH_GSTRING_LEN);
|
||||
@@ -631,8 +634,11 @@ qca8k_get_ethtool_stats(struct dsa_switch *ds, int port,
|
||||
}
|
||||
|
||||
static int
|
||||
qca8k_get_sset_count(struct dsa_switch *ds, int port)
|
||||
qca8k_get_sset_count(struct dsa_switch *ds, int port, int sset)
|
||||
{
|
||||
if (sset != ETH_SS_STATS)
|
||||
return 0;
|
||||
|
||||
return ARRAY_SIZE(ar8327_mib);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user