diff options
author | raj <raj@FreeBSD.org> | 2009-02-17 14:57:05 +0000 |
---|---|---|
committer | raj <raj@FreeBSD.org> | 2009-02-17 14:57:05 +0000 |
commit | fe8e0abcf53c6335cdb09c1bf1bd11c6b3fcb8df (patch) | |
tree | 6a7c1cddf95f5c82a405ff60e8bf160f8d6eb47b /sys/dev/tsec/if_tsec.h | |
parent | 11a3f6d70678aa71a8de150e7782914dbc0fe6ce (diff) | |
download | FreeBSD-src-fe8e0abcf53c6335cdb09c1bf1bd11c6b3fcb8df.zip FreeBSD-src-fe8e0abcf53c6335cdb09c1bf1bd11c6b3fcb8df.tar.gz |
Additional features for the tsec(4) Ethernet driver.
- interrupt coalescing
- polling
- jumbo frames
- multicast
- VLAN tagging
The enhanced version of the chip (eTSEC) can also take advantage of:
- TCP/IP checksum calculation h/w offloading
Obtained from: Freescale, Semihalf
Diffstat (limited to 'sys/dev/tsec/if_tsec.h')
-rw-r--r-- | sys/dev/tsec/if_tsec.h | 78 |
1 files changed, 72 insertions, 6 deletions
diff --git a/sys/dev/tsec/if_tsec.h b/sys/dev/tsec/if_tsec.h index e388b62..143b3d0 100644 --- a/sys/dev/tsec/if_tsec.h +++ b/sys/dev/tsec/if_tsec.h @@ -31,6 +31,17 @@ #define TSEC_RX_NUM_DESC 256 #define TSEC_TX_NUM_DESC 256 +/* Interrupt Coalescing types */ +#define TSEC_IC_RX 0 +#define TSEC_IC_TX 1 + +/* eTSEC ID */ +#define TSEC_ETSEC_ID 0x0124 + +/* Frame sizes */ +#define TSEC_MIN_FRAME_SIZE 64 +#define TSEC_MAX_FRAME_SIZE 9600 + struct tsec_softc { /* XXX MII bus requires that struct ifnet is first!!! */ struct ifnet *tsec_ifp; @@ -84,6 +95,7 @@ struct tsec_softc { int sc_error_irid; int tsec_if_flags; + int is_etsec; /* Watchdog and MII tick related */ struct callout tsec_callout; @@ -106,6 +118,16 @@ struct tsec_softc { uint32_t tx_mbuf_used_get_cnt; uint32_t tx_mbuf_used_put_cnt; struct mbuf *tx_mbuf_used_data[TSEC_TX_NUM_DESC]; + + /* interrupt coalescing */ + struct mtx ic_lock; + uint32_t rx_ic_time; /* RW, valid values 0..65535 */ + uint32_t rx_ic_count; /* RW, valid values 0..255 */ + uint32_t tx_ic_time; + uint32_t tx_ic_count; + + /* currently received frame */ + struct mbuf *frame; }; /* interface to get/put generic objects */ @@ -235,14 +257,23 @@ struct tsec_softc { #define TSEC_TRANSMIT_LOCK_ASSERT(sc) mtx_assert(&(sc)->transmit_lock, MA_OWNED) /* Lock for receiver */ -#define TSEC_RECEIVE_LOCK(sc) do { \ - mtx_assert(&(sc)->transmit_lock, MA_NOTOWNED); \ - mtx_lock(&(sc)->receive_lock); \ +#define TSEC_RECEIVE_LOCK(sc) do { \ + mtx_assert(&(sc)->transmit_lock, MA_NOTOWNED); \ + mtx_lock(&(sc)->receive_lock); \ } while (0) #define TSEC_RECEIVE_UNLOCK(sc) mtx_unlock(&(sc)->receive_lock) #define TSEC_RECEIVE_LOCK_ASSERT(sc) mtx_assert(&(sc)->receive_lock, MA_OWNED) +/* Lock for interrupts coalescing */ +#define TSEC_IC_LOCK(sc) do { \ + mtx_assert(&(sc)->ic_lock, MA_NOTOWNED); \ + mtx_lock(&(sc)->ic_lock); \ +} while (0) + +#define TSEC_IC_UNLOCK(sc) mtx_unlock(&(sc)->ic_lock) +#define TSEC_IC_LOCK_ASSERT(sc) mtx_assert(&(sc)->ic_lock, MA_OWNED) + /* Global tsec lock (with all locks) */ #define TSEC_GLOBAL_LOCK(sc) do { \ if ((mtx_owned(&(sc)->transmit_lock) ? 1 : 0) != \ @@ -273,14 +304,49 @@ struct tsec_softc { } while (0) struct tsec_desc { - volatile uint16_t flags; /* descriptor flags */ - volatile uint16_t length; /* buffer length */ - volatile uint32_t bufptr; /* buffer pointer */ + volatile uint16_t flags; /* descriptor flags */ + volatile uint16_t length; /* buffer length */ + volatile uint32_t bufptr; /* buffer pointer */ }; #define TSEC_READ_RETRY 10000 #define TSEC_READ_DELAY 100 +/* Structures and defines for TCP/IP Off-load */ +struct tsec_tx_fcb { + volatile uint16_t flags; + volatile uint8_t l4_offset; + volatile uint8_t l3_offset; + volatile uint16_t ph_chsum; + volatile uint16_t vlan; +}; + +struct tsec_rx_fcb { + volatile uint16_t flags; + volatile uint8_t rq_index; + volatile uint8_t protocol; + volatile uint16_t unused; + volatile uint16_t vlan; +}; + +#define TSEC_CHECKSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP) + +#define TSEC_TX_FCB_IP4 TSEC_TX_FCB_L3_IS_IP +#define TSEC_TX_FCB_IP6 (TSEC_TX_FCB_L3_IS_IP | TSEC_TX_FCB_L3_IS_IP6) + +#define TSEC_TX_FCB_TCP TSEC_TX_FCB_L4_IS_TCP_UDP +#define TSEC_TX_FCB_UDP (TSEC_TX_FCB_L4_IS_TCP_UDP | TSEC_TX_FCB_L4_IS_UDP) + +#define TSEC_RX_FCB_IP_CSUM_CHECKED(flags) \ + ((flags & (TSEC_RX_FCB_IP_FOUND | TSEC_RX_FCB_IP6_FOUND | \ + TSEC_RX_FCB_IP_CSUM | TSEC_RX_FCB_PARSE_ERROR)) \ + == (TSEC_RX_FCB_IP_FOUND | TSEC_RX_FCB_IP_CSUM)) + +#define TSEC_RX_FCB_TCP_UDP_CSUM_CHECKED(flags) \ + ((flags & (TSEC_RX_FCB_TCP_UDP_FOUND | TSEC_RX_FCB_TCP_UDP_CSUM \ + | TSEC_RX_FCB_PARSE_ERROR)) \ + == (TSEC_RX_FCB_TCP_UDP_FOUND | TSEC_RX_FCB_TCP_UDP_CSUM)) + /* Prototypes */ extern devclass_t tsec_devclass; |