diff mbox series

[v2,net-next,1/8] net: socket: intrudoce SKB_DROP_REASON_SOCKET_FILTER

Message ID 20220127091308.91401-2-imagedong@tencent.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series net: use kfree_skb_reason() for ip/udp packet receive | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 5991 this patch: 5991
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 882 this patch: 882
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 6142 this patch: 6142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Menglong Dong Jan. 27, 2022, 9:13 a.m. UTC
From: Menglong Dong <imagedong@tencent.com>

Introduce SKB_DROP_REASON_SOCKET_FILTER, which is used as the reason
of skb drop out of socket filter. Meanwhile, replace
SKB_DROP_REASON_TCP_FILTER with it.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
---
 include/linux/skbuff.h     | 2 +-
 include/trace/events/skb.h | 2 +-
 net/ipv4/tcp_ipv4.c        | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Comments

David Ahern Jan. 27, 2022, 3:37 p.m. UTC | #1
On 1/27/22 2:13 AM, menglong8.dong@gmail.com wrote:
> From: Menglong Dong <imagedong@tencent.com>
> 
> Introduce SKB_DROP_REASON_SOCKET_FILTER, which is used as the reason
> of skb drop out of socket filter. Meanwhile, replace
> SKB_DROP_REASON_TCP_FILTER with it.
> 
> Signed-off-by: Menglong Dong <imagedong@tencent.com>
> ---
>  include/linux/skbuff.h     | 2 +-
>  include/trace/events/skb.h | 2 +-
>  net/ipv4/tcp_ipv4.c        | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> index bf11e1fbd69b..8a636e678902 100644
> --- a/include/linux/skbuff.h
> +++ b/include/linux/skbuff.h
> @@ -318,7 +318,7 @@ enum skb_drop_reason {
>  	SKB_DROP_REASON_NO_SOCKET,
>  	SKB_DROP_REASON_PKT_TOO_SMALL,
>  	SKB_DROP_REASON_TCP_CSUM,
> -	SKB_DROP_REASON_TCP_FILTER,
> +	SKB_DROP_REASON_SOCKET_FILTER,
>  	SKB_DROP_REASON_UDP_CSUM,
>  	SKB_DROP_REASON_MAX,
>  };
> diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
> index 3e042ca2cedb..a8a64b97504d 100644
> --- a/include/trace/events/skb.h
> +++ b/include/trace/events/skb.h
> @@ -14,7 +14,7 @@
>  	EM(SKB_DROP_REASON_NO_SOCKET, NO_SOCKET)		\
>  	EM(SKB_DROP_REASON_PKT_TOO_SMALL, PKT_TOO_SMALL)	\
>  	EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM)			\
> -	EM(SKB_DROP_REASON_TCP_FILTER, TCP_FILTER)		\
> +	EM(SKB_DROP_REASON_SOCKET_FILTER, SOCKET_FILTER)	\
>  	EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM)			\
>  	EMe(SKB_DROP_REASON_MAX, MAX)
>  
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index b3f34e366b27..938b59636578 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -2095,7 +2095,7 @@ int tcp_v4_rcv(struct sk_buff *skb)
>  	nf_reset_ct(skb);
>  
>  	if (tcp_filter(sk, skb)) {
> -		drop_reason = SKB_DROP_REASON_TCP_FILTER;
> +		drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
>  		goto discard_and_relse;
>  	}
>  	th = (const struct tcphdr *)skb->data;

This should go to net, not net-next.

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Jan. 27, 2022, 4:42 p.m. UTC | #2
On Thu, 27 Jan 2022 08:37:06 -0700 David Ahern wrote:
> On 1/27/22 2:13 AM, menglong8.dong@gmail.com wrote:
> > From: Menglong Dong <imagedong@tencent.com>
> > 
> > Introduce SKB_DROP_REASON_SOCKET_FILTER, which is used as the reason
> > of skb drop out of socket filter. Meanwhile, replace
> > SKB_DROP_REASON_TCP_FILTER with it.

> > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > index bf11e1fbd69b..8a636e678902 100644
> > --- a/include/linux/skbuff.h
> > +++ b/include/linux/skbuff.h
> > @@ -318,7 +318,7 @@ enum skb_drop_reason {
> >  	SKB_DROP_REASON_NO_SOCKET,
> >  	SKB_DROP_REASON_PKT_TOO_SMALL,
> >  	SKB_DROP_REASON_TCP_CSUM,
> > -	SKB_DROP_REASON_TCP_FILTER,
> > +	SKB_DROP_REASON_SOCKET_FILTER,
> >  	SKB_DROP_REASON_UDP_CSUM,
> >  	SKB_DROP_REASON_MAX,
> 
> This should go to net, not net-next.

Let me make an exception and apply this patch out of the series 
to avoid a conflict / week long wait for another merge.
Menglong Dong Jan. 28, 2022, 7:31 a.m. UTC | #3
On Fri, Jan 28, 2022 at 12:42 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 27 Jan 2022 08:37:06 -0700 David Ahern wrote:
> > On 1/27/22 2:13 AM, menglong8.dong@gmail.com wrote:
> > > From: Menglong Dong <imagedong@tencent.com>
> > >
> > > Introduce SKB_DROP_REASON_SOCKET_FILTER, which is used as the reason
> > > of skb drop out of socket filter. Meanwhile, replace
> > > SKB_DROP_REASON_TCP_FILTER with it.
>
> > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
> > > index bf11e1fbd69b..8a636e678902 100644
> > > --- a/include/linux/skbuff.h
> > > +++ b/include/linux/skbuff.h
> > > @@ -318,7 +318,7 @@ enum skb_drop_reason {
> > >     SKB_DROP_REASON_NO_SOCKET,
> > >     SKB_DROP_REASON_PKT_TOO_SMALL,
> > >     SKB_DROP_REASON_TCP_CSUM,
> > > -   SKB_DROP_REASON_TCP_FILTER,
> > > +   SKB_DROP_REASON_SOCKET_FILTER,
> > >     SKB_DROP_REASON_UDP_CSUM,
> > >     SKB_DROP_REASON_MAX,
> >
> > This should go to net, not net-next.
>
> Let me make an exception and apply this patch out of the series
> to avoid a conflict / week long wait for another merge.

Thank you! I'll send v3 of this series patches without this one.
diff mbox series

Patch

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bf11e1fbd69b..8a636e678902 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -318,7 +318,7 @@  enum skb_drop_reason {
 	SKB_DROP_REASON_NO_SOCKET,
 	SKB_DROP_REASON_PKT_TOO_SMALL,
 	SKB_DROP_REASON_TCP_CSUM,
-	SKB_DROP_REASON_TCP_FILTER,
+	SKB_DROP_REASON_SOCKET_FILTER,
 	SKB_DROP_REASON_UDP_CSUM,
 	SKB_DROP_REASON_MAX,
 };
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 3e042ca2cedb..a8a64b97504d 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -14,7 +14,7 @@ 
 	EM(SKB_DROP_REASON_NO_SOCKET, NO_SOCKET)		\
 	EM(SKB_DROP_REASON_PKT_TOO_SMALL, PKT_TOO_SMALL)	\
 	EM(SKB_DROP_REASON_TCP_CSUM, TCP_CSUM)			\
-	EM(SKB_DROP_REASON_TCP_FILTER, TCP_FILTER)		\
+	EM(SKB_DROP_REASON_SOCKET_FILTER, SOCKET_FILTER)	\
 	EM(SKB_DROP_REASON_UDP_CSUM, UDP_CSUM)			\
 	EMe(SKB_DROP_REASON_MAX, MAX)
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index b3f34e366b27..938b59636578 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2095,7 +2095,7 @@  int tcp_v4_rcv(struct sk_buff *skb)
 	nf_reset_ct(skb);
 
 	if (tcp_filter(sk, skb)) {
-		drop_reason = SKB_DROP_REASON_TCP_FILTER;
+		drop_reason = SKB_DROP_REASON_SOCKET_FILTER;
 		goto discard_and_relse;
 	}
 	th = (const struct tcphdr *)skb->data;