Milan
Milan

Reputation: 1529

What are the Hardware Rx/Tx Queue in Ethernet controller

I have very basic question regarding Rx/Tx Hardware Queues in Ethernet Controller, what its used for ?

While looking at the following driver in Linux kernel, its seems like it is used to carry DMA descriptors ?

https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/broadcom/genet/bcmgenet.c#L2276

Upvotes: 6

Views: 13266

Answers (1)

Tim
Tim

Reputation: 4948

You are correct, the rx/tx queues contain DMA descriptors for incoming and outgoing packets.

If you are curious how network drivers work, I recommend looking at the ixy userspace network driver: https://github.com/emmericp/ixy

The code is relatively simple and very well commented, and there is a paper which explains how it works: https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/ixy-writing-user-space-network-drivers.pdf

See section 4.1 NIC Ring API in the paper for an explanation of the receive (rx) and transmit (tx) queues:

NICs expose multiple circular buffers called queues or rings to transfer packets. The simplest setup uses only one receive and one transmit queue. Multiple transmit queues are merged on the NIC, incoming traffic is split according to filters or a hashing algorithm if multiple receive queues are configured. Both receive and transmit rings work in a similar way: the driver programs a physical base address and the size of the ring. It then fills the memory area with DMA descriptors, i.e., pointers to physical addresses where the packet data is stored with some metadata. Sending and receiving packets is done by passing ownership of the DMA descriptors between driver and hardware via a head and a tail pointer. The driver controls the tail, the hardware the head. Both pointers are stored in device registers accessible via MMIO.

Upvotes: 11

Related Questions