summaryrefslogtreecommitdiffstats
path: root/sys/dev/fxp
diff options
context:
space:
mode:
authormux <mux@FreeBSD.org>2005-03-03 00:22:59 +0000
committermux <mux@FreeBSD.org>2005-03-03 00:22:59 +0000
commita98c1e7d35e2f75753dee8f14c5e97c89871bddb (patch)
tree07e3f186b6a470c215c467056197cd94b5b68a63 /sys/dev/fxp
parentbeec1e31adac1183a2368eea61b23b17b276421a (diff)
downloadFreeBSD-src-a98c1e7d35e2f75753dee8f14c5e97c89871bddb.zip
FreeBSD-src-a98c1e7d35e2f75753dee8f14c5e97c89871bddb.tar.gz
Fix the panic recently reported on -current@ occuring when configuring
a vlan interface attached to a fxp(4) card when it has not been initialized yet. We now set the links from our internel TX descriptor structure to the TX command blocks at attach time rather than at init time. While I'm here, slightly improve the style in fxp_attach(). PR: kern/78112 Reported by: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk> and others Tested by: flz, Gavin Atkinson <gavin.atkinson@ury.york.ac.uk> MFC after: 1 week
Diffstat (limited to 'sys/dev/fxp')
-rw-r--r--sys/dev/fxp/if_fxp.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/sys/dev/fxp/if_fxp.c b/sys/dev/fxp/if_fxp.c
index 644ec2c..9b003f8 100644
--- a/sys/dev/fxp/if_fxp.c
+++ b/sys/dev/fxp/if_fxp.c
@@ -364,15 +364,18 @@ fxp_dma_map_addr(void *arg, bus_dma_segment_t *segs, int nseg, int error)
static int
fxp_attach(device_t dev)
{
- int error = 0;
- struct fxp_softc *sc = device_get_softc(dev);
- struct ifnet *ifp;
+ struct fxp_softc *sc;
+ struct fxp_cb_tx *tcbp;
+ struct fxp_tx *txp;
struct fxp_rx *rxp;
+ struct ifnet *ifp;
u_int32_t val;
u_int16_t data, myea[ETHER_ADDR_LEN / 2];
int i, rid, m1, m2, prefer_iomap, maxtxseg;
- int s;
+ int error, s;
+ error = 0;
+ sc = device_get_softc(dev);
sc->dev = dev;
callout_init(&sc->stat_ch, CALLOUT_MPSAFE);
mtx_init(&sc->sc_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
@@ -658,11 +661,14 @@ fxp_attach(device_t dev)
}
/*
- * Pre-allocate the TX DMA maps.
+ * Pre-allocate the TX DMA maps and setup the pointers to
+ * the TX command blocks.
*/
+ txp = sc->fxp_desc.tx_list;
+ tcbp = sc->fxp_desc.cbl_list;
for (i = 0; i < FXP_NTXCB; i++) {
- error = bus_dmamap_create(sc->fxp_mtag, 0,
- &sc->fxp_desc.tx_list[i].tx_map);
+ txp[i].tx_cb = tcbp + i;
+ error = bus_dmamap_create(sc->fxp_mtag, 0, &txp[i].tx_map);
if (error) {
device_printf(dev, "can't create DMA map for TX\n");
goto fail;
@@ -2132,7 +2138,6 @@ fxp_init_body(struct fxp_softc *sc)
tcbp = sc->fxp_desc.cbl_list;
bzero(tcbp, FXP_TXCB_SZ);
for (i = 0; i < FXP_NTXCB; i++) {
- txp[i].tx_cb = tcbp + i;
txp[i].tx_mbuf = NULL;
tcbp[i].cb_status = htole16(FXP_CB_STATUS_C | FXP_CB_STATUS_OK);
tcbp[i].cb_command = htole16(FXP_CB_COMMAND_NOP);
OpenPOWER on IntegriCloud