Commit 93a7e7e8 authored by David Ahern's avatar David Ahern Committed by David S. Miller

net: Remove the now unused vrf_ptr

Signed-off-by: default avatarDavid Ahern <dsa@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8e1ed705
...@@ -396,18 +396,15 @@ static void __vrf_insert_slave(struct slave_queue *queue, struct slave *slave) ...@@ -396,18 +396,15 @@ static void __vrf_insert_slave(struct slave_queue *queue, struct slave *slave)
static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
{ {
struct net_vrf_dev *vrf_ptr = kmalloc(sizeof(*vrf_ptr), GFP_KERNEL);
struct slave *slave = kzalloc(sizeof(*slave), GFP_KERNEL); struct slave *slave = kzalloc(sizeof(*slave), GFP_KERNEL);
struct net_vrf *vrf = netdev_priv(dev); struct net_vrf *vrf = netdev_priv(dev);
struct slave_queue *queue = &vrf->queue; struct slave_queue *queue = &vrf->queue;
int ret = -ENOMEM; int ret = -ENOMEM;
if (!slave || !vrf_ptr) if (!slave)
goto out_fail; goto out_fail;
slave->dev = port_dev; slave->dev = port_dev;
vrf_ptr->ifindex = dev->ifindex;
vrf_ptr->tb_id = vrf->tb_id;
/* register the packet handler for slave ports */ /* register the packet handler for slave ports */
ret = netdev_rx_handler_register(port_dev, vrf_handle_frame, dev); ret = netdev_rx_handler_register(port_dev, vrf_handle_frame, dev);
...@@ -424,7 +421,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -424,7 +421,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
port_dev->flags |= IFF_SLAVE; port_dev->flags |= IFF_SLAVE;
__vrf_insert_slave(queue, slave); __vrf_insert_slave(queue, slave);
rcu_assign_pointer(port_dev->vrf_ptr, vrf_ptr);
cycle_netdev(port_dev); cycle_netdev(port_dev);
return 0; return 0;
...@@ -432,7 +428,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -432,7 +428,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
out_unregister: out_unregister:
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
out_fail: out_fail:
kfree(vrf_ptr);
kfree(slave); kfree(slave);
return ret; return ret;
} }
...@@ -448,21 +443,15 @@ static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -448,21 +443,15 @@ static int vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
/* inverse of do_vrf_add_slave */ /* inverse of do_vrf_add_slave */
static int do_vrf_del_slave(struct net_device *dev, struct net_device *port_dev) static int do_vrf_del_slave(struct net_device *dev, struct net_device *port_dev)
{ {
struct net_vrf_dev *vrf_ptr = rtnl_dereference(port_dev->vrf_ptr);
struct net_vrf *vrf = netdev_priv(dev); struct net_vrf *vrf = netdev_priv(dev);
struct slave_queue *queue = &vrf->queue; struct slave_queue *queue = &vrf->queue;
struct slave *slave; struct slave *slave;
RCU_INIT_POINTER(port_dev->vrf_ptr, NULL);
netdev_upper_dev_unlink(port_dev, dev); netdev_upper_dev_unlink(port_dev, dev);
port_dev->flags &= ~IFF_SLAVE; port_dev->flags &= ~IFF_SLAVE;
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
/* after netdev_rx_handler_unregister for synchronize_rcu */
kfree(vrf_ptr);
cycle_netdev(port_dev); cycle_netdev(port_dev);
slave = __vrf_find_slave_dev(queue, port_dev); slave = __vrf_find_slave_dev(queue, port_dev);
...@@ -601,10 +590,6 @@ static int vrf_validate(struct nlattr *tb[], struct nlattr *data[]) ...@@ -601,10 +590,6 @@ static int vrf_validate(struct nlattr *tb[], struct nlattr *data[])
static void vrf_dellink(struct net_device *dev, struct list_head *head) static void vrf_dellink(struct net_device *dev, struct list_head *head)
{ {
struct net_vrf_dev *vrf_ptr = rtnl_dereference(dev->vrf_ptr);
RCU_INIT_POINTER(dev->vrf_ptr, NULL);
kfree_rcu(vrf_ptr, rcu);
unregister_netdevice_queue(dev, head); unregister_netdevice_queue(dev, head);
} }
...@@ -612,7 +597,6 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, ...@@ -612,7 +597,6 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[]) struct nlattr *tb[], struct nlattr *data[])
{ {
struct net_vrf *vrf = netdev_priv(dev); struct net_vrf *vrf = netdev_priv(dev);
struct net_vrf_dev *vrf_ptr;
int err; int err;
if (!data || !data[IFLA_VRF_TABLE]) if (!data || !data[IFLA_VRF_TABLE])
...@@ -622,24 +606,13 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev, ...@@ -622,24 +606,13 @@ static int vrf_newlink(struct net *src_net, struct net_device *dev,
dev->priv_flags |= IFF_L3MDEV_MASTER; dev->priv_flags |= IFF_L3MDEV_MASTER;
err = -ENOMEM;
vrf_ptr = kmalloc(sizeof(*dev->vrf_ptr), GFP_KERNEL);
if (!vrf_ptr)
goto out_fail;
vrf_ptr->ifindex = dev->ifindex;
vrf_ptr->tb_id = vrf->tb_id;
err = register_netdevice(dev); err = register_netdevice(dev);
if (err < 0) if (err < 0)
goto out_fail; goto out_fail;
rcu_assign_pointer(dev->vrf_ptr, vrf_ptr);
return 0; return 0;
out_fail: out_fail:
kfree(vrf_ptr);
free_netdev(dev); free_netdev(dev);
return err; return err;
} }
...@@ -683,10 +656,9 @@ static int vrf_device_event(struct notifier_block *unused, ...@@ -683,10 +656,9 @@ static int vrf_device_event(struct notifier_block *unused,
/* only care about unregister events to drop slave references */ /* only care about unregister events to drop slave references */
if (event == NETDEV_UNREGISTER) { if (event == NETDEV_UNREGISTER) {
struct net_vrf_dev *vrf_ptr = rtnl_dereference(dev->vrf_ptr);
struct net_device *vrf_dev; struct net_device *vrf_dev;
if (!vrf_ptr || netif_is_l3_master(dev)) if (netif_is_l3_master(dev))
goto out; goto out;
vrf_dev = netdev_master_upper_dev_get(dev); vrf_dev = netdev_master_upper_dev_get(dev);
......
...@@ -1427,7 +1427,6 @@ enum netdev_priv_flags { ...@@ -1427,7 +1427,6 @@ enum netdev_priv_flags {
* @dn_ptr: DECnet specific data * @dn_ptr: DECnet specific data
* @ip6_ptr: IPv6 specific data * @ip6_ptr: IPv6 specific data
* @ax25_ptr: AX.25 specific data * @ax25_ptr: AX.25 specific data
* @vrf_ptr: VRF specific data
* @ieee80211_ptr: IEEE 802.11 specific data, assign before registering * @ieee80211_ptr: IEEE 802.11 specific data, assign before registering
* *
* @last_rx: Time of last Rx * @last_rx: Time of last Rx
...@@ -1649,7 +1648,6 @@ struct net_device { ...@@ -1649,7 +1648,6 @@ struct net_device {
struct dn_dev __rcu *dn_ptr; struct dn_dev __rcu *dn_ptr;
struct inet6_dev __rcu *ip6_ptr; struct inet6_dev __rcu *ip6_ptr;
void *ax25_ptr; void *ax25_ptr;
struct net_vrf_dev __rcu *vrf_ptr;
struct wireless_dev *ieee80211_ptr; struct wireless_dev *ieee80211_ptr;
struct wpan_dev *ieee802154_ptr; struct wpan_dev *ieee802154_ptr;
#if IS_ENABLED(CONFIG_MPLS_ROUTING) #if IS_ENABLED(CONFIG_MPLS_ROUTING)
......
...@@ -11,12 +11,6 @@ ...@@ -11,12 +11,6 @@
#ifndef __LINUX_NET_VRF_H #ifndef __LINUX_NET_VRF_H
#define __LINUX_NET_VRF_H #define __LINUX_NET_VRF_H
struct net_vrf_dev {
struct rcu_head rcu;
int ifindex; /* ifindex of master dev */
u32 tb_id; /* table id for VRF */
};
struct slave { struct slave {
struct list_head list; struct list_head list;
struct net_device *dev; struct net_device *dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment