mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
cmd: give mtu a lower bound as well as an upper one
"mtu 1 0" was accepted. The chip takes it verbatim, the port reports 0x0000 back, and it stops passing frames: on a live 2.5G LAG member the LACPDU receives moved by 4 in fifteen seconds against 21 on the sibling port, and the partner went expired. Restoring the size brought both back. Nothing shorter than a minimum Ethernet frame is a usable maximum, so the range is now 64 to 16383. The upper end is unchanged and still comes from the width of the field the value is written into. This also covers most of #312 by accident: "mtu 1 abc" leaves the parse result at 0 and now gets rejected on the bound rather than reaching the register. It does not cover all of it. The handler still ignores what atoi_short() returns, so "mtu 1 99999" stops on a partial 9999 and goes through as a number nobody typed. The GUI is not affected either way, it offers a fixed list of sizes.
This commit is contained in:
+2
-2
@@ -737,8 +737,8 @@ void parse_mtu(void)
|
||||
return;
|
||||
}
|
||||
atoi_short(&mtu, cmd_words_b[2]);
|
||||
if (mtu > 0x3fff) {
|
||||
print_string("Maximum MTU is 16383\n");
|
||||
if (mtu < 64 || mtu > 0x3fff) {
|
||||
print_string("MTU must be 64..16383\n");
|
||||
return;
|
||||
}
|
||||
REG_WRITE(RTL8373_REG_MAC_L2_PORT_MAX_LEN + ((uint16_t) p << 8), (mtu >> 10) & 0xf, (mtu >> 2) & 0xff,
|
||||
|
||||
Reference in New Issue
Block a user