e1000 receive queue handling
beezarliu at yahoo.com.cn
Fri Sep 10 10:36:54 UTC 2010
I found em's receiving queue handling will have the following problems if system mbuf is used up.
1. NIC will hang because receive ring's tail pointer will not be updated (in em_rxeof).
2. "ifconfig up/down" may cause system panic because em_setup_receive_ring will free already-freed mbufs.
So I made some changes:
1. NIC's recieve ring's head/tail pointer is updated according to rxr's next_to_check/next_to_refresh.
So, on the position of next_to_refresh, no need to fill free mbuf because datasheet says
"When the head pointer(s) is equal to the tail pointer(s), the queue(s) is empty.
Hardware stops storing packets in system memory until software advances the tail
pointer(s), making more receive buffers available."
And (next_to_refresh + 1) % num_rx_desc == next_to_check means ring queue is full.
2. no need to reallocate the mbufs on receive queue when em re-initialize.
3. The mbufs on the queue are also freed according to these two indexs.
4. If ring queue is empty, em_refresh_mbufs is also called even if it doesn't handle any packet.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 4182 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20100910/1f80f0be/if_em.c.obj
More information about the freebsd-stable