gpt4 book ai didi

c - 以太网 Controller 中的硬件 Rx/Tx 队列是什么

转载 作者:行者123 更新时间:2023-11-30 14:35:09 26 4
gpt4 key购买 nike

我有关于以太网 Controller 中的 Rx/Tx 硬件队列的非常基本的问题,它的用途是什么?

查看Linux内核中的以下驱动程序,它似乎是用于携带DMA描述符的?

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

最佳答案

您是对的,rx/tx 队列包含传入和传出数据包的 DMA 描述符。

如果您好奇网络驱动程序如何工作,我建议您查看 ixy 用户空间网络驱动程序:https://github.com/emmericp/ixy

代码相对简单,注释也很好,有一篇论文解释了它的工作原理:https://www.net.in.tum.de/fileadmin/bibtex/publications/papers/ixy-writing-user-space-network-drivers.pdf

请参阅本文中的第 4.1 节NIC Ring API,了解接收 (rx) 和传输 (tx) 队列的说明:

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.

关于c - 以太网 Controller 中的硬件 Rx/Tx 队列是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58658739/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com