.. | .. |
---|
24 | 24 | |
---|
25 | 25 | #include "igbvf.h" |
---|
26 | 26 | |
---|
27 | | -#define DRV_VERSION "2.4.0-k" |
---|
28 | 27 | char igbvf_driver_name[] = "igbvf"; |
---|
29 | | -const char igbvf_driver_version[] = DRV_VERSION; |
---|
30 | 28 | static const char igbvf_driver_string[] = |
---|
31 | 29 | "Intel(R) Gigabit Virtual Function Network Driver"; |
---|
32 | 30 | static const char igbvf_copyright[] = |
---|
.. | .. |
---|
63 | 61 | |
---|
64 | 62 | /** |
---|
65 | 63 | * igbvf_desc_unused - calculate if we have unused descriptors |
---|
66 | | - * @rx_ring: address of receive ring structure |
---|
| 64 | + * @ring: address of receive ring structure |
---|
67 | 65 | **/ |
---|
68 | 66 | static int igbvf_desc_unused(struct igbvf_ring *ring) |
---|
69 | 67 | { |
---|
.. | .. |
---|
76 | 74 | /** |
---|
77 | 75 | * igbvf_receive_skb - helper function to handle Rx indications |
---|
78 | 76 | * @adapter: board private structure |
---|
| 77 | + * @netdev: pointer to netdev struct |
---|
| 78 | + * @skb: skb to indicate to stack |
---|
79 | 79 | * @status: descriptor status field as written by hardware |
---|
80 | 80 | * @vlan: descriptor vlan field as written by hardware (no le/be conversion) |
---|
81 | 81 | * @skb: pointer to sk_buff to be indicated to stack |
---|
.. | .. |
---|
83 | 83 | static void igbvf_receive_skb(struct igbvf_adapter *adapter, |
---|
84 | 84 | struct net_device *netdev, |
---|
85 | 85 | struct sk_buff *skb, |
---|
86 | | - u32 status, u16 vlan) |
---|
| 86 | + u32 status, __le16 vlan) |
---|
87 | 87 | { |
---|
88 | 88 | u16 vid; |
---|
89 | 89 | |
---|
90 | 90 | if (status & E1000_RXD_STAT_VP) { |
---|
91 | 91 | if ((adapter->flags & IGBVF_FLAG_RX_LB_VLAN_BSWAP) && |
---|
92 | 92 | (status & E1000_RXDEXT_STATERR_LB)) |
---|
93 | | - vid = be16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK; |
---|
| 93 | + vid = be16_to_cpu((__force __be16)vlan) & E1000_RXD_SPC_VLAN_MASK; |
---|
94 | 94 | else |
---|
95 | 95 | vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK; |
---|
96 | 96 | if (test_bit(vid, adapter->active_vlans)) |
---|
.. | .. |
---|
235 | 235 | /** |
---|
236 | 236 | * igbvf_clean_rx_irq - Send received data up the network stack; legacy |
---|
237 | 237 | * @adapter: board private structure |
---|
| 238 | + * @work_done: output parameter used to indicate completed work |
---|
| 239 | + * @work_to_do: input parameter setting limit of work |
---|
238 | 240 | * |
---|
239 | 241 | * the return value indicates whether actual cleaning was done, there |
---|
240 | 242 | * is no guarantee that everything was cleaned |
---|
.. | .. |
---|
408 | 410 | /** |
---|
409 | 411 | * igbvf_setup_tx_resources - allocate Tx resources (Descriptors) |
---|
410 | 412 | * @adapter: board private structure |
---|
| 413 | + * @tx_ring: ring being initialized |
---|
411 | 414 | * |
---|
412 | 415 | * Return 0 on success, negative on failure |
---|
413 | 416 | **/ |
---|
.. | .. |
---|
446 | 449 | /** |
---|
447 | 450 | * igbvf_setup_rx_resources - allocate Rx resources (Descriptors) |
---|
448 | 451 | * @adapter: board private structure |
---|
| 452 | + * @rx_ring: ring being initialized |
---|
449 | 453 | * |
---|
450 | 454 | * Returns 0 on success, negative on failure |
---|
451 | 455 | **/ |
---|
.. | .. |
---|
542 | 546 | |
---|
543 | 547 | /** |
---|
544 | 548 | * igbvf_clean_rx_ring - Free Rx Buffers per Queue |
---|
545 | | - * @adapter: board private structure |
---|
| 549 | + * @rx_ring: ring structure pointer to free buffers from |
---|
546 | 550 | **/ |
---|
547 | 551 | static void igbvf_clean_rx_ring(struct igbvf_ring *rx_ring) |
---|
548 | 552 | { |
---|
.. | .. |
---|
762 | 766 | |
---|
763 | 767 | /** |
---|
764 | 768 | * igbvf_clean_tx_irq - Reclaim resources after transmit completes |
---|
765 | | - * @adapter: board private structure |
---|
| 769 | + * @tx_ring: ring structure to clean descriptors from |
---|
766 | 770 | * |
---|
767 | 771 | * returns true if ring is completely cleaned |
---|
768 | 772 | **/ |
---|
.. | .. |
---|
1186 | 1190 | |
---|
1187 | 1191 | igbvf_clean_rx_irq(adapter, &work_done, budget); |
---|
1188 | 1192 | |
---|
1189 | | - /* If not enough Rx work done, exit the polling mode */ |
---|
1190 | | - if (work_done < budget) { |
---|
1191 | | - napi_complete_done(napi, work_done); |
---|
| 1193 | + if (work_done == budget) |
---|
| 1194 | + return budget; |
---|
1192 | 1195 | |
---|
| 1196 | + /* Exit the polling mode, but don't re-enable interrupts if stack might |
---|
| 1197 | + * poll us due to busy-polling |
---|
| 1198 | + */ |
---|
| 1199 | + if (likely(napi_complete_done(napi, work_done))) { |
---|
1193 | 1200 | if (adapter->requested_itr & 3) |
---|
1194 | 1201 | igbvf_set_itr(adapter); |
---|
1195 | 1202 | |
---|
.. | .. |
---|
1890 | 1897 | |
---|
1891 | 1898 | /** |
---|
1892 | 1899 | * igbvf_watchdog - Timer Call-back |
---|
1893 | | - * @data: pointer to adapter cast into an unsigned long |
---|
| 1900 | + * @t: timer list pointer containing private struct |
---|
1894 | 1901 | **/ |
---|
1895 | 1902 | static void igbvf_watchdog(struct timer_list *t) |
---|
1896 | 1903 | { |
---|
.. | .. |
---|
2090 | 2097 | switch (skb->csum_offset) { |
---|
2091 | 2098 | case offsetof(struct tcphdr, check): |
---|
2092 | 2099 | type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP; |
---|
2093 | | - /* fall through */ |
---|
| 2100 | + fallthrough; |
---|
2094 | 2101 | case offsetof(struct udphdr, check): |
---|
2095 | 2102 | break; |
---|
2096 | 2103 | case offsetof(struct sctphdr, checksum): |
---|
.. | .. |
---|
2102 | 2109 | type_tucmd = E1000_ADVTXD_TUCMD_L4T_SCTP; |
---|
2103 | 2110 | break; |
---|
2104 | 2111 | } |
---|
2105 | | - /* fall through */ |
---|
| 2112 | + fallthrough; |
---|
2106 | 2113 | default: |
---|
2107 | 2114 | skb_checksum_help(skb); |
---|
2108 | 2115 | goto csum_failed; |
---|
.. | .. |
---|
2171 | 2178 | goto dma_error; |
---|
2172 | 2179 | |
---|
2173 | 2180 | for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) { |
---|
2174 | | - const struct skb_frag_struct *frag; |
---|
| 2181 | + const skb_frag_t *frag; |
---|
2175 | 2182 | |
---|
2176 | 2183 | count++; |
---|
2177 | 2184 | i++; |
---|
.. | .. |
---|
2276 | 2283 | tx_ring->buffer_info[first].next_to_watch = tx_desc; |
---|
2277 | 2284 | tx_ring->next_to_use = i; |
---|
2278 | 2285 | writel(i, adapter->hw.hw_addr + tx_ring->tail); |
---|
2279 | | - /* we need this if more than one processor can write to our tail |
---|
2280 | | - * at a time, it synchronizes IO on IA64/Altix systems |
---|
2281 | | - */ |
---|
2282 | | - mmiowb(); |
---|
2283 | 2286 | } |
---|
2284 | 2287 | |
---|
2285 | 2288 | static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb, |
---|
.. | .. |
---|
2375 | 2378 | /** |
---|
2376 | 2379 | * igbvf_tx_timeout - Respond to a Tx Hang |
---|
2377 | 2380 | * @netdev: network interface device structure |
---|
| 2381 | + * @txqueue: queue timing out (unused) |
---|
2378 | 2382 | **/ |
---|
2379 | | -static void igbvf_tx_timeout(struct net_device *netdev) |
---|
| 2383 | +static void igbvf_tx_timeout(struct net_device *netdev, unsigned int __always_unused txqueue) |
---|
2380 | 2384 | { |
---|
2381 | 2385 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
---|
2382 | 2386 | |
---|
.. | .. |
---|
2438 | 2442 | adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + |
---|
2439 | 2443 | ETH_FCS_LEN; |
---|
2440 | 2444 | |
---|
2441 | | - dev_info(&adapter->pdev->dev, "changing MTU from %d to %d\n", |
---|
2442 | | - netdev->mtu, new_mtu); |
---|
| 2445 | + netdev_dbg(netdev, "changing MTU from %d to %d\n", |
---|
| 2446 | + netdev->mtu, new_mtu); |
---|
2443 | 2447 | netdev->mtu = new_mtu; |
---|
2444 | 2448 | |
---|
2445 | 2449 | if (netif_running(netdev)) |
---|
.. | .. |
---|
2460 | 2464 | } |
---|
2461 | 2465 | } |
---|
2462 | 2466 | |
---|
2463 | | -static int igbvf_suspend(struct pci_dev *pdev, pm_message_t state) |
---|
| 2467 | +static int igbvf_suspend(struct device *dev_d) |
---|
2464 | 2468 | { |
---|
2465 | | - struct net_device *netdev = pci_get_drvdata(pdev); |
---|
| 2469 | + struct net_device *netdev = dev_get_drvdata(dev_d); |
---|
2466 | 2470 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
---|
2467 | | -#ifdef CONFIG_PM |
---|
2468 | | - int retval = 0; |
---|
2469 | | -#endif |
---|
2470 | 2471 | |
---|
2471 | 2472 | netif_device_detach(netdev); |
---|
2472 | 2473 | |
---|
.. | .. |
---|
2476 | 2477 | igbvf_free_irq(adapter); |
---|
2477 | 2478 | } |
---|
2478 | 2479 | |
---|
2479 | | -#ifdef CONFIG_PM |
---|
2480 | | - retval = pci_save_state(pdev); |
---|
2481 | | - if (retval) |
---|
2482 | | - return retval; |
---|
2483 | | -#endif |
---|
2484 | | - |
---|
2485 | | - pci_disable_device(pdev); |
---|
2486 | | - |
---|
2487 | 2480 | return 0; |
---|
2488 | 2481 | } |
---|
2489 | 2482 | |
---|
2490 | | -#ifdef CONFIG_PM |
---|
2491 | | -static int igbvf_resume(struct pci_dev *pdev) |
---|
| 2483 | +static int __maybe_unused igbvf_resume(struct device *dev_d) |
---|
2492 | 2484 | { |
---|
| 2485 | + struct pci_dev *pdev = to_pci_dev(dev_d); |
---|
2493 | 2486 | struct net_device *netdev = pci_get_drvdata(pdev); |
---|
2494 | 2487 | struct igbvf_adapter *adapter = netdev_priv(netdev); |
---|
2495 | 2488 | u32 err; |
---|
2496 | | - |
---|
2497 | | - pci_restore_state(pdev); |
---|
2498 | | - err = pci_enable_device_mem(pdev); |
---|
2499 | | - if (err) { |
---|
2500 | | - dev_err(&pdev->dev, "Cannot enable PCI device from suspend\n"); |
---|
2501 | | - return err; |
---|
2502 | | - } |
---|
2503 | 2489 | |
---|
2504 | 2490 | pci_set_master(pdev); |
---|
2505 | 2491 | |
---|
.. | .. |
---|
2518 | 2504 | |
---|
2519 | 2505 | return 0; |
---|
2520 | 2506 | } |
---|
2521 | | -#endif |
---|
2522 | 2507 | |
---|
2523 | 2508 | static void igbvf_shutdown(struct pci_dev *pdev) |
---|
2524 | 2509 | { |
---|
2525 | | - igbvf_suspend(pdev, PMSG_SUSPEND); |
---|
| 2510 | + igbvf_suspend(&pdev->dev); |
---|
2526 | 2511 | } |
---|
2527 | 2512 | |
---|
2528 | 2513 | #ifdef CONFIG_NET_POLL_CONTROLLER |
---|
.. | .. |
---|
2964 | 2949 | }; |
---|
2965 | 2950 | MODULE_DEVICE_TABLE(pci, igbvf_pci_tbl); |
---|
2966 | 2951 | |
---|
| 2952 | +static SIMPLE_DEV_PM_OPS(igbvf_pm_ops, igbvf_suspend, igbvf_resume); |
---|
| 2953 | + |
---|
2967 | 2954 | /* PCI Device API Driver */ |
---|
2968 | 2955 | static struct pci_driver igbvf_driver = { |
---|
2969 | 2956 | .name = igbvf_driver_name, |
---|
2970 | 2957 | .id_table = igbvf_pci_tbl, |
---|
2971 | 2958 | .probe = igbvf_probe, |
---|
2972 | 2959 | .remove = igbvf_remove, |
---|
2973 | | -#ifdef CONFIG_PM |
---|
2974 | | - /* Power Management Hooks */ |
---|
2975 | | - .suspend = igbvf_suspend, |
---|
2976 | | - .resume = igbvf_resume, |
---|
2977 | | -#endif |
---|
| 2960 | + .driver.pm = &igbvf_pm_ops, |
---|
2978 | 2961 | .shutdown = igbvf_shutdown, |
---|
2979 | 2962 | .err_handler = &igbvf_err_handler |
---|
2980 | 2963 | }; |
---|
.. | .. |
---|
2989 | 2972 | { |
---|
2990 | 2973 | int ret; |
---|
2991 | 2974 | |
---|
2992 | | - pr_info("%s - version %s\n", igbvf_driver_string, igbvf_driver_version); |
---|
| 2975 | + pr_info("%s\n", igbvf_driver_string); |
---|
2993 | 2976 | pr_info("%s\n", igbvf_copyright); |
---|
2994 | 2977 | |
---|
2995 | 2978 | ret = pci_register_driver(&igbvf_driver); |
---|
.. | .. |
---|
3012 | 2995 | |
---|
3013 | 2996 | MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>"); |
---|
3014 | 2997 | MODULE_DESCRIPTION("Intel(R) Gigabit Virtual Function Network Driver"); |
---|
3015 | | -MODULE_LICENSE("GPL"); |
---|
3016 | | -MODULE_VERSION(DRV_VERSION); |
---|
| 2998 | +MODULE_LICENSE("GPL v2"); |
---|
3017 | 2999 | |
---|
3018 | 3000 | /* netdev.c */ |
---|