ixgbe.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. /*******************************************************************************
  2. Intel 10 Gigabit PCI Express Linux driver
  3. Copyright(c) 1999 - 2011 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #ifndef _IXGBE_H_
  21. #define _IXGBE_H_
  22. #include <linux/bitops.h>
  23. #include <linux/types.h>
  24. #include <linux/pci.h>
  25. #include <linux/netdevice.h>
  26. #include <linux/cpumask.h>
  27. #include <linux/aer.h>
  28. #include <linux/if_vlan.h>
  29. #include "ixgbe_type.h"
  30. #include "ixgbe_common.h"
  31. #include "ixgbe_dcb.h"
  32. #if defined(CONFIG_FCOE) || defined(CONFIG_FCOE_MODULE)
  33. #define IXGBE_FCOE
  34. #include "ixgbe_fcoe.h"
  35. #endif /* CONFIG_FCOE or CONFIG_FCOE_MODULE */
  36. #ifdef CONFIG_IXGBE_DCA
  37. #include <linux/dca.h>
  38. #endif
  39. /* common prefix used by pr_<> macros */
  40. #undef pr_fmt
  41. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  42. /* TX/RX descriptor defines */
  43. #define IXGBE_DEFAULT_TXD 512
  44. #define IXGBE_MAX_TXD 4096
  45. #define IXGBE_MIN_TXD 64
  46. #define IXGBE_DEFAULT_RXD 512
  47. #define IXGBE_MAX_RXD 4096
  48. #define IXGBE_MIN_RXD 64
  49. /* flow control */
  50. #define IXGBE_MIN_FCRTL 0x40
  51. #define IXGBE_MAX_FCRTL 0x7FF80
  52. #define IXGBE_MIN_FCRTH 0x600
  53. #define IXGBE_MAX_FCRTH 0x7FFF0
  54. #define IXGBE_DEFAULT_FCPAUSE 0xFFFF
  55. #define IXGBE_MIN_FCPAUSE 0
  56. #define IXGBE_MAX_FCPAUSE 0xFFFF
  57. /* Supported Rx Buffer Sizes */
  58. #define IXGBE_RXBUFFER_512 512 /* Used for packet split */
  59. #define IXGBE_RXBUFFER_2048 2048
  60. #define IXGBE_RXBUFFER_4096 4096
  61. #define IXGBE_RXBUFFER_8192 8192
  62. #define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */
  63. /*
  64. * NOTE: netdev_alloc_skb reserves up to 64 bytes, NET_IP_ALIGN mans we
  65. * reserve 2 more, and skb_shared_info adds an additional 384 bytes more,
  66. * this adds up to 512 bytes of extra data meaning the smallest allocation
  67. * we could have is 1K.
  68. * i.e. RXBUFFER_512 --> size-1024 slab
  69. */
  70. #define IXGBE_RX_HDR_SIZE IXGBE_RXBUFFER_512
  71. #define MAXIMUM_ETHERNET_VLAN_SIZE (ETH_FRAME_LEN + ETH_FCS_LEN + VLAN_HLEN)
  72. /* How many Rx Buffers do we bundle into one write to the hardware ? */
  73. #define IXGBE_RX_BUFFER_WRITE 16 /* Must be power of 2 */
  74. #define IXGBE_TX_FLAGS_CSUM (u32)(1)
  75. #define IXGBE_TX_FLAGS_VLAN (u32)(1 << 1)
  76. #define IXGBE_TX_FLAGS_TSO (u32)(1 << 2)
  77. #define IXGBE_TX_FLAGS_IPV4 (u32)(1 << 3)
  78. #define IXGBE_TX_FLAGS_FCOE (u32)(1 << 4)
  79. #define IXGBE_TX_FLAGS_FSO (u32)(1 << 5)
  80. #define IXGBE_TX_FLAGS_VLAN_MASK 0xffff0000
  81. #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK 0x0000e000
  82. #define IXGBE_TX_FLAGS_VLAN_SHIFT 16
  83. #define IXGBE_MAX_RSC_INT_RATE 162760
  84. #define IXGBE_MAX_VF_MC_ENTRIES 30
  85. #define IXGBE_MAX_VF_FUNCTIONS 64
  86. #define IXGBE_MAX_VFTA_ENTRIES 128
  87. #define MAX_EMULATION_MAC_ADDRS 16
  88. #define IXGBE_MAX_PF_MACVLANS 15
  89. #define VMDQ_P(p) ((p) + adapter->num_vfs)
  90. struct vf_data_storage {
  91. unsigned char vf_mac_addresses[ETH_ALEN];
  92. u16 vf_mc_hashes[IXGBE_MAX_VF_MC_ENTRIES];
  93. u16 num_vf_mc_hashes;
  94. u16 default_vf_vlan_id;
  95. u16 vlans_enabled;
  96. bool clear_to_send;
  97. bool pf_set_mac;
  98. u16 pf_vlan; /* When set, guest VLAN config not allowed. */
  99. u16 pf_qos;
  100. u16 tx_rate;
  101. };
  102. struct vf_macvlans {
  103. struct list_head l;
  104. int vf;
  105. int rar_entry;
  106. bool free;
  107. bool is_macvlan;
  108. u8 vf_macvlan[ETH_ALEN];
  109. };
  110. /* wrapper around a pointer to a socket buffer,
  111. * so a DMA handle can be stored along with the buffer */
  112. struct ixgbe_tx_buffer {
  113. struct sk_buff *skb;
  114. dma_addr_t dma;
  115. unsigned long time_stamp;
  116. u16 length;
  117. u16 next_to_watch;
  118. unsigned int bytecount;
  119. u16 gso_segs;
  120. u8 mapped_as_page;
  121. };
  122. struct ixgbe_rx_buffer {
  123. struct sk_buff *skb;
  124. dma_addr_t dma;
  125. struct page *page;
  126. dma_addr_t page_dma;
  127. unsigned int page_offset;
  128. };
  129. struct ixgbe_queue_stats {
  130. u64 packets;
  131. u64 bytes;
  132. };
  133. struct ixgbe_tx_queue_stats {
  134. u64 restart_queue;
  135. u64 tx_busy;
  136. u64 completed;
  137. u64 tx_done_old;
  138. };
  139. struct ixgbe_rx_queue_stats {
  140. u64 rsc_count;
  141. u64 rsc_flush;
  142. u64 non_eop_descs;
  143. u64 alloc_rx_page_failed;
  144. u64 alloc_rx_buff_failed;
  145. };
  146. enum ixbge_ring_state_t {
  147. __IXGBE_TX_FDIR_INIT_DONE,
  148. __IXGBE_TX_DETECT_HANG,
  149. __IXGBE_HANG_CHECK_ARMED,
  150. __IXGBE_RX_PS_ENABLED,
  151. __IXGBE_RX_RSC_ENABLED,
  152. };
  153. #define ring_is_ps_enabled(ring) \
  154. test_bit(__IXGBE_RX_PS_ENABLED, &(ring)->state)
  155. #define set_ring_ps_enabled(ring) \
  156. set_bit(__IXGBE_RX_PS_ENABLED, &(ring)->state)
  157. #define clear_ring_ps_enabled(ring) \
  158. clear_bit(__IXGBE_RX_PS_ENABLED, &(ring)->state)
  159. #define check_for_tx_hang(ring) \
  160. test_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
  161. #define set_check_for_tx_hang(ring) \
  162. set_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
  163. #define clear_check_for_tx_hang(ring) \
  164. clear_bit(__IXGBE_TX_DETECT_HANG, &(ring)->state)
  165. #define ring_is_rsc_enabled(ring) \
  166. test_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
  167. #define set_ring_rsc_enabled(ring) \
  168. set_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
  169. #define clear_ring_rsc_enabled(ring) \
  170. clear_bit(__IXGBE_RX_RSC_ENABLED, &(ring)->state)
  171. struct ixgbe_ring {
  172. void *desc; /* descriptor ring memory */
  173. struct device *dev; /* device for DMA mapping */
  174. struct net_device *netdev; /* netdev ring belongs to */
  175. union {
  176. struct ixgbe_tx_buffer *tx_buffer_info;
  177. struct ixgbe_rx_buffer *rx_buffer_info;
  178. };
  179. unsigned long state;
  180. u8 atr_sample_rate;
  181. u8 atr_count;
  182. u16 count; /* amount of descriptors */
  183. u16 rx_buf_len;
  184. u16 next_to_use;
  185. u16 next_to_clean;
  186. u8 queue_index; /* needed for multiqueue queue management */
  187. u8 reg_idx; /* holds the special value that gets
  188. * the hardware register offset
  189. * associated with this ring, which is
  190. * different for DCB and RSS modes
  191. */
  192. u8 dcb_tc;
  193. u16 work_limit; /* max work per interrupt */
  194. u8 __iomem *tail;
  195. unsigned int total_bytes;
  196. unsigned int total_packets;
  197. struct ixgbe_queue_stats stats;
  198. struct u64_stats_sync syncp;
  199. union {
  200. struct ixgbe_tx_queue_stats tx_stats;
  201. struct ixgbe_rx_queue_stats rx_stats;
  202. };
  203. int numa_node;
  204. unsigned int size; /* length in bytes */
  205. dma_addr_t dma; /* phys. address of descriptor ring */
  206. struct rcu_head rcu;
  207. struct ixgbe_q_vector *q_vector; /* back-pointer to host q_vector */
  208. } ____cacheline_internodealigned_in_smp;
  209. enum ixgbe_ring_f_enum {
  210. RING_F_NONE = 0,
  211. RING_F_DCB,
  212. RING_F_VMDQ, /* SR-IOV uses the same ring feature */
  213. RING_F_RSS,
  214. RING_F_FDIR,
  215. #ifdef IXGBE_FCOE
  216. RING_F_FCOE,
  217. #endif /* IXGBE_FCOE */
  218. RING_F_ARRAY_SIZE /* must be last in enum set */
  219. };
  220. #define IXGBE_MAX_DCB_INDICES 64
  221. #define IXGBE_MAX_RSS_INDICES 16
  222. #define IXGBE_MAX_VMDQ_INDICES 64
  223. #define IXGBE_MAX_FDIR_INDICES 64
  224. #ifdef IXGBE_FCOE
  225. #define IXGBE_MAX_FCOE_INDICES 8
  226. #define MAX_RX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
  227. #define MAX_TX_QUEUES (IXGBE_MAX_FDIR_INDICES + IXGBE_MAX_FCOE_INDICES)
  228. #else
  229. #define MAX_RX_QUEUES IXGBE_MAX_FDIR_INDICES
  230. #define MAX_TX_QUEUES IXGBE_MAX_FDIR_INDICES
  231. #endif /* IXGBE_FCOE */
  232. struct ixgbe_ring_feature {
  233. int indices;
  234. int mask;
  235. } ____cacheline_internodealigned_in_smp;
  236. #define MAX_RX_PACKET_BUFFERS ((adapter->flags & IXGBE_FLAG_DCB_ENABLED) \
  237. ? 8 : 1)
  238. #define MAX_TX_PACKET_BUFFERS MAX_RX_PACKET_BUFFERS
  239. /* MAX_MSIX_Q_VECTORS of these are allocated,
  240. * but we only use one per queue-specific vector.
  241. */
  242. struct ixgbe_q_vector {
  243. struct ixgbe_adapter *adapter;
  244. unsigned int v_idx; /* index of q_vector within array, also used for
  245. * finding the bit in EICR and friends that
  246. * represents the vector for this ring */
  247. #ifdef CONFIG_IXGBE_DCA
  248. int cpu; /* CPU for DCA */
  249. #endif
  250. struct napi_struct napi;
  251. DECLARE_BITMAP(rxr_idx, MAX_RX_QUEUES); /* Rx ring indices */
  252. DECLARE_BITMAP(txr_idx, MAX_TX_QUEUES); /* Tx ring indices */
  253. u8 rxr_count; /* Rx ring count assigned to this vector */
  254. u8 txr_count; /* Tx ring count assigned to this vector */
  255. u8 tx_itr;
  256. u8 rx_itr;
  257. u32 eitr;
  258. cpumask_var_t affinity_mask;
  259. char name[IFNAMSIZ + 9];
  260. };
  261. /* Helper macros to switch between ints/sec and what the register uses.
  262. * And yes, it's the same math going both ways. The lowest value
  263. * supported by all of the ixgbe hardware is 8.
  264. */
  265. #define EITR_INTS_PER_SEC_TO_REG(_eitr) \
  266. ((_eitr) ? (1000000000 / ((_eitr) * 256)) : 8)
  267. #define EITR_REG_TO_INTS_PER_SEC EITR_INTS_PER_SEC_TO_REG
  268. #define IXGBE_DESC_UNUSED(R) \
  269. ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
  270. (R)->next_to_clean - (R)->next_to_use - 1)
  271. #define IXGBE_RX_DESC_ADV(R, i) \
  272. (&(((union ixgbe_adv_rx_desc *)((R)->desc))[i]))
  273. #define IXGBE_TX_DESC_ADV(R, i) \
  274. (&(((union ixgbe_adv_tx_desc *)((R)->desc))[i]))
  275. #define IXGBE_TX_CTXTDESC_ADV(R, i) \
  276. (&(((struct ixgbe_adv_tx_context_desc *)((R)->desc))[i]))
  277. #define IXGBE_MAX_JUMBO_FRAME_SIZE 16128
  278. #ifdef IXGBE_FCOE
  279. /* Use 3K as the baby jumbo frame size for FCoE */
  280. #define IXGBE_FCOE_JUMBO_FRAME_SIZE 3072
  281. #endif /* IXGBE_FCOE */
  282. #define OTHER_VECTOR 1
  283. #define NON_Q_VECTORS (OTHER_VECTOR)
  284. #define MAX_MSIX_VECTORS_82599 64
  285. #define MAX_MSIX_Q_VECTORS_82599 64
  286. #define MAX_MSIX_VECTORS_82598 18
  287. #define MAX_MSIX_Q_VECTORS_82598 16
  288. #define MAX_MSIX_Q_VECTORS MAX_MSIX_Q_VECTORS_82599
  289. #define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82599
  290. #define MIN_MSIX_Q_VECTORS 2
  291. #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
  292. /* board specific private data structure */
  293. struct ixgbe_adapter {
  294. unsigned long state;
  295. /* Some features need tri-state capability,
  296. * thus the additional *_CAPABLE flags.
  297. */
  298. u32 flags;
  299. #define IXGBE_FLAG_RX_CSUM_ENABLED (u32)(1)
  300. #define IXGBE_FLAG_MSI_CAPABLE (u32)(1 << 1)
  301. #define IXGBE_FLAG_MSI_ENABLED (u32)(1 << 2)
  302. #define IXGBE_FLAG_MSIX_CAPABLE (u32)(1 << 3)
  303. #define IXGBE_FLAG_MSIX_ENABLED (u32)(1 << 4)
  304. #define IXGBE_FLAG_RX_1BUF_CAPABLE (u32)(1 << 6)
  305. #define IXGBE_FLAG_RX_PS_CAPABLE (u32)(1 << 7)
  306. #define IXGBE_FLAG_RX_PS_ENABLED (u32)(1 << 8)
  307. #define IXGBE_FLAG_IN_NETPOLL (u32)(1 << 9)
  308. #define IXGBE_FLAG_DCA_ENABLED (u32)(1 << 10)
  309. #define IXGBE_FLAG_DCA_CAPABLE (u32)(1 << 11)
  310. #define IXGBE_FLAG_IMIR_ENABLED (u32)(1 << 12)
  311. #define IXGBE_FLAG_MQ_CAPABLE (u32)(1 << 13)
  312. #define IXGBE_FLAG_DCB_ENABLED (u32)(1 << 14)
  313. #define IXGBE_FLAG_RSS_ENABLED (u32)(1 << 16)
  314. #define IXGBE_FLAG_RSS_CAPABLE (u32)(1 << 17)
  315. #define IXGBE_FLAG_VMDQ_CAPABLE (u32)(1 << 18)
  316. #define IXGBE_FLAG_VMDQ_ENABLED (u32)(1 << 19)
  317. #define IXGBE_FLAG_FAN_FAIL_CAPABLE (u32)(1 << 20)
  318. #define IXGBE_FLAG_NEED_LINK_UPDATE (u32)(1 << 22)
  319. #define IXGBE_FLAG_NEED_LINK_CONFIG (u32)(1 << 23)
  320. #define IXGBE_FLAG_FDIR_HASH_CAPABLE (u32)(1 << 24)
  321. #define IXGBE_FLAG_FDIR_PERFECT_CAPABLE (u32)(1 << 25)
  322. #define IXGBE_FLAG_FCOE_CAPABLE (u32)(1 << 26)
  323. #define IXGBE_FLAG_FCOE_ENABLED (u32)(1 << 27)
  324. #define IXGBE_FLAG_SRIOV_CAPABLE (u32)(1 << 28)
  325. #define IXGBE_FLAG_SRIOV_ENABLED (u32)(1 << 29)
  326. u32 flags2;
  327. #define IXGBE_FLAG2_RSC_CAPABLE (u32)(1)
  328. #define IXGBE_FLAG2_RSC_ENABLED (u32)(1 << 1)
  329. #define IXGBE_FLAG2_TEMP_SENSOR_CAPABLE (u32)(1 << 2)
  330. #define IXGBE_FLAG2_TEMP_SENSOR_EVENT (u32)(1 << 3)
  331. #define IXGBE_FLAG2_SEARCH_FOR_SFP (u32)(1 << 4)
  332. #define IXGBE_FLAG2_SFP_NEEDS_RESET (u32)(1 << 5)
  333. #define IXGBE_FLAG2_RESET_REQUESTED (u32)(1 << 6)
  334. #define IXGBE_FLAG2_FDIR_REQUIRES_REINIT (u32)(1 << 7)
  335. unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
  336. u16 bd_number;
  337. struct ixgbe_q_vector *q_vector[MAX_MSIX_Q_VECTORS];
  338. /* DCB parameters */
  339. struct ieee_pfc *ixgbe_ieee_pfc;
  340. struct ieee_ets *ixgbe_ieee_ets;
  341. struct ixgbe_dcb_config dcb_cfg;
  342. struct ixgbe_dcb_config temp_dcb_cfg;
  343. u8 dcb_set_bitmap;
  344. u8 dcbx_cap;
  345. enum ixgbe_fc_mode last_lfc_mode;
  346. /* Interrupt Throttle Rate */
  347. u32 rx_itr_setting;
  348. u32 tx_itr_setting;
  349. u16 eitr_low;
  350. u16 eitr_high;
  351. /* TX */
  352. struct ixgbe_ring *tx_ring[MAX_TX_QUEUES] ____cacheline_aligned_in_smp;
  353. int num_tx_queues;
  354. u32 tx_timeout_count;
  355. bool detect_tx_hung;
  356. u64 restart_queue;
  357. u64 lsc_int;
  358. /* RX */
  359. struct ixgbe_ring *rx_ring[MAX_RX_QUEUES] ____cacheline_aligned_in_smp;
  360. int num_rx_queues;
  361. int num_rx_pools; /* == num_rx_queues in 82598 */
  362. int num_rx_queues_per_pool; /* 1 if 82598, can be many if 82599 */
  363. u64 hw_csum_rx_error;
  364. u64 hw_rx_no_dma_resources;
  365. u64 non_eop_descs;
  366. int num_msix_vectors;
  367. int max_msix_q_vectors; /* true count of q_vectors for device */
  368. struct ixgbe_ring_feature ring_feature[RING_F_ARRAY_SIZE];
  369. struct msix_entry *msix_entries;
  370. u32 alloc_rx_page_failed;
  371. u32 alloc_rx_buff_failed;
  372. /* default to trying for four seconds */
  373. #define IXGBE_TRY_LINK_TIMEOUT (4 * HZ)
  374. /* OS defined structs */
  375. struct net_device *netdev;
  376. struct pci_dev *pdev;
  377. u32 test_icr;
  378. struct ixgbe_ring test_tx_ring;
  379. struct ixgbe_ring test_rx_ring;
  380. /* structs defined in ixgbe_hw.h */
  381. struct ixgbe_hw hw;
  382. u16 msg_enable;
  383. struct ixgbe_hw_stats stats;
  384. /* Interrupt Throttle Rate */
  385. u32 rx_eitr_param;
  386. u32 tx_eitr_param;
  387. u64 tx_busy;
  388. unsigned int tx_ring_count;
  389. unsigned int rx_ring_count;
  390. u32 link_speed;
  391. bool link_up;
  392. unsigned long link_check_timeout;
  393. struct work_struct service_task;
  394. struct timer_list service_timer;
  395. u32 fdir_pballoc;
  396. u32 atr_sample_rate;
  397. unsigned long fdir_overflow; /* number of times ATR was backed off */
  398. spinlock_t fdir_perfect_lock;
  399. #ifdef IXGBE_FCOE
  400. struct ixgbe_fcoe fcoe;
  401. #endif /* IXGBE_FCOE */
  402. u64 rsc_total_count;
  403. u64 rsc_total_flush;
  404. u32 wol;
  405. u16 eeprom_version;
  406. int node;
  407. u32 led_reg;
  408. u32 interrupt_event;
  409. char lsc_int_name[IFNAMSIZ + 9];
  410. /* SR-IOV */
  411. DECLARE_BITMAP(active_vfs, IXGBE_MAX_VF_FUNCTIONS);
  412. unsigned int num_vfs;
  413. struct vf_data_storage *vfinfo;
  414. int vf_rate_link_speed;
  415. struct vf_macvlans vf_mvs;
  416. struct vf_macvlans *mv_list;
  417. bool antispoofing_enabled;
  418. };
  419. enum ixbge_state_t {
  420. __IXGBE_TESTING,
  421. __IXGBE_RESETTING,
  422. __IXGBE_DOWN,
  423. __IXGBE_SERVICE_SCHED,
  424. __IXGBE_IN_SFP_INIT,
  425. };
  426. struct ixgbe_rsc_cb {
  427. dma_addr_t dma;
  428. u16 skb_cnt;
  429. bool delay_unmap;
  430. };
  431. #define IXGBE_RSC_CB(skb) ((struct ixgbe_rsc_cb *)(skb)->cb)
  432. enum ixgbe_boards {
  433. board_82598,
  434. board_82599,
  435. board_X540,
  436. };
  437. extern struct ixgbe_info ixgbe_82598_info;
  438. extern struct ixgbe_info ixgbe_82599_info;
  439. extern struct ixgbe_info ixgbe_X540_info;
  440. #ifdef CONFIG_IXGBE_DCB
  441. extern const struct dcbnl_rtnl_ops dcbnl_ops;
  442. extern int ixgbe_copy_dcb_cfg(struct ixgbe_dcb_config *src_dcb_cfg,
  443. struct ixgbe_dcb_config *dst_dcb_cfg,
  444. int tc_max);
  445. #endif
  446. extern char ixgbe_driver_name[];
  447. extern const char ixgbe_driver_version[];
  448. extern int ixgbe_up(struct ixgbe_adapter *adapter);
  449. extern void ixgbe_down(struct ixgbe_adapter *adapter);
  450. extern void ixgbe_reinit_locked(struct ixgbe_adapter *adapter);
  451. extern void ixgbe_reset(struct ixgbe_adapter *adapter);
  452. extern void ixgbe_set_ethtool_ops(struct net_device *netdev);
  453. extern int ixgbe_setup_rx_resources(struct ixgbe_ring *);
  454. extern int ixgbe_setup_tx_resources(struct ixgbe_ring *);
  455. extern void ixgbe_free_rx_resources(struct ixgbe_ring *);
  456. extern void ixgbe_free_tx_resources(struct ixgbe_ring *);
  457. extern void ixgbe_configure_rx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
  458. extern void ixgbe_configure_tx_ring(struct ixgbe_adapter *,struct ixgbe_ring *);
  459. extern void ixgbe_disable_rx_queue(struct ixgbe_adapter *adapter,
  460. struct ixgbe_ring *);
  461. extern void ixgbe_update_stats(struct ixgbe_adapter *adapter);
  462. extern int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter);
  463. extern void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter);
  464. extern netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *,
  465. struct ixgbe_adapter *,
  466. struct ixgbe_ring *);
  467. extern void ixgbe_unmap_and_free_tx_resource(struct ixgbe_ring *,
  468. struct ixgbe_tx_buffer *);
  469. extern void ixgbe_alloc_rx_buffers(struct ixgbe_ring *, u16);
  470. extern void ixgbe_write_eitr(struct ixgbe_q_vector *);
  471. extern int ethtool_ioctl(struct ifreq *ifr);
  472. extern s32 ixgbe_reinit_fdir_tables_82599(struct ixgbe_hw *hw);
  473. extern s32 ixgbe_init_fdir_signature_82599(struct ixgbe_hw *hw, u32 pballoc);
  474. extern s32 ixgbe_init_fdir_perfect_82599(struct ixgbe_hw *hw, u32 pballoc);
  475. extern s32 ixgbe_fdir_add_signature_filter_82599(struct ixgbe_hw *hw,
  476. union ixgbe_atr_hash_dword input,
  477. union ixgbe_atr_hash_dword common,
  478. u8 queue);
  479. extern s32 ixgbe_fdir_add_perfect_filter_82599(struct ixgbe_hw *hw,
  480. union ixgbe_atr_input *input,
  481. struct ixgbe_atr_input_masks *input_masks,
  482. u16 soft_id, u8 queue);
  483. extern void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
  484. struct ixgbe_ring *ring);
  485. extern void ixgbe_clear_rscctl(struct ixgbe_adapter *adapter,
  486. struct ixgbe_ring *ring);
  487. extern void ixgbe_set_rx_mode(struct net_device *netdev);
  488. extern int ixgbe_setup_tc(struct net_device *dev, u8 tc);
  489. #ifdef IXGBE_FCOE
  490. extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter);
  491. extern int ixgbe_fso(struct ixgbe_adapter *adapter,
  492. struct ixgbe_ring *tx_ring, struct sk_buff *skb,
  493. u32 tx_flags, u8 *hdr_len);
  494. extern void ixgbe_cleanup_fcoe(struct ixgbe_adapter *adapter);
  495. extern int ixgbe_fcoe_ddp(struct ixgbe_adapter *adapter,
  496. union ixgbe_adv_rx_desc *rx_desc,
  497. struct sk_buff *skb);
  498. extern int ixgbe_fcoe_ddp_get(struct net_device *netdev, u16 xid,
  499. struct scatterlist *sgl, unsigned int sgc);
  500. extern int ixgbe_fcoe_ddp_target(struct net_device *netdev, u16 xid,
  501. struct scatterlist *sgl, unsigned int sgc);
  502. extern int ixgbe_fcoe_ddp_put(struct net_device *netdev, u16 xid);
  503. extern int ixgbe_fcoe_enable(struct net_device *netdev);
  504. extern int ixgbe_fcoe_disable(struct net_device *netdev);
  505. #ifdef CONFIG_IXGBE_DCB
  506. extern u8 ixgbe_fcoe_getapp(struct ixgbe_adapter *adapter);
  507. extern u8 ixgbe_fcoe_setapp(struct ixgbe_adapter *adapter, u8 up);
  508. #endif /* CONFIG_IXGBE_DCB */
  509. extern int ixgbe_fcoe_get_wwn(struct net_device *netdev, u64 *wwn, int type);
  510. #endif /* IXGBE_FCOE */
  511. #endif /* _IXGBE_H_ */