summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorHadar Hen Zion <hadarh@mellanox.com>2016-12-01 13:06:36 +0100
committerDavid S. Miller <davem@davemloft.net>2016-12-02 19:28:36 +0100
commit255cb30425c0ced57d6d85f3e7cddb99b9576046 (patch)
tree757ac8b0039f730754d70d633eafe1fdd3bb87e5 /net/sched
parentnet/sched: cls_flower: Provide a filter to replace/destroy hardware filter fu... (diff)
downloadlinux-255cb30425c0ced57d6d85f3e7cddb99b9576046.tar.xz
linux-255cb30425c0ced57d6d85f3e7cddb99b9576046.zip
net/sched: act_mirred: Add new tc_action_ops get_dev()
Adding support to a new tc_action_ops. get_dev is a general option which allows to get the underline device when trying to offload a tc rule. In case of mirred action the returned device is the mirred (egress) device. Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/act_mirred.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 1af7baa732a3..bb09ba3ca5c2 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -315,6 +315,17 @@ 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)
+{
+ int ifindex = tcf_mirred_ifindex(a);
+
+ *mirred_dev = __dev_get_by_index(net, ifindex);
+ if (!mirred_dev)
+ return -EINVAL;
+ return 0;
+}
+
static struct tc_action_ops act_mirred_ops = {
.kind = "mirred",
.type = TCA_ACT_MIRRED,
@@ -327,6 +338,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,
};
static __net_init int mirred_init_net(struct net *net)