forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/net/ethernet/qualcomm/emac/emac-mac.c
....@@ -1,13 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
2
- *
3
- * This program is free software; you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License version 2 and
5
- * only version 2 as published by the Free Software Foundation.
6
- *
7
- * This program is distributed in the hope that it will be useful,
8
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
- * GNU General Public License for more details.
113 */
124
135 /* Qualcomm Technologies, Inc. EMAC Ethernet Controller MAC layer support
....@@ -776,7 +768,7 @@
776768 8 + 2 * 8; /* 8 byte per one Tx and two Rx rings */
777769
778770 ring_header->used = 0;
779
- ring_header->v_addr = dma_zalloc_coherent(dev, ring_header->size,
771
+ ring_header->v_addr = dma_alloc_coherent(dev, ring_header->size,
780772 &ring_header->dma_addr,
781773 GFP_KERNEL);
782774 if (!ring_header->v_addr)
....@@ -1204,7 +1196,7 @@
12041196 if (tpbuf->skb) {
12051197 pkts_compl++;
12061198 bytes_compl += tpbuf->skb->len;
1207
- dev_kfree_skb_irq(tpbuf->skb);
1199
+ dev_consume_skb_irq(tpbuf->skb);
12081200 tpbuf->skb = NULL;
12091201 }
12101202
....@@ -1296,11 +1288,8 @@
12961288 memset(tpd, 0, sizeof(*tpd));
12971289 memset(&extra_tpd, 0, sizeof(extra_tpd));
12981290
1299
- ipv6_hdr(skb)->payload_len = 0;
1300
- tcp_hdr(skb)->check =
1301
- ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
1302
- &ipv6_hdr(skb)->daddr,
1303
- 0, IPPROTO_TCP, 0);
1291
+ tcp_v6_gso_csum_prep(skb);
1292
+
13041293 TPD_PKT_LEN_SET(&extra_tpd, skb->len);
13051294 TPD_LSO_SET(&extra_tpd, 1);
13061295 TPD_LSOV_SET(&extra_tpd, 1);
....@@ -1393,15 +1382,13 @@
13931382 }
13941383
13951384 for (i = 0; i < nr_frags; i++) {
1396
- struct skb_frag_struct *frag;
1397
-
1398
- frag = &skb_shinfo(skb)->frags[i];
1385
+ skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
13991386
14001387 tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx);
1401
- tpbuf->length = frag->size;
1402
- tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
1403
- frag->page.p, frag->page_offset,
1404
- tpbuf->length, DMA_TO_DEVICE);
1388
+ tpbuf->length = skb_frag_size(frag);
1389
+ tpbuf->dma_addr = skb_frag_dma_map(adpt->netdev->dev.parent,
1390
+ frag, 0, tpbuf->length,
1391
+ DMA_TO_DEVICE);
14051392 ret = dma_mapping_error(adpt->netdev->dev.parent,
14061393 tpbuf->dma_addr);
14071394 if (ret)
....@@ -1444,8 +1431,9 @@
14441431 }
14451432
14461433 /* Transmit the packet using specified transmit queue */
1447
-int emac_mac_tx_buf_send(struct emac_adapter *adpt, struct emac_tx_queue *tx_q,
1448
- struct sk_buff *skb)
1434
+netdev_tx_t emac_mac_tx_buf_send(struct emac_adapter *adpt,
1435
+ struct emac_tx_queue *tx_q,
1436
+ struct sk_buff *skb)
14491437 {
14501438 struct emac_tpd tpd;
14511439 u32 prod_idx;