diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2017-12-05 16:17:26 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-06 14:50:13 -0500 |
commit | 9f8a739e72f1546fb0f8c518af1193522c45be12 (patch) | |
tree | e78d4c2ab7eefd36be1bb026788a1f9b6416e33b /net/dsa | |
parent | 3a9ab393287b64c96eee94001d0efed2a66f0be9 (diff) |
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 'net/dsa')
-rw-r--r-- | net/dsa/slave.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index d6e7a642493b..895db05d8c82 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -709,14 +709,12 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, struct dsa_slave_priv *p = netdev_priv(dev); struct dsa_mall_tc_entry *mall_tc_entry; __be16 protocol = cls->common.protocol; - struct net *net = dev_net(dev); struct dsa_switch *ds = dp->ds; struct net_device *to_dev; const struct tc_action *a; struct dsa_port *to_dp; int err = -EOPNOTSUPP; LIST_HEAD(actions); - int ifindex; if (!ds->ops->port_mirror_add) return err; @@ -730,8 +728,7 @@ static int dsa_slave_add_cls_matchall(struct net_device *dev, if (is_tcf_mirred_egress_mirror(a) && protocol == htons(ETH_P_ALL)) { struct dsa_mall_mirror_tc_entry *mirror; - ifindex = tcf_mirred_ifindex(a); - to_dev = __dev_get_by_index(net, ifindex); + to_dev = tcf_mirred_dev(a); if (!to_dev) return -EINVAL; |