diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2017-12-06 01:17:26 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-06 20:50:13 +0100 |
commit | 9f8a739e72f1546fb0f8c518af1193522c45be12 (patch) | |
tree | e78d4c2ab7eefd36be1bb026788a1f9b6416e33b /include/net/tc_act | |
parent | Merge branch 'ipv6-add-ip6erspan-collect_md-mode' (diff) | |
download | linux-9f8a739e72f1546fb0f8c518af1193522c45be12.tar.xz linux-9f8a739e72f1546fb0f8c518af1193522c45be12.zip |
act_mirred: get rid of tcfm_ifindex from struct tcf_mirred
tcfm_dev always points to the correct netdev and we already
hold a refcnt, so no need to use tcfm_ifindex to lookup again.
If we would support moving target netdev across netns, using
pointer would be better than ifindex.
This also fixes dumping obsolete ifindex, now after the
target device is gone we just dump 0 as ifindex.
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tc_act')
-rw-r--r-- | include/net/tc_act/tc_mirred.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/include/net/tc_act/tc_mirred.h b/include/net/tc_act/tc_mirred.h index 21d253c9a8c6..a2e9cbca5c9e 100644 --- a/include/net/tc_act/tc_mirred.h +++ b/include/net/tc_act/tc_mirred.h @@ -8,10 +8,8 @@ struct tcf_mirred { struct tc_action common; int tcfm_eaction; - int tcfm_ifindex; bool tcfm_mac_header_xmit; struct net_device __rcu *tcfm_dev; - struct net *net; struct list_head tcfm_list; }; #define to_mirred(a) ((struct tcf_mirred *)a) @@ -34,9 +32,9 @@ static inline bool is_tcf_mirred_egress_mirror(const struct tc_action *a) return false; } -static inline int tcf_mirred_ifindex(const struct tc_action *a) +static inline struct net_device *tcf_mirred_dev(const struct tc_action *a) { - return to_mirred(a)->tcfm_ifindex; + return rtnl_dereference(to_mirred(a)->tcfm_dev); } #endif /* __NET_TC_MIR_H */ |