Skip to content

Commit

Permalink
net: dsa: mv88e6xxx: get STU entry on VTU GetNext
Browse files Browse the repository at this point in the history
Now that the code reads both VTU and STU data on VTU GetNext operation,
fetch the STU entry data of a VTU entry at the same time.

The STU data bits are masked with the VTU data bits and they are now all
read at the same time a VTU GetNext operation is issued.

Signed-off-by: Vivien Didelot <[email protected]>
Reviewed-by: Andrew Lunn <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
vivien authored and davem330 committed May 1, 2017
1 parent 66a8e1f commit ef6fcea
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/dsa/mv88e6xxx/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ static int _mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip,
}

if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_STU)) {
err = mv88e6xxx_g1_vtu_sid_read(chip, &next);
err = mv88e6xxx_g1_vtu_stu_get(chip, &next);
if (err)
return err;
}
Expand Down
2 changes: 2 additions & 0 deletions drivers/net/dsa/mv88e6xxx/global1.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry);
int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *vtu);
int mv88e6xxx_g1_vtu_stu_get(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *vtu);
int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip);

#endif /* _MV88E6XXX_GLOBAL1_H */
22 changes: 22 additions & 0 deletions drivers/net/dsa/mv88e6xxx/global1_vtu.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,28 @@ int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
return mv88e6xxx_g1_vtu_vid_read(chip, entry);
}

int mv88e6xxx_g1_vtu_stu_get(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *vtu)
{
struct mv88e6xxx_vtu_entry stu;
int err;

err = mv88e6xxx_g1_vtu_sid_read(chip, vtu);
if (err)
return err;

stu.sid = vtu->sid - 1;

err = mv88e6xxx_g1_vtu_stu_getnext(chip, &stu);
if (err)
return err;

if (stu.sid != vtu->sid || !stu.valid)
return -EINVAL;

return 0;
}

int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
struct mv88e6xxx_vtu_entry *entry)
{
Expand Down

0 comments on commit ef6fcea

Please sign in to comment.