Skip to contentSkip to conversation

net: stmmac: Add support for VLAN Rx filtering

PATCH In review Boon Khai Ng 1 participant 2 messages Mar 30, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 5/8 net: stmmac: Add support for VLAN Rx filtering

Add support for VLAN ID-based filtering by the MAC controller for MAC drivers that support it. Only the 12-bit VID field is used.

---
 .../net/ethernet/stmicro/stmmac/dwxgmac2.h    |  21 +-
 .../ethernet/stmicro/stmmac/dwxgmac2_core.c   | 191 +++++++++++++++++-
 2 files changed, 210 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +20 -1
index b7beaa197343..4c92828f21d6 100644
@@ -64,6 +64,10 @@
 #define XGMAC_VLAN_ESVL			BIT(18)
 #define XGMAC_VLAN_ETV			BIT(16)
 #define XGMAC_VLAN_VID			GENMASK(15, 0)
+#define XGMAC_VLAN_OFS			GENMASK(6, 2)
+#define XGMAC_VLAN_OFS_SHIFT		2
+#define XGMAC_VLAN_CT			BIT(1)
+#define XGMAC_VLAN_OB			BIT(0)
 #define XGMAC_VLAN_HASH_TABLE		0x00000058
 #define XGMAC_VLAN_INCL			0x00000060
 #define XGMAC_VLAN_VLTI			BIT(20)
@@ -149,6 +153,7 @@
 #define XGMAC_HWFEAT_FRPES		GENMASK(12, 11)
 #define XGMAC_HWFEAT_FRPPB		GENMASK(10, 9)
 #define XGMAC_HWFEAT_FRPSEL		BIT(3)
+#define XGMAC_HWFEAT_NRVF		GENMASK(2, 0)
 #define XGMAC_MAC_DPP_FSM_INT_STATUS	0x00000150
 #define XGMAC_MAC_FSM_CONTROL		0x00000158
 #define XGMAC_PRTYEN			BIT(1)
@@ -477,7 +482,8 @@
 /* RDES0 (write back format) */
 #define XGMAC_RDES0_VLAN_TAG_MASK	GENMASK(15, 0)
 
-/* MAC VLAN Tag Control */
+/* MAC VLAN Tag Control and VLAN Tag Data */
+#define XGMAC_VLAN_TAG_CTRL		0x00000050
 #define XGMAC_VLAN_TAG_CTRL_OB		BIT(0)
 #define XGMAC_VLAN_TAG_CTRL_CT		BIT(1)
 #define XGMAC_VLAN_TAG_CTRL_OFS_MASK	GENMASK(6, 2)
@@ -491,6 +497,11 @@
 #define XGMAC_VLAN_TAG_STRIP_FAIL	(0x2 << XGMAC_VLAN_TAG_CTRL_EVLS_SHIFT)
 #define XGMAC_VLAN_TAG_STRIP_ALL	(0x3 << XGMAC_VLAN_TAG_CTRL_EVLS_SHIFT)
 
+#define XGMAC_VLAN_TAG_DATA		0x00000054
+#define XGMAC_VLAN_TAG_DATA_ETV		BIT(17)
+#define XGMAC_VLAN_TAG_DATA_VEN		BIT(16)
+#define XGMAC_VLAN_TAG_DATA_VID		GENMASK(15, 0)
+
 /* Error Type or L2 Type(ET/LT) Field Number */
 #define XGMAC_ET_LT_VLAN_STAG		8
 #define XGMAC_ET_LT_VLAN_CTAG		9
@@ -499,4 +510,12 @@
 #define XGMAC_ET_LT_DVLAN_CTAG_STAG	12
 #define XGMAC_ET_LT_DVLAN_STAG_CTAG	13
 
+/* EXT VLAN Filtering HW FEAT */
+#define XGMAC_HWFEAT_NO_EXT		0
+#define XGMAC_HWFEAT_EXT_VLAN_4		1
+#define XGMAC_HWFEAT_EXT_VLAN_8		2
+#define XGMAC_HWFEAT_EXT_VLAN_16	3
+#define XGMAC_HWFEAT_EXT_VLAN_24	4
+#define XGMAC_HWFEAT_EXT_VLAN_32	5
+
 #endif /* __STMMAC_DWXGMAC2_H__ */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +190 -1

221 lines not on this page · raw message

Signature · 1 line
2.25.1
#1 lore raw

Please ignore this review, send out by accident.

My appologies for sending out this review by accident, this is meant for internal reivew, kindly ignore and close this thread. Thanks.