From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4DA3143840; Fri, 5 Jan 2024 20:31:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1BAB7402CC; Fri, 5 Jan 2024 20:31:00 +0100 (CET) Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by mails.dpdk.org (Postfix) with ESMTP id 4E140402BF for ; Fri, 5 Jan 2024 20:30:59 +0100 (CET) Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-1d3ef33e68dso6415785ad.1 for ; Fri, 05 Jan 2024 11:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1704483058; x=1705087858; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=S/tNGnG/UyVt7gTnrVxwRZC9ZaJRjGTMv+NxfM1z8wo=; b=oul8wMyyySapIustgObrcctVl68Zyd43+OnO8Kv5Is5CsIV+9SdICVPfZxHEj0hptE 6lh2yKNfuQhLWlu7Lp+3jDgcGCdMMdSukKrL0lEYzsJw0Fuset2Vt4GoIlsWZ1Dll5pn LrINRtRuN6Cfnb8SlMUzvKttUs0IB8RORK5BuJiwuQtawkU2CHXVOkP9gTGwL007HHqO SGNH40Fjv0Wa08YkLM1mBZWnu0tQbLSeGuhP+2pHJVEHi20vZuKluYYZjyqYF8x7zPTp 5X66H5CuZsURYtTl9Nl0zoG+UQQ5HuiV0VtgD31x1RuJSvJwdNI0bMP13hAY+//40XdJ 6QRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704483058; x=1705087858; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S/tNGnG/UyVt7gTnrVxwRZC9ZaJRjGTMv+NxfM1z8wo=; b=Ovrlx+k6//GWUxdRRMxGPD0yAGkqOOHuYRjuyOusfJNXfvlKlt8N32gwfAPVTgUMys DmlpxDbCFOf1GXMx/coSVWEfvA19NFiQwr0xcogJ0RpnhpLNcjXI6e078+2sebOdK+sD Q9advQFHfCXr75Wvzgi6EFFaONLj6JKHygmVcNPXYZj12W6HmSzcXkYekDnUUuSBKiPS 06wdnA4hk/HJukfPMN9fjqOcCDUoj0ERitTmYHtO9OGbG5LgF8P1anHD+nwsojQkZgpb mfOorNtnWoMLLXo+qPtjRd0f8CRqrP/tBczsJzGWK0+j8MLS7Q+TIp9OwE8FzFVRD/G7 WDSQ== X-Gm-Message-State: AOJu0YyKx8jlRUQcVB4HpA5ub8A3lzqn32gHG0rW7HelTjabYbzxNZCH Wbqnfy9W0rhWI3bKpMp+HtrnWRwstCLw5Q== X-Google-Smtp-Source: AGHT+IFKkNhBgAgiLHyDXLPKCKH/4bS3sadM6j3zLkmmypU2DyOv8Q0NExbpQiSn+Kr5uWWSxdHCOw== X-Received: by 2002:a17:902:e84b:b0:1d4:c139:782b with SMTP id t11-20020a170902e84b00b001d4c139782bmr3921194plg.1.1704483058357; Fri, 05 Jan 2024 11:30:58 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id b17-20020a170902d89100b001d3c23a6862sm1756291plz.25.2024.01.05.11.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 11:30:57 -0800 (PST) Date: Fri, 5 Jan 2024 11:30:55 -0800 From: Stephen Hemminger To: madhuker.mythri@oracle.com Cc: ferruh.yigit@amd.com, dev@dpdk.org Subject: Re: [PATCH] net/tap: Modified TAP BPF program as per the new Kernel-version upgrade requirements. Message-ID: <20240105113055.54190838@hermes.local> In-Reply-To: <20240104172756.2213-1-madhuker.mythri@oracle.com> References: <20240104172756.2213-1-madhuker.mythri@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Thu, 4 Jan 2024 22:57:56 +0530 madhuker.mythri@oracle.com wrote: > adhuker Mythri > > 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 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://doc.dpdk.org/guides/nics/tap.html) 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 0a:0b:0c:0d:0e:0f / ipv4 / tcp / end actions rss queues 0 1 2 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