diff options
author | marius <marius@FreeBSD.org> | 2009-06-23 20:36:59 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2009-06-23 20:36:59 +0000 |
commit | 224c243ab7658cd209c242bde332223cd68b8ee6 (patch) | |
tree | f992451f2d24f7251db039adf592e8c394536d48 /sys/dev/gem/if_gemvar.h | |
parent | eeafb36508ef6b5677597f46291958c39c792c19 (diff) | |
download | FreeBSD-src-224c243ab7658cd209c242bde332223cd68b8ee6.zip FreeBSD-src-224c243ab7658cd209c242bde332223cd68b8ee6.tar.gz |
- Initialize the ifnet structure, especially if_dname, before probing
the PHYs as some PHY drivers use it (but probably shouldn't). How
gem(4) has worked with brgphy(4) on powerpc without this so far is
unclear to me.
- Introduce a dying flag which is set during detach and checked in
gem_ioctl() in order to prevent active BPF listeners to clear
promiscuous mode which may lead to the tick callout being restarted
which will trigger a panic once it's actually gone.
- In gem_stop() reset rather than just disable the transmitter and
receiver in order to ensure we're not unloading DMA maps still in
use by the hardware. [1]
- The blanking time is specified in PCI clocks so we should use twice
the value when operating at 66MHz.
- Spell some 2 as ETHER_ALIGN and a 19 as GEM_STATUS_TX_COMPLETION_SHFT
to make the actual intentions clear.
- As we don't unload the peak attempts counter ignore its overflow
interrupts.
- Remove a stale setting of a variable to GEM_TD_INTERRUPT_ME which
isn't used afterwards.
- For optimum performance increment the TX kick register in multiples
of 4 if possible as suggested by the documentation.
- Partially revert r164931; drivers should only clear the watchdog
timer if all outstanding TX descriptors are done.
- Fix some debugging strings.
- Add a missing BUS_DMASYNC_POSTWRITE in gem_rint().
- As the error paths in the interrupt handler are generally unlikely
predict them as false.
- Add support for the SBus version of the GEM controller. [2]
- Add some lock assertions.
- Improve some comments.
- Fix some more or less cosmetic issues in the code of the PCI front-end.
- Change some softc members to be unsigned where more appropriate and
remove unused ones.
Approved by: re (kib)
Obtained from: NetBSD (partially) [2], OpenBSD [1]
MFC after: 2 weeks
Diffstat (limited to 'sys/dev/gem/if_gemvar.h')
-rw-r--r-- | sys/dev/gem/if_gemvar.h | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/sys/dev/gem/if_gemvar.h b/sys/dev/gem/if_gemvar.h index 76e2b20..48e3299 100644 --- a/sys/dev/gem/if_gemvar.h +++ b/sys/dev/gem/if_gemvar.h @@ -35,7 +35,7 @@ #include <sys/callout.h> /* - * Transmit descriptor list size. This is arbitrary, but allocate + * Transmit descriptor ring size - this is arbitrary, but allocate * enough descriptors for 64 pending transmissions and 16 segments * per packet. This limit is not actually enforced (packets with * more segments can be sent, depending on the busdma backend); it @@ -50,7 +50,7 @@ #define GEM_NEXTTX(x) ((x + 1) & GEM_NTXDESC_MASK) /* - * Receive descriptor list size. We have one RX buffer per incoming + * Receive descriptor ring size - we have one RX buffer per incoming * packet, so this logic is a little simpler. */ #define GEM_NRXDESC 256 @@ -64,7 +64,7 @@ #define GEM_RXOWN_TICKS (hz / 50) /* - * Control structures are DMA'd to the GEM chip. We allocate them + * Control structures are DMA'd to the chip. We allocate them * in a single clump that maps to a single DMA segment to make * several things easier. */ @@ -83,9 +83,9 @@ struct gem_control_data { struct gem_txsoft { struct mbuf *txs_mbuf; /* head of our mbuf chain */ bus_dmamap_t txs_dmamap; /* our DMA map */ - int txs_firstdesc; /* first descriptor in packet */ - int txs_lastdesc; /* last descriptor in packet */ - int txs_ndescs; /* number of descriptors */ + u_int txs_firstdesc; /* first descriptor in packet */ + u_int txs_lastdesc; /* last descriptor in packet */ + u_int txs_ndescs; /* number of descriptors */ STAILQ_ENTRY(gem_txsoft) txs_q; }; @@ -112,7 +112,7 @@ struct gem_softc { u_char sc_enaddr[ETHER_ADDR_LEN]; struct callout sc_tick_ch; /* tick callout */ struct callout sc_rx_ch; /* delayed RX callout */ - int sc_wdog_timer; /* watchdog timer */ + u_int sc_wdog_timer; /* watchdog timer */ void *sc_ih; struct resource *sc_res[3]; @@ -141,15 +141,15 @@ struct gem_softc { u_int sc_flags; #define GEM_INITED (1 << 0) /* reset persistent regs init'ed */ -#define GEM_LINK (1 << 1) /* link is up */ -#define GEM_PCI (1 << 2) /* PCI busses are little-endian */ -#define GEM_SERDES (1 << 3) /* use the SERDES */ +#define GEM_DYING (1 << 1) /* detach initiated */ +#define GEM_LINK (1 << 2) /* link is up */ +#define GEM_PCI (1 << 3) /* PCI busses are little-endian */ +#define GEM_PCI66 (1 << 4) /* PCI bus runs at 66MHz */ +#define GEM_SERDES (1 << 5) /* use the SERDES */ /* * ring buffer DMA stuff */ - bus_dma_segment_t sc_cdseg; /* control data memory */ - int sc_cdnseg; /* number of segments */ bus_dmamap_t sc_cddmamap; /* control data DMA map */ bus_addr_t sc_cddma; @@ -166,18 +166,18 @@ struct gem_softc { #define sc_txdescs sc_control_data->gcd_txdescs #define sc_rxdescs sc_control_data->gcd_rxdescs - int sc_txfree; /* number of free TX descriptors */ - int sc_txnext; /* next ready TX descriptor */ - int sc_txwin; /* TX desc. since last TX intr. */ + u_int sc_txfree; /* number of free TX descriptors */ + u_int sc_txnext; /* next ready TX descriptor */ + u_int sc_txwin; /* TX desc. since last TX intr. */ struct gem_txsq sc_txfreeq; /* free TX descsofts */ struct gem_txsq sc_txdirtyq; /* dirty TX descsofts */ - int sc_rxptr; /* next ready RX desc./descsoft */ - int sc_rxfifosize; /* RX FIFO size (bytes) */ + u_int sc_rxptr; /* next ready RX descriptor/state */ + u_int sc_rxfifosize; /* RX FIFO size (bytes) */ int sc_ifflags; - int sc_csum_features; + u_long sc_csum_features; }; #define GEM_BANKN_BARRIER(n, sc, offs, len, flags) \ @@ -238,10 +238,9 @@ do { \ __m->m_data = __m->m_ext.ext_buf; \ __rxd->gd_addr = \ GEM_DMA_WRITE((sc), __rxs->rxs_paddr); \ - __rxd->gd_flags = \ - GEM_DMA_WRITE((sc), \ - (((__m->m_ext.ext_size) << GEM_RD_BUFSHIFT) \ - & GEM_RD_BUFSIZE) | GEM_RD_OWN); \ + __rxd->gd_flags = GEM_DMA_WRITE((sc), \ + (((__m->m_ext.ext_size) << GEM_RD_BUFSHIFT) & \ + GEM_RD_BUFSIZE) | GEM_RD_OWN); \ } while (0) #define GEM_UPDATE_RXDESC(sc, x) \ @@ -250,10 +249,9 @@ do { \ struct gem_desc *__rxd = &sc->sc_rxdescs[(x)]; \ struct mbuf *__m = __rxs->rxs_mbuf; \ \ - __rxd->gd_flags = \ - GEM_DMA_WRITE((sc), \ - (((__m->m_ext.ext_size) << GEM_RD_BUFSHIFT) \ - & GEM_RD_BUFSIZE) | GEM_RD_OWN); \ + __rxd->gd_flags = GEM_DMA_WRITE((sc), \ + (((__m->m_ext.ext_size) << GEM_RD_BUFSHIFT) & \ + GEM_RD_BUFSIZE) | GEM_RD_OWN); \ } while (0) #define GEM_LOCK_INIT(_sc, _name) \ |