Skip to content

Commit ef6fcea

Browse files
viviendavem330
authored andcommitted
net: dsa: mv88e6xxx: get STU entry on VTU GetNext
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]>
1 parent 66a8e1f commit ef6fcea

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ static int _mv88e6xxx_vtu_getnext(struct mv88e6xxx_chip *chip,
12921292
}
12931293

12941294
if (mv88e6xxx_has(chip, MV88E6XXX_FLAG_STU)) {
1295-
err = mv88e6xxx_g1_vtu_sid_read(chip, &next);
1295+
err = mv88e6xxx_g1_vtu_stu_get(chip, &next);
12961296
if (err)
12971297
return err;
12981298
}

drivers/net/dsa/mv88e6xxx/global1.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
7272
struct mv88e6xxx_vtu_entry *entry);
7373
int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
7474
struct mv88e6xxx_vtu_entry *vtu);
75+
int mv88e6xxx_g1_vtu_stu_get(struct mv88e6xxx_chip *chip,
76+
struct mv88e6xxx_vtu_entry *vtu);
7577
int mv88e6xxx_g1_vtu_flush(struct mv88e6xxx_chip *chip);
7678

7779
#endif /* _MV88E6XXX_GLOBAL1_H */

drivers/net/dsa/mv88e6xxx/global1_vtu.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,28 @@ int mv88e6xxx_g1_vtu_stu_getnext(struct mv88e6xxx_chip *chip,
194194
return mv88e6xxx_g1_vtu_vid_read(chip, entry);
195195
}
196196

197+
int mv88e6xxx_g1_vtu_stu_get(struct mv88e6xxx_chip *chip,
198+
struct mv88e6xxx_vtu_entry *vtu)
199+
{
200+
struct mv88e6xxx_vtu_entry stu;
201+
int err;
202+
203+
err = mv88e6xxx_g1_vtu_sid_read(chip, vtu);
204+
if (err)
205+
return err;
206+
207+
stu.sid = vtu->sid - 1;
208+
209+
err = mv88e6xxx_g1_vtu_stu_getnext(chip, &stu);
210+
if (err)
211+
return err;
212+
213+
if (stu.sid != vtu->sid || !stu.valid)
214+
return -EINVAL;
215+
216+
return 0;
217+
}
218+
197219
int mv88e6xxx_g1_vtu_getnext(struct mv88e6xxx_chip *chip,
198220
struct mv88e6xxx_vtu_entry *entry)
199221
{

0 commit comments

Comments
 (0)