Skip to content

Commit 61fbfac

Browse files
author
Paolo Abeni
committed
Merge branch 'mt7530-dsa-subdriver-fix-vlan-egress-and-handling-of-all-link-local-frames'
says: ==================== MT7530 DSA subdriver fix VLAN egress and handling of all link-local frames This patch series fixes the VLAN tag egress procedure for link-local frames, and fixes handling of all link-local frames. Signed-off-by: Arınç ÜNAL <[email protected]> ==================== Link: https://lore.kernel.org/r/20240314-b4-for-net-mt7530-fix-link-local-vlan-v2-0-7dbcf6429ba0@arinc9.com Signed-off-by: Paolo Abeni <[email protected]>
2 parents 3201de4 + 69ddba9 commit 61fbfac

File tree

2 files changed

+65
-9
lines changed

2 files changed

+65
-9
lines changed

drivers/net/dsa/mt7530.c

Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -950,20 +950,56 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface)
950950
mutex_unlock(&priv->reg_mutex);
951951
}
952952

953+
/* On page 205, section "8.6.3 Frame filtering" of the active standard, IEEE Std
954+
* 802.1Q™-2022, it is stated that frames with 01:80:C2:00:00:00-0F as MAC DA
955+
* must only be propagated to C-VLAN and MAC Bridge components. That means
956+
* VLAN-aware and VLAN-unaware bridges. On the switch designs with CPU ports,
957+
* these frames are supposed to be processed by the CPU (software). So we make
958+
* the switch only forward them to the CPU port. And if received from a CPU
959+
* port, forward to a single port. The software is responsible of making the
960+
* switch conform to the latter by setting a single port as destination port on
961+
* the special tag.
962+
*
963+
* This switch intellectual property cannot conform to this part of the standard
964+
* fully. Whilst the REV_UN frame tag covers the remaining :04-0D and :0F MAC
965+
* DAs, it also includes :22-FF which the scope of propagation is not supposed
966+
* to be restricted for these MAC DAs.
967+
*/
953968
static void
954969
mt753x_trap_frames(struct mt7530_priv *priv)
955970
{
956-
/* Trap BPDUs to the CPU port(s) */
957-
mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
971+
/* Trap 802.1X PAE frames and BPDUs to the CPU port(s) and egress them
972+
* VLAN-untagged.
973+
*/
974+
mt7530_rmw(priv, MT753X_BPC, MT753X_PAE_EG_TAG_MASK |
975+
MT753X_PAE_PORT_FW_MASK | MT753X_BPDU_EG_TAG_MASK |
976+
MT753X_BPDU_PORT_FW_MASK,
977+
MT753X_PAE_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
978+
MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY) |
979+
MT753X_BPDU_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
958980
MT753X_BPDU_CPU_ONLY);
959981

960-
/* Trap 802.1X PAE frames to the CPU port(s) */
961-
mt7530_rmw(priv, MT753X_BPC, MT753X_PAE_PORT_FW_MASK,
962-
MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY));
982+
/* Trap frames with :01 and :02 MAC DAs to the CPU port(s) and egress
983+
* them VLAN-untagged.
984+
*/
985+
mt7530_rmw(priv, MT753X_RGAC1, MT753X_R02_EG_TAG_MASK |
986+
MT753X_R02_PORT_FW_MASK | MT753X_R01_EG_TAG_MASK |
987+
MT753X_R01_PORT_FW_MASK,
988+
MT753X_R02_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
989+
MT753X_R02_PORT_FW(MT753X_BPDU_CPU_ONLY) |
990+
MT753X_R01_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
991+
MT753X_BPDU_CPU_ONLY);
963992

964-
/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
965-
mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
966-
MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY));
993+
/* Trap frames with :03 and :0E MAC DAs to the CPU port(s) and egress
994+
* them VLAN-untagged.
995+
*/
996+
mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_EG_TAG_MASK |
997+
MT753X_R0E_PORT_FW_MASK | MT753X_R03_EG_TAG_MASK |
998+
MT753X_R03_PORT_FW_MASK,
999+
MT753X_R0E_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
1000+
MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY) |
1001+
MT753X_R03_EG_TAG(MT7530_VLAN_EG_UNTAGGED) |
1002+
MT753X_BPDU_CPU_ONLY);
9671003
}
9681004

9691005
static void

drivers/net/dsa/mt7530.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,33 @@ enum mt753x_id {
6565

6666
/* Registers for BPDU and PAE frame control*/
6767
#define MT753X_BPC 0x24
68-
#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0)
68+
#define MT753X_PAE_EG_TAG_MASK GENMASK(24, 22)
69+
#define MT753X_PAE_EG_TAG(x) FIELD_PREP(MT753X_PAE_EG_TAG_MASK, x)
6970
#define MT753X_PAE_PORT_FW_MASK GENMASK(18, 16)
7071
#define MT753X_PAE_PORT_FW(x) FIELD_PREP(MT753X_PAE_PORT_FW_MASK, x)
72+
#define MT753X_BPDU_EG_TAG_MASK GENMASK(8, 6)
73+
#define MT753X_BPDU_EG_TAG(x) FIELD_PREP(MT753X_BPDU_EG_TAG_MASK, x)
74+
#define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0)
75+
76+
/* Register for :01 and :02 MAC DA frame control */
77+
#define MT753X_RGAC1 0x28
78+
#define MT753X_R02_EG_TAG_MASK GENMASK(24, 22)
79+
#define MT753X_R02_EG_TAG(x) FIELD_PREP(MT753X_R02_EG_TAG_MASK, x)
80+
#define MT753X_R02_PORT_FW_MASK GENMASK(18, 16)
81+
#define MT753X_R02_PORT_FW(x) FIELD_PREP(MT753X_R02_PORT_FW_MASK, x)
82+
#define MT753X_R01_EG_TAG_MASK GENMASK(8, 6)
83+
#define MT753X_R01_EG_TAG(x) FIELD_PREP(MT753X_R01_EG_TAG_MASK, x)
84+
#define MT753X_R01_PORT_FW_MASK GENMASK(2, 0)
7185

7286
/* Register for :03 and :0E MAC DA frame control */
7387
#define MT753X_RGAC2 0x2c
88+
#define MT753X_R0E_EG_TAG_MASK GENMASK(24, 22)
89+
#define MT753X_R0E_EG_TAG(x) FIELD_PREP(MT753X_R0E_EG_TAG_MASK, x)
7490
#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16)
7591
#define MT753X_R0E_PORT_FW(x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x)
92+
#define MT753X_R03_EG_TAG_MASK GENMASK(8, 6)
93+
#define MT753X_R03_EG_TAG(x) FIELD_PREP(MT753X_R03_EG_TAG_MASK, x)
94+
#define MT753X_R03_PORT_FW_MASK GENMASK(2, 0)
7695

7796
enum mt753x_bpdu_port_fw {
7897
MT753X_BPDU_FOLLOW_MFC,
@@ -253,6 +272,7 @@ enum mt7530_port_mode {
253272
enum mt7530_vlan_port_eg_tag {
254273
MT7530_VLAN_EG_DISABLED = 0,
255274
MT7530_VLAN_EG_CONSISTENT = 1,
275+
MT7530_VLAN_EG_UNTAGGED = 4,
256276
};
257277

258278
enum mt7530_vlan_port_attr {

0 commit comments

Comments
 (0)