* [PATCH] kni: fix build
@ 2014-11-07 14:51 Thomas Monjalon
[not found] ` <1415371867-3730-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2014-11-07 14:51 UTC (permalink / raw)
To: dev-VfR2kkLFssw
Since commit 08b563ffb19 ("mbuf: replace data pointer by an offset"),
KNI vhost compilation (CONFIG_RTE_KNI_VHOST=y) was broken.
rte_pktmbuf_mtod() is not used in the kernel context but is replaced
by a simple addition of the base address and the offset.
Signed-off-by: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
lib/librte_eal/linuxapp/kni/kni_vhost.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/linuxapp/kni/kni_vhost.c b/lib/librte_eal/linuxapp/kni/kni_vhost.c
index fe512c2..7bcc985 100644
--- a/lib/librte_eal/linuxapp/kni/kni_vhost.c
+++ b/lib/librte_eal/linuxapp/kni/kni_vhost.c
@@ -104,7 +104,8 @@ kni_vhost_net_tx(struct kni_dev *kni, struct iovec *iov,
void *data_kva;
pkt_kva = (void *)pkt_va - kni->mbuf_va + kni->mbuf_kva;
- data_kva = pkt_kva->data - kni->mbuf_va + kni->mbuf_kva;
+ data_kva = pkt_kva->buf_addr + pkt_kva->data_off
+ - kni->mbuf_va + kni->mbuf_kva;
memcpy_fromiovecend(data_kva, iov, offset, len);
if (unlikely(len < ETH_ZLEN)) {
@@ -177,7 +178,7 @@ kni_vhost_net_rx(struct kni_dev *kni, struct iovec *iov,
KNI_DBG_RX("rx offset=%d, len=%d, pkt_len=%d, iovlen=%d\n",
offset, len, pkt_len, (int)iov->iov_len);
- data_kva = kva->data - kni->mbuf_va + kni->mbuf_kva;
+ data_kva = kva->buf_addr + kva->data_off - kni->mbuf_va + kni->mbuf_kva;
if (unlikely(memcpy_toiovecend(iov, data_kva, offset, pkt_len)))
goto drop;
--
2.1.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v4] kni: fix build with Linux 5.18
@ 2022-06-05 8:22 Andrew Rybchenko
2022-06-06 10:46 ` [PATCH] kni: fix build Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Rybchenko @ 2022-06-05 8:22 UTC (permalink / raw)
To: Jiri Slaby, dev
Cc: stable, Stephen Hemminger, Ferruh Yigit, mingli.yu,
Min Hu (Connor)
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 <jslaby@suse.cz>
> ---
> [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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] kni: fix build
2022-06-05 8:22 [PATCH v4] kni: fix build with Linux 5.18 Andrew Rybchenko
@ 2022-06-06 10:46 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2022-06-06 10:46 UTC (permalink / raw)
To: dev; +Cc: daxuex.gao, stable, Andrew Rybchenko, Jiri Slaby
A previous fix had #else instead of #endif.
The error message is:
kernel/linux/kni/kni_net.c: In function ‘kni_net_rx_normal’:
kernel/linux/kni/kni_net.c:448:2: error: #else after #else
Bugzilla ID: 1025
Fixes: c98600d4bed6 ("kni: fix build with Linux 5.18")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
kernel/linux/kni/kni_net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index a8b092b756..41805fcabf 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -445,7 +445,7 @@ kni_net_rx_normal(struct kni_dev *kni)
netif_rx_ni(skb);
#else
netif_rx(skb);
-#else
+#endif
/* Update statistics */
dev->stats.rx_bytes += len;
--
2.36.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-06 10:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 14:51 [PATCH] kni: fix build Thomas Monjalon
[not found] ` <1415371867-3730-1-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-11-07 15:07 ` Olivier MATZ
[not found] ` <545CE01F.2060509-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2014-11-10 9:29 ` Thomas Monjalon
-- strict thread matches above, loose matches on Subject: below --
2022-06-05 8:22 [PATCH v4] kni: fix build with Linux 5.18 Andrew Rybchenko
2022-06-06 10:46 ` [PATCH] kni: fix build Thomas Monjalon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.