[External] : Re: [PATCH] net/tap: Modified TAP BPF program as per the new Kernel-version upgrade requirements.

Madhuker Mythri madhuker.mythri at oracle.com
Fri Jan 5 15:58:22 CET 2024


Hi Stephen,

As part of hash calculation logic, the hash value is going beyond 32-bits and thus the eBPF verifier throws error with the 32-bit hash variable.
So, I need to modify as 64-bit hash variable to resolve the BPF verifier error.

Here, in the code this rte_softrss_be() function is returning the hash variable, which is a 64-bit value, so modified the return type from 32-bit to 64-bit.
==================
-static __u32  __attribute__((always_inline))
-rte_softrss_be(const __u32 *input_tuple, const uint8_t *rss_key,
-               __u8 input_len)
+static __u64  __attribute__((always_inline))
+rte_softrss_be(const __u32 *input_tuple, __u8 input_len)
 {
-       __u32 i, j, hash = 0;
-#pragma unroll
+       __u32 i, j;
+        __u64  hash = 0;
+#pragma clang loop unroll(full)
        for (j = 0; j < input_len; j++) {
-#pragma unroll
+#pragma clang loop unroll(full)
                for (i = 0; i < 32; i++) {
                        if (input_tuple[j] & (1U << (31 - i))) {
                                hash ^= ((const __u32 *)def_rss_key)[j] << i |
-                               (__u32)((uint64_t)
+                               (__u32)((__u64)
                                (((const __u32 *)def_rss_key)[j + 1])
                                        >> (32 - i));
                        }
@@ -119,137 +107,78 @@ rte_softrss_be(const __u32 *input_tuple, const uint8_t *rss_key,
        return hash;
 }
======================

Thanks,
Madhuker.

-----Original Message-----
From: Stephen Hemminger <stephen at networkplumber.org> 
Sent: 05 January 2024 02:09
To: Madhuker Mythri <madhuker.mythri at oracle.com>
Cc: ferruh.yigit at amd.com; dev at dpdk.org
Subject: [External] : Re: [PATCH] net/tap: Modified TAP BPF program as per the new Kernel-version upgrade requirements.

On Thu,  4 Jan 2024 22:57:56 +0530
madhuker.mythri at oracle.com wrote:

> -static __u32  __attribute__((always_inline)) -rte_softrss_be(const 
> __u32 *input_tuple, const uint8_t *rss_key,
> -		__u8 input_len)
> +static __u64  __attribute__((always_inline)) rte_softrss_be(const 
> +__u32 *input_tuple, __u8 input_len)

Why the change to u64?
This is not part of the bug fix and not how RSS is defined.


More information about the dev mailing list