First real attempt at proper locking. The locking is a little complicated

since the the command and data that is being built to be sent to or read
from the HW lives in the softc.  Commands are later run via an_setdef etc.
In the ioctl path various references are kept to the data stored in
the softc so it needs to be protected.  Almost think of the command
in the softc a global variable since it essentially is.  Since locking
wasn't done in this type of context the commands would get corrupted.

Thanks to avatar@ for catching some lock issues and dhw@ for testing.

Things are a lot more stable except for the MPI-350 cards.  My an(4)
remote laptop stays on the network now.

The driver should be changed so that it uses private memory that is passed
to the functions that talk to the card.  Then only those functions would
really need to grab locks.

Reviewed by:	avatar@
This commit is contained in:
Doug Ambrisko 2008-01-18 16:31:24 +00:00
parent 0e17ccbe36
commit f0e1e8d9fb
3 changed files with 253 additions and 122 deletions

File diff suppressed because it is too large Load Diff

View File

@ -118,13 +118,16 @@ static int
an_probe_pci(device_t dev)
{
struct an_type *t;
struct an_softc *sc = device_get_softc(dev);
bzero(sc, sizeof(struct an_softc));
t = an_devs;
while (t->an_name != NULL) {
if (pci_get_vendor(dev) == t->an_vid &&
pci_get_device(dev) == t->an_did) {
device_set_desc(dev, t->an_name);
an_pci_probe(dev);
return(BUS_PROBE_DEFAULT);
}
t++;
@ -133,6 +136,7 @@ an_probe_pci(device_t dev)
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {
device_set_desc(dev, "Cisco Aironet MPI350");
an_pci_probe(dev);
return(BUS_PROBE_DEFAULT);
}
@ -150,7 +154,6 @@ an_attach_pci(dev)
sc = device_get_softc(dev);
unit = device_get_unit(dev);
flags = device_get_flags(dev);
bzero(sc, sizeof(struct an_softc));
if (pci_get_vendor(dev) == AIRONET_VENDORID &&
pci_get_device(dev) == AIRONET_DEVICEID_MPI350) {

View File

@ -509,6 +509,7 @@ int an_alloc_port (device_t, int, int);
int an_alloc_memory (device_t, int, int);
int an_alloc_aux_memory (device_t, int, int);
int an_alloc_irq (device_t, int, int);
int an_pci_probe (device_t);
int an_probe (device_t);
void an_shutdown (device_t);
void an_resume (device_t);