+/* Selects and returns an enabled slave from the 'enabled_slaves' list
+ * in a round-robin fashion. If the 'enabled_slaves' list is empty,
+ * returns NULL. */
+static struct bond_slave *
+get_enabled_slave(struct bond *bond)
+{
+ struct list *node;
+
+ ovs_mutex_lock(&bond->mutex);
+ if (list_is_empty(&bond->enabled_slaves)) {
+ ovs_mutex_unlock(&bond->mutex);
+ return NULL;
+ }
+
+ node = list_pop_front(&bond->enabled_slaves);
+ list_push_back(&bond->enabled_slaves, node);
+ ovs_mutex_unlock(&bond->mutex);
+
+ return CONTAINER_OF(node, struct bond_slave, list_node);
+}
+