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 77597A04FD; Mon, 23 May 2022 11:15:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AAE640141; Mon, 23 May 2022 11:15:38 +0200 (CEST) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 892AD40041 for ; Mon, 23 May 2022 11:15:36 +0200 (CEST) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L6BVN67CGzjWyw; Mon, 23 May 2022 17:14:36 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 23 May 2022 17:15:33 +0800 Subject: Re: [PATCH v3] kni: update kernel API to receive packets To: Gagandeep Singh , References: <20220421034502.1987597-1-g.singh@nxp.com> <20220421085931.2429443-1-g.singh@nxp.com> From: "Min Hu (Connor)" Message-ID: <8f4f1ab9-2c21-1495-77c4-36665314d081@huawei.com> Date: Mon, 23 May 2022 17:15:32 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20220421085931.2429443-1-g.singh@nxp.com> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected 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 Acked-by: Min Hu (Connor) ÔÚ 2022/4/21 16:59, Gagandeep Singh дµÀ: > API 'netif_rx_ni()' has been removed in kernel with commit: > baebdf48c3600 ("net: dev: Makes sure netif_rx() can be invoked in any context.") > > The API netif_rx() can be used for any context to receive packets > from device drivers. > > This patch replaces the API netif_rx_ni() with netif_rx() for > kernel version 5.18 and above. > > Signed-off-by: Gagandeep Singh > > v2 Change-log: > Added a #if for kernel version 5.18 and above for API change. > > v3 Change-log: > Moved #if of kernel check to compat.h > --- > 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 664785674f..6451295270 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_CHANGE_NETIF_RX > +#endif > diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c > index 29e5b9e21f..80ead13b75 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_CHANGE_NETIF_RX > + netif_rx(skb); > +#else > netif_rx_ni(skb); > +#endif > > /* Update statistics */ > dev->stats.rx_bytes += len; >