/**
* mesh_path_lookup_by_idx - look up a path in the mesh path table by its index
* @idx: index
- * @dev: local interface
+ * @dev: local interface, or NULL for all entries
*
* Returns: pointer to the mesh path structure, or NULL if not found.
*
int i;
int j = 0;
- for_each_mesh_entry(mesh_paths, p, node, i)
+ for_each_mesh_entry(mesh_paths, p, node, i) {
+ if (dev && node->mpath->dev != dev)
+ continue;
if (j++ == idx) {
if (MPATH_EXPIRED(node->mpath)) {
spin_lock_bh(&node->mpath->state_lock);
}
return node->mpath;
}
+ }
return NULL;
}
int i = 0;
list_for_each_entry_rcu(sta, &local->sta_list, list) {
+ if (dev && dev != sta->sdata->dev)
+ continue;
if (i < idx) {
++i;
continue;
- } else if (!dev || dev == sta->sdata->dev) {
- return sta;
}
+ return sta;
}
return NULL;