commit 80f9ba69ca3e78fe8c1597db39337d7be59e4b04 Author: Ryota Ozaki Date: Fri Jan 20 09:57:50 2017 +0900 Tx softint diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index a808268..30361c3 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -990,6 +990,7 @@ axe_attach(device_t parent, device_t self, void *aux) ifp->if_softc = sc; strlcpy(ifp->if_xname, devname, IFNAMSIZ); ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_extflags = IFEF_TX_SOFTINT; ifp->if_ioctl = axe_ioctl; ifp->if_start = axe_start; ifp->if_init = axe_init; @@ -1044,6 +1045,7 @@ axe_attach(device_t parent, device_t self, void *aux) /* Attach the interface. */ if_attach(ifp); + if_deferred_start_init(ifp, NULL); ether_ifattach(ifp, sc->axe_enaddr); rnd_attach_source(&sc->rnd_source, device_xname(sc->axe_dev), RND_TYPE_NET, RND_FLAG_DEFAULT); diff --git a/sys/net/if.c b/sys/net/if.c index f2db4ed..6638712 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -3194,8 +3194,12 @@ if_transmit(struct ifnet *ifp, struct mbuf *m) if (m->m_flags & M_MCAST) ifp->if_omcasts++; - if ((ifp->if_flags & IFF_OACTIVE) == 0) - if_start_lock(ifp); + if ((ifp->if_flags & IFF_OACTIVE) == 0) { + if (ISSET(ifp->if_extflags, IFEF_TX_SOFTINT)) + if_schedule_deferred_start(ifp); + else + if_start_lock(ifp); + } out: splx(s); diff --git a/sys/net/if.h b/sys/net/if.h index 837b97e..ba79650 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -387,6 +387,7 @@ typedef struct ifnet { #define IFEF_OUTPUT_MPSAFE __BIT(0) /* if_output() can run parallel */ #define IFEF_START_MPSAFE __BIT(1) /* if_start() can run parallel */ #define IFEF_NO_LINK_STATE_CHANGE __BIT(2) /* doesn't use link state interrupts */ +#define IFEF_TX_SOFTINT __BIT(3) /* defer transmit to softint */ #ifdef _KERNEL static inline bool