.. | .. |
---|
1 | 1 | // SPDX-License-Identifier: GPL-2.0 |
---|
2 | | -/* Copyright(c) 2013 - 2018 Intel Corporation. */ |
---|
| 2 | +/* Copyright(c) 2013 - 2019 Intel Corporation. */ |
---|
3 | 3 | |
---|
4 | 4 | #include <linux/module.h> |
---|
5 | 5 | #include <linux/interrupt.h> |
---|
.. | .. |
---|
23 | 23 | */ |
---|
24 | 24 | static const struct pci_device_id fm10k_pci_tbl[] = { |
---|
25 | 25 | { PCI_VDEVICE(INTEL, FM10K_DEV_ID_PF), fm10k_device_pf }, |
---|
| 26 | + { PCI_VDEVICE(INTEL, FM10K_DEV_ID_SDI_FM10420_QDA2), fm10k_device_pf }, |
---|
| 27 | + { PCI_VDEVICE(INTEL, FM10K_DEV_ID_SDI_FM10420_DA2), fm10k_device_pf }, |
---|
26 | 28 | { PCI_VDEVICE(INTEL, FM10K_DEV_ID_VF), fm10k_device_vf }, |
---|
27 | 29 | /* required last entry */ |
---|
28 | 30 | { 0, } |
---|
.. | .. |
---|
219 | 221 | { |
---|
220 | 222 | struct net_device *netdev = interface->netdev; |
---|
221 | 223 | |
---|
222 | | - WARN_ON(in_interrupt()); |
---|
223 | | - |
---|
224 | 224 | /* put off any impending NetWatchDogTimeout */ |
---|
225 | 225 | netif_trans_update(netdev); |
---|
226 | 226 | |
---|
.. | .. |
---|
342 | 342 | struct net_device *netdev = interface->netdev; |
---|
343 | 343 | u32 __iomem *hw_addr; |
---|
344 | 344 | u32 value; |
---|
345 | | - int err; |
---|
346 | 345 | |
---|
347 | 346 | /* do nothing if netdev is still present or hw_addr is set */ |
---|
348 | 347 | if (netif_device_present(netdev) || interface->hw.hw_addr) |
---|
.. | .. |
---|
360 | 359 | hw_addr = READ_ONCE(interface->uc_addr); |
---|
361 | 360 | value = readl(hw_addr); |
---|
362 | 361 | if (~value) { |
---|
| 362 | + int err; |
---|
| 363 | + |
---|
363 | 364 | /* Make sure the reset was initiated because we detached, |
---|
364 | 365 | * otherwise we might race with a different reset flow. |
---|
365 | 366 | */ |
---|
.. | .. |
---|
627 | 628 | net_stats->rx_errors = rx_errors; |
---|
628 | 629 | net_stats->rx_dropped = interface->stats.nodesc_drop.count; |
---|
629 | 630 | |
---|
| 631 | + /* Update VF statistics */ |
---|
| 632 | + fm10k_iov_update_stats(interface); |
---|
| 633 | + |
---|
630 | 634 | clear_bit(__FM10K_UPDATING_STATS, interface->state); |
---|
631 | 635 | } |
---|
632 | 636 | |
---|
.. | .. |
---|
695 | 699 | */ |
---|
696 | 700 | static void fm10k_check_hang_subtask(struct fm10k_intfc *interface) |
---|
697 | 701 | { |
---|
698 | | - int i; |
---|
699 | | - |
---|
700 | 702 | /* If we're down or resetting, just bail */ |
---|
701 | 703 | if (test_bit(__FM10K_DOWN, interface->state) || |
---|
702 | 704 | test_bit(__FM10K_RESETTING, interface->state)) |
---|
.. | .. |
---|
708 | 710 | interface->next_tx_hang_check = jiffies + (2 * HZ); |
---|
709 | 711 | |
---|
710 | 712 | if (netif_carrier_ok(interface->netdev)) { |
---|
| 713 | + int i; |
---|
| 714 | + |
---|
711 | 715 | /* Force detection of hung controller */ |
---|
712 | 716 | for (i = 0; i < interface->num_tx_queues; i++) |
---|
713 | 717 | set_check_for_tx_hang(interface->tx_ring[i]); |
---|
.. | .. |
---|
895 | 899 | |
---|
896 | 900 | /* Map interrupt */ |
---|
897 | 901 | if (ring->q_vector) { |
---|
898 | | - txint = ring->q_vector->v_idx + NON_Q_VECTORS(hw); |
---|
| 902 | + txint = ring->q_vector->v_idx + NON_Q_VECTORS; |
---|
899 | 903 | txint |= FM10K_INT_MAP_TIMER0; |
---|
900 | 904 | } |
---|
901 | 905 | |
---|
.. | .. |
---|
1034 | 1038 | |
---|
1035 | 1039 | /* Map interrupt */ |
---|
1036 | 1040 | if (ring->q_vector) { |
---|
1037 | | - rxint = ring->q_vector->v_idx + NON_Q_VECTORS(hw); |
---|
| 1041 | + rxint = ring->q_vector->v_idx + NON_Q_VECTORS; |
---|
1038 | 1042 | rxint |= FM10K_INT_MAP_TIMER1; |
---|
1039 | 1043 | } |
---|
1040 | 1044 | |
---|
.. | .. |
---|
1717 | 1721 | void fm10k_qv_free_irq(struct fm10k_intfc *interface) |
---|
1718 | 1722 | { |
---|
1719 | 1723 | int vector = interface->num_q_vectors; |
---|
1720 | | - struct fm10k_hw *hw = &interface->hw; |
---|
1721 | 1724 | struct msix_entry *entry; |
---|
1722 | 1725 | |
---|
1723 | | - entry = &interface->msix_entries[NON_Q_VECTORS(hw) + vector]; |
---|
| 1726 | + entry = &interface->msix_entries[NON_Q_VECTORS + vector]; |
---|
1724 | 1727 | |
---|
1725 | 1728 | while (vector) { |
---|
1726 | 1729 | struct fm10k_q_vector *q_vector; |
---|
.. | .. |
---|
1757 | 1760 | unsigned int ri = 0, ti = 0; |
---|
1758 | 1761 | int vector, err; |
---|
1759 | 1762 | |
---|
1760 | | - entry = &interface->msix_entries[NON_Q_VECTORS(hw)]; |
---|
| 1763 | + entry = &interface->msix_entries[NON_Q_VECTORS]; |
---|
1761 | 1764 | |
---|
1762 | 1765 | for (vector = 0; vector < interface->num_q_vectors; vector++) { |
---|
1763 | 1766 | struct fm10k_q_vector *q_vector = interface->q_vector[vector]; |
---|
.. | .. |
---|
2061 | 2064 | interface->tx_itr = FM10K_TX_ITR_DEFAULT; |
---|
2062 | 2065 | interface->rx_itr = FM10K_ITR_ADAPTIVE | FM10K_RX_ITR_DEFAULT; |
---|
2063 | 2066 | |
---|
2064 | | - /* initialize udp port lists */ |
---|
2065 | | - INIT_LIST_HEAD(&interface->vxlan_port); |
---|
2066 | | - INIT_LIST_HEAD(&interface->geneve_port); |
---|
2067 | | - |
---|
2068 | 2067 | /* Initialize the MAC/VLAN queue */ |
---|
2069 | 2068 | INIT_LIST_HEAD(&interface->macvlan_requests); |
---|
2070 | 2069 | |
---|
.. | .. |
---|
2338 | 2337 | /* Restart the MAC/VLAN request queue in-case of outstanding events */ |
---|
2339 | 2338 | fm10k_macvlan_schedule(interface); |
---|
2340 | 2339 | |
---|
2341 | | - return err; |
---|
| 2340 | + return 0; |
---|
2342 | 2341 | } |
---|
2343 | 2342 | |
---|
2344 | 2343 | /** |
---|
.. | .. |
---|
2351 | 2350 | **/ |
---|
2352 | 2351 | static int __maybe_unused fm10k_resume(struct device *dev) |
---|
2353 | 2352 | { |
---|
2354 | | - struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev)); |
---|
| 2353 | + struct fm10k_intfc *interface = dev_get_drvdata(dev); |
---|
2355 | 2354 | struct net_device *netdev = interface->netdev; |
---|
2356 | 2355 | struct fm10k_hw *hw = &interface->hw; |
---|
2357 | 2356 | int err; |
---|
.. | .. |
---|
2378 | 2377 | **/ |
---|
2379 | 2378 | static int __maybe_unused fm10k_suspend(struct device *dev) |
---|
2380 | 2379 | { |
---|
2381 | | - struct fm10k_intfc *interface = pci_get_drvdata(to_pci_dev(dev)); |
---|
| 2380 | + struct fm10k_intfc *interface = dev_get_drvdata(dev); |
---|
2382 | 2381 | struct net_device *netdev = interface->netdev; |
---|
2383 | 2382 | |
---|
2384 | 2383 | netif_device_detach(netdev); |
---|
.. | .. |
---|
2440 | 2439 | |
---|
2441 | 2440 | result = PCI_ERS_RESULT_RECOVERED; |
---|
2442 | 2441 | } |
---|
2443 | | - |
---|
2444 | | - pci_cleanup_aer_uncorrect_error_status(pdev); |
---|
2445 | 2442 | |
---|
2446 | 2443 | return result; |
---|
2447 | 2444 | } |
---|