DPDK patches and discussions
 help / color / mirror / Atom feed
From: Madhuker Mythri <madhuker.mythri@oracle.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "ferruh.yigit@amd.com" <ferruh.yigit@amd.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: RE: [External] : Re: [PATCH] net/tap: Modified TAP BPF program as per the new Kernel-version upgrade requirements.
Date: Sat, 6 Jan 2024 10:23:57 +0000	[thread overview]
Message-ID: <SJ0PR10MB4798881DBFDE262426F7287397652@SJ0PR10MB4798.namprd10.prod.outlook.com> (raw)
In-Reply-To: <SJ0PR10MB47987058D8F21945B8E2F8E897652@SJ0PR10MB4798.namprd10.prod.outlook.com>

Hi Stephen,

The new Kernel expects the BPF maps in BTF format: https://www.kernel.org/doc/html/v5.4/bpf/btf.html.
So, we need to compile with "-g" option as follows:
==============================
clang -O2 -target bpf -c tap_bpf_program.c  -g  -o  tap_bpf_program.o
=============================

I had cross check this functionality with DPDK-22.11 and as the BPF C-program is same had modified just the C-program and submitted for review.
I will update the Makefile changes also and will publish for code-review once again w.r.t DPDK-23.11.

Thanks,
Madhuker.

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

The flow creation worked well for us on the Azure/Hyper-V platform using failsafe/tap PMD, using Kernel-5.15.0 and 5.4 versions.

So, does the original/existing code works well on Kernel-6.5 version ?

Thanks,
Madhuker.

-----Original Message-----
From: Stephen Hemminger <stephen@networkplumber.org>
Sent: 06 January 2024 01:01
To: Madhuker Mythri <madhuker.mythri@oracle.com>
Cc: ferruh.yigit@amd.com; dev@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@oracle.com wrote:

> adhuker Mythri <madhuker.mythri@oracle.com>
> 
> When multiple queues configured, internally RSS will be enabled and thus TAP BPF RSS byte-code will be loaded on to the Kernel using BPF system calls.
> 
> Here, the problem is loading the existing BPF byte-code to the Kernel-5.15 and above versions throws errors, i.e: Kernel BPF verifier not accepted this existing BPF byte-code and system calls return error code "-7" as follows:
> ------------------------
> rss_add_actions(): Failed to load BPF section l3_l4 (7): Argument list 
> too long
> ------------------------
> 
> RCA:  These errors started coming after from the Kernel-5.15 version, in which lots of new BPF verification restrictions were added for safe execution of byte-code on to the Kernel, due to which existing BPF program verification does not pass.
> Here are the major BPF verifier restrictions observed:
> 1) Need to use new BPF maps structure.
> 2) Kernel SKB data pointer access not allowed.
> 3) Undefined loops were not allowed(which are bounded by a variable value).
> 4) unreachable instructions(like: undefined array access).
> 
> After addressing all these Kernel BPF verifier restrictions able to load the BPF byte-code onto the Kernel successfully.
> 
> Note: This new BPF changes supports from Kernel:4.10 version.
> 
> Bugzilla Id: 1329
> 
> Signed-off-by: Madhuker Mythri <madhuker.mythri@oracle.com>

I tried this version on Debian testing which has:
	kernel 6.5.0-5-amd64
	clang 16.0.6

If build and run with the pre-compiled BPF then it will load the example flow  (see https://urldefense.com/v3/__https://doc.dpdk.org/guides/nics/tap.html__;!!ACWV5N9M2RV99hQ!I6LFEsrAnlW2WMQlCy7Sxw-9MxJ_Qtchg-aZdal53Np6QtmC1wWsMdG_uT3zc57Yu7kvJANA-dQIirEUr-BWfaVXhGtd$ )

But if I recompile the bpf program by using make in the tap/bpf directory, then the resulting bpf instructions will not make it past verifier.

With modified tap_bpf_api can get the log message as:

testpmd> flow create 0 priority 4 ingress pattern eth dst is 
testpmd> 0a:0b:0c:0d:0e:0f  / ipv4 / tcp / end actions rss queues 0 1 2
testpmd> 3 end / end
rss_add_actions(): Failed to load BPF section l3_l4 (13): func#0 @0
0: R1=ctx(off=0,imm=0) R10=fp0
0: (bf) r6 = r1                       ; R1=ctx(off=0,imm=0) R6_w=ctx(off=0,imm=0)
1: (18) r1 = 0x300                    ; R1_w=768
3: (63) *(u32 *)(r10 -84) = r1        ; R1_w=768 R10=fp0 fp-88=mmmm????
4: (bf) r2 = r10                      ; R2_w=fp0 R10=fp0
5: (07) r2 += -84                     ; R2_w=fp-84
6: (18) r1 = 0xfd                     ; R1_w=253
8: (85) call bpf_map_lookup_elem#1
R1 type=scalar expected=map_ptr
processed 7 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

port_flow_complain(): Caught PMD error type 16 (specific action): cause: 0x7ffcef37e678, action not supported: Operation not supported


  reply	other threads:[~2024-01-06 10:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-04 17:27 madhuker.mythri
2024-01-04 20:32 ` Stephen Hemminger
2024-01-05 14:58   ` [External] : " Madhuker Mythri
2024-01-04 20:33 ` Stephen Hemminger
2024-01-04 20:35 ` Stephen Hemminger
2024-01-04 20:38 ` Stephen Hemminger
2024-01-05 14:58   ` [External] : " Madhuker Mythri
2024-01-05 17:40     ` Stephen Hemminger
2024-01-04 20:39 ` Stephen Hemminger
2024-01-04 20:41 ` Stephen Hemminger
2024-01-05 15:11   ` [External] : " Madhuker Mythri
2024-01-05 17:41     ` Stephen Hemminger
2024-01-04 20:42 ` Stephen Hemminger
2024-01-04 20:57 ` Stephen Hemminger
2024-01-05 14:44   ` [External] : " Madhuker Mythri
2024-01-05 17:39     ` Stephen Hemminger
2024-01-06  5:47       ` Madhuker Mythri
2024-01-05 19:30 ` Stephen Hemminger
2024-01-06  5:36   ` [External] : " Madhuker Mythri
2024-01-06 10:23     ` Madhuker Mythri [this message]
2024-01-06 16:54       ` Stephen Hemminger
2024-01-06 18:16       ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB4798881DBFDE262426F7287397652@SJ0PR10MB4798.namprd10.prod.outlook.com \
    --to=madhuker.mythri@oracle.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).