42 #include <linux/bitops.h>
43 #include <linux/if_vlan.h>
48 #define IGB_START_ITR 648
49 #define IGB_4K_ITR 980
50 #define IGB_20K_ITR 196
51 #define IGB_70K_ITR 56
54 #define IGB_DEFAULT_TXD 256
55 #define IGB_DEFAULT_TX_WORK 128
56 #define IGB_MIN_TXD 80
57 #define IGB_MAX_TXD 4096
59 #define IGB_DEFAULT_RXD 256
60 #define IGB_MIN_RXD 80
61 #define IGB_MAX_RXD 4096
63 #define IGB_DEFAULT_ITR 3
64 #define IGB_MAX_ITR_USECS 10000
65 #define IGB_MIN_ITR_USECS 10
66 #define NON_Q_VECTORS 1
67 #define MAX_Q_VECTORS 8
70 #define IGB_MAX_RX_QUEUES 8
71 #define IGB_MAX_RX_QUEUES_82575 4
72 #define IGB_MAX_RX_QUEUES_I211 2
73 #define IGB_MAX_TX_QUEUES 8
74 #define IGB_MAX_VF_MC_ENTRIES 30
75 #define IGB_MAX_VF_FUNCTIONS 8
76 #define IGB_MAX_VFTA_ENTRIES 128
77 #define IGB_82576_VF_DEV_ID 0x10CA
78 #define IGB_I350_VF_DEV_ID 0x1520
81 #define IGB_MAJOR_MASK 0xF000
82 #define IGB_MINOR_MASK 0x0FF0
83 #define IGB_BUILD_MASK 0x000F
84 #define IGB_COMB_VER_MASK 0x00FF
85 #define IGB_MAJOR_SHIFT 12
86 #define IGB_MINOR_SHIFT 4
87 #define IGB_COMB_VER_SHFT 8
88 #define IGB_NVM_VER_INVALID 0xFFFF
89 #define IGB_ETRACK_SHIFT 16
90 #define NVM_ETRACK_WORD 0x0042
91 #define NVM_COMB_VER_OFF 0x0083
92 #define NVM_COMB_VER_PTR 0x003d
106 #define IGB_VF_FLAG_CTS 0x00000001
107 #define IGB_VF_FLAG_UNI_PROMISC 0x00000002
108 #define IGB_VF_FLAG_MULTI_PROMISC 0x00000004
109 #define IGB_VF_FLAG_PF_SET_MAC 0x00000008
122 #define IGB_RX_PTHRESH 8
123 #define IGB_RX_HTHRESH 8
124 #define IGB_TX_PTHRESH 8
125 #define IGB_TX_HTHRESH 1
126 #define IGB_RX_WTHRESH ((hw->mac.type == e1000_82576 && \
127 adapter->msix_entries) ? 1 : 4)
128 #define IGB_TX_WTHRESH ((hw->mac.type == e1000_82576 && \
129 adapter->msix_entries) ? 1 : 16)
132 #define MAXIMUM_ETHERNET_VLAN_SIZE 1522
135 #define IGB_RXBUFFER_256 256
136 #define IGB_RXBUFFER_16384 16384
137 #define IGB_RX_HDR_LEN IGB_RXBUFFER_256
140 #define IGB_TX_QUEUE_WAKE 16
142 #define IGB_RX_BUFFER_WRITE 16
144 #define AUTO_ALL_MODES 0
145 #define IGB_EEPROM_APME 0x0400
147 #ifndef IGB_MASTER_SLAVE
149 #define IGB_MASTER_SLAVE e1000_ms_hw_default
152 #define IGB_MNG_VLAN_NONE -1
154 #define IGB_TX_FLAGS_CSUM 0x00000001
155 #define IGB_TX_FLAGS_VLAN 0x00000002
156 #define IGB_TX_FLAGS_TSO 0x00000004
157 #define IGB_TX_FLAGS_IPV4 0x00000008
158 #define IGB_TX_FLAGS_TSTAMP 0x00000010
159 #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000
160 #define IGB_TX_FLAGS_VLAN_SHIFT 16
269 #define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
271 #define IGB_RX_DESC(R, i) \
272 (&(((union e1000_adv_rx_desc *)((R)->desc))[i]))
273 #define IGB_TX_DESC(R, i) \
274 (&(((union e1000_adv_tx_desc *)((R)->desc))[i]))
275 #define IGB_TX_CTXTDESC(R, i) \
276 (&(((struct e1000_adv_tx_context_desc *)((R)->desc))[i]))
280 const u32 stat_err_bits)
282 return rx_desc->
wb.upper.status_error &
cpu_to_le32(stat_err_bits);
286 static inline int igb_desc_unused(
struct igb_ring *
ring)
289 return ring->next_to_clean - ring->
next_to_use - 1;
376 #ifdef CONFIG_IGB_PTP
390 #define IGB_FLAG_HAS_MSI (1 << 0)
391 #define IGB_FLAG_DCA_ENABLED (1 << 1)
392 #define IGB_FLAG_QUAD_PORT_A (1 << 2)
393 #define IGB_FLAG_QUEUE_PAIRS (1 << 3)
394 #define IGB_FLAG_DMAC (1 << 4)
395 #define IGB_FLAG_PTP (1 << 5)
398 #define IGB_MIN_TXPBSIZE 20408
399 #define IGB_TX_BUF_4096 4096
400 #define IGB_DMCTLX_DCFLUSH_DIS 0x80000000
402 #define IGB_82576_TSYNC_SHIFT 19
403 #define IGB_TS_HDR_LEN 16
439 #ifdef CONFIG_IGB_PTP
454 if (hw->
phy.ops.reset)
455 return hw->
phy.ops.reset(hw);
462 if (hw->
phy.ops.read_reg)
463 return hw->
phy.ops.read_reg(hw, offset, data);
470 if (hw->
phy.ops.write_reg)
471 return hw->
phy.ops.write_reg(hw, offset, data);
476 static inline s32 igb_get_phy_info(
struct e1000_hw *hw)
478 if (hw->
phy.ops.get_phy_info)
479 return hw->
phy.ops.get_phy_info(hw);