freebsd-skq/sys/dev/nfe/if_nfevar.h
yongari 36a63ea429 Bring overhauled nfe(4) into tree.
o s/printf/device_printf/g
o Nuke OpenBSDism.
o Nuke NetBSD/OpenBSD specific DMA sync operations.(we don't have a way
   to sync a single descriptor within a DMA map.)
o Remove recursive mutex.
o bus_dma(9) clean up.
o 40bit DMA address support.
o Add protection for Rx map load failure.
o Fix a long standing bug for watchdog timeout. [1]
o Add additional protections, missing Tx completion interrupt, losing
   start Tx command, for watchdog timeout.
o Switch to taskqueue(9) API to handle interrupts.
o Use our own timer for watchdog instead of if_watchdog/if_timer
   interface.
o Advertise VLAN header length/capability correctly to upper layer.
o Remove excessive kernel stack consumption in nfe_encap().
o Handle highly fragmented mbuf chains correctly.
o Enable etherenet address reprogramming with ifconfig(8).
o Add ALTQ/TSO, MSI/MSIX support.
o Increased Rx ring to 256 descriptors from 128.
o Align Tx/Rx descriptor ring on sizeof(struct nfe_desc64) boundary.
o Remove alignment restrictions on Tx/Rx buffers.
o Rewritten jumbo frame support code.
o Add support for hardware assistend VLAN tag insertion/stripping.
o Add support for Tx/Rx flow control based on patches from Peer Chen. [2]
o Add a routine that detects whether ethernet address swap routines is
   required. [3]
o Add a workaround that take MAC/PHY out of power down mode.
o Add suspend/resume support.
o style(9) and code clean up.

Special thanks to Shigeaki Tagashira, the original porter of nfe(4),
who submitted lots of patches, performed uncountable number of
regression tests and maintained nfe(4) for a long time. Without his
enthusiastic help and support I could never have completed this
overhauling task.

The only weak point of nfe(4) compared to nve(4) is instability of
manual half-duplex media selection on certain hardwares(auto sensing
media type should work for all cases, though). This was a long
standing bug of nfe(4) and I still have no idea why it doesn't work
on some hardwares.

Obtained from:	OpenBSD [1]
Submitted by:	Peer Chen < pchen at nvidia dot com > [2], [3]
Reviewed by:	Shigeaki Tagashira < shigeaki AT se DOT hiroshima-u DOT ac DOT jp >
Tested by:	Shigeaki Tagashira, current
Discussed with:	current
Silence from:	obrien
2007-06-12 02:16:02 +00:00

138 lines
3.5 KiB
C

/* $OpenBSD: if_nfevar.h,v 1.11 2006/02/19 13:57:02 damien Exp $ */
/*-
* Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $FreeBSD$
*/
struct nfe_tx_data {
bus_dmamap_t tx_data_map;
struct mbuf *m;
};
struct nfe_tx_ring {
bus_dma_tag_t tx_desc_tag;
bus_dmamap_t tx_desc_map;
bus_addr_t physaddr;
struct nfe_desc32 *desc32;
struct nfe_desc64 *desc64;
bus_dma_tag_t tx_data_tag;
struct nfe_tx_data data[NFE_TX_RING_COUNT];
int queued;
int cur;
int next;
};
struct nfe_jpool_entry {
int slot;
SLIST_ENTRY(nfe_jpool_entry) jpool_entries;
};
struct nfe_rx_data {
bus_dmamap_t rx_data_map;
bus_addr_t paddr;
struct mbuf *m;
};
struct nfe_rx_ring {
bus_dma_tag_t rx_desc_tag;
bus_dmamap_t rx_desc_map;
bus_addr_t physaddr;
struct nfe_desc32 *desc32;
struct nfe_desc64 *desc64;
bus_dma_tag_t rx_data_tag;
bus_dmamap_t rx_spare_map;
struct nfe_rx_data data[NFE_RX_RING_COUNT];
int cur;
int next;
};
struct nfe_jrx_ring {
bus_dma_tag_t jrx_desc_tag;
bus_dmamap_t jrx_desc_map;
bus_dma_tag_t jrx_jumbo_tag;
bus_dmamap_t jrx_jumbo_map;
void *jpool;
caddr_t jslots[NFE_JSLOTS];
bus_addr_t jphysaddr;
struct nfe_desc32 *jdesc32;
struct nfe_desc64 *jdesc64;
bus_dma_tag_t jrx_data_tag;
bus_dmamap_t jrx_spare_map;
struct nfe_rx_data jdata[NFE_JUMBO_RX_RING_COUNT];
int jcur;
int jnext;
};
struct nfe_softc {
struct ifnet *nfe_ifp;
device_t nfe_dev;
uint16_t nfe_devid;
uint16_t nfe_revid;
device_t nfe_miibus;
struct mtx nfe_mtx;
struct resource *nfe_res[1];
struct resource *nfe_msix_res;
struct resource *nfe_msix_pba_res;
struct resource *nfe_irq[NFE_MSI_MESSAGES];
void *nfe_intrhand[NFE_MSI_MESSAGES];
struct callout nfe_stat_ch;
int nfe_watchdog_timer;
bus_dma_tag_t nfe_parent_tag;
int nfe_if_flags;
uint32_t nfe_flags;
#define NFE_JUMBO_SUP 0x0001
#define NFE_40BIT_ADDR 0x0002
#define NFE_HW_CSUM 0x0004
#define NFE_HW_VLAN 0x0008
#define NFE_PWR_MGMT 0x0010
#define NFE_CORRECT_MACADDR 0x0020
#define NFE_TX_FLOW_CTRL 0x0040
uint32_t rxtxctl;
uint8_t mii_phyaddr;
uint8_t eaddr[ETHER_ADDR_LEN];
struct taskqueue *nfe_tq;
struct task nfe_int_task;
struct task nfe_tx_task;
struct task nfe_link_task;
int nfe_link;
int nfe_suspended;
int nfe_framesize;
int nfe_process_limit;
int nfe_force_tx;
uint32_t nfe_irq_status;
uint32_t nfe_irq_mask;
uint32_t nfe_intrs;
uint32_t nfe_nointrs;
uint32_t nfe_msi;
uint32_t nfe_msix;
struct nfe_tx_ring txq;
struct nfe_rx_ring rxq;
struct nfe_jrx_ring jrxq;
SLIST_HEAD(__nfe_jfreehead, nfe_jpool_entry) nfe_jfree_listhead;
SLIST_HEAD(__nfe_jinusehead, nfe_jpool_entry) nfe_jinuse_listhead;
struct mtx nfe_jlist_mtx;
};
struct nfe_type {
uint16_t vid_id;
uint16_t dev_id;
char *name;
};