]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
net: dsa: mv88e6xxx: get STU entry on VTU GetNext
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 1 May 2017 18:05:20 +0000 (14:05 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 May 2017 19:03:11 +0000 (15:03 -0400)
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 <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/mv88e6xxx/global1.h
drivers/net/dsa/mv88e6xxx/global1_vtu.c

index 5441b05f519bf4a7eec751f8af2d805a214e4d88..38c3e047fbf921283a94ea609aee8f9b8c36aba3 100644 (file)
@@ -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;
                }
index 5d276cc4262ba5159292fc5bd7ff6918a6f7e425..76b49a3a470155bb75404601da9b7b144725c9dd 100644 (file)
@@ -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 */
index cf572ba761952849806743860211b7def8551524..710f86fa3b4e4ece1b3c3c7b8fe0174e42f3afca 100644 (file)
@@ -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)
 {