mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 02:19:06 +04:00
realtek: dsa: rtl930x: write the source port field once
The encoder ORs the source port field twice: first the raw port, then the value it composes from the trunk or stack device and the port. Both land on the same ten bits, so what reaches the hardware is the two values ORed together rather than the composed one. For an entry that came from the decoder without a trunk the two agree, because the decoder masked the port down to six bits and the composition puts the stack device back above it. For a trunk entry the decoder leaves the whole field in port and the composition rebuilds it from trunk, so the first OR contributes bits the second does not, and the entry is written with a source port that is neither. Drop the first OR: the composition below covers both branches. Compile-tested on realtek/rtl930x and realtek/rtl838x. Not exercised on hardware: the driver writes no trunk entry of its own, and a trunk entry read back and rewritten is the case this affects. Assisted-by: Claude:claude-opus-5 Signed-off-by: Gennaro Cimmino <gcimmino@rayonra.net> Link: https://github.com/openwrt/openwrt/pull/25220 Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
This commit is contained in:
1 parent
c253271f32
commit
73e1cc119e
1 file changed
-1
@@ -524,7 +524,6 @@ static void rtl930x_fill_l2_row(u32 r[], struct rtl838x_l2_entry *e)
|
||||
if (e->type == L2_UNICAST) {
|
||||
r[2] |= e->is_static ? BIT(14) : 0;
|
||||
r[1] |= e->rvid & 0xfff;
|
||||
r[2] |= (e->port & 0x3ff) << 20;
|
||||
if (e->is_trunk) {
|
||||
r[2] |= BIT(30);
|
||||
port = e->stack_dev << 9 | (e->port & 0x3f);
|
||||
|
||||
Reference in new issue
Block a user