Bladeren bron

qcacmn: Use qdf API instead of linux function

Replacing linux function with qdf API in P2P conponemt.

Change-Id: Ibf4e8acef0b2f4be113dbecb9ac2a685f456fd53
CRs-Fixed: 2148472
Wu Gao 7 jaren geleden
bovenliggende
commit
e823bbf9d5
2 gewijzigde bestanden met toevoegingen van 112 en 75 verwijderingen
  1. 56 38
      core/src/wlan_p2p_off_chan_tx.c
  2. 56 37
      core/src/wlan_p2p_roc.c

+ 56 - 38
core/src/wlan_p2p_off_chan_tx.c

@@ -1006,31 +1006,38 @@ static struct tx_action_context *p2p_find_tx_ctx(
 	bool *is_roc_q, bool *is_ack_q)
 {
 	struct tx_action_context *cur_tx_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status;
 	*is_roc_q = false;
 	*is_ack_q = false;
 
 	p2p_debug("Start to find tx ctx, p2p soc_obj:%pK, cookie:%llx",
 		p2p_soc_obj, cookie);
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_roc.anchor) {
-		cur_tx_ctx =
-			list_entry(pos, struct tx_action_context, node);
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_roc, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		cur_tx_ctx = qdf_container_of(p_node,
+				struct tx_action_context, node);
 		if ((uintptr_t) cur_tx_ctx == cookie) {
 			*is_roc_q = true;
 			p2p_debug("find tx ctx, cookie:%llx", cookie);
 			return cur_tx_ctx;
 		}
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_roc,
+						p_node, &p_node);
 	}
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_ack.anchor) {
-		cur_tx_ctx =
-			list_entry(pos, struct tx_action_context, node);
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_ack, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		cur_tx_ctx = qdf_container_of(p_node,
+				struct tx_action_context, node);
 		if ((uintptr_t) cur_tx_ctx == cookie) {
 			*is_ack_q = true;
 			p2p_debug("find tx ctx, cookie:%llx", cookie);
 			return cur_tx_ctx;
 		}
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_ack,
+						p_node, &p_node);
 	}
 
 	return NULL;
@@ -1052,31 +1059,38 @@ static struct tx_action_context *p2p_find_tx_ctx_by_roc(
 	bool *is_roc_q, bool *is_ack_q)
 {
 	struct tx_action_context *cur_tx_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status;
 	*is_roc_q = false;
 	*is_ack_q = false;
 
 	p2p_debug("Start to find tx ctx, p2p soc_obj:%pK, cookie:%llx",
 		p2p_soc_obj, cookie);
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_roc.anchor) {
-		cur_tx_ctx =
-			list_entry(pos, struct tx_action_context, node);
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_roc, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		cur_tx_ctx = qdf_container_of(p_node,
+					struct tx_action_context, node);
 		if (cur_tx_ctx->roc_cookie == cookie) {
 			*is_roc_q = true;
 			p2p_debug("find tx ctx, cookie:%llx", cookie);
 			return cur_tx_ctx;
 		}
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_roc,
+						p_node, &p_node);
 	}
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_ack.anchor) {
-		cur_tx_ctx =
-			list_entry(pos, struct tx_action_context, node);
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_ack, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		cur_tx_ctx = qdf_container_of(p_node,
+				struct tx_action_context, node);
 		if (cur_tx_ctx->roc_cookie == cookie) {
 			*is_ack_q = true;
 			p2p_debug("find tx ctx, cookie:%llx", cookie);
 			return cur_tx_ctx;
 		}
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_ack,
+						p_node, &p_node);
 	}
 
 	return NULL;
@@ -1445,13 +1459,16 @@ static QDF_STATUS p2p_execute_tx_action_frame(
 void p2p_dump_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 {
 	struct tx_action_context *tx_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status;
 
 	p2p_debug("dump tx queue wait for roc, p2p soc obj:%pK, size:%d",
 		p2p_soc_obj, qdf_list_size(&p2p_soc_obj->tx_q_roc));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_roc.anchor) {
-		tx_ctx = list_entry(pos, struct tx_action_context,
-				node);
+
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_roc, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		tx_ctx = qdf_container_of(p_node,
+				struct tx_action_context, node);
 		p2p_debug("p2p soc object:%pK, tx ctx:%pK, vdev_id:%d, scan_id:%d, roc_cookie:%llx, chan:%d, buf:%pK, len:%d, off_chan:%d, cck:%d, ack:%d, duration:%d",
 			p2p_soc_obj, tx_ctx,
 			tx_ctx->vdev_id, tx_ctx->scan_id,
@@ -1459,13 +1476,17 @@ void p2p_dump_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 			tx_ctx->buf, tx_ctx->buf_len,
 			tx_ctx->off_chan, tx_ctx->no_cck,
 			tx_ctx->no_ack, tx_ctx->duration);
+
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_roc,
+						p_node, &p_node);
 	}
 
 	p2p_debug("dump tx queue wait for ack, size:%d",
 		qdf_list_size(&p2p_soc_obj->tx_q_ack));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_ack.anchor) {
-		tx_ctx = list_entry(pos, struct tx_action_context,
-				node);
+	status = qdf_list_peek_front(&p2p_soc_obj->tx_q_ack, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		tx_ctx = qdf_container_of(p_node,
+				struct tx_action_context, node);
 		p2p_debug("p2p soc object:%pK, tx_ctx:%pK, vdev_id:%d, scan_id:%d, roc_cookie:%llx, chan:%d, buf:%pK, len:%d, off_chan:%d, cck:%d, ack:%d, duration:%d",
 			p2p_soc_obj, tx_ctx,
 			tx_ctx->vdev_id, tx_ctx->scan_id,
@@ -1473,6 +1494,9 @@ void p2p_dump_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 			tx_ctx->buf, tx_ctx->buf_len,
 			tx_ctx->off_chan, tx_ctx->no_cck,
 			tx_ctx->no_ack, tx_ctx->duration);
+
+		status = qdf_list_peek_next(&p2p_soc_obj->tx_q_ack,
+						p_node, &p_node);
 	}
 }
 
@@ -1511,19 +1535,16 @@ QDF_STATUS p2p_ready_to_tx_frame(struct p2p_soc_priv_obj *p2p_soc_obj,
 
 QDF_STATUS p2p_cleanup_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 {
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	struct tx_action_context *curr_tx_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
 
 	p2p_debug("clean up tx queue wait for roc, size:%d",
 		qdf_list_size(&p2p_soc_obj->tx_q_roc));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_roc.anchor) {
-		curr_tx_ctx = list_entry(pos,
-				struct tx_action_context, node);
-		status = qdf_list_remove_node(&p2p_soc_obj->tx_q_roc,
-				(qdf_list_node_t *)curr_tx_ctx);
-		if (status != QDF_STATUS_SUCCESS)
-			p2p_err("Failed to remove tx ctx from tx wait for roc queue");
+
+	while (qdf_list_remove_front(&p2p_soc_obj->tx_q_roc, &p_node) ==
+		QDF_STATUS_SUCCESS) {
+		curr_tx_ctx = qdf_container_of(p_node,
+					struct tx_action_context, node);
 		p2p_send_tx_conf(curr_tx_ctx, false);
 		qdf_mem_free(curr_tx_ctx->buf);
 		qdf_mem_free(curr_tx_ctx);
@@ -1531,20 +1552,17 @@ QDF_STATUS p2p_cleanup_tx_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 
 	p2p_debug("clean up tx queue wait for ack, size:%d",
 		qdf_list_size(&p2p_soc_obj->tx_q_ack));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->tx_q_ack.anchor) {
-		curr_tx_ctx = list_entry(pos,
-				struct tx_action_context, node);
-		status = qdf_list_remove_node(&p2p_soc_obj->tx_q_ack,
-				(qdf_list_node_t *)curr_tx_ctx);
-		if (status != QDF_STATUS_SUCCESS)
-			p2p_err("Failed to remove tx ctx from tx wait for ack queue");
+	while (qdf_list_remove_front(&p2p_soc_obj->tx_q_ack, &p_node) ==
+		QDF_STATUS_SUCCESS) {
+		curr_tx_ctx = qdf_container_of(p_node,
+					struct tx_action_context, node);
 		p2p_disable_tx_timer(curr_tx_ctx);
 		p2p_send_tx_conf(curr_tx_ctx, false);
 		qdf_mem_free(curr_tx_ctx->buf);
 		qdf_mem_free(curr_tx_ctx);
 	}
 
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx)

+ 56 - 37
core/src/wlan_p2p_roc.c

@@ -402,15 +402,19 @@ static struct p2p_roc_context *p2p_find_roc_ctx(
 	struct p2p_soc_priv_obj *p2p_soc_obj, uint64_t cookie)
 {
 	struct p2p_roc_context *curr_roc_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status;
 
 	p2p_debug("p2p soc obj:%pK, cookie:%llx", p2p_soc_obj, cookie);
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		curr_roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		curr_roc_ctx = qdf_container_of(p_node,
+					struct p2p_roc_context, node);
 		if ((uintptr_t) curr_roc_ctx == cookie)
 			return curr_roc_ctx;
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 	}
 
 	return NULL;
@@ -569,11 +573,13 @@ struct p2p_roc_context *p2p_find_current_roc_ctx(
 	struct p2p_soc_priv_obj *p2p_soc_obj)
 {
 	struct p2p_roc_context *roc_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status;
 
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		roc_ctx = qdf_container_of(p_node,
+				struct p2p_roc_context, node);
 		if (roc_ctx->roc_state != ROC_STATE_IDLE) {
 			p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id"
 				":%d, scan_id:%d, cookie:%llx, chan:"
@@ -587,6 +593,8 @@ struct p2p_roc_context *p2p_find_current_roc_ctx(
 
 			return roc_ctx;
 		}
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 	}
 
 	return NULL;
@@ -616,15 +624,17 @@ QDF_STATUS p2p_restart_roc_timer(struct p2p_roc_context *roc_ctx)
 
 QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 {
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct p2p_roc_context *roc_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
+	QDF_STATUS status, ret;
 
 	p2p_debug("clean up idle roc request, roc queue size:%d",
 		qdf_list_size(&p2p_soc_obj->roc_q));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		roc_ctx = qdf_container_of(p_node,
+				struct p2p_roc_context, node);
 
 		p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d",
 			roc_ctx->p2p_soc_obj, roc_ctx,
@@ -632,12 +642,13 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 			roc_ctx->cookie, roc_ctx->chan,
 			roc_ctx->phy_mode, roc_ctx->duration,
 			roc_ctx->roc_type, roc_ctx->roc_state);
-
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 		if (roc_ctx->roc_state == ROC_STATE_IDLE) {
-			status = qdf_list_remove_node(
+			ret = qdf_list_remove_node(
 					&p2p_soc_obj->roc_q,
 					(qdf_list_node_t *)roc_ctx);
-			if (status == QDF_STATUS_SUCCESS)
+			if (ret == QDF_STATUS_SUCCESS)
 				p2p_destroy_roc_ctx(roc_ctx,
 						true, false);
 			else
@@ -647,9 +658,10 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 
 	p2p_debug("clean up started roc request, roc queue size:%d",
 		qdf_list_size(&p2p_soc_obj->roc_q));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		roc_ctx = qdf_container_of(p_node,
+				struct p2p_roc_context, node);
 
 	p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d",
 		roc_ctx->p2p_soc_obj, roc_ctx, roc_ctx->vdev_id,
@@ -657,33 +669,36 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 		roc_ctx->phy_mode, roc_ctx->duration,
 		roc_ctx->roc_type, roc_ctx->roc_state);
 
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 		if (roc_ctx->roc_state != ROC_STATE_IDLE) {
 			if (roc_ctx->roc_state !=
 			    ROC_STATE_CANCEL_IN_PROG)
 				p2p_execute_cancel_roc_req(roc_ctx);
 
-			status = qdf_wait_single_event(
+			ret = qdf_wait_single_event(
 				&p2p_soc_obj->cancel_roc_done,
 				P2P_WAIT_CANCEL_ROC);
-			p2p_debug("roc cancellation done, status:%d", status);
+			p2p_debug("roc cancellation done, return:%d", ret);
 		}
 	}
 
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS p2p_cleanup_roc_by_vdev(
 	struct p2p_soc_priv_obj *p2p_soc_obj, uint32_t vdev_id)
 {
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	QDF_STATUS status, ret;
 	struct p2p_roc_context *roc_ctx;
-	qdf_list_node_t *tmp, *pos;
+	qdf_list_node_t *p_node;
 
 	p2p_debug("clean up idle roc request, roc queue size:%d, vdev id:%d",
 		qdf_list_size(&p2p_soc_obj->roc_q), vdev_id);
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		roc_ctx = qdf_container_of(p_node,
+				struct p2p_roc_context, node);
 
 		p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d",
 			roc_ctx->p2p_soc_obj, roc_ctx,
@@ -691,13 +706,14 @@ QDF_STATUS p2p_cleanup_roc_by_vdev(
 			roc_ctx->cookie, roc_ctx->chan,
 			roc_ctx->phy_mode, roc_ctx->duration,
 			roc_ctx->roc_type, roc_ctx->roc_state);
-
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 		if (roc_ctx->roc_state == ROC_STATE_IDLE &&
 			roc_ctx->vdev_id == vdev_id) {
-			status = qdf_list_remove_node(
+			ret = qdf_list_remove_node(
 					&p2p_soc_obj->roc_q,
 					(qdf_list_node_t *)roc_ctx);
-			if (status == QDF_STATUS_SUCCESS)
+			if (ret == QDF_STATUS_SUCCESS)
 				qdf_mem_free(roc_ctx);
 			else
 				p2p_err("Failed to remove roc ctx from queue");
@@ -706,30 +722,33 @@ QDF_STATUS p2p_cleanup_roc_by_vdev(
 
 	p2p_debug("clean up started roc request, roc queue size:%d",
 		qdf_list_size(&p2p_soc_obj->roc_q));
-	list_for_each_safe(pos, tmp, &p2p_soc_obj->roc_q.anchor) {
-		roc_ctx = list_entry(pos, struct p2p_roc_context,
-					node);
+	status = qdf_list_peek_front(&p2p_soc_obj->roc_q, &p_node);
+	while (QDF_IS_STATUS_SUCCESS(status)) {
+		roc_ctx = qdf_container_of(p_node,
+				struct p2p_roc_context, node);
 
-	p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d",
+		p2p_debug("p2p soc obj:%pK, roc ctx:%pK, vdev_id:%d, scan_id:%d, cookie:%llx, chan:%d, phy_mode:%d, duration:%d, roc_type:%d, roc_state:%d",
 		roc_ctx->p2p_soc_obj, roc_ctx, roc_ctx->vdev_id,
 		roc_ctx->scan_id, roc_ctx->cookie, roc_ctx->chan,
 		roc_ctx->phy_mode, roc_ctx->duration,
 		roc_ctx->roc_type, roc_ctx->roc_state);
 
+		status = qdf_list_peek_next(&p2p_soc_obj->roc_q,
+						p_node, &p_node);
 		if (roc_ctx->roc_state != ROC_STATE_IDLE &&
 			roc_ctx->vdev_id == vdev_id) {
 			if (roc_ctx->roc_state !=
 			    ROC_STATE_CANCEL_IN_PROG)
 				p2p_execute_cancel_roc_req(roc_ctx);
 
-			status = qdf_wait_single_event(
+			ret = qdf_wait_single_event(
 				&p2p_soc_obj->cancel_roc_done,
 				P2P_WAIT_CANCEL_ROC);
-			p2p_debug("RoC cancellation done, status:%d", status);
+			p2p_debug("RoC cancellation done, return:%d", ret);
 		}
 	}
 
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx)