mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
A reserved-multicast trap goes to the port named in EXT_CPU_CTRL, which names no port out of reset, so trapped frames were dropped at ingress. trap_init() points it at the CPU port once at startup, and trap_rma_set() changes only the action field of an RMA register. A trapped frame arrives without the VLAN tag a forwarded one gets, so TRAP_RX_BODY() gives the offset of the payload for both forms. STP now traps its address while it runs instead of steering it with a static L2 entry per VLAN, so turning it on no longer walks the VLAN table and a pvid change no longer needs stp off and on. With STP off the flooding entries are restored as before. A trapped BPDU passes the tagged-only ingress filter that drops a forwarded one, so the stp_setup() warning about such ports goes.
17 lines
404 B
C
17 lines
404 B
C
#ifndef _RTL837X_TRAP_H_
|
|
#define _RTL837X_TRAP_H_
|
|
|
|
#include <stdint.h>
|
|
#include "rtl837x_common.h"
|
|
|
|
#define TRAP_RX_HDR_SIZE (12 + RTL_TAG_SIZE)
|
|
|
|
#define TRAP_RX_BODY() \
|
|
((uip_buf[TRAP_RX_HDR_SIZE] == 0x81 && uip_buf[TRAP_RX_HDR_SIZE + 1] == 0x00) \
|
|
? TRAP_RX_HDR_SIZE + VLAN_TAG_SIZE : TRAP_RX_HDR_SIZE)
|
|
|
|
void trap_init(void) __banked;
|
|
void trap_rma_set(uint16_t reg, uint8_t act) __banked;
|
|
|
|
#endif
|