Commit 377cda13 authored by Andrew Lunn's avatar Andrew Lunn Committed by David S. Miller

net: dsa: mv88e6xxx: Release mutex between each statistics read

The PTP code needs low latency access to the PTP hardware timestamps.
Reading all the statistics in one go adds a lot of latency to the PTP
code. So take and release the reg_lock mutex for each individual
statistics, allowing the PTP thread jump in between.
Signed-off-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 65bd449c
...@@ -714,9 +714,12 @@ static void mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port, ...@@ -714,9 +714,12 @@ static void mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port,
for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) {
stat = &mv88e6xxx_hw_stats[i]; stat = &mv88e6xxx_hw_stats[i];
if (stat->type & types) { if (stat->type & types) {
mutex_lock(&chip->reg_lock);
data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port, data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port,
bank1_select, bank1_select,
histogram); histogram);
mutex_unlock(&chip->reg_lock);
j++; j++;
} }
} }
...@@ -764,14 +767,13 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port, ...@@ -764,14 +767,13 @@ static void mv88e6xxx_get_ethtool_stats(struct dsa_switch *ds, int port,
mutex_lock(&chip->reg_lock); mutex_lock(&chip->reg_lock);
ret = mv88e6xxx_stats_snapshot(chip, port); ret = mv88e6xxx_stats_snapshot(chip, port);
if (ret < 0) { mutex_unlock(&chip->reg_lock);
mutex_unlock(&chip->reg_lock);
if (ret < 0)
return; return;
}
mv88e6xxx_get_stats(chip, port, data); mv88e6xxx_get_stats(chip, port, data);
mutex_unlock(&chip->reg_lock);
} }
static int mv88e6xxx_stats_set_histogram(struct mv88e6xxx_chip *chip) static int mv88e6xxx_stats_set_histogram(struct mv88e6xxx_chip *chip)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment