mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 17:39:23 -04:00
dsa: mv88e6xxx: Centralise common statistics check
With moving information about available statistics into the info structure, the test becomes identical. Consolidate them into a single test. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20241207-v6-13-rc1-net-next-mv88e6xxx-stats-refactor-v1-2-b9960f839846@lunn.ch Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
5595e3613e
commit
9a4eef6bf2
@@ -1289,9 +1289,6 @@ static size_t mv88e6095_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
|
||||
const struct mv88e6xxx_hw_stat *stat,
|
||||
uint64_t *data)
|
||||
{
|
||||
if (!(stat->type & chip->info->stats_type))
|
||||
return 0;
|
||||
|
||||
*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
|
||||
MV88E6XXX_G1_STATS_OP_HIST_RX);
|
||||
return 1;
|
||||
@@ -1301,9 +1298,6 @@ static size_t mv88e6250_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
|
||||
const struct mv88e6xxx_hw_stat *stat,
|
||||
uint64_t *data)
|
||||
{
|
||||
if (!(stat->type & chip->info->stats_type))
|
||||
return 0;
|
||||
|
||||
*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port, 0,
|
||||
MV88E6XXX_G1_STATS_OP_HIST_RX);
|
||||
return 1;
|
||||
@@ -1313,9 +1307,6 @@ static size_t mv88e6320_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
|
||||
const struct mv88e6xxx_hw_stat *stat,
|
||||
uint64_t *data)
|
||||
{
|
||||
if (!(stat->type & chip->info->stats_type))
|
||||
return 0;
|
||||
|
||||
*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
|
||||
MV88E6XXX_G1_STATS_OP_BANK_1_BIT_9,
|
||||
MV88E6XXX_G1_STATS_OP_HIST_RX);
|
||||
@@ -1326,9 +1317,6 @@ static size_t mv88e6390_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
|
||||
const struct mv88e6xxx_hw_stat *stat,
|
||||
uint64_t *data)
|
||||
{
|
||||
if (!(stat->type & chip->info->stats_type))
|
||||
return 0;
|
||||
|
||||
*data = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
|
||||
MV88E6XXX_G1_STATS_OP_BANK_1_BIT_10,
|
||||
0);
|
||||
@@ -1341,6 +1329,9 @@ static size_t mv88e6xxx_stats_get_stat(struct mv88e6xxx_chip *chip, int port,
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (!(stat->type & chip->info->stats_type))
|
||||
return 0;
|
||||
|
||||
if (chip->info->ops->stats_get_stat) {
|
||||
mv88e6xxx_reg_lock(chip);
|
||||
ret = chip->info->ops->stats_get_stat(chip, port, stat, data);
|
||||
|
||||
Reference in New Issue
Block a user