net: dsa: mv88e6xxx: support the VTU Page bit
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>
Mon, 1 May 2017 18:05:26 +0000 (14:05 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 May 2017 19:03:13 +0000 (15:03 -0400)
Newer chips such as the 88E6390 have a VTU Page bit in the VTU VID
register to specify a 13th bit for the VID. This can be used to support
8K VLANs.

When dumping the whole VTU, all VID bits must be set to one, including
this VTU Page bit. Add support for VID greater than 4095.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/global1_vtu.c
drivers/net/dsa/mv88e6xxx/mv88e6xxx.h

index 469056d0b42140c3da5f9f474a47fef59a346986..8e77974fb2f8f8342a1d0f90afa50f3d5c644211 100644 (file)
@@ -95,6 +95,10 @@ static int mv88e6xxx_g1_vtu_vid_read(struct mv88e6xxx_chip *chip,
                return err;
 
        entry->vid = val & 0xfff;
+
+       if (val & GLOBAL_VTU_VID_PAGE)
+               entry->vid |= 0x1000;
+
        entry->valid = !!(val & GLOBAL_VTU_VID_VALID);
 
        return 0;
@@ -105,6 +109,9 @@ static int mv88e6xxx_g1_vtu_vid_write(struct mv88e6xxx_chip *chip,
 {
        u16 val = entry->vid & 0xfff;
 
+       if (entry->vid & 0x1000)
+               val |= GLOBAL_VTU_VID_PAGE;
+
        if (entry->valid)
                val |= GLOBAL_VTU_VID_VALID;
 
index a0d57b10acfe54c6543cb68d36c1d48f6fe83e63..77236cd72df25e31cd2a25a0aea02718c73d77a2 100644 (file)
 #define GLOBAL_VTU_OP_STU_GET_NEXT     ((0x06 << 12) | GLOBAL_VTU_OP_BUSY)
 #define GLOBAL_VTU_VID         0x06
 #define GLOBAL_VTU_VID_MASK    0xfff
+#define GLOBAL_VTU_VID_PAGE    BIT(13)
 #define GLOBAL_VTU_VID_VALID   BIT(12)
 #define GLOBAL_VTU_DATA_0_3    0x07
 #define GLOBAL_VTU_DATA_4_7    0x08