Skip to content

Commit

Permalink
net: mscc: ocelot: remove redundant stats_layout pointers
Browse files Browse the repository at this point in the history
Ever since commit 4d1d157 ("net: mscc: ocelot: share the common stat
definitions between all drivers") the stats_layout entry in ocelot and
felix drivers have become redundant. Remove the unnecessary code.

Suggested-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
  • Loading branch information
colin-foster-in-advantage authored and intel-lab-lkp committed Nov 11, 2022
1 parent 2cf7e87 commit 08340d5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 22 deletions.
1 change: 0 additions & 1 deletion drivers/net/dsa/ocelot/felix.c
Expand Up @@ -1370,7 +1370,6 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports)
return -ENOMEM;

ocelot->map = felix->info->map;
ocelot->stats_layout = felix->info->stats_layout;
ocelot->num_mact_rows = felix->info->num_mact_rows;
ocelot->vcap = felix->info->vcap;
ocelot->vcap_pol.base = felix->info->vcap_pol_base;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/ocelot/felix.h
Expand Up @@ -28,7 +28,6 @@ struct felix_info {
const struct ocelot_ops *ops;
const u32 *port_modes;
int num_mact_rows;
const struct ocelot_stat_layout *stats_layout;
int num_ports;
int num_tx_queues;
struct vcap_props *vcap;
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/dsa/ocelot/felix_vsc9959.c
Expand Up @@ -565,10 +565,6 @@ static const struct reg_field vsc9959_regfields[REGFIELD_MAX] = {
[SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 7, 4),
};

static const struct ocelot_stat_layout vsc9959_stats_layout[OCELOT_NUM_STATS] = {
OCELOT_COMMON_STATS,
};

static const struct vcap_field vsc9959_vcap_es0_keys[] = {
[VCAP_ES0_EGR_PORT] = { 0, 3},
[VCAP_ES0_IGR_PORT] = { 3, 3},
Expand Down Expand Up @@ -2575,7 +2571,6 @@ static const struct felix_info felix_info_vsc9959 = {
.regfields = vsc9959_regfields,
.map = vsc9959_regmap,
.ops = &vsc9959_ops,
.stats_layout = vsc9959_stats_layout,
.vcap = vsc9959_vcap_props,
.vcap_pol_base = VSC9959_VCAP_POLICER_BASE,
.vcap_pol_max = VSC9959_VCAP_POLICER_MAX,
Expand Down
5 changes: 0 additions & 5 deletions drivers/net/dsa/ocelot/seville_vsc9953.c
Expand Up @@ -543,10 +543,6 @@ static const struct reg_field vsc9953_regfields[REGFIELD_MAX] = {
[SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 11, 4),
};

static const struct ocelot_stat_layout vsc9953_stats_layout[OCELOT_NUM_STATS] = {
OCELOT_COMMON_STATS,
};

static const struct vcap_field vsc9953_vcap_es0_keys[] = {
[VCAP_ES0_EGR_PORT] = { 0, 4},
[VCAP_ES0_IGR_PORT] = { 4, 4},
Expand Down Expand Up @@ -996,7 +992,6 @@ static const struct felix_info seville_info_vsc9953 = {
.regfields = vsc9953_regfields,
.map = vsc9953_regmap,
.ops = &vsc9953_ops,
.stats_layout = vsc9953_stats_layout,
.vcap = vsc9953_vcap_props,
.vcap_pol_base = VSC9953_VCAP_POLICER_BASE,
.vcap_pol_max = VSC9953_VCAP_POLICER_MAX,
Expand Down
20 changes: 12 additions & 8 deletions drivers/net/ethernet/mscc/ocelot_stats.c
Expand Up @@ -9,6 +9,10 @@
#include <linux/workqueue.h>
#include "ocelot.h"

static const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STATS] = {
OCELOT_COMMON_STATS,
};

/* Read the counters from hardware and keep them in region->buf.
* Caller must hold &ocelot->stat_view_lock.
*/
Expand Down Expand Up @@ -93,10 +97,10 @@ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data)
return;

for (i = 0; i < OCELOT_NUM_STATS; i++) {
if (ocelot->stats_layout[i].name[0] == '\0')
if (ocelot_stats_layout[i].name[0] == '\0')
continue;

memcpy(data + i * ETH_GSTRING_LEN, ocelot->stats_layout[i].name,
memcpy(data + i * ETH_GSTRING_LEN, ocelot_stats_layout[i].name,
ETH_GSTRING_LEN);
}
}
Expand Down Expand Up @@ -137,7 +141,7 @@ int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset)
return -EOPNOTSUPP;

for (i = 0; i < OCELOT_NUM_STATS; i++)
if (ocelot->stats_layout[i].name[0] != '\0')
if (ocelot_stats_layout[i].name[0] != '\0')
num_stats++;

return num_stats;
Expand All @@ -154,7 +158,7 @@ static void ocelot_port_ethtool_stats_cb(struct ocelot *ocelot, int port,
for (i = 0; i < OCELOT_NUM_STATS; i++) {
int index = port * OCELOT_NUM_STATS + i;

if (ocelot->stats_layout[i].name[0] == '\0')
if (ocelot_stats_layout[i].name[0] == '\0')
continue;

*data++ = ocelot->stats[index];
Expand Down Expand Up @@ -389,23 +393,23 @@ static int ocelot_prepare_stats_regions(struct ocelot *ocelot)
INIT_LIST_HEAD(&ocelot->stats_regions);

for (i = 0; i < OCELOT_NUM_STATS; i++) {
if (!ocelot->stats_layout[i].reg)
if (!ocelot_stats_layout[i].reg)
continue;

if (region && ocelot->stats_layout[i].reg == last + 4) {
if (region && ocelot_stats_layout[i].reg == last + 4) {
region->count++;
} else {
region = devm_kzalloc(ocelot->dev, sizeof(*region),
GFP_KERNEL);
if (!region)
return -ENOMEM;

region->base = ocelot->stats_layout[i].reg;
region->base = ocelot_stats_layout[i].reg;
region->count = 1;
list_add_tail(&region->node, &ocelot->stats_regions);
}

last = ocelot->stats_layout[i].reg;
last = ocelot_stats_layout[i].reg;
}

list_for_each_entry(region, &ocelot->stats_regions, node) {
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/mscc/ocelot_vsc7514.c
Expand Up @@ -138,7 +138,6 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops)
int ret;

ocelot->map = ocelot_regmap;
ocelot->stats_layout = ocelot_stats_layout;
ocelot->num_mact_rows = 1024;
ocelot->ops = ops;

Expand Down
1 change: 0 additions & 1 deletion include/soc/mscc/ocelot.h
Expand Up @@ -967,7 +967,6 @@ struct ocelot {
struct regmap *targets[TARGET_MAX];
struct regmap_field *regfields[REGFIELD_MAX];
const u32 *const *map;
const struct ocelot_stat_layout *stats_layout;
struct list_head stats_regions;

u32 pool_size[OCELOT_SB_NUM][OCELOT_SB_POOL_NUM];
Expand Down

0 comments on commit 08340d5

Please sign in to comment.