diff options
| author | Vlad Buslov <[email protected]> | 2019-09-13 15:28:41 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2019-09-16 07:18:03 +0000 |
| commit | 470d5060e6b3b8fae47d944601855e9ece7a2470 (patch) | |
| tree | b91a0dfb567b5ed2878d5543014a65196f7fe7ae /net/sched/cls_api.c | |
| parent | net: sched: take reference to psample group in flow_action infra (diff) | |
| download | kernel-470d5060e6b3b8fae47d944601855e9ece7a2470.tar.gz kernel-470d5060e6b3b8fae47d944601855e9ece7a2470.zip | |
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 <[email protected]>
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
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) |
