mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
ifnet: make if_alloc_domain() never fail
The last consumer of if_com_alloc() is firewire. It never fails to allocate. Most likely the if_com_alloc() KPI will go away together with if_fwip(), less likely new consumers of if_com_alloc() will be added, but they would need to follow the no fail KPI.
This commit is contained in:
parent
1e3ca25d92
commit
4787572d05
22
sys/net/if.c
22
sys/net/if.c
@ -406,7 +406,7 @@ ifindex_alloc(void **old)
|
||||
}
|
||||
|
||||
static void
|
||||
ifindex_free_locked(u_short idx)
|
||||
ifindex_free(u_short idx)
|
||||
{
|
||||
|
||||
IFNET_WLOCK_ASSERT();
|
||||
@ -417,15 +417,6 @@ ifindex_free_locked(u_short idx)
|
||||
V_if_index--;
|
||||
}
|
||||
|
||||
static void
|
||||
ifindex_free(u_short idx)
|
||||
{
|
||||
|
||||
IFNET_WLOCK();
|
||||
ifindex_free_locked(idx);
|
||||
IFNET_WUNLOCK();
|
||||
}
|
||||
|
||||
static void
|
||||
ifnet_setbyindex(u_short idx, struct ifnet *ifp)
|
||||
{
|
||||
@ -636,11 +627,8 @@ if_alloc_domain(u_char type, int numa_domain)
|
||||
#endif
|
||||
if (if_com_alloc[type] != NULL) {
|
||||
ifp->if_l2com = if_com_alloc[type](type, ifp);
|
||||
if (ifp->if_l2com == NULL) {
|
||||
free(ifp, M_IFNET);
|
||||
ifindex_free(idx);
|
||||
return (NULL);
|
||||
}
|
||||
KASSERT(ifp->if_l2com, ("%s: if_com_alloc[%u] failed", __func__,
|
||||
type));
|
||||
}
|
||||
|
||||
IF_ADDR_LOCK_INIT(ifp);
|
||||
@ -735,7 +723,7 @@ if_free(struct ifnet *ifp)
|
||||
KASSERT(ifp == ifnet_byindex(ifp->if_index),
|
||||
("%s: freeing unallocated ifnet", ifp->if_xname));
|
||||
|
||||
ifindex_free_locked(ifp->if_index);
|
||||
ifindex_free(ifp->if_index);
|
||||
IFNET_WUNLOCK();
|
||||
|
||||
if (refcount_release(&ifp->if_refcount))
|
||||
@ -1356,7 +1344,7 @@ if_vmove(struct ifnet *ifp, struct vnet *new_vnet)
|
||||
* or we'd lock on one vnet and unlock on another.
|
||||
*/
|
||||
IFNET_WLOCK();
|
||||
ifindex_free_locked(ifp->if_index);
|
||||
ifindex_free(ifp->if_index);
|
||||
IFNET_WUNLOCK();
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user