[PATCH net-next 0/9] mlxsw: Add support for 802.1ad bridging

Ido Schimmel
2020-11-29T12:56:03Z

From: Ido Schimmel <idosch@nvidia.com>

802.1ad, also known as QinQ, is an extension to the 802.1q standard,
which is concerned with passing possibly 802.1q-tagged packets through
another VLAN-like tunnel. The format of 802.1ad tag is the same as
802.1q, except it uses the EtherType of 0x88a8, unlike 802.1q's 0x8100.

Currently, mlxsw supports bridging with VLAN-unaware (802.1d) bridges
and with VLAN-aware bridges whose VLAN protocol is 802.1q. This set adds
support for VLAN-aware bridges whose VLAN protocol is 802.1ad.

From mlxsw perspective, 802.1ad support entails two main changes:

1. Ports member in an 802.1ad bridge need to be configured to classify
802.1ad packets as tagged and all other packets as untagged

2. When pushing a VLAN at ingress (PVID), its EtherType needs to be
0x88a8 instead of 802.1q's 0x8100

The rest stays the same as with 802.1q bridges.

A follow-up patch set will add support for QinQ with VXLAN, also known
as QinVNI. Currently, linking of a VXLAN netdev to an 802.1ad bridge is
vetoed and an error is returned to user space.

Patch set overview:

Patches #1-#2 add the registers required to configure the two changes
described above.

Patch #3 changes the device to only treat 802.1q packets as tagged by
default, as opposed to both 802.1q and 802.1ad packets. This is more
inline with the behavior supported by the driver.

Patch #4 adds the ability to configure the EtherType when pushing a PVID
at ingress.

Patch #5 performs small refactoring to allow for code re-use in the next
patch.

Patch #6 adds support for 802.1ad bridging and allows mlxsw ports and
their uppers to join such a bridge.

Patch #7 changes the bridge driver to notify about changes to its VLAN
protocol, so that these could be vetoed by mlxsw in the next patch.

Patches #8-#9 teach mlxsw to veto unsupported 802.1ad configurations and
add a corresponding selftest to make sure such configurations are indeed
vetoed.

Amit Cohen (6):
mlxsw: reg: Add Switch Port VLAN Classification Register
mlxsw: reg: Add et_vlan field to SPVID register
mlxsw: spectrum: Only treat 802.1q packets as tagged packets
mlxsw: Make EtherType configurable when pushing VLAN at ingress
mlxsw: spectrum_switchdev: Create common functions for VLAN-aware
bridge
mlxsw: spectrum_switchdev: Add support of QinQ traffic

Danielle Ratson (3):
bridge: switchdev: Notify about VLAN protocol changes
mlxsw: Add QinQ configuration vetoes
selftests: forwarding: Add QinQ veto testing

drivers/net/ethernet/mellanox/mlxsw/reg.h | 114 ++++++-
.../net/ethernet/mellanox/mlxsw/spectrum.c | 111 ++++++-
.../net/ethernet/mellanox/mlxsw/spectrum.h | 7 +-
.../ethernet/mellanox/mlxsw/spectrum_router.c | 9 +
.../mellanox/mlxsw/spectrum_switchdev.c | 123 +++++++-
include/net/switchdev.h | 2 +
net/bridge/br_vlan.c | 16 +-
.../drivers/net/mlxsw/q_in_q_veto.sh | 296 ++++++++++++++++++
8 files changed, 657 insertions(+), 21 deletions(-)
create mode 100755 tools/testing/selftests/drivers/net/mlxsw/q_in_q_veto.sh

--
2.28.0