aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igc/igc.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/intel/igc/igc.h')
-rw-r--r--drivers/net/ethernet/intel/igc/igc.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/igc/igc.h b/drivers/net/ethernet/intel/igc/igc.h
index 7bb19328b899..88ee451e36fd 100644
--- a/drivers/net/ethernet/intel/igc/igc.h
+++ b/drivers/net/ethernet/intel/igc/igc.h
@@ -32,13 +32,31 @@ extern char igc_driver_version[];
32#define IGC_START_ITR 648 /* ~6000 ints/sec */ 32#define IGC_START_ITR 648 /* ~6000 ints/sec */
33#define IGC_FLAG_HAS_MSI BIT(0) 33#define IGC_FLAG_HAS_MSI BIT(0)
34#define IGC_FLAG_QUEUE_PAIRS BIT(4) 34#define IGC_FLAG_QUEUE_PAIRS BIT(4)
35#define IGC_FLAG_NEED_LINK_UPDATE BIT(9)
35#define IGC_FLAG_HAS_MSIX BIT(13) 36#define IGC_FLAG_HAS_MSIX BIT(13)
37#define IGC_FLAG_VLAN_PROMISC BIT(15)
36 38
37#define IGC_START_ITR 648 /* ~6000 ints/sec */ 39#define IGC_START_ITR 648 /* ~6000 ints/sec */
38#define IGC_4K_ITR 980 40#define IGC_4K_ITR 980
39#define IGC_20K_ITR 196 41#define IGC_20K_ITR 196
40#define IGC_70K_ITR 56 42#define IGC_70K_ITR 56
41 43
44#define IGC_DEFAULT_ITR 3 /* dynamic */
45#define IGC_MAX_ITR_USECS 10000
46#define IGC_MIN_ITR_USECS 10
47#define NON_Q_VECTORS 1
48#define MAX_MSIX_ENTRIES 10
49
50/* TX/RX descriptor defines */
51#define IGC_DEFAULT_TXD 256
52#define IGC_DEFAULT_TX_WORK 128
53#define IGC_MIN_TXD 80
54#define IGC_MAX_TXD 4096
55
56#define IGC_DEFAULT_RXD 256
57#define IGC_MIN_RXD 80
58#define IGC_MAX_RXD 4096
59
42/* Transmit and receive queues */ 60/* Transmit and receive queues */
43#define IGC_MAX_RX_QUEUES 4 61#define IGC_MAX_RX_QUEUES 4
44#define IGC_MAX_TX_QUEUES 4 62#define IGC_MAX_TX_QUEUES 4
@@ -85,6 +103,16 @@ extern char igc_driver_version[];
85#define IGC_MAX_FRAME_BUILD_SKB (IGC_RXBUFFER_2048 - IGC_TS_HDR_LEN) 103#define IGC_MAX_FRAME_BUILD_SKB (IGC_RXBUFFER_2048 - IGC_TS_HDR_LEN)
86#endif 104#endif
87 105
106/* How many Rx Buffers do we bundle into one write to the hardware ? */
107#define IGC_RX_BUFFER_WRITE 16 /* Must be power of 2 */
108
109/* igc_test_staterr - tests bits within Rx descriptor status and error fields */
110static inline __le32 igc_test_staterr(union igc_adv_rx_desc *rx_desc,
111 const u32 stat_err_bits)
112{
113 return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
114}
115
88enum igc_state_t { 116enum igc_state_t {
89 __IGC_TESTING, 117 __IGC_TESTING,
90 __IGC_RESETTING, 118 __IGC_RESETTING,
@@ -92,6 +120,27 @@ enum igc_state_t {
92 __IGC_PTP_TX_IN_PROGRESS, 120 __IGC_PTP_TX_IN_PROGRESS,
93}; 121};
94 122
123enum igc_tx_flags {
124 /* cmd_type flags */
125 IGC_TX_FLAGS_VLAN = 0x01,
126 IGC_TX_FLAGS_TSO = 0x02,
127 IGC_TX_FLAGS_TSTAMP = 0x04,
128
129 /* olinfo flags */
130 IGC_TX_FLAGS_IPV4 = 0x10,
131 IGC_TX_FLAGS_CSUM = 0x20,
132};
133
134/* The largest size we can write to the descriptor is 65535. In order to
135 * maintain a power of two alignment we have to limit ourselves to 32K.
136 */
137#define IGC_MAX_TXD_PWR 15
138#define IGC_MAX_DATA_PER_TXD BIT(IGC_MAX_TXD_PWR)
139
140/* Tx Descriptors needed, worst case */
141#define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGC_MAX_DATA_PER_TXD)
142#define DESC_NEEDED (MAX_SKB_FRAGS + 4)
143
95/* wrapper around a pointer to a socket buffer, 144/* wrapper around a pointer to a socket buffer,
96 * so a DMA handle can be stored along with the buffer 145 * so a DMA handle can be stored along with the buffer
97 */ 146 */
@@ -123,6 +172,7 @@ struct igc_tx_queue_stats {
123 u64 packets; 172 u64 packets;
124 u64 bytes; 173 u64 bytes;
125 u64 restart_queue; 174 u64 restart_queue;
175 u64 restart_queue2;
126}; 176};
127 177
128struct igc_rx_queue_stats { 178struct igc_rx_queue_stats {
@@ -181,11 +231,14 @@ struct igc_ring {
181 /* TX */ 231 /* TX */
182 struct { 232 struct {
183 struct igc_tx_queue_stats tx_stats; 233 struct igc_tx_queue_stats tx_stats;
234 struct u64_stats_sync tx_syncp;
235 struct u64_stats_sync tx_syncp2;
184 }; 236 };
185 /* RX */ 237 /* RX */
186 struct { 238 struct {
187 struct igc_rx_queue_stats rx_stats; 239 struct igc_rx_queue_stats rx_stats;
188 struct igc_rx_packet_stats pkt_stats; 240 struct igc_rx_packet_stats pkt_stats;
241 struct u64_stats_sync rx_syncp;
189 struct sk_buff *skb; 242 struct sk_buff *skb;
190 }; 243 };
191 }; 244 };
@@ -258,11 +311,17 @@ struct igc_adapter {
258 struct work_struct watchdog_task; 311 struct work_struct watchdog_task;
259 struct work_struct dma_err_task; 312 struct work_struct dma_err_task;
260 313
314 u8 tx_timeout_factor;
315
261 int msg_enable; 316 int msg_enable;
262 u32 max_frame_size; 317 u32 max_frame_size;
318 u32 min_frame_size;
263 319
264 /* OS defined structs */ 320 /* OS defined structs */
265 struct pci_dev *pdev; 321 struct pci_dev *pdev;
322 /* lock for statistics */
323 spinlock_t stats64_lock;
324 struct rtnl_link_stats64 stats64;
266 325
267 /* structs defined in igc_hw.h */ 326 /* structs defined in igc_hw.h */
268 struct igc_hw hw; 327 struct igc_hw hw;
@@ -275,8 +334,13 @@ struct igc_adapter {
275 u16 tx_ring_count; 334 u16 tx_ring_count;
276 u16 rx_ring_count; 335 u16 rx_ring_count;
277 336
337 u32 *shadow_vfta;
338
278 u32 rss_queues; 339 u32 rss_queues;
279 340
341 /* lock for RX network flow classification filter */
342 spinlock_t nfc_lock;
343
280 struct igc_mac_addr *mac_table; 344 struct igc_mac_addr *mac_table;
281}; 345};
282 346
@@ -332,6 +396,8 @@ static inline unsigned int igc_rx_pg_order(struct igc_ring *ring)
332 396
333#define igc_rx_pg_size(_ring) (PAGE_SIZE << igc_rx_pg_order(_ring)) 397#define igc_rx_pg_size(_ring) (PAGE_SIZE << igc_rx_pg_order(_ring))
334 398
399#define IGC_TXD_DCMD (IGC_ADVTXD_DCMD_EOP | IGC_ADVTXD_DCMD_RS)
400
335#define IGC_RX_DESC(R, i) \ 401#define IGC_RX_DESC(R, i) \
336 (&(((union igc_adv_rx_desc *)((R)->desc))[i])) 402 (&(((union igc_adv_rx_desc *)((R)->desc))[i]))
337#define IGC_TX_DESC(R, i) \ 403#define IGC_TX_DESC(R, i) \