[PATCH 4/4] net/sched: use rtnl_notify() instead of rtnetlink_send()

From: Yajun Deng
Date: Mon Jul 19 2021 - 08:48:02 EST


The rtnetlink_send() is already removed. use rtnl_notify() instead.

Signed-off-by: Yajun Deng <yajun.deng@xxxxxxxxx>
---
net/sched/act_api.c | 13 ++++++-------
net/sched/cls_api.c | 14 +++++++-------
net/sched/sch_api.c | 13 ++++++-------
3 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 998a2374f7ae..d25678b1ebec 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1349,8 +1349,8 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
nlh->nlmsg_len = skb_tail_pointer(skb) - b;
nlh->nlmsg_flags |= NLM_F_ROOT;
module_put(ops->owner);
- err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ err = rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
if (err < 0)
NL_SET_ERR_MSG(extack, "Failed to send TC action flush notification");

@@ -1419,9 +1419,8 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
return ret;
}

- ret = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
- return ret;
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
}

static int
@@ -1490,8 +1489,8 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
return -EINVAL;
}

- return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
}

static int tcf_action_add(struct net *net, struct nlattr *nla,
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index c8cb59a11098..63ca7afc472d 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -1872,8 +1872,8 @@ static int tfilter_notify(struct net *net, struct sk_buff *oskb,
if (unicast)
err = rtnl_unicast(skb, net, portid);
else
- err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ err = rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
return err;
}

@@ -1908,8 +1908,8 @@ static int tfilter_del_notify(struct net *net, struct sk_buff *oskb,
if (unicast)
err = rtnl_unicast(skb, net, portid);
else
- err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ err = rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
if (err < 0)
NL_SET_ERR_MSG(extack, "Failed to send filter delete notification");

@@ -2708,8 +2708,8 @@ static int tc_chain_notify(struct tcf_chain *chain, struct sk_buff *oskb,
if (unicast)
err = rtnl_unicast(skb, net, portid);
else
- err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- flags & NLM_F_ECHO);
+ err = rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ flags & NLM_F_ECHO, GFP_KERNEL);

return err;
}
@@ -2736,7 +2736,7 @@ static int tc_chain_notify_delete(const struct tcf_proto_ops *tmplt_ops,
if (unicast)
return rtnl_unicast(skb, net, portid);

- return rtnetlink_send(skb, net, portid, RTNLGRP_TC, flags & NLM_F_ECHO);
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC, flags & NLM_F_ECHO, GFP_KERNEL);
}

static int tc_chain_tmplt_add(struct tcf_chain *chain, struct net *net,
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 5e90e9b160e3..01858fd08b2a 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -987,8 +987,8 @@ static int qdisc_notify(struct net *net, struct sk_buff *oskb,
}

if (skb->len)
- return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);

err_out:
kfree_skb(skb);
@@ -1855,8 +1855,8 @@ static int tclass_notify(struct net *net, struct sk_buff *oskb,
return -EINVAL;
}

- return rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
}

static int tclass_del_notify(struct net *net,
@@ -1888,9 +1888,8 @@ static int tclass_del_notify(struct net *net,
return err;
}

- err = rtnetlink_send(skb, net, portid, RTNLGRP_TC,
- n->nlmsg_flags & NLM_F_ECHO);
- return err;
+ return rtnl_notify(skb, net, portid, RTNLGRP_TC,
+ nlmsg_report(n), GFP_KERNEL);
}

#ifdef CONFIG_NET_CLS
--
2.32.0