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 5AAD74388B; Fri, 12 Jan 2024 17:40:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E0AD402C5; Fri, 12 Jan 2024 17:40:39 +0100 (CET) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id C48A6402AD for ; Fri, 12 Jan 2024 17:40:37 +0100 (CET) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1d3aa0321b5so55497255ad.2 for ; Fri, 12 Jan 2024 08:40:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1705077636; x=1705682436; 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=AmWiDFYBY3Ysjrc2RNDN8LJReWcvpfA29rtnEDXCOro=; b=MZn3Qj1oru8bSvEKCwGIE6kvdd91zCWFPblTrwjyCA+oBM0NLCSChSWGFY8BXKDHs7 uGyzLng8ADuzRp+QKDYI+0/5VHwTzjDqet9e6lR8PpxMmhDzAb3I3xx3tuXyjPtXqFLf W6mQdJekmRUn+dBE0qySQerGB0WFQJKqcIEF6n5Uj7Sr2GpbykKL/rreGFWwF1zrLDK9 Im28GXngVLNknRdkcJAwwUWtmT6JnWDDLWopN/3u9of0U4O3ArJGbwImZN/bKV0SKRQc LD9NZI+W2aJ9MB1BMW3sZnrbVMD4/Meqt+B1xqlsKdLLYbxcUumEBQ4ZI2ZrN3F7Vgjd FbcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705077636; x=1705682436; 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=AmWiDFYBY3Ysjrc2RNDN8LJReWcvpfA29rtnEDXCOro=; b=INO0mTezjCH1NTB9Fa1iicrOU2Pyg4Rk5co7NNACur50uJ1OxwSAIRsRjx+pKRns93 ambbhNNeywooIHUnvzHwoi61JGAbgCw9oRY5XqoTfoUwVMYWRZIGyqx37BCSX7280pO0 8gOFFIaJiB9jgKEygYVDysVgX7tayXXBwKBOPbLLYVuZ0nKPGSc9rjkXIk8rFscPFijl cVEvDCl0bVAY6xSKDE3ozYtitvfU6VbUWzzu4HyYYl/pGg6dp4rtmJgk1pV1zL4hZAWu 2dc7lIO43TaOIP//cv+9thZtD/gR4B3NHx3pyCGMigwBuLjaSZPd1PD0Y2O9jem3zQo1 2w3w== X-Gm-Message-State: AOJu0Ywo+NOvNeCcOq4yxPW5K1irpQATOyDNhxaxsX+6xsH+/U3g48ZH um5Jk8vXHezwDkkACC6wQFcaF8yjEmro+w== X-Google-Smtp-Source: AGHT+IH3v6Ar9UNoouOrd1EyjAKzEMd0dqL1q0f1jnlf7XDD0LzvScshTExDAwgWb9hZDKHixK9fSw== X-Received: by 2002:a17:902:e804:b0:1d3:f1b7:b479 with SMTP id u4-20020a170902e80400b001d3f1b7b479mr1680319plg.26.1705077636664; Fri, 12 Jan 2024 08:40:36 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id kr4-20020a170903080400b001d36dbb22a9sm3361245plb.4.2024.01.12.08.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 08:40:36 -0800 (PST) Date: Fri, 12 Jan 2024 08:40:34 -0800 From: Stephen Hemminger To: madhuker.mythri@oracle.com Cc: dev@dpdk.org, ferruh.yigit@amd.com Subject: Re: [PATCH] net/tap: Modified TAP BPF program as per the Kernel-version upgrade requirements. Message-ID: <20240112084034.7de67fb9@hermes.local> In-Reply-To: <20240112134821.2067-1-madhuker.mythri@oracle.com> References: <20240112134821.2067-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 Fri, 12 Jan 2024 19:18:21 +0530 madhuker.mythri@oracle.com wrote: > From: Madhuker 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, instead use the BPF helper functions. > 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. > > Verified with the latest DPDK-23.11 code, using the python extracted > BPF instructions able to load sucessfully on to the Kernel tap device. > > Bugzilla Id: 1329 > > Signed-off-by: Madhuker Mythri The DPDK practice is to keep patches as followons of original thread. Please use --msg-id option for reply. Also put v2 in the mail. The BPF program doesn't have to meet all the requirements of DPDK checkpatch since it doesn't use EAL, but it should follow conventions. For example: $ ./devtools/checkpatches.sh ~/Downloads/tap-bpf.mbox ### [PATCH] net/tap: Modified TAP BPF program as per the Kernel-version upgrade requirements. WARNING:COMMIT_LOG_LONG_LINE: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #92: 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. WARNING:TYPO_SPELLING: 'sucessfully' may be misspelled - perhaps 'successfully'? #109: BPF instructions able to load sucessfully on to the Kernel tap device. ^^^^^^^^^^^ ... WARNING:BRACES: braces {} are not necessary for single statement blocks #659: FILE: drivers/net/tap/bpf/tap_bpf_program.c:120: + if (rsskey == NULL) { return TC_ACT_OK; } ERROR:ELSE_AFTER_BRACE: else should follow close brace '}' #769: FILE: drivers/net/tap/bpf/tap_bpf_program.c:156: + } + else { CHECK:BRACES: Unbalanced braces around else statement #769: FILE: drivers/net/tap/bpf/tap_bpf_program.c:156: + else { ERROR:SPACING: space required before the open parenthesis '(' #790: FILE: drivers/net/tap/bpf/tap_bpf_program.c:168: + if(k == hash) CHECK:BRACES: Blank lines aren't necessary before a close brace '}' #807: FILE: drivers/net/tap/bpf/tap_bpf_program.c:176: +} total: 2 errors, 7 warnings, 2 checks, 3314 lines checked 0/1 valid patch