summaryrefslogtreecommitdiffstats
path: root/sys/dev/e1000/if_em.h
diff options
context:
space:
mode:
authorjfv <jfv@FreeBSD.org>2010-03-29 23:36:34 +0000
committerjfv <jfv@FreeBSD.org>2010-03-29 23:36:34 +0000
commite7270b68f305f255c984dcc9c3ff3e39bf73ba09 (patch)
tree52adde5169569de66f66f886a5c368751c45c604 /sys/dev/e1000/if_em.h
parent5b550c005a08a17c603fa3014ddcefc9a26ff070 (diff)
downloadFreeBSD-src-e7270b68f305f255c984dcc9c3ff3e39bf73ba09.zip
FreeBSD-src-e7270b68f305f255c984dcc9c3ff3e39bf73ba09.tar.gz
Update to igb and em:
em revision 7.0.0: - Using driver devclass, seperate legacy (pre-pcie) code into a seperate source file. This will at least help protect against regression issues. It compiles along with em, and is transparent to end use, devices in each appear to be 'emX'. When using em in a modular form this also allows the legacy stuff to be defined out. - Add tx and rx rings as in igb, in the 82574 this becomes actual multiqueue for the first time (2 queues) while in other PCIE adapters its just make code cleaner. - Add RX mbuf handling logic that matches igb, this will eliminate packet drops due to temporary mbuf shortage. igb revision 1.9.3: - Following the ixgbe code, use a new approach in what was called 'get_buf', the routine now has been made independent of rxeof, it now does the update to the engine TDT register, this design allows temporary mbuf resources to become non-critical, not requiring a packet to be discarded, instead it just returns and does not increment the tail pointer. - With the above change it was also unnecessary to keep 'spare' maps around, since we do not have the discard issue. - Performance tweaks and improvements to the code also. MFC in a week
Diffstat (limited to 'sys/dev/e1000/if_em.h')
-rw-r--r--sys/dev/e1000/if_em.h231
1 files changed, 100 insertions, 131 deletions
diff --git a/sys/dev/e1000/if_em.h b/sys/dev/e1000/if_em.h
index fe5a99b..d3a1019 100644
--- a/sys/dev/e1000/if_em.h
+++ b/sys/dev/e1000/if_em.h
@@ -52,7 +52,6 @@
* (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0
*/
#define EM_MIN_TXD 80
-#define EM_MAX_TXD_82543 256
#define EM_MAX_TXD 4096
#define EM_DEFAULT_TXD 1024
@@ -70,7 +69,6 @@
* (num_tx_desc * sizeof(struct e1000_tx_desc)) % 128 == 0
*/
#define EM_MIN_RXD 80
-#define EM_MAX_RXD_82543 256
#define EM_MAX_RXD 4096
#define EM_DEFAULT_RXD 1024
@@ -144,7 +142,6 @@
* transmit descriptors.
*/
#define EM_TX_CLEANUP_THRESHOLD (adapter->num_tx_desc / 8)
-#define EM_TX_OP_THRESHOLD (adapter->num_tx_desc / 32)
/*
* This parameter controls whether or not autonegotation is enabled.
@@ -182,7 +179,7 @@
#define EM_DEFAULT_PBA 0x00000030
#define EM_SMARTSPEED_DOWNSHIFT 3
#define EM_SMARTSPEED_MAX 15
-#define EM_MAX_INTR 10
+#define EM_MAX_LOOP 10
#define MAX_NUM_MULTICAST_ADDRESSES 128
#define PCI_ANY_ID (~0U)
@@ -191,11 +188,6 @@
#define EM_EEPROM_APME 0x400;
#define EM_82544_APME 0x0004;
-/* Code compatilbility between 6 and 7 */
-#ifndef ETHER_BPF_MTAP
-#define ETHER_BPF_MTAP BPF_MTAP
-#endif
-
/*
* TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
* multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will
@@ -209,7 +201,6 @@
#define EM_BAR_TYPE(v) ((v) & EM_BAR_TYPE_MASK)
#define EM_BAR_TYPE_MASK 0x00000001
#define EM_BAR_TYPE_MMEM 0x00000000
-#define EM_BAR_TYPE_IO 0x00000001
#define EM_BAR_TYPE_FLASH 0x0014
#define EM_BAR_MEM_TYPE(v) ((v) & EM_BAR_MEM_TYPE_MASK)
#define EM_BAR_MEM_TYPE_MASK 0x00000006
@@ -237,6 +228,7 @@
#define EM_TSO_SIZE (65535 + sizeof(struct ether_vlan_header))
#define EM_TSO_SEG_SIZE 4096 /* Max dma segment size */
#define EM_MSIX_MASK 0x01F00000 /* For 82574 use */
+#define EM_MSIX_LINK 0x01000000 /* For 82574 use */
#define ETH_ZLEN 60
#define ETH_ADDR_LEN 6
#define CSUM_OFFLOAD 7 /* Offload bits in mbuf flag */
@@ -249,18 +241,6 @@
*/
#define EM_EIAC 0x000DC
-/* Used in for 82547 10Mb Half workaround */
-#define EM_PBA_BYTES_SHIFT 0xA
-#define EM_TX_HEAD_ADDR_SHIFT 7
-#define EM_PBA_TX_MASK 0xFFFF0000
-#define EM_FIFO_HDR 0x10
-#define EM_82547_PKT_THRESH 0x3e0
-
-/* Precision Time Sync (IEEE 1588) defines */
-#define ETHERTYPE_IEEE1588 0x88F7
-#define PICOSECS_PER_TICK 20833
-#define TSYNC_PORT 319 /* UDP port for the protocol */
-
/*
* Bus dma allocation structure used by
* e1000_dma_malloc and e1000_dma_free.
@@ -282,12 +262,76 @@ struct em_int_delay_info {
int value; /* Current value in usecs */
};
+/*
+ * The transmit ring, one per tx queue
+ */
+struct tx_ring {
+ struct adapter *adapter;
+ struct mtx tx_mtx;
+ char mtx_name[16];
+ u32 me;
+ u32 msix;
+ u32 ims;
+ bool watchdog_check;
+ int watchdog_time;
+ struct em_dma_alloc txdma;
+ struct e1000_tx_desc *tx_base;
+ struct task tx_task;
+ struct taskqueue *tq;
+ u32 next_avail_desc;
+ u32 next_to_clean;
+ struct em_buffer *tx_buffers;
+ volatile u16 tx_avail;
+ u32 tx_tso; /* last tx was tso */
+ u16 last_hw_offload;
+#if __FreeBSD_version >= 800000
+ struct buf_ring *br;
+#endif
+ /* Interrupt resources */
+ bus_dma_tag_t txtag;
+ void *tag;
+ struct resource *res;
+ u64 tx_irq;
+ u64 no_desc_avail;
+};
+
+/*
+ * The Receive ring, one per rx queue
+ */
+struct rx_ring {
+ struct adapter *adapter;
+ u32 me;
+ u32 msix;
+ u32 ims;
+ struct mtx rx_mtx;
+ char mtx_name[16];
+ u32 payload;
+ struct task rx_task;
+ struct taskqueue *tq;
+ struct e1000_rx_desc *rx_base;
+ struct em_dma_alloc rxdma;
+ unsigned int next_to_refresh;
+ unsigned int next_to_check;
+ struct em_buffer *rx_buffers;
+ struct mbuf *fmp;
+ struct mbuf *lmp;
+
+ /* Interrupt resources */
+ void *tag;
+ struct resource *res;
+ bus_dma_tag_t rxtag;
+ bus_dmamap_t rx_sparemap;
+
+ /* Soft stats */
+ u64 rx_irq;
+ u64 rx_packets;
+ u64 rx_bytes;
+};
+
+
/* Our adapter structure */
struct adapter {
struct ifnet *ifp;
-#if __FreeBSD_version >= 800000
- struct buf_ring *br;
-#endif
struct e1000_hw hw;
/* FreeBSD operating-system-specific structures. */
@@ -296,42 +340,50 @@ struct adapter {
struct resource *memory;
struct resource *flash;
- struct resource *msix;
+ struct resource *msix_mem;
- struct resource *ioport;
- int io_rid;
-
- /* 82574 may use 3 int vectors */
- struct resource *res[3];
- void *tag[3];
- int rid[3];
+ struct resource *res;
+ void *tag;
+ u32 linkvec;
+ u32 ivars;
struct ifmedia media;
struct callout timer;
- struct callout tx_fifo_timer;
- bool watchdog_check;
- int watchdog_time;
- int msi;
+ int msix;
int if_flags;
int max_frame_size;
int min_frame_size;
struct mtx core_mtx;
- struct mtx tx_mtx;
- struct mtx rx_mtx;
int em_insert_vlan_header;
+ u32 ims;
+ bool in_detach;
/* Task for FAST handling */
struct task link_task;
- struct task rxtx_task;
- struct task rx_task;
- struct task tx_task;
+ struct task que_task;
struct taskqueue *tq; /* private task queue */
-#if __FreeBSD_version >= 700029
eventhandler_tag vlan_attach;
eventhandler_tag vlan_detach;
- u32 num_vlans;
-#endif
+
+ u16 num_vlans;
+ u16 num_queues;
+
+ /*
+ * Transmit rings:
+ * Allocated at run time, an array of rings.
+ */
+ struct tx_ring *tx_rings;
+ int num_tx_desc;
+ u32 txd_cmd;
+
+ /*
+ * Receive rings:
+ * Allocated at run time, an array of rings.
+ */
+ struct rx_ring *rx_rings;
+ int num_rx_desc;
+ u32 rx_process_limit;
/* Management and WOL features */
u32 wol;
@@ -348,96 +400,26 @@ struct adapter {
struct em_int_delay_info rx_int_delay;
struct em_int_delay_info rx_abs_int_delay;
- /*
- * Transmit definitions
- *
- * We have an array of num_tx_desc descriptors (handled
- * by the controller) paired with an array of tx_buffers
- * (at tx_buffer_area).
- * The index of the next available descriptor is next_avail_tx_desc.
- * The number of remaining tx_desc is num_tx_desc_avail.
- */
- struct em_dma_alloc txdma; /* bus_dma glue for tx desc */
- struct e1000_tx_desc *tx_desc_base;
- uint32_t next_avail_tx_desc;
- uint32_t next_tx_to_clean;
- volatile uint16_t num_tx_desc_avail;
- uint16_t num_tx_desc;
- uint16_t last_hw_offload;
- uint32_t txd_cmd;
- struct em_buffer *tx_buffer_area;
- bus_dma_tag_t txtag; /* dma tag for tx */
- uint32_t tx_tso; /* last tx was tso */
-
- /*
- * Receive definitions
- *
- * we have an array of num_rx_desc rx_desc (handled by the
- * controller), and paired with an array of rx_buffers
- * (at rx_buffer_area).
- * The next pair to check on receive is at offset next_rx_desc_to_check
- */
- struct em_dma_alloc rxdma; /* bus_dma glue for rx desc */
- struct e1000_rx_desc *rx_desc_base;
- uint32_t next_rx_desc_to_check;
- uint32_t rx_buffer_len;
- uint16_t num_rx_desc;
- int rx_process_limit;
- struct em_buffer *rx_buffer_area;
- bus_dma_tag_t rxtag;
- bus_dmamap_t rx_sparemap;
-
- /*
- * First/last mbuf pointers, for
- * collecting multisegment RX packets.
- */
- struct mbuf *fmp;
- struct mbuf *lmp;
-
/* Misc stats maintained by the driver */
unsigned long dropped_pkts;
unsigned long mbuf_alloc_failed;
unsigned long mbuf_cluster_failed;
- unsigned long no_tx_desc_avail1;
- unsigned long no_tx_desc_avail2;
unsigned long no_tx_map_avail;
unsigned long no_tx_dma_setup;
- unsigned long watchdog_events;
unsigned long rx_overruns;
- unsigned long rx_irq;
- unsigned long tx_irq;
+ unsigned long watchdog_events;
unsigned long link_irq;
- /* 82547 workaround */
- uint32_t tx_fifo_size;
- uint32_t tx_fifo_head;
- uint32_t tx_fifo_head_addr;
- uint64_t tx_fifo_reset_cnt;
- uint64_t tx_fifo_wrk_cnt;
- uint32_t tx_head_addr;
-
- /* For 82544 PCIX Workaround */
- boolean_t pcix_82544;
- boolean_t in_detach;
-
-#ifdef EM_IEEE1588
- /* IEEE 1588 precision time support */
- struct cyclecounter cycles;
- struct nettimer clock;
- struct nettime_compare compare;
- struct hwtstamp_ctrl hwtstamp;
-#endif
-
struct e1000_hw_stats stats;
};
-/* ******************************************************************************
+/********************************************************************************
* vendor_info_array
*
* This array contains the list of Subvendor/Subdevice IDs on which the driver
* should load.
*
- * ******************************************************************************/
+ ********************************************************************************/
typedef struct _em_vendor_info_t {
unsigned int vendor_id;
unsigned int device_id;
@@ -452,19 +434,6 @@ struct em_buffer {
bus_dmamap_t map; /* bus_dma map for packet */
};
-/* For 82544 PCIX Workaround */
-typedef struct _ADDRESS_LENGTH_PAIR
-{
- uint64_t address;
- uint32_t length;
-} ADDRESS_LENGTH_PAIR, *PADDRESS_LENGTH_PAIR;
-
-typedef struct _DESCRIPTOR_PAIR
-{
- ADDRESS_LENGTH_PAIR descriptor[4];
- uint32_t elements;
-} DESC_ARRAY, *PDESC_ARRAY;
-
#define EM_CORE_LOCK_INIT(_sc, _name) \
mtx_init(&(_sc)->core_mtx, _name, "EM Core Lock", MTX_DEF)
#define EM_TX_LOCK_INIT(_sc, _name) \
OpenPOWER on IntegriCloud