From f44630f1e12462921245feb91fe94d225ba90f9c Mon Sep 17 00:00:00 2001 From: Calvin Johnson 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 --- 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);