igb.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /* Intel(R) Gigabit Ethernet Linux driver
  2. * Copyright(c) 2007-2014 Intel Corporation.
  3. *
  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. *
  8. * This program is distributed in the hope it will be useful, but WITHOUT
  9. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  11. * more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along with
  14. * this program; if not, see <http://www.gnu.org/licenses/>.
  15. *
  16. * The full GNU General Public License is included in this distribution in
  17. * the file called "COPYING".
  18. *
  19. * Contact Information:
  20. * e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  21. * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  22. */
  23. /* Linux PRO/1000 Ethernet Driver main header file */
  24. #ifndef _IGB_H_
  25. #define _IGB_H_
  26. #include "e1000_mac.h"
  27. #include "e1000_82575.h"
  28. #include <linux/timecounter.h>
  29. #include <linux/net_tstamp.h>
  30. #include <linux/ptp_clock_kernel.h>
  31. #include <linux/bitops.h>
  32. #include <linux/if_vlan.h>
  33. #include <linux/i2c.h>
  34. #include <linux/i2c-algo-bit.h>
  35. #include <linux/pci.h>
  36. #include <linux/mdio.h>
  37. struct igb_adapter;
  38. #define E1000_PCS_CFG_IGN_SD 1
  39. /* Interrupt defines */
  40. #define IGB_START_ITR 648 /* ~6000 ints/sec */
  41. #define IGB_4K_ITR 980
  42. #define IGB_20K_ITR 196
  43. #define IGB_70K_ITR 56
  44. /* TX/RX descriptor defines */
  45. #define IGB_DEFAULT_TXD 256
  46. #define IGB_DEFAULT_TX_WORK 128
  47. #define IGB_MIN_TXD 80
  48. #define IGB_MAX_TXD 4096
  49. #define IGB_DEFAULT_RXD 256
  50. #define IGB_MIN_RXD 80
  51. #define IGB_MAX_RXD 4096
  52. #define IGB_DEFAULT_ITR 3 /* dynamic */
  53. #define IGB_MAX_ITR_USECS 10000
  54. #define IGB_MIN_ITR_USECS 10
  55. #define NON_Q_VECTORS 1
  56. #define MAX_Q_VECTORS 8
  57. #define MAX_MSIX_ENTRIES 10
  58. /* Transmit and receive queues */
  59. #define IGB_MAX_RX_QUEUES 8
  60. #define IGB_MAX_RX_QUEUES_82575 4
  61. #define IGB_MAX_RX_QUEUES_I211 2
  62. #define IGB_MAX_TX_QUEUES 8
  63. #define IGB_MAX_VF_MC_ENTRIES 30
  64. #define IGB_MAX_VF_FUNCTIONS 8
  65. #define IGB_MAX_VFTA_ENTRIES 128
  66. #define IGB_82576_VF_DEV_ID 0x10CA
  67. #define IGB_I350_VF_DEV_ID 0x1520
  68. /* NVM version defines */
  69. #define IGB_MAJOR_MASK 0xF000
  70. #define IGB_MINOR_MASK 0x0FF0
  71. #define IGB_BUILD_MASK 0x000F
  72. #define IGB_COMB_VER_MASK 0x00FF
  73. #define IGB_MAJOR_SHIFT 12
  74. #define IGB_MINOR_SHIFT 4
  75. #define IGB_COMB_VER_SHFT 8
  76. #define IGB_NVM_VER_INVALID 0xFFFF
  77. #define IGB_ETRACK_SHIFT 16
  78. #define NVM_ETRACK_WORD 0x0042
  79. #define NVM_COMB_VER_OFF 0x0083
  80. #define NVM_COMB_VER_PTR 0x003d
  81. /* Transmit and receive latency (for PTP timestamps) */
  82. #define IGB_I210_TX_LATENCY_10 9542
  83. #define IGB_I210_TX_LATENCY_100 1024
  84. #define IGB_I210_TX_LATENCY_1000 178
  85. #define IGB_I210_RX_LATENCY_10 20662
  86. #define IGB_I210_RX_LATENCY_100 2213
  87. #define IGB_I210_RX_LATENCY_1000 448
  88. struct vf_data_storage {
  89. unsigned char vf_mac_addresses[ETH_ALEN];
  90. u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
  91. u16 num_vf_mc_hashes;
  92. u32 flags;
  93. unsigned long last_nack;
  94. u16 pf_vlan; /* When set, guest VLAN config not allowed. */
  95. u16 pf_qos;
  96. u16 tx_rate;
  97. bool spoofchk_enabled;
  98. };
  99. #define IGB_VF_FLAG_CTS 0x00000001 /* VF is clear to send data */
  100. #define IGB_VF_FLAG_UNI_PROMISC 0x00000002 /* VF has unicast promisc */
  101. #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004 /* VF has multicast promisc */
  102. #define IGB_VF_FLAG_PF_SET_MAC 0x00000008 /* PF has set MAC address */
  103. /* RX descriptor control thresholds.
  104. * PTHRESH - MAC will consider prefetch if it has fewer than this number of
  105. * descriptors available in its onboard memory.
  106. * Setting this to 0 disables RX descriptor prefetch.
  107. * HTHRESH - MAC will only prefetch if there are at least this many descriptors
  108. * available in host memory.
  109. * If PTHRESH is 0, this should also be 0.
  110. * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
  111. * descriptors until either it has this many to write back, or the
  112. * ITR timer expires.
  113. */
  114. #define IGB_RX_PTHRESH ((hw->mac.type == e1000_i354) ? 12 : 8)
  115. #define IGB_RX_HTHRESH 8
  116. #define IGB_TX_PTHRESH ((hw->mac.type == e1000_i354) ? 20 : 8)
  117. #define IGB_TX_HTHRESH 1
  118. #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \
  119. (adapter->flags & IGB_FLAG_HAS_MSIX)) ? 1 : 4)
  120. #define IGB_TX_WTHRESH ((hw->mac.type == e1000_82576 && \
  121. (adapter->flags & IGB_FLAG_HAS_MSIX)) ? 1 : 16)
  122. /* this is the size past which hardware will drop packets when setting LPE=0 */
  123. #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
  124. /* Supported Rx Buffer Sizes */
  125. #define IGB_RXBUFFER_256 256
  126. #define IGB_RXBUFFER_2048 2048
  127. #define IGB_RX_HDR_LEN IGB_RXBUFFER_256
  128. #define IGB_RX_BUFSZ IGB_RXBUFFER_2048
  129. /* How many Rx Buffers do we bundle into one write to the hardware ? */
  130. #define IGB_RX_BUFFER_WRITE 16 /* Must be power of 2 */
  131. #define AUTO_ALL_MODES 0
  132. #define IGB_EEPROM_APME 0x0400
  133. #ifndef IGB_MASTER_SLAVE
  134. /* Switch to override PHY master/slave setting */
  135. #define IGB_MASTER_SLAVE e1000_ms_hw_default
  136. #endif
  137. #define IGB_MNG_VLAN_NONE -1
  138. enum igb_tx_flags {
  139. /* cmd_type flags */
  140. IGB_TX_FLAGS_VLAN = 0x01,
  141. IGB_TX_FLAGS_TSO = 0x02,
  142. IGB_TX_FLAGS_TSTAMP = 0x04,
  143. /* olinfo flags */
  144. IGB_TX_FLAGS_IPV4 = 0x10,
  145. IGB_TX_FLAGS_CSUM = 0x20,
  146. };
  147. /* VLAN info */
  148. #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000
  149. #define IGB_TX_FLAGS_VLAN_SHIFT 16
  150. /* The largest size we can write to the descriptor is 65535. In order to
  151. * maintain a power of two alignment we have to limit ourselves to 32K.
  152. */
  153. #define IGB_MAX_TXD_PWR 15
  154. #define IGB_MAX_DATA_PER_TXD (1u << IGB_MAX_TXD_PWR)
  155. /* Tx Descriptors needed, worst case */
  156. #define TXD_USE_COUNT(S) DIV_ROUND_UP((S), IGB_MAX_DATA_PER_TXD)
  157. #define DESC_NEEDED (MAX_SKB_FRAGS + 4)
  158. /* EEPROM byte offsets */
  159. #define IGB_SFF_8472_SWAP 0x5C
  160. #define IGB_SFF_8472_COMP 0x5E
  161. /* Bitmasks */
  162. #define IGB_SFF_ADDRESSING_MODE 0x4
  163. #define IGB_SFF_8472_UNSUP 0x00
  164. /* wrapper around a pointer to a socket buffer,
  165. * so a DMA handle can be stored along with the buffer
  166. */
  167. struct igb_tx_buffer {
  168. union e1000_adv_tx_desc *next_to_watch;
  169. unsigned long time_stamp;
  170. struct sk_buff *skb;
  171. unsigned int bytecount;
  172. u16 gso_segs;
  173. __be16 protocol;
  174. DEFINE_DMA_UNMAP_ADDR(dma);
  175. DEFINE_DMA_UNMAP_LEN(len);
  176. u32 tx_flags;
  177. };
  178. struct igb_rx_buffer {
  179. dma_addr_t dma;
  180. struct page *page;
  181. unsigned int page_offset;
  182. };
  183. struct igb_tx_queue_stats {
  184. u64 packets;
  185. u64 bytes;
  186. u64 restart_queue;
  187. u64 restart_queue2;
  188. };
  189. struct igb_rx_queue_stats {
  190. u64 packets;
  191. u64 bytes;
  192. u64 drops;
  193. u64 csum_err;
  194. u64 alloc_failed;
  195. };
  196. struct igb_ring_container {
  197. struct igb_ring *ring; /* pointer to linked list of rings */
  198. unsigned int total_bytes; /* total bytes processed this int */
  199. unsigned int total_packets; /* total packets processed this int */
  200. u16 work_limit; /* total work allowed per interrupt */
  201. u8 count; /* total number of rings in vector */
  202. u8 itr; /* current ITR setting for ring */
  203. };
  204. struct igb_ring {
  205. struct igb_q_vector *q_vector; /* backlink to q_vector */
  206. struct net_device *netdev; /* back pointer to net_device */
  207. struct device *dev; /* device pointer for dma mapping */
  208. union { /* array of buffer info structs */
  209. struct igb_tx_buffer *tx_buffer_info;
  210. struct igb_rx_buffer *rx_buffer_info;
  211. };
  212. void *desc; /* descriptor ring memory */
  213. unsigned long flags; /* ring specific flags */
  214. void __iomem *tail; /* pointer to ring tail register */
  215. dma_addr_t dma; /* phys address of the ring */
  216. unsigned int size; /* length of desc. ring in bytes */
  217. u16 count; /* number of desc. in the ring */
  218. u8 queue_index; /* logical index of the ring*/
  219. u8 reg_idx; /* physical index of the ring */
  220. /* everything past this point are written often */
  221. u16 next_to_clean;
  222. u16 next_to_use;
  223. u16 next_to_alloc;
  224. union {
  225. /* TX */
  226. struct {
  227. struct igb_tx_queue_stats tx_stats;
  228. struct u64_stats_sync tx_syncp;
  229. struct u64_stats_sync tx_syncp2;
  230. };
  231. /* RX */
  232. struct {
  233. struct sk_buff *skb;
  234. struct igb_rx_queue_stats rx_stats;
  235. struct u64_stats_sync rx_syncp;
  236. };
  237. };
  238. } ____cacheline_internodealigned_in_smp;
  239. struct igb_q_vector {
  240. struct igb_adapter *adapter; /* backlink */
  241. int cpu; /* CPU for DCA */
  242. u32 eims_value; /* EIMS mask value */
  243. u16 itr_val;
  244. u8 set_itr;
  245. void __iomem *itr_register;
  246. struct igb_ring_container rx, tx;
  247. struct napi_struct napi;
  248. struct rcu_head rcu; /* to avoid race with update stats on free */
  249. char name[IFNAMSIZ + 9];
  250. /* for dynamic allocation of rings associated with this q_vector */
  251. struct igb_ring ring[0] ____cacheline_internodealigned_in_smp;
  252. };
  253. enum e1000_ring_flags_t {
  254. IGB_RING_FLAG_RX_SCTP_CSUM,
  255. IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
  256. IGB_RING_FLAG_TX_CTX_IDX,
  257. IGB_RING_FLAG_TX_DETECT_HANG
  258. };
  259. #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
  260. #define IGB_RX_DESC(R, i) \
  261. (&(((union e1000_adv_rx_desc *)((R)->desc))[i]))
  262. #define IGB_TX_DESC(R, i) \
  263. (&(((union e1000_adv_tx_desc *)((R)->desc))[i]))
  264. #define IGB_TX_CTXTDESC(R, i) \
  265. (&(((struct e1000_adv_tx_context_desc *)((R)->desc))[i]))
  266. /* igb_test_staterr - tests bits within Rx descriptor status and error fields */
  267. static inline __le32 igb_test_staterr(union e1000_adv_rx_desc *rx_desc,
  268. const u32 stat_err_bits)
  269. {
  270. return rx_desc->wb.upper.status_error & cpu_to_le32(stat_err_bits);
  271. }
  272. /* igb_desc_unused - calculate if we have unused descriptors */
  273. static inline int igb_desc_unused(struct igb_ring *ring)
  274. {
  275. if (ring->next_to_clean > ring->next_to_use)
  276. return ring->next_to_clean - ring->next_to_use - 1;
  277. return ring->count + ring->next_to_clean - ring->next_to_use - 1;
  278. }
  279. #ifdef CONFIG_IGB_HWMON
  280. #define IGB_HWMON_TYPE_LOC 0
  281. #define IGB_HWMON_TYPE_TEMP 1
  282. #define IGB_HWMON_TYPE_CAUTION 2
  283. #define IGB_HWMON_TYPE_MAX 3
  284. struct hwmon_attr {
  285. struct device_attribute dev_attr;
  286. struct e1000_hw *hw;
  287. struct e1000_thermal_diode_data *sensor;
  288. char name[12];
  289. };
  290. struct hwmon_buff {
  291. struct attribute_group group;
  292. const struct attribute_group *groups[2];
  293. struct attribute *attrs[E1000_MAX_SENSORS * 4 + 1];
  294. struct hwmon_attr hwmon_list[E1000_MAX_SENSORS * 4];
  295. unsigned int n_hwmon;
  296. };
  297. #endif
  298. /* The number of L2 ether-type filter registers, Index 3 is reserved
  299. * for PTP 1588 timestamp
  300. */
  301. #define MAX_ETYPE_FILTER (4 - 1)
  302. /* ETQF filter list: one static filter per filter consumer. This is
  303. * to avoid filter collisions later. Add new filters here!!
  304. *
  305. * Current filters: Filter 3
  306. */
  307. #define IGB_ETQF_FILTER_1588 3
  308. #define IGB_N_EXTTS 2
  309. #define IGB_N_PEROUT 2
  310. #define IGB_N_SDP 4
  311. #define IGB_RETA_SIZE 128
  312. enum igb_filter_match_flags {
  313. IGB_FILTER_FLAG_ETHER_TYPE = 0x1,
  314. IGB_FILTER_FLAG_VLAN_TCI = 0x2,
  315. };
  316. #define IGB_MAX_RXNFC_FILTERS 16
  317. /* RX network flow classification data structure */
  318. struct igb_nfc_input {
  319. /* Byte layout in order, all values with MSB first:
  320. * match_flags - 1 byte
  321. * etype - 2 bytes
  322. * vlan_tci - 2 bytes
  323. */
  324. u8 match_flags;
  325. __be16 etype;
  326. __be16 vlan_tci;
  327. };
  328. struct igb_nfc_filter {
  329. struct hlist_node nfc_node;
  330. struct igb_nfc_input filter;
  331. u16 etype_reg_index;
  332. u16 sw_idx;
  333. u16 action;
  334. };
  335. /* board specific private data structure */
  336. struct igb_adapter {
  337. unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
  338. struct net_device *netdev;
  339. unsigned long state;
  340. unsigned int flags;
  341. unsigned int num_q_vectors;
  342. struct msix_entry msix_entries[MAX_MSIX_ENTRIES];
  343. /* Interrupt Throttle Rate */
  344. u32 rx_itr_setting;
  345. u32 tx_itr_setting;
  346. u16 tx_itr;
  347. u16 rx_itr;
  348. /* TX */
  349. u16 tx_work_limit;
  350. u32 tx_timeout_count;
  351. int num_tx_queues;
  352. struct igb_ring *tx_ring[16];
  353. /* RX */
  354. int num_rx_queues;
  355. struct igb_ring *rx_ring[16];
  356. u32 max_frame_size;
  357. u32 min_frame_size;
  358. struct timer_list watchdog_timer;
  359. struct timer_list phy_info_timer;
  360. u16 mng_vlan_id;
  361. u32 bd_number;
  362. u32 wol;
  363. u32 en_mng_pt;
  364. u16 link_speed;
  365. u16 link_duplex;
  366. u8 __iomem *io_addr; /* Mainly for iounmap use */
  367. struct work_struct reset_task;
  368. struct work_struct watchdog_task;
  369. bool fc_autoneg;
  370. u8 tx_timeout_factor;
  371. struct timer_list blink_timer;
  372. unsigned long led_status;
  373. /* OS defined structs */
  374. struct pci_dev *pdev;
  375. spinlock_t stats64_lock;
  376. struct rtnl_link_stats64 stats64;
  377. /* structs defined in e1000_hw.h */
  378. struct e1000_hw hw;
  379. struct e1000_hw_stats stats;
  380. struct e1000_phy_info phy_info;
  381. u32 test_icr;
  382. struct igb_ring test_tx_ring;
  383. struct igb_ring test_rx_ring;
  384. int msg_enable;
  385. struct igb_q_vector *q_vector[MAX_Q_VECTORS];
  386. u32 eims_enable_mask;
  387. u32 eims_other;
  388. /* to not mess up cache alignment, always add to the bottom */
  389. u16 tx_ring_count;
  390. u16 rx_ring_count;
  391. unsigned int vfs_allocated_count;
  392. struct vf_data_storage *vf_data;
  393. int vf_rate_link_speed;
  394. u32 rss_queues;
  395. u32 wvbr;
  396. u32 *shadow_vfta;
  397. struct ptp_clock *ptp_clock;
  398. struct ptp_clock_info ptp_caps;
  399. struct delayed_work ptp_overflow_work;
  400. struct work_struct ptp_tx_work;
  401. struct sk_buff *ptp_tx_skb;
  402. struct hwtstamp_config tstamp_config;
  403. unsigned long ptp_tx_start;
  404. unsigned long last_rx_ptp_check;
  405. unsigned long last_rx_timestamp;
  406. unsigned int ptp_flags;
  407. spinlock_t tmreg_lock;
  408. struct cyclecounter cc;
  409. struct timecounter tc;
  410. u32 tx_hwtstamp_timeouts;
  411. u32 rx_hwtstamp_cleared;
  412. bool pps_sys_wrap_on;
  413. struct ptp_pin_desc sdp_config[IGB_N_SDP];
  414. struct {
  415. struct timespec64 start;
  416. struct timespec64 period;
  417. } perout[IGB_N_PEROUT];
  418. char fw_version[32];
  419. #ifdef CONFIG_IGB_HWMON
  420. struct hwmon_buff *igb_hwmon_buff;
  421. bool ets;
  422. #endif
  423. struct i2c_algo_bit_data i2c_algo;
  424. struct i2c_adapter i2c_adap;
  425. struct i2c_client *i2c_client;
  426. u32 rss_indir_tbl_init;
  427. u8 rss_indir_tbl[IGB_RETA_SIZE];
  428. unsigned long link_check_timeout;
  429. int copper_tries;
  430. struct e1000_info ei;
  431. u16 eee_advert;
  432. /* RX network flow classification support */
  433. struct hlist_head nfc_filter_list;
  434. unsigned int nfc_filter_count;
  435. /* lock for RX network flow classification filter */
  436. spinlock_t nfc_lock;
  437. bool etype_bitmap[MAX_ETYPE_FILTER];
  438. };
  439. /* flags controlling PTP/1588 function */
  440. #define IGB_PTP_ENABLED BIT(0)
  441. #define IGB_PTP_OVERFLOW_CHECK BIT(1)
  442. #define IGB_FLAG_HAS_MSI BIT(0)
  443. #define IGB_FLAG_DCA_ENABLED BIT(1)
  444. #define IGB_FLAG_QUAD_PORT_A BIT(2)
  445. #define IGB_FLAG_QUEUE_PAIRS BIT(3)
  446. #define IGB_FLAG_DMAC BIT(4)
  447. #define IGB_FLAG_RSS_FIELD_IPV4_UDP BIT(6)
  448. #define IGB_FLAG_RSS_FIELD_IPV6_UDP BIT(7)
  449. #define IGB_FLAG_WOL_SUPPORTED BIT(8)
  450. #define IGB_FLAG_NEED_LINK_UPDATE BIT(9)
  451. #define IGB_FLAG_MEDIA_RESET BIT(10)
  452. #define IGB_FLAG_MAS_CAPABLE BIT(11)
  453. #define IGB_FLAG_MAS_ENABLE BIT(12)
  454. #define IGB_FLAG_HAS_MSIX BIT(13)
  455. #define IGB_FLAG_EEE BIT(14)
  456. #define IGB_FLAG_VLAN_PROMISC BIT(15)
  457. /* Media Auto Sense */
  458. #define IGB_MAS_ENABLE_0 0X0001
  459. #define IGB_MAS_ENABLE_1 0X0002
  460. #define IGB_MAS_ENABLE_2 0X0004
  461. #define IGB_MAS_ENABLE_3 0X0008
  462. /* DMA Coalescing defines */
  463. #define IGB_MIN_TXPBSIZE 20408
  464. #define IGB_TX_BUF_4096 4096
  465. #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000 /* Disable DMA Coal Flush */
  466. #define IGB_82576_TSYNC_SHIFT 19
  467. #define IGB_TS_HDR_LEN 16
  468. enum e1000_state_t {
  469. __IGB_TESTING,
  470. __IGB_RESETTING,
  471. __IGB_DOWN,
  472. __IGB_PTP_TX_IN_PROGRESS,
  473. };
  474. enum igb_boards {
  475. board_82575,
  476. };
  477. extern char igb_driver_name[];
  478. extern char igb_driver_version[];
  479. int igb_open(struct net_device *netdev);
  480. int igb_close(struct net_device *netdev);
  481. int igb_up(struct igb_adapter *);
  482. void igb_down(struct igb_adapter *);
  483. void igb_reinit_locked(struct igb_adapter *);
  484. void igb_reset(struct igb_adapter *);
  485. int igb_reinit_queues(struct igb_adapter *);
  486. void igb_write_rss_indir_tbl(struct igb_adapter *);
  487. int igb_set_spd_dplx(struct igb_adapter *, u32, u8);
  488. int igb_setup_tx_resources(struct igb_ring *);
  489. int igb_setup_rx_resources(struct igb_ring *);
  490. void igb_free_tx_resources(struct igb_ring *);
  491. void igb_free_rx_resources(struct igb_ring *);
  492. void igb_configure_tx_ring(struct igb_adapter *, struct igb_ring *);
  493. void igb_configure_rx_ring(struct igb_adapter *, struct igb_ring *);
  494. void igb_setup_tctl(struct igb_adapter *);
  495. void igb_setup_rctl(struct igb_adapter *);
  496. netdev_tx_t igb_xmit_frame_ring(struct sk_buff *, struct igb_ring *);
  497. void igb_unmap_and_free_tx_resource(struct igb_ring *, struct igb_tx_buffer *);
  498. void igb_alloc_rx_buffers(struct igb_ring *, u16);
  499. void igb_update_stats(struct igb_adapter *, struct rtnl_link_stats64 *);
  500. bool igb_has_link(struct igb_adapter *adapter);
  501. void igb_set_ethtool_ops(struct net_device *);
  502. void igb_power_up_link(struct igb_adapter *);
  503. void igb_set_fw_version(struct igb_adapter *);
  504. void igb_ptp_init(struct igb_adapter *adapter);
  505. void igb_ptp_stop(struct igb_adapter *adapter);
  506. void igb_ptp_reset(struct igb_adapter *adapter);
  507. void igb_ptp_suspend(struct igb_adapter *adapter);
  508. void igb_ptp_rx_hang(struct igb_adapter *adapter);
  509. void igb_ptp_rx_rgtstamp(struct igb_q_vector *q_vector, struct sk_buff *skb);
  510. void igb_ptp_rx_pktstamp(struct igb_q_vector *q_vector, unsigned char *va,
  511. struct sk_buff *skb);
  512. int igb_ptp_set_ts_config(struct net_device *netdev, struct ifreq *ifr);
  513. int igb_ptp_get_ts_config(struct net_device *netdev, struct ifreq *ifr);
  514. void igb_set_flag_queue_pairs(struct igb_adapter *, const u32);
  515. #ifdef CONFIG_IGB_HWMON
  516. void igb_sysfs_exit(struct igb_adapter *adapter);
  517. int igb_sysfs_init(struct igb_adapter *adapter);
  518. #endif
  519. static inline s32 igb_reset_phy(struct e1000_hw *hw)
  520. {
  521. if (hw->phy.ops.reset)
  522. return hw->phy.ops.reset(hw);
  523. return 0;
  524. }
  525. static inline s32 igb_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
  526. {
  527. if (hw->phy.ops.read_reg)
  528. return hw->phy.ops.read_reg(hw, offset, data);
  529. return 0;
  530. }
  531. static inline s32 igb_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
  532. {
  533. if (hw->phy.ops.write_reg)
  534. return hw->phy.ops.write_reg(hw, offset, data);
  535. return 0;
  536. }
  537. static inline s32 igb_get_phy_info(struct e1000_hw *hw)
  538. {
  539. if (hw->phy.ops.get_phy_info)
  540. return hw->phy.ops.get_phy_info(hw);
  541. return 0;
  542. }
  543. static inline struct netdev_queue *txring_txq(const struct igb_ring *tx_ring)
  544. {
  545. return netdev_get_tx_queue(tx_ring->netdev, tx_ring->queue_index);
  546. }
  547. int igb_add_filter(struct igb_adapter *adapter,
  548. struct igb_nfc_filter *input);
  549. int igb_erase_filter(struct igb_adapter *adapter,
  550. struct igb_nfc_filter *input);
  551. #endif /* _IGB_H_ */