uip: build the forwarding module only when configured

uip-fw.c forwards packets between several network interfaces. Nothing in
this firmware calls it: the only references to uip_fw_output() outside the
module are commented out in uip-split.c. It is compiled and linked all the
same, and its register pressure lands in direct RAM, which on SWTGW218AS is
already reported as having no spare space.

Add UIP_CONF_FORWARDING alongside the existing UIP_CONF_BROADCAST and build
the module only when it is set. A device that forwards turns it on and gets
the module unchanged; a single-interface device stops paying for it.

On SWTGW218AS the stack gains 9 bytes, from 151 available to 160, and BANK1
drops 1200 bytes, from 47994 to 46794.
This commit is contained in:
bloqaudio committed 2026-09-22 09:23:13 -05:00
1 parent 88454ec7d7
commit 175ca9464a
2 files changed
+18

No files matched your search

+4
View File
@@ -64,6 +64,8 @@
#include "../rtl837x_common.h" #include "../rtl837x_common.h"
#if UIP_FORWARDING
/* /*
* The list of registered network interfaces. * The list of registered network interfaces.
*/ */
@@ -535,3 +537,5 @@ uip_fw_periodic(void)
} }
} }
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
#endif /* UIP_FORWARDING */
+14
View File
@@ -464,6 +464,20 @@ extern __xdata uint8_t uip_buf[UIP_CONF_BUFFER_SIZE+2];
#define UIP_BROADCAST UIP_CONF_BROADCAST #define UIP_BROADCAST UIP_CONF_BROADCAST
#endif /* UIP_CONF_BROADCAST */ #endif /* UIP_CONF_BROADCAST */
/**
* Build the IP forwarding module.
*
* uip-fw.c forwards packets between several network interfaces. A
* single-interface device does not call it and should not pay for it.
*
* \hideinitializer
*/
#ifndef UIP_CONF_FORWARDING
#define UIP_FORWARDING 0
#else /* UIP_CONF_FORWARDING */
#define UIP_FORWARDING UIP_CONF_FORWARDING
#endif /* UIP_CONF_FORWARDING */
/** /**
* Print out a uIP log message. * Print out a uIP log message.
* *