Ethernet Processing

The High MAC Framework implements efficient processing of Ethernet receptions. The code is built on top of the scatter-gather capabilities of the DMA core attached to the Ethernet MAC in the FPGA design. The Ethernet Rx processing is tightly coupled with the High MAC Framework’s Queue, Encapsulation, and wlan_exp subsystems.

Initialization

The Queue subsystem is used by platform-dependent code for initializing one or more Ethernet interfaces. The Ethernet scatter-gather DMAs are configured so that a burst of receptions will automatically fill queue entries.

Handling Ethernet Receptions

The High MAC framework provides two points of ingress for Ethernet frames:

  • Packets destined for Encapsulation and wireless transmissions are consumed by wlan_enqueue_eth_rx() in wlan_mac_eth_util.c
  • Packets destined for the wlan_exp subsystem are consumed by wlan_exp_process_eth_rx() in wlan_exp_node.c

Notably, the these two points of ingress might be served by their own dedicated Ethernet interfaces or they might be served by a single shared Ethernet interface, depending on specific platform capabilities.

In either of these contexts, the payload of the packet has already been copied into an Ethernet queue buffer via the platform’s Ethernet DMA. It is the responsibility of these two contexts to either enqueue the received packet somewhere (e.g. for wireless transmission) or to free the queue buffer back to the queue subsystem. This structure minimizes the number of times a payload is copied to different parts of memory.

Immediately following a reception, the platform-dependent receive processing checks out new queue buffer space to reconfigure any buffer descriptors just finished by the platform’s Ethernet DMA.

Handling Ethernet Transmissions

Hardware platforms must provide two points of egress for Ethernet frames:

  • A wlan_platform_portal_eth_send() function that sends Ethernet frames meant for the portal
  • A wlan_platform_wlan_exp_eth_send() function that sends Ethernet frames meant for wlan_exp hosts

Depending on the capabilities of the platform, these two contexts may use a single shared Ethernet interface.

In either of these contexts, the platform will configure its Ethernet DMA to send the Ethernet frame provided by the call from the framework. If it is not currently able to do this, it will return an error to the calling context so that the frame may be re-enqueued for future transmission.