forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*******************************************************************************
23 Specialised functions for managing Ring mode
34
....@@ -7,17 +8,6 @@
78 descriptors in case of the DMA is configured to work in chained or
89 in ring mode.
910
10
- This program is free software; you can redistribute it and/or modify it
11
- under the terms and conditions of the GNU General Public License,
12
- version 2, as published by the Free Software Foundation.
13
-
14
- This program is distributed in the hope it will be useful, but WITHOUT
15
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17
- more details.
18
-
19
- The full GNU General Public License is included in this distribution in
20
- the file called "COPYING".
2111
2212 Author: Giuseppe Cavallaro <peppe.cavallaro@st.com>
2313 *******************************************************************************/
....@@ -59,9 +49,9 @@
5949
6050 desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
6151 stmmac_prepare_tx_desc(priv, desc, 1, bmax, csum,
62
- STMMAC_RING_MODE, 1, false, skb->len);
52
+ STMMAC_RING_MODE, 0, false, skb->len);
6353 tx_q->tx_skbuff[entry] = NULL;
64
- entry = STMMAC_GET_ENTRY(entry, DMA_TX_SIZE);
54
+ entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
6555
6656 if (priv->extend_desc)
6757 desc = (struct dma_desc *)(tx_q->dma_etx + entry);
....@@ -79,7 +69,8 @@
7969
8070 desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
8171 stmmac_prepare_tx_desc(priv, desc, 0, len, csum,
82
- STMMAC_RING_MODE, 1, true, skb->len);
72
+ STMMAC_RING_MODE, 1, !skb_is_nonlinear(skb),
73
+ skb->len);
8374 } else {
8475 des2 = dma_map_single(priv->device, skb->data,
8576 nopaged_len, DMA_TO_DEVICE);
....@@ -91,7 +82,8 @@
9182 tx_q->tx_skbuff_dma[entry].is_jumbo = true;
9283 desc->des3 = cpu_to_le32(des2 + BUF_SIZE_4KiB);
9384 stmmac_prepare_tx_desc(priv, desc, 1, nopaged_len, csum,
94
- STMMAC_RING_MODE, 1, true, skb->len);
85
+ STMMAC_RING_MODE, 0, !skb_is_nonlinear(skb),
86
+ skb->len);
9587 }
9688
9789 tx_q->cur_tx = entry;