Scatter/Gather
BCM5718 Programmer’s Guide
Broadcom
®
January 29, 2016 • 5718-PG108-R
Page 130
Scatter/Gather
Most often, the host software requests the NIC to transmit a frame that spans several physical fragments that
are arbitrary in size and buffer alignment. This requires the Ethernet controller to gather all these fragments
during a DMA process into a continuous data stream for transmission.
The ability to scatter/gather a frame lessens the restriction on the host software and increases overall system
performance.
Example:
A TCP/IP protocol stack could preconstruct the MAC and IP headers in separate buffers that are
combined with the payload to form a complete frame. Since the header data are fairly constant during a TCP
or UDP session, the stack could use the same header buffers for the next frame.
The Ethernet controller uses a buffer descriptor for describing a physical fragment. There are two types of buffer
descriptors; the Receive MAC processes receive buffer descriptors (Receive BD) and the Transmit MAC
processes send buffer descriptors (Send BD).
illustrates the relationship between a frame consisting of multiple fragments and their corresponding
send buffer descriptors.
Figure 29: Scatter Gather of Frame Fragments
To transmit a frame, the host software sets up consecutive buffer descriptors in a send ring. Each buffer
descriptor describes a physical fragment of a frame. As an example, the above figure illustrates a frame
consisting of five fragments that are scattered throughout host memory. Frag1, the first fragment, is at the start
of the frame, and Frag5, the last fragment, is at the end of a frame. For each fragment, there is a corresponding
buffer descriptor, SendBd1 through SendBd5. These buffer descriptors must be initialized in the send ring in a
consecutive order, SendBd1 to SendBd5. The last send buffer descriptor of a frame must have the
PACKET_END bit of Send BD Flags field set to indicate the end of a frame.
Send BD 3
Frame Fragments
Frag 2
Frag 5
Frag 4
Frag 1
Send BD 1
Send BD 2
Send BD 4
Send BD 5
Frag 3
Send Buffer Descriptors
Buffers
Buffer 1
Buffer 2
Buffer 3
Buffer 4
Buffer 5
Tx FIFO
Tx MAC
DMA