Skip to content

Commit

Permalink
net: dsa: mv88e6xxx: write MAC outside of ATU Get Next code
Browse files Browse the repository at this point in the history
There is no need to write the MAC address before every Get Next
operation, since ATU MAC registers are not cleared between calls.

Move the _mv88e6xxx_atu_mac_write call outside of _mv88e6xxx_atu_getnext
so future code could call ATU Get Next multiple times and save a few
register access.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vivien Didelot authored and David S. Miller committed Oct 22, 2015
1 parent 36d04ba commit b0e1a69
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/net/dsa/mv88e6xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ int mv88e6xxx_port_fdb_del(struct dsa_switch *ds, int port,
}

static int _mv88e6xxx_atu_getnext(struct dsa_switch *ds, u16 fid,
const unsigned char *addr,
struct mv88e6xxx_atu_entry *entry)
{
struct mv88e6xxx_atu_entry next = { 0 };
Expand All @@ -1763,10 +1762,6 @@ static int _mv88e6xxx_atu_getnext(struct dsa_switch *ds, u16 fid,
if (ret < 0)
return ret;

ret = _mv88e6xxx_atu_mac_write(ds, addr);
if (ret < 0)
return ret;

ret = _mv88e6xxx_reg_write(ds, REG_GLOBAL, GLOBAL_ATU_FID, fid);
if (ret < 0)
return ret;
Expand Down Expand Up @@ -1827,7 +1822,11 @@ int mv88e6xxx_port_fdb_getnext(struct dsa_switch *ds, int port,
fid = vtu.fid;
}

ret = _mv88e6xxx_atu_getnext(ds, fid, addr, &next);
ret = _mv88e6xxx_atu_mac_write(ds, addr);
if (ret < 0)
goto unlock;

ret = _mv88e6xxx_atu_getnext(ds, fid, &next);
if (ret < 0)
goto unlock;

Expand Down

0 comments on commit b0e1a69

Please sign in to comment.