diff mbox series

[net-next,02/10] net: skb: add SKB_DR_RESET

Message ID 20240815124302.982711-3-dongml2@chinatelecom.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: vxlan: add skb drop reasons support | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 72 this patch: 72
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 4 of 4 maintainers
netdev/build_clang success Errors and warnings before: 131 this patch: 131
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4976 this patch: 4976
netdev/checkpatch warning WARNING: From:/Signed-off-by: email address mismatch: 'From: Menglong Dong <menglong8.dong@gmail.com>' != 'Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>'
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
netdev/contest success net-next-2024-08-16--21-00 (tests: 710)

Commit Message

Menglong Dong Aug. 15, 2024, 12:42 p.m. UTC
For now, the skb drop reason can be SKB_NOT_DROPPED_YET, which makes the
kfree_skb_reason call consume_skb. In some case, we need to make sure that
kfree_skb is called, which means the reason can't be SKB_NOT_DROPPED_YET.
Introduce SKB_DR_RESET() to reset the reason to NOT_SPECIFIED if it is
SKB_NOT_DROPPED_YET.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
 include/net/dropreason-core.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Ido Schimmel Aug. 20, 2024, 12:24 p.m. UTC | #1
On Thu, Aug 15, 2024 at 08:42:54PM +0800, Menglong Dong wrote:
> For now, the skb drop reason can be SKB_NOT_DROPPED_YET, which makes the
> kfree_skb_reason call consume_skb.

Maybe I'm missing something, but kfree_skb_reason() only calls
trace_consume_skb() if reason is SKB_CONSUMED. With SKB_NOT_DROPPED_YET
you will get a warning.

> In some case, we need to make sure that
> kfree_skb is called, which means the reason can't be SKB_NOT_DROPPED_YET.
> Introduce SKB_DR_RESET() to reset the reason to NOT_SPECIFIED if it is
> SKB_NOT_DROPPED_YET.
> 
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
>  include/net/dropreason-core.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
> index 9707ab54fdd5..8da0129d1ed6 100644
> --- a/include/net/dropreason-core.h
> +++ b/include/net/dropreason-core.h
> @@ -445,5 +445,6 @@ enum skb_drop_reason {
>  		    name == SKB_NOT_DROPPED_YET)		\
>  			SKB_DR_SET(name, reason);		\
>  	} while (0)
> +#define SKB_DR_RESET(name) SKB_DR_OR(name, NOT_SPECIFIED)
>  
>  #endif
> -- 
> 2.39.2
>
Menglong Dong Aug. 21, 2024, 12:55 p.m. UTC | #2
On Tue, Aug 20, 2024 at 8:24 PM Ido Schimmel <idosch@nvidia.com> wrote:
>
> On Thu, Aug 15, 2024 at 08:42:54PM +0800, Menglong Dong wrote:
> > For now, the skb drop reason can be SKB_NOT_DROPPED_YET, which makes the
> > kfree_skb_reason call consume_skb.
>
> Maybe I'm missing something, but kfree_skb_reason() only calls
> trace_consume_skb() if reason is SKB_CONSUMED. With SKB_NOT_DROPPED_YET
> you will get a warning.
>

Yeah, I use this macro to avoid such WARNING. And I'm not sure
if we need this patch now :/

> > In some case, we need to make sure that
> > kfree_skb is called, which means the reason can't be SKB_NOT_DROPPED_YET.
> > Introduce SKB_DR_RESET() to reset the reason to NOT_SPECIFIED if it is
> > SKB_NOT_DROPPED_YET.
> >
> > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > ---
> >  include/net/dropreason-core.h | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
> > index 9707ab54fdd5..8da0129d1ed6 100644
> > --- a/include/net/dropreason-core.h
> > +++ b/include/net/dropreason-core.h
> > @@ -445,5 +445,6 @@ enum skb_drop_reason {
> >                   name == SKB_NOT_DROPPED_YET)                \
> >                       SKB_DR_SET(name, reason);               \
> >       } while (0)
> > +#define SKB_DR_RESET(name) SKB_DR_OR(name, NOT_SPECIFIED)
> >
> >  #endif
> > --
> > 2.39.2
> >
diff mbox series

Patch

diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index 9707ab54fdd5..8da0129d1ed6 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -445,5 +445,6 @@  enum skb_drop_reason {
 		    name == SKB_NOT_DROPPED_YET)		\
 			SKB_DR_SET(name, reason);		\
 	} while (0)
+#define SKB_DR_RESET(name) SKB_DR_OR(name, NOT_SPECIFIED)
 
 #endif