diff options
author | Vlad Buslov <vladbu@mellanox.com> | 2019-09-13 18:28:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-09-16 10:18:03 +0300 |
commit | 470d5060e6b3b8fae47d944601855e9ece7a2470 (patch) | |
tree | b91a0dfb567b5ed2878d5543014a65196f7fe7ae /net/sched/cls_api.c | |
parent | 4a5da47d5cb6aba3c26a5cc0dddfb2d577e851e9 (diff) | |
download | linux-470d5060e6b3b8fae47d944601855e9ece7a2470.tar.xz |
net: sched: use get_dev() action API in flow_action infra
When filling in hardware intermediate representation tc_setup_flow_action()
directly obtains, checks and takes reference to dev used by mirred action,
instead of using act->ops->get_dev() API created specifically for this
purpose. In order to remove code duplication, refactor flow_action infra to
use action API when obtaining mirred action target dev. Extend get_dev()
with additional argument that is used to provide dev destructor to the
user.
Fixes: 5a6ff4b13d59 ("net: sched: take reference to action dev before calling offloads")
Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/cls_api.c')
-rw-r--r-- | net/sched/cls_api.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 60d44b14750a..32577c248968 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -3288,22 +3288,15 @@ void tc_cleanup_flow_action(struct flow_action *flow_action) } EXPORT_SYMBOL(tc_cleanup_flow_action); -static void tcf_mirred_put_dev(void *priv) -{ - struct net_device *dev = priv; - - dev_put(dev); -} - static void tcf_mirred_get_dev(struct flow_action_entry *entry, const struct tc_action *act) { - entry->dev = tcf_mirred_dev(act); +#ifdef CONFIG_NET_CLS_ACT + entry->dev = act->ops->get_dev(act, &entry->destructor); if (!entry->dev) return; - dev_hold(entry->dev); - entry->destructor = tcf_mirred_put_dev; entry->destructor_priv = entry->dev; +#endif } static void tcf_tunnel_encap_put_tunnel(void *priv) |