#define AUTONEG_ADVERTISE_SPEED_DEFAULT 0x002F /* All but 1000-Half */
#define MAX_JUMBO_FRAME_SIZE 10240
#define ATL1_EEDUMP_LEN 48
/* Statistics counters collected by the MAC */ struct stats_msg_block { /* rx */
u32 rx_ok; /* good RX packets */
u32 rx_bcast; /* good RX broadcast packets */
u32 rx_mcast; /* good RX multicast packets */
u32 rx_pause; /* RX pause frames */
u32 rx_ctrl; /* RX control packets other than pause frames */
u32 rx_fcs_err; /* RX packets with bad FCS */
u32 rx_len_err; /* RX packets with length != actual size */
u32 rx_byte_cnt; /* good bytes received. FCS is NOT included */
u32 rx_runt; /* RX packets < 64 bytes with good FCS */
u32 rx_frag; /* RX packets < 64 bytes with bad FCS */
u32 rx_sz_64; /* 64 byte RX packets */
u32 rx_sz_65_127;
u32 rx_sz_128_255;
u32 rx_sz_256_511;
u32 rx_sz_512_1023;
u32 rx_sz_1024_1518;
u32 rx_sz_1519_max; /* 1519 byte to MTU RX packets */
u32 rx_sz_ov; /* truncated RX packets > MTU */
u32 rx_rxf_ov; /* frames dropped due to RX FIFO overflow */
u32 rx_rrd_ov; /* frames dropped due to RRD overflow */
u32 rx_align_err; /* alignment errors */
u32 rx_bcast_byte_cnt; /* RX broadcast bytes, excluding FCS */
u32 rx_mcast_byte_cnt; /* RX multicast bytes, excluding FCS */
u32 rx_err_addr; /* packets dropped due to address filtering */
/* tx */
u32 tx_ok; /* good TX packets */
u32 tx_bcast; /* good TX broadcast packets */
u32 tx_mcast; /* good TX multicast packets */
u32 tx_pause; /* TX pause frames */
u32 tx_exc_defer; /* TX packets deferred excessively */
u32 tx_ctrl; /* TX control frames, excluding pause frames */
u32 tx_defer; /* TX packets deferred */
u32 tx_byte_cnt; /* bytes transmitted, FCS is NOT included */
u32 tx_sz_64; /* 64 byte TX packets */
u32 tx_sz_65_127;
u32 tx_sz_128_255;
u32 tx_sz_256_511;
u32 tx_sz_512_1023;
u32 tx_sz_1024_1518;
u32 tx_sz_1519_max; /* 1519 byte to MTU TX packets */
u32 tx_1_col; /* packets TX after a single collision */
u32 tx_2_col; /* packets TX after multiple collisions */
u32 tx_late_col; /* TX packets with late collisions */
u32 tx_abort_col; /* TX packets aborted w/excessive collisions */
u32 tx_underrun; /* TX packets aborted due to TX FIFO underrun
* or TRD FIFO underrun */
u32 tx_rd_eop; /* reads beyond the EOP into the next frame
* when TRD was not written timely */
u32 tx_len_err; /* TX packets where length != actual size */
u32 tx_trunc; /* TX packets truncated due to size > MTU */
u32 tx_bcast_byte; /* broadcast bytes transmitted, excluding FCS */
u32 tx_mcast_byte; /* multicast bytes transmitted, excluding FCS */
u32 smb_updated; /* 1: SMB Updated. This is used by software to * indicate the statistics update. Software * should clear this bit after retrieving the
* statistics information. */
};
/* Coalescing Message Block */ struct coals_msg_block {
u32 int_stats; /* interrupt status */
u16 rrd_prod_idx; /* TRD Producer Index. */
u16 rfd_cons_idx; /* RFD Consumer Index. */
u16 update; /* Selene sets this bit every time it DMAs the * CMB to host memory. Software should clear
* this bit when CMB info is processed. */
u16 tpd_cons_idx; /* TPD Consumer Index. */
};
/* RRD descriptor */ struct rx_return_desc {
u8 num_buf; /* Number of RFD buffers used by the received packet */
u8 resved;
u16 buf_indx; /* RFD Index of the first buffer */ union {
u32 valid; struct {
u16 rx_chksum;
u16 pkt_size;
} xsum_sz;
} xsz;
/* RFD descriptor */ struct rx_free_desc {
__le64 buffer_addr; /* Address of the descriptor's data buffer */
__le16 buf_len; /* Size of the receive buffer in host memory */
u16 coalese; /* Update consumer index to host after the
* reception of this frame */ /* __packed is required */
} __packed;
/* * The L1 transmit packet descriptor is comprised of four 32-bit words. * * 31 0 * +---------------------------------------+ * | Word 0: Buffer addr lo | * +---------------------------------------+ * | Word 1: Buffer addr hi | * +---------------------------------------+ * | Word 2 | * +---------------------------------------+ * | Word 3 | * +---------------------------------------+ * * Words 0 and 1 combine to form a 64-bit buffer address. * * Word 2 is self explanatory in the #define block below. * * Word 3 has two forms, depending upon the state of bits 3 and 4. * If bits 3 and 4 are both zero, then bits 14:31 are unused by the * hardware. Otherwise, if either bit 3 or 4 is set, the definition * of bits 14:31 vary according to the following depiction. * * 0 End of packet 0 End of packet * 1 Coalesce 1 Coalesce * 2 Insert VLAN tag 2 Insert VLAN tag * 3 Custom csum enable = 0 3 Custom csum enable = 1 * 4 Segment enable = 1 4 Segment enable = 0 * 5 Generate IP checksum 5 Generate IP checksum * 6 Generate TCP checksum 6 Generate TCP checksum * 7 Generate UDP checksum 7 Generate UDP checksum * 8 VLAN tagged 8 VLAN tagged * 9 Ethernet frame type 9 Ethernet frame type * 10-+ 10-+ * 11 | IP hdr length (10:13) 11 | IP hdr length (10:13) * 12 | (num 32-bit words) 12 | (num 32-bit words) * 13-+ 13-+ * 14-+ 14 Unused * 15 | TCP hdr length (14:17) 15 Unused * 16 | (num 32-bit words) 16-+ * 17-+ 17 | * 18 Header TPD flag 18 | * 19-+ 19 | Payload offset * 20 | 20 | (16:23) * 21 | 21 | * 22 | 22 | * 23 | 23-+ * 24 | 24-+ * 25 | MSS (19:31) 25 | * 26 | 26 | * 27 | 27 | Custom csum offset * 28 | 28 | (24:31) * 29 | 29 | * 30 | 30 | * 31-+ 31-+
*/
#define ATL1_GET_DESC(R, i, type) (&(((type *)((R)->desc))[i])) #define ATL1_RFD_DESC(R, i) ATL1_GET_DESC(R, i, struct rx_free_desc) #define ATL1_TPD_DESC(R, i) ATL1_GET_DESC(R, i, struct tx_packet_desc) #define ATL1_RRD_DESC(R, i) ATL1_GET_DESC(R, i, struct rx_return_desc)
/* * atl1_ring_header represents a single, contiguous block of DMA space * mapped for the three descriptor rings (tpd, rfd, rrd) and the two * message blocks (cmb, smb) described below
*/ struct atl1_ring_header { void *desc; /* virtual address */
dma_addr_t dma; /* physical address*/ unsignedint size; /* length in bytes */
};
/* * atl1_buffer is wrapper around a pointer to a socket buffer * so a DMA handle can be stored along with the skb
*/ struct atl1_buffer { struct sk_buff *skb; /* socket buffer */
u16 length; /* rx buffer length */
u16 alloced; /* 1 if skb allocated */
dma_addr_t dma;
};
/* transmit packet descriptor (tpd) ring */ struct atl1_tpd_ring { void *desc; /* descriptor ring virtual address */
dma_addr_t dma; /* descriptor ring physical address */
u16 size; /* descriptor ring length in bytes */
u16 count; /* number of descriptors in the ring */
u16 hw_idx; /* hardware index */
atomic_t next_to_clean;
atomic_t next_to_use; struct atl1_buffer *buffer_info;
};
/* receive free descriptor (rfd) ring */ struct atl1_rfd_ring { void *desc; /* descriptor ring virtual address */
dma_addr_t dma; /* descriptor ring physical address */
u16 size; /* descriptor ring length in bytes */
u16 count; /* number of descriptors in the ring */
atomic_t next_to_use;
u16 next_to_clean; struct atl1_buffer *buffer_info;
};
/* receive return descriptor (rrd) ring */ struct atl1_rrd_ring { void *desc; /* descriptor ring virtual address */
dma_addr_t dma; /* descriptor ring physical address */ unsignedint size; /* descriptor ring length in bytes */
u16 count; /* number of descriptors in the ring */
u16 next_to_use;
atomic_t next_to_clean;
};
/* hardware structure */ struct atl1_hw {
u8 __iomem *hw_addr; struct atl1_adapter *back; enum atl1_dma_order dma_ord; enum atl1_dma_rcb rcb_value; enum atl1_dma_req_block dmar_block; enum atl1_dma_req_block dmaw_block;
u8 preamble_len;
u8 max_retry;
u8 jam_ipg; /* IPG to start JAM for collision based flow * control in half-duplex mode. In units of
* 8-bit time */
u8 ipgt; /* Desired back to back inter-packet gap.
* The default is 96-bit time */
u8 min_ifg; /* Minimum number of IFG to enforce in between * receive frames. Frame gap below such IFP
* is dropped */
u8 ipgr1; /* 64bit Carrier-Sense window */
u8 ipgr2; /* 96-bit IPG window */
u8 tpd_burst; /* Number of TPD to prefetch in cache-aligned
* burst. Each TPD is 16 bytes long */
u8 rfd_burst; /* Number of RFD to prefetch in cache-aligned
* burst. Each RFD is 12 bytes long */
u8 rfd_fetch_gap;
u8 rrd_burst; /* Threshold number of RRDs that can be retired
* in a burst. Each RRD is 16 bytes long */
u8 tpd_fetch_th;
u8 tpd_fetch_gap;
u16 tx_jumbo_task_th;
u16 txf_burst; /* Number of data bytes to read in a cache-
* aligned burst. Each SRAM entry is 8 bytes */
u16 rx_jumbo_th; /* Jumbo packet size for non-VLAN packet. VLAN
* packets should add 4 bytes */
u16 rx_jumbo_lkah;
u16 rrd_ret_timer; /* RRD retirement timer. Decrement by 1 after
* every 512ns passes. */
u16 lcol; /* Collision Window */
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.