hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/net/ethernet/intel/igbvf/netdev.c
....@@ -24,9 +24,7 @@
2424
2525 #include "igbvf.h"
2626
27
-#define DRV_VERSION "2.4.0-k"
2827 char igbvf_driver_name[] = "igbvf";
29
-const char igbvf_driver_version[] = DRV_VERSION;
3028 static const char igbvf_driver_string[] =
3129 "Intel(R) Gigabit Virtual Function Network Driver";
3230 static const char igbvf_copyright[] =
....@@ -63,7 +61,7 @@
6361
6462 /**
6563 * igbvf_desc_unused - calculate if we have unused descriptors
66
- * @rx_ring: address of receive ring structure
64
+ * @ring: address of receive ring structure
6765 **/
6866 static int igbvf_desc_unused(struct igbvf_ring *ring)
6967 {
....@@ -76,6 +74,8 @@
7674 /**
7775 * igbvf_receive_skb - helper function to handle Rx indications
7876 * @adapter: board private structure
77
+ * @netdev: pointer to netdev struct
78
+ * @skb: skb to indicate to stack
7979 * @status: descriptor status field as written by hardware
8080 * @vlan: descriptor vlan field as written by hardware (no le/be conversion)
8181 * @skb: pointer to sk_buff to be indicated to stack
....@@ -83,14 +83,14 @@
8383 static void igbvf_receive_skb(struct igbvf_adapter *adapter,
8484 struct net_device *netdev,
8585 struct sk_buff *skb,
86
- u32 status, u16 vlan)
86
+ u32 status, __le16 vlan)
8787 {
8888 u16 vid;
8989
9090 if (status & E1000_RXD_STAT_VP) {
9191 if ((adapter->flags & IGBVF_FLAG_RX_LB_VLAN_BSWAP) &&
9292 (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;
9494 else
9595 vid = le16_to_cpu(vlan) & E1000_RXD_SPC_VLAN_MASK;
9696 if (test_bit(vid, adapter->active_vlans))
....@@ -235,6 +235,8 @@
235235 /**
236236 * igbvf_clean_rx_irq - Send received data up the network stack; legacy
237237 * @adapter: board private structure
238
+ * @work_done: output parameter used to indicate completed work
239
+ * @work_to_do: input parameter setting limit of work
238240 *
239241 * the return value indicates whether actual cleaning was done, there
240242 * is no guarantee that everything was cleaned
....@@ -408,6 +410,7 @@
408410 /**
409411 * igbvf_setup_tx_resources - allocate Tx resources (Descriptors)
410412 * @adapter: board private structure
413
+ * @tx_ring: ring being initialized
411414 *
412415 * Return 0 on success, negative on failure
413416 **/
....@@ -446,6 +449,7 @@
446449 /**
447450 * igbvf_setup_rx_resources - allocate Rx resources (Descriptors)
448451 * @adapter: board private structure
452
+ * @rx_ring: ring being initialized
449453 *
450454 * Returns 0 on success, negative on failure
451455 **/
....@@ -542,7 +546,7 @@
542546
543547 /**
544548 * igbvf_clean_rx_ring - Free Rx Buffers per Queue
545
- * @adapter: board private structure
549
+ * @rx_ring: ring structure pointer to free buffers from
546550 **/
547551 static void igbvf_clean_rx_ring(struct igbvf_ring *rx_ring)
548552 {
....@@ -762,7 +766,7 @@
762766
763767 /**
764768 * igbvf_clean_tx_irq - Reclaim resources after transmit completes
765
- * @adapter: board private structure
769
+ * @tx_ring: ring structure to clean descriptors from
766770 *
767771 * returns true if ring is completely cleaned
768772 **/
....@@ -1186,10 +1190,13 @@
11861190
11871191 igbvf_clean_rx_irq(adapter, &work_done, budget);
11881192
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;
11921195
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))) {
11931200 if (adapter->requested_itr & 3)
11941201 igbvf_set_itr(adapter);
11951202
....@@ -1890,7 +1897,7 @@
18901897
18911898 /**
18921899 * igbvf_watchdog - Timer Call-back
1893
- * @data: pointer to adapter cast into an unsigned long
1900
+ * @t: timer list pointer containing private struct
18941901 **/
18951902 static void igbvf_watchdog(struct timer_list *t)
18961903 {
....@@ -2090,7 +2097,7 @@
20902097 switch (skb->csum_offset) {
20912098 case offsetof(struct tcphdr, check):
20922099 type_tucmd = E1000_ADVTXD_TUCMD_L4T_TCP;
2093
- /* fall through */
2100
+ fallthrough;
20942101 case offsetof(struct udphdr, check):
20952102 break;
20962103 case offsetof(struct sctphdr, checksum):
....@@ -2102,7 +2109,7 @@
21022109 type_tucmd = E1000_ADVTXD_TUCMD_L4T_SCTP;
21032110 break;
21042111 }
2105
- /* fall through */
2112
+ fallthrough;
21062113 default:
21072114 skb_checksum_help(skb);
21082115 goto csum_failed;
....@@ -2171,7 +2178,7 @@
21712178 goto dma_error;
21722179
21732180 for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
2174
- const struct skb_frag_struct *frag;
2181
+ const skb_frag_t *frag;
21752182
21762183 count++;
21772184 i++;
....@@ -2276,10 +2283,6 @@
22762283 tx_ring->buffer_info[first].next_to_watch = tx_desc;
22772284 tx_ring->next_to_use = i;
22782285 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();
22832286 }
22842287
22852288 static netdev_tx_t igbvf_xmit_frame_ring_adv(struct sk_buff *skb,
....@@ -2375,8 +2378,9 @@
23752378 /**
23762379 * igbvf_tx_timeout - Respond to a Tx Hang
23772380 * @netdev: network interface device structure
2381
+ * @txqueue: queue timing out (unused)
23782382 **/
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)
23802384 {
23812385 struct igbvf_adapter *adapter = netdev_priv(netdev);
23822386
....@@ -2438,8 +2442,8 @@
24382442 adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN +
24392443 ETH_FCS_LEN;
24402444
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);
24432447 netdev->mtu = new_mtu;
24442448
24452449 if (netif_running(netdev))
....@@ -2460,13 +2464,10 @@
24602464 }
24612465 }
24622466
2463
-static int igbvf_suspend(struct pci_dev *pdev, pm_message_t state)
2467
+static int igbvf_suspend(struct device *dev_d)
24642468 {
2465
- struct net_device *netdev = pci_get_drvdata(pdev);
2469
+ struct net_device *netdev = dev_get_drvdata(dev_d);
24662470 struct igbvf_adapter *adapter = netdev_priv(netdev);
2467
-#ifdef CONFIG_PM
2468
- int retval = 0;
2469
-#endif
24702471
24712472 netif_device_detach(netdev);
24722473
....@@ -2476,30 +2477,15 @@
24762477 igbvf_free_irq(adapter);
24772478 }
24782479
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
-
24872480 return 0;
24882481 }
24892482
2490
-#ifdef CONFIG_PM
2491
-static int igbvf_resume(struct pci_dev *pdev)
2483
+static int __maybe_unused igbvf_resume(struct device *dev_d)
24922484 {
2485
+ struct pci_dev *pdev = to_pci_dev(dev_d);
24932486 struct net_device *netdev = pci_get_drvdata(pdev);
24942487 struct igbvf_adapter *adapter = netdev_priv(netdev);
24952488 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
- }
25032489
25042490 pci_set_master(pdev);
25052491
....@@ -2518,11 +2504,10 @@
25182504
25192505 return 0;
25202506 }
2521
-#endif
25222507
25232508 static void igbvf_shutdown(struct pci_dev *pdev)
25242509 {
2525
- igbvf_suspend(pdev, PMSG_SUSPEND);
2510
+ igbvf_suspend(&pdev->dev);
25262511 }
25272512
25282513 #ifdef CONFIG_NET_POLL_CONTROLLER
....@@ -2964,17 +2949,15 @@
29642949 };
29652950 MODULE_DEVICE_TABLE(pci, igbvf_pci_tbl);
29662951
2952
+static SIMPLE_DEV_PM_OPS(igbvf_pm_ops, igbvf_suspend, igbvf_resume);
2953
+
29672954 /* PCI Device API Driver */
29682955 static struct pci_driver igbvf_driver = {
29692956 .name = igbvf_driver_name,
29702957 .id_table = igbvf_pci_tbl,
29712958 .probe = igbvf_probe,
29722959 .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,
29782961 .shutdown = igbvf_shutdown,
29792962 .err_handler = &igbvf_err_handler
29802963 };
....@@ -2989,7 +2972,7 @@
29892972 {
29902973 int ret;
29912974
2992
- pr_info("%s - version %s\n", igbvf_driver_string, igbvf_driver_version);
2975
+ pr_info("%s\n", igbvf_driver_string);
29932976 pr_info("%s\n", igbvf_copyright);
29942977
29952978 ret = pci_register_driver(&igbvf_driver);
....@@ -3012,7 +2995,6 @@
30122995
30132996 MODULE_AUTHOR("Intel Corporation, <e1000-devel@lists.sourceforge.net>");
30142997 MODULE_DESCRIPTION("Intel(R) Gigabit Virtual Function Network Driver");
3015
-MODULE_LICENSE("GPL");
3016
-MODULE_VERSION(DRV_VERSION);
2998
+MODULE_LICENSE("GPL v2");
30172999
30183000 /* netdev.c */