> On 27 Aug 2017, at 12:04, mrityunjay.kum...@wipro.com wrote: > > Dear Team > I would like bring it to your kind notice of below code of vpp-1707-dpdk > plunging. > > static_always_inline void dpdk_prefetch_buffer_by_index (vlib_main_t * vm, > u32 bi) > { > vlib_buffer_t *b; > struct rte_mbuf *mb; > b = vlib_get_buffer (vm, bi); > mb = rte_mbuf_from_vlib_buffer (b); > CLIB_PREFETCH (mb, CLIB_CACHE_LINE_BYTES, LOAD); > CLIB_PREFETCH (b, CLIB_CACHE_LINE_BYTES, LOAD); > } > > #define CLIB_PREFETCH(addr,size,type) \ > do { \ > void * _addr = (addr); \ > \ > ASSERT ((size) <= 4*CLIB_CACHE_LINE_BYTES); \ > _CLIB_PREFETCH (0, size, type); \ > _CLIB_PREFETCH (1, size, type); \ > _CLIB_PREFETCH (2, size, type); \ > _CLIB_PREFETCH (3, size, type); \ > } while (0) > > <pastedImage.png> > > > Here , Sizeof(rte_mbuf) = 128 and sizeof(vlib_buffer_t) = 128 + > HEAD_ROOM(128)= 256. > > In above code part, vlib_buffer is ahead of 128 bytes from start of rte_mbuf > structure. As i understood one CLIB_PREFETCH will load 256 bytes from > memory. ,hence total pre-fetch is 512 bytes. As per the above code first > CLIB_PREFETCH will load 256, which includes 128 of rte_mbuf + 128 of > vlib_buffer as well . 2nd CLIB_PREFETCH will also load vlib_buffer whcih as > ready has been loaded. > > I must say duplication in prefetching the memory. Please correct me if I am > wrong.
Hi MJ, Yes, you are wrong. Each invocation of CLIB_PREFETCH in the inline function you listed above will prefetch one cacheline, so 64 bytes, not 256. Please look at _CLIB_PREFETCH macro for details… _______________________________________________ vpp-dev mailing list vpp-dev@lists.fd.io https://lists.fd.io/mailman/listinfo/vpp-dev