Skip to content

Commit

Permalink
net: skb: rename SKB_DROP_REASON_PTYPE_ABSENT
Browse files Browse the repository at this point in the history
As David Ahern suggested, the reasons for skb drops should be more
general and not be code based.

Therefore, rename SKB_DROP_REASON_PTYPE_ABSENT to
SKB_DROP_REASON_UNHANDLED_PROTO, which is used for the cases of no
L3 protocol handler, no L4 protocol handler, version extensions, etc.

From previous discussion, now we have the aim to make these reasons
more abstract and users based, avoiding code based.

Signed-off-by: Menglong Dong <[email protected]>
Reviewed-by: David Ahern <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
menglongdong authored and davem330 committed Apr 11, 2022
1 parent c1b8a56 commit 9f8ed57
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
8 changes: 3 additions & 5 deletions include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,9 @@ enum skb_drop_reason {
*/
SKB_DROP_REASON_XDP, /* dropped by XDP in input path */
SKB_DROP_REASON_TC_INGRESS, /* dropped in TC ingress HOOK */
SKB_DROP_REASON_PTYPE_ABSENT, /* not packet_type found to handle
* the skb. For an etner packet,
* this means that L3 protocol is
* not supported
*/
SKB_DROP_REASON_UNHANDLED_PROTO, /* protocol not implemented
* or not supported
*/
SKB_DROP_REASON_SKB_CSUM, /* sk_buff checksum computation
* error
*/
Expand Down
2 changes: 1 addition & 1 deletion include/trace/events/skb.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
EM(SKB_DROP_REASON_CPU_BACKLOG, CPU_BACKLOG) \
EM(SKB_DROP_REASON_XDP, XDP) \
EM(SKB_DROP_REASON_TC_INGRESS, TC_INGRESS) \
EM(SKB_DROP_REASON_PTYPE_ABSENT, PTYPE_ABSENT) \
EM(SKB_DROP_REASON_UNHANDLED_PROTO, UNHANDLED_PROTO) \
EM(SKB_DROP_REASON_SKB_CSUM, SKB_CSUM) \
EM(SKB_DROP_REASON_SKB_GSO_SEG, SKB_GSO_SEG) \
EM(SKB_DROP_REASON_SKB_UCOPY_FAULT, SKB_UCOPY_FAULT) \
Expand Down
8 changes: 3 additions & 5 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5375,13 +5375,11 @@ static int __netif_receive_skb_core(struct sk_buff **pskb, bool pfmemalloc,
*ppt_prev = pt_prev;
} else {
drop:
if (!deliver_exact) {
if (!deliver_exact)
dev_core_stats_rx_dropped_inc(skb->dev);
kfree_skb_reason(skb, SKB_DROP_REASON_PTYPE_ABSENT);
} else {
else
dev_core_stats_rx_nohandler_inc(skb->dev);
kfree_skb(skb);
}
kfree_skb_reason(skb, SKB_DROP_REASON_UNHANDLED_PROTO);
/* Jamal, now you will not able to escape explaining
* me how you were going to use this. :-)
*/
Expand Down

0 comments on commit 9f8ed57

Please sign in to comment.