4ed5b04f509059357c085b4d31768b7f5956aedc
[openwrt/staging/ldir.git] /
1 From f44630f1e12462921245feb91fe94d225ba90f9c Mon Sep 17 00:00:00 2001
2 From: Calvin Johnson <calvin.johnson@nxp.com>
3 Date: Wed, 18 Oct 2017 18:34:41 +0530
4 Subject: [PATCH] staging: fsl_ppfe/eth: fix read/write/ack idx issue
5
6 While fixing checkpatch errors some of the index increments
7 were commented out. They are enabled.
8
9 Signed-off-by: Calvin Johnson <calvin.johnson@nxp.com>
10 ---
11 drivers/staging/fsl_ppfe/pfe_hif.c | 8 ++++----
12 drivers/staging/fsl_ppfe/pfe_hif_lib.c | 9 +++------
13 2 files changed, 7 insertions(+), 10 deletions(-)
14
15 --- a/drivers/staging/fsl_ppfe/pfe_hif.c
16 +++ b/drivers/staging/fsl_ppfe/pfe_hif.c
17 @@ -511,9 +511,9 @@ static void *client_put_rxpacket(struct
18 */
19 smp_wmb();
20 writel(CL_DESC_BUF_LEN(len) | flags, &desc->ctrl);
21 - /* queue->write_idx = (queue->write_idx + 1)
22 - * & (queue->size - 1);
23 - */
24 + queue->write_idx = (queue->write_idx + 1)
25 + & (queue->size - 1);
26 +
27 free_pkt += pfe_pkt_headroom;
28 }
29 }
30 @@ -703,7 +703,7 @@ static int client_ack_txpacket(struct pf
31
32 if (readl(&desc->ctrl) & CL_DESC_OWN) {
33 writel((readl(&desc->ctrl) & ~CL_DESC_OWN), &desc->ctrl);
34 - /* queue->ack_idx = (queue->ack_idx + 1) & (queue->size - 1); */
35 + queue->ack_idx = (queue->ack_idx + 1) & (queue->size - 1);
36
37 return 0;
38
39 --- a/drivers/staging/fsl_ppfe/pfe_hif_lib.c
40 +++ b/drivers/staging/fsl_ppfe/pfe_hif_lib.c
41 @@ -211,9 +211,6 @@ err:
42 return 1;
43 }
44
45 -#define inc_cl_idx(idxname) \
46 - ({ typeof(idxname) idxname_ = (idxname); \
47 - ((idxname_) = (idxname_ + 1) & (queue->size - 1)); })
48
49 static void hif_lib_client_cleanup_tx_queue(struct hif_client_tx_queue *queue)
50 {
51 @@ -465,7 +462,7 @@ void *hif_lib_receive_pkt(struct hif_cli
52 smp_wmb();
53
54 desc->ctrl = CL_DESC_BUF_LEN(pfe_pkt_size) | CL_DESC_OWN;
55 - inc_cl_idx(queue->read_idx);
56 + queue->read_idx = (queue->read_idx + 1) & (queue->size - 1);
57 }
58
59 /*spin_unlock_irqrestore(&client->rx_lock, flags); */
60 @@ -507,7 +504,7 @@ void __hif_lib_xmit_pkt(struct hif_clien
61
62 __hif_xmit_pkt(&pfe->hif, client->id, qno, data, len, flags);
63
64 - inc_cl_idx(queue->write_idx);
65 + queue->write_idx = (queue->write_idx + 1) & (queue->size - 1);
66 queue->tx_pending++;
67 queue->jiffies_last_packet = jiffies;
68 }
69 @@ -544,7 +541,7 @@ void *hif_lib_tx_get_next_complete(struc
70 if (desc->ctrl & CL_DESC_OWN)
71 return NULL;
72
73 - inc_cl_idx(queue->read_idx);
74 + queue->read_idx = (queue->read_idx + 1) & (queue->size - 1);
75 queue->tx_pending--;
76
77 *flags = CL_DESC_GET_FLAGS(desc->ctrl);