Home | History | Annotate | Line # | Download | only in pci
if_nfevar.h revision 1.5
      1 /*	$NetBSD: if_nfevar.h,v 1.5 2007/12/17 12:41:07 tsutsui Exp $	*/
      2 /*	$OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $	*/
      3 
      4 /*-
      5  * Copyright (c) 2005 Jonathan Gray <jsg (at) openbsd.org>
      6  *
      7  * Permission to use, copy, modify, and distribute this software for any
      8  * purpose with or without fee is hereby granted, provided that the above
      9  * copyright notice and this permission notice appear in all copies.
     10  *
     11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     18  */
     19 
     20 #define NFE_IFQ_MAXLEN	64
     21 
     22 struct nfe_tx_data {
     23 	bus_dmamap_t	map;
     24 	bus_dmamap_t	active;
     25 	struct mbuf	*m;
     26 };
     27 
     28 struct nfe_tx_ring {
     29 	bus_dmamap_t		map;
     30 	bus_dma_segment_t	seg;
     31 	bus_addr_t		physaddr;
     32 	struct nfe_desc32	*desc32;
     33 	struct nfe_desc64	*desc64;
     34 	struct nfe_tx_data	data[NFE_TX_RING_COUNT];
     35 	int			queued;
     36 	int			cur;
     37 	int			next;
     38 };
     39 
     40 struct nfe_jbuf {
     41 	void *			buf;
     42 	bus_addr_t		physaddr;
     43 	SLIST_ENTRY(nfe_jbuf)	jnext;
     44 };
     45 
     46 struct nfe_rx_data {
     47 	bus_dmamap_t	map;
     48 	struct mbuf	*m;
     49 };
     50 
     51 struct nfe_rx_ring {
     52 	bus_dmamap_t		map;
     53 	bus_dma_segment_t	seg;
     54 	bus_dmamap_t		jmap;
     55 	bus_dma_segment_t	jseg;
     56 	bus_addr_t		physaddr;
     57 	struct nfe_desc32	*desc32;
     58 	struct nfe_desc64	*desc64;
     59 	void *			jpool;
     60 	struct nfe_rx_data	data[NFE_RX_RING_COUNT];
     61 	struct nfe_jbuf		jbuf[NFE_JPOOL_COUNT];
     62 	int			jbufmap[NFE_RX_RING_COUNT];
     63 	SLIST_HEAD(, nfe_jbuf)	jfreelist;
     64 	int			bufsz;
     65 	int			cur;
     66 	int			next;
     67 };
     68 
     69 struct nfe_softc {
     70 	struct device		sc_dev;
     71 	struct ethercom		sc_ethercom;
     72 	uint8_t			sc_enaddr[ETHER_ADDR_LEN];
     73 	bus_space_handle_t	sc_memh;
     74 	bus_space_tag_t		sc_memt;
     75 	void			*sc_ih;
     76 	bus_dma_tag_t		sc_dmat;
     77 	struct mii_data		sc_mii;
     78 	struct callout		sc_tick_ch;
     79 
     80 	int			sc_if_flags;
     81 	u_int			sc_flags;
     82 #define NFE_JUMBO_SUP		0x01
     83 #define NFE_40BIT_ADDR		0x02
     84 #define NFE_HW_CSUM		0x04
     85 #define NFE_HW_VLAN		0x08
     86 #define NFE_USE_JUMBO		0x10
     87 #define NFE_CORRECT_MACADDR	0x20
     88 
     89 	uint32_t		rxtxctl;
     90 	uint8_t			mii_phyaddr;
     91 
     92 	struct nfe_tx_ring	txq;
     93 	struct nfe_rx_ring	rxq;
     94 };
     95