cpu 映射 nic
ring->dma dma ring
next_to_use <=> rhtail
next_to_clean <=> rhheader
1.初始化时 next_to_use =0 ,next_to_clean=0;
然后分配skb,建立dma映射,adapter->alloc_rx_buf(adapter,
ring, E1000_DESC_UNUSED(ring));
这样 next_to_use =255 了,tail ptr 255
2.nic接收数据时,data 从 ring的头部开始放,同时移动RDH,如果遇到ringDTail则丢弃数据包
此时出发中断,调用clean_rx_irq,获取数据,next_to_clean++;
3.如果可用指针(小于可用)被清除指针追上,则转一圈,补充空间,更新RDT。
cleaned_count = E1000_DESC_UNUSED(rx_ring);
if (cleaned_count)
adapter->alloc_rx_buf(adapter, rx_ring, cleaned_count);
4. alloc_rx_buf置位 writel(i, adapter->hw.hw_addr + rx_ring->rdt);
ok?
~cruse/cs686s08/
http://blog.chinaunix.net/u1/58855/showart_973930.html
阅读(2039) | 评论(0) | 转发(0) |