2021-06-07 12:18:49

by Wang Hai

[permalink] [raw]
Subject: [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path

In ixgbe_xsk_pool_enable(), if ixgbe_xsk_wakeup() fails,
We should restore the previous state and clean up the
resources. Add the missing clear af_xdp_zc_qps and unmap dma
to fix this bug.

Fixes: d49e286d354e ("ixgbe: add tracking of AF_XDP zero-copy state for each queue pair")
Fixes: 4a9b32f30f80 ("ixgbe: fix potential RX buffer starvation for AF_XDP")
Signed-off-by: Wang Hai <[email protected]>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
index 91ad5b902673..d912f14d2ba4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
@@ -52,8 +52,11 @@ static int ixgbe_xsk_pool_enable(struct ixgbe_adapter *adapter,

/* Kick start the NAPI context so that receiving will start */
err = ixgbe_xsk_wakeup(adapter->netdev, qid, XDP_WAKEUP_RX);
- if (err)
+ if (err) {
+ clear_bit(qid, adapter->af_xdp_zc_qps);
+ xsk_pool_dma_unmap(pool, IXGBE_RX_DMA_ATTR);
return err;
+ }
}

return 0;
--
2.17.1


2021-06-08 11:11:17

by Magnus Karlsson

[permalink] [raw]
Subject: Re: [Intel-wired-lan] [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path

On Mon, Jun 7, 2021 at 2:17 PM Wang Hai <[email protected]> wrote:
>
> In ixgbe_xsk_pool_enable(), if ixgbe_xsk_wakeup() fails,
> We should restore the previous state and clean up the
> resources. Add the missing clear af_xdp_zc_qps and unmap dma
> to fix this bug.
>
> Fixes: d49e286d354e ("ixgbe: add tracking of AF_XDP zero-copy state for each queue pair")
> Fixes: 4a9b32f30f80 ("ixgbe: fix potential RX buffer starvation for AF_XDP")
> Signed-off-by: Wang Hai <[email protected]>
> ---
> drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)

Thanks Wang.

Acked-by: Magnus Karlsson <[email protected]>

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
> index 91ad5b902673..d912f14d2ba4 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c
> @@ -52,8 +52,11 @@ static int ixgbe_xsk_pool_enable(struct ixgbe_adapter *adapter,
>
> /* Kick start the NAPI context so that receiving will start */
> err = ixgbe_xsk_wakeup(adapter->netdev, qid, XDP_WAKEUP_RX);
> - if (err)
> + if (err) {
> + clear_bit(qid, adapter->af_xdp_zc_qps);
> + xsk_pool_dma_unmap(pool, IXGBE_RX_DMA_ATTR);
> return err;
> + }
> }
>
> return 0;
> --
> 2.17.1
>
> _______________________________________________
> Intel-wired-lan mailing list
> [email protected]
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

2021-08-17 10:41:58

by Penigalapati, Sandeep

[permalink] [raw]
Subject: RE: [Intel-wired-lan] [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path

>-----Original Message-----
>From: Intel-wired-lan <[email protected]> On Behalf Of
>Wang Hai
>Sent: Monday, June 7, 2021 5:57 PM
>To: Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L
><[email protected]>; [email protected]; [email protected];
>[email protected]; [email protected]; [email protected];
>[email protected]; [email protected]; Sokolowski, Jan
><[email protected]>; Karlsson, Magnus
><[email protected]>
>Cc: [email protected]; [email protected]; intel-wired-
>[email protected]; [email protected]
>Subject: [Intel-wired-lan] [PATCH net] ixgbe, xsk: clean up the resources in
>ixgbe_xsk_pool_enable error path
>
>In ixgbe_xsk_pool_enable(), if ixgbe_xsk_wakeup() fails, We should restore
>the previous state and clean up the resources. Add the missing clear
>af_xdp_zc_qps and unmap dma to fix this bug.
>
>Fixes: d49e286d354e ("ixgbe: add tracking of AF_XDP zero-copy state for each
>queue pair")
>Fixes: 4a9b32f30f80 ("ixgbe: fix potential RX buffer starvation for AF_XDP")
>Signed-off-by: Wang Hai <[email protected]>
>---
> drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Tested-by: Sandeep Penigalapati <[email protected]>