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 49854A00C2; Sun, 5 Jun 2022 10:22:36 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D81B64021E; Sun, 5 Jun 2022 10:22:35 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 3DA7840041; Sun, 5 Jun 2022 10:22:35 +0200 (CEST) Received: from [192.168.1.126] (unknown [188.242.181.57]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id C88461F3; Sun, 5 Jun 2022 11:22:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru C88461F3 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1654417351; bh=ZgBePl4vO03YISMrYFZGxNmhyoy9Zaq9Wyv3M1T7mNs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=u2l9ee7Ok5LH7yPyaHgyaoC0uP3fMdq9wfcBbjwuKpsRQledgnHpFa73+Wpy+xNnG no0Z2myM3LN0+B488BK+0ppVqKU6YhJhO9f7rYSt4hIiNq1C1SJPkhuXclvcIR3/bO ramVHK04yReTBKybehwJOssiXA80AIiG5jiN/eYs= Message-ID: <88cd54ca-9318-d240-4ce9-2be8b13d19ad@oktetlabs.ru> Date: Sun, 5 Jun 2022 11:22:31 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v4] kni: fix build with Linux 5.18 Content-Language: en-US To: Jiri Slaby , dev@dpdk.org Cc: stable@dpdk.org, Stephen Hemminger , Ferruh Yigit , mingli.yu@windriver.com, "Min Hu (Connor)" References: <20220601065149.8031-1-jslaby@suse.cz> <20220601065358.8195-1-jslaby@suse.cz> From: Andrew Rybchenko In-Reply-To: <20220601065358.8195-1-jslaby@suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed 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 6/1/22 09:53, Jiri Slaby wrote: > Since commit 2655926aea9b (net: Remove netif_rx_any_context() and > netif_rx_ni().) in 5.18, netif_rx_ni() no longer exists as netif_rx() > can be called from any context. So define HAVE_NETIF_RX_NI for older > releases and call the appropriate function in kni_net. > > There were other attempts to fix this: > https://patches.dpdk.org/project/dpdk/patch/20220521070642.35413-1-humin29@huawei.com/ > https://patches.dpdk.org/project/dpdk/patch/20220511112334.3233433-1-mingli.yu@windriver.com/ > > But neither of them ensures netif_rx_ni() is used on older kernel. This > might lead to deadlocks or other problems there. > > Cc: stable@dpdk.org > Signed-off-by: Jiri Slaby > --- > [v4] > - really switch the #if test > [v3] > - reference other patches > - switch the #if test expressions to conform to the checker > [v2] > - forgot to amend the #else/#endif typo fix > > kernel/linux/kni/compat.h | 4 ++++ > kernel/linux/kni/kni_net.c | 4 ++++ > 2 files changed, 8 insertions(+) > > diff --git a/kernel/linux/kni/compat.h b/kernel/linux/kni/compat.h > index 664785674ff1..0db29a4a6f61 100644 > --- a/kernel/linux/kni/compat.h > +++ b/kernel/linux/kni/compat.h > @@ -141,3 +141,7 @@ > #if KERNEL_VERSION(5, 9, 0) > LINUX_VERSION_CODE > #define HAVE_TSK_IN_GUP > #endif > + > +#if KERNEL_VERSION(5, 18, 0) > LINUX_VERSION_CODE > +#define HAVE_NETIF_RX_NI > +#endif > diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c > index 29e5b9e21f9e..a8b092b7567d 100644 > --- a/kernel/linux/kni/kni_net.c > +++ b/kernel/linux/kni/kni_net.c > @@ -441,7 +441,11 @@ kni_net_rx_normal(struct kni_dev *kni) > skb->ip_summed = CHECKSUM_UNNECESSARY; > > /* Call netif interface */ > +#ifdef HAVE_NETIF_RX_NI > netif_rx_ni(skb); > +#else > + netif_rx(skb); > +#else > > /* Update statistics */ > dev->stats.rx_bytes += len; Applied to dpdk-next-net/main with minor fixes in the description, thanks.