mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-13 19:48:16 +04:00
realtek: l3: rtl839x: trap packets to an aged-out gateway
On RTL839x a route forwards through its gateway's L2 entry. A gateway that sends nothing lets that entry age out, and a packet routed through it then hits the routing entry age-out exception, whose action is forward after reset: the packet is routed and also reaches the CPU, which routes it a second time when IPv4 forwarding is on. Trap it instead (ROUTING_AGE, bits 15:14 of ROUTING_EXCPT_CTRL: 0 drop, 1 forward, 2 trap; Realtek GPL SDK, dal_cypress_trap.c, exception ROUTE_EXCEPTION_TYPE_ENTRY_AGE_OUT), as the TTL exception already does. The CPU routes such packets alone until the gateway sends again and its entry is learnt anew. Measured on an HPE 1920-48G (RTL8393), 10.99.0.0/16 via a gateway that sends nothing, 8 echo requests per case, once the age of its L2 entry had run down to 0 (about 4.5 minutes on the bench): - without this change: forwarding off, 8/8 routed and 8/8 at the CPU as well; forwarding on, 14 at the gateway, 8 from the switch and 6 from the kernel - with it: forwarding off, none routed, 8/8 at the CPU; forwarding on, 8 at the gateway, none of them twice With a fresh entry, 8/8 were routed in hardware and none reached the CPU, without and with this change. Both images also carried the pending switch MAC change for #25768 items 3 and 4 and bench debugfs files. Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net> Link: https://github.com/openwrt/openwrt/pull/25821 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
1 parent
f866c69e9b
commit
aef4cf2215
1 file changed
+7
@@ -296,6 +296,13 @@ static int otto_l3_839x_setup(struct otto_l3_ctrl *ctrl)
|
||||
*/
|
||||
sw_w32_mask(0x3 << 2, 2 << 2, RTL839X_ROUTING_EXCPT_CTRL);
|
||||
|
||||
/* A packet routed through a gateway whose L2 entry has aged out goes
|
||||
* to the CPU alone. Forwarded, the default, it is routed and reaches
|
||||
* the CPU as well, which routes it a second time. ROUTING_AGE, bits
|
||||
* 15:14, same encoding.
|
||||
*/
|
||||
sw_w32_mask(0x3 << 14, 2 << 14, RTL839X_ROUTING_EXCPT_CTRL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user