mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
net: macvlan: add net device refcount tracker
Add net device refcount tracker to macvlan. Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
291ac68478
commit
1f4a5983d6
@ -912,7 +912,7 @@ static int macvlan_init(struct net_device *dev)
|
|||||||
port->count += 1;
|
port->count += 1;
|
||||||
|
|
||||||
/* Get macvlan's reference to lowerdev */
|
/* Get macvlan's reference to lowerdev */
|
||||||
dev_hold(lowerdev);
|
dev_hold_track(lowerdev, &vlan->dev_tracker, GFP_KERNEL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1181,7 +1181,7 @@ static void macvlan_dev_free(struct net_device *dev)
|
|||||||
struct macvlan_dev *vlan = netdev_priv(dev);
|
struct macvlan_dev *vlan = netdev_priv(dev);
|
||||||
|
|
||||||
/* Get rid of the macvlan's reference to lowerdev */
|
/* Get rid of the macvlan's reference to lowerdev */
|
||||||
dev_put(vlan->lowerdev);
|
dev_put_track(vlan->lowerdev, &vlan->dev_tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
void macvlan_common_setup(struct net_device *dev)
|
void macvlan_common_setup(struct net_device *dev)
|
||||||
|
@ -21,6 +21,7 @@ struct macvlan_dev {
|
|||||||
struct hlist_node hlist;
|
struct hlist_node hlist;
|
||||||
struct macvlan_port *port;
|
struct macvlan_port *port;
|
||||||
struct net_device *lowerdev;
|
struct net_device *lowerdev;
|
||||||
|
netdevice_tracker dev_tracker;
|
||||||
void *accel_priv;
|
void *accel_priv;
|
||||||
struct vlan_pcpu_stats __percpu *pcpu_stats;
|
struct vlan_pcpu_stats __percpu *pcpu_stats;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user