diff options
author | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2015-11-28 09:42:11 +0000 |
---|---|---|
committer | Jonathan Matthew <jmatthew@cvs.openbsd.org> | 2015-11-28 09:42:11 +0000 |
commit | 20c47ceb322af637ac425d248011f5be9ab5beb4 (patch) | |
tree | dbc45aba9a7abb0437775efe70029c09161a99b3 /sys/dev/pci | |
parent | 8ed09e4b021bd0584e36de9ccf8079298f62d199 (diff) |
Rework gem_start to check that there's enough space in the ring before
dequeueing a packet, then drop the packet if it can't be sent, rather than
using two phase dequeue then commit.
Adjust sc_tx_cnt using atomic operations, take the kernel lock before
calling gem_start or gem_init from the interrupt handler, and use an
interrupt barrier when taking the interface down.
With all this done, we can mark the interrupt handler for pci (but not sbus)
attached gem(4) as mpsafe.
mpi@ wrote this initially, I fixed bugs to keep sparc64 happy and kept it up
to date with ifq changes.
ok mpi@ dlg@
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_gem_pci.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/dev/pci/if_gem_pci.c b/sys/dev/pci/if_gem_pci.c index 68c61eddfba..eeee62f672b 100644 --- a/sys/dev/pci/if_gem_pci.c +++ b/sys/dev/pci/if_gem_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gem_pci.c,v 1.38 2015/11/24 17:11:39 mpi Exp $ */ +/* $OpenBSD: if_gem_pci.c,v 1.39 2015/11/28 09:42:10 jmatthew Exp $ */ /* $NetBSD: if_gem_pci.c,v 1.1 2001/09/16 00:11:42 eeh Exp $ */ /* @@ -71,7 +71,6 @@ struct gem_pci_softc { bus_space_tag_t gsc_memt; bus_space_handle_t gsc_memh; bus_size_t gsc_memsize; - void *gsc_ih; pci_chipset_tag_t gsc_pc; }; @@ -275,9 +274,9 @@ gem_attach_pci(struct device *parent, struct device *self, void *aux) return; } intrstr = pci_intr_string(pa->pa_pc, ih); - gsc->gsc_ih = pci_intr_establish(pa->pa_pc, - ih, IPL_NET, gem_intr, sc, self->dv_xname); - if (gsc->gsc_ih == NULL) { + sc->sc_ih = pci_intr_establish(pa->pa_pc, + ih, IPL_NET | IPL_MPSAFE, gem_intr, sc, self->dv_xname); + if (sc->sc_ih == NULL) { printf(": couldn't establish interrupt"); if (intrstr != NULL) printf(" at %s", intrstr); @@ -304,7 +303,7 @@ gem_detach_pci(struct device *self, int flags) timeout_del(&sc->sc_rx_watchdog); gem_unconfig(sc); - pci_intr_disestablish(gsc->gsc_pc, gsc->gsc_ih); + pci_intr_disestablish(gsc->gsc_pc, sc->sc_ih); bus_space_unmap(gsc->gsc_memt, gsc->gsc_memh, gsc->gsc_memsize); return (0); |