Skip to content

Conversation

sharadanand
Copy link

To properly support protocols like LLDP, EAPOL, and MSTP, the driver must configure the switch to trap their management frames to the CPU rather than forwarding them. This commit adds support for configuring these frame traps on RTL93xx devices.

@github-actions github-actions bot added the target/realtek pull request/issue for realtek target label Jul 28, 2025
@Djfe
Copy link
Contributor

Djfe commented Jul 28, 2025

I'm not sure what Test Formalities is complaining about. maybe a missing space between name and mail address in the "Signed-off-by" line?

@sharadanand sharadanand force-pushed the rtl931x-traffic-cpu-trap branch 2 times, most recently from 0a285a0 to ac5f274 Compare August 4, 2025 08:24
@sharadanand sharadanand force-pushed the rtl931x-traffic-cpu-trap branch 3 times, most recently from 285109a to 26c0e18 Compare August 8, 2025 15:38
@howels
Copy link

howels commented Aug 8, 2025

Is this ready for testing with LLDP?

case BPDU:
reg = RTL930X_RMA_BPDU_CTRL + (port / 10) * 4;
shift = (port % 10) * 3;
sw_w32_mask(7 << shift, value << shift, reg);

This comment was marked as resolved.

Comment on lines +685 to +693
case FLOODALL:
value = 4;
break;

This comment was marked as resolved.

@ecsv
Copy link
Contributor

ecsv commented Aug 8, 2025

Is this ready for testing with LLDP?

What do you mean by testing? That LLDP is no longer forwarded to other ports but instead trapped to the CPU? After looking at the code, I would assume that this should work on RTL930x.

Comment on lines +668 to +669
/* hack for value mapping */
if (type == GRATARP && action == COPY2CPU)
action = TRAP2MASTERCPU;

This comment was marked as resolved.

Comment on lines 725 to 735
case GRATARP:
/* NOSUPPORT */
break;

This comment was marked as resolved.

@sharadanand sharadanand force-pushed the rtl931x-traffic-cpu-trap branch from 26c0e18 to f198a03 Compare August 11, 2025 07:28
@howels
Copy link

howels commented Aug 14, 2025

EDIT - this build also appears to prevent tagged VLAN traffic, will test further.

Tested on the Onti (clone of Xikestor SK8300X-8S) and while I do now see LLDP frames on the CPU port, there is also quite a lot of LLDP duplication occuring, which presents as the attached clients seeing frames from all active switch ports instead of just the attached interface:

-------------------------------------------------------------------------------
LLDP neighbors:
-------------------------------------------------------------------------------
Interface:    enp6s0, via: LLDP, RID: 303, Time: 0 day, 00:07:14
  Chassis:     
    ChassisID:    mac d0:aa:5f:00:1a:64
    SysName:      onti
    SysDescr:     OpenWrt SNAPSHOT @ onti
    MgmtIP:       A.B.C.D
    MgmtIface:    12
    MgmtIP:       A.B.C.D IPv6
    MgmtIface:    2
    Capability:   Bridge, on
    Capability:   Router, on
    Capability:   Wlan, off
    Capability:   Station, off
  Port:        
    PortID:       mac d0:aa:5f:00:1a:64
    PortDescr:    lan1
    TTL:          120
-------------------------------------------------------------------------------
Interface:    enp6s0, via: LLDP, RID: 303, Time: 0 day, 00:07:14
  Chassis:     
    ChassisID:    mac d0:aa:5f:00:1a:64
    SysName:      onti
    SysDescr:     OpenWrt SNAPSHOT @ onti
    MgmtIP:       A.B.C.D
    MgmtIface:    12
    MgmtIP:      A.B.C.D IPv6
    MgmtIface:    2
    Capability:   Bridge, on
    Capability:   Router, on
    Capability:   Wlan, off
    Capability:   Station, off
  Port:        
    PortID:       mac d2:aa:5f:00:1a:67
    PortDescr:    lan4
    TTL:          120
-------------------------------------------------------------------------------
Interface:    enp6s0, via: LLDP, RID: 303, Time: 0 day, 00:07:14
  Chassis:     
    ChassisID:    mac d0:aa:5f:00:1a:64
    SysName:      onti
    SysDescr:     OpenWrt SNAPSHOT @ onti
    MgmtIP:       A.B.C.D
    MgmtIface:    12
    MgmtIP:       A.B.C.D IPv6
    MgmtIface:    2
    Capability:   Bridge, on
    Capability:   Router, on
    Capability:   Wlan, off
    Capability:   Station, off
  Port:        
    PortID:       mac d2:aa:5f:00:1a:68
    PortDescr:    lan5
    TTL:          120
-------------------------------------------------------------------------------

@howels
Copy link

howels commented Aug 15, 2025

Tagged VLAN traffic is accepted on the CPU port, but not forwarded to other tagged switch ports when this branch is used.

@ecsv

This comment was marked as resolved.

@howels
Copy link

howels commented Aug 17, 2025

Tagged VLAN traffic is accepted on the CPU port, but not forwarded to other tagged switch ports when this branch is used.

@howels can't test this myself. But I find it a little bit odd (after I reviewed the code) because should not interact with the VLANs. But maybe we can understand this better: Is it triggered by the line

	rtl83xx_setup_lldp_traps(priv);

or

	rtl83xx_setup_bpdu_traps(priv);

Or by both.

Just remove these lines (1. the first one, 2. the second one, 3. both) in `rtl93xx_setup(), build a new images and test again.

I commented out the BPDU trap setup and tagged VLANs are working again:

	rtl83xx_setup_lldp_traps(priv);
	//rtl83xx_setup_bpdu_traps(priv);

@ecsv

This comment was marked as resolved.

@ecsv

This comment was marked as resolved.

@howels
Copy link

howels commented Aug 18, 2025

Can you clarify:

Tagged VLAN traffic is accepted on the CPU port, but not forwarded to other tagged switch ports when this branch is used.

Do you mean:

1. * you **can** send tagged VLAN traffic from the CPU port to other ports which are tagged member of the VLAN?
   * you **cannot** send from one tagged CPU port the other one (when both are tagged members of the VLAN)

2. * you **cannot** send tagged VLAN traffic from the CPU port to other ports which are tagged member of the VLAN?
   * you **cannot** send from one tagged CPU port the other one (when both are tagged members of the VLAN)

3. * you **cannot** send tagged VLAN traffic from the CPU port to other ports which are tagged member of the VLAN?
   * you **can** send from one tagged CPU port the other one (when both are tagged members of the VLAN)

Are you using (M)STP? Is changing this line (while this branch is used without any extra changes) having any effect?

diff --git i/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c w/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
index eef52e4ac2..359614b06e 100644
--- i/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
+++ w/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/common.c
@@ -1539,7 +1539,7 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev)
 		 */
 		priv->version = RTL8390_VERSION_A;
 		priv->n_lags = 16;
-		sw_w32(1, RTL930X_ST_CTRL);
+		sw_w32(0, RTL930X_ST_CTRL);
 		priv->l2_bucket_size = 8;
 		priv->n_pie_blocks = 16;
 		priv->port_ignore = 0x3f;

EDIT: Hm, the MSTI states require most likely a lot more changes:

From: Issam Hamdi <ih@simonwunderlich.de>
Date: Tue, 15 Jul 2025 20:22:26 +0200
Subject: realtek: rtl83xx: support multi spanning tree

- Add support for creating the msti per vlans and ports
- Add support for setting state per msti

- (Re)associating VLANs with an MSTI:

          bridge vlan global set dev <BR> vid <X> msti <Y>

- Setting the port state in a given MSTI:

          bridge mst set dev <PORT> msti <Y> state <Z>

Signed-off-by: Issam Hamdi <ih@simonwunderlich.de>

diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
index 1f6a60f78a38452d9f938cc0408f006305f6845a..fccaa7afc22947ceb5a0ed4f4446e6f3021b9524 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
@@ -1246,9 +1246,9 @@ static void rtl83xx_port_bridge_leave(struct dsa_switch *ds, int port,
 	mutex_unlock(&priv->reg_mutex);
 }
 
-void rtl83xx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
+static void rtl83xx_port_xstp_state_set(struct dsa_switch *ds, int port,
+				   u8 state, u32 msti)
 {
-	u32 msti = 0;
 	u32 port_state[4];
 	int index, bit;
 	int pos = port;
@@ -1301,6 +1301,11 @@ void rtl83xx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
 	mutex_unlock(&priv->reg_mutex);
 }
 
+void rtl83xx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
+{
+	rtl83xx_port_xstp_state_set(ds, port, state, 0);
+}
+
 void rtl83xx_fast_age(struct dsa_switch *ds, int port)
 {
 	struct rtl838x_switch_priv *priv = ds->priv;
@@ -2489,6 +2494,33 @@ static int rtl93xx_cls_flower_stats(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int rtl83xx_port_mst_state_set(struct dsa_switch *ds, int port,
+					const struct switchdev_mst_state *st)
+{
+	rtl83xx_port_xstp_state_set(ds, port, st->state, st->msti);
+
+	return 0;
+}
+
+static int rtl83xx_vlan_msti_set(struct dsa_switch *ds,
+				 struct dsa_bridge bridge,
+				 const struct switchdev_vlan_msti *msti)
+{
+	struct rtl838x_vlan_info info;
+	struct rtl838x_switch_priv *priv = ds->priv;
+
+	if (msti->msti > 0x7f)
+		return -1;
+
+	priv->r->vlan_tables_read(msti->vid, &info);
+
+	info.fid = msti->msti;
+
+	priv->r->vlan_set_tagged(msti->vid, &info);
+
+	return 0;
+}
+
 static int rtl931x_port_vlan_fast_age(struct dsa_switch *ds, int port, u16 vid)
 {
 	struct rtl838x_switch_priv *priv = ds->priv;
@@ -2564,10 +2596,12 @@ const struct dsa_switch_ops rtl83xx_switch_ops = {
 	.port_bridge_leave	= rtl83xx_port_bridge_leave,
 	.port_stp_state_set	= rtl83xx_port_stp_state_set,
 	.port_fast_age		= rtl83xx_fast_age,
+	.port_mst_state_set	= rtl83xx_port_mst_state_set,
 
 	.port_vlan_filtering	= rtl83xx_vlan_filtering,
 	.port_vlan_add		= rtl83xx_vlan_add,
 	.port_vlan_del		= rtl83xx_vlan_del,
+	.vlan_msti_set		= rtl83xx_vlan_msti_set,
 
 	.port_fdb_add		= rtl83xx_port_fdb_add,
 	.port_fdb_del		= rtl83xx_port_fdb_del,
@@ -2622,10 +2656,12 @@ const struct dsa_switch_ops rtl930x_switch_ops = {
 	.port_bridge_leave	= rtl83xx_port_bridge_leave,
 	.port_stp_state_set	= rtl83xx_port_stp_state_set,
 	.port_fast_age		= rtl930x_fast_age,
+	.port_mst_state_set	= rtl83xx_port_mst_state_set,
 
 	.port_vlan_filtering	= rtl83xx_vlan_filtering,
 	.port_vlan_add		= rtl83xx_vlan_add,
 	.port_vlan_del		= rtl83xx_vlan_del,
+	.vlan_msti_set		= rtl83xx_vlan_msti_set,
 	.port_vlan_fast_age	= rtl930x_port_vlan_fast_age,
 
 	.port_fdb_add		= rtl83xx_port_fdb_add,

And

From: Issam Hamdi <ih@simonwunderlich.de>
Date: Tue, 15 Jul 2025 19:41:13 +0200
Subject: realtek: rtl93xx: implement the vlan fast age

Signed-off-by: Issam Hamdi <ih@simonwunderlich.de>

diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
index 0caeb35e70a12e18aebe4ab4553ba9fe2f9d55ac..1f6a60f78a38452d9f938cc0408f006305f6845a 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
@@ -2489,6 +2489,53 @@ static int rtl93xx_cls_flower_stats(struct dsa_switch *ds, int port,
 	return 0;
 }
 
+static int rtl931x_port_vlan_fast_age(struct dsa_switch *ds, int port, u16 vid)
+{
+	struct rtl838x_switch_priv *priv = ds->priv;
+	u32 val = 0x0;
+
+	mutex_lock(&priv->reg_mutex);
+
+	val |= BIT(10);
+	val |= port << 11;
+	val |= BIT(24);
+	val |= BIT(26);
+	val |= BIT(28);
+
+	sw_w32(val, RTL931X_L2_TBL_FLUSH_CTRL);
+	sw_w32(vid << 20, RTL931X_L2_TBL_FLUSH_CTRL + 4);
+
+	do { } while (sw_r32(RTL931X_L2_TBL_FLUSH_CTRL) & BIT (28));
+
+	mutex_unlock(&priv->reg_mutex);
+	return 0;
+}
+
+static int rtl930x_port_vlan_fast_age(struct dsa_switch *ds, int port, u16 vid)
+{
+	struct rtl838x_switch_priv *priv = ds->priv;
+	u32 val = 0;
+
+	if (priv->family_id == RTL9310_FAMILY_ID)
+		return rtl931x_port_vlan_fast_age(ds, port, vid);
+
+	pr_debug("VLAN FAST AGE port %d, vid %d\n", port, vid);
+	mutex_lock(&priv->reg_mutex);
+
+	sw_w32(port << 11, RTL930X_L2_TBL_FLUSH_CTRL + 4);
+
+	val |= vid << 12;
+	val |= BIT(26);
+	val |= BIT(28);
+	val |= BIT(30);
+	sw_w32(val, RTL930X_L2_TBL_FLUSH_CTRL);
+
+	do { } while (sw_r32(priv->r->l2_tbl_flush_ctrl) & BIT(30));
+	mutex_unlock(&priv->reg_mutex);
+
+	return 0;
+}
+
 const struct dsa_switch_ops rtl83xx_switch_ops = {
 	.get_tag_protocol	= rtl83xx_get_tag_protocol,
 	.setup			= rtl83xx_setup,
@@ -2579,6 +2626,7 @@ const struct dsa_switch_ops rtl930x_switch_ops = {
 	.port_vlan_filtering	= rtl83xx_vlan_filtering,
 	.port_vlan_add		= rtl83xx_vlan_add,
 	.port_vlan_del		= rtl83xx_vlan_del,
+	.port_vlan_fast_age	= rtl930x_port_vlan_fast_age,
 
 	.port_fdb_add		= rtl83xx_port_fdb_add,
 	.port_fdb_del		= rtl83xx_port_fdb_del,

And

From: Issam Hamdi <ih@simonwunderlich.de>
Date: Sun, 6 Apr 2025 14:51:26 +0200
Subject: realtek: rtl93xx: enable bypass egress STP

During MSTP testing, we observed that when multicast traffic is transmitted
over the bridge and a local loop forms between two of its ports,
it results in a multicast storm and significantly high CPU usage.

The solution is to enable STP egress bypass to ensure that BPDUs are
still forwarded even when the port is in blocking or learning state,
especially when multicast traffic is being blocked.

Signed-off-by: Issam Hamdi <ih@simonwunderlich.de>

diff --git a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
index 982023fe39f0170547abf09421b056d425425b66..7b2e6f6a15ab172cab7c57196ddc61462ba5b5b7 100644
--- a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c
@@ -129,7 +129,8 @@ struct notify_b {
 	u32			reserved2[8];
 };
 
-static void rtl838x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
+static void rtl838x_create_tx_header(struct p_hdr *h, unsigned int dest_port,
+				     int prio, unsigned char *dest)
 {
 	/* cpu_tag[0] is reserved on the RTL83XX SoCs */
 	h->cpu_tag[1] = 0x0400;  /* BIT 10: RTL8380_CPU_TAG */
@@ -143,7 +144,8 @@ static void rtl838x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 		h->cpu_tag[2] |= ((prio & 0x7) | BIT(3)) << 12;
 }
 
-static void rtl839x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
+static void rtl839x_create_tx_header(struct p_hdr *h, unsigned int dest_port,
+				     int prio, unsigned char *dest)
 {
 	/* cpu_tag[0] is reserved on the RTL83XX SoCs */
 	h->cpu_tag[1] = 0x0100; /* RTL8390_CPU_TAG marker */
@@ -164,7 +166,8 @@ static void rtl839x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 		h->cpu_tag[2] |= ((prio & 0x7) | BIT(3)) << 8;
 }
 
-static void rtl930x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
+static void rtl930x_create_tx_header(struct p_hdr *h, unsigned int dest_port,
+				     int prio, unsigned char *dest)
 {
 	h->cpu_tag[0] = 0x8000;  /* CPU tag marker */
 	h->cpu_tag[1] = h->cpu_tag[2] = 0;
@@ -177,9 +180,14 @@ static void rtl930x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 	/* Enable (AS_QID) and set priority queue (QID) */
 	if (prio >= 0)
 		h->cpu_tag[2] = (BIT(5) | (prio & 0x1f)) << 8;
+
+	/* ignore STP port state */
+	if (unlikely(is_link_local_ether_addr(dest)) && (dest[5] == 0x00))
+		h->cpu_tag[1] |= BIT(2);
 }
 
-static void rtl931x_create_tx_header(struct p_hdr *h, unsigned int dest_port, int prio)
+static void rtl931x_create_tx_header(struct p_hdr *h, unsigned int dest_port,
+				     int prio, unsigned char *dest)
 {
 	h->cpu_tag[0] = 0x8000;  /* CPU tag marker */
 	h->cpu_tag[1] = h->cpu_tag[2] = 0;
@@ -197,6 +205,10 @@ static void rtl931x_create_tx_header(struct p_hdr *h, unsigned int dest_port, in
 	/* Enable (AS_QID) and set priority queue (QID) */
 	if (prio >= 0)
 		h->cpu_tag[2] = (BIT(5) | (prio & 0x1f)) << 8;
+
+	/* ignore STP port state */
+	if (unlikely(is_link_local_ether_addr(dest)) && (dest[5] == 0x00))
+		h->cpu_tag[1] |= BIT(2);
 }
 
 // Currently unused
@@ -1166,7 +1178,8 @@ static int rtl838x_eth_tx(struct sk_buff *skb, struct net_device *dev)
 		}
 
 		if (dest_port >= 0)
-			priv->r->create_tx_header(h, dest_port, skb->priority >> 1);
+			priv->r->create_tx_header(h, dest_port, skb->priority >> 1,
+						  eth_hdr(skb)->h_dest);
 
 		/* Copy packet data to tx buffer */
 		memcpy((void *)KSEG1ADDR(h->buf), skb->data, len);
diff --git a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h
index 8d138cabb9d6659408c7e6039d4848cefae5e311..daef4eb5be3a8009c53736fa9c82081abdeb7b39 100644
--- a/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h
+++ b/target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.h
@@ -441,7 +441,8 @@ struct rtl838x_eth_reg {
 	int mac;
 	int l2_tbl_flush_ctrl;
 	void (*update_cntr)(int r, int work_done);
-	void (*create_tx_header)(struct p_hdr *h, unsigned int dest_port, int prio);
+	void (*create_tx_header)(struct p_hdr *h, unsigned int dest_port,
+				 int prio, unsigned char *dest);
 	bool (*decode_tag)(struct p_hdr *h, struct dsa_tag *tag);
 };
 

I meant that I can only send tagged traffic to the CPU port, the tagged traffic is not sent to the other access ports lan1 - lan8 which are also members of the tagged VLAN.

Tagged traffic reaches the CPU port, tagged traffic does not reach any other tagged ports which are members of the same VLAN.

I am not running STP, so the lack of STP BPDU should not affect client reachability.

@@ -529,6 +529,9 @@ static int rtl93xx_setup(struct dsa_switch *ds)

rtl83xx_vlan_setup(priv);

rtl83xx_setup_lldp_traps(priv);
rtl83xx_setup_bpdu_traps(priv);

This comment was marked as resolved.

@sharadanand sharadanand force-pushed the rtl931x-traffic-cpu-trap branch from f198a03 to 2ecc734 Compare August 25, 2025 09:02
Copy link
Contributor

@plappermaul plappermaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. Please see comments.

Comment on lines 685 to 689
switch (type) {
case PTP:
case PTP_UDP:
case PTP_ETH2:
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this to the beginning and make a simple early-check / return.

Comment on lines 690 to 691
default:
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm not understanding all possible combinations But that can leave value uninitialized (e.g for BDPU).

Copy link
Contributor

@ecsv ecsv Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I'm not understanding all possible combinations But that can leave value uninitialized (e.g for BDPU).

No, the initialization of the value is directly below

	case FLOODALL:
		switch (type) {
		case PTP:
		case PTP_UDP:
		case PTP_ETH2:
			return;
		default:
			break;
		}

		value = 4;
		break;

If it something wants FLOODALL then it is getting the value 4. Only when it is PTP, PTP_UDP or PTP_ETH2, nothing happens (because this value is invalid for it).

The break refers to the inner switch - not the outer one. Unfortunately, C doesn't have labels to correctly mark this for breaks/continues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another argument to move this sub-switch to the beginning with early return for better readability.

@@ -529,6 +529,8 @@ static int rtl93xx_setup(struct dsa_switch *ds)

rtl83xx_vlan_setup(priv);

rtl83xx_setup_lldp_traps(priv);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are here. Doesn't this miss also the rtl83xx_setup_bpdu_traps() from the RTL83xx initialization routine?

Regardeless if you add only this or both functions. Please directly rename the added functions to rtldsa_setup...() to end this generic prefix confusion.

Copy link
Contributor

@ecsv ecsv Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While you are here. Doesn't this miss also the rtl83xx_setup_bpdu_traps() from the RTL83xx initialization routine?

I asked to remove this for now because @howels reported tagged VLAN problems when this line is added. And this PR needs to be merged (with #19802) to get LLDP working correctly.

I would show you my comment but github makes it hard to find old collapsed comments.

EDIT: #19571 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Then sinply rename rtl83xx_setup_lldp_traps to rtldsa_setup_lldp_traps() and change the two calling locations.

@sharadanand sharadanand force-pushed the rtl931x-traffic-cpu-trap branch from 2ecc734 to 0751267 Compare August 26, 2025 07:40
Copy link
Contributor

@plappermaul plappermaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

The functions to enable trapping of management frames are not RTL83xx
specific. It is more appropriate to use the more generic "rtldsa" prefix
for them.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded.

The function to implement the various management frame actions was already
present but not yet registered correctly.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
LLDP packets must be transmitted on a single port and trapped on a port of
a device which understands LLDP. It must not forward it to other ports to
avoid confusing neighbor information on connected devices.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
@hauke hauke force-pushed the rtl931x-traffic-cpu-trap branch from 0751267 to 18077d2 Compare August 26, 2025 21:45
@openwrt-bot openwrt-bot merged commit 18077d2 into openwrt:main Aug 26, 2025
3 checks passed
neheb pushed a commit to neheb/openwrt that referenced this pull request Aug 26, 2025
The functions to enable trapping of management frames are not RTL83xx
specific. It is more appropriate to use the more generic "rtldsa" prefix
for them.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
neheb pushed a commit to neheb/openwrt that referenced this pull request Aug 26, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
neheb pushed a commit to neheb/openwrt that referenced this pull request Aug 26, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded.

The function to implement the various management frame actions was already
present but not yet registered correctly.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
neheb pushed a commit to neheb/openwrt that referenced this pull request Aug 26, 2025
LLDP packets must be transmitted on a single port and trapped on a port of
a device which understands LLDP. It must not forward it to other ports to
avoid confusing neighbor information on connected devices.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 27, 2025
The functions to enable trapping of management frames are not RTL83xx
specific. It is more appropriate to use the more generic "rtldsa" prefix
for them.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 27, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 27, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded.

The function to implement the various management frame actions was already
present but not yet registered correctly.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Vladdrako pushed a commit to Vladdrako/openwrt that referenced this pull request Aug 27, 2025
LLDP packets must be transmitted on a single port and trapped on a port of
a device which understands LLDP. It must not forward it to other ports to
avoid confusing neighbor information on connected devices.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Lienol pushed a commit to Lienol/openwrt that referenced this pull request Aug 27, 2025
The functions to enable trapping of management frames are not RTL83xx
specific. It is more appropriate to use the more generic "rtldsa" prefix
for them.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt/openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Lienol pushed a commit to Lienol/openwrt that referenced this pull request Aug 27, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt/openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Lienol pushed a commit to Lienol/openwrt that referenced this pull request Aug 27, 2025
Driver needs to configure management frame actions
To support LLDP, EAPOL or MSTP, which needs to be trapped to the CPU
instead of being forwarded.

The function to implement the various management frame actions was already
present but not yet registered correctly.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt/openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Lienol pushed a commit to Lienol/openwrt that referenced this pull request Aug 27, 2025
LLDP packets must be transmitted on a single port and trapped on a port of
a device which understands LLDP. It must not forward it to other ports to
avoid confusing neighbor information on connected devices.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: openwrt/openwrt#19571
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
target/realtek pull request/issue for realtek target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants