version 1.484.6.2, 2021/08/01 22:42:41 |
version 1.485, 2021/05/17 04:07:43 |
|
|
* ether_ifattach(ifp, enaddr); |
* ether_ifattach(ifp, enaddr); |
* if_register(ifp); |
* if_register(ifp); |
*/ |
*/ |
void |
int |
if_initialize(ifnet_t *ifp) |
if_initialize(ifnet_t *ifp) |
{ |
{ |
|
int rv = 0; |
|
|
KASSERT(if_indexlim > 0); |
KASSERT(if_indexlim > 0); |
TAILQ_INIT(&ifp->if_addrlist); |
TAILQ_INIT(&ifp->if_addrlist); |
Line 747 if_initialize(ifnet_t *ifp) |
|
Line 748 if_initialize(ifnet_t *ifp) |
|
psref_target_init(&ifp->if_psref, ifnet_psref_class); |
psref_target_init(&ifp->if_psref, ifnet_psref_class); |
ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE); |
ifp->if_ioctl_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE); |
LIST_INIT(&ifp->if_multiaddrs); |
LIST_INIT(&ifp->if_multiaddrs); |
if_stats_init(ifp); |
if ((rv = if_stats_init(ifp)) != 0) { |
|
goto fail; |
|
} |
|
|
IFNET_GLOBAL_LOCK(); |
IFNET_GLOBAL_LOCK(); |
if_getindex(ifp); |
if_getindex(ifp); |
IFNET_GLOBAL_UNLOCK(); |
IFNET_GLOBAL_UNLOCK(); |
|
|
|
return 0; |
|
|
|
fail: |
|
IF_AFDATA_LOCK_DESTROY(ifp); |
|
|
|
pfil_run_ifhooks(if_pfil, PFIL_IFNET_DETACH, ifp); |
|
(void)pfil_head_destroy(ifp->if_pfil); |
|
|
|
IFQ_LOCK_DESTROY(&ifp->if_snd); |
|
|
|
return rv; |
} |
} |
|
|
/* |
/* |
|
|
if_register(ifnet_t *ifp) |
if_register(ifnet_t *ifp) |
{ |
{ |
/* |
/* |
* If the driver has not supplied its own if_ioctl or if_stop, |
* If the driver has not supplied its own if_ioctl, then |
* then supply the default. |
* supply the default. |
*/ |
*/ |
if (ifp->if_ioctl == NULL) |
if (ifp->if_ioctl == NULL) |
ifp->if_ioctl = ifioctl_common; |
ifp->if_ioctl = ifioctl_common; |
if (ifp->if_stop == NULL) |
|
ifp->if_stop = if_nullstop; |
|
|
|
sysctl_sndq_setup(&ifp->if_sysctl_log, ifp->if_xname, &ifp->if_snd); |
sysctl_sndq_setup(&ifp->if_sysctl_log, ifp->if_xname, &ifp->if_snd); |
|
|
Line 1129 if_input(struct ifnet *ifp, struct mbuf |
|
Line 1142 if_input(struct ifnet *ifp, struct mbuf |
|
* migrate softint-based if_input without much changes. If you don't |
* migrate softint-based if_input without much changes. If you don't |
* want to enable it, use if_initialize instead. |
* want to enable it, use if_initialize instead. |
*/ |
*/ |
void |
int |
if_attach(ifnet_t *ifp) |
if_attach(ifnet_t *ifp) |
{ |
{ |
|
int rv; |
|
|
|
rv = if_initialize(ifp); |
|
if (rv != 0) |
|
return rv; |
|
|
if_initialize(ifp); |
|
ifp->if_percpuq = if_percpuq_create(ifp); |
ifp->if_percpuq = if_percpuq_create(ifp); |
if_register(ifp); |
if_register(ifp); |
|
|
|
return 0; |
} |
} |
|
|
void |
void |