Skip to content

Commit da1178c

Browse files
image-dragongregkh
authored andcommitted
net: vxlan: use kfree_skb_reason() in vxlan_xmit()
[ Upstream commit b71a576 ] Replace kfree_skb() with kfree_skb_reason() in vxlan_xmit(). Following new skb drop reasons are introduced for vxlan: /* no remote found for xmit */ SKB_DROP_REASON_VXLAN_NO_REMOTE /* packet without necessary metadata reached a device which is * in "external" mode */ SKB_DROP_REASON_TUNNEL_TXINFO Signed-off-by: Menglong Dong <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]> Stable-dep-of: 1f5d2fd ("vxlan: Fix NPD in {arp,neigh}_reduce() when using nexthop objects") Signed-off-by: Sasha Levin <[email protected]>
1 parent e891984 commit da1178c

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

drivers/net/vxlan/vxlan_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,7 +2724,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
27242724
if (info && info->mode & IP_TUNNEL_INFO_TX)
27252725
vxlan_xmit_one(skb, dev, vni, NULL, false);
27262726
else
2727-
kfree_skb(skb);
2727+
kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_TXINFO);
27282728
return NETDEV_TX_OK;
27292729
}
27302730
}
@@ -2787,7 +2787,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
27872787
dev_core_stats_tx_dropped_inc(dev);
27882788
vxlan_vnifilter_count(vxlan, vni, NULL,
27892789
VXLAN_VNI_STATS_TX_DROPS, 0);
2790-
kfree_skb(skb);
2790+
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
27912791
return NETDEV_TX_OK;
27922792
}
27932793
}
@@ -2810,7 +2810,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
28102810
if (fdst)
28112811
vxlan_xmit_one(skb, dev, vni, fdst, did_rsc);
28122812
else
2813-
kfree_skb(skb);
2813+
kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_NO_REMOTE);
28142814
}
28152815

28162816
return NETDEV_TX_OK;

include/net/dropreason-core.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,9 @@
9696
FN(VXLAN_VNI_NOT_FOUND) \
9797
FN(MAC_INVALID_SOURCE) \
9898
FN(VXLAN_ENTRY_EXISTS) \
99+
FN(VXLAN_NO_REMOTE) \
99100
FN(IP_TUNNEL_ECN) \
101+
FN(TUNNEL_TXINFO) \
100102
FN(LOCAL_MAC) \
101103
FNe(MAX)
102104

@@ -439,11 +441,18 @@ enum skb_drop_reason {
439441
* entry or an entry pointing to a nexthop.
440442
*/
441443
SKB_DROP_REASON_VXLAN_ENTRY_EXISTS,
444+
/** @SKB_DROP_REASON_VXLAN_NO_REMOTE: no remote found for xmit */
445+
SKB_DROP_REASON_VXLAN_NO_REMOTE,
442446
/**
443447
* @SKB_DROP_REASON_IP_TUNNEL_ECN: skb is dropped according to
444448
* RFC 6040 4.2, see __INET_ECN_decapsulate() for detail.
445449
*/
446450
SKB_DROP_REASON_IP_TUNNEL_ECN,
451+
/**
452+
* @SKB_DROP_REASON_TUNNEL_TXINFO: packet without necessary metadata
453+
* reached a device which is in "external" mode.
454+
*/
455+
SKB_DROP_REASON_TUNNEL_TXINFO,
447456
/**
448457
* @SKB_DROP_REASON_LOCAL_MAC: the source MAC address is equal to
449458
* the MAC address of the local netdev.

0 commit comments

Comments
 (0)