aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0289-staging-fsl_ppfe-eth-fix-read-write-ack-idx-issue.patch
blob: 4ed5b04f509059357c085b4d31768b7f5956aedc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From f44630f1e12462921245feb91fe94d225ba90f9c Mon Sep 17 00:00:00 2001
From: Calvin Johnson <calvin.johnson@nxp.com>
Date: Wed, 18 Oct 2017 18:34:41 +0530
Subject: [PATCH] staging: fsl_ppfe/eth: fix read/write/ack idx issue

While fixing checkpatch errors some of the index increments
were commented out. They are enabled.

Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
---
 drivers/staging/fsl_ppfe/pfe_hif.c     | 8 ++++----
 drivers/staging/fsl_ppfe/pfe_hif_lib.c | 9 +++------
 2 files changed, 7 insertions(+), 10 deletions(-)

--- a/drivers/staging/fsl_ppfe/pfe_hif.c
+++ b/drivers/staging/fsl_ppfe/pfe_hif.c
@@ -511,9 +511,9 @@ static void *client_put_rxpacket(struct
 			 */
 			smp_wmb();
 			writel(CL_DESC_BUF_LEN(len) | flags, &desc->ctrl);
-			/* queue->write_idx = (queue->write_idx + 1)
-			 *		       & (queue->size - 1);
-			 */
+			queue->write_idx = (queue->write_idx + 1)
+					    & (queue->size - 1);
+
 			free_pkt += pfe_pkt_headroom;
 		}
 	}
@@ -703,7 +703,7 @@ static int client_ack_txpacket(struct pf
 
 	if (readl(&desc->ctrl) & CL_DESC_OWN) {
 		writel((readl(&desc->ctrl) & ~CL_DESC_OWN), &desc->ctrl);
-		/* queue->ack_idx = (queue->ack_idx + 1) & (queue->size - 1); */
+		queue->ack_idx = (queue->ack_idx + 1) & (queue->size - 1);
 
 		return 0;
 
--- a/drivers/staging/fsl_ppfe/pfe_hif_lib.c
+++ b/drivers/staging/fsl_ppfe/pfe_hif_lib.c
@@ -211,9 +211,6 @@ err:
 	return 1;
 }
 
-#define inc_cl_idx(idxname)					\
-	({ typeof(idxname) idxname_ = (idxname);		\
-	((idxname_) = (idxname_ + 1) & (queue->size - 1)); })
 
 static void hif_lib_client_cleanup_tx_queue(struct hif_client_tx_queue *queue)
 {
@@ -465,7 +462,7 @@ void *hif_lib_receive_pkt(struct hif_cli
 		smp_wmb();
 
 		desc->ctrl = CL_DESC_BUF_LEN(pfe_pkt_size) | CL_DESC_OWN;
-		inc_cl_idx(queue->read_idx);
+		queue->read_idx = (queue->read_idx + 1) & (queue->size - 1);
 	}
 
 	/*spin_unlock_irqrestore(&client->rx_lock, flags); */
@@ -507,7 +504,7 @@ void __hif_lib_xmit_pkt(struct hif_clien
 
 	__hif_xmit_pkt(&pfe->hif, client->id, qno, data, len, flags);
 
-	inc_cl_idx(queue->write_idx);
+	queue->write_idx = (queue->write_idx + 1) & (queue->size - 1);
 	queue->tx_pending++;
 	queue->jiffies_last_packet = jiffies;
 }
@@ -544,7 +541,7 @@ void *hif_lib_tx_get_next_complete(struc
 	if (desc->ctrl & CL_DESC_OWN)
 		return NULL;
 
-	inc_cl_idx(queue->read_idx);
+	queue->read_idx = (queue->read_idx + 1) & (queue->size - 1);
 	queue->tx_pending--;
 
 	*flags = CL_DESC_GET_FLAGS(desc->ctrl);