OSDN Git Service

net: mscc: ocelot: add a "valid" boolean to struct ocelot_vlan
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 31 Oct 2020 10:29:13 +0000 (12:29 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 3 Nov 2020 01:09:06 +0000 (17:09 -0800)
commite2b2e83e52f756decbaacd8202f28745bab49e07
tree2a2436542df870f98bb43c3d13bb3e75b72a33b6
parentc3e58a750e3d64ea51df1e39911098a46dd0d9a6
net: mscc: ocelot: add a "valid" boolean to struct ocelot_vlan

Currently we are checking in some places whether the port has a native
VLAN on egress or not, by comparing the ocelot_port->vid value with zero.

That works, because VID 0 can never be a native VLAN configured by the
bridge, but now we want to make similar checks for the pvid. That won't
work, because there are cases when we do have the pvid set to 0 (not by
the bridge, by ourselves, but still.. it's confusing). And we can't
encode a negative value into an u16, so add a bool to the structure.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mscc/ocelot.c
include/soc/mscc/ocelot.h