Skip to content

Commit 8fa66e4

Browse files
committed
net: skbuff: update and rename __kfree_skb_defer()
__kfree_skb_defer() uses the old naming where "defer" meant slab bulk free/alloc APIs. In the meantime we also made __kfree_skb_defer() feed the per-NAPI skb cache, which implies bulk APIs. So take away the 'defer' and add 'napi'. While at it add a drop reason. This only matters on the tx_action path, if the skb has a frag_list. But getting rid of a SKB_DROP_REASON_NOT_SPECIFIED seems like a net benefit so why not. Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Link: https://lore.kernel.org/r/20230420020005.815854-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6171820 commit 8fa66e4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

include/linux/skbuff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3253,7 +3253,7 @@ static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
32533253
void napi_consume_skb(struct sk_buff *skb, int budget);
32543254

32553255
void napi_skb_free_stolen_head(struct sk_buff *skb);
3256-
void __kfree_skb_defer(struct sk_buff *skb);
3256+
void __napi_kfree_skb(struct sk_buff *skb, enum skb_drop_reason reason);
32573257

32583258
/**
32593259
* __dev_alloc_pages - allocate page for network Rx

net/core/dev.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5040,7 +5040,8 @@ static __latent_entropy void net_tx_action(struct softirq_action *h)
50405040
if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
50415041
__kfree_skb(skb);
50425042
else
5043-
__kfree_skb_defer(skb);
5043+
__napi_kfree_skb(skb,
5044+
get_kfree_skb_cb(skb)->reason);
50445045
}
50455046
}
50465047

net/core/gro.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static gro_result_t napi_skb_finish(struct napi_struct *napi,
633633
else if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
634634
__kfree_skb(skb);
635635
else
636-
__kfree_skb_defer(skb);
636+
__napi_kfree_skb(skb, SKB_CONSUMED);
637637
break;
638638

639639
case GRO_HELD:

net/core/skbuff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,9 +1226,9 @@ static void napi_skb_cache_put(struct sk_buff *skb)
12261226
}
12271227
}
12281228

1229-
void __kfree_skb_defer(struct sk_buff *skb)
1229+
void __napi_kfree_skb(struct sk_buff *skb, enum skb_drop_reason reason)
12301230
{
1231-
skb_release_all(skb, SKB_DROP_REASON_NOT_SPECIFIED, true);
1231+
skb_release_all(skb, reason, true);
12321232
napi_skb_cache_put(skb);
12331233
}
12341234

0 commit comments

Comments
 (0)