linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
@ 2021-06-07 12:26 Wang Hai
  2021-06-08 11:07 ` [Intel-wired-lan] " Magnus Karlsson
  2021-08-17 10:39 ` Penigalapati, Sandeep
  0 siblings, 2 replies; 3+ messages in thread
From: Wang Hai @ 2021-06-07 12:26 UTC (permalink / raw)
  To: jesse.brandeburg, anthony.l.nguyen, davem, ast, kuba, daniel,
	hawk, john.fastabend, jeffrey.t.kirsher, jan.sokolowski,
	magnus.karlsson
  Cc: intel-wired-lan, bpf, netdev, linux-kernel

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 <wanghai38@huawei.com>
---
 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


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

* Re: [Intel-wired-lan] [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
  2021-06-07 12:26 [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Wang Hai
@ 2021-06-08 11:07 ` Magnus Karlsson
  2021-08-17 10:39 ` Penigalapati, Sandeep
  1 sibling, 0 replies; 3+ messages in thread
From: Magnus Karlsson @ 2021-06-08 11:07 UTC (permalink / raw)
  To: Wang Hai
  Cc: Brandeburg, Jesse, Nguyen, Anthony L, David S. Miller,
	Alexei Starovoitov, Jakub Kicinski, Daniel Borkmann,
	Jesper Dangaard Brouer, John Fastabend, Jeff Kirsher,
	jan.sokolowski, Karlsson, Magnus, Network Development, bpf,
	intel-wired-lan, open list

On Mon, Jun 7, 2021 at 2:17 PM Wang Hai <wanghai38@huawei.com> 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 <wanghai38@huawei.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Thanks Wang.

Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>

> 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
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* RE: [Intel-wired-lan] [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path
  2021-06-07 12:26 [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Wang Hai
  2021-06-08 11:07 ` [Intel-wired-lan] " Magnus Karlsson
@ 2021-08-17 10:39 ` Penigalapati, Sandeep
  1 sibling, 0 replies; 3+ messages in thread
From: Penigalapati, Sandeep @ 2021-08-17 10:39 UTC (permalink / raw)
  To: Wang Hai, Brandeburg, Jesse, Nguyen, Anthony L, davem, ast, kuba,
	daniel, hawk, john.fastabend, jeffrey.t.kirsher, Sokolowski, Jan,
	Karlsson, Magnus
  Cc: netdev, bpf, intel-wired-lan, linux-kernel

>-----Original Message-----
>From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
>Wang Hai
>Sent: Monday, June 7, 2021 5:57 PM
>To: Brandeburg, Jesse <jesse.brandeburg@intel.com>; Nguyen, Anthony L
><anthony.l.nguyen@intel.com>; davem@davemloft.net; ast@kernel.org;
>kuba@kernel.org; daniel@iogearbox.net; hawk@kernel.org;
>john.fastabend@gmail.com; jeffrey.t.kirsher@intel.com; Sokolowski, Jan
><jan.sokolowski@intel.com>; Karlsson, Magnus
><magnus.karlsson@intel.com>
>Cc: netdev@vger.kernel.org; bpf@vger.kernel.org; intel-wired-
>lan@lists.osuosl.org; linux-kernel@vger.kernel.org
>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 <wanghai38@huawei.com>
>---
> drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
Tested-by: Sandeep Penigalapati <sandeep.penigalapati@intel.com>

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

end of thread, other threads:[~2021-08-17 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-07 12:26 [PATCH net] ixgbe, xsk: clean up the resources in ixgbe_xsk_pool_enable error path Wang Hai
2021-06-08 11:07 ` [Intel-wired-lan] " Magnus Karlsson
2021-08-17 10:39 ` Penigalapati, Sandeep

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