diff mbox series

[net-next,v2,08/12] net: vxlan: use vxlan_kfree_skb() in vxlan_xmit()

Message ID 20240830020001.79377-9-dongml2@chinatelecom.cn (mailing list archive)
State Superseded
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: 58 this patch: 58
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 116 this patch: 116
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: 4960 this patch: 4960
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>' WARNING: line length of 85 exceeds 80 columns
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-30--21-00 (tests: 713)

Commit Message

Menglong Dong Aug. 30, 2024, 1:59 a.m. UTC
Replace kfree_skb() with vxlan_kfree_skb() in vxlan_xmit(). Following
new skb drop reasons are introduced for vxlan:

/* no remote found */
VXLAN_DROP_NO_REMOTE

And following drop reason is introduced to dropreason-core:

/* txinfo is missed in "external" mode */
SKB_DROP_REASON_TUNNEL_TXINFO

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
---
v2:
- move the drop reason "TXINFO" from vxlan to core
- rename VXLAN_DROP_REMOTE to VXLAN_DROP_NO_REMOTE
---
 drivers/net/vxlan/drop.h       | 3 +++
 drivers/net/vxlan/vxlan_core.c | 6 +++---
 include/net/dropreason-core.h  | 3 +++
 3 files changed, 9 insertions(+), 3 deletions(-)

Comments

Simon Horman Aug. 30, 2024, 3:34 p.m. UTC | #1
On Fri, Aug 30, 2024 at 09:59:57AM +0800, Menglong Dong wrote:
> Replace kfree_skb() with vxlan_kfree_skb() in vxlan_xmit(). Following
> new skb drop reasons are introduced for vxlan:
> 
> /* no remote found */
> VXLAN_DROP_NO_REMOTE
> 
> And following drop reason is introduced to dropreason-core:
> 
> /* txinfo is missed in "external" mode */
> SKB_DROP_REASON_TUNNEL_TXINFO
> 
> Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> ---
> v2:
> - move the drop reason "TXINFO" from vxlan to core
> - rename VXLAN_DROP_REMOTE to VXLAN_DROP_NO_REMOTE
> ---
>  drivers/net/vxlan/drop.h       | 3 +++
>  drivers/net/vxlan/vxlan_core.c | 6 +++---
>  include/net/dropreason-core.h  | 3 +++
>  3 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/vxlan/drop.h b/drivers/net/vxlan/drop.h
> index 416532633881..a8ad96e0a502 100644
> --- a/drivers/net/vxlan/drop.h
> +++ b/drivers/net/vxlan/drop.h
> @@ -13,6 +13,7 @@
>  	R(VXLAN_DROP_ENTRY_EXISTS)		\
>  	R(VXLAN_DROP_INVALID_HDR)		\
>  	R(VXLAN_DROP_VNI_NOT_FOUND)		\
> +	R(VXLAN_DROP_NO_REMOTE)			\
>  	/* deliberate comment for trailing \ */
>  
>  enum vxlan_drop_reason {
> @@ -33,6 +34,8 @@ enum vxlan_drop_reason {
>  	VXLAN_DROP_INVALID_HDR,
>  	/** @VXLAN_DROP_VNI_NOT_FOUND: no vxlan device found for the vni */
>  	VXLAN_DROP_VNI_NOT_FOUND,
> +	/** @VXLAN_DROP_NO_REMOTE: no remote found to transmit the packet */

Maybe: no remote found for transmit
   or: no remote found for xmit

> +	VXLAN_DROP_NO_REMOTE,
>  };
>  
>  static inline void

...
Menglong Dong Sept. 1, 2024, 1:02 p.m. UTC | #2
On Fri, Aug 30, 2024 at 11:34 PM Simon Horman <horms@kernel.org> wrote:
>
> On Fri, Aug 30, 2024 at 09:59:57AM +0800, Menglong Dong wrote:
> > Replace kfree_skb() with vxlan_kfree_skb() in vxlan_xmit(). Following
> > new skb drop reasons are introduced for vxlan:
> >
> > /* no remote found */
> > VXLAN_DROP_NO_REMOTE
> >
> > And following drop reason is introduced to dropreason-core:
> >
> > /* txinfo is missed in "external" mode */
> > SKB_DROP_REASON_TUNNEL_TXINFO
> >
> > Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
> > ---
> > v2:
> > - move the drop reason "TXINFO" from vxlan to core
> > - rename VXLAN_DROP_REMOTE to VXLAN_DROP_NO_REMOTE
> > ---
> >  drivers/net/vxlan/drop.h       | 3 +++
> >  drivers/net/vxlan/vxlan_core.c | 6 +++---
> >  include/net/dropreason-core.h  | 3 +++
> >  3 files changed, 9 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/vxlan/drop.h b/drivers/net/vxlan/drop.h
> > index 416532633881..a8ad96e0a502 100644
> > --- a/drivers/net/vxlan/drop.h
> > +++ b/drivers/net/vxlan/drop.h
> > @@ -13,6 +13,7 @@
> >       R(VXLAN_DROP_ENTRY_EXISTS)              \
> >       R(VXLAN_DROP_INVALID_HDR)               \
> >       R(VXLAN_DROP_VNI_NOT_FOUND)             \
> > +     R(VXLAN_DROP_NO_REMOTE)                 \
> >       /* deliberate comment for trailing \ */
> >
> >  enum vxlan_drop_reason {
> > @@ -33,6 +34,8 @@ enum vxlan_drop_reason {
> >       VXLAN_DROP_INVALID_HDR,
> >       /** @VXLAN_DROP_VNI_NOT_FOUND: no vxlan device found for the vni */
> >       VXLAN_DROP_VNI_NOT_FOUND,
> > +     /** @VXLAN_DROP_NO_REMOTE: no remote found to transmit the packet */
>
> Maybe: no remote found for transmit
>    or: no remote found for xmit
>

Okay!

> > +     VXLAN_DROP_NO_REMOTE,
> >  };
> >
> >  static inline void
>
> ...
diff mbox series

Patch

diff --git a/drivers/net/vxlan/drop.h b/drivers/net/vxlan/drop.h
index 416532633881..a8ad96e0a502 100644
--- a/drivers/net/vxlan/drop.h
+++ b/drivers/net/vxlan/drop.h
@@ -13,6 +13,7 @@ 
 	R(VXLAN_DROP_ENTRY_EXISTS)		\
 	R(VXLAN_DROP_INVALID_HDR)		\
 	R(VXLAN_DROP_VNI_NOT_FOUND)		\
+	R(VXLAN_DROP_NO_REMOTE)			\
 	/* deliberate comment for trailing \ */
 
 enum vxlan_drop_reason {
@@ -33,6 +34,8 @@  enum vxlan_drop_reason {
 	VXLAN_DROP_INVALID_HDR,
 	/** @VXLAN_DROP_VNI_NOT_FOUND: no vxlan device found for the vni */
 	VXLAN_DROP_VNI_NOT_FOUND,
+	/** @VXLAN_DROP_NO_REMOTE: no remote found to transmit the packet */
+	VXLAN_DROP_NO_REMOTE,
 };
 
 static inline void
diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
index ab1c14a807f2..c3bdac6834d4 100644
--- a/drivers/net/vxlan/vxlan_core.c
+++ b/drivers/net/vxlan/vxlan_core.c
@@ -2728,7 +2728,7 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			if (info && info->mode & IP_TUNNEL_INFO_TX)
 				vxlan_xmit_one(skb, dev, vni, NULL, false);
 			else
-				kfree_skb(skb);
+				kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_TXINFO);
 			return NETDEV_TX_OK;
 		}
 	}
@@ -2791,7 +2791,7 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 			dev_core_stats_tx_dropped_inc(dev);
 			vxlan_vnifilter_count(vxlan, vni, NULL,
 					      VXLAN_VNI_STATS_TX_DROPS, 0);
-			kfree_skb(skb);
+			vxlan_kfree_skb(skb, VXLAN_DROP_NO_REMOTE);
 			return NETDEV_TX_OK;
 		}
 	}
@@ -2814,7 +2814,7 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 		if (fdst)
 			vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
 		else
-			kfree_skb(skb);
+			vxlan_kfree_skb(skb, VXLAN_DROP_NO_REMOTE);
 	}
 
 	return NETDEV_TX_OK;
diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index d38371f33e2b..77bd92f507d8 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -93,6 +93,7 @@ 
 	FN(TC_CHAIN_NOTFOUND)		\
 	FN(TC_RECLASSIFY_LOOP)		\
 	FN(IP_TUNNEL_ECN)		\
+	FN(TUNNEL_TXINFO)		\
 	FNe(MAX)
 
 /**
@@ -424,6 +425,8 @@  enum skb_drop_reason {
 	 * RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
 	 */
 	SKB_DROP_REASON_IP_TUNNEL_ECN,
+	/** @SKB_DROP_REASON_TUNNEL_TXINFO: tx info for tunnel is missed */
+	SKB_DROP_REASON_TUNNEL_TXINFO,
 	/**
 	 * @SKB_DROP_REASON_MAX: the maximum of core drop reasons, which
 	 * shouldn't be used as a real 'reason' - only for tracing code gen