提交 a61e5406 编写于 作者: A Andrew Lunn 提交者: David S. Miller

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

The PTP code needs low latency access to the PTP hardware timestamps.
Reading all the ATU entries in one go adds a lot of latency to the PTP
code. So take and release the reg_lock mutex for each individual MAC
address in the ATU, allowing the PTP thread jump in between.
Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 377cda13
...@@ -1437,7 +1437,9 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip, ...@@ -1437,7 +1437,9 @@ static int mv88e6xxx_port_db_dump_fid(struct mv88e6xxx_chip *chip,
eth_broadcast_addr(addr.mac); eth_broadcast_addr(addr.mac);
do { do {
mutex_lock(&chip->reg_lock);
err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr); err = mv88e6xxx_g1_atu_getnext(chip, fid, &addr);
mutex_unlock(&chip->reg_lock);
if (err) if (err)
return err; return err;
...@@ -1470,7 +1472,10 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, ...@@ -1470,7 +1472,10 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
int err; int err;
/* Dump port's default Filtering Information Database (VLAN ID 0) */ /* Dump port's default Filtering Information Database (VLAN ID 0) */
mutex_lock(&chip->reg_lock);
err = mv88e6xxx_port_get_fid(chip, port, &fid); err = mv88e6xxx_port_get_fid(chip, port, &fid);
mutex_unlock(&chip->reg_lock);
if (err) if (err)
return err; return err;
...@@ -1480,7 +1485,9 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port, ...@@ -1480,7 +1485,9 @@ static int mv88e6xxx_port_db_dump(struct mv88e6xxx_chip *chip, int port,
/* Dump VLANs' Filtering Information Databases */ /* Dump VLANs' Filtering Information Databases */
do { do {
mutex_lock(&chip->reg_lock);
err = mv88e6xxx_vtu_getnext(chip, &vlan); err = mv88e6xxx_vtu_getnext(chip, &vlan);
mutex_unlock(&chip->reg_lock);
if (err) if (err)
return err; return err;
...@@ -1500,13 +1507,8 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port, ...@@ -1500,13 +1507,8 @@ static int mv88e6xxx_port_fdb_dump(struct dsa_switch *ds, int port,
dsa_fdb_dump_cb_t *cb, void *data) dsa_fdb_dump_cb_t *cb, void *data)
{ {
struct mv88e6xxx_chip *chip = ds->priv; struct mv88e6xxx_chip *chip = ds->priv;
int err;
mutex_lock(&chip->reg_lock);
err = mv88e6xxx_port_db_dump(chip, port, cb, data);
mutex_unlock(&chip->reg_lock);
return err; return mv88e6xxx_port_db_dump(chip, port, cb, data);
} }
static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip, static int mv88e6xxx_bridge_map(struct mv88e6xxx_chip *chip,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册