@@ -32,13 +32,31 @@ extern char igc_driver_version[];
3232#define IGC_START_ITR 648 /* ~6000 ints/sec */
3333#define IGC_FLAG_HAS_MSI BIT(0)
3434#define IGC_FLAG_QUEUE_PAIRS BIT(4)
35+ #define IGC_FLAG_NEED_LINK_UPDATE BIT(9)
3536#define IGC_FLAG_HAS_MSIX BIT(13)
37+ #define IGC_FLAG_VLAN_PROMISC BIT(15)
3638
3739#define IGC_START_ITR 648 /* ~6000 ints/sec */
3840#define IGC_4K_ITR 980
3941#define IGC_20K_ITR 196
4042#define IGC_70K_ITR 56
4143
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+
4260/* Transmit and receive queues */
4361#define IGC_MAX_RX_QUEUES 4
4462#define IGC_MAX_TX_QUEUES 4
@@ -85,13 +103,44 @@ extern char igc_driver_version[];
85103#define IGC_MAX_FRAME_BUILD_SKB (IGC_RXBUFFER_2048 - IGC_TS_HDR_LEN)
86104#endif
87105
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 */
110+ static 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+
88116enum igc_state_t {
89117 __IGC_TESTING ,
90118 __IGC_RESETTING ,
91119 __IGC_DOWN ,
92120 __IGC_PTP_TX_IN_PROGRESS ,
93121};
94122
123+ enum 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+
95144/* wrapper around a pointer to a socket buffer,
96145 * so a DMA handle can be stored along with the buffer
97146 */
@@ -123,6 +172,7 @@ struct igc_tx_queue_stats {
123172 u64 packets ;
124173 u64 bytes ;
125174 u64 restart_queue ;
175+ u64 restart_queue2 ;
126176};
127177
128178struct igc_rx_queue_stats {
@@ -181,11 +231,14 @@ struct igc_ring {
181231 /* TX */
182232 struct {
183233 struct igc_tx_queue_stats tx_stats ;
234+ struct u64_stats_sync tx_syncp ;
235+ struct u64_stats_sync tx_syncp2 ;
184236 };
185237 /* RX */
186238 struct {
187239 struct igc_rx_queue_stats rx_stats ;
188240 struct igc_rx_packet_stats pkt_stats ;
241+ struct u64_stats_sync rx_syncp ;
189242 struct sk_buff * skb ;
190243 };
191244 };
@@ -258,11 +311,17 @@ struct igc_adapter {
258311 struct work_struct watchdog_task ;
259312 struct work_struct dma_err_task ;
260313
314+ u8 tx_timeout_factor ;
315+
261316 int msg_enable ;
262317 u32 max_frame_size ;
318+ u32 min_frame_size ;
263319
264320 /* OS defined structs */
265321 struct pci_dev * pdev ;
322+ /* lock for statistics */
323+ spinlock_t stats64_lock ;
324+ struct rtnl_link_stats64 stats64 ;
266325
267326 /* structs defined in igc_hw.h */
268327 struct igc_hw hw ;
@@ -275,8 +334,13 @@ struct igc_adapter {
275334 u16 tx_ring_count ;
276335 u16 rx_ring_count ;
277336
337+ u32 * shadow_vfta ;
338+
278339 u32 rss_queues ;
279340
341+ /* lock for RX network flow classification filter */
342+ spinlock_t nfc_lock ;
343+
280344 struct igc_mac_addr * mac_table ;
281345};
282346
@@ -332,6 +396,8 @@ static inline unsigned int igc_rx_pg_order(struct igc_ring *ring)
332396
333397#define igc_rx_pg_size (_ring ) (PAGE_SIZE << igc_rx_pg_order(_ring))
334398
399+ #define IGC_TXD_DCMD (IGC_ADVTXD_DCMD_EOP | IGC_ADVTXD_DCMD_RS)
400+
335401#define IGC_RX_DESC (R , i ) \
336402 (&(((union igc_adv_rx_desc *)((R)->desc))[i]))
337403#define IGC_TX_DESC (R , i ) \
0 commit comments