net: dev: add skb drop reasons to __dev_xmit_skb()

Add reasons for skb drops to __dev_xmit_skb() by replacing
kfree_skb_list() with kfree_skb_list_reason(). The drop reason of
SKB_DROP_REASON_QDISC_DROP is introduced for qdisc enqueue fails.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Menglong Dong 2022-03-04 14:00:42 +08:00 committed by David S. Miller
parent 215b0f1963
commit 7faef0547f
3 changed files with 8 additions and 2 deletions

View File

@ -395,6 +395,10 @@ enum skb_drop_reason {
*/
SKB_DROP_REASON_NEIGH_DEAD, /* neigh entry is dead */
SKB_DROP_REASON_TC_EGRESS, /* dropped in TC egress HOOK */
SKB_DROP_REASON_QDISC_DROP, /* dropped by qdisc when packet
* outputting (failed to enqueue to
* current qdisc)
*/
SKB_DROP_REASON_MAX,
};

View File

@ -46,6 +46,7 @@
EM(SKB_DROP_REASON_NEIGH_QUEUEFULL, NEIGH_QUEUEFULL) \
EM(SKB_DROP_REASON_NEIGH_DEAD, NEIGH_DEAD) \
EM(SKB_DROP_REASON_TC_EGRESS, TC_EGRESS) \
EM(SKB_DROP_REASON_QDISC_DROP, QDISC_DROP) \
EMe(SKB_DROP_REASON_MAX, MAX)
#undef EM

View File

@ -3759,7 +3759,8 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
no_lock_out:
if (unlikely(to_free))
kfree_skb_list(to_free);
kfree_skb_list_reason(to_free,
SKB_DROP_REASON_QDISC_DROP);
return rc;
}
@ -3814,7 +3815,7 @@ no_lock_out:
}
spin_unlock(root_lock);
if (unlikely(to_free))
kfree_skb_list(to_free);
kfree_skb_list_reason(to_free, SKB_DROP_REASON_QDISC_DROP);
if (unlikely(contended))
spin_unlock(&q->busylock);
return rc;