Commit 8fa66e4a authored by Jakub Kicinski's avatar Jakub Kicinski

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: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
Link: https://lore.kernel.org/r/20230420020005.815854-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 61718206
...@@ -3253,7 +3253,7 @@ static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi, ...@@ -3253,7 +3253,7 @@ static inline struct sk_buff *napi_alloc_skb(struct napi_struct *napi,
void napi_consume_skb(struct sk_buff *skb, int budget); void napi_consume_skb(struct sk_buff *skb, int budget);
void napi_skb_free_stolen_head(struct sk_buff *skb); void napi_skb_free_stolen_head(struct sk_buff *skb);
void __kfree_skb_defer(struct sk_buff *skb); void __napi_kfree_skb(struct sk_buff *skb, enum skb_drop_reason reason);
/** /**
* __dev_alloc_pages - allocate page for network Rx * __dev_alloc_pages - allocate page for network Rx
......
...@@ -5040,7 +5040,8 @@ static __latent_entropy void net_tx_action(struct softirq_action *h) ...@@ -5040,7 +5040,8 @@ static __latent_entropy void net_tx_action(struct softirq_action *h)
if (skb->fclone != SKB_FCLONE_UNAVAILABLE) if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
__kfree_skb(skb); __kfree_skb(skb);
else else
__kfree_skb_defer(skb); __napi_kfree_skb(skb,
get_kfree_skb_cb(skb)->reason);
} }
} }
......
...@@ -633,7 +633,7 @@ static gro_result_t napi_skb_finish(struct napi_struct *napi, ...@@ -633,7 +633,7 @@ static gro_result_t napi_skb_finish(struct napi_struct *napi,
else if (skb->fclone != SKB_FCLONE_UNAVAILABLE) else if (skb->fclone != SKB_FCLONE_UNAVAILABLE)
__kfree_skb(skb); __kfree_skb(skb);
else else
__kfree_skb_defer(skb); __napi_kfree_skb(skb, SKB_CONSUMED);
break; break;
case GRO_HELD: case GRO_HELD:
......
...@@ -1226,9 +1226,9 @@ static void napi_skb_cache_put(struct sk_buff *skb) ...@@ -1226,9 +1226,9 @@ static void napi_skb_cache_put(struct sk_buff *skb)
} }
} }
void __kfree_skb_defer(struct sk_buff *skb) void __napi_kfree_skb(struct sk_buff *skb, enum skb_drop_reason reason)
{ {
skb_release_all(skb, SKB_DROP_REASON_NOT_SPECIFIED, true); skb_release_all(skb, reason, true);
napi_skb_cache_put(skb); napi_skb_cache_put(skb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment