Changeset View
Changeset View
Standalone View
Standalone View
sys/net/if.c
Show First 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | |||||
struct ifnet * | struct ifnet * | ||||
ifnet_byindex(u_short idx) | ifnet_byindex(u_short idx) | ||||
{ | { | ||||
if (__predict_false(idx > V_if_index)) | if (__predict_false(idx > V_if_index)) | ||||
return (NULL); | return (NULL); | ||||
return (V_ifindex_table[idx]); | return (ck_pr_load_ptr(&V_ifindex_table[idx])); | ||||
} | } | ||||
struct ifnet * | struct ifnet * | ||||
ifnet_byindex_ref(u_short idx) | ifnet_byindex_ref(u_short idx) | ||||
{ | { | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
NET_EPOCH_ASSERT(); | NET_EPOCH_ASSERT(); | ||||
Show All 36 Lines | |||||
} | } | ||||
static void | static void | ||||
ifindex_free(u_short idx) | ifindex_free(u_short idx) | ||||
{ | { | ||||
IFNET_WLOCK_ASSERT(); | IFNET_WLOCK_ASSERT(); | ||||
V_ifindex_table[idx] = NULL; | ck_pr_store_ptr(&V_ifindex_table[idx], NULL); | ||||
while (V_if_index > 0 && | while (V_if_index > 0 && | ||||
V_ifindex_table[V_if_index] == NULL) | V_ifindex_table[V_if_index] == NULL) | ||||
V_if_index--; | V_if_index--; | ||||
} | } | ||||
static void | static void | ||||
ifnet_setbyindex(u_short idx, struct ifnet *ifp) | ifnet_setbyindex(u_short idx, struct ifnet *ifp) | ||||
{ | { | ||||
ifp->if_index = idx; | ifp->if_index = idx; | ||||
bz: Contrary to your description, why do you need to add this suddenly here? | |||||
Done Inline ActionsCan be removed, but it still removed when all index allocation bits are merged into one in D33262 glebius: Can be removed, but it still removed when all index allocation bits are merged into one in… | |||||
V_ifindex_table[idx] = ifp; | ck_pr_store_ptr(&V_ifindex_table[idx], ifp); | ||||
} | } | ||||
struct ifaddr * | struct ifaddr * | ||||
ifaddr_byindex(u_short idx) | ifaddr_byindex(u_short idx) | ||||
{ | { | ||||
struct ifnet *ifp; | struct ifnet *ifp; | ||||
struct ifaddr *ifa = NULL; | struct ifaddr *ifa = NULL; | ||||
▲ Show 20 Lines • Show All 4,249 Lines • Show Last 20 Lines |
Contrary to your description, why do you need to add this suddenly here?