Skip to content

Commit

Permalink
net: dev: add skb drop reasons to __dev_xmit_skb()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
menglongdong authored and davem330 committed Mar 4, 2022
1 parent 215b0f1 commit 7faef05
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
1 change: 1 addition & 0 deletions include/trace/events/skb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -3814,7 +3815,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
}
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;
Expand Down

0 comments on commit 7faef05

Please sign in to comment.