summaryrefslogtreecommitdiff
path: root/net/sched/act_mirred.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-10-11 20:15:43 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-11 20:15:43 -0700
commitb274f6db148a87055052aa8fd4fdd4a0b65b8bd5 (patch)
treee19b142c76c8b89498b1040e76f24f75bffa288d /net/sched/act_mirred.c
parent7c6a86b4cd1b0134a4768505ce10e4ef3b9b0213 (diff)
parent7578d7b45ed870b13a8ace57e32feaed623c2a94 (diff)
Merge branch 'net-sched-get-rid-of-cls_flower-egress_dev'
Jiri Pirko says: ==================== net: sched: get rid of cls_flower->egress_dev Introduction of cls_flower->egress_dev was a workaround. Turned out to be a bit ugly hack. So replace it with more generic and reusable infrastructure. This is a dependency of shared block introduction that will be send as a follow-up patchsets group. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_mirred.c')
-rw-r--r--net/sched/act_mirred.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 416627c66f08..8b3e59388480 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -140,6 +140,7 @@ static int tcf_mirred_init(struct net *net, struct nlattr *nla,
m->tcfm_eaction = parm->eaction;
if (dev != NULL) {
m->tcfm_ifindex = parm->ifindex;
+ m->net = net;
if (ret != ACT_P_CREATED)
dev_put(rcu_dereference_protected(m->tcfm_dev, 1));
dev_hold(dev);
@@ -313,15 +314,11 @@ static struct notifier_block mirred_device_notifier = {
.notifier_call = mirred_device_event,
};
-static int tcf_mirred_device(const struct tc_action *a, struct net *net,
- struct net_device **mirred_dev)
+static struct net_device *tcf_mirred_get_dev(const struct tc_action *a)
{
- int ifindex = tcf_mirred_ifindex(a);
+ struct tcf_mirred *m = to_mirred(a);
- *mirred_dev = __dev_get_by_index(net, ifindex);
- if (!*mirred_dev)
- return -EINVAL;
- return 0;
+ return __dev_get_by_index(m->net, m->tcfm_ifindex);
}
static struct tc_action_ops act_mirred_ops = {
@@ -336,7 +333,7 @@ static struct tc_action_ops act_mirred_ops = {
.walk = tcf_mirred_walker,
.lookup = tcf_mirred_search,
.size = sizeof(struct tcf_mirred),
- .get_dev = tcf_mirred_device,
+ .get_dev = tcf_mirred_get_dev,
};
static __net_init int mirred_init_net(struct net *net)