mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 18:06:59 +07:00
net_sched: remove unnecessary ops->delete()
All ops->delete() wants is getting the tn->idrinfo, but we already
have tc_action before calling ops->delete(), and tc_action has
a pointer ->idrinfo.
More importantly, each type of action does the same thing, that is,
just calling tcf_idr_delete_index().
So it can be just removed.
Fixes: b409074e66
("net: sched: add 'delete' function to action ops")
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
edfaf94fa7
commit
97a3f84f2c
@ -102,7 +102,6 @@ struct tc_action_ops {
|
||||
size_t (*get_fill_size)(const struct tc_action *act);
|
||||
struct net_device *(*get_dev)(const struct tc_action *a);
|
||||
void (*put_dev)(struct net_device *dev);
|
||||
int (*delete)(struct net *net, u32 index);
|
||||
};
|
||||
|
||||
struct tc_action_net {
|
||||
@ -158,7 +157,6 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a);
|
||||
void tcf_idr_cleanup(struct tc_action_net *tn, u32 index);
|
||||
int tcf_idr_check_alloc(struct tc_action_net *tn, u32 *index,
|
||||
struct tc_action **a, int bind);
|
||||
int tcf_idr_delete_index(struct tc_action_net *tn, u32 index);
|
||||
int __tcf_idr_release(struct tc_action *a, bool bind, bool strict);
|
||||
|
||||
static inline int tcf_idr_release(struct tc_action *a, bool bind)
|
||||
|
@ -337,9 +337,8 @@ bool tcf_idr_check(struct tc_action_net *tn, u32 index, struct tc_action **a,
|
||||
}
|
||||
EXPORT_SYMBOL(tcf_idr_check);
|
||||
|
||||
int tcf_idr_delete_index(struct tc_action_net *tn, u32 index)
|
||||
static int tcf_idr_delete_index(struct tcf_idrinfo *idrinfo, u32 index)
|
||||
{
|
||||
struct tcf_idrinfo *idrinfo = tn->idrinfo;
|
||||
struct tc_action *p;
|
||||
int ret = 0;
|
||||
|
||||
@ -370,7 +369,6 @@ int tcf_idr_delete_index(struct tc_action_net *tn, u32 index)
|
||||
spin_unlock(&idrinfo->lock);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(tcf_idr_delete_index);
|
||||
|
||||
int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
|
||||
struct tc_action **a, const struct tc_action_ops *ops,
|
||||
@ -1182,24 +1180,25 @@ static int tca_action_flush(struct net *net, struct nlattr *nla,
|
||||
static int tcf_action_delete(struct net *net, struct tc_action *actions[],
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
u32 act_index;
|
||||
int ret, i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TCA_ACT_MAX_PRIO && actions[i]; i++) {
|
||||
struct tc_action *a = actions[i];
|
||||
const struct tc_action_ops *ops = a->ops;
|
||||
|
||||
/* Actions can be deleted concurrently so we must save their
|
||||
* type and id to search again after reference is released.
|
||||
*/
|
||||
act_index = a->tcfa_index;
|
||||
struct tcf_idrinfo *idrinfo = a->idrinfo;
|
||||
u32 act_index = a->tcfa_index;
|
||||
|
||||
if (tcf_action_put(a)) {
|
||||
/* last reference, action was deleted concurrently */
|
||||
module_put(ops->owner);
|
||||
} else {
|
||||
int ret;
|
||||
|
||||
/* now do the delete */
|
||||
ret = ops->delete(net, act_index);
|
||||
ret = tcf_idr_delete_index(idrinfo, act_index);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
@ -395,13 +395,6 @@ static int tcf_bpf_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_bpf_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, bpf_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_bpf_ops __read_mostly = {
|
||||
.kind = "bpf",
|
||||
.type = TCA_ACT_BPF,
|
||||
@ -412,7 +405,6 @@ static struct tc_action_ops act_bpf_ops __read_mostly = {
|
||||
.init = tcf_bpf_init,
|
||||
.walk = tcf_bpf_walker,
|
||||
.lookup = tcf_bpf_search,
|
||||
.delete = tcf_bpf_delete,
|
||||
.size = sizeof(struct tcf_bpf),
|
||||
};
|
||||
|
||||
|
@ -198,13 +198,6 @@ static int tcf_connmark_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_connmark_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, connmark_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_connmark_ops = {
|
||||
.kind = "connmark",
|
||||
.type = TCA_ACT_CONNMARK,
|
||||
@ -214,7 +207,6 @@ static struct tc_action_ops act_connmark_ops = {
|
||||
.init = tcf_connmark_init,
|
||||
.walk = tcf_connmark_walker,
|
||||
.lookup = tcf_connmark_search,
|
||||
.delete = tcf_connmark_delete,
|
||||
.size = sizeof(struct tcf_connmark_info),
|
||||
};
|
||||
|
||||
|
@ -659,13 +659,6 @@ static size_t tcf_csum_get_fill_size(const struct tc_action *act)
|
||||
return nla_total_size(sizeof(struct tc_csum));
|
||||
}
|
||||
|
||||
static int tcf_csum_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, csum_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_csum_ops = {
|
||||
.kind = "csum",
|
||||
.type = TCA_ACT_CSUM,
|
||||
@ -677,7 +670,6 @@ static struct tc_action_ops act_csum_ops = {
|
||||
.walk = tcf_csum_walker,
|
||||
.lookup = tcf_csum_search,
|
||||
.get_fill_size = tcf_csum_get_fill_size,
|
||||
.delete = tcf_csum_delete,
|
||||
.size = sizeof(struct tcf_csum),
|
||||
};
|
||||
|
||||
|
@ -243,13 +243,6 @@ static size_t tcf_gact_get_fill_size(const struct tc_action *act)
|
||||
return sz;
|
||||
}
|
||||
|
||||
static int tcf_gact_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, gact_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_gact_ops = {
|
||||
.kind = "gact",
|
||||
.type = TCA_ACT_GACT,
|
||||
@ -261,7 +254,6 @@ static struct tc_action_ops act_gact_ops = {
|
||||
.walk = tcf_gact_walker,
|
||||
.lookup = tcf_gact_search,
|
||||
.get_fill_size = tcf_gact_get_fill_size,
|
||||
.delete = tcf_gact_delete,
|
||||
.size = sizeof(struct tcf_gact),
|
||||
};
|
||||
|
||||
|
@ -853,13 +853,6 @@ static int tcf_ife_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_ife_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, ife_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_ife_ops = {
|
||||
.kind = "ife",
|
||||
.type = TCA_ACT_IFE,
|
||||
@ -870,7 +863,6 @@ static struct tc_action_ops act_ife_ops = {
|
||||
.init = tcf_ife_init,
|
||||
.walk = tcf_ife_walker,
|
||||
.lookup = tcf_ife_search,
|
||||
.delete = tcf_ife_delete,
|
||||
.size = sizeof(struct tcf_ife_info),
|
||||
};
|
||||
|
||||
|
@ -337,13 +337,6 @@ static int tcf_ipt_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_ipt_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, ipt_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_ipt_ops = {
|
||||
.kind = "ipt",
|
||||
.type = TCA_ACT_IPT,
|
||||
@ -354,7 +347,6 @@ static struct tc_action_ops act_ipt_ops = {
|
||||
.init = tcf_ipt_init,
|
||||
.walk = tcf_ipt_walker,
|
||||
.lookup = tcf_ipt_search,
|
||||
.delete = tcf_ipt_delete,
|
||||
.size = sizeof(struct tcf_ipt),
|
||||
};
|
||||
|
||||
@ -395,13 +387,6 @@ static int tcf_xt_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_xt_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, xt_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_xt_ops = {
|
||||
.kind = "xt",
|
||||
.type = TCA_ACT_XT,
|
||||
@ -412,7 +397,6 @@ static struct tc_action_ops act_xt_ops = {
|
||||
.init = tcf_xt_init,
|
||||
.walk = tcf_xt_walker,
|
||||
.lookup = tcf_xt_search,
|
||||
.delete = tcf_xt_delete,
|
||||
.size = sizeof(struct tcf_ipt),
|
||||
};
|
||||
|
||||
|
@ -395,13 +395,6 @@ static void tcf_mirred_put_dev(struct net_device *dev)
|
||||
dev_put(dev);
|
||||
}
|
||||
|
||||
static int tcf_mirred_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, mirred_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_mirred_ops = {
|
||||
.kind = "mirred",
|
||||
.type = TCA_ACT_MIRRED,
|
||||
@ -416,7 +409,6 @@ static struct tc_action_ops act_mirred_ops = {
|
||||
.size = sizeof(struct tcf_mirred),
|
||||
.get_dev = tcf_mirred_get_dev,
|
||||
.put_dev = tcf_mirred_put_dev,
|
||||
.delete = tcf_mirred_delete,
|
||||
};
|
||||
|
||||
static __net_init int mirred_init_net(struct net *net)
|
||||
|
@ -300,13 +300,6 @@ static int tcf_nat_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_nat_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, nat_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_nat_ops = {
|
||||
.kind = "nat",
|
||||
.type = TCA_ACT_NAT,
|
||||
@ -316,7 +309,6 @@ static struct tc_action_ops act_nat_ops = {
|
||||
.init = tcf_nat_init,
|
||||
.walk = tcf_nat_walker,
|
||||
.lookup = tcf_nat_search,
|
||||
.delete = tcf_nat_delete,
|
||||
.size = sizeof(struct tcf_nat),
|
||||
};
|
||||
|
||||
|
@ -460,13 +460,6 @@ static int tcf_pedit_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_pedit_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, pedit_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_pedit_ops = {
|
||||
.kind = "pedit",
|
||||
.type = TCA_ACT_PEDIT,
|
||||
@ -477,7 +470,6 @@ static struct tc_action_ops act_pedit_ops = {
|
||||
.init = tcf_pedit_init,
|
||||
.walk = tcf_pedit_walker,
|
||||
.lookup = tcf_pedit_search,
|
||||
.delete = tcf_pedit_delete,
|
||||
.size = sizeof(struct tcf_pedit),
|
||||
};
|
||||
|
||||
|
@ -320,13 +320,6 @@ static int tcf_police_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_police_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, police_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
MODULE_AUTHOR("Alexey Kuznetsov");
|
||||
MODULE_DESCRIPTION("Policing actions");
|
||||
MODULE_LICENSE("GPL");
|
||||
@ -340,7 +333,6 @@ static struct tc_action_ops act_police_ops = {
|
||||
.init = tcf_police_init,
|
||||
.walk = tcf_police_walker,
|
||||
.lookup = tcf_police_search,
|
||||
.delete = tcf_police_delete,
|
||||
.size = sizeof(struct tcf_police),
|
||||
};
|
||||
|
||||
|
@ -232,13 +232,6 @@ static int tcf_sample_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_sample_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, sample_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_sample_ops = {
|
||||
.kind = "sample",
|
||||
.type = TCA_ACT_SAMPLE,
|
||||
@ -249,7 +242,6 @@ static struct tc_action_ops act_sample_ops = {
|
||||
.cleanup = tcf_sample_cleanup,
|
||||
.walk = tcf_sample_walker,
|
||||
.lookup = tcf_sample_search,
|
||||
.delete = tcf_sample_delete,
|
||||
.size = sizeof(struct tcf_sample),
|
||||
};
|
||||
|
||||
|
@ -196,13 +196,6 @@ static int tcf_simp_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_simp_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, simp_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_simp_ops = {
|
||||
.kind = "simple",
|
||||
.type = TCA_ACT_SIMP,
|
||||
@ -213,7 +206,6 @@ static struct tc_action_ops act_simp_ops = {
|
||||
.init = tcf_simp_init,
|
||||
.walk = tcf_simp_walker,
|
||||
.lookup = tcf_simp_search,
|
||||
.delete = tcf_simp_delete,
|
||||
.size = sizeof(struct tcf_defact),
|
||||
};
|
||||
|
||||
|
@ -299,13 +299,6 @@ static int tcf_skbedit_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_skbedit_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, skbedit_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_skbedit_ops = {
|
||||
.kind = "skbedit",
|
||||
.type = TCA_ACT_SKBEDIT,
|
||||
@ -316,7 +309,6 @@ static struct tc_action_ops act_skbedit_ops = {
|
||||
.cleanup = tcf_skbedit_cleanup,
|
||||
.walk = tcf_skbedit_walker,
|
||||
.lookup = tcf_skbedit_search,
|
||||
.delete = tcf_skbedit_delete,
|
||||
.size = sizeof(struct tcf_skbedit),
|
||||
};
|
||||
|
||||
|
@ -259,13 +259,6 @@ static int tcf_skbmod_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_skbmod_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, skbmod_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_skbmod_ops = {
|
||||
.kind = "skbmod",
|
||||
.type = TCA_ACT_SKBMOD,
|
||||
@ -276,7 +269,6 @@ static struct tc_action_ops act_skbmod_ops = {
|
||||
.cleanup = tcf_skbmod_cleanup,
|
||||
.walk = tcf_skbmod_walker,
|
||||
.lookup = tcf_skbmod_search,
|
||||
.delete = tcf_skbmod_delete,
|
||||
.size = sizeof(struct tcf_skbmod),
|
||||
};
|
||||
|
||||
|
@ -548,13 +548,6 @@ static int tunnel_key_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tunnel_key_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, tunnel_key_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_tunnel_key_ops = {
|
||||
.kind = "tunnel_key",
|
||||
.type = TCA_ACT_TUNNEL_KEY,
|
||||
@ -565,7 +558,6 @@ static struct tc_action_ops act_tunnel_key_ops = {
|
||||
.cleanup = tunnel_key_release,
|
||||
.walk = tunnel_key_walker,
|
||||
.lookup = tunnel_key_search,
|
||||
.delete = tunnel_key_delete,
|
||||
.size = sizeof(struct tcf_tunnel_key),
|
||||
};
|
||||
|
||||
|
@ -296,13 +296,6 @@ static int tcf_vlan_search(struct net *net, struct tc_action **a, u32 index,
|
||||
return tcf_idr_search(tn, a, index);
|
||||
}
|
||||
|
||||
static int tcf_vlan_delete(struct net *net, u32 index)
|
||||
{
|
||||
struct tc_action_net *tn = net_generic(net, vlan_net_id);
|
||||
|
||||
return tcf_idr_delete_index(tn, index);
|
||||
}
|
||||
|
||||
static struct tc_action_ops act_vlan_ops = {
|
||||
.kind = "vlan",
|
||||
.type = TCA_ACT_VLAN,
|
||||
@ -313,7 +306,6 @@ static struct tc_action_ops act_vlan_ops = {
|
||||
.cleanup = tcf_vlan_cleanup,
|
||||
.walk = tcf_vlan_walker,
|
||||
.lookup = tcf_vlan_search,
|
||||
.delete = tcf_vlan_delete,
|
||||
.size = sizeof(struct tcf_vlan),
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user