Skip to content

Commit c91498e

Browse files
viviendavem330
authored andcommitted
net: dsa: mv88e6xxx: define membership on VLAN add
Define the target port membership of the VLAN entry in mv88e6xxx_port_vlan_add where ds is scoped. Allow the DSA core to call later the port_vlan_add operation for CPU or DSA ports, by using the Unmodified membership for these ports, as in the current behavior. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7eca9cc commit c91498e

File tree

1 file changed

+11
-5
lines changed
  • drivers/net/dsa/mv88e6xxx

1 file changed

+11
-5
lines changed

drivers/net/dsa/mv88e6xxx/chip.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ mv88e6xxx_port_vlan_prepare(struct dsa_switch *ds, int port,
12741274
}
12751275

12761276
static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
1277-
u16 vid, bool untagged)
1277+
u16 vid, u8 member)
12781278
{
12791279
struct mv88e6xxx_vtu_entry vlan;
12801280
int err;
@@ -1283,9 +1283,7 @@ static int _mv88e6xxx_port_vlan_add(struct mv88e6xxx_chip *chip, int port,
12831283
if (err)
12841284
return err;
12851285

1286-
vlan.member[port] = untagged ?
1287-
GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED :
1288-
GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED;
1286+
vlan.member[port] = member;
12891287

12901288
return mv88e6xxx_vtu_loadpurge(chip, &vlan);
12911289
}
@@ -1297,15 +1295,23 @@ static void mv88e6xxx_port_vlan_add(struct dsa_switch *ds, int port,
12971295
struct mv88e6xxx_chip *chip = ds->priv;
12981296
bool untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
12991297
bool pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
1298+
u8 member;
13001299
u16 vid;
13011300

13021301
if (!chip->info->max_vid)
13031302
return;
13041303

1304+
if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port))
1305+
member = GLOBAL_VTU_DATA_MEMBER_TAG_UNMODIFIED;
1306+
else if (untagged)
1307+
member = GLOBAL_VTU_DATA_MEMBER_TAG_UNTAGGED;
1308+
else
1309+
member = GLOBAL_VTU_DATA_MEMBER_TAG_TAGGED;
1310+
13051311
mutex_lock(&chip->reg_lock);
13061312

13071313
for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid)
1308-
if (_mv88e6xxx_port_vlan_add(chip, port, vid, untagged))
1314+
if (_mv88e6xxx_port_vlan_add(chip, port, vid, member))
13091315
netdev_err(ds->ports[port].netdev,
13101316
"failed to add VLAN %d%c\n",
13111317
vid, untagged ? 'u' : 't');

0 commit comments

Comments
 (0)