diff mbox series

[net,v2,2/4] bnxt_en: Fix skb recycling logic in bnxt_deliver_skb()

Message ID 20231207000551.138584-3-michael.chan@broadcom.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series bnxt_en: Misc. fixes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success SINGLE THREAD; Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1115 this patch: 1115
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1144 this patch: 1144
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Michael Chan Dec. 7, 2023, 12:05 a.m. UTC
From: Sreekanth Reddy <sreekanth.reddy@broadcom.com>

Receive SKBs can go through the VF-rep path or the normal path.
skb_mark_for_recycle() is only called for the normal path.  Fix it
to do it for both paths to fix possible stalled page pool shutdown
errors.

Fixes: 86b05508f775 ("bnxt_en: Use the unified RX page pool buffers for XDP and non-XDP")
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Reviewed-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Dec. 7, 2023, 6:21 p.m. UTC | #1
On Wed,  6 Dec 2023 16:05:49 -0800 Michael Chan wrote:
> Receive SKBs can go through the VF-rep path or the normal path.
> skb_mark_for_recycle() is only called for the normal path.  Fix it
> to do it for both paths to fix possible stalled page pool shutdown
> errors.

This patch is probably fine, but since I'm complaining -
IMHO it may be better to mark the skbs right after they
are allocated. Catching all "exit points" seems very error
prone...
Jakub Kicinski Dec. 7, 2023, 6:22 p.m. UTC | #2
On Thu, 7 Dec 2023 10:21:44 -0800 Jakub Kicinski wrote:
> On Wed,  6 Dec 2023 16:05:49 -0800 Michael Chan wrote:
> > Receive SKBs can go through the VF-rep path or the normal path.
> > skb_mark_for_recycle() is only called for the normal path.  Fix it
> > to do it for both paths to fix possible stalled page pool shutdown
> > errors.  
> 
> This patch is probably fine, but since I'm complaining -
> IMHO it may be better to mark the skbs right after they
> are allocated. Catching all "exit points" seems very error
> prone...

To be 100% clear - I mean that as a suggestion for a potential 
net-next cleanup.
Andy Gospodarek Dec. 7, 2023, 6:37 p.m. UTC | #3
On Thu, Dec 07, 2023 at 10:21:44AM -0800, Jakub Kicinski wrote:
> On Wed,  6 Dec 2023 16:05:49 -0800 Michael Chan wrote:
> > Receive SKBs can go through the VF-rep path or the normal path.
> > skb_mark_for_recycle() is only called for the normal path.  Fix it
> > to do it for both paths to fix possible stalled page pool shutdown
> > errors.
> 
> This patch is probably fine, but since I'm complaining -
> IMHO it may be better to mark the skbs right after they
> are allocated. Catching all "exit points" seems very error
> prone...

That's a good suggestion.  To take it a step further...what about a
third arg (bool) to build_skb that would automatically call
skb_mark_for_recycle if the new 3rd arg was true?  I don't love the
extra arg, but that would avoid duplicating the need to call
skb_mark_for_recycle for all drivers that use the page pool for all
data.
Jakub Kicinski Dec. 7, 2023, 6:41 p.m. UTC | #4
On Thu, 7 Dec 2023 13:37:40 -0500 Andy Gospodarek wrote:
> That's a good suggestion.  To take it a step further...what about a
> third arg (bool) to build_skb that would automatically call
> skb_mark_for_recycle if the new 3rd arg was true?  I don't love the
> extra arg, but that would avoid duplicating the need to call
> skb_mark_for_recycle for all drivers that use the page pool for all
> data.

2x yes, would be great to have a function which just sets as recycling
by default; also don't love the extra arg / I could not come up with 
a nice API quickly :(
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 72f2fc983940..b4a5311bdeb5 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -1748,13 +1748,14 @@  static void bnxt_tpa_agg(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
 static void bnxt_deliver_skb(struct bnxt *bp, struct bnxt_napi *bnapi,
 			     struct sk_buff *skb)
 {
+	skb_mark_for_recycle(skb);
+
 	if (skb->dev != bp->dev) {
 		/* this packet belongs to a vf-rep */
 		bnxt_vf_rep_rx(bp, skb);
 		return;
 	}
 	skb_record_rx_queue(skb, bnapi->index);
-	skb_mark_for_recycle(skb);
 	napi_gro_receive(&bnapi->napi, skb);
 }