Ver Fonte

qcacmn: Handle scan dequeue event and start failed event

Handle scan dequeue event and start failed event in P2P component,
same as scan complete event. Fix incorrect method to call qdf wait
single event. Fix code style issue.

Change-Id: Id8fbf5180a942183eff9b02f36f945fe17ceab6e
CRs-Fixed: 2032600
Wu Gao há 8 anos atrás
pai
commit
a47828dd20

+ 6 - 14
umac/p2p/core/src/wlan_p2p_off_chan_tx.c

@@ -991,7 +991,7 @@ static QDF_STATUS p2p_move_tx_context_to_ack_queue(
 		}
 
 		if (is_ack_q) {
-			p2p_err("Already in waiting for ack queue");
+			p2p_debug("Already in waiting for ack queue");
 			return QDF_STATUS_SUCCESS;
 		}
 	}
@@ -1374,11 +1374,11 @@ QDF_STATUS p2p_ready_to_tx_frame(struct p2p_soc_priv_obj *p2p_soc_obj,
 			}
 		}
 		if (is_ack_q) {
-			p2p_err("Already sent and waiting for ack");
+			p2p_debug("Already sent and waiting for ack");
 			status = QDF_STATUS_SUCCESS;
 		}
 	} else {
-		p2p_err("Failed to find tx ctx by cookie, cookie %llx",
+		p2p_debug("Failed to find tx ctx by cookie, cookie %llx",
 			cookie);
 		status = QDF_STATUS_E_INVAL;
 	}
@@ -1428,7 +1428,6 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx)
 {
 	struct p2p_soc_priv_obj *p2p_soc_obj;
 	struct p2p_roc_context *curr_roc_ctx;
-	uint64_t rc = 1;
 	QDF_STATUS status;
 
 	status = p2p_tx_context_check_valid(tx_ctx);
@@ -1462,7 +1461,7 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx)
 
 	status = p2p_vdev_check_valid(tx_ctx);
 	if (status != QDF_STATUS_SUCCESS) {
-		p2p_err("invalid vdev or vdev mode");
+		p2p_debug("invalid vdev or vdev mode");
 		status = QDF_STATUS_E_INVAL;
 		goto fail;
 	}
@@ -1486,15 +1485,8 @@ QDF_STATUS p2p_process_mgmt_tx(struct tx_action_context *tx_ctx)
 	/* For off channel tx case */
 	curr_roc_ctx = p2p_find_current_roc_ctx(p2p_soc_obj);
 	if (curr_roc_ctx && (curr_roc_ctx->chan == tx_ctx->chan)) {
-		if (curr_roc_ctx->roc_state ==
+		if (curr_roc_ctx->roc_state !=
 			ROC_STATE_CANCEL_IN_PROG) {
-			/* wait for roc canceling done */
-			rc = qdf_wait_single_event(
-				&p2p_soc_obj->cancel_roc_done,
-				msecs_to_jiffies(P2P_WAIT_CANCEL_ROC));
-			if (!rc)
-				p2p_err("Timeout occurred while waiting for RoC cancellation");
-		} else {
 			p2p_adjust_tx_wait(tx_ctx);
 			status = p2p_restart_roc_timer(curr_roc_ctx);
 			if (status != QDF_STATUS_SUCCESS) {
@@ -1552,7 +1544,7 @@ QDF_STATUS p2p_process_mgmt_tx_cancel(
 				cancel_tx->cookie);
 		}
 	} else {
-		p2p_err("Failed to find tx ctx by cookie, cookie %llx",
+		p2p_debug("Failed to find tx ctx by cookie, cookie %llx",
 			cancel_tx->cookie);
 		return QDF_STATUS_E_INVAL;
 	}

+ 14 - 58
umac/p2p/core/src/wlan_p2p_roc.c

@@ -450,9 +450,13 @@ static QDF_STATUS p2p_process_scan_complete_evt(
 		roc_ctx->phy_mode, roc_ctx->duration,
 		roc_ctx->roc_type, roc_ctx->roc_state);
 
-	status = qdf_mc_timer_stop(&roc_ctx->roc_timer);
-	if (status != QDF_STATUS_SUCCESS)
-		p2p_err("Failed to stop roc timer");
+	if (QDF_TIMER_STATE_RUNNING ==
+		qdf_mc_timer_get_current_state(&roc_ctx->roc_timer)) {
+		status = qdf_mc_timer_stop(&roc_ctx->roc_timer);
+		if (status != QDF_STATUS_SUCCESS)
+			p2p_err("Failed to stop roc timer");
+	}
+
 	status = qdf_mc_timer_destroy(&roc_ctx->roc_timer);
 	if (status != QDF_STATUS_SUCCESS)
 		p2p_err("Failed to destroy roc timer");
@@ -489,45 +493,6 @@ static QDF_STATUS p2p_process_scan_complete_evt(
 	return status;
 }
 
-/**
- * p2p_process_scan_dequeue() - Process scan dequeue
- * @roc_ctx: remain on channel request
- *
- * This function process scan dequeued event.
- *
- * Return: QDF_STATUS_SUCCESS - in case of success
- */
-static QDF_STATUS p2p_process_scan_dequeue(
-	struct p2p_roc_context *roc_ctx)
-{
-	QDF_STATUS status;
-	struct p2p_soc_priv_obj *p2p_soc_obj = roc_ctx->p2p_soc_obj;
-
-	if (roc_ctx->roc_state != ROC_STATE_CANCEL_IN_PROG) {
-		p2p_debug("invalid roc state, %d", roc_ctx->roc_state);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (QDF_TIMER_STATE_RUNNING !=
-		qdf_mc_timer_get_current_state(&roc_ctx->roc_timer)) {
-		qdf_mc_timer_stop(&roc_ctx->roc_timer);
-	}
-
-	status = qdf_mc_timer_destroy(&roc_ctx->roc_timer);
-	if (status != QDF_STATUS_SUCCESS)
-		p2p_err("failed to destroy roc timer, roc ctx:%p, status:%d",
-			roc_ctx, status);
-
-	status = qdf_list_remove_node(&p2p_soc_obj->roc_q,
-				(qdf_list_node_t *)roc_ctx);
-	if (status != QDF_STATUS_SUCCESS)
-		p2p_err("failed to remove roc context, roc ctx:%p, status:%d",
-			roc_ctx, status);
-	qdf_mem_free(roc_ctx);
-
-	return status;
-}
-
 struct p2p_roc_context *p2p_find_current_roc_ctx(
 	struct p2p_soc_priv_obj *p2p_soc_obj)
 {
@@ -582,7 +547,6 @@ 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;
-	unsigned long rc = 0;
 
 	p2p_debug("clean up idle roc request, roc queue size:%d",
 		qdf_list_size(&p2p_soc_obj->roc_q));
@@ -625,20 +589,13 @@ QDF_STATUS p2p_cleanup_roc_queue(struct p2p_soc_priv_obj *p2p_soc_obj)
 			    ROC_STATE_CANCEL_IN_PROG)
 				p2p_execute_cancel_roc_req(roc_ctx);
 
-			rc = qdf_wait_single_event(
+			status = qdf_wait_single_event(
 				&p2p_soc_obj->cancel_roc_done,
-				msecs_to_jiffies(P2P_WAIT_CANCEL_ROC));
-			if (!rc)
-				p2p_err("Timeout occurred while waiting for RoC cancellation");
+				P2P_WAIT_CANCEL_ROC);
+			p2p_err("roc cancellation done, status:%d", status);
 		}
 	}
 
-	if (status != QDF_STATUS_SUCCESS || rc) {
-		p2p_err("failed to cleanup roc queue, status:%d, rc:%ld",
-			status, rc);
-		status = QDF_STATUS_E_FAILURE;
-	}
-
 	return status;
 }
 
@@ -661,7 +618,7 @@ QDF_STATUS p2p_process_roc_req(struct p2p_roc_context *roc_ctx)
 			&roc_ctx->node);
 	if (QDF_STATUS_SUCCESS != status) {
 		qdf_mem_free(roc_ctx);
-		p2p_err("Failed to insert roc req, status %d", status);
+		p2p_debug("Failed to insert roc req, status %d", status);
 		return status;
 	}
 
@@ -742,12 +699,11 @@ void p2p_scan_event_cb(struct wlan_objmgr_vdev *vdev,
 		p2p_process_ready_on_channel_evt(curr_roc_ctx);
 		break;
 	case SCAN_EVENT_TYPE_COMPLETED:
-		p2p_process_scan_complete_evt(curr_roc_ctx);
-		break;
 	case SCAN_EVENT_TYPE_DEQUEUED:
-		p2p_process_scan_dequeue(curr_roc_ctx);
+	case SCAN_EVENT_TYPE_START_FAILED:
+		p2p_process_scan_complete_evt(curr_roc_ctx);
 		break;
 	default:
-		p2p_err("invalid scan event, %d", event->type);
+		p2p_debug("drop scan event, %d", event->type);
 	}
 }

+ 7 - 7
umac/p2p/dispatcher/src/wlan_p2p_ucfg_api.c

@@ -160,20 +160,20 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
 		mgmt_frm->wait, mgmt_frm->len, mgmt_frm->no_cck,
 		mgmt_frm->dont_wait_for_ack, mgmt_frm->off_chan);
 
-	if (soc == NULL) {
+	if (!soc) {
 		p2p_err("psoc context passed is NULL");
 		return QDF_STATUS_E_INVAL;
 	}
 
 	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
 			WLAN_UMAC_COMP_P2P);
-	if (p2p_soc_obj == NULL) {
+	if (!p2p_soc_obj) {
 		p2p_err("P2P soc context is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	tx_action = qdf_mem_malloc(sizeof(*tx_action));
-	if (tx_action == NULL) {
+	if (!tx_action) {
 		p2p_err("Failed to allocate tx action context");
 		return QDF_STATUS_E_NOMEM;
 	}
@@ -193,7 +193,7 @@ QDF_STATUS ucfg_p2p_mgmt_tx(struct wlan_objmgr_psoc *soc,
 	tx_action->no_ack = mgmt_frm->dont_wait_for_ack;
 	tx_action->off_chan = mgmt_frm->off_chan;
 	tx_action->buf = qdf_mem_malloc(tx_action->buf_len);
-	if (tx_action->buf == NULL) {
+	if (!(tx_action->buf)) {
 		p2p_err("Failed to allocate buffer for action frame");
 		qdf_mem_free(tx_action);
 		return QDF_STATUS_E_NOMEM;
@@ -216,20 +216,20 @@ QDF_STATUS ucfg_p2p_mgmt_tx_cancel(struct wlan_objmgr_psoc *soc,
 
 	p2p_debug("soc:%p, cookie:0x%llx", soc, cookie);
 
-	if (soc == NULL) {
+	if (!soc) {
 		p2p_err("psoc context passed is NULL");
 		return QDF_STATUS_E_INVAL;
 	}
 
 	p2p_soc_obj = wlan_objmgr_psoc_get_comp_private_obj(soc,
 			WLAN_UMAC_COMP_P2P);
-	if (p2p_soc_obj == NULL) {
+	if (!p2p_soc_obj) {
 		p2p_err("p2p soc context is NULL");
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	cancel_tx = qdf_mem_malloc(sizeof(*cancel_tx));
-	if (cancel_tx == NULL) {
+	if (!cancel_tx) {
 		p2p_err("Failed to allocate cancel p2p roc");
 		return QDF_STATUS_E_NOMEM;
 	}