[qca-edma] Add atomic_inc for prec-stats

Per precedence stats were not synchronized.
Add fix to synchronize the stats with atomic_inc

Change-Id: I710f4aa3077c8fc086876b5aa320e698e2faed5b
Signed-off-by: Rakesh Nair <ranair@codeaurora.org>
diff --git a/edma.c b/edma.c
index f8a4352..bd69dd8 100644
--- a/edma.c
+++ b/edma.c
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/if_vlan.h>
 #include <linux/kernel.h>
+#include <asm/atomic.h>
 #include "ess_edma.h"
 #include "edma.h"
 
@@ -805,7 +806,7 @@
 			 * We increment per-precedence counters for the rx packets
 			 */
 			if (edma_per_prec_stats_enable) {
-				edma_cinfo->edma_ethstats.rx_prec[priority]++;
+				atomic_inc(&edma_cinfo->edma_ethstats.rx_prec[priority]);
 				edma_cinfo->edma_ethstats.rx_ac[edma_dscp2ac_tbl[priority]]++;
 
 				if (edma_iad_stats_enable) {
@@ -1490,7 +1491,7 @@
 			/* Increment per-precedence counters for tx packets
 			 * and set the precedence in the TPD.
 			 */
-			edma_cinfo->edma_ethstats.tx_prec[precedence]++;
+			atomic_inc(&edma_cinfo->edma_ethstats.tx_prec[precedence]);
 			edma_cinfo->edma_ethstats.tx_ac[edma_dscp2ac_tbl[precedence]]++;
 			if (tpd)
 				tpd->word3 |= precedence << EDMA_TPD_PRIO_SHIFT;
diff --git a/edma.h b/edma.h
index ac1752b..73b7b5f 100644
--- a/edma.h
+++ b/edma.h
@@ -244,8 +244,8 @@
 	u64 rx_q7_byte;
 	u64 tx_desc_error;
 	u64 rx_alloc_fail_ctr;
-	u64 tx_prec[EDMA_PRECEDENCE_MAX];
-	u64 rx_prec[EDMA_PRECEDENCE_MAX];
+	atomic64_t tx_prec[EDMA_PRECEDENCE_MAX];
+	atomic64_t rx_prec[EDMA_PRECEDENCE_MAX];
 	u64 rx_ac[EDMA_AC_MAX];
 	u64 tx_ac[EDMA_AC_MAX];
 	u64 rx_flow_iad[EDMA_MAX_IAD_FLOW_STATS_SUPPORTED];
diff --git a/edma_ethtool.c b/edma_ethtool.c
index f234afd..bbc0679 100644
--- a/edma_ethtool.c
+++ b/edma_ethtool.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 - 2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015 - 2018, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -81,14 +81,14 @@
 	{"rx_q7_byte", EDMA_STAT(rx_q7_byte)},
 	{"tx_desc_error", EDMA_STAT(tx_desc_error)},
 	{"rx_alloc_fail_ctr", EDMA_STAT(rx_alloc_fail_ctr)},
-	{"rx_prec_0", EDMA_STAT(rx_prec[0])},
-	{"rx_prec_1", EDMA_STAT(rx_prec[1])},
-	{"rx_prec_2", EDMA_STAT(rx_prec[2])},
-	{"rx_prec_3", EDMA_STAT(rx_prec[3])},
-	{"rx_prec_4", EDMA_STAT(rx_prec[4])},
-	{"rx_prec_5", EDMA_STAT(rx_prec[5])},
-	{"rx_prec_6", EDMA_STAT(rx_prec[6])},
-	{"rx_prec_7", EDMA_STAT(rx_prec[7])},
+	{"rx_prec_0", EDMA_STAT(rx_prec[0].counter)},
+	{"rx_prec_1", EDMA_STAT(rx_prec[1].counter)},
+	{"rx_prec_2", EDMA_STAT(rx_prec[2].counter)},
+	{"rx_prec_3", EDMA_STAT(rx_prec[3].counter)},
+	{"rx_prec_4", EDMA_STAT(rx_prec[4].counter)},
+	{"rx_prec_5", EDMA_STAT(rx_prec[5].counter)},
+	{"rx_prec_6", EDMA_STAT(rx_prec[6].counter)},
+	{"rx_prec_7", EDMA_STAT(rx_prec[7].counter)},
 	{"rx_ac_bk", EDMA_STAT(rx_ac[EDMA_AC_BK])},
 	{"rx_ac_be", EDMA_STAT(rx_ac[EDMA_AC_BE])},
 	{"rx_ac_vi", EDMA_STAT(rx_ac[EDMA_AC_VI])},
@@ -109,14 +109,14 @@
 	{"rx_flow7_max_ifd_usec", EDMA_STAT(rx_flow_iad[6])},
 	{"rx_flow8_delta_start_ts", EDMA_STAT(rx_flow_delta_start_ts[7])},
 	{"rx_flow8_max_ifd_usec", EDMA_STAT(rx_flow_iad[7])},
-	{"tx_prec_0", EDMA_STAT(tx_prec[0])},
-	{"tx_prec_1", EDMA_STAT(tx_prec[1])},
-	{"tx_prec_2", EDMA_STAT(tx_prec[2])},
-	{"tx_prec_3", EDMA_STAT(tx_prec[3])},
-	{"tx_prec_4", EDMA_STAT(tx_prec[4])},
-	{"tx_prec_5", EDMA_STAT(tx_prec[5])},
-	{"tx_prec_6", EDMA_STAT(tx_prec[6])},
-	{"tx_prec_7", EDMA_STAT(tx_prec[7])},
+	{"tx_prec_0", EDMA_STAT(tx_prec[0].counter)},
+	{"tx_prec_1", EDMA_STAT(tx_prec[1].counter)},
+	{"tx_prec_2", EDMA_STAT(tx_prec[2].counter)},
+	{"tx_prec_3", EDMA_STAT(tx_prec[3].counter)},
+	{"tx_prec_4", EDMA_STAT(tx_prec[4].counter)},
+	{"tx_prec_5", EDMA_STAT(tx_prec[5].counter)},
+	{"tx_prec_6", EDMA_STAT(tx_prec[6].counter)},
+	{"tx_prec_7", EDMA_STAT(tx_prec[7].counter)},
 	{"tx_ac_bk", EDMA_STAT(tx_ac[EDMA_AC_BK])},
 	{"tx_ac_be", EDMA_STAT(tx_ac[EDMA_AC_BE])},
 	{"tx_ac_vi", EDMA_STAT(tx_ac[EDMA_AC_VI])},