common: define the RTL frame-tag flag bits shared by STP and LACP

The rtl_tag `flags` word (LEARN_DIS, KEEP) and the `pmask` ALLOW-bit
semantics are properties of the RTL8_4 CPU tag, not of any one protocol:
STP injects BPDUs with LEARN_DIS set and LACP emits slow-protocol frames
the same way. Define them once in the shared header, with the HTONS
byte-order caveat documented, so every feature that hand-builds a CPU
tag frame uses the same constants.

(cherry picked from commit 7f905b3e90f9bc5df586a5138723d97edf3d6aaf)
This commit is contained in:
d00f
2026-08-04 03:17:08 +02:00
parent ab5e213ce9
commit b236a30564
+14
View File
@@ -71,6 +71,20 @@ struct vlan_tag {
#define VLAN_TAG_SIZE (sizeof (struct vlan_tag))
#define RTL_FRAME_TAG_ID 0x8899
#define RTL_FRAME_TAG_VERSION 0x04
/* Bits of the tag's `flags` word (word2), per Linux DSA tag_rtl8_4:
* bit15 EFID_EN | 14:12 EFID | 11 PRI_EN | 10:8 PRI |
* bit7 KEEP | 6 VSEL | 5 LEARN_DIS | 4:0 VIDX
* NOTE: this word must be written through HTONS like every other tag field -
* writing the constant raw puts the bits in the wrong byte (0x0020 raw lands on
* the wire as 0x2000 = EFID, not LEARN_DIS), the ASIC then fails to parse the
* tag and forwards the frame with the 0x8899 header still on it. */
#define RTL_TAG_LEARN_DIS 0x0020 /* do not learn the CPU's SA on the egress port */
#define RTL_TAG_KEEP 0x0080 /* keep the frame's 802.1Q tag format as injected */
/* The `pmask` word (word3): bit15 ALLOW selects how 14:0 is interpreted.
* ALLOW=0 -> forwarding port mask (directed egress: frame goes exactly to the
* ports set). ALLOW=1 -> allowance mask (permission filter on a normal lookup),
* which for a one-hot mask yields an empty egress set - the frame disappears.
* Directed egress therefore requires ALLOW cleared, as mainline does. */
// For TX, an 8 byte (plus 4 byte padding when when VLAN is enabled)
// header describing the frame to be moved to the Asic is used