mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
igmp: only hand reports to the CPU while snooping is on
handle_rx() dispatched to igmp_packet_handler() on the destination address alone, so an ordinary IGMPv3 report off the wire reached the handler and could write a table entry whether or not anyone had asked for snooping. The STP branch right above it is gated on stpEnabled; this brings the IGMP branch in line. Snooping state lived only in the per-port registers, and the receive path cannot afford to read one per packet, so the flag shadows it: igmp_enable() sets it, igmp_setup() clears it, and igmp_setup() runs from both the boot path and "igmp off". While here, igmp off becomes an explicit subcommand instead of the fall-through, and an unrecognised igmp subcommand prints the usage line rather than silently turning snooping off. Six bytes of BANK1 and one of xdata, no internal RAM.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "machine.h"
|
||||
|
||||
extern __code struct machine machine;
|
||||
extern __xdata uint8_t igmpEnabled;
|
||||
|
||||
#include "uip.h"
|
||||
|
||||
@@ -85,6 +86,7 @@ void igmp_setup(void) __banked
|
||||
{
|
||||
uint8_t i;
|
||||
print_string("igmp_setup called\n");
|
||||
igmpEnabled = 0;
|
||||
// For now, forward all unkown IP-MC pkts (2 bits per port. 00: flood via floodmask, 01: drop, 10: trap, 11: to rport)
|
||||
REG_SET(RTL837X_IPV4_PORT_MC_LM_ACT, LOOKUP_MISS_FLOOD);
|
||||
REG_SET(RTL837X_IPV6_PORT_MC_LM_ACT, LOOKUP_MISS_FLOOD);
|
||||
@@ -130,6 +132,7 @@ void igmp_setup(void) __banked
|
||||
void igmp_enable(void) __banked
|
||||
{
|
||||
print_string("igmp_enable called\n");
|
||||
igmpEnabled = 1;
|
||||
// Configure trapping of unhandled IGMP protocol packets to CPU
|
||||
REG_SET(RTL837X_IGMP_TRAP_CFG, IGMP_CPU_PORT | IGMP_TRAP_PRIORITY);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user