bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][v2] i40e: fix wrong index in i40e_xsk_umem_dma_map
@ 2020-06-02 12:12 Li RongQing
  2020-06-02 12:21 ` Björn Töpel
  0 siblings, 1 reply; 2+ messages in thread
From: Li RongQing @ 2020-06-02 12:12 UTC (permalink / raw)
  To: netdev, bpf

The dma should be unmapped in rollback path from
umem->pages[0].dma till umem->pages[i-1].dma which
is last dma map address

Fixes: 0a714186d3c0 "(i40e: add AF_XDP zero-copy Rx support)"
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
diff with v1: add description

 drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 0b7d29192b2c..c926438118ea 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -37,9 +37,9 @@ static int i40e_xsk_umem_dma_map(struct i40e_vsi *vsi, struct xdp_umem *umem)
 
 out_unmap:
 	for (j = 0; j < i; j++) {
-		dma_unmap_page_attrs(dev, umem->pages[i].dma, PAGE_SIZE,
+		dma_unmap_page_attrs(dev, umem->pages[j].dma, PAGE_SIZE,
 				     DMA_BIDIRECTIONAL, I40E_RX_DMA_ATTR);
-		umem->pages[i].dma = 0;
+		umem->pages[j].dma = 0;
 	}
 
 	return -1;
-- 
2.16.2


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

* Re: [PATCH][v2] i40e: fix wrong index in i40e_xsk_umem_dma_map
  2020-06-02 12:12 [PATCH][v2] i40e: fix wrong index in i40e_xsk_umem_dma_map Li RongQing
@ 2020-06-02 12:21 ` Björn Töpel
  0 siblings, 0 replies; 2+ messages in thread
From: Björn Töpel @ 2020-06-02 12:21 UTC (permalink / raw)
  To: Li RongQing, Netdev, David Miller; +Cc: bpf, intel-wired-lan, Karlsson, Magnus

On Tue, 2 Jun 2020 at 14:13, Li RongQing <lirongqing@baidu.com> wrote:
>
> The dma should be unmapped in rollback path from
> umem->pages[0].dma till umem->pages[i-1].dma which
> is last dma map address
>
> Fixes: 0a714186d3c0 "(i40e: add AF_XDP zero-copy Rx support)"
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> diff with v1: add description
>

Thanks! I think this should be queued for -stable.

Acked-by: Björn Töpel <bjorn.topel@intel.com>


>  drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index 0b7d29192b2c..c926438118ea 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -37,9 +37,9 @@ static int i40e_xsk_umem_dma_map(struct i40e_vsi *vsi, struct xdp_umem *umem)
>
>  out_unmap:
>         for (j = 0; j < i; j++) {
> -               dma_unmap_page_attrs(dev, umem->pages[i].dma, PAGE_SIZE,
> +               dma_unmap_page_attrs(dev, umem->pages[j].dma, PAGE_SIZE,
>                                      DMA_BIDIRECTIONAL, I40E_RX_DMA_ATTR);
> -               umem->pages[i].dma = 0;
> +               umem->pages[j].dma = 0;
>         }
>
>         return -1;
> --
> 2.16.2
>

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

end of thread, other threads:[~2020-06-02 12:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 12:12 [PATCH][v2] i40e: fix wrong index in i40e_xsk_umem_dma_map Li RongQing
2020-06-02 12:21 ` Björn Töpel

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).