[dpdk-dev] [memnic PATCH v2 6/7] pmd: add branch hint in recv/xmit

Thomas Monjalon thomas.monjalon at 6wind.com
Tue Sep 30 16:51:10 CEST 2014


2014-09-30 14:38, Xie, Huawei:
> > -		if (++next >= MEMNIC_NR_PACKET)
> > +		if (unlikely(++next >= MEMNIC_NR_PACKET))
> 
> On IA,  compiler can use add, cmp and cmov to avoid branch.
> But If MEMNIC_NR_PACKET is always power of 2, 
> 	it is better just next = (next + 1) & (MEMNIC_NR_PACKET - 1)

Power of 2 is not enforced for MEMNIC_NR_PACKET.

-- 
Thomas


More information about the dev mailing list