storm: meters from 24 up, plainer parser, documentation from the review

Storm control used meters 0 to 39, the same meters the ACL hands out,
so a storm limit and an acl meter could overwrite each other. It now
uses 24 + port * 4 + type, meters 24 to 63.

parse_storm() is no longer reentrant and uses plain locals, looks the
type up in a while loop and returns straight from the one-line cases.
storm_show() uses plain locals too.

The documentation says how IGMP decides between mcast and umcast, how
to get from a meter index to its limit, where the IFG bit of a meter
is, and what an ingress bandwidth limit on the same port does to the
storm limit.
This commit is contained in:
DrDoof committed 2026-09-30 22:48:31 +02:00
1 parent 26547f3e01
commit de431c6d84
5 files changed
+44 -32

No files matched your search

+13 -18
View File
@@ -1576,31 +1576,26 @@ err:
static __code char * __code storm_types[STORM_TYPES] = { "bcast", "mcast", "ucast", "umcast" };
void parse_storm(void) __reentrant
void parse_storm(void)
{
static __xdata uint8_t port, type, d;
static __xdata uint32_t rate;
static __xdata uint8_t * __xdata p;
uint8_t port, type, d;
__xdata uint32_t rate;
__xdata uint8_t *p;
if (cmd_words_len == 1) {
storm_show();
return;
}
if (cmd_words_len < 4 || cmd_parse_port_separator(cmd_words_b[1]) == 0)
if (cmd_words_len == 1)
return storm_show();
if (cmd_words_len < 4 || !cmd_parse_port_separator(cmd_words_b[1]))
goto err;
port = atoi_results_u8;
for (type = 0; type < STORM_TYPES; type++) {
if (cmd_compare(2, storm_types[type]))
break;
type = 0;
while (!cmd_compare(2, storm_types[type])) {
if (++type == STORM_TYPES)
goto err;
}
if (type == STORM_TYPES)
goto err;
if (cmd_words_len == 4 && cmd_compare(3, "off")) {
storm_off(port, type);
return;
}
if (cmd_words_len == 4 && cmd_compare(3, "off"))
return storm_off(port, type);
if (cmd_words_len != 5)
goto err;