28
28
extern char igc_driver_name [];
29
29
extern char igc_driver_version [];
30
30
31
+ /* Interrupt defines */
32
+ #define IGC_START_ITR 648 /* ~6000 ints/sec */
33
+ #define IGC_FLAG_HAS_MSI BIT(0)
34
+ #define IGC_FLAG_QUEUE_PAIRS BIT(4)
35
+ #define IGC_FLAG_HAS_MSIX BIT(13)
36
+
37
+ #define IGC_START_ITR 648 /* ~6000 ints/sec */
38
+ #define IGC_4K_ITR 980
39
+ #define IGC_20K_ITR 196
40
+ #define IGC_70K_ITR 56
41
+
31
42
/* Transmit and receive queues */
32
43
#define IGC_MAX_RX_QUEUES 4
33
44
#define IGC_MAX_TX_QUEUES 4
@@ -42,10 +53,96 @@ enum igc_state_t {
42
53
__IGC_PTP_TX_IN_PROGRESS ,
43
54
};
44
55
56
+ struct igc_tx_queue_stats {
57
+ u64 packets ;
58
+ u64 bytes ;
59
+ u64 restart_queue ;
60
+ };
61
+
62
+ struct igc_rx_queue_stats {
63
+ u64 packets ;
64
+ u64 bytes ;
65
+ u64 drops ;
66
+ u64 csum_err ;
67
+ u64 alloc_failed ;
68
+ };
69
+
70
+ struct igc_rx_packet_stats {
71
+ u64 ipv4_packets ; /* IPv4 headers processed */
72
+ u64 ipv4e_packets ; /* IPv4E headers with extensions processed */
73
+ u64 ipv6_packets ; /* IPv6 headers processed */
74
+ u64 ipv6e_packets ; /* IPv6E headers with extensions processed */
75
+ u64 tcp_packets ; /* TCP headers processed */
76
+ u64 udp_packets ; /* UDP headers processed */
77
+ u64 sctp_packets ; /* SCTP headers processed */
78
+ u64 nfs_packets ; /* NFS headers processe */
79
+ u64 other_packets ;
80
+ };
81
+
82
+ struct igc_ring_container {
83
+ struct igc_ring * ring ; /* pointer to linked list of rings */
84
+ unsigned int total_bytes ; /* total bytes processed this int */
85
+ unsigned int total_packets ; /* total packets processed this int */
86
+ u16 work_limit ; /* total work allowed per interrupt */
87
+ u8 count ; /* total number of rings in vector */
88
+ u8 itr ; /* current ITR setting for ring */
89
+ };
90
+
91
+ struct igc_ring {
92
+ struct igc_q_vector * q_vector ; /* backlink to q_vector */
93
+ struct net_device * netdev ; /* back pointer to net_device */
94
+ struct device * dev ; /* device for dma mapping */
95
+ union { /* array of buffer info structs */
96
+ struct igc_tx_buffer * tx_buffer_info ;
97
+ struct igc_rx_buffer * rx_buffer_info ;
98
+ };
99
+ void * desc ; /* descriptor ring memory */
100
+ unsigned long flags ; /* ring specific flags */
101
+ void __iomem * tail ; /* pointer to ring tail register */
102
+ dma_addr_t dma ; /* phys address of the ring */
103
+ unsigned int size ; /* length of desc. ring in bytes */
104
+
105
+ u16 count ; /* number of desc. in the ring */
106
+ u8 queue_index ; /* logical index of the ring*/
107
+ u8 reg_idx ; /* physical index of the ring */
108
+
109
+ /* everything past this point are written often */
110
+ u16 next_to_clean ;
111
+ u16 next_to_use ;
112
+ u16 next_to_alloc ;
113
+
114
+ union {
115
+ /* TX */
116
+ struct {
117
+ struct igc_tx_queue_stats tx_stats ;
118
+ };
119
+ /* RX */
120
+ struct {
121
+ struct igc_rx_queue_stats rx_stats ;
122
+ struct igc_rx_packet_stats pkt_stats ;
123
+ struct sk_buff * skb ;
124
+ };
125
+ };
126
+ } ____cacheline_internodealigned_in_smp ;
127
+
45
128
struct igc_q_vector {
46
129
struct igc_adapter * adapter ; /* backlink */
130
+ void __iomem * itr_register ;
131
+ u32 eims_value ; /* EIMS mask value */
132
+
133
+ u16 itr_val ;
134
+ u8 set_itr ;
135
+
136
+ struct igc_ring_container rx , tx ;
47
137
48
138
struct napi_struct napi ;
139
+
140
+ struct rcu_head rcu ; /* to avoid race with update stats on free */
141
+ char name [IFNAMSIZ + 9 ];
142
+ struct net_device poll_dev ;
143
+
144
+ /* for dynamic allocation of rings associated with this q_vector */
145
+ struct igc_ring ring [0 ] ____cacheline_internodealigned_in_smp ;
49
146
};
50
147
51
148
struct igc_mac_addr {
@@ -65,13 +162,35 @@ struct igc_adapter {
65
162
unsigned long state ;
66
163
unsigned int flags ;
67
164
unsigned int num_q_vectors ;
165
+
166
+ struct msix_entry * msix_entries ;
167
+
168
+ /* TX */
169
+ u16 tx_work_limit ;
170
+ int num_tx_queues ;
171
+ struct igc_ring * tx_ring [IGC_MAX_TX_QUEUES ];
172
+
173
+ /* RX */
174
+ int num_rx_queues ;
175
+ struct igc_ring * rx_ring [IGC_MAX_RX_QUEUES ];
176
+
177
+ struct timer_list watchdog_timer ;
178
+ struct timer_list dma_err_timer ;
179
+ struct timer_list phy_info_timer ;
180
+
68
181
u16 link_speed ;
69
182
u16 link_duplex ;
70
183
71
184
u8 port_num ;
72
185
73
186
u8 __iomem * io_addr ;
187
+ /* Interrupt Throttle Rate */
188
+ u32 rx_itr_setting ;
189
+ u32 tx_itr_setting ;
190
+
191
+ struct work_struct reset_task ;
74
192
struct work_struct watchdog_task ;
193
+ struct work_struct dma_err_task ;
75
194
76
195
int msg_enable ;
77
196
u32 max_frame_size ;
@@ -81,8 +200,16 @@ struct igc_adapter {
81
200
82
201
/* structs defined in igc_hw.h */
83
202
struct igc_hw hw ;
203
+ struct igc_hw_stats stats ;
84
204
85
205
struct igc_q_vector * q_vector [MAX_Q_VECTORS ];
206
+ u32 eims_enable_mask ;
207
+ u32 eims_other ;
208
+
209
+ u16 tx_ring_count ;
210
+ u16 rx_ring_count ;
211
+
212
+ u32 rss_queues ;
86
213
87
214
struct igc_mac_addr * mac_table ;
88
215
};
0 commit comments