net: core: add ignore flag to netdev_adjacent structure
Subsystems (2)
PATCH v2 9/11 net: core: add ignore flag to netdev_adjacent structure
In order to link an adjacent node, netdev_upper_dev_link() is used and in order to unlink an adjacent node, netdev_upper_dev_unlink() is used. unlink operation does not fail, but link operation can fail.
In order to exchange adjacent nodes, we should unlink an old adjacent node first. then, link a new adjacent node.
If link operation is failed, we should link an old adjacent node again. But this link operation can fail too.
It eventually breaks the adjacent link relationship.
This patch adds an ignore flag into the netdev_adjacent structure. If this flag is set, netdev_upper_dev_link() ignores an old adjacent node for a moment.
So we can skip unlink operation before link operation.
---
v1 -> v2 : this patch isn't changed
include/linux/netdevice.h | 4 + net/core/dev.c | 160 +++++++++++++++++++++++++++++++++----- 2 files changed, 144 insertions(+), 20 deletions(-)
include/linux/netdevice.h +4 -0
@@ -4319,6 +4319,10 @@ int netdev_master_upper_dev_link(struct net_device *dev, struct netlink_ext_ack *extack);void netdev_upper_dev_unlink (struct net_device *dev,struct net_device *upper_dev); +void netdev_adjacent_dev_disable (struct net_device *upper_dev, +struct net_device *lower_dev); +void netdev_adjacent_dev_enable (struct net_device *upper_dev, +struct net_device *lower_dev);void netdev_adjacent_rename_links (struct net_device *dev,char *oldname);void *netdev_lower_dev_get_private (struct net_device *dev,struct net_device *lower_dev);
net/core/dev.c +140 -20
278 lines not on this page · raw message
Signature · 1 line
2.17.1