1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2019-2020 Intel Corporation
8 #include <rte_string_fns.h>
10 #include <rte_bus_pci.h>
11 #include <rte_ethdev_driver.h>
12 #include <rte_ethdev_pci.h>
13 #include <rte_malloc.h>
14 #include <rte_alarm.h>
19 #define IGC_INTEL_VENDOR_ID 0x8086
22 * The overhead from MTU to max frame size.
23 * Considering VLAN so tag needs to be counted.
25 #define IGC_ETH_OVERHEAD (RTE_ETHER_HDR_LEN + \
26 RTE_ETHER_CRC_LEN + VLAN_TAG_SIZE)
28 #define IGC_FC_PAUSE_TIME 0x0680
29 #define IGC_LINK_UPDATE_CHECK_TIMEOUT 90 /* 9s */
30 #define IGC_LINK_UPDATE_CHECK_INTERVAL 100 /* ms */
32 #define IGC_MISC_VEC_ID RTE_INTR_VEC_ZERO_OFFSET
33 #define IGC_RX_VEC_START RTE_INTR_VEC_RXTX_OFFSET
34 #define IGC_MSIX_OTHER_INTR_VEC 0 /* MSI-X other interrupt vector */
35 #define IGC_FLAG_NEED_LINK_UPDATE (1u << 0) /* need update link */
37 #define IGC_DEFAULT_RX_FREE_THRESH 32
39 #define IGC_DEFAULT_RX_PTHRESH 8
40 #define IGC_DEFAULT_RX_HTHRESH 8
41 #define IGC_DEFAULT_RX_WTHRESH 4
43 #define IGC_DEFAULT_TX_PTHRESH 8
44 #define IGC_DEFAULT_TX_HTHRESH 1
45 #define IGC_DEFAULT_TX_WTHRESH 16
47 /* MSI-X other interrupt vector */
48 #define IGC_MSIX_OTHER_INTR_VEC 0
50 /* External VLAN Enable bit mask */
51 #define IGC_CTRL_EXT_EXT_VLAN (1u << 26)
54 #define IGC_CTRL_SPEED_MASK (7u << 8)
55 #define IGC_CTRL_SPEED_2500 (6u << 8)
57 /* External VLAN Ether Type bit mask and shift */
58 #define IGC_VET_EXT 0xFFFF0000
59 #define IGC_VET_EXT_SHIFT 16
61 /* Force EEE Auto-negotiation */
62 #define IGC_EEER_EEE_FRC_AN (1u << 28)
64 /* Per Queue Good Packets Received Count */
65 #define IGC_PQGPRC(idx) (0x10010 + 0x100 * (idx))
66 /* Per Queue Good Octets Received Count */
67 #define IGC_PQGORC(idx) (0x10018 + 0x100 * (idx))
68 /* Per Queue Good Octets Transmitted Count */
69 #define IGC_PQGOTC(idx) (0x10034 + 0x100 * (idx))
70 /* Per Queue Multicast Packets Received Count */
71 #define IGC_PQMPRC(idx) (0x10038 + 0x100 * (idx))
72 /* Transmit Queue Drop Packet Count */
73 #define IGC_TQDPC(idx) (0xe030 + 0x40 * (idx))
75 #if RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN
76 #define U32_0_IN_U64 0 /* lower bytes of u64 */
77 #define U32_1_IN_U64 1 /* higher bytes of u64 */
79 #define U32_0_IN_U64 1
80 #define U32_1_IN_U64 0
83 #define IGC_ALARM_INTERVAL 8000000u
84 /* us, about 13.6s some per-queue registers will wrap around back to 0. */
86 static const struct rte_eth_desc_lim rx_desc_lim = {
87 .nb_max = IGC_MAX_RXD,
88 .nb_min = IGC_MIN_RXD,
89 .nb_align = IGC_RXD_ALIGN,
92 static const struct rte_eth_desc_lim tx_desc_lim = {
93 .nb_max = IGC_MAX_TXD,
94 .nb_min = IGC_MIN_TXD,
95 .nb_align = IGC_TXD_ALIGN,
96 .nb_seg_max = IGC_TX_MAX_SEG,
97 .nb_mtu_seg_max = IGC_TX_MAX_MTU_SEG,
100 static const struct rte_pci_id pci_id_igc_map[] = {
101 { RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_LM) },
102 { RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_V) },
103 { RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_I) },
104 { RTE_PCI_DEVICE(IGC_INTEL_VENDOR_ID, IGC_DEV_ID_I225_K) },
105 { .vendor_id = 0, /* sentinel */ },
108 /* store statistics names and its offset in stats structure */
109 struct rte_igc_xstats_name_off {
110 char name[RTE_ETH_XSTATS_NAME_SIZE];
114 static const struct rte_igc_xstats_name_off rte_igc_stats_strings[] = {
115 {"rx_crc_errors", offsetof(struct igc_hw_stats, crcerrs)},
116 {"rx_align_errors", offsetof(struct igc_hw_stats, algnerrc)},
117 {"rx_errors", offsetof(struct igc_hw_stats, rxerrc)},
118 {"rx_missed_packets", offsetof(struct igc_hw_stats, mpc)},
119 {"tx_single_collision_packets", offsetof(struct igc_hw_stats, scc)},
120 {"tx_multiple_collision_packets", offsetof(struct igc_hw_stats, mcc)},
121 {"tx_excessive_collision_packets", offsetof(struct igc_hw_stats,
123 {"tx_late_collisions", offsetof(struct igc_hw_stats, latecol)},
124 {"tx_total_collisions", offsetof(struct igc_hw_stats, colc)},
125 {"tx_deferred_packets", offsetof(struct igc_hw_stats, dc)},
126 {"tx_no_carrier_sense_packets", offsetof(struct igc_hw_stats, tncrs)},
127 {"tx_discarded_packets", offsetof(struct igc_hw_stats, htdpmc)},
128 {"rx_length_errors", offsetof(struct igc_hw_stats, rlec)},
129 {"rx_xon_packets", offsetof(struct igc_hw_stats, xonrxc)},
130 {"tx_xon_packets", offsetof(struct igc_hw_stats, xontxc)},
131 {"rx_xoff_packets", offsetof(struct igc_hw_stats, xoffrxc)},
132 {"tx_xoff_packets", offsetof(struct igc_hw_stats, xofftxc)},
133 {"rx_flow_control_unsupported_packets", offsetof(struct igc_hw_stats,
135 {"rx_size_64_packets", offsetof(struct igc_hw_stats, prc64)},
136 {"rx_size_65_to_127_packets", offsetof(struct igc_hw_stats, prc127)},
137 {"rx_size_128_to_255_packets", offsetof(struct igc_hw_stats, prc255)},
138 {"rx_size_256_to_511_packets", offsetof(struct igc_hw_stats, prc511)},
139 {"rx_size_512_to_1023_packets", offsetof(struct igc_hw_stats,
141 {"rx_size_1024_to_max_packets", offsetof(struct igc_hw_stats,
143 {"rx_broadcast_packets", offsetof(struct igc_hw_stats, bprc)},
144 {"rx_multicast_packets", offsetof(struct igc_hw_stats, mprc)},
145 {"rx_undersize_errors", offsetof(struct igc_hw_stats, ruc)},
146 {"rx_fragment_errors", offsetof(struct igc_hw_stats, rfc)},
147 {"rx_oversize_errors", offsetof(struct igc_hw_stats, roc)},
148 {"rx_jabber_errors", offsetof(struct igc_hw_stats, rjc)},
149 {"rx_no_buffers", offsetof(struct igc_hw_stats, rnbc)},
150 {"rx_management_packets", offsetof(struct igc_hw_stats, mgprc)},
151 {"rx_management_dropped", offsetof(struct igc_hw_stats, mgpdc)},
152 {"tx_management_packets", offsetof(struct igc_hw_stats, mgptc)},
153 {"rx_total_packets", offsetof(struct igc_hw_stats, tpr)},
154 {"tx_total_packets", offsetof(struct igc_hw_stats, tpt)},
155 {"rx_total_bytes", offsetof(struct igc_hw_stats, tor)},
156 {"tx_total_bytes", offsetof(struct igc_hw_stats, tot)},
157 {"tx_size_64_packets", offsetof(struct igc_hw_stats, ptc64)},
158 {"tx_size_65_to_127_packets", offsetof(struct igc_hw_stats, ptc127)},
159 {"tx_size_128_to_255_packets", offsetof(struct igc_hw_stats, ptc255)},
160 {"tx_size_256_to_511_packets", offsetof(struct igc_hw_stats, ptc511)},
161 {"tx_size_512_to_1023_packets", offsetof(struct igc_hw_stats,
163 {"tx_size_1023_to_max_packets", offsetof(struct igc_hw_stats,
165 {"tx_multicast_packets", offsetof(struct igc_hw_stats, mptc)},
166 {"tx_broadcast_packets", offsetof(struct igc_hw_stats, bptc)},
167 {"tx_tso_packets", offsetof(struct igc_hw_stats, tsctc)},
168 {"rx_sent_to_host_packets", offsetof(struct igc_hw_stats, rpthc)},
169 {"tx_sent_by_host_packets", offsetof(struct igc_hw_stats, hgptc)},
170 {"interrupt_assert_count", offsetof(struct igc_hw_stats, iac)},
171 {"rx_descriptor_lower_threshold",
172 offsetof(struct igc_hw_stats, icrxdmtc)},
175 #define IGC_NB_XSTATS (sizeof(rte_igc_stats_strings) / \
176 sizeof(rte_igc_stats_strings[0]))
178 static int eth_igc_configure(struct rte_eth_dev *dev);
179 static int eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete);
180 static void eth_igc_stop(struct rte_eth_dev *dev);
181 static int eth_igc_start(struct rte_eth_dev *dev);
182 static int eth_igc_set_link_up(struct rte_eth_dev *dev);
183 static int eth_igc_set_link_down(struct rte_eth_dev *dev);
184 static void eth_igc_close(struct rte_eth_dev *dev);
185 static int eth_igc_reset(struct rte_eth_dev *dev);
186 static int eth_igc_promiscuous_enable(struct rte_eth_dev *dev);
187 static int eth_igc_promiscuous_disable(struct rte_eth_dev *dev);
188 static int eth_igc_fw_version_get(struct rte_eth_dev *dev,
189 char *fw_version, size_t fw_size);
190 static int eth_igc_infos_get(struct rte_eth_dev *dev,
191 struct rte_eth_dev_info *dev_info);
192 static int eth_igc_led_on(struct rte_eth_dev *dev);
193 static int eth_igc_led_off(struct rte_eth_dev *dev);
194 static const uint32_t *eth_igc_supported_ptypes_get(struct rte_eth_dev *dev);
195 static int eth_igc_rar_set(struct rte_eth_dev *dev,
196 struct rte_ether_addr *mac_addr, uint32_t index, uint32_t pool);
197 static void eth_igc_rar_clear(struct rte_eth_dev *dev, uint32_t index);
198 static int eth_igc_default_mac_addr_set(struct rte_eth_dev *dev,
199 struct rte_ether_addr *addr);
200 static int eth_igc_set_mc_addr_list(struct rte_eth_dev *dev,
201 struct rte_ether_addr *mc_addr_set,
202 uint32_t nb_mc_addr);
203 static int eth_igc_allmulticast_enable(struct rte_eth_dev *dev);
204 static int eth_igc_allmulticast_disable(struct rte_eth_dev *dev);
205 static int eth_igc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
206 static int eth_igc_stats_get(struct rte_eth_dev *dev,
207 struct rte_eth_stats *rte_stats);
208 static int eth_igc_xstats_get(struct rte_eth_dev *dev,
209 struct rte_eth_xstat *xstats, unsigned int n);
210 static int eth_igc_xstats_get_by_id(struct rte_eth_dev *dev,
212 uint64_t *values, unsigned int n);
213 static int eth_igc_xstats_get_names(struct rte_eth_dev *dev,
214 struct rte_eth_xstat_name *xstats_names,
216 static int eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
217 struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
219 static int eth_igc_xstats_reset(struct rte_eth_dev *dev);
221 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
222 uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx);
224 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id);
226 eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id);
228 eth_igc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf);
230 eth_igc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf);
231 static int eth_igc_rss_reta_update(struct rte_eth_dev *dev,
232 struct rte_eth_rss_reta_entry64 *reta_conf,
234 static int eth_igc_rss_reta_query(struct rte_eth_dev *dev,
235 struct rte_eth_rss_reta_entry64 *reta_conf,
237 static int eth_igc_rss_hash_update(struct rte_eth_dev *dev,
238 struct rte_eth_rss_conf *rss_conf);
239 static int eth_igc_rss_hash_conf_get(struct rte_eth_dev *dev,
240 struct rte_eth_rss_conf *rss_conf);
242 eth_igc_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on);
243 static int eth_igc_vlan_offload_set(struct rte_eth_dev *dev, int mask);
244 static int eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
245 enum rte_vlan_type vlan_type, uint16_t tpid);
247 static const struct eth_dev_ops eth_igc_ops = {
248 .dev_configure = eth_igc_configure,
249 .link_update = eth_igc_link_update,
250 .dev_stop = eth_igc_stop,
251 .dev_start = eth_igc_start,
252 .dev_close = eth_igc_close,
253 .dev_reset = eth_igc_reset,
254 .dev_set_link_up = eth_igc_set_link_up,
255 .dev_set_link_down = eth_igc_set_link_down,
256 .promiscuous_enable = eth_igc_promiscuous_enable,
257 .promiscuous_disable = eth_igc_promiscuous_disable,
258 .allmulticast_enable = eth_igc_allmulticast_enable,
259 .allmulticast_disable = eth_igc_allmulticast_disable,
260 .fw_version_get = eth_igc_fw_version_get,
261 .dev_infos_get = eth_igc_infos_get,
262 .dev_led_on = eth_igc_led_on,
263 .dev_led_off = eth_igc_led_off,
264 .dev_supported_ptypes_get = eth_igc_supported_ptypes_get,
265 .mtu_set = eth_igc_mtu_set,
266 .mac_addr_add = eth_igc_rar_set,
267 .mac_addr_remove = eth_igc_rar_clear,
268 .mac_addr_set = eth_igc_default_mac_addr_set,
269 .set_mc_addr_list = eth_igc_set_mc_addr_list,
271 .rx_queue_setup = eth_igc_rx_queue_setup,
272 .rx_queue_release = eth_igc_rx_queue_release,
273 .rx_queue_count = eth_igc_rx_queue_count,
274 .rx_descriptor_done = eth_igc_rx_descriptor_done,
275 .rx_descriptor_status = eth_igc_rx_descriptor_status,
276 .tx_descriptor_status = eth_igc_tx_descriptor_status,
277 .tx_queue_setup = eth_igc_tx_queue_setup,
278 .tx_queue_release = eth_igc_tx_queue_release,
279 .tx_done_cleanup = eth_igc_tx_done_cleanup,
280 .rxq_info_get = eth_igc_rxq_info_get,
281 .txq_info_get = eth_igc_txq_info_get,
282 .stats_get = eth_igc_stats_get,
283 .xstats_get = eth_igc_xstats_get,
284 .xstats_get_by_id = eth_igc_xstats_get_by_id,
285 .xstats_get_names_by_id = eth_igc_xstats_get_names_by_id,
286 .xstats_get_names = eth_igc_xstats_get_names,
287 .stats_reset = eth_igc_xstats_reset,
288 .xstats_reset = eth_igc_xstats_reset,
289 .queue_stats_mapping_set = eth_igc_queue_stats_mapping_set,
290 .rx_queue_intr_enable = eth_igc_rx_queue_intr_enable,
291 .rx_queue_intr_disable = eth_igc_rx_queue_intr_disable,
292 .flow_ctrl_get = eth_igc_flow_ctrl_get,
293 .flow_ctrl_set = eth_igc_flow_ctrl_set,
294 .reta_update = eth_igc_rss_reta_update,
295 .reta_query = eth_igc_rss_reta_query,
296 .rss_hash_update = eth_igc_rss_hash_update,
297 .rss_hash_conf_get = eth_igc_rss_hash_conf_get,
298 .vlan_filter_set = eth_igc_vlan_filter_set,
299 .vlan_offload_set = eth_igc_vlan_offload_set,
300 .vlan_tpid_set = eth_igc_vlan_tpid_set,
301 .vlan_strip_queue_set = eth_igc_vlan_strip_queue_set,
305 * multiple queue mode checking
308 igc_check_mq_mode(struct rte_eth_dev *dev)
310 enum rte_eth_rx_mq_mode rx_mq_mode = dev->data->dev_conf.rxmode.mq_mode;
311 enum rte_eth_tx_mq_mode tx_mq_mode = dev->data->dev_conf.txmode.mq_mode;
313 if (RTE_ETH_DEV_SRIOV(dev).active != 0) {
314 PMD_INIT_LOG(ERR, "SRIOV is not supported.");
318 if (rx_mq_mode != ETH_MQ_RX_NONE &&
319 rx_mq_mode != ETH_MQ_RX_RSS) {
320 /* RSS together with VMDq not supported*/
321 PMD_INIT_LOG(ERR, "RX mode %d is not supported.",
326 /* To no break software that set invalid mode, only display
327 * warning if invalid mode is used.
329 if (tx_mq_mode != ETH_MQ_TX_NONE)
330 PMD_INIT_LOG(WARNING,
331 "TX mode %d is not supported. Due to meaningless in this driver, just ignore",
338 eth_igc_configure(struct rte_eth_dev *dev)
340 struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
343 PMD_INIT_FUNC_TRACE();
345 ret = igc_check_mq_mode(dev);
349 intr->flags |= IGC_FLAG_NEED_LINK_UPDATE;
354 eth_igc_set_link_up(struct rte_eth_dev *dev)
356 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
358 if (hw->phy.media_type == igc_media_type_copper)
359 igc_power_up_phy(hw);
361 igc_power_up_fiber_serdes_link(hw);
366 eth_igc_set_link_down(struct rte_eth_dev *dev)
368 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
370 if (hw->phy.media_type == igc_media_type_copper)
371 igc_power_down_phy(hw);
373 igc_shutdown_fiber_serdes_link(hw);
378 * disable other interrupt
381 igc_intr_other_disable(struct rte_eth_dev *dev)
383 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
384 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
385 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
387 if (rte_intr_allow_others(intr_handle) &&
388 dev->data->dev_conf.intr_conf.lsc) {
389 IGC_WRITE_REG(hw, IGC_EIMC, 1u << IGC_MSIX_OTHER_INTR_VEC);
392 IGC_WRITE_REG(hw, IGC_IMC, ~0);
397 * enable other interrupt
400 igc_intr_other_enable(struct rte_eth_dev *dev)
402 struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
403 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
404 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
405 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
407 if (rte_intr_allow_others(intr_handle) &&
408 dev->data->dev_conf.intr_conf.lsc) {
409 IGC_WRITE_REG(hw, IGC_EIMS, 1u << IGC_MSIX_OTHER_INTR_VEC);
412 IGC_WRITE_REG(hw, IGC_IMS, intr->mask);
417 * It reads ICR and gets interrupt causes, check it and set a bit flag
418 * to update link status.
421 eth_igc_interrupt_get_status(struct rte_eth_dev *dev)
424 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
425 struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
427 /* read-on-clear nic registers here */
428 icr = IGC_READ_REG(hw, IGC_ICR);
431 if (icr & IGC_ICR_LSC)
432 intr->flags |= IGC_FLAG_NEED_LINK_UPDATE;
435 /* return 0 means link status changed, -1 means not changed */
437 eth_igc_link_update(struct rte_eth_dev *dev, int wait_to_complete)
439 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
440 struct rte_eth_link link;
441 int link_check, count;
444 hw->mac.get_link_status = 1;
446 /* possible wait-to-complete in up to 9 seconds */
447 for (count = 0; count < IGC_LINK_UPDATE_CHECK_TIMEOUT; count++) {
448 /* Read the real link status */
449 switch (hw->phy.media_type) {
450 case igc_media_type_copper:
451 /* Do the work to read phy */
452 igc_check_for_link(hw);
453 link_check = !hw->mac.get_link_status;
456 case igc_media_type_fiber:
457 igc_check_for_link(hw);
458 link_check = (IGC_READ_REG(hw, IGC_STATUS) &
462 case igc_media_type_internal_serdes:
463 igc_check_for_link(hw);
464 link_check = hw->mac.serdes_has_link;
470 if (link_check || wait_to_complete == 0)
472 rte_delay_ms(IGC_LINK_UPDATE_CHECK_INTERVAL);
474 memset(&link, 0, sizeof(link));
476 /* Now we check if a transition has happened */
478 uint16_t duplex, speed;
479 hw->mac.ops.get_link_up_info(hw, &speed, &duplex);
480 link.link_duplex = (duplex == FULL_DUPLEX) ?
481 ETH_LINK_FULL_DUPLEX :
482 ETH_LINK_HALF_DUPLEX;
483 link.link_speed = speed;
484 link.link_status = ETH_LINK_UP;
485 link.link_autoneg = !(dev->data->dev_conf.link_speeds &
486 ETH_LINK_SPEED_FIXED);
488 if (speed == SPEED_2500) {
489 uint32_t tipg = IGC_READ_REG(hw, IGC_TIPG);
490 if ((tipg & IGC_TIPG_IPGT_MASK) != 0x0b) {
491 tipg &= ~IGC_TIPG_IPGT_MASK;
493 IGC_WRITE_REG(hw, IGC_TIPG, tipg);
498 link.link_duplex = ETH_LINK_HALF_DUPLEX;
499 link.link_status = ETH_LINK_DOWN;
500 link.link_autoneg = ETH_LINK_FIXED;
503 return rte_eth_linkstatus_set(dev, &link);
507 * It executes link_update after knowing an interrupt is present.
510 eth_igc_interrupt_action(struct rte_eth_dev *dev)
512 struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
513 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
514 struct rte_eth_link link;
517 if (intr->flags & IGC_FLAG_NEED_LINK_UPDATE) {
518 intr->flags &= ~IGC_FLAG_NEED_LINK_UPDATE;
520 /* set get_link_status to check register later */
521 ret = eth_igc_link_update(dev, 0);
523 /* check if link has changed */
527 rte_eth_linkstatus_get(dev, &link);
528 if (link.link_status)
530 " Port %d: Link Up - speed %u Mbps - %s",
532 (unsigned int)link.link_speed,
533 link.link_duplex == ETH_LINK_FULL_DUPLEX ?
534 "full-duplex" : "half-duplex");
536 PMD_DRV_LOG(INFO, " Port %d: Link Down",
539 PMD_DRV_LOG(DEBUG, "PCI Address: " PCI_PRI_FMT,
540 pci_dev->addr.domain,
543 pci_dev->addr.function);
544 _rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC,
550 * Interrupt handler which shall be registered at first.
553 * Pointer to interrupt handle.
555 * The address of parameter (struct rte_eth_dev *) registered before.
558 eth_igc_interrupt_handler(void *param)
560 struct rte_eth_dev *dev = (struct rte_eth_dev *)param;
562 eth_igc_interrupt_get_status(dev);
563 eth_igc_interrupt_action(dev);
566 static void igc_read_queue_stats_register(struct rte_eth_dev *dev);
569 * Update the queue status every IGC_ALARM_INTERVAL time.
571 * The address of parameter (struct rte_eth_dev *) registered before.
574 igc_update_queue_stats_handler(void *param)
576 struct rte_eth_dev *dev = param;
577 igc_read_queue_stats_register(dev);
578 rte_eal_alarm_set(IGC_ALARM_INTERVAL,
579 igc_update_queue_stats_handler, dev);
583 * rx,tx enable/disable
586 eth_igc_rxtx_control(struct rte_eth_dev *dev, bool enable)
588 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
591 tctl = IGC_READ_REG(hw, IGC_TCTL);
592 rctl = IGC_READ_REG(hw, IGC_RCTL);
600 tctl &= ~IGC_TCTL_EN;
601 rctl &= ~IGC_RCTL_EN;
603 IGC_WRITE_REG(hw, IGC_TCTL, tctl);
604 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
609 * This routine disables all traffic on the adapter by issuing a
610 * global reset on the MAC.
613 eth_igc_stop(struct rte_eth_dev *dev)
615 struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
616 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
617 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
618 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
619 struct rte_eth_link link;
621 adapter->stopped = 1;
623 /* disable receive and transmit */
624 eth_igc_rxtx_control(dev, false);
626 /* disable all MSI-X interrupts */
627 IGC_WRITE_REG(hw, IGC_EIMC, 0x1f);
630 /* clear all MSI-X interrupts */
631 IGC_WRITE_REG(hw, IGC_EICR, 0x1f);
633 igc_intr_other_disable(dev);
635 rte_eal_alarm_cancel(igc_update_queue_stats_handler, dev);
637 /* disable intr eventfd mapping */
638 rte_intr_disable(intr_handle);
642 /* disable all wake up */
643 IGC_WRITE_REG(hw, IGC_WUC, 0);
645 /* disable checking EEE operation in MAC loopback mode */
646 igc_read_reg_check_clear_bits(hw, IGC_EEER, IGC_EEER_EEE_FRC_AN);
648 /* Set bit for Go Link disconnect */
649 igc_read_reg_check_set_bits(hw, IGC_82580_PHY_POWER_MGMT,
650 IGC_82580_PM_GO_LINKD);
652 /* Power down the phy. Needed to make the link go Down */
653 eth_igc_set_link_down(dev);
655 igc_dev_clear_queues(dev);
657 /* clear the recorded link status */
658 memset(&link, 0, sizeof(link));
659 rte_eth_linkstatus_set(dev, &link);
661 if (!rte_intr_allow_others(intr_handle))
662 /* resume to the default handler */
663 rte_intr_callback_register(intr_handle,
664 eth_igc_interrupt_handler,
667 /* Clean datapath event and queue/vec mapping */
668 rte_intr_efd_disable(intr_handle);
669 if (intr_handle->intr_vec != NULL) {
670 rte_free(intr_handle->intr_vec);
671 intr_handle->intr_vec = NULL;
676 * write interrupt vector allocation register
678 * board private structure
680 * queue index, valid 0,1,2,3
684 * msix-vector, valid 0,1,2,3,4
687 igc_write_ivar(struct igc_hw *hw, uint8_t queue_index,
688 bool tx, uint8_t msix_vector)
691 uint8_t reg_index = queue_index >> 1;
696 * bit31...24 bit23...16 bit15...8 bit7...0
700 * bit31...24 bit23...16 bit15...8 bit7...0
710 val = IGC_READ_REG_ARRAY(hw, IGC_IVAR0, reg_index);
713 val &= ~((uint32_t)0xFF << offset);
715 /* write vector and valid bit */
716 val |= (uint32_t)(msix_vector | IGC_IVAR_VALID) << offset;
718 IGC_WRITE_REG_ARRAY(hw, IGC_IVAR0, reg_index, val);
721 /* Sets up the hardware to generate MSI-X interrupts properly
723 * board private structure
726 igc_configure_msix_intr(struct rte_eth_dev *dev)
728 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
729 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
730 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
733 uint32_t vec = IGC_MISC_VEC_ID;
734 uint32_t base = IGC_MISC_VEC_ID;
735 uint32_t misc_shift = 0;
738 /* won't configure msix register if no mapping is done
739 * between intr vector and event fd
741 if (!rte_intr_dp_is_en(intr_handle))
744 if (rte_intr_allow_others(intr_handle)) {
745 base = IGC_RX_VEC_START;
750 /* turn on MSI-X capability first */
751 IGC_WRITE_REG(hw, IGC_GPIE, IGC_GPIE_MSIX_MODE |
752 IGC_GPIE_PBA | IGC_GPIE_EIAME |
754 intr_mask = RTE_LEN2MASK(intr_handle->nb_efd, uint32_t) <<
757 if (dev->data->dev_conf.intr_conf.lsc)
758 intr_mask |= (1u << IGC_MSIX_OTHER_INTR_VEC);
760 /* enable msix auto-clear */
761 igc_read_reg_check_set_bits(hw, IGC_EIAC, intr_mask);
763 /* set other cause interrupt vector */
764 igc_read_reg_check_set_bits(hw, IGC_IVAR_MISC,
765 (uint32_t)(IGC_MSIX_OTHER_INTR_VEC | IGC_IVAR_VALID) << 8);
767 /* enable auto-mask */
768 igc_read_reg_check_set_bits(hw, IGC_EIAM, intr_mask);
770 for (i = 0; i < dev->data->nb_rx_queues; i++) {
771 igc_write_ivar(hw, i, 0, vec);
772 intr_handle->intr_vec[i] = vec;
773 if (vec < base + intr_handle->nb_efd - 1)
781 * It enables the interrupt mask and then enable the interrupt.
784 * Pointer to struct rte_eth_dev.
789 igc_lsc_interrupt_setup(struct rte_eth_dev *dev, uint8_t on)
791 struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
794 intr->mask |= IGC_ICR_LSC;
796 intr->mask &= ~IGC_ICR_LSC;
800 * It enables the interrupt.
801 * It will be called once only during nic initialized.
804 igc_rxq_interrupt_setup(struct rte_eth_dev *dev)
807 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
808 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
809 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
810 int misc_shift = rte_intr_allow_others(intr_handle) ? 1 : 0;
812 /* won't configure msix register if no mapping is done
813 * between intr vector and event fd
815 if (!rte_intr_dp_is_en(intr_handle))
818 mask = RTE_LEN2MASK(intr_handle->nb_efd, uint32_t) << misc_shift;
819 IGC_WRITE_REG(hw, IGC_EIMS, mask);
823 * Get hardware rx-buffer size.
826 igc_get_rx_buffer_size(struct igc_hw *hw)
828 return (IGC_READ_REG(hw, IGC_RXPBS) & 0x3f) << 10;
832 * igc_hw_control_acquire sets CTRL_EXT:DRV_LOAD bit.
833 * For ASF and Pass Through versions of f/w this means
834 * that the driver is loaded.
837 igc_hw_control_acquire(struct igc_hw *hw)
841 /* Let firmware know the driver has taken over */
842 ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT);
843 IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext | IGC_CTRL_EXT_DRV_LOAD);
847 * igc_hw_control_release resets CTRL_EXT:DRV_LOAD bit.
848 * For ASF and Pass Through versions of f/w this means that the
849 * driver is no longer loaded.
852 igc_hw_control_release(struct igc_hw *hw)
856 /* Let firmware taken over control of h/w */
857 ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT);
858 IGC_WRITE_REG(hw, IGC_CTRL_EXT,
859 ctrl_ext & ~IGC_CTRL_EXT_DRV_LOAD);
863 igc_hardware_init(struct igc_hw *hw)
865 uint32_t rx_buf_size;
868 /* Let the firmware know the OS is in control */
869 igc_hw_control_acquire(hw);
871 /* Issue a global reset */
874 /* disable all wake up */
875 IGC_WRITE_REG(hw, IGC_WUC, 0);
878 * Hardware flow control
879 * - High water mark should allow for at least two standard size (1518)
880 * frames to be received after sending an XOFF.
881 * - Low water mark works best when it is very near the high water mark.
882 * This allows the receiver to restart by sending XON when it has
883 * drained a bit. Here we use an arbitrary value of 1500 which will
884 * restart after one full frame is pulled from the buffer. There
885 * could be several smaller frames in the buffer and if so they will
886 * not trigger the XON until their total number reduces the buffer
889 rx_buf_size = igc_get_rx_buffer_size(hw);
890 hw->fc.high_water = rx_buf_size - (RTE_ETHER_MAX_LEN * 2);
891 hw->fc.low_water = hw->fc.high_water - 1500;
892 hw->fc.pause_time = IGC_FC_PAUSE_TIME;
894 hw->fc.requested_mode = igc_fc_full;
896 diag = igc_init_hw(hw);
900 igc_get_phy_info(hw);
901 igc_check_for_link(hw);
907 eth_igc_start(struct rte_eth_dev *dev)
909 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
910 struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
911 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
912 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
916 PMD_INIT_FUNC_TRACE();
918 /* disable all MSI-X interrupts */
919 IGC_WRITE_REG(hw, IGC_EIMC, 0x1f);
922 /* clear all MSI-X interrupts */
923 IGC_WRITE_REG(hw, IGC_EICR, 0x1f);
925 /* disable uio/vfio intr/eventfd mapping */
926 if (!adapter->stopped)
927 rte_intr_disable(intr_handle);
929 /* Power up the phy. Needed to make the link go Up */
930 eth_igc_set_link_up(dev);
932 /* Put the address into the Receive Address Array */
933 igc_rar_set(hw, hw->mac.addr, 0);
935 /* Initialize the hardware */
936 if (igc_hardware_init(hw)) {
937 PMD_DRV_LOG(ERR, "Unable to initialize the hardware");
940 adapter->stopped = 0;
942 /* check and configure queue intr-vector mapping */
943 if (rte_intr_cap_multiple(intr_handle) &&
944 dev->data->dev_conf.intr_conf.rxq) {
945 uint32_t intr_vector = dev->data->nb_rx_queues;
946 if (rte_intr_efd_enable(intr_handle, intr_vector))
950 if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) {
951 intr_handle->intr_vec = rte_zmalloc("intr_vec",
952 dev->data->nb_rx_queues * sizeof(int), 0);
953 if (intr_handle->intr_vec == NULL) {
955 "Failed to allocate %d rx_queues intr_vec",
956 dev->data->nb_rx_queues);
961 /* configure msix for rx interrupt */
962 igc_configure_msix_intr(dev);
966 /* This can fail when allocating mbufs for descriptor rings */
967 ret = igc_rx_init(dev);
969 PMD_DRV_LOG(ERR, "Unable to initialize RX hardware");
970 igc_dev_clear_queues(dev);
974 igc_clear_hw_cntrs_base_generic(hw);
976 /* VLAN Offload Settings */
977 eth_igc_vlan_offload_set(dev,
978 ETH_VLAN_STRIP_MASK | ETH_VLAN_FILTER_MASK |
979 ETH_VLAN_EXTEND_MASK);
981 /* Setup link speed and duplex */
982 speeds = &dev->data->dev_conf.link_speeds;
983 if (*speeds == ETH_LINK_SPEED_AUTONEG) {
984 hw->phy.autoneg_advertised = IGC_ALL_SPEED_DUPLEX_2500;
988 bool autoneg = (*speeds & ETH_LINK_SPEED_FIXED) == 0;
991 hw->phy.autoneg_advertised = 0;
993 if (*speeds & ~(ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M |
994 ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M |
995 ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G |
996 ETH_LINK_SPEED_FIXED)) {
998 goto error_invalid_config;
1000 if (*speeds & ETH_LINK_SPEED_10M_HD) {
1001 hw->phy.autoneg_advertised |= ADVERTISE_10_HALF;
1004 if (*speeds & ETH_LINK_SPEED_10M) {
1005 hw->phy.autoneg_advertised |= ADVERTISE_10_FULL;
1008 if (*speeds & ETH_LINK_SPEED_100M_HD) {
1009 hw->phy.autoneg_advertised |= ADVERTISE_100_HALF;
1012 if (*speeds & ETH_LINK_SPEED_100M) {
1013 hw->phy.autoneg_advertised |= ADVERTISE_100_FULL;
1016 if (*speeds & ETH_LINK_SPEED_1G) {
1017 hw->phy.autoneg_advertised |= ADVERTISE_1000_FULL;
1020 if (*speeds & ETH_LINK_SPEED_2_5G) {
1021 hw->phy.autoneg_advertised |= ADVERTISE_2500_FULL;
1024 if (num_speeds == 0 || (!autoneg && num_speeds > 1))
1025 goto error_invalid_config;
1027 /* Set/reset the mac.autoneg based on the link speed,
1031 hw->mac.autoneg = 0;
1032 hw->mac.forced_speed_duplex =
1033 hw->phy.autoneg_advertised;
1035 hw->mac.autoneg = 1;
1041 if (rte_intr_allow_others(intr_handle)) {
1042 /* check if lsc interrupt is enabled */
1043 if (dev->data->dev_conf.intr_conf.lsc)
1044 igc_lsc_interrupt_setup(dev, 1);
1046 igc_lsc_interrupt_setup(dev, 0);
1048 rte_intr_callback_unregister(intr_handle,
1049 eth_igc_interrupt_handler,
1051 if (dev->data->dev_conf.intr_conf.lsc)
1053 "LSC won't enable because of no intr multiplex");
1056 /* enable uio/vfio intr/eventfd mapping */
1057 rte_intr_enable(intr_handle);
1059 rte_eal_alarm_set(IGC_ALARM_INTERVAL,
1060 igc_update_queue_stats_handler, dev);
1062 /* check if rxq interrupt is enabled */
1063 if (dev->data->dev_conf.intr_conf.rxq &&
1064 rte_intr_dp_is_en(intr_handle))
1065 igc_rxq_interrupt_setup(dev);
1067 /* resume enabled intr since hw reset */
1068 igc_intr_other_enable(dev);
1070 eth_igc_rxtx_control(dev, true);
1071 eth_igc_link_update(dev, 0);
1073 /* configure MAC-loopback mode */
1074 if (dev->data->dev_conf.lpbk_mode == 1) {
1077 reg_val = IGC_READ_REG(hw, IGC_CTRL);
1078 reg_val &= ~IGC_CTRL_SPEED_MASK;
1079 reg_val |= IGC_CTRL_SLU | IGC_CTRL_FRCSPD |
1080 IGC_CTRL_FRCDPX | IGC_CTRL_FD | IGC_CTRL_SPEED_2500;
1081 IGC_WRITE_REG(hw, IGC_CTRL, reg_val);
1083 igc_read_reg_check_set_bits(hw, IGC_EEER, IGC_EEER_EEE_FRC_AN);
1088 error_invalid_config:
1089 PMD_DRV_LOG(ERR, "Invalid advertised speeds (%u) for port %u",
1090 dev->data->dev_conf.link_speeds, dev->data->port_id);
1091 igc_dev_clear_queues(dev);
1096 igc_reset_swfw_lock(struct igc_hw *hw)
1101 * Do mac ops initialization manually here, since we will need
1102 * some function pointers set by this call.
1104 ret_val = igc_init_mac_params(hw);
1109 * SMBI lock should not fail in this early stage. If this is the case,
1110 * it is due to an improper exit of the application.
1111 * So force the release of the faulty lock.
1113 if (igc_get_hw_semaphore_generic(hw) < 0)
1114 PMD_DRV_LOG(DEBUG, "SMBI lock released");
1116 igc_put_hw_semaphore_generic(hw);
1118 if (hw->mac.ops.acquire_swfw_sync != NULL) {
1122 * Phy lock should not fail in this early stage.
1123 * If this is the case, it is due to an improper exit of the
1124 * application. So force the release of the faulty lock.
1126 mask = IGC_SWFW_PHY0_SM;
1127 if (hw->mac.ops.acquire_swfw_sync(hw, mask) < 0) {
1128 PMD_DRV_LOG(DEBUG, "SWFW phy%d lock released",
1131 hw->mac.ops.release_swfw_sync(hw, mask);
1134 * This one is more tricky since it is common to all ports; but
1135 * swfw_sync retries last long enough (1s) to be almost sure
1136 * that if lock can not be taken it is due to an improper lock
1139 mask = IGC_SWFW_EEP_SM;
1140 if (hw->mac.ops.acquire_swfw_sync(hw, mask) < 0)
1141 PMD_DRV_LOG(DEBUG, "SWFW common locks released");
1143 hw->mac.ops.release_swfw_sync(hw, mask);
1150 * free all rx/tx queues.
1153 igc_dev_free_queues(struct rte_eth_dev *dev)
1157 for (i = 0; i < dev->data->nb_rx_queues; i++) {
1158 eth_igc_rx_queue_release(dev->data->rx_queues[i]);
1159 dev->data->rx_queues[i] = NULL;
1161 dev->data->nb_rx_queues = 0;
1163 for (i = 0; i < dev->data->nb_tx_queues; i++) {
1164 eth_igc_tx_queue_release(dev->data->tx_queues[i]);
1165 dev->data->tx_queues[i] = NULL;
1167 dev->data->nb_tx_queues = 0;
1171 eth_igc_close(struct rte_eth_dev *dev)
1173 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1174 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
1175 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1176 struct igc_adapter *adapter = IGC_DEV_PRIVATE(dev);
1179 PMD_INIT_FUNC_TRACE();
1181 if (!adapter->stopped)
1184 igc_intr_other_disable(dev);
1186 int ret = rte_intr_callback_unregister(intr_handle,
1187 eth_igc_interrupt_handler, dev);
1188 if (ret >= 0 || ret == -ENOENT || ret == -EINVAL)
1191 PMD_DRV_LOG(ERR, "intr callback unregister failed: %d", ret);
1192 DELAY(200 * 1000); /* delay 200ms */
1193 } while (retry++ < 5);
1195 igc_phy_hw_reset(hw);
1196 igc_hw_control_release(hw);
1197 igc_dev_free_queues(dev);
1199 /* Reset any pending lock */
1200 igc_reset_swfw_lock(hw);
1204 igc_identify_hardware(struct rte_eth_dev *dev, struct rte_pci_device *pci_dev)
1206 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1208 hw->vendor_id = pci_dev->id.vendor_id;
1209 hw->device_id = pci_dev->id.device_id;
1210 hw->subsystem_vendor_id = pci_dev->id.subsystem_vendor_id;
1211 hw->subsystem_device_id = pci_dev->id.subsystem_device_id;
1215 eth_igc_dev_init(struct rte_eth_dev *dev)
1217 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
1218 struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
1219 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1222 PMD_INIT_FUNC_TRACE();
1223 dev->dev_ops = ð_igc_ops;
1226 * for secondary processes, we don't initialize any further as primary
1227 * has already done this work. Only check we don't need a different
1230 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1233 rte_eth_copy_pci_info(dev, pci_dev);
1236 hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
1238 igc_identify_hardware(dev, pci_dev);
1239 if (igc_setup_init_funcs(hw, false) != IGC_SUCCESS) {
1244 igc_get_bus_info(hw);
1246 /* Reset any pending lock */
1247 if (igc_reset_swfw_lock(hw) != IGC_SUCCESS) {
1252 /* Finish initialization */
1253 if (igc_setup_init_funcs(hw, true) != IGC_SUCCESS) {
1258 hw->mac.autoneg = 1;
1259 hw->phy.autoneg_wait_to_complete = 0;
1260 hw->phy.autoneg_advertised = IGC_ALL_SPEED_DUPLEX_2500;
1262 /* Copper options */
1263 if (hw->phy.media_type == igc_media_type_copper) {
1264 hw->phy.mdix = 0; /* AUTO_ALL_MODES */
1265 hw->phy.disable_polarity_correction = 0;
1266 hw->phy.ms_type = igc_ms_hw_default;
1270 * Start from a known state, this is important in reading the nvm
1271 * and mac from that.
1275 /* Make sure we have a good EEPROM before we read from it */
1276 if (igc_validate_nvm_checksum(hw) < 0) {
1278 * Some PCI-E parts fail the first check due to
1279 * the link being in sleep state, call it again,
1280 * if it fails a second time its a real issue.
1282 if (igc_validate_nvm_checksum(hw) < 0) {
1283 PMD_INIT_LOG(ERR, "EEPROM checksum invalid");
1289 /* Read the permanent MAC address out of the EEPROM */
1290 if (igc_read_mac_addr(hw) != 0) {
1291 PMD_INIT_LOG(ERR, "EEPROM error while reading MAC address");
1296 /* Allocate memory for storing MAC addresses */
1297 dev->data->mac_addrs = rte_zmalloc("igc",
1298 RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count, 0);
1299 if (dev->data->mac_addrs == NULL) {
1300 PMD_INIT_LOG(ERR, "Failed to allocate %d bytes for storing MAC",
1301 RTE_ETHER_ADDR_LEN * hw->mac.rar_entry_count);
1306 /* Copy the permanent MAC address */
1307 rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
1308 &dev->data->mac_addrs[0]);
1310 /* Now initialize the hardware */
1311 if (igc_hardware_init(hw) != 0) {
1312 PMD_INIT_LOG(ERR, "Hardware initialization failed");
1313 rte_free(dev->data->mac_addrs);
1314 dev->data->mac_addrs = NULL;
1319 /* Pass the information to the rte_eth_dev_close() that it should also
1320 * release the private port resources.
1322 dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
1324 hw->mac.get_link_status = 1;
1327 /* Indicate SOL/IDER usage */
1328 if (igc_check_reset_block(hw) < 0)
1330 "PHY reset is blocked due to SOL/IDER session.");
1332 PMD_INIT_LOG(DEBUG, "port_id %d vendorID=0x%x deviceID=0x%x",
1333 dev->data->port_id, pci_dev->id.vendor_id,
1334 pci_dev->id.device_id);
1336 rte_intr_callback_register(&pci_dev->intr_handle,
1337 eth_igc_interrupt_handler, (void *)dev);
1339 /* enable uio/vfio intr/eventfd mapping */
1340 rte_intr_enable(&pci_dev->intr_handle);
1342 /* enable support intr */
1343 igc_intr_other_enable(dev);
1345 /* initiate queue status */
1346 for (i = 0; i < IGC_QUEUE_PAIRS_NUM; i++) {
1347 igc->txq_stats_map[i] = -1;
1348 igc->rxq_stats_map[i] = -1;
1354 igc_hw_control_release(hw);
1359 eth_igc_dev_uninit(__rte_unused struct rte_eth_dev *eth_dev)
1361 PMD_INIT_FUNC_TRACE();
1363 if (rte_eal_process_type() != RTE_PROC_PRIMARY)
1366 eth_igc_close(eth_dev);
1371 eth_igc_reset(struct rte_eth_dev *dev)
1375 PMD_INIT_FUNC_TRACE();
1377 ret = eth_igc_dev_uninit(dev);
1381 return eth_igc_dev_init(dev);
1385 eth_igc_promiscuous_enable(struct rte_eth_dev *dev)
1387 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1390 rctl = IGC_READ_REG(hw, IGC_RCTL);
1391 rctl |= (IGC_RCTL_UPE | IGC_RCTL_MPE);
1392 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
1397 eth_igc_promiscuous_disable(struct rte_eth_dev *dev)
1399 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1402 rctl = IGC_READ_REG(hw, IGC_RCTL);
1403 rctl &= (~IGC_RCTL_UPE);
1404 if (dev->data->all_multicast == 1)
1405 rctl |= IGC_RCTL_MPE;
1407 rctl &= (~IGC_RCTL_MPE);
1408 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
1413 eth_igc_allmulticast_enable(struct rte_eth_dev *dev)
1415 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1418 rctl = IGC_READ_REG(hw, IGC_RCTL);
1419 rctl |= IGC_RCTL_MPE;
1420 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
1425 eth_igc_allmulticast_disable(struct rte_eth_dev *dev)
1427 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1430 if (dev->data->promiscuous == 1)
1431 return 0; /* must remain in all_multicast mode */
1433 rctl = IGC_READ_REG(hw, IGC_RCTL);
1434 rctl &= (~IGC_RCTL_MPE);
1435 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
1440 eth_igc_fw_version_get(struct rte_eth_dev *dev, char *fw_version,
1443 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1444 struct igc_fw_version fw;
1447 igc_get_fw_version(hw, &fw);
1449 /* if option rom is valid, display its version too */
1451 ret = snprintf(fw_version, fw_size,
1452 "%d.%d, 0x%08x, %d.%d.%d",
1453 fw.eep_major, fw.eep_minor, fw.etrack_id,
1454 fw.or_major, fw.or_build, fw.or_patch);
1457 if (fw.etrack_id != 0X0000) {
1458 ret = snprintf(fw_version, fw_size,
1460 fw.eep_major, fw.eep_minor,
1463 ret = snprintf(fw_version, fw_size,
1465 fw.eep_major, fw.eep_minor,
1470 ret += 1; /* add the size of '\0' */
1471 if (fw_size < (u32)ret)
1478 eth_igc_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
1480 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1482 dev_info->min_rx_bufsize = 256; /* See BSIZE field of RCTL register. */
1483 dev_info->max_rx_pktlen = MAX_RX_JUMBO_FRAME_SIZE;
1484 dev_info->max_mac_addrs = hw->mac.rar_entry_count;
1485 dev_info->rx_offload_capa = IGC_RX_OFFLOAD_ALL;
1486 dev_info->tx_offload_capa = IGC_TX_OFFLOAD_ALL;
1487 dev_info->rx_queue_offload_capa = DEV_RX_OFFLOAD_VLAN_STRIP;
1489 dev_info->max_rx_queues = IGC_QUEUE_PAIRS_NUM;
1490 dev_info->max_tx_queues = IGC_QUEUE_PAIRS_NUM;
1491 dev_info->max_vmdq_pools = 0;
1493 dev_info->hash_key_size = IGC_HKEY_MAX_INDEX * sizeof(uint32_t);
1494 dev_info->reta_size = ETH_RSS_RETA_SIZE_128;
1495 dev_info->flow_type_rss_offloads = IGC_RSS_OFFLOAD_ALL;
1497 dev_info->default_rxconf = (struct rte_eth_rxconf) {
1499 .pthresh = IGC_DEFAULT_RX_PTHRESH,
1500 .hthresh = IGC_DEFAULT_RX_HTHRESH,
1501 .wthresh = IGC_DEFAULT_RX_WTHRESH,
1503 .rx_free_thresh = IGC_DEFAULT_RX_FREE_THRESH,
1508 dev_info->default_txconf = (struct rte_eth_txconf) {
1510 .pthresh = IGC_DEFAULT_TX_PTHRESH,
1511 .hthresh = IGC_DEFAULT_TX_HTHRESH,
1512 .wthresh = IGC_DEFAULT_TX_WTHRESH,
1517 dev_info->rx_desc_lim = rx_desc_lim;
1518 dev_info->tx_desc_lim = tx_desc_lim;
1520 dev_info->speed_capa = ETH_LINK_SPEED_10M_HD | ETH_LINK_SPEED_10M |
1521 ETH_LINK_SPEED_100M_HD | ETH_LINK_SPEED_100M |
1522 ETH_LINK_SPEED_1G | ETH_LINK_SPEED_2_5G;
1524 dev_info->max_mtu = dev_info->max_rx_pktlen - IGC_ETH_OVERHEAD;
1525 dev_info->min_mtu = RTE_ETHER_MIN_MTU;
1530 eth_igc_led_on(struct rte_eth_dev *dev)
1532 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1534 return igc_led_on(hw) == IGC_SUCCESS ? 0 : -ENOTSUP;
1538 eth_igc_led_off(struct rte_eth_dev *dev)
1540 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1542 return igc_led_off(hw) == IGC_SUCCESS ? 0 : -ENOTSUP;
1545 static const uint32_t *
1546 eth_igc_supported_ptypes_get(__rte_unused struct rte_eth_dev *dev)
1548 static const uint32_t ptypes[] = {
1549 /* refers to rx_desc_pkt_info_to_pkt_type() */
1552 RTE_PTYPE_L3_IPV4_EXT,
1554 RTE_PTYPE_L3_IPV6_EXT,
1558 RTE_PTYPE_TUNNEL_IP,
1559 RTE_PTYPE_INNER_L3_IPV6,
1560 RTE_PTYPE_INNER_L3_IPV6_EXT,
1561 RTE_PTYPE_INNER_L4_TCP,
1562 RTE_PTYPE_INNER_L4_UDP,
1570 eth_igc_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
1572 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1573 uint32_t frame_size = mtu + IGC_ETH_OVERHEAD;
1576 /* if extend vlan has been enabled */
1577 if (IGC_READ_REG(hw, IGC_CTRL_EXT) & IGC_CTRL_EXT_EXT_VLAN)
1578 frame_size += VLAN_TAG_SIZE;
1580 /* check that mtu is within the allowed range */
1581 if (mtu < RTE_ETHER_MIN_MTU ||
1582 frame_size > MAX_RX_JUMBO_FRAME_SIZE)
1586 * refuse mtu that requires the support of scattered packets when
1587 * this feature has not been enabled before.
1589 if (!dev->data->scattered_rx &&
1590 frame_size > dev->data->min_rx_buf_size - RTE_PKTMBUF_HEADROOM)
1593 rctl = IGC_READ_REG(hw, IGC_RCTL);
1595 /* switch to jumbo mode if needed */
1596 if (mtu > RTE_ETHER_MTU) {
1597 dev->data->dev_conf.rxmode.offloads |=
1598 DEV_RX_OFFLOAD_JUMBO_FRAME;
1599 rctl |= IGC_RCTL_LPE;
1601 dev->data->dev_conf.rxmode.offloads &=
1602 ~DEV_RX_OFFLOAD_JUMBO_FRAME;
1603 rctl &= ~IGC_RCTL_LPE;
1605 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
1607 /* update max frame size */
1608 dev->data->dev_conf.rxmode.max_rx_pkt_len = frame_size;
1610 IGC_WRITE_REG(hw, IGC_RLPML,
1611 dev->data->dev_conf.rxmode.max_rx_pkt_len);
1617 eth_igc_rar_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr,
1618 uint32_t index, uint32_t pool)
1620 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1622 igc_rar_set(hw, mac_addr->addr_bytes, index);
1628 eth_igc_rar_clear(struct rte_eth_dev *dev, uint32_t index)
1630 uint8_t addr[RTE_ETHER_ADDR_LEN];
1631 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1633 memset(addr, 0, sizeof(addr));
1634 igc_rar_set(hw, addr, index);
1638 eth_igc_default_mac_addr_set(struct rte_eth_dev *dev,
1639 struct rte_ether_addr *addr)
1641 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1642 igc_rar_set(hw, addr->addr_bytes, 0);
1647 eth_igc_set_mc_addr_list(struct rte_eth_dev *dev,
1648 struct rte_ether_addr *mc_addr_set,
1649 uint32_t nb_mc_addr)
1651 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1652 igc_update_mc_addr_list(hw, (u8 *)mc_addr_set, nb_mc_addr);
1657 * Read hardware registers
1660 igc_read_stats_registers(struct igc_hw *hw, struct igc_hw_stats *stats)
1664 uint64_t old_gprc = stats->gprc;
1665 uint64_t old_gptc = stats->gptc;
1666 uint64_t old_tpr = stats->tpr;
1667 uint64_t old_tpt = stats->tpt;
1668 uint64_t old_rpthc = stats->rpthc;
1669 uint64_t old_hgptc = stats->hgptc;
1671 stats->crcerrs += IGC_READ_REG(hw, IGC_CRCERRS);
1672 stats->algnerrc += IGC_READ_REG(hw, IGC_ALGNERRC);
1673 stats->rxerrc += IGC_READ_REG(hw, IGC_RXERRC);
1674 stats->mpc += IGC_READ_REG(hw, IGC_MPC);
1675 stats->scc += IGC_READ_REG(hw, IGC_SCC);
1676 stats->ecol += IGC_READ_REG(hw, IGC_ECOL);
1678 stats->mcc += IGC_READ_REG(hw, IGC_MCC);
1679 stats->latecol += IGC_READ_REG(hw, IGC_LATECOL);
1680 stats->colc += IGC_READ_REG(hw, IGC_COLC);
1682 stats->dc += IGC_READ_REG(hw, IGC_DC);
1683 stats->tncrs += IGC_READ_REG(hw, IGC_TNCRS);
1684 stats->htdpmc += IGC_READ_REG(hw, IGC_HTDPMC);
1685 stats->rlec += IGC_READ_REG(hw, IGC_RLEC);
1686 stats->xonrxc += IGC_READ_REG(hw, IGC_XONRXC);
1687 stats->xontxc += IGC_READ_REG(hw, IGC_XONTXC);
1690 * For watchdog management we need to know if we have been
1691 * paused during the last interval, so capture that here.
1693 pause_frames = IGC_READ_REG(hw, IGC_XOFFRXC);
1694 stats->xoffrxc += pause_frames;
1695 stats->xofftxc += IGC_READ_REG(hw, IGC_XOFFTXC);
1696 stats->fcruc += IGC_READ_REG(hw, IGC_FCRUC);
1697 stats->prc64 += IGC_READ_REG(hw, IGC_PRC64);
1698 stats->prc127 += IGC_READ_REG(hw, IGC_PRC127);
1699 stats->prc255 += IGC_READ_REG(hw, IGC_PRC255);
1700 stats->prc511 += IGC_READ_REG(hw, IGC_PRC511);
1701 stats->prc1023 += IGC_READ_REG(hw, IGC_PRC1023);
1702 stats->prc1522 += IGC_READ_REG(hw, IGC_PRC1522);
1703 stats->gprc += IGC_READ_REG(hw, IGC_GPRC);
1704 stats->bprc += IGC_READ_REG(hw, IGC_BPRC);
1705 stats->mprc += IGC_READ_REG(hw, IGC_MPRC);
1706 stats->gptc += IGC_READ_REG(hw, IGC_GPTC);
1708 /* For the 64-bit byte counters the low dword must be read first. */
1709 /* Both registers clear on the read of the high dword */
1711 /* Workaround CRC bytes included in size, take away 4 bytes/packet */
1712 stats->gorc += IGC_READ_REG(hw, IGC_GORCL);
1713 stats->gorc += ((uint64_t)IGC_READ_REG(hw, IGC_GORCH) << 32);
1714 stats->gorc -= (stats->gprc - old_gprc) * RTE_ETHER_CRC_LEN;
1715 stats->gotc += IGC_READ_REG(hw, IGC_GOTCL);
1716 stats->gotc += ((uint64_t)IGC_READ_REG(hw, IGC_GOTCH) << 32);
1717 stats->gotc -= (stats->gptc - old_gptc) * RTE_ETHER_CRC_LEN;
1719 stats->rnbc += IGC_READ_REG(hw, IGC_RNBC);
1720 stats->ruc += IGC_READ_REG(hw, IGC_RUC);
1721 stats->rfc += IGC_READ_REG(hw, IGC_RFC);
1722 stats->roc += IGC_READ_REG(hw, IGC_ROC);
1723 stats->rjc += IGC_READ_REG(hw, IGC_RJC);
1725 stats->mgprc += IGC_READ_REG(hw, IGC_MGTPRC);
1726 stats->mgpdc += IGC_READ_REG(hw, IGC_MGTPDC);
1727 stats->mgptc += IGC_READ_REG(hw, IGC_MGTPTC);
1728 stats->b2ospc += IGC_READ_REG(hw, IGC_B2OSPC);
1729 stats->b2ogprc += IGC_READ_REG(hw, IGC_B2OGPRC);
1730 stats->o2bgptc += IGC_READ_REG(hw, IGC_O2BGPTC);
1731 stats->o2bspc += IGC_READ_REG(hw, IGC_O2BSPC);
1733 stats->tpr += IGC_READ_REG(hw, IGC_TPR);
1734 stats->tpt += IGC_READ_REG(hw, IGC_TPT);
1736 stats->tor += IGC_READ_REG(hw, IGC_TORL);
1737 stats->tor += ((uint64_t)IGC_READ_REG(hw, IGC_TORH) << 32);
1738 stats->tor -= (stats->tpr - old_tpr) * RTE_ETHER_CRC_LEN;
1739 stats->tot += IGC_READ_REG(hw, IGC_TOTL);
1740 stats->tot += ((uint64_t)IGC_READ_REG(hw, IGC_TOTH) << 32);
1741 stats->tot -= (stats->tpt - old_tpt) * RTE_ETHER_CRC_LEN;
1743 stats->ptc64 += IGC_READ_REG(hw, IGC_PTC64);
1744 stats->ptc127 += IGC_READ_REG(hw, IGC_PTC127);
1745 stats->ptc255 += IGC_READ_REG(hw, IGC_PTC255);
1746 stats->ptc511 += IGC_READ_REG(hw, IGC_PTC511);
1747 stats->ptc1023 += IGC_READ_REG(hw, IGC_PTC1023);
1748 stats->ptc1522 += IGC_READ_REG(hw, IGC_PTC1522);
1749 stats->mptc += IGC_READ_REG(hw, IGC_MPTC);
1750 stats->bptc += IGC_READ_REG(hw, IGC_BPTC);
1751 stats->tsctc += IGC_READ_REG(hw, IGC_TSCTC);
1753 stats->iac += IGC_READ_REG(hw, IGC_IAC);
1754 stats->rpthc += IGC_READ_REG(hw, IGC_RPTHC);
1755 stats->hgptc += IGC_READ_REG(hw, IGC_HGPTC);
1756 stats->icrxdmtc += IGC_READ_REG(hw, IGC_ICRXDMTC);
1758 /* Host to Card Statistics */
1759 stats->hgorc += IGC_READ_REG(hw, IGC_HGORCL);
1760 stats->hgorc += ((uint64_t)IGC_READ_REG(hw, IGC_HGORCH) << 32);
1761 stats->hgorc -= (stats->rpthc - old_rpthc) * RTE_ETHER_CRC_LEN;
1762 stats->hgotc += IGC_READ_REG(hw, IGC_HGOTCL);
1763 stats->hgotc += ((uint64_t)IGC_READ_REG(hw, IGC_HGOTCH) << 32);
1764 stats->hgotc -= (stats->hgptc - old_hgptc) * RTE_ETHER_CRC_LEN;
1765 stats->lenerrs += IGC_READ_REG(hw, IGC_LENERRS);
1769 * Write 0 to all queue status registers
1772 igc_reset_queue_stats_register(struct igc_hw *hw)
1776 for (i = 0; i < IGC_QUEUE_PAIRS_NUM; i++) {
1777 IGC_WRITE_REG(hw, IGC_PQGPRC(i), 0);
1778 IGC_WRITE_REG(hw, IGC_PQGPTC(i), 0);
1779 IGC_WRITE_REG(hw, IGC_PQGORC(i), 0);
1780 IGC_WRITE_REG(hw, IGC_PQGOTC(i), 0);
1781 IGC_WRITE_REG(hw, IGC_PQMPRC(i), 0);
1782 IGC_WRITE_REG(hw, IGC_RQDPC(i), 0);
1783 IGC_WRITE_REG(hw, IGC_TQDPC(i), 0);
1788 * Read all hardware queue status registers
1791 igc_read_queue_stats_register(struct rte_eth_dev *dev)
1793 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1794 struct igc_hw_queue_stats *queue_stats =
1795 IGC_DEV_PRIVATE_QUEUE_STATS(dev);
1799 * This register is not cleared on read. Furthermore, the register wraps
1800 * around back to 0x00000000 on the next increment when reaching a value
1801 * of 0xFFFFFFFF and then continues normal count operation.
1803 for (i = 0; i < IGC_QUEUE_PAIRS_NUM; i++) {
1811 * Read the register first, if the value is smaller than that
1812 * previous read, that mean the register has been overflowed,
1813 * then we add the high 4 bytes by 1 and replace the low 4
1814 * bytes by the new value.
1816 tmp = IGC_READ_REG(hw, IGC_PQGPRC(i));
1817 value.ddword = queue_stats->pqgprc[i];
1818 if (value.dword[U32_0_IN_U64] > tmp)
1819 value.dword[U32_1_IN_U64]++;
1820 value.dword[U32_0_IN_U64] = tmp;
1821 queue_stats->pqgprc[i] = value.ddword;
1823 tmp = IGC_READ_REG(hw, IGC_PQGPTC(i));
1824 value.ddword = queue_stats->pqgptc[i];
1825 if (value.dword[U32_0_IN_U64] > tmp)
1826 value.dword[U32_1_IN_U64]++;
1827 value.dword[U32_0_IN_U64] = tmp;
1828 queue_stats->pqgptc[i] = value.ddword;
1830 tmp = IGC_READ_REG(hw, IGC_PQGORC(i));
1831 value.ddword = queue_stats->pqgorc[i];
1832 if (value.dword[U32_0_IN_U64] > tmp)
1833 value.dword[U32_1_IN_U64]++;
1834 value.dword[U32_0_IN_U64] = tmp;
1835 queue_stats->pqgorc[i] = value.ddword;
1837 tmp = IGC_READ_REG(hw, IGC_PQGOTC(i));
1838 value.ddword = queue_stats->pqgotc[i];
1839 if (value.dword[U32_0_IN_U64] > tmp)
1840 value.dword[U32_1_IN_U64]++;
1841 value.dword[U32_0_IN_U64] = tmp;
1842 queue_stats->pqgotc[i] = value.ddword;
1844 tmp = IGC_READ_REG(hw, IGC_PQMPRC(i));
1845 value.ddword = queue_stats->pqmprc[i];
1846 if (value.dword[U32_0_IN_U64] > tmp)
1847 value.dword[U32_1_IN_U64]++;
1848 value.dword[U32_0_IN_U64] = tmp;
1849 queue_stats->pqmprc[i] = value.ddword;
1851 tmp = IGC_READ_REG(hw, IGC_RQDPC(i));
1852 value.ddword = queue_stats->rqdpc[i];
1853 if (value.dword[U32_0_IN_U64] > tmp)
1854 value.dword[U32_1_IN_U64]++;
1855 value.dword[U32_0_IN_U64] = tmp;
1856 queue_stats->rqdpc[i] = value.ddword;
1858 tmp = IGC_READ_REG(hw, IGC_TQDPC(i));
1859 value.ddword = queue_stats->tqdpc[i];
1860 if (value.dword[U32_0_IN_U64] > tmp)
1861 value.dword[U32_1_IN_U64]++;
1862 value.dword[U32_0_IN_U64] = tmp;
1863 queue_stats->tqdpc[i] = value.ddword;
1868 eth_igc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)
1870 struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
1871 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1872 struct igc_hw_stats *stats = IGC_DEV_PRIVATE_STATS(dev);
1873 struct igc_hw_queue_stats *queue_stats =
1874 IGC_DEV_PRIVATE_QUEUE_STATS(dev);
1878 * Cancel status handler since it will read the queue status registers
1880 rte_eal_alarm_cancel(igc_update_queue_stats_handler, dev);
1882 /* Read status register */
1883 igc_read_queue_stats_register(dev);
1884 igc_read_stats_registers(hw, stats);
1886 if (rte_stats == NULL) {
1887 /* Restart queue status handler */
1888 rte_eal_alarm_set(IGC_ALARM_INTERVAL,
1889 igc_update_queue_stats_handler, dev);
1894 rte_stats->imissed = stats->mpc;
1895 rte_stats->ierrors = stats->crcerrs +
1896 stats->rlec + stats->ruc + stats->roc +
1897 stats->rxerrc + stats->algnerrc;
1900 rte_stats->oerrors = stats->ecol + stats->latecol;
1902 rte_stats->ipackets = stats->gprc;
1903 rte_stats->opackets = stats->gptc;
1904 rte_stats->ibytes = stats->gorc;
1905 rte_stats->obytes = stats->gotc;
1907 /* Get per-queue statuses */
1908 for (i = 0; i < IGC_QUEUE_PAIRS_NUM; i++) {
1909 /* GET TX queue statuses */
1910 int map_id = igc->txq_stats_map[i];
1912 rte_stats->q_opackets[map_id] += queue_stats->pqgptc[i];
1913 rte_stats->q_obytes[map_id] += queue_stats->pqgotc[i];
1915 /* Get RX queue statuses */
1916 map_id = igc->rxq_stats_map[i];
1918 rte_stats->q_ipackets[map_id] += queue_stats->pqgprc[i];
1919 rte_stats->q_ibytes[map_id] += queue_stats->pqgorc[i];
1920 rte_stats->q_errors[map_id] += queue_stats->rqdpc[i];
1924 /* Restart queue status handler */
1925 rte_eal_alarm_set(IGC_ALARM_INTERVAL,
1926 igc_update_queue_stats_handler, dev);
1931 eth_igc_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
1934 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1935 struct igc_hw_stats *hw_stats =
1936 IGC_DEV_PRIVATE_STATS(dev);
1939 igc_read_stats_registers(hw, hw_stats);
1941 if (n < IGC_NB_XSTATS)
1942 return IGC_NB_XSTATS;
1944 /* If this is a reset xstats is NULL, and we have cleared the
1945 * registers by reading them.
1950 /* Extended stats */
1951 for (i = 0; i < IGC_NB_XSTATS; i++) {
1953 xstats[i].value = *(uint64_t *)(((char *)hw_stats) +
1954 rte_igc_stats_strings[i].offset);
1957 return IGC_NB_XSTATS;
1961 eth_igc_xstats_reset(struct rte_eth_dev *dev)
1963 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
1964 struct igc_hw_stats *hw_stats = IGC_DEV_PRIVATE_STATS(dev);
1965 struct igc_hw_queue_stats *queue_stats =
1966 IGC_DEV_PRIVATE_QUEUE_STATS(dev);
1968 /* Cancel queue status handler for avoid conflict */
1969 rte_eal_alarm_cancel(igc_update_queue_stats_handler, dev);
1971 /* HW registers are cleared on read */
1972 igc_reset_queue_stats_register(hw);
1973 igc_read_stats_registers(hw, hw_stats);
1975 /* Reset software totals */
1976 memset(hw_stats, 0, sizeof(*hw_stats));
1977 memset(queue_stats, 0, sizeof(*queue_stats));
1979 /* Restart the queue status handler */
1980 rte_eal_alarm_set(IGC_ALARM_INTERVAL, igc_update_queue_stats_handler,
1987 eth_igc_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
1988 struct rte_eth_xstat_name *xstats_names, unsigned int size)
1992 if (xstats_names == NULL)
1993 return IGC_NB_XSTATS;
1995 if (size < IGC_NB_XSTATS) {
1996 PMD_DRV_LOG(ERR, "not enough buffers!");
1997 return IGC_NB_XSTATS;
2000 for (i = 0; i < IGC_NB_XSTATS; i++)
2001 strlcpy(xstats_names[i].name, rte_igc_stats_strings[i].name,
2002 sizeof(xstats_names[i].name));
2004 return IGC_NB_XSTATS;
2008 eth_igc_xstats_get_names_by_id(struct rte_eth_dev *dev,
2009 struct rte_eth_xstat_name *xstats_names, const uint64_t *ids,
2015 return eth_igc_xstats_get_names(dev, xstats_names, limit);
2017 for (i = 0; i < limit; i++) {
2018 if (ids[i] >= IGC_NB_XSTATS) {
2019 PMD_DRV_LOG(ERR, "id value isn't valid");
2022 strlcpy(xstats_names[i].name,
2023 rte_igc_stats_strings[ids[i]].name,
2024 sizeof(xstats_names[i].name));
2030 eth_igc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
2031 uint64_t *values, unsigned int n)
2033 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2034 struct igc_hw_stats *hw_stats = IGC_DEV_PRIVATE_STATS(dev);
2037 igc_read_stats_registers(hw, hw_stats);
2040 if (n < IGC_NB_XSTATS)
2041 return IGC_NB_XSTATS;
2043 /* If this is a reset xstats is NULL, and we have cleared the
2044 * registers by reading them.
2049 /* Extended stats */
2050 for (i = 0; i < IGC_NB_XSTATS; i++)
2051 values[i] = *(uint64_t *)(((char *)hw_stats) +
2052 rte_igc_stats_strings[i].offset);
2054 return IGC_NB_XSTATS;
2057 for (i = 0; i < n; i++) {
2058 if (ids[i] >= IGC_NB_XSTATS) {
2059 PMD_DRV_LOG(ERR, "id value isn't valid");
2062 values[i] = *(uint64_t *)(((char *)hw_stats) +
2063 rte_igc_stats_strings[ids[i]].offset);
2070 eth_igc_queue_stats_mapping_set(struct rte_eth_dev *dev,
2071 uint16_t queue_id, uint8_t stat_idx, uint8_t is_rx)
2073 struct igc_adapter *igc = IGC_DEV_PRIVATE(dev);
2075 /* check queue id is valid */
2076 if (queue_id >= IGC_QUEUE_PAIRS_NUM) {
2077 PMD_DRV_LOG(ERR, "queue id(%u) error, max is %u",
2078 queue_id, IGC_QUEUE_PAIRS_NUM - 1);
2082 /* store the mapping status id */
2084 igc->rxq_stats_map[queue_id] = stat_idx;
2086 igc->txq_stats_map[queue_id] = stat_idx;
2092 eth_igc_rx_queue_intr_disable(struct rte_eth_dev *dev, uint16_t queue_id)
2094 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2095 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
2096 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
2097 uint32_t vec = IGC_MISC_VEC_ID;
2099 if (rte_intr_allow_others(intr_handle))
2100 vec = IGC_RX_VEC_START;
2102 uint32_t mask = 1u << (queue_id + vec);
2104 IGC_WRITE_REG(hw, IGC_EIMC, mask);
2105 IGC_WRITE_FLUSH(hw);
2111 eth_igc_rx_queue_intr_enable(struct rte_eth_dev *dev, uint16_t queue_id)
2113 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2114 struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
2115 struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
2116 uint32_t vec = IGC_MISC_VEC_ID;
2118 if (rte_intr_allow_others(intr_handle))
2119 vec = IGC_RX_VEC_START;
2121 uint32_t mask = 1u << (queue_id + vec);
2123 IGC_WRITE_REG(hw, IGC_EIMS, mask);
2124 IGC_WRITE_FLUSH(hw);
2126 rte_intr_enable(intr_handle);
2132 eth_igc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
2134 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2139 fc_conf->pause_time = hw->fc.pause_time;
2140 fc_conf->high_water = hw->fc.high_water;
2141 fc_conf->low_water = hw->fc.low_water;
2142 fc_conf->send_xon = hw->fc.send_xon;
2143 fc_conf->autoneg = hw->mac.autoneg;
2146 * Return rx_pause and tx_pause status according to actual setting of
2147 * the TFCE and RFCE bits in the CTRL register.
2149 ctrl = IGC_READ_REG(hw, IGC_CTRL);
2150 if (ctrl & IGC_CTRL_TFCE)
2155 if (ctrl & IGC_CTRL_RFCE)
2160 if (rx_pause && tx_pause)
2161 fc_conf->mode = RTE_FC_FULL;
2163 fc_conf->mode = RTE_FC_RX_PAUSE;
2165 fc_conf->mode = RTE_FC_TX_PAUSE;
2167 fc_conf->mode = RTE_FC_NONE;
2173 eth_igc_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
2175 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2176 uint32_t rx_buf_size;
2177 uint32_t max_high_water;
2181 if (fc_conf->autoneg != hw->mac.autoneg)
2184 rx_buf_size = igc_get_rx_buffer_size(hw);
2185 PMD_DRV_LOG(DEBUG, "Rx packet buffer size = 0x%x", rx_buf_size);
2187 /* At least reserve one Ethernet frame for watermark */
2188 max_high_water = rx_buf_size - RTE_ETHER_MAX_LEN;
2189 if (fc_conf->high_water > max_high_water ||
2190 fc_conf->high_water < fc_conf->low_water) {
2192 "Incorrect high(%u)/low(%u) water value, max is %u",
2193 fc_conf->high_water, fc_conf->low_water,
2198 switch (fc_conf->mode) {
2200 hw->fc.requested_mode = igc_fc_none;
2202 case RTE_FC_RX_PAUSE:
2203 hw->fc.requested_mode = igc_fc_rx_pause;
2205 case RTE_FC_TX_PAUSE:
2206 hw->fc.requested_mode = igc_fc_tx_pause;
2209 hw->fc.requested_mode = igc_fc_full;
2212 PMD_DRV_LOG(ERR, "unsupported fc mode: %u", fc_conf->mode);
2216 hw->fc.pause_time = fc_conf->pause_time;
2217 hw->fc.high_water = fc_conf->high_water;
2218 hw->fc.low_water = fc_conf->low_water;
2219 hw->fc.send_xon = fc_conf->send_xon;
2221 err = igc_setup_link_generic(hw);
2222 if (err == IGC_SUCCESS) {
2224 * check if we want to forward MAC frames - driver doesn't have
2225 * native capability to do that, so we'll write the registers
2228 rctl = IGC_READ_REG(hw, IGC_RCTL);
2230 /* set or clear MFLCN.PMCF bit depending on configuration */
2231 if (fc_conf->mac_ctrl_frame_fwd != 0)
2232 rctl |= IGC_RCTL_PMCF;
2234 rctl &= ~IGC_RCTL_PMCF;
2236 IGC_WRITE_REG(hw, IGC_RCTL, rctl);
2237 IGC_WRITE_FLUSH(hw);
2242 PMD_DRV_LOG(ERR, "igc_setup_link_generic = 0x%x", err);
2247 eth_igc_rss_reta_update(struct rte_eth_dev *dev,
2248 struct rte_eth_rss_reta_entry64 *reta_conf,
2251 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2254 if (reta_size != ETH_RSS_RETA_SIZE_128) {
2256 "The size of RSS redirection table configured(%d) doesn't match the number hardware can supported(%d)",
2257 reta_size, ETH_RSS_RETA_SIZE_128);
2261 /* set redirection table */
2262 for (i = 0; i < ETH_RSS_RETA_SIZE_128; i += IGC_RSS_RDT_REG_SIZE) {
2263 union igc_rss_reta_reg reta, reg;
2264 uint16_t idx, shift;
2267 idx = i / RTE_RETA_GROUP_SIZE;
2268 shift = i % RTE_RETA_GROUP_SIZE;
2269 mask = (uint8_t)((reta_conf[idx].mask >> shift) &
2270 IGC_RSS_RDT_REG_SIZE_MASK);
2272 /* if no need to update the register */
2276 /* check mask whether need to read the register value first */
2277 if (mask == IGC_RSS_RDT_REG_SIZE_MASK)
2280 reg.dword = IGC_READ_REG_LE_VALUE(hw,
2281 IGC_RETA(i / IGC_RSS_RDT_REG_SIZE));
2283 /* update the register */
2284 for (j = 0; j < IGC_RSS_RDT_REG_SIZE; j++) {
2285 if (mask & (1u << j))
2287 (uint8_t)reta_conf[idx].reta[shift + j];
2289 reta.bytes[j] = reg.bytes[j];
2291 IGC_WRITE_REG_LE_VALUE(hw,
2292 IGC_RETA(i / IGC_RSS_RDT_REG_SIZE), reta.dword);
2299 eth_igc_rss_reta_query(struct rte_eth_dev *dev,
2300 struct rte_eth_rss_reta_entry64 *reta_conf,
2303 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2306 if (reta_size != ETH_RSS_RETA_SIZE_128) {
2308 "The size of RSS redirection table configured(%d) doesn't match the number hardware can supported(%d)",
2309 reta_size, ETH_RSS_RETA_SIZE_128);
2313 /* read redirection table */
2314 for (i = 0; i < ETH_RSS_RETA_SIZE_128; i += IGC_RSS_RDT_REG_SIZE) {
2315 union igc_rss_reta_reg reta;
2316 uint16_t idx, shift;
2319 idx = i / RTE_RETA_GROUP_SIZE;
2320 shift = i % RTE_RETA_GROUP_SIZE;
2321 mask = (uint8_t)((reta_conf[idx].mask >> shift) &
2322 IGC_RSS_RDT_REG_SIZE_MASK);
2324 /* if no need to read register */
2328 /* read register and get the queue index */
2329 reta.dword = IGC_READ_REG_LE_VALUE(hw,
2330 IGC_RETA(i / IGC_RSS_RDT_REG_SIZE));
2331 for (j = 0; j < IGC_RSS_RDT_REG_SIZE; j++) {
2332 if (mask & (1u << j))
2333 reta_conf[idx].reta[shift + j] = reta.bytes[j];
2341 eth_igc_rss_hash_update(struct rte_eth_dev *dev,
2342 struct rte_eth_rss_conf *rss_conf)
2344 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2345 igc_hw_rss_hash_set(hw, rss_conf);
2350 eth_igc_rss_hash_conf_get(struct rte_eth_dev *dev,
2351 struct rte_eth_rss_conf *rss_conf)
2353 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2354 uint32_t *hash_key = (uint32_t *)rss_conf->rss_key;
2358 if (hash_key != NULL) {
2361 /* if not enough space for store hash key */
2362 if (rss_conf->rss_key_len != IGC_HKEY_SIZE) {
2364 "RSS hash key size %u in parameter doesn't match the hardware hash key size %u",
2365 rss_conf->rss_key_len, IGC_HKEY_SIZE);
2369 /* read RSS key from register */
2370 for (i = 0; i < IGC_HKEY_MAX_INDEX; i++)
2371 hash_key[i] = IGC_READ_REG_LE_VALUE(hw, IGC_RSSRK(i));
2374 /* get RSS functions configured in MRQC register */
2375 mrqc = IGC_READ_REG(hw, IGC_MRQC);
2376 if ((mrqc & IGC_MRQC_ENABLE_RSS_4Q) == 0)
2380 if (mrqc & IGC_MRQC_RSS_FIELD_IPV4)
2381 rss_hf |= ETH_RSS_IPV4;
2382 if (mrqc & IGC_MRQC_RSS_FIELD_IPV4_TCP)
2383 rss_hf |= ETH_RSS_NONFRAG_IPV4_TCP;
2384 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6)
2385 rss_hf |= ETH_RSS_IPV6;
2386 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6_EX)
2387 rss_hf |= ETH_RSS_IPV6_EX;
2388 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6_TCP)
2389 rss_hf |= ETH_RSS_NONFRAG_IPV6_TCP;
2390 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6_TCP_EX)
2391 rss_hf |= ETH_RSS_IPV6_TCP_EX;
2392 if (mrqc & IGC_MRQC_RSS_FIELD_IPV4_UDP)
2393 rss_hf |= ETH_RSS_NONFRAG_IPV4_UDP;
2394 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6_UDP)
2395 rss_hf |= ETH_RSS_NONFRAG_IPV6_UDP;
2396 if (mrqc & IGC_MRQC_RSS_FIELD_IPV6_UDP_EX)
2397 rss_hf |= ETH_RSS_IPV6_UDP_EX;
2399 rss_conf->rss_hf |= rss_hf;
2404 eth_igc_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
2406 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2407 struct igc_vfta *shadow_vfta = IGC_DEV_PRIVATE_VFTA(dev);
2412 vid_idx = (vlan_id >> IGC_VFTA_ENTRY_SHIFT) & IGC_VFTA_ENTRY_MASK;
2413 vid_bit = 1u << (vlan_id & IGC_VFTA_ENTRY_BIT_SHIFT_MASK);
2414 vfta = shadow_vfta->vfta[vid_idx];
2419 IGC_WRITE_REG_ARRAY(hw, IGC_VFTA, vid_idx, vfta);
2421 /* update local VFTA copy */
2422 shadow_vfta->vfta[vid_idx] = vfta;
2428 igc_vlan_hw_filter_disable(struct rte_eth_dev *dev)
2430 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2431 igc_read_reg_check_clear_bits(hw, IGC_RCTL,
2432 IGC_RCTL_CFIEN | IGC_RCTL_VFE);
2436 igc_vlan_hw_filter_enable(struct rte_eth_dev *dev)
2438 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2439 struct igc_vfta *shadow_vfta = IGC_DEV_PRIVATE_VFTA(dev);
2443 /* Filter Table Enable, CFI not used for packet acceptance */
2444 reg_val = IGC_READ_REG(hw, IGC_RCTL);
2445 reg_val &= ~IGC_RCTL_CFIEN;
2446 reg_val |= IGC_RCTL_VFE;
2447 IGC_WRITE_REG(hw, IGC_RCTL, reg_val);
2449 /* restore VFTA table */
2450 for (i = 0; i < IGC_VFTA_SIZE; i++)
2451 IGC_WRITE_REG_ARRAY(hw, IGC_VFTA, i, shadow_vfta->vfta[i]);
2455 igc_vlan_hw_strip_disable(struct rte_eth_dev *dev)
2457 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2459 igc_read_reg_check_clear_bits(hw, IGC_CTRL, IGC_CTRL_VME);
2463 igc_vlan_hw_strip_enable(struct rte_eth_dev *dev)
2465 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2467 igc_read_reg_check_set_bits(hw, IGC_CTRL, IGC_CTRL_VME);
2471 igc_vlan_hw_extend_disable(struct rte_eth_dev *dev)
2473 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2476 ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT);
2478 /* if extend vlan hasn't been enabled */
2479 if ((ctrl_ext & IGC_CTRL_EXT_EXT_VLAN) == 0)
2482 if ((dev->data->dev_conf.rxmode.offloads &
2483 DEV_RX_OFFLOAD_JUMBO_FRAME) == 0)
2484 goto write_ext_vlan;
2486 /* Update maximum packet length */
2487 if (dev->data->dev_conf.rxmode.max_rx_pkt_len <
2488 RTE_ETHER_MIN_MTU + VLAN_TAG_SIZE) {
2489 PMD_DRV_LOG(ERR, "Maximum packet length %u error, min is %u",
2490 dev->data->dev_conf.rxmode.max_rx_pkt_len,
2491 VLAN_TAG_SIZE + RTE_ETHER_MIN_MTU);
2494 dev->data->dev_conf.rxmode.max_rx_pkt_len -= VLAN_TAG_SIZE;
2495 IGC_WRITE_REG(hw, IGC_RLPML,
2496 dev->data->dev_conf.rxmode.max_rx_pkt_len);
2499 IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext & ~IGC_CTRL_EXT_EXT_VLAN);
2504 igc_vlan_hw_extend_enable(struct rte_eth_dev *dev)
2506 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2509 ctrl_ext = IGC_READ_REG(hw, IGC_CTRL_EXT);
2511 /* if extend vlan has been enabled */
2512 if (ctrl_ext & IGC_CTRL_EXT_EXT_VLAN)
2515 if ((dev->data->dev_conf.rxmode.offloads &
2516 DEV_RX_OFFLOAD_JUMBO_FRAME) == 0)
2517 goto write_ext_vlan;
2519 /* Update maximum packet length */
2520 if (dev->data->dev_conf.rxmode.max_rx_pkt_len >
2521 MAX_RX_JUMBO_FRAME_SIZE - VLAN_TAG_SIZE) {
2522 PMD_DRV_LOG(ERR, "Maximum packet length %u error, max is %u",
2523 dev->data->dev_conf.rxmode.max_rx_pkt_len +
2524 VLAN_TAG_SIZE, MAX_RX_JUMBO_FRAME_SIZE);
2527 dev->data->dev_conf.rxmode.max_rx_pkt_len += VLAN_TAG_SIZE;
2528 IGC_WRITE_REG(hw, IGC_RLPML,
2529 dev->data->dev_conf.rxmode.max_rx_pkt_len);
2532 IGC_WRITE_REG(hw, IGC_CTRL_EXT, ctrl_ext | IGC_CTRL_EXT_EXT_VLAN);
2537 eth_igc_vlan_offload_set(struct rte_eth_dev *dev, int mask)
2539 struct rte_eth_rxmode *rxmode;
2541 rxmode = &dev->data->dev_conf.rxmode;
2542 if (mask & ETH_VLAN_STRIP_MASK) {
2543 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
2544 igc_vlan_hw_strip_enable(dev);
2546 igc_vlan_hw_strip_disable(dev);
2549 if (mask & ETH_VLAN_FILTER_MASK) {
2550 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
2551 igc_vlan_hw_filter_enable(dev);
2553 igc_vlan_hw_filter_disable(dev);
2556 if (mask & ETH_VLAN_EXTEND_MASK) {
2557 if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)
2558 return igc_vlan_hw_extend_enable(dev);
2560 return igc_vlan_hw_extend_disable(dev);
2567 eth_igc_vlan_tpid_set(struct rte_eth_dev *dev,
2568 enum rte_vlan_type vlan_type,
2571 struct igc_hw *hw = IGC_DEV_PRIVATE_HW(dev);
2574 /* only outer TPID of double VLAN can be configured*/
2575 if (vlan_type == ETH_VLAN_TYPE_OUTER) {
2576 reg_val = IGC_READ_REG(hw, IGC_VET);
2577 reg_val = (reg_val & (~IGC_VET_EXT)) |
2578 ((uint32_t)tpid << IGC_VET_EXT_SHIFT);
2579 IGC_WRITE_REG(hw, IGC_VET, reg_val);
2584 /* all other TPID values are read-only*/
2585 PMD_DRV_LOG(ERR, "Not supported");
2590 eth_igc_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
2591 struct rte_pci_device *pci_dev)
2593 PMD_INIT_FUNC_TRACE();
2594 return rte_eth_dev_pci_generic_probe(pci_dev,
2595 sizeof(struct igc_adapter), eth_igc_dev_init);
2599 eth_igc_pci_remove(struct rte_pci_device *pci_dev)
2601 PMD_INIT_FUNC_TRACE();
2602 return rte_eth_dev_pci_generic_remove(pci_dev, eth_igc_dev_uninit);
2605 static struct rte_pci_driver rte_igc_pmd = {
2606 .id_table = pci_id_igc_map,
2607 .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC,
2608 .probe = eth_igc_pci_probe,
2609 .remove = eth_igc_pci_remove,
2612 RTE_PMD_REGISTER_PCI(net_igc, rte_igc_pmd);
2613 RTE_PMD_REGISTER_PCI_TABLE(net_igc, pci_id_igc_map);
2614 RTE_PMD_REGISTER_KMOD_DEP(net_igc, "* igb_uio | uio_pci_generic | vfio-pci");