Skip to content

Commit c6c8cd5

Browse files
lunndavem330
authored andcommitted
net: dsa: mv88e6xxx: Hold mutex while doing stats operations
Until now, there has been no need to hold the reg mutex while getting the count of statistics, or the strings, because the hardware was not accessed. When adding support for SERDES statistics, it is necessary to access the hardware, to determine if a port is using the SERDES interface. So add mutex lock/unlocks. Signed-off-by: Andrew Lunn <[email protected]> Tested-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 88c0605 commit c6c8cd5

File tree

1 file changed

+9
-2
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+9
-2
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,8 +724,12 @@ static void mv88e6xxx_get_strings(struct dsa_switch *ds, int port,
724724
{
725725
struct mv88e6xxx_chip *chip = ds->priv;
726726

727+
mutex_lock(&chip->reg_lock);
728+
727729
if (chip->info->ops->stats_get_strings)
728730
chip->info->ops->stats_get_strings(chip, data);
731+
732+
mutex_unlock(&chip->reg_lock);
729733
}
730734

731735
static int mv88e6xxx_stats_get_sset_count(struct mv88e6xxx_chip *chip,
@@ -757,11 +761,14 @@ static int mv88e6320_stats_get_sset_count(struct mv88e6xxx_chip *chip)
757761
static int mv88e6xxx_get_sset_count(struct dsa_switch *ds, int port)
758762
{
759763
struct mv88e6xxx_chip *chip = ds->priv;
764+
int ret = 0;
760765

766+
mutex_lock(&chip->reg_lock);
761767
if (chip->info->ops->stats_get_sset_count)
762-
return chip->info->ops->stats_get_sset_count(chip);
768+
ret = chip->info->ops->stats_get_sset_count(chip);
769+
mutex_unlock(&chip->reg_lock);
763770

764-
return 0;
771+
return ret;
765772
}
766773

767774
static void mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port,

0 commit comments

Comments
 (0)