DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] kni: fix crash on userspace VA for segmented packets
@ 2021-06-22 12:29 Ferruh Yigit
  2021-06-24  1:57 ` Ajit Khaparde
  0 siblings, 1 reply; 3+ messages in thread
From: Ferruh Yigit @ 2021-06-22 12:29 UTC (permalink / raw)
  To: Jerin Jacob, Kiran Kumar K, Vamsi Attunuru; +Cc: Ferruh Yigit, dev, stable

When IOVA=VA, address translation for segmented packets is wrong, it
assumes the address in the mbuf->next is physical address, not VA
address.

Fixing the address translation to work both PA & VA mode.

Fixes: e73831dc6c26 ("kni: support userspace VA")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: vattunuru@marvell.com
---
 kernel/linux/kni/kni_net.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
index f259327954b2..611719b5ee27 100644
--- a/kernel/linux/kni/kni_net.c
+++ b/kernel/linux/kni/kni_net.c
@@ -245,7 +245,7 @@ kni_fifo_trans_pa2va(struct kni_dev *kni,
 					break;
 
 				prev_kva = kva;
-				kva = pa2kva(kva->next);
+				kva = get_kva(kni, kva->next);
 				/* Convert physical address to virtual address */
 				prev_kva->next = pa2va(prev_kva->next, kva);
 			}
@@ -422,7 +422,7 @@ kni_net_rx_normal(struct kni_dev *kni)
 					break;
 
 				prev_kva = kva;
-				kva = pa2kva(kva->next);
+				kva = get_kva(kni, kva->next);
 				data_kva = kva2data_kva(kva);
 				/* Convert physical address to virtual address */
 				prev_kva->next = pa2va(prev_kva->next, kva);
@@ -501,7 +501,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
 			kni->va[i] = pa2va(kni->pa[i], kva);
 
 			while (kva->next) {
-				next_kva = pa2kva(kva->next);
+				next_kva = get_kva(kni, kva->next);
 				/* Convert physical address to virtual address */
 				kva->next = pa2va(kva->next, next_kva);
 				kva = next_kva;
-- 
2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] kni: fix crash on userspace VA for segmented packets
  2021-06-22 12:29 [dpdk-dev] [PATCH] kni: fix crash on userspace VA for segmented packets Ferruh Yigit
@ 2021-06-24  1:57 ` Ajit Khaparde
  2021-06-24  7:48   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Ajit Khaparde @ 2021-06-24  1:57 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Jerin Jacob, Kiran Kumar K, Vamsi Attunuru, dpdk-dev, dpdk stable

[-- Attachment #1: Type: text/plain, Size: 2319 bytes --]

On Tue, Jun 22, 2021 at 5:39 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> When IOVA=VA, address translation for segmented packets is wrong, it
> assumes the address in the mbuf->next is physical address, not VA
> address.
>
> Fixing the address translation to work both PA & VA mode.
>
> Fixes: e73831dc6c26 ("kni: support userspace VA")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
> Cc: vattunuru@marvell.com
> ---
>  kernel/linux/kni/kni_net.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/linux/kni/kni_net.c b/kernel/linux/kni/kni_net.c
> index f259327954b2..611719b5ee27 100644
> --- a/kernel/linux/kni/kni_net.c
> +++ b/kernel/linux/kni/kni_net.c
> @@ -245,7 +245,7 @@ kni_fifo_trans_pa2va(struct kni_dev *kni,
>                                         break;
>
>                                 prev_kva = kva;
> -                               kva = pa2kva(kva->next);
> +                               kva = get_kva(kni, kva->next);
>                                 /* Convert physical address to virtual address */
>                                 prev_kva->next = pa2va(prev_kva->next, kva);
>                         }
> @@ -422,7 +422,7 @@ kni_net_rx_normal(struct kni_dev *kni)
>                                         break;
>
>                                 prev_kva = kva;
> -                               kva = pa2kva(kva->next);
> +                               kva = get_kva(kni, kva->next);
>                                 data_kva = kva2data_kva(kva);
>                                 /* Convert physical address to virtual address */
>                                 prev_kva->next = pa2va(prev_kva->next, kva);
> @@ -501,7 +501,7 @@ kni_net_rx_lo_fifo(struct kni_dev *kni)
>                         kni->va[i] = pa2va(kni->pa[i], kva);
>
>                         while (kva->next) {
> -                               next_kva = pa2kva(kva->next);
> +                               next_kva = get_kva(kni, kva->next);
>                                 /* Convert physical address to virtual address */
>                                 kva->next = pa2va(kva->next, next_kva);
>                                 kva = next_kva;
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH] kni: fix crash on userspace VA for segmented packets
  2021-06-24  1:57 ` Ajit Khaparde
@ 2021-06-24  7:48   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-06-24  7:48 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: stable, Jerin Jacob, Kiran Kumar K, Vamsi Attunuru, dpdk-dev,
	dpdk stable, Ajit Khaparde

24/06/2021 03:57, Ajit Khaparde:
> On Tue, Jun 22, 2021 at 5:39 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >
> > When IOVA=VA, address translation for segmented packets is wrong, it
> > assumes the address in the mbuf->next is physical address, not VA
> > address.
> >
> > Fixing the address translation to work both PA & VA mode.
> >
> > Fixes: e73831dc6c26 ("kni: support userspace VA")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

Applied, thanks




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-06-24  7:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 12:29 [dpdk-dev] [PATCH] kni: fix crash on userspace VA for segmented packets Ferruh Yigit
2021-06-24  1:57 ` Ajit Khaparde
2021-06-24  7:48   ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).