From 5c5dcb52094cb630da12b1659f0989d0700fdc78 Mon Sep 17 00:00:00 2001 From: d00f Date: Fri, 14 Aug 2026 01:04:20 +0200 Subject: [PATCH] igmp: drop the duplicate port configuration loop igmp_setup() writes the per-port IGMP configuration twice, once with the value spelled out and once with the same number assembled from the constants: IGMP_MAX_GROUP | IGMP_PROTOCOL_ENABLE | IGMP_FLOOD is exactly 0x00ff7c15. The second loop carries the comment block explaining the bit layout, so the literal one is the one to drop. Today the cost is one redundant register write, because REG_SET is not a single statement and the unbraced loop body only ever reaches index machine.max_port + 1. Once the macro is wrapped it becomes one redundant write per port on every boot and on every "igmp off", which is what makes this worth removing rather than leaving. Fifty nine bytes of BANK1 on SWTGW218AS, nothing anywhere else. --- rtl837x_igmp.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/rtl837x_igmp.c b/rtl837x_igmp.c index ec9d59a..3b267af 100644 --- a/rtl837x_igmp.c +++ b/rtl837x_igmp.c @@ -96,11 +96,6 @@ void igmp_setup(void) __banked // Enable lookup of IPv4 MC addresses in table reg_bit_set(RTL837X_L2_CTRL, L2_CTRL_LUT_IPMC_HASH); - // Configure per-port IGMP configuration, bits 0-10 enable MC protocol snooping, - // bits 16-24 configure max MC group used by that port. For now all protocols are flooded (01) - for (i = machine.min_port; i <= machine.max_port; i++) - REG_SET(RTL837X_IGMP_PORT_CFG + (i << 2), 0x00ff7c15); - /* Configure per-port IGMP operations when protocol messages are received * bits 0-9 enable MC protocol snooping * bit 10: Enable dynamic router port learning