With the original code BPF verifier throws error, due to undefined array access 
and thus could failed to load the BPF instructions onto the Kernel.
For safe execution on the Kernel, the array access with such undefined value 
throws error.

So, came up with this loop which has Max-queues as limit.

Thanks,
Madhuker,

-----Original Message-----
From: Stephen Hemminger <step...@networkplumber.org> 
Sent: 12 January 2024 22:12
To: Madhuker Mythri <madhuker.myt...@oracle.com>
Cc: dev@dpdk.org; ferruh.yi...@amd.com
Subject: [External] : Re: [PATCH] net/tap: Modified TAP BPF program as per the 
Kernel-version upgrade requirements.

On Fri, 12 Jan 2024 19:18:21 +0530
madhuker.myt...@oracle.com wrote:

> -     queue = rsskey->queues[(hash % rsskey->nb_queues) &
> -                                    (TAP_MAX_QUEUES - 1)];
> -     skb->cb[1] = QUEUE_OFFSET + queue;
> -     /* printt(">>>>> rss_l3_l4 hash=0x%x queue=%u\n", hash, queue); */
> +     hash = (hash % rsskey->nb_queues) & (TAP_MAX_QUEUES - 1); #pragma 
> +clang loop unroll(full)
> +     for (k = 0; k < TAP_MAX_QUEUES; k++) {
> +             if(k == hash)
> +                     queue = rsskey->queues[k];
> +     }
>  

Why introduce another loop here. Original code was fine and bounded.

Reply via email to