|
@@ -4468,6 +4468,31 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev)
|
|
|
}
|
|
|
EXPORT_SYMBOL(netdev_master_upper_dev_get);
|
|
|
|
|
|
+/* netdev_upper_get_next_dev_rcu - Get the next dev from upper list
|
|
|
+ * @dev: device
|
|
|
+ * @iter: list_head ** of the current position
|
|
|
+ *
|
|
|
+ * Gets the next device from the dev's upper list, starting from iter
|
|
|
+ * position. The caller must hold RCU read lock.
|
|
|
+ */
|
|
|
+struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
|
|
|
+ struct list_head **iter)
|
|
|
+{
|
|
|
+ struct netdev_adjacent *upper;
|
|
|
+
|
|
|
+ WARN_ON_ONCE(!rcu_read_lock_held());
|
|
|
+
|
|
|
+ upper = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
|
|
|
+
|
|
|
+ if (&upper->list == &dev->upper_dev_list)
|
|
|
+ return NULL;
|
|
|
+
|
|
|
+ *iter = &upper->list;
|
|
|
+
|
|
|
+ return upper->dev;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(netdev_upper_get_next_dev_rcu);
|
|
|
+
|
|
|
/**
|
|
|
* netdev_master_upper_dev_get_rcu - Get master upper device
|
|
|
* @dev: device
|