Hi,

Wanted to understand the reason/implications behind not using for loops for any 
operations on pre-fetched buffers.

For ex:- I was checking the code of " *ip4-input* " node and could see the 
following
while (n_left_from >= 4)
{
/* Prefetch next iteration. */
if (n_left_from >= 12)
{
vlib_prefetch_buffer_header (b[8], LOAD);
vlib_prefetch_buffer_header (b[9], LOAD);
vlib_prefetch_buffer_header (b[10], LOAD);
vlib_prefetch_buffer_header (b[11], LOAD);
vlib_prefetch_buffer_data (b[4], LOAD);
vlib_prefetch_buffer_data (b[5], LOAD);
vlib_prefetch_buffer_data (b[6], LOAD);
vlib_prefetch_buffer_data (b[7], LOAD);
}
sw_if_index[0] = vnet_buffer (b[0])->sw_if_index[VLIB_RX];
sw_if_index[1] = vnet_buffer (b[1])->sw_if_index[VLIB_RX];
sw_if_index[2] = vnet_buffer (b[2])->sw_if_index[VLIB_RX];
sw_if_index[3] = vnet_buffer (b[3])->sw_if_index[VLIB_RX];

Here, after pre-fetching, we are calculating sw_if_index for each buffer in a 
repetitive manner . Instead ,can we use a for loop to calculate the 
sw_if_indicesĀ  or will it have any performance impact?

Ex:
for (int i =0; i<4;i++)
{
sw_if_index[i] = vnet_buffer (b[i])->sw_if_index[VLIB_RX];
}

Regards
Amit
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#22464): https://lists.fd.io/g/vpp-dev/message/22464
Mute This Topic: https://lists.fd.io/mt/96243950/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/leave/1480452/21656/631435203/xyzzy 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to