forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
....@@ -1,20 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 1999 - 2010 Intel Corporation.
34 * Copyright (C) 2010 - 2012 LAPIS SEMICONDUCTOR CO., LTD.
45 *
56 * This code was derived from the Intel e1000e Linux driver.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; version 2 of the License.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
187 */
198
209 #include "pch_gbe.h"
....@@ -299,7 +288,7 @@
299288 /**
300289 * pch_gbe_wait_clr_bit - Wait to clear a bit
301290 * @reg: Pointer of register
302
- * @busy: Busy bit
291
+ * @bit: Busy bit
303292 */
304293 static void pch_gbe_wait_clr_bit(void *reg, u32 bit)
305294 {
....@@ -1038,7 +1027,7 @@
10381027
10391028 /**
10401029 * pch_gbe_watchdog - Watchdog process
1041
- * @data: Board private structure
1030
+ * @t: timer list containing a Board private structure
10421031 */
10431032 static void pch_gbe_watchdog(struct timer_list *t)
10441033 {
....@@ -1177,6 +1166,7 @@
11771166 buffer_info->dma = 0;
11781167 buffer_info->time_stamp = 0;
11791168 tx_ring->next_to_use = ring_num;
1169
+ dev_kfree_skb_any(skb);
11801170 return;
11811171 }
11821172 buffer_info->mapped = true;
....@@ -1430,8 +1420,8 @@
14301420
14311421 size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY;
14321422 rx_ring->rx_buff_pool =
1433
- dma_zalloc_coherent(&pdev->dev, size,
1434
- &rx_ring->rx_buff_pool_logic, GFP_KERNEL);
1423
+ dma_alloc_coherent(&pdev->dev, size,
1424
+ &rx_ring->rx_buff_pool_logic, GFP_KERNEL);
14351425 if (!rx_ring->rx_buff_pool)
14361426 return -ENOMEM;
14371427
....@@ -1745,8 +1735,8 @@
17451735
17461736 tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc);
17471737
1748
- tx_ring->desc = dma_zalloc_coherent(&pdev->dev, tx_ring->size,
1749
- &tx_ring->dma, GFP_KERNEL);
1738
+ tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
1739
+ &tx_ring->dma, GFP_KERNEL);
17501740 if (!tx_ring->desc) {
17511741 vfree(tx_ring->buffer_info);
17521742 return -ENOMEM;
....@@ -1788,8 +1778,8 @@
17881778 return -ENOMEM;
17891779
17901780 rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc);
1791
- rx_ring->desc = dma_zalloc_coherent(&pdev->dev, rx_ring->size,
1792
- &rx_ring->dma, GFP_KERNEL);
1781
+ rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
1782
+ &rx_ring->dma, GFP_KERNEL);
17931783 if (!rx_ring->desc) {
17941784 vfree(rx_ring->buffer_info);
17951785 return -ENOMEM;
....@@ -2068,7 +2058,7 @@
20682058 * - NETDEV_TX_OK: Normal end
20692059 * - NETDEV_TX_BUSY: Error end
20702060 */
2071
-static int pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2061
+static netdev_tx_t pch_gbe_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
20722062 {
20732063 struct pch_gbe_adapter *adapter = netdev_priv(netdev);
20742064 struct pch_gbe_tx_ring *tx_ring = adapter->tx_ring;
....@@ -2274,8 +2264,9 @@
22742264 /**
22752265 * pch_gbe_tx_timeout - Respond to a Tx Hang
22762266 * @netdev: Network interface device structure
2267
+ * @txqueue: index of hanging queue
22772268 */
2278
-static void pch_gbe_tx_timeout(struct net_device *netdev)
2269
+static void pch_gbe_tx_timeout(struct net_device *netdev, unsigned int txqueue)
22792270 {
22802271 struct pch_gbe_adapter *adapter = netdev_priv(netdev);
22812272
....@@ -2491,6 +2482,7 @@
24912482 unregister_netdev(netdev);
24922483
24932484 pch_gbe_phy_hw_reset(&adapter->hw);
2485
+ pci_dev_put(adapter->ptp_pdev);
24942486
24952487 free_netdev(netdev);
24962488 }
....@@ -2572,7 +2564,7 @@
25722564 /* setup the private structure */
25732565 ret = pch_gbe_sw_init(adapter);
25742566 if (ret)
2575
- goto err_free_netdev;
2567
+ goto err_put_dev;
25762568
25772569 /* Initialize PHY */
25782570 ret = pch_gbe_init_phy(adapter);
....@@ -2630,6 +2622,8 @@
26302622
26312623 err_free_adapter:
26322624 pch_gbe_phy_hw_reset(&adapter->hw);
2625
+err_put_dev:
2626
+ pci_dev_put(adapter->ptp_pdev);
26332627 err_free_netdev:
26342628 free_netdev(netdev);
26352629 return ret;