mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-09-02 15:02:51 +08:00
Do not insert the management VLAN tag into a CPU-tagged frame
tcpip_output() splices the 802.1Q tag in right behind the source address, which is exactly where the ASIC expects the RTL tag of a frame the CPU addressed to a port itself. The tag then ends up behind the VLAN tag, the ASIC does not find it, and the frame goes out flooded with the 0x8899 header still on it instead of being sent to the port that was asked for. Whether a frame is CPU-tagged is a property of the frame, so decide it here from the ether-type rather than having every sender of such a frame clear management_vlan around its tcpip_output() call. stp_cnf_send() did that, and no longer has to.
This commit is contained in:
+6
-2
@@ -203,6 +203,9 @@ struct nonq_frame {
|
||||
// The output frame structure with 802.1Q field and the padding moved before the buffer-start
|
||||
#define FRAME_Q ((__xdata struct q_frame *)&uip_buf[0])
|
||||
|
||||
// Ether-type of the output frame, which is the RTL tag on a CPU-tagged frame
|
||||
#define FRAME_ETHERTYPE (*(__xdata uint16_t *)&uip_buf[RTL_FRAME_DESC_SIZE + 2 * sizeof(struct uip_eth_addr)])
|
||||
|
||||
void isr_timer0(void) __interrupt(1)
|
||||
{
|
||||
}
|
||||
@@ -1097,8 +1100,9 @@ void tcpip_output(void)
|
||||
FRAME->len = uip_len;
|
||||
FRAME->reserved_2[0] = 0x00; FRAME->reserved_2[1] = 0x00;
|
||||
|
||||
// For the management VLAN we insert an 802.1Q VLAN tag
|
||||
if (management_vlan) {
|
||||
// For the management VLAN we insert an 802.1Q VLAN tag, but never into a
|
||||
// CPU-tagged frame, where the ASIC expects its tag right behind the addresses
|
||||
if (management_vlan && FRAME_ETHERTYPE != HTONS(RTL_FRAME_TAG_ID)) {
|
||||
// Shift the ethernet header before the HW type including the rtl_frame_desc to the beginning of uip_buf
|
||||
// to allow space to insert the dot 1Q tag
|
||||
for (uint8_t i = 0; i < sizeof(struct q_frame) - DOT_1Q_TAG_SIZE; i++)
|
||||
|
||||
Reference in New Issue
Block a user