VXLAN_INVALID_HDR and VXLAN_VNI_NOT_FOUND describe conditions that are not specific to vxlan: a malformed tunnel header, and a packet for which no tunnel device is found. The GRE receive paths converted later in this series drop packets for the same two conditions. Rename them to TUNNEL_INVALID_HDR and TUNNEL_NOT_FOUND and reword their descriptions, the way VXLAN_NO_REMOTE became NO_TX_TARGET in commit 46e0ccfb88f0 ("net: vxlan: rename SKB_DROP_REASON_VXLAN_NO_REMOTE"). The numeric values stay the same; the names that the skb:kfree_skb tracepoint and drop_monitor report change. Suggested-by: Ido Schimmel Assisted-by: LLM Signed-off-by: Anton Danilov --- drivers/net/vxlan/vxlan_core.c | 8 ++++---- include/net/dropreason-core.h | 19 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c index 27b0b6567d52..35a47cc27200 100644 --- a/drivers/net/vxlan/vxlan_core.c +++ b/drivers/net/vxlan/vxlan_core.c @@ -1700,7 +1700,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) if (!(vh->vx_flags & VXLAN_HF_VNI)) { netdev_dbg(skb->dev, "invalid vxlan flags=%#x vni=%#x\n", ntohl(vh->vx_flags), ntohl(vh->vx_vni)); - reason = SKB_DROP_REASON_VXLAN_INVALID_HDR; + reason = SKB_DROP_REASON_TUNNEL_INVALID_HDR; /* Return non vxlan pkt */ goto drop; } @@ -1713,7 +1713,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) vxlan = vxlan_vs_find_vni(vs, skb->dev->ifindex, vni, &vninode); if (!vxlan) { - reason = SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND; + reason = SKB_DROP_REASON_TUNNEL_NOT_FOUND; goto drop; } @@ -1729,7 +1729,7 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb) * previous stack code, and also is more robust and provides a * little more security in adding extensions to VXLAN. */ - reason = SKB_DROP_REASON_VXLAN_INVALID_HDR; + reason = SKB_DROP_REASON_TUNNEL_INVALID_HDR; DEV_STATS_INC(vxlan->dev, rx_frame_errors); DEV_STATS_INC(vxlan->dev, rx_errors); vxlan_vnifilter_count(vxlan, cfg, vni, vninode, @@ -2389,7 +2389,7 @@ static int encap_bypass_if_local(struct sk_buff *skb, struct net_device *dev, DEV_STATS_INC(dev, tx_errors); vxlan_vnifilter_count(vxlan, cfg, vni, NULL, VXLAN_VNI_STATS_TX_ERRORS, 0); - kfree_skb_reason(skb, SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND); + kfree_skb_reason(skb, SKB_DROP_REASON_TUNNEL_NOT_FOUND); return -ENOENT; } diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h index 12f909651591..40a27d8887af 100644 --- a/include/net/dropreason-core.h +++ b/include/net/dropreason-core.h @@ -111,8 +111,8 @@ FN(PACKET_SOCK_ERROR) \ FN(TC_CHAIN_NOTFOUND) \ FN(TC_RECLASSIFY_LOOP) \ - FN(VXLAN_INVALID_HDR) \ - FN(VXLAN_VNI_NOT_FOUND) \ + FN(TUNNEL_INVALID_HDR) \ + FN(TUNNEL_NOT_FOUND) \ FN(MAC_INVALID_SOURCE) \ FN(VXLAN_ENTRY_EXISTS) \ FN(NO_TX_TARGET) \ @@ -539,13 +539,16 @@ enum skb_drop_reason { */ SKB_DROP_REASON_TC_RECLASSIFY_LOOP, /** - * @SKB_DROP_REASON_VXLAN_INVALID_HDR: VXLAN header is invalid. E.g.: - * 1) reserved fields are not zero - * 2) "I" flag is not set + * @SKB_DROP_REASON_TUNNEL_INVALID_HDR: tunnel header is invalid. E.g.: + * 1) VXLAN reserved fields are not zero + * 2) VXLAN "I" flag is not set */ - SKB_DROP_REASON_VXLAN_INVALID_HDR, - /** @SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND: no VXLAN device found for VNI */ - SKB_DROP_REASON_VXLAN_VNI_NOT_FOUND, + SKB_DROP_REASON_TUNNEL_INVALID_HDR, + /** + * @SKB_DROP_REASON_TUNNEL_NOT_FOUND: no tunnel device found for the + * packet, e.g. no VXLAN device for its VNI + */ + SKB_DROP_REASON_TUNNEL_NOT_FOUND, /** @SKB_DROP_REASON_MAC_INVALID_SOURCE: source mac is invalid */ SKB_DROP_REASON_MAC_INVALID_SOURCE, /** -- 2.47.3