linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] net: Deal with if statement in rtnetlink_send()
@ 2021-07-15 12:12 Yajun Deng
  2021-07-15 12:12 ` [PATCH v2 1/2] rtnetlink: use nlmsg_notify() " Yajun Deng
  2021-07-16 17:50 ` [PATCH v2 0/2] net: Deal with if statement " patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Yajun Deng @ 2021-07-15 12:12 UTC (permalink / raw)
  To: davem, kuba, jhs, xiyou.wangcong, jiri, johannes.berg, avagin,
	ryazanov.s.a, vladimir.oltean, roopa, yajun.deng, zhudi21
  Cc: netdev, linux-kernel

Patch1: use nlmsg_notify() in rtnetlink_send(), so that the caller 
wouldn't deal with if statement.
Patch2: Remove unnecessary if statement.


Yajun Deng (2):
  rtnetlink: use nlmsg_notify() in rtnetlink_send()
  net/sched: Remove unnecessary if statement

 net/core/rtnetlink.c |  9 +--------
 net/sched/act_api.c  | 12 ++----------
 net/sched/cls_api.c  | 15 ++++-----------
 net/sched/sch_api.c  | 10 ++--------
 4 files changed, 9 insertions(+), 37 deletions(-)

-- 
2.32.0


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

* [PATCH v2 1/2] rtnetlink: use nlmsg_notify() in rtnetlink_send()
  2021-07-15 12:12 [PATCH v2 0/2] net: Deal with if statement in rtnetlink_send() Yajun Deng
@ 2021-07-15 12:12 ` Yajun Deng
  2021-07-16 17:50 ` [PATCH v2 0/2] net: Deal with if statement " patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yajun Deng @ 2021-07-15 12:12 UTC (permalink / raw)
  To: davem, kuba, jhs, xiyou.wangcong, jiri, johannes.berg, avagin,
	ryazanov.s.a, vladimir.oltean, roopa, yajun.deng, zhudi21
  Cc: netdev, linux-kernel

The netlink_{broadcast, unicast} don't deal with 'if (err > 0' statement
but nlmsg_{multicast, unicast} do. The nlmsg_notify() contains them.
so use nlmsg_notify() instead. so that the caller wouldn't deal with
'if (err > 0' statement.

v2: use nlmsg_notify() will do well.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
 net/core/rtnetlink.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f6af3e74fc44..670d74ab91ae 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -710,15 +710,8 @@ static int rtnl_link_fill(struct sk_buff *skb, const struct net_device *dev)
 int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, unsigned int group, int echo)
 {
 	struct sock *rtnl = net->rtnl;
-	int err = 0;
 
-	NETLINK_CB(skb).dst_group = group;
-	if (echo)
-		refcount_inc(&skb->users);
-	netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
-	if (echo)
-		err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
-	return err;
+	return nlmsg_notify(rtnl, skb, pid, group, echo, GFP_KERNEL);
 }
 
 int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid)
-- 
2.32.0


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

* Re: [PATCH v2 0/2] net: Deal with if statement in rtnetlink_send()
  2021-07-15 12:12 [PATCH v2 0/2] net: Deal with if statement in rtnetlink_send() Yajun Deng
  2021-07-15 12:12 ` [PATCH v2 1/2] rtnetlink: use nlmsg_notify() " Yajun Deng
@ 2021-07-16 17:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-16 17:50 UTC (permalink / raw)
  To: Yajun Deng
  Cc: davem, kuba, jhs, xiyou.wangcong, jiri, johannes.berg, avagin,
	ryazanov.s.a, vladimir.oltean, roopa, zhudi21, netdev,
	linux-kernel

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Thu, 15 Jul 2021 20:12:56 +0800 you wrote:
> Patch1: use nlmsg_notify() in rtnetlink_send(), so that the caller
> wouldn't deal with if statement.
> Patch2: Remove unnecessary if statement.
> 
> 
> Yajun Deng (2):
>   rtnetlink: use nlmsg_notify() in rtnetlink_send()
>   net/sched: Remove unnecessary if statement
> 
> [...]

Here is the summary with links:
  - [v2,1/2] rtnetlink: use nlmsg_notify() in rtnetlink_send()
    https://git.kernel.org/netdev/net-next/c/cfdf0d9ae75b
  - [v2,2/2] net/sched: Remove unnecessary if statement
    https://git.kernel.org/netdev/net-next/c/f79a3bcb1a50

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-07-16 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-15 12:12 [PATCH v2 0/2] net: Deal with if statement in rtnetlink_send() Yajun Deng
2021-07-15 12:12 ` [PATCH v2 1/2] rtnetlink: use nlmsg_notify() " Yajun Deng
2021-07-16 17:50 ` [PATCH v2 0/2] net: Deal with if statement " patchwork-bot+netdevbpf

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).