qcacld-3.0: Add QDF atomic API's

Replace CDF atomic API's with QDF atomic API's.

Change-Id: I18b4ab3487357d150bdfb96f9a078e1b5abb3156
CRs-Fixed: 981188
diff --git a/core/dp/txrx/ol_rx.c b/core/dp/txrx/ol_rx.c
index 19db139..310d13d 100644
--- a/core/dp/txrx/ol_rx.c
+++ b/core/dp/txrx/ol_rx.c
@@ -1201,7 +1201,7 @@
 	peer->security[txrx_sec_ucast].sec_type =
 		peer->security[txrx_sec_mcast].sec_type = htt_sec_type_none;
 	peer->keyinstalled = 0;
-	cdf_atomic_init(&peer->fw_pn_check);
+	qdf_atomic_init(&peer->fw_pn_check);
 }
 
 void
diff --git a/core/dp/txrx/ol_rx_pn.c b/core/dp/txrx/ol_rx_pn.c
index f61ccd1..a37125a 100644
--- a/core/dp/txrx/ol_rx_pn.c
+++ b/core/dp/txrx/ol_rx_pn.c
@@ -96,7 +96,7 @@
 	int last_pn_valid;
 
 	/* Make sure host pn check is not redundant */
-	if ((cdf_atomic_read(&peer->fw_pn_check)) ||
+	if ((qdf_atomic_read(&peer->fw_pn_check)) ||
 		(vdev->opmode == wlan_op_mode_ibss)) {
 		return msdu_list;
 	}
diff --git a/core/dp/txrx/ol_rx_reorder.c b/core/dp/txrx/ol_rx_reorder.c
index 79e42e7..e6f3c16 100644
--- a/core/dp/txrx/ol_rx_reorder.c
+++ b/core/dp/txrx/ol_rx_reorder.c
@@ -617,7 +617,7 @@
 	else
 		return;
 
-	cdf_atomic_set(&peer->fw_pn_check, 1);
+	qdf_atomic_set(&peer->fw_pn_check, 1);
 	/*TODO: Fragmentation case */
 	win_sz_mask = peer->tids_rx_reorder[tid].win_sz_mask;
 	seq_num_start &= win_sz_mask;
diff --git a/core/dp/txrx/ol_tx.c b/core/dp/txrx/ol_tx.c
index e0ff756..3ab7827 100644
--- a/core/dp/txrx/ol_tx.c
+++ b/core/dp/txrx/ol_tx.c
@@ -27,7 +27,7 @@
 
 /* OS abstraction libraries */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <cdf_util.h>           /* cdf_unlikely */
 
 /* APIs for other modules */
@@ -1106,7 +1106,7 @@
 #define OL_TX_ENCAP_WRAPPER(pdev, vdev, tx_desc, msdu, tx_msdu_info) \
 	do { \
 		if (OL_TX_ENCAP(vdev, tx_desc, msdu, &tx_msdu_info) != A_OK) { \
-			cdf_atomic_inc(&pdev->tx_queue.rsrc_cnt); \
+			qdf_atomic_inc(&pdev->tx_queue.rsrc_cnt); \
 			ol_tx_desc_frame_free_nonstd(pdev, tx_desc, 1);	\
 			if (tx_msdu_info.peer) { \
 				/* remove the peer reference added above */ \
diff --git a/core/dp/txrx/ol_tx_desc.c b/core/dp/txrx/ol_tx_desc.c
index 4a70fdb..a6aba47 100644
--- a/core/dp/txrx/ol_tx_desc.c
+++ b/core/dp/txrx/ol_tx_desc.c
@@ -443,7 +443,7 @@
 	TAILQ_FOREACH_SAFE(tx_desc, tx_descs, tx_desc_list_elem, tmp) {
 		cdf_nbuf_t msdu = tx_desc->netbuf;
 
-		cdf_atomic_init(&tx_desc->ref_cnt);   /* clear the ref cnt */
+		qdf_atomic_init(&tx_desc->ref_cnt);   /* clear the ref cnt */
 #ifdef QCA_SUPPORT_SW_TXRX_ENCAP
 		/* restore original hdr offset */
 		OL_TX_RESTORE_HDR(tx_desc, msdu);
@@ -466,7 +466,7 @@
 	ol_txrx_mgmt_tx_cb ota_ack_cb;
 	char *trace_str;
 
-	cdf_atomic_init(&tx_desc->ref_cnt);     /* clear the ref cnt */
+	qdf_atomic_init(&tx_desc->ref_cnt);     /* clear the ref cnt */
 #ifdef QCA_SUPPORT_SW_TXRX_ENCAP
 	/* restore original hdr offset */
 	OL_TX_RESTORE_HDR(tx_desc, (tx_desc->netbuf));
diff --git a/core/dp/txrx/ol_tx_queue.c b/core/dp/txrx/ol_tx_queue.c
index a894b1c..9ff8fcd 100644
--- a/core/dp/txrx/ol_tx_queue.c
+++ b/core/dp/txrx/ol_tx_queue.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -26,7 +26,7 @@
  */
 
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <ol_cfg.h>             /* ol_cfg_addba_retry */
 #include <htt.h>                /* HTT_TX_EXT_TID_MGMT */
 #include <ol_htt_tx_api.h>      /* htt_tx_desc_tid */
diff --git a/core/dp/txrx/ol_tx_send.c b/core/dp/txrx/ol_tx_send.c
index e729f02..6ab22ac 100644
--- a/core/dp/txrx/ol_tx_send.c
+++ b/core/dp/txrx/ol_tx_send.c
@@ -25,7 +25,7 @@
  * to the Linux Foundation.
  */
 
-#include <cdf_atomic.h>         /* cdf_atomic_inc, etc. */
+#include <qdf_atomic.h>         /* qdf_atomic_inc, etc. */
 #include <cdf_lock.h>           /* cdf_os_spinlock */
 #include <qdf_time.h>           /* qdf_system_ticks, etc. */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t */
@@ -60,7 +60,7 @@
 
 #define OL_TX_CREDIT_RECLAIM(pdev)					\
 	do {								\
-		if (cdf_atomic_read(&pdev->target_tx_credit)  <		\
+		if (qdf_atomic_read(&pdev->target_tx_credit)  <		\
 		    ol_cfg_tx_credit_lwm(pdev->ctrl_pdev)) {		\
 			ol_osif_ath_tasklet(pdev->osdev);		\
 		}							\
@@ -83,16 +83,16 @@
  * messages.
  */
 #define OL_TX_TARGET_CREDIT_ADJUST(factor, pdev, msdu) \
-	cdf_atomic_add(	\
+	qdf_atomic_add(	\
 		factor * htt_tx_msdu_credit(msdu), &pdev->target_tx_credit)
 #define OL_TX_TARGET_CREDIT_DECR(pdev, msdu) \
 	OL_TX_TARGET_CREDIT_ADJUST(-1, pdev, msdu)
 #define OL_TX_TARGET_CREDIT_INCR(pdev, msdu) \
 	OL_TX_TARGET_CREDIT_ADJUST(1, pdev, msdu)
 #define OL_TX_TARGET_CREDIT_DECR_INT(pdev, delta) \
-	cdf_atomic_add(-1 * delta, &pdev->target_tx_credit)
+	qdf_atomic_add(-1 * delta, &pdev->target_tx_credit)
 #define OL_TX_TARGET_CREDIT_INCR_INT(pdev, delta) \
-	cdf_atomic_add(delta, &pdev->target_tx_credit)
+	qdf_atomic_add(delta, &pdev->target_tx_credit)
 #else
 /*
  * LL does not need to keep track of target credit.
@@ -112,12 +112,12 @@
 	do {								\
 		struct ol_txrx_vdev_t *vdev;				\
 		TAILQ_FOREACH(vdev, &pdev->vdev_list, vdev_list_elem) {	\
-			if (cdf_atomic_read(&vdev->os_q_paused) &&	\
+			if (qdf_atomic_read(&vdev->os_q_paused) &&	\
 			    (vdev->tx_fl_hwm != 0)) {			\
 				cdf_spin_lock(&pdev->tx_mutex);		\
 				if (pdev->tx_desc.num_free >		\
 				    vdev->tx_fl_hwm) {			\
-					cdf_atomic_set(&vdev->os_q_paused, 0); \
+					qdf_atomic_set(&vdev->os_q_paused, 0); \
 					cdf_spin_unlock(&pdev->tx_mutex); \
 					ol_txrx_flow_control_cb(vdev, true);\
 				}					\
@@ -139,8 +139,8 @@
 
 	TX_CREDIT_DEBUG_PRINT("TX %d bytes\n", cdf_nbuf_len(msdu));
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Decrease credit %d - 1 = %d, len:%d.\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
-			      cdf_atomic_read(&pdev->target_tx_credit) - 1,
+			      qdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit) - 1,
 			      cdf_nbuf_len(msdu));
 
 	msdu_credit_consumed = htt_tx_msdu_credit(msdu);
@@ -312,24 +312,24 @@
 
 	if ((tx_desc->pkt_type != ol_tx_frm_no_free) &&
 	    (tx_desc->pkt_type < OL_TXRX_MGMT_TYPE_BASE)) {
-		cdf_atomic_add(1, &pdev->tx_queue.rsrc_cnt);
+		qdf_atomic_add(1, &pdev->tx_queue.rsrc_cnt);
 		ol_tx_desc_frame_free_nonstd(pdev, tx_desc, status != A_OK);
 	}
 }
 
 void ol_tx_target_credit_init(struct ol_txrx_pdev_t *pdev, int credit_delta)
 {
-	cdf_atomic_add(credit_delta, &pdev->orig_target_tx_credit);
+	qdf_atomic_add(credit_delta, &pdev->orig_target_tx_credit);
 }
 
 void ol_tx_target_credit_update(struct ol_txrx_pdev_t *pdev, int credit_delta)
 {
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase credit %d + %d = %d\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit),
 			      credit_delta,
-			      cdf_atomic_read(&pdev->target_tx_credit) +
+			      qdf_atomic_read(&pdev->target_tx_credit) +
 			      credit_delta);
-	cdf_atomic_add(credit_delta, &pdev->target_tx_credit);
+	qdf_atomic_add(credit_delta, &pdev->target_tx_credit);
 }
 
 #ifdef QCA_COMPUTE_TX_DELAY
@@ -360,7 +360,7 @@
 #define ol_tx_msdu_complete_single(_pdev, _tx_desc, _netbuf,\
 				   _lcl_freelist, _tx_desc_last)	\
 	do {								\
-		cdf_atomic_init(&(_tx_desc)->ref_cnt);			\
+		qdf_atomic_init(&(_tx_desc)->ref_cnt);			\
 		/* restore orginal hdr offset */			\
 		OL_TX_RESTORE_HDR((_tx_desc), (_netbuf));		\
 		cdf_nbuf_unmap((_pdev)->osdev, (_netbuf), CDF_DMA_TO_DEVICE); \
@@ -453,7 +453,7 @@
 		 * been given to the target to transmit, for which the
 		 * target has never provided a response.
 		 */
-		if (cdf_atomic_read(&tx_desc->ref_cnt)) {
+		if (qdf_atomic_read(&tx_desc->ref_cnt)) {
 			TXRX_PRINT(TXRX_PRINT_LEVEL_WARN,
 				   "Warning: freeing tx frame "
 				   "(no tx completion from the target)\n");
@@ -577,11 +577,11 @@
 	}
 
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase credit %d + %d = %d\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
-			      1, cdf_atomic_read(&pdev->target_tx_credit) + 1);
+			      qdf_atomic_read(&pdev->target_tx_credit),
+			      1, qdf_atomic_read(&pdev->target_tx_credit) + 1);
 
 
-	cdf_atomic_add(1, &pdev->target_tx_credit);
+	qdf_atomic_add(1, &pdev->target_tx_credit);
 }
 
 /* WARNING: ol_tx_inspect_handler()'s bahavior is similar to that of
@@ -620,7 +620,7 @@
 
 #ifndef ATH_11AC_TXCOMPACT
 		/* save this multicast packet to local free list */
-		if (cdf_atomic_dec_and_test(&tx_desc->ref_cnt))
+		if (qdf_atomic_dec_and_test(&tx_desc->ref_cnt))
 #endif
 		{
 			/* for this function only, force htt status to be
@@ -643,9 +643,9 @@
 					   htt_tx_status_discard);
 	}
 	TX_CREDIT_DEBUG_PRINT(" <HTT> Increase HTT credit %d + %d = %d..\n",
-			      cdf_atomic_read(&pdev->target_tx_credit),
+			      qdf_atomic_read(&pdev->target_tx_credit),
 			      num_msdus,
-			      cdf_atomic_read(&pdev->target_tx_credit) +
+			      qdf_atomic_read(&pdev->target_tx_credit) +
 			      num_msdus);
 
 	OL_TX_TARGET_CREDIT_ADJUST(num_msdus, pdev, NULL);
diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c
index f8629ba..282e26c 100644
--- a/core/dp/txrx/ol_txrx.c
+++ b/core/dp/txrx/ol_txrx.c
@@ -31,7 +31,7 @@
 #include <cdf_memory.h>         /* cdf_mem_malloc,free */
 #include <cdf_types.h>          /* cdf_device_t, cdf_print */
 #include <cdf_lock.h>           /* cdf_spinlock */
-#include <cdf_atomic.h>         /* cdf_atomic_read */
+#include <qdf_atomic.h>         /* qdf_atomic_read */
 
 /* Required for WLAN_FEATURE_FASTPATH */
 #include <ce_api.h>
@@ -126,7 +126,7 @@
 	if (!peer)
 		return NULL;
 	*peer_id = peer->local_id;
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 	return peer;
 }
 
@@ -180,7 +180,7 @@
 	if (!peer)
 		return NULL;
 	*peer_id = peer->local_id;
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 	return peer;
 }
 
@@ -523,14 +523,14 @@
 	 */
 
 	/* initialize the counter of the target's tx buffer availability */
-	cdf_atomic_init(&pdev->target_tx_credit);
-	cdf_atomic_init(&pdev->orig_target_tx_credit);
+	qdf_atomic_init(&pdev->target_tx_credit);
+	qdf_atomic_init(&pdev->orig_target_tx_credit);
 	/*
 	 * LL - initialize the target credit outselves.
 	 * HL - wait for a HTT target credit initialization during htt_attach.
 	 */
 
-	cdf_atomic_add(ol_cfg_target_tx_credit(pdev->ctrl_pdev),
+	qdf_atomic_add(ol_cfg_target_tx_credit(pdev->ctrl_pdev),
 		   &pdev->target_tx_credit);
 
 	desc_pool_size = ol_tx_get_desc_global_pool_size(pdev);
@@ -638,7 +638,7 @@
 #endif
 #endif
 		c_element->tx_desc.id = i;
-		cdf_atomic_init(&c_element->tx_desc.ref_cnt);
+		qdf_atomic_init(&c_element->tx_desc.ref_cnt);
 		c_element = c_element->next;
 		fail_idx = i;
 	}
@@ -1022,7 +1022,7 @@
 		 * been given to the target to transmit, for which the
 		 * target has never provided a response.
 		 */
-		if (cdf_atomic_read(&tx_desc->ref_cnt)) {
+		if (qdf_atomic_read(&tx_desc->ref_cnt)) {
 			TXRX_PRINT(TXRX_PRINT_LEVEL_WARN,
 				   "Warning: freeing tx frame (no compltn)\n");
 			ol_tx_desc_frame_free_nonstd(pdev,
@@ -1112,8 +1112,8 @@
 			       &vdev->ll_pause.timer,
 			       ol_tx_vdev_ll_pause_queue_send, vdev,
 			       CDF_TIMER_TYPE_SW);
-	cdf_atomic_init(&vdev->os_q_paused);
-	cdf_atomic_set(&vdev->os_q_paused, 0);
+	qdf_atomic_init(&vdev->os_q_paused);
+	qdf_atomic_set(&vdev->os_q_paused, 0);
 	vdev->tx_fl_lwm = 0;
 	vdev->tx_fl_hwm = 0;
 	vdev->wait_on_peer_id = OL_TXRX_INVALID_LOCAL_PEER_ID;
@@ -1267,8 +1267,8 @@
 	ol_rx_callback_fp data_rx = NULL;
 	void *cds_ctx = cds_get_global_context();
 
-	if (cdf_atomic_inc_return(&peer->flush_in_progress) > 1) {
-		cdf_atomic_dec(&peer->flush_in_progress);
+	if (qdf_atomic_inc_return(&peer->flush_in_progress) > 1) {
+		qdf_atomic_dec(&peer->flush_in_progress);
 		return;
 	}
 
@@ -1300,7 +1300,7 @@
 				typeof(*cache_buf), list);
 	}
 	cdf_spin_unlock_bh(&peer->bufq_lock);
-	cdf_atomic_dec(&peer->flush_in_progress);
+	qdf_atomic_dec(&peer->flush_in_progress);
 }
 
 ol_txrx_peer_handle
@@ -1330,7 +1330,7 @@
 				peer_mac_addr[0], peer_mac_addr[1],
 				peer_mac_addr[2], peer_mac_addr[3],
 				peer_mac_addr[4], peer_mac_addr[5]);
-			if (cdf_atomic_read(&temp_peer->delete_in_progress)) {
+			if (qdf_atomic_read(&temp_peer->delete_in_progress)) {
 				vdev->wait_on_peer_id = temp_peer->local_id;
 				qdf_event_create(&vdev->wait_delete_comp);
 				wait_on_deletion = true;
@@ -1387,16 +1387,16 @@
 	cdf_spinlock_init(&peer->peer_info_lock);
 	cdf_spinlock_init(&peer->bufq_lock);
 
-	cdf_atomic_init(&peer->delete_in_progress);
-	cdf_atomic_init(&peer->flush_in_progress);
+	qdf_atomic_init(&peer->delete_in_progress);
+	qdf_atomic_init(&peer->flush_in_progress);
 
-	cdf_atomic_init(&peer->ref_cnt);
+	qdf_atomic_init(&peer->ref_cnt);
 
 	/* keep one reference for attach */
-	cdf_atomic_inc(&peer->ref_cnt);
+	qdf_atomic_inc(&peer->ref_cnt);
 
 	/* keep one reference for ol_rx_peer_map_handler */
-	cdf_atomic_inc(&peer->ref_cnt);
+	qdf_atomic_inc(&peer->ref_cnt);
 
 	peer->valid = 1;
 
@@ -1495,7 +1495,7 @@
 			   "%s: no state change, returns directly\n",
 			   __func__);
 #endif
-		cdf_atomic_dec(&peer->ref_cnt);
+		qdf_atomic_dec(&peer->ref_cnt);
 		return QDF_STATUS_SUCCESS;
 	}
 
@@ -1525,7 +1525,7 @@
 				ol_txrx_peer_tid_unpause(peer, tid);
 		}
 	}
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 
 	/* Set the state after the Pause to avoid the race condiction
 	   with ADDBA check in tx path */
@@ -1628,7 +1628,7 @@
 		break;
 	}
 	}
-	cdf_atomic_dec(&peer->ref_cnt);
+	qdf_atomic_dec(&peer->ref_cnt);
 }
 
 uint8_t
@@ -1683,7 +1683,7 @@
 	 * (A double-free should never happen, so assert if it does.)
 	 */
 
-	if (0 == cdf_atomic_read(&(peer->ref_cnt))) {
+	if (0 == qdf_atomic_read(&(peer->ref_cnt))) {
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 			   "The Peer is not present anymore\n");
 		cdf_assert(0);
@@ -1701,7 +1701,7 @@
 	 * concurrently with the empty check.
 	 */
 	cdf_spin_lock_bh(&pdev->peer_ref_mutex);
-	if (cdf_atomic_dec_and_test(&peer->ref_cnt)) {
+	if (qdf_atomic_dec_and_test(&peer->ref_cnt)) {
 		u_int16_t peer_id;
 
 		TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
@@ -1722,7 +1722,7 @@
 		ol_rx_peer_cleanup(vdev, peer);
 
 		/* peer is removed from peer_list */
-		cdf_atomic_set(&peer->delete_in_progress, 0);
+		qdf_atomic_set(&peer->delete_in_progress, 0);
 
 		/*
 		 * Set wait_delete_comp event if the current peer id matches
@@ -1834,7 +1834,7 @@
 	cdf_spinlock_destroy(&peer->bufq_lock);
 	/* set delete_in_progress to identify that wma
 	 * is waiting for unmap massage for this peer */
-	cdf_atomic_set(&peer->delete_in_progress, 1);
+	qdf_atomic_set(&peer->delete_in_progress, 1);
 	/*
 	 * Remove the reference added during peer_attach.
 	 * The peer will still be left allocated until the
@@ -1956,8 +1956,8 @@
 void ol_txrx_discard_tx_pending(ol_txrx_pdev_handle pdev_handle)
 {
 	ol_tx_desc_list tx_descs;
-	/* First let hif do the cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
-	 * then let htt do the cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+	/* First let hif do the qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+	 * then let htt do the qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
 	 * which is tha same with normal data send complete path*/
 	htt_tx_pending_discard(pdev_handle->htt_pdev);
 
@@ -2672,7 +2672,7 @@
 		vdev->tx_fl_hwm =
 			(uint16_t) (low_watermark + high_watermark_offset);
 		/* Not enough free resource, stop TX OS Q */
-		cdf_atomic_set(&vdev->os_q_paused, 1);
+		qdf_atomic_set(&vdev->os_q_paused, 1);
 		cdf_spin_unlock_bh(&vdev->pdev->tx_mutex);
 		return false;
 	}
diff --git a/core/dp/txrx/ol_txrx_flow_control.c b/core/dp/txrx/ol_txrx_flow_control.c
index 77fd41e..cd352e1 100644
--- a/core/dp/txrx/ol_txrx_flow_control.c
+++ b/core/dp/txrx/ol_txrx_flow_control.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -27,7 +27,7 @@
 
 /* OS abstraction libraries */
 #include <cdf_nbuf.h>           /* cdf_nbuf_t, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_read, etc. */
+#include <cdf_atomic.h>         /* qdf_atomic_read, etc. */
 #include <cdf_util.h>           /* cdf_unlikely */
 
 /* APIs for other modules */
diff --git a/core/dp/txrx/ol_txrx_internal.h b/core/dp/txrx/ol_txrx_internal.h
index 30315e6..85da268 100644
--- a/core/dp/txrx/ol_txrx_internal.h
+++ b/core/dp/txrx/ol_txrx_internal.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -48,9 +48,9 @@
 #define OL_TX_DESC_REF_INC(tx_desc)     /* no-op */
 #else
 #define OL_TX_DESC_NO_REFS(tx_desc) \
-	cdf_atomic_dec_and_test(&tx_desc->ref_cnt)
-#define OL_TX_DESC_REF_INIT(tx_desc) cdf_atomic_init(&tx_desc->ref_cnt)
-#define OL_TX_DESC_REF_INC(tx_desc) cdf_atomic_inc(&tx_desc->ref_cnt)
+	qdf_atomic_dec_and_test(&tx_desc->ref_cnt)
+#define OL_TX_DESC_REF_INIT(tx_desc) qdf_atomic_init(&tx_desc->ref_cnt)
+#define OL_TX_DESC_REF_INC(tx_desc) qdf_atomic_inc(&tx_desc->ref_cnt)
 #endif
 
 #ifndef TXRX_ASSERT_LEVEL
diff --git a/core/dp/txrx/ol_txrx_peer_find.c b/core/dp/txrx/ol_txrx_peer_find.c
index 6422ed4..495afa0 100644
--- a/core/dp/txrx/ol_txrx_peer_find.c
+++ b/core/dp/txrx/ol_txrx_peer_find.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -194,7 +194,7 @@
 		    && peer->vdev == vdev) {
 			/* found it - increment the ref count before releasing
 			   the lock */
-			cdf_atomic_inc(&peer->ref_cnt);
+			qdf_atomic_inc(&peer->ref_cnt);
 			cdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 			return peer;
 		}
@@ -226,7 +226,7 @@
 		    0 && (check_valid == 0 || peer->valid)) {
 			/* found it - increment the ref count before
 			   releasing the lock */
-			cdf_atomic_inc(&peer->ref_cnt);
+			qdf_atomic_inc(&peer->ref_cnt);
 			cdf_spin_unlock_bh(&pdev->peer_ref_mutex);
 			return peer;
 		}
@@ -290,8 +290,8 @@
 				 * 1, so it will get deleted by
 				 * ol_txrx_peer_unref_delete.
 				 */
-				cdf_atomic_init(&peer->ref_cnt); /* set to 0 */
-				cdf_atomic_inc(&peer->ref_cnt); /* incr to 1 */
+				qdf_atomic_init(&peer->ref_cnt); /* set to 0 */
+				qdf_atomic_inc(&peer->ref_cnt); /* incr to 1 */
 				TXRX_PRINT(TXRX_PRINT_LEVEL_ERR,
 					   "%s: Delete Peer %p\n", __func__,
 					   peer);
@@ -441,7 +441,7 @@
 	 */
 	if (vdev->last_real_peer
 	    && vdev->last_real_peer->peer_ids[0] != HTT_INVALID_PEER_ID) {
-		cdf_atomic_inc(&vdev->last_real_peer->ref_cnt);
+		qdf_atomic_inc(&vdev->last_real_peer->ref_cnt);
 		peer = vdev->last_real_peer;
 	} else {
 		peer = NULL;
diff --git a/core/dp/txrx/ol_txrx_types.h b/core/dp/txrx/ol_txrx_types.h
index da06c7d..7c0bc80 100644
--- a/core/dp/txrx/ol_txrx_types.h
+++ b/core/dp/txrx/ol_txrx_types.h
@@ -37,7 +37,7 @@
 #include <cds_queue.h>          /* TAILQ */
 #include <a_types.h>            /* A_UINT8 */
 #include <htt.h>                /* htt_sec_type, htt_pkt_type, etc. */
-#include <cdf_atomic.h>         /* cdf_atomic_t */
+#include <qdf_atomic.h>         /* qdf_atomic_t */
 #include <wdi_event_api.h>      /* wdi_event_subscribe */
 #include <cdf_softirq_timer.h>  /* cdf_softirq_timer_t */
 #include <cdf_lock.h>           /* cdf_spinlock */
@@ -133,7 +133,7 @@
 	cdf_dma_addr_t htt_tx_desc_paddr;
 	void *htt_frag_desc; /* struct msdu_ext_desc_t * */
 	cdf_dma_addr_t htt_frag_desc_paddr;
-	cdf_atomic_t ref_cnt;
+	qdf_atomic_t ref_cnt;
 	enum htt_tx_status status;
 
 #ifdef QCA_COMPUTE_TX_DELAY
@@ -497,8 +497,8 @@
 	 * track of roughly how much space is available in the target for
 	 * tx frames
 	 */
-	cdf_atomic_t target_tx_credit;
-	cdf_atomic_t orig_target_tx_credit;
+	qdf_atomic_t target_tx_credit;
+	qdf_atomic_t orig_target_tx_credit;
 
 	/* Peer mac address to staid mapping */
 	struct ol_mac_addr mac_to_staid[WLAN_MAX_STA_COUNT + 3];
@@ -677,7 +677,7 @@
 	 * conditional compilation.
 	 */
 	struct {
-		cdf_atomic_t rsrc_cnt;
+		qdf_atomic_t rsrc_cnt;
 		/* threshold_lo - when to start tx desc margin replenishment */
 		uint16_t rsrc_threshold_lo;
 		/* threshold_hi - where to stop during tx desc margin
@@ -842,7 +842,7 @@
 		uint32_t q_overflow_cnt;
 	} ll_pause;
 	bool disable_intrabss_fwd;
-	cdf_atomic_t os_q_paused;
+	qdf_atomic_t os_q_paused;
 	uint16_t tx_fl_lwm;
 	uint16_t tx_fl_hwm;
 	cdf_spinlock_t flow_control_lock;
@@ -910,9 +910,9 @@
 struct ol_txrx_peer_t {
 	struct ol_txrx_vdev_t *vdev;
 
-	cdf_atomic_t ref_cnt;
-	cdf_atomic_t delete_in_progress;
-	cdf_atomic_t flush_in_progress;
+	qdf_atomic_t ref_cnt;
+	qdf_atomic_t delete_in_progress;
+	qdf_atomic_t flush_in_progress;
 
 	/* The peer state tracking is used for HL systems
 	 * that don't support tx and rx filtering within the target.
@@ -985,7 +985,7 @@
 	uint8_t keyinstalled;
 
 	/* Bit to indicate if PN check is done in fw */
-	cdf_atomic_t fw_pn_check;
+	qdf_atomic_t fw_pn_check;
 
 #ifdef WLAN_FEATURE_11W
 	/* PN counter for Robust Management Frames */