Date: Wed, 23 Jul 2014 20:37:35 +0800 From: Xu Zhe <xzpeter@gmail.com> To: freebsd-net@freebsd.org Subject: Question on rx queue in ixgbe driver Message-ID: <53CFAC8F.8090404@gmail.com>
next in thread | raw e-mail | index | archive | help
Hi, I am reading ixgbe driver of Freebsd and got some problems, which are described below. (1) Why rxd_tail does not equals to rxd_head? Here, rxd_tail/rxd_head is the value of dev.ix.0.queue0.rxd_tail/dev.ix.0.queue0.rxd_head from sysctl (take the first queue of ix0 as example). Actually, in most cases, rxd_head - rxd_tail == 1. Refers to the code, these values are actually next_to_refresh/next_to_check for each receive queue (though the sysctl implementation is read directly from the hardware registers I suppose). Why next_to_refresh is always one smaller than next_to_check (of course, when the latter is 0, the former is 2047 possibly, which is the size of rx ring - 1)? In my point of view, this means that we will always have one tiny mbuf (which is pointed by next_to_refresh) that is already checked (passed up to upper network stack) but not refreshed (not prepared for the next receive). It does not make sense? Or I missed anything important? (2) The init value of rxd_tail Even if (1) has no problem, when ixgbe device is inited, rxd_tail (or say, next_to_refresh) is set to zero (in function ixgbe_setup_receive_ring). I think it should be rxr->num_desc - 1. This should not matter much in the latest ixgbe driver, but it might cause old driver (ixgbe 2.5.8 at least) to double init the rx_ring descriptors (both in ixgbe_setup_receive_ring when ixgbe init up, and the first entry of ixgbe_refresh_mbufs of the first interrupt come). This is a case I met in my test environment. ========== Looking forward to any of your replies to help clarify my thoughts. Thanks in advance. Peter
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53CFAC8F.8090404>