Lines 645-650
if_alloc_domain(u_char type, int numa_domain)
Link Here
|
645 |
ifq_init(&ifp->if_snd, ifp); |
645 |
ifq_init(&ifp->if_snd, ifp); |
646 |
|
646 |
|
647 |
refcount_init(&ifp->if_refcount, 1); /* Index reference. */ |
647 |
refcount_init(&ifp->if_refcount, 1); /* Index reference. */ |
|
|
648 |
refcount_init(&ifp->if_slowref, 1); |
649 |
|
648 |
for (int i = 0; i < IFCOUNTERS; i++) |
650 |
for (int i = 0; i < IFCOUNTERS; i++) |
649 |
ifp->if_counters[i] = counter_u64_alloc(M_WAITOK); |
651 |
ifp->if_counters[i] = counter_u64_alloc(M_WAITOK); |
650 |
ifp->if_get_counter = if_get_counter_default; |
652 |
ifp->if_get_counter = if_get_counter_default; |
Lines 753-758
if_rele(struct ifnet *ifp)
Link Here
|
753 |
NET_EPOCH_CALL(if_destroy, &ifp->if_epoch_ctx); |
755 |
NET_EPOCH_CALL(if_destroy, &ifp->if_epoch_ctx); |
754 |
} |
756 |
} |
755 |
|
757 |
|
|
|
758 |
/* |
759 |
* Keep track of slow path configuration events. |
760 |
* Returns true on success and false on failure. |
761 |
*/ |
762 |
bool |
763 |
if_slow_ref(struct ifnet *ifp) |
764 |
{ |
765 |
return (refcount_acquire_if_not_zero(&ifp->if_slowref)); |
766 |
} |
767 |
|
768 |
void |
769 |
if_slow_drain(struct ifnet *ifp) |
770 |
{ |
771 |
if (refcount_release(&ifp->if_slowref)) |
772 |
return; |
773 |
|
774 |
while (refcount_load(&ifp->if_slowref) != 0) |
775 |
pause("W", hz); |
776 |
} |
777 |
|
778 |
void |
779 |
if_slow_unref(struct ifnet *ifp) |
780 |
{ |
781 |
if (refcount_release(&ifp->if_slowref)) |
782 |
return; |
783 |
} |
784 |
|
756 |
void |
785 |
void |
757 |
ifq_init(struct ifaltq *ifq, struct ifnet *ifp) |
786 |
ifq_init(struct ifaltq *ifq, struct ifnet *ifp) |
758 |
{ |
787 |
{ |
Lines 2459-2466
ifr_data_get_ptr(void *ifrp)
Link Here
|
2459 |
/* |
2488 |
/* |
2460 |
* Hardware specific interface ioctls. |
2489 |
* Hardware specific interface ioctls. |
2461 |
*/ |
2490 |
*/ |
2462 |
int |
2491 |
static inline int |
2463 |
ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) |
2492 |
ifhwioctl_sub(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) |
2464 |
{ |
2493 |
{ |
2465 |
struct ifreq *ifr; |
2494 |
struct ifreq *ifr; |
2466 |
int error = 0, do_ifup = 0; |
2495 |
int error = 0, do_ifup = 0; |
Lines 2887-2892
ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td)
Link Here
|
2887 |
return (error); |
2916 |
return (error); |
2888 |
} |
2917 |
} |
2889 |
|
2918 |
|
|
|
2919 |
int |
2920 |
ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, struct thread *td) |
2921 |
{ |
2922 |
int error; |
2923 |
|
2924 |
if (if_slow_ref(ifp) == false) |
2925 |
return (ENXIO); |
2926 |
error = ifhwioctl_sub(cmd, ifp, data, td); |
2927 |
if_slow_unref(ifp); |
2928 |
return (error); |
2929 |
} |
2930 |
|
2931 |
|
2890 |
#ifdef COMPAT_FREEBSD32 |
2932 |
#ifdef COMPAT_FREEBSD32 |
2891 |
struct ifconf32 { |
2933 |
struct ifconf32 { |
2892 |
int32_t ifc_len; |
2934 |
int32_t ifc_len; |