linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output()
@ 2025-05-20  2:44 jiang.kun2
  2025-05-20  4:58 ` Kuniyuki Iwashima
  0 siblings, 1 reply; 4+ messages in thread
From: jiang.kun2 @ 2025-05-20  2:44 UTC (permalink / raw)
  To: davem, kuba
  Cc: edumazet, pabeni, horms, kuniyu, gnaaman, leitao, lizetao1,
	netdev, linux-kernel, xu.xin16, yang.yang29, wang.yaxin, fan.yu9,
	he.peilin, tu.qiang35, qiu.yutan, zhang.yunkai, ye.xingchen

From: Qiu Yutan <qiu.yutan@zte.com.cn>

Replace kfree_skb() used in neigh_resolve_output() with kfree_skb_reason().

Following new skb drop reason is added:
/* failed to fill the device hard header */
SKB_DROP_REASON_NEIGH_HH_FILLFAIL

Signed-off-by: Qiu Yutan <qiu.yutan@zte.com.cn>
Signed-off-by: Jiang Kun <jiang.kun2@zte.com.cn>
---
 include/net/dropreason-core.h | 3 +++
 net/core/neighbour.c          | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
index bea77934a235..bcf9d7467e1a 100644
--- a/include/net/dropreason-core.h
+++ b/include/net/dropreason-core.h
@@ -62,6 +62,7 @@
 	FN(NEIGH_FAILED)		\
 	FN(NEIGH_QUEUEFULL)		\
 	FN(NEIGH_DEAD)			\
+	FN(NEIGH_HH_FILLFAIL)		\
 	FN(TC_EGRESS)			\
 	FN(SECURITY_HOOK)		\
 	FN(QDISC_DROP)			\
@@ -348,6 +349,8 @@ enum skb_drop_reason {
 	SKB_DROP_REASON_NEIGH_QUEUEFULL,
 	/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
 	SKB_DROP_REASON_NEIGH_DEAD,
+	/** @SKB_DROP_REASON_NEIGH_HH_FILLFAIL: failed to fill the device hard header */
+	SKB_DROP_REASON_NEIGH_HH_FILLFAIL,
 	/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
 	SKB_DROP_REASON_TC_EGRESS,
 	/** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 254067b719da..f297296c1a43 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1517,7 +1517,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
 	return rc;
 out_kfree_skb:
 	rc = -EINVAL;
-	kfree_skb(skb);
+	kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_HH_FILLFAIL);
 	goto out;
 }
 EXPORT_SYMBOL(neigh_resolve_output);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output()
  2025-05-20  2:44 [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output() jiang.kun2
@ 2025-05-20  4:58 ` Kuniyuki Iwashima
  2025-05-20 10:40   ` jiang.kun2
  0 siblings, 1 reply; 4+ messages in thread
From: Kuniyuki Iwashima @ 2025-05-20  4:58 UTC (permalink / raw)
  To: jiang.kun2
  Cc: davem, edumazet, fan.yu9, gnaaman, he.peilin, horms, kuba, kuniyu,
	leitao, linux-kernel, lizetao1, netdev, pabeni, qiu.yutan,
	tu.qiang35, wang.yaxin, xu.xin16, yang.yang29, ye.xingchen,
	zhang.yunkai

From: <jiang.kun2@zte.com.cn>
Date: Tue, 20 May 2025 10:44:13 +0800 (CST)
> From: Qiu Yutan <qiu.yutan@zte.com.cn>
> 
> Replace kfree_skb() used in neigh_resolve_output() with kfree_skb_reason().
> 
> Following new skb drop reason is added:
> /* failed to fill the device hard header */
> SKB_DROP_REASON_NEIGH_HH_FILLFAIL
> 
> Signed-off-by: Qiu Yutan <qiu.yutan@zte.com.cn>
> Signed-off-by: Jiang Kun <jiang.kun2@zte.com.cn>
> ---
>  include/net/dropreason-core.h | 3 +++
>  net/core/neighbour.c          | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/dropreason-core.h b/include/net/dropreason-core.h
> index bea77934a235..bcf9d7467e1a 100644
> --- a/include/net/dropreason-core.h
> +++ b/include/net/dropreason-core.h
> @@ -62,6 +62,7 @@
>  	FN(NEIGH_FAILED)		\
>  	FN(NEIGH_QUEUEFULL)		\
>  	FN(NEIGH_DEAD)			\
> +	FN(NEIGH_HH_FILLFAIL)		\
>  	FN(TC_EGRESS)			\
>  	FN(SECURITY_HOOK)		\
>  	FN(QDISC_DROP)			\
> @@ -348,6 +349,8 @@ enum skb_drop_reason {
>  	SKB_DROP_REASON_NEIGH_QUEUEFULL,
>  	/** @SKB_DROP_REASON_NEIGH_DEAD: neigh entry is dead */
>  	SKB_DROP_REASON_NEIGH_DEAD,
> +	/** @SKB_DROP_REASON_NEIGH_HH_FILLFAIL: failed to fill the device hard header */
> +	SKB_DROP_REASON_NEIGH_HH_FILLFAIL,
>  	/** @SKB_DROP_REASON_TC_EGRESS: dropped in TC egress HOOK */
>  	SKB_DROP_REASON_TC_EGRESS,
>  	/** @SKB_DROP_REASON_SECURITY_HOOK: dropped due to security HOOK */
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 254067b719da..f297296c1a43 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> @@ -1517,7 +1517,7 @@ int neigh_resolve_output(struct neighbour *neigh, struct sk_buff *skb)
>  	return rc;
>  out_kfree_skb:
>  	rc = -EINVAL;
> -	kfree_skb(skb);
> +	kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_HH_FILLFAIL);

Is there any reason you don't change neigh_connected_output() ?


If you respin, please specify net-next and the patch version in

Subject: [PATCH v2 net-next] net: neighbour: ...


>  	goto out;
>  }
>  EXPORT_SYMBOL(neigh_resolve_output);
> -- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:Re: [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output()
  2025-05-20  4:58 ` Kuniyuki Iwashima
@ 2025-05-20 10:40   ` jiang.kun2
  2025-05-20 18:05     ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: jiang.kun2 @ 2025-05-20 10:40 UTC (permalink / raw)
  To: kuniyu
  Cc: davem, edumazet, fan.yu9, gnaaman, he.peilin, horms, kuba, kuniyu,
	leitao, linux-kernel, lizetao1, netdev, pabeni, qiu.yutan,
	tu.qiang35, wang.yaxin, xu.xin16, yang.yang29, ye.xingchen,
	zhang.yunkai


[-- Attachment #1.1.1: Type: text/plain, Size: 595 bytes --]

>Is there any reason you don't change neigh_connected_output() ?
>
>
>If you respin, please specify net-next and the patch version in
>
>Subject: [PATCH v2 net-next] net: neighbour: ...
>

Thank you for your feedback.
I notice that most commits related to kfree_skb_reason() involve changes 
within the scope of a single function, which aligns with the meaning of 
the commit titles. I consider this approach appropriate as it facilitates 
both modification and traceability. Following this approach, I will submit 
another new patch to specifically modify neigh_connected_output().

[-- Attachment #1.1.2: Type: text/html , Size: 1246 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output()
  2025-05-20 10:40   ` jiang.kun2
@ 2025-05-20 18:05     ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-05-20 18:05 UTC (permalink / raw)
  To: jiang.kun2
  Cc: kuniyu, davem, edumazet, fan.yu9, gnaaman, he.peilin, kuba,
	leitao, linux-kernel, lizetao1, netdev, pabeni, qiu.yutan,
	tu.qiang35, wang.yaxin, xu.xin16, yang.yang29, ye.xingchen,
	zhang.yunkai

On Tue, May 20, 2025 at 06:40:32PM +0800, jiang.kun2@zte.com.cn wrote:
> >Is there any reason you don't change neigh_connected_output() ?
> >
> >
> >If you respin, please specify net-next and the patch version in
> >
> >Subject: [PATCH v2 net-next] net: neighbour: ...
> >
> 
> Thank you for your feedback.
> I notice that most commits related to kfree_skb_reason() involve changes 
> within the scope of a single function, which aligns with the meaning of 
> the commit titles. I consider this approach appropriate as it facilitates 
> both modification and traceability. Following this approach, I will submit 
> another new patch to specifically modify neigh_connected_output().

I think it makes sense to make changes that are closely related,
as seems to be the case here, in a single patch.

-- 
pw-bot: changes-requested

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-20 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-20  2:44 [PATCH linux next] net: neigh: use kfree_skb_reason() in neigh_resolve_output() jiang.kun2
2025-05-20  4:58 ` Kuniyuki Iwashima
2025-05-20 10:40   ` jiang.kun2
2025-05-20 18:05     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).