blob: 65cda344eec92ab0fbca7f9b5e18b259c555a8c0 [file] [log] [blame]
Greg Rose92915f72010-01-09 02:24:10 +00001/*******************************************************************************
2
3 Intel 82599 Virtual Function driver
Mark Rustad2e7cfbd2014-03-04 03:02:13 +00004 Copyright(c) 1999 - 2014 Intel Corporation.
Greg Rose92915f72010-01-09 02:24:10 +00005
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
23 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
24 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
25
26*******************************************************************************/
27
28#ifndef _IXGBEVF_H_
29#define _IXGBEVF_H_
30
31#include <linux/types.h>
Jiri Pirkodadcd652011-07-21 03:25:09 +000032#include <linux/bitops.h>
Greg Rose92915f72010-01-09 02:24:10 +000033#include <linux/timer.h>
34#include <linux/io.h>
35#include <linux/netdevice.h>
Jiri Pirkodadcd652011-07-21 03:25:09 +000036#include <linux/if_vlan.h>
Eric Dumazet4197aa72011-06-22 05:01:35 +000037#include <linux/u64_stats_sync.h>
Greg Rose92915f72010-01-09 02:24:10 +000038
39#include "vf.h"
40
Jacob Kellerc777cdf2013-09-21 06:24:20 +000041#ifdef CONFIG_NET_RX_BUSY_POLL
42#include <net/busy_poll.h>
Jacob Keller3b5dca22013-09-21 06:24:25 +000043#define BP_EXTENDED_STATS
Jacob Kellerc777cdf2013-09-21 06:24:20 +000044#endif
45
Greg Rose92915f72010-01-09 02:24:10 +000046/* wrapper around a pointer to a socket buffer,
47 * so a DMA handle can be stored along with the buffer */
48struct ixgbevf_tx_buffer {
Alexander Duycke757e3e2013-01-31 07:43:22 +000049 union ixgbe_adv_tx_desc *next_to_watch;
Emil Tantilov7ad1a092014-01-17 18:30:03 -080050 unsigned long time_stamp;
51 struct sk_buff *skb;
52 unsigned int bytecount;
53 unsigned short gso_segs;
54 __be16 protocol;
Emil Tantilov9bdfefd2014-01-17 18:30:04 -080055 DEFINE_DMA_UNMAP_ADDR(dma);
56 DEFINE_DMA_UNMAP_LEN(len);
Emil Tantilov7ad1a092014-01-17 18:30:03 -080057 u32 tx_flags;
Greg Rose92915f72010-01-09 02:24:10 +000058};
59
60struct ixgbevf_rx_buffer {
Greg Rose92915f72010-01-09 02:24:10 +000061 dma_addr_t dma;
Emil Tantilovbad17232014-11-21 02:57:15 +000062 struct page *page;
63 unsigned int page_offset;
Greg Rose92915f72010-01-09 02:24:10 +000064};
65
Emil Tantilov095e2612014-01-17 18:30:00 -080066struct ixgbevf_stats {
67 u64 packets;
68 u64 bytes;
69#ifdef BP_EXTENDED_STATS
70 u64 yields;
71 u64 misses;
72 u64 cleaned;
73#endif
74};
75
76struct ixgbevf_tx_queue_stats {
77 u64 restart_queue;
78 u64 tx_busy;
79 u64 tx_done_old;
80};
81
82struct ixgbevf_rx_queue_stats {
Emil Tantilov095e2612014-01-17 18:30:00 -080083 u64 alloc_rx_page_failed;
84 u64 alloc_rx_buff_failed;
85 u64 csum_err;
86};
87
Greg Rose92915f72010-01-09 02:24:10 +000088struct ixgbevf_ring {
Alexander Duyck6b43c442012-05-11 08:32:45 +000089 struct ixgbevf_ring *next;
Alexander Duyckfb401952012-05-11 08:33:16 +000090 struct net_device *netdev;
91 struct device *dev;
Greg Rose92915f72010-01-09 02:24:10 +000092 void *desc; /* descriptor ring memory */
93 dma_addr_t dma; /* phys. address of descriptor ring */
94 unsigned int size; /* length in bytes */
Emil Tantilovbad17232014-11-21 02:57:15 +000095 u16 count; /* amount of descriptors */
96 u16 next_to_use;
97 u16 next_to_clean;
98 u16 next_to_alloc;
Greg Rose92915f72010-01-09 02:24:10 +000099
Greg Rose92915f72010-01-09 02:24:10 +0000100 union {
101 struct ixgbevf_tx_buffer *tx_buffer_info;
102 struct ixgbevf_rx_buffer *rx_buffer_info;
103 };
104
Emil Tantilov095e2612014-01-17 18:30:00 -0800105 struct ixgbevf_stats stats;
106 struct u64_stats_sync syncp;
107 union {
108 struct ixgbevf_tx_queue_stats tx_stats;
109 struct ixgbevf_rx_queue_stats rx_stats;
110 };
111
Greg Rose55fb2772012-11-06 05:53:32 +0000112 u64 hw_csum_rx_error;
Don Skidmore5cdab2f2013-10-30 07:45:39 +0000113 u8 __iomem *tail;
Emil Tantilovbad17232014-11-21 02:57:15 +0000114 struct sk_buff *skb;
Greg Rose92915f72010-01-09 02:24:10 +0000115
Greg Rose92915f72010-01-09 02:24:10 +0000116 u16 reg_idx; /* holds the special value that gets the hardware register
117 * offset associated with this ring, which is different
118 * for DCB and RSS modes */
Emil Tantilov095e2612014-01-17 18:30:00 -0800119 int queue_index; /* needed for multiqueue queue management */
Greg Rose92915f72010-01-09 02:24:10 +0000120};
121
Greg Rose92915f72010-01-09 02:24:10 +0000122/* How many Rx Buffers do we bundle into one write to the hardware ? */
123#define IXGBEVF_RX_BUFFER_WRITE 16 /* Must be power of 2 */
124
Alexander Duyck56e94092012-07-20 08:10:03 +0000125#define MAX_RX_QUEUES IXGBE_VF_MAX_RX_QUEUES
126#define MAX_TX_QUEUES IXGBE_VF_MAX_TX_QUEUES
Emil Tantilov2dc571a2014-12-06 09:19:02 +0000127#define IXGBEVF_MAX_RSS_QUEUES 2
Greg Rose92915f72010-01-09 02:24:10 +0000128
129#define IXGBEVF_DEFAULT_TXD 1024
130#define IXGBEVF_DEFAULT_RXD 512
131#define IXGBEVF_MAX_TXD 4096
132#define IXGBEVF_MIN_TXD 64
133#define IXGBEVF_MAX_RXD 4096
134#define IXGBEVF_MIN_RXD 64
135
136/* Supported Rx Buffer Sizes */
Greg Rose92915f72010-01-09 02:24:10 +0000137#define IXGBEVF_RXBUFFER_256 256 /* Used for packet split */
Emil Tantilovbad17232014-11-21 02:57:15 +0000138#define IXGBEVF_RXBUFFER_2048 2048
Greg Rose92915f72010-01-09 02:24:10 +0000139
140#define IXGBEVF_RX_HDR_SIZE IXGBEVF_RXBUFFER_256
Emil Tantilovbad17232014-11-21 02:57:15 +0000141#define IXGBEVF_RX_BUFSZ IXGBEVF_RXBUFFER_2048
Greg Rose92915f72010-01-09 02:24:10 +0000142
143#define MAXIMUM_ETHERNET_VLAN_SIZE (VLAN_ETH_FRAME_LEN + ETH_FCS_LEN)
144
145#define IXGBE_TX_FLAGS_CSUM (u32)(1)
146#define IXGBE_TX_FLAGS_VLAN (u32)(1 << 1)
147#define IXGBE_TX_FLAGS_TSO (u32)(1 << 2)
148#define IXGBE_TX_FLAGS_IPV4 (u32)(1 << 3)
Greg Rose92915f72010-01-09 02:24:10 +0000149#define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
150#define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000
151#define IXGBE_TX_FLAGS_VLAN_SHIFT 16
152
Alexander Duyck6b43c442012-05-11 08:32:45 +0000153struct ixgbevf_ring_container {
154 struct ixgbevf_ring *ring; /* pointer to linked list of rings */
Alexander Duyck5f3600e2012-05-11 08:32:55 +0000155 unsigned int total_bytes; /* total bytes processed this int */
156 unsigned int total_packets; /* total packets processed this int */
Alexander Duyck6b43c442012-05-11 08:32:45 +0000157 u8 count; /* total number of rings in vector */
158 u8 itr; /* current ITR setting for ring */
159};
160
161/* iterator for handling rings in ring container */
162#define ixgbevf_for_each_ring(pos, head) \
163 for (pos = (head).ring; pos != NULL; pos = pos->next)
164
Greg Rose92915f72010-01-09 02:24:10 +0000165/* MAX_MSIX_Q_VECTORS of these are allocated,
166 * but we only use one per queue-specific vector.
167 */
168struct ixgbevf_q_vector {
169 struct ixgbevf_adapter *adapter;
Alexander Duyck5f3600e2012-05-11 08:32:55 +0000170 u16 v_idx; /* index of q_vector within array, also used for
171 * finding the bit in EICR and friends that
172 * represents the vector for this ring */
173 u16 itr; /* Interrupt throttle rate written to EITR */
Greg Rose92915f72010-01-09 02:24:10 +0000174 struct napi_struct napi;
Alexander Duyck6b43c442012-05-11 08:32:45 +0000175 struct ixgbevf_ring_container rx, tx;
Alexander Duyckfa71ae22012-05-11 08:32:50 +0000176 char name[IFNAMSIZ + 9];
Jacob Kellerc777cdf2013-09-21 06:24:20 +0000177#ifdef CONFIG_NET_RX_BUSY_POLL
178 unsigned int state;
179#define IXGBEVF_QV_STATE_IDLE 0
180#define IXGBEVF_QV_STATE_NAPI 1 /* NAPI owns this QV */
181#define IXGBEVF_QV_STATE_POLL 2 /* poll owns this QV */
182#define IXGBEVF_QV_STATE_DISABLED 4 /* QV is disabled */
183#define IXGBEVF_QV_OWNED (IXGBEVF_QV_STATE_NAPI | IXGBEVF_QV_STATE_POLL)
184#define IXGBEVF_QV_LOCKED (IXGBEVF_QV_OWNED | IXGBEVF_QV_STATE_DISABLED)
185#define IXGBEVF_QV_STATE_NAPI_YIELD 8 /* NAPI yielded this QV */
186#define IXGBEVF_QV_STATE_POLL_YIELD 16 /* poll yielded this QV */
187#define IXGBEVF_QV_YIELD (IXGBEVF_QV_STATE_NAPI_YIELD | IXGBEVF_QV_STATE_POLL_YIELD)
188#define IXGBEVF_QV_USER_PEND (IXGBEVF_QV_STATE_POLL | IXGBEVF_QV_STATE_POLL_YIELD)
189 spinlock_t lock;
190#endif /* CONFIG_NET_RX_BUSY_POLL */
Greg Rose92915f72010-01-09 02:24:10 +0000191};
Jacob Kellerc777cdf2013-09-21 06:24:20 +0000192#ifdef CONFIG_NET_RX_BUSY_POLL
193static inline void ixgbevf_qv_init_lock(struct ixgbevf_q_vector *q_vector)
194{
195
196 spin_lock_init(&q_vector->lock);
197 q_vector->state = IXGBEVF_QV_STATE_IDLE;
198}
199
200/* called from the device poll routine to get ownership of a q_vector */
201static inline bool ixgbevf_qv_lock_napi(struct ixgbevf_q_vector *q_vector)
202{
203 int rc = true;
204 spin_lock_bh(&q_vector->lock);
205 if (q_vector->state & IXGBEVF_QV_LOCKED) {
206 WARN_ON(q_vector->state & IXGBEVF_QV_STATE_NAPI);
207 q_vector->state |= IXGBEVF_QV_STATE_NAPI_YIELD;
208 rc = false;
Jacob Keller3b5dca22013-09-21 06:24:25 +0000209#ifdef BP_EXTENDED_STATS
Emil Tantilov095e2612014-01-17 18:30:00 -0800210 q_vector->tx.ring->stats.yields++;
Jacob Keller3b5dca22013-09-21 06:24:25 +0000211#endif
Jacob Kellerc777cdf2013-09-21 06:24:20 +0000212 } else {
213 /* we don't care if someone yielded */
214 q_vector->state = IXGBEVF_QV_STATE_NAPI;
215 }
216 spin_unlock_bh(&q_vector->lock);
217 return rc;
218}
219
220/* returns true is someone tried to get the qv while napi had it */
221static inline bool ixgbevf_qv_unlock_napi(struct ixgbevf_q_vector *q_vector)
222{
223 int rc = false;
224 spin_lock_bh(&q_vector->lock);
225 WARN_ON(q_vector->state & (IXGBEVF_QV_STATE_POLL |
226 IXGBEVF_QV_STATE_NAPI_YIELD));
227
228 if (q_vector->state & IXGBEVF_QV_STATE_POLL_YIELD)
229 rc = true;
230 /* reset state to idle, unless QV is disabled */
231 q_vector->state &= IXGBEVF_QV_STATE_DISABLED;
232 spin_unlock_bh(&q_vector->lock);
233 return rc;
234}
235
236/* called from ixgbevf_low_latency_poll() */
237static inline bool ixgbevf_qv_lock_poll(struct ixgbevf_q_vector *q_vector)
238{
239 int rc = true;
240 spin_lock_bh(&q_vector->lock);
241 if ((q_vector->state & IXGBEVF_QV_LOCKED)) {
242 q_vector->state |= IXGBEVF_QV_STATE_POLL_YIELD;
243 rc = false;
Jacob Keller3b5dca22013-09-21 06:24:25 +0000244#ifdef BP_EXTENDED_STATS
Emil Tantilov095e2612014-01-17 18:30:00 -0800245 q_vector->rx.ring->stats.yields++;
Jacob Keller3b5dca22013-09-21 06:24:25 +0000246#endif
Jacob Kellerc777cdf2013-09-21 06:24:20 +0000247 } else {
248 /* preserve yield marks */
249 q_vector->state |= IXGBEVF_QV_STATE_POLL;
250 }
251 spin_unlock_bh(&q_vector->lock);
252 return rc;
253}
254
255/* returns true if someone tried to get the qv while it was locked */
256static inline bool ixgbevf_qv_unlock_poll(struct ixgbevf_q_vector *q_vector)
257{
258 int rc = false;
259 spin_lock_bh(&q_vector->lock);
260 WARN_ON(q_vector->state & (IXGBEVF_QV_STATE_NAPI));
261
262 if (q_vector->state & IXGBEVF_QV_STATE_POLL_YIELD)
263 rc = true;
264 /* reset state to idle, unless QV is disabled */
265 q_vector->state &= IXGBEVF_QV_STATE_DISABLED;
266 spin_unlock_bh(&q_vector->lock);
267 return rc;
268}
269
270/* true if a socket is polling, even if it did not get the lock */
271static inline bool ixgbevf_qv_busy_polling(struct ixgbevf_q_vector *q_vector)
272{
273 WARN_ON(!(q_vector->state & IXGBEVF_QV_OWNED));
274 return q_vector->state & IXGBEVF_QV_USER_PEND;
275}
276
277/* false if QV is currently owned */
278static inline bool ixgbevf_qv_disable(struct ixgbevf_q_vector *q_vector)
279{
280 int rc = true;
281 spin_lock_bh(&q_vector->lock);
282 if (q_vector->state & IXGBEVF_QV_OWNED)
283 rc = false;
Jacob Kellere689e722014-01-16 02:30:06 -0800284 q_vector->state |= IXGBEVF_QV_STATE_DISABLED;
Jacob Kellerc777cdf2013-09-21 06:24:20 +0000285 spin_unlock_bh(&q_vector->lock);
286 return rc;
287}
288
289#endif /* CONFIG_NET_RX_BUSY_POLL */
Greg Rose92915f72010-01-09 02:24:10 +0000290
Alexander Duyck5f3600e2012-05-11 08:32:55 +0000291/*
292 * microsecond values for various ITR rates shifted by 2 to fit itr register
293 * with the first 3 bits reserved 0
294 */
295#define IXGBE_MIN_RSC_ITR 24
296#define IXGBE_100K_ITR 40
297#define IXGBE_20K_ITR 200
298#define IXGBE_10K_ITR 400
299#define IXGBE_8K_ITR 500
300
Greg Rose92915f72010-01-09 02:24:10 +0000301/* Helper macros to switch between ints/sec and what the register uses.
302 * And yes, it's the same math going both ways. The lowest value
303 * supported by all of the ixgbe hardware is 8.
304 */
305#define EITR_INTS_PER_SEC_TO_REG(_eitr) \
306 ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8)
307#define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG
308
Emil Tantilovec62fe22014-11-08 01:39:20 +0000309/* ixgbevf_test_staterr - tests bits in Rx descriptor status and error fields */
310static inline __le32 ixgbevf_test_staterr(union ixgbe_adv_rx_desc *rx_desc,
311 const u32 stat_err_bits)
312{
313 return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
314}
315
Don Skidmoref880d072013-10-23 02:17:52 +0000316static inline u16 ixgbevf_desc_unused(struct ixgbevf_ring *ring)
317{
318 u16 ntc = ring->next_to_clean;
319 u16 ntu = ring->next_to_use;
320
321 return ((ntc > ntu) ? 0 : ring->count) + ntc - ntu - 1;
322}
Greg Rose92915f72010-01-09 02:24:10 +0000323
Mark Rustad06380db2014-03-04 03:02:23 +0000324static inline void ixgbevf_write_tail(struct ixgbevf_ring *ring, u32 value)
325{
326 writel(value, ring->tail);
327}
328
Alexander Duyck908421f2012-05-11 08:33:00 +0000329#define IXGBEVF_RX_DESC(R, i) \
330 (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
331#define IXGBEVF_TX_DESC(R, i) \
332 (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
333#define IXGBEVF_TX_CTXTDESC(R, i) \
334 (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
Greg Rose92915f72010-01-09 02:24:10 +0000335
Alexander Duyckc88887e2012-08-22 02:04:37 +0000336#define IXGBE_MAX_JUMBO_FRAME_SIZE 9728 /* Maximum Supported Size 9.5KB */
Greg Rose92915f72010-01-09 02:24:10 +0000337
338#define OTHER_VECTOR 1
339#define NON_Q_VECTORS (OTHER_VECTOR)
340
341#define MAX_MSIX_Q_VECTORS 2
Greg Rose92915f72010-01-09 02:24:10 +0000342
Alexander Duyckfa71ae22012-05-11 08:32:50 +0000343#define MIN_MSIX_Q_VECTORS 1
Greg Rose92915f72010-01-09 02:24:10 +0000344#define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
345
346/* board specific private data structure */
347struct ixgbevf_adapter {
Emil Tantilovdff80522014-11-08 01:39:25 +0000348 /* this field must be first, see ixgbevf_process_skb_fields */
Jiri Pirkodadcd652011-07-21 03:25:09 +0000349 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
Emil Tantilovdff80522014-11-08 01:39:25 +0000350
351 struct timer_list watchdog_timer;
Greg Rose92915f72010-01-09 02:24:10 +0000352 struct work_struct reset_task;
353 struct ixgbevf_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
Greg Rose92915f72010-01-09 02:24:10 +0000354
355 /* Interrupt Throttle Rate */
Alexander Duyck5f3600e2012-05-11 08:32:55 +0000356 u16 rx_itr_setting;
357 u16 tx_itr_setting;
358
359 /* interrupt masks */
360 u32 eims_enable_mask;
361 u32 eims_other;
Greg Rose92915f72010-01-09 02:24:10 +0000362
363 /* TX */
Greg Rose92915f72010-01-09 02:24:10 +0000364 int num_tx_queues;
Emil Tantilov97031922014-01-17 18:30:01 -0800365 struct ixgbevf_ring *tx_ring[MAX_TX_QUEUES]; /* One per active queue */
Greg Rose92915f72010-01-09 02:24:10 +0000366 u64 restart_queue;
Greg Rose92915f72010-01-09 02:24:10 +0000367 u32 tx_timeout_count;
Greg Rose92915f72010-01-09 02:24:10 +0000368
369 /* RX */
Greg Rose92915f72010-01-09 02:24:10 +0000370 int num_rx_queues;
Emil Tantilov97031922014-01-17 18:30:01 -0800371 struct ixgbevf_ring *rx_ring[MAX_TX_QUEUES]; /* One per active queue */
Greg Rose92915f72010-01-09 02:24:10 +0000372 u64 hw_csum_rx_error;
373 u64 hw_rx_no_dma_resources;
Greg Rose92915f72010-01-09 02:24:10 +0000374 int num_msix_vectors;
Greg Rose92915f72010-01-09 02:24:10 +0000375 u32 alloc_rx_page_failed;
376 u32 alloc_rx_buff_failed;
377
378 /* Some features need tri-state capability,
379 * thus the additional *_CAPABLE flags.
380 */
381 u32 flags;
Alexander Duyck525a9402012-05-11 08:32:29 +0000382#define IXGBE_FLAG_IN_WATCHDOG_TASK (u32)(1)
Emil Tantilov688ff322014-11-08 01:39:56 +0000383
Don Skidmore220fe052013-09-21 01:40:49 +0000384#define IXGBEVF_FLAG_QUEUE_RESET_REQUESTED (u32)(1 << 2)
Alexander Duyck77d5dfc2012-05-11 08:32:19 +0000385
Emil Tantilov97031922014-01-17 18:30:01 -0800386 struct msix_entry *msix_entries;
387
Greg Rose92915f72010-01-09 02:24:10 +0000388 /* OS defined structs */
389 struct net_device *netdev;
390 struct pci_dev *pdev;
Greg Rose92915f72010-01-09 02:24:10 +0000391
392 /* structs defined in ixgbe_vf.h */
393 struct ixgbe_hw hw;
394 u16 msg_enable;
Greg Rose92915f72010-01-09 02:24:10 +0000395 /* Interrupt Throttle Rate */
396 u32 eitr_param;
397
Emil Tantilov97031922014-01-17 18:30:01 -0800398 struct ixgbevf_hw_stats stats;
399
Greg Rose92915f72010-01-09 02:24:10 +0000400 unsigned long state;
Greg Rose92915f72010-01-09 02:24:10 +0000401 u64 tx_busy;
402 unsigned int tx_ring_count;
403 unsigned int rx_ring_count;
404
Jacob Keller3b5dca22013-09-21 06:24:25 +0000405#ifdef BP_EXTENDED_STATS
406 u64 bp_rx_yields;
407 u64 bp_rx_cleaned;
408 u64 bp_rx_missed;
409
410 u64 bp_tx_yields;
411 u64 bp_tx_cleaned;
412 u64 bp_tx_missed;
413#endif
414
Mark Rustaddbf8b0d2014-03-04 03:02:34 +0000415 u8 __iomem *io_addr; /* Mainly for iounmap use */
Greg Rose92915f72010-01-09 02:24:10 +0000416 u32 link_speed;
417 bool link_up;
Greg Rose92915f72010-01-09 02:24:10 +0000418
Alexander Duyck1c55ed72012-05-11 08:33:06 +0000419 spinlock_t mbx_lock;
Emil Tantilov97031922014-01-17 18:30:01 -0800420
421 struct work_struct watchdog_task;
Greg Rose92915f72010-01-09 02:24:10 +0000422};
423
424enum ixbgevf_state_t {
425 __IXGBEVF_TESTING,
426 __IXGBEVF_RESETTING,
Mark Rustad2e7cfbd2014-03-04 03:02:13 +0000427 __IXGBEVF_DOWN,
Mark Rustadbc0c7152014-03-12 00:38:45 +0000428 __IXGBEVF_DISABLED,
Mark Rustad2e7cfbd2014-03-04 03:02:13 +0000429 __IXGBEVF_REMOVING,
Mark Rustadea699562014-03-12 00:38:51 +0000430 __IXGBEVF_WORK_INIT,
Greg Rose92915f72010-01-09 02:24:10 +0000431};
432
433enum ixgbevf_boards {
434 board_82599_vf,
Greg Rose2316aa22010-12-02 07:12:26 +0000435 board_X540_vf,
Emil Tantilov47068b02014-11-22 07:59:56 +0000436 board_X550_vf,
437 board_X550EM_x_vf,
Greg Rose92915f72010-01-09 02:24:10 +0000438};
439
Stephen Hemminger3d8fe982012-01-18 22:13:34 +0000440extern const struct ixgbevf_info ixgbevf_82599_vf_info;
441extern const struct ixgbevf_info ixgbevf_X540_vf_info;
Emil Tantilov47068b02014-11-22 07:59:56 +0000442extern const struct ixgbevf_info ixgbevf_X550_vf_info;
443extern const struct ixgbevf_info ixgbevf_X550EM_x_vf_info;
Stephen Hemmingerb5417bf2012-01-18 22:13:33 +0000444extern const struct ixgbe_mbx_operations ixgbevf_mbx_ops;
Greg Rose92915f72010-01-09 02:24:10 +0000445
446/* needed by ethtool.c */
Stephen Hemminger3d8fe982012-01-18 22:13:34 +0000447extern const char ixgbevf_driver_name[];
Greg Rose92915f72010-01-09 02:24:10 +0000448extern const char ixgbevf_driver_version[];
449
Joe Perches5ccc9212013-09-23 11:37:59 -0700450void ixgbevf_up(struct ixgbevf_adapter *adapter);
451void ixgbevf_down(struct ixgbevf_adapter *adapter);
452void ixgbevf_reinit_locked(struct ixgbevf_adapter *adapter);
453void ixgbevf_reset(struct ixgbevf_adapter *adapter);
454void ixgbevf_set_ethtool_ops(struct net_device *netdev);
Emil Tantilov05d063a2014-01-17 18:29:59 -0800455int ixgbevf_setup_rx_resources(struct ixgbevf_ring *);
456int ixgbevf_setup_tx_resources(struct ixgbevf_ring *);
457void ixgbevf_free_rx_resources(struct ixgbevf_ring *);
458void ixgbevf_free_tx_resources(struct ixgbevf_ring *);
Joe Perches5ccc9212013-09-23 11:37:59 -0700459void ixgbevf_update_stats(struct ixgbevf_adapter *adapter);
460int ethtool_ioctl(struct ifreq *ifr);
Greg Rose92915f72010-01-09 02:24:10 +0000461
Jacob Keller38496232013-10-22 06:19:18 +0000462extern void ixgbevf_write_eitr(struct ixgbevf_q_vector *q_vector);
463
Joe Perches5ccc9212013-09-23 11:37:59 -0700464void ixgbe_napi_add_all(struct ixgbevf_adapter *adapter);
465void ixgbe_napi_del_all(struct ixgbevf_adapter *adapter);
Greg Rose92915f72010-01-09 02:24:10 +0000466
467#ifdef DEBUG
Joe Perches5ccc9212013-09-23 11:37:59 -0700468char *ixgbevf_get_hw_dev_name(struct ixgbe_hw *hw);
Greg Rose92915f72010-01-09 02:24:10 +0000469#define hw_dbg(hw, format, arg...) \
470 printk(KERN_DEBUG "%s: " format, ixgbevf_get_hw_dev_name(hw), ##arg)
471#else
472#define hw_dbg(hw, format, arg...) do {} while (0)
473#endif
474
475#endif /* _IXGBEVF_H_ */