Explorar o código

qcacmn: Save vdev id of current roc ctx

RX mgmt frame is from interrupt thread, it may be access freed roc
ctx for low rate case. Save vdev id of current roc ctx in p2p psoc
object. Low log level of P2P RX and TX conf since too many output.

Change-Id: I4c944244f32b844d78bb69d66e341a1f3bf13abf
CRs-Fixed: 2180116
Wu Gao %!s(int64=7) %!d(string=hai) anos
pai
achega
3e25780223

+ 3 - 3
os_if/linux/p2p/src/wlan_cfg80211_p2p.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -91,7 +91,7 @@ static void wlan_p2p_rx_callback(void *user_data,
 		freq = ieee80211_channel_to_frequency(
 			rx_frame->rx_chan, NL80211_BAND_5GHZ);
 
-	cfg80211_notice("Indicate frame over nl80211, vdev id:%d, idx:%d",
+	cfg80211_debug("Indicate frame over nl80211, vdev id:%d, idx:%d",
 		   rx_frame->vdev_id, wdev->netdev->ifindex);
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0))
@@ -129,7 +129,7 @@ static void wlan_p2p_action_tx_cnf_callback(void *user_data,
 	struct wireless_dev *wdev;
 	bool is_success;
 
-	cfg80211_info("user data:%pK, action cookie:%llx, buf:%pK, len:%d, tx status:%d",
+	cfg80211_debug("user data:%pK, action cookie:%llx, buf:%pK, len:%d, tx status:%d",
 		user_data, tx_cnf->action_cookie, tx_cnf->buf,
 		tx_cnf->buf_len, tx_cnf->status);
 

+ 2 - 1
umac/p2p/core/src/wlan_p2p_main.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -820,6 +820,7 @@ QDF_STATUS p2p_psoc_object_open(struct wlan_objmgr_psoc *soc)
 	}
 
 	qdf_runtime_lock_init(&p2p_soc_obj->roc_runtime_lock);
+	p2p_soc_obj->cur_roc_vdev_id = P2P_INVALID_VDEV_ID;
 	p2p_register_pmo_handler();
 
 	p2p_debug("p2p psoc object open successful");

+ 3 - 0
umac/p2p/core/src/wlan_p2p_main.h

@@ -32,6 +32,7 @@
 #define MAX_QUEUE_LENGTH 20
 #define P2P_NOA_ATTR_IND 0x1090
 #define P2P_MODULE_NAME  "P2P"
+#define P2P_INVALID_VDEV_ID 0xFFFFFFFF
 
 #define p2p_log(level, args...) \
 	QDF_TRACE(QDF_MODULE_ID_P2P, level, ## args)
@@ -167,6 +168,7 @@ enum p2p_connection_status {
  * @cancel_roc_done:  Cancel roc done event
  * @roc_runtime_lock: Runtime lock for roc request
  * @p2p_cb: Callbacks to protocol stack
+ * @cur_roc_vdev_id:  Vdev id of current roc
  * @connection_status:Global P2P connection status
  */
 struct p2p_soc_priv_obj {
@@ -179,6 +181,7 @@ struct p2p_soc_priv_obj {
 	qdf_event_t cancel_roc_done;
 	qdf_runtime_lock_t roc_runtime_lock;
 	struct p2p_protocol_callbacks p2p_cb;
+	uint32_t cur_roc_vdev_id;
 #ifdef WLAN_FEATURE_P2P_DEBUG
 	enum p2p_connection_status connection_status;
 #endif

+ 3 - 1
umac/p2p/core/src/wlan_p2p_roc.c

@@ -380,7 +380,8 @@ fail:
 		return status;
 	}
 
-	status = p2p_mgmt_rx_ops(roc_ctx->p2p_soc_obj->soc, true);
+	p2p_soc_obj->cur_roc_vdev_id = roc_ctx->vdev_id;
+	status = p2p_mgmt_rx_ops(p2p_soc_obj->soc, true);
 	if (status != QDF_STATUS_SUCCESS)
 		p2p_err("Failed to register mgmt rx callback, status:%d",
 			status);
@@ -520,6 +521,7 @@ static QDF_STATUS p2p_process_scan_complete_evt(
 		p2p_err("Failed to destroy roc timer");
 
 	status = p2p_mgmt_rx_ops(p2p_soc_obj->soc, false);
+	p2p_soc_obj->cur_roc_vdev_id = P2P_INVALID_VDEV_ID;
 	if (status != QDF_STATUS_SUCCESS)
 		p2p_err("Failed to deregister mgmt rx callback");
 

+ 4 - 8
umac/p2p/dispatcher/src/wlan_p2p_tgt_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -185,9 +185,7 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc,
 	struct p2p_rx_mgmt_event *rx_mgmt_event;
 	struct p2p_soc_priv_obj *p2p_soc_obj;
 	struct scheduler_msg msg = {0};
-	struct wlan_frame_hdr *wh;
 	struct wlan_objmgr_vdev *vdev;
-	struct p2p_roc_context *roc_ctx;
 	uint32_t vdev_id;
 	uint8_t *pdata;
 
@@ -208,13 +206,12 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc,
 	}
 
 	if (!peer) {
-		roc_ctx = p2p_find_current_roc_ctx(p2p_soc_obj);
-		if (!roc_ctx) {
-			p2p_err("current roc ctx is null, can't get vdev id");
+		if (p2p_soc_obj->cur_roc_vdev_id == P2P_INVALID_VDEV_ID) {
+			p2p_err("vdev id of current roc invalid");
 			qdf_nbuf_free(buf);
 			return QDF_STATUS_E_FAILURE;
 		} else {
-			vdev_id = roc_ctx->vdev_id;
+			vdev_id = p2p_soc_obj->cur_roc_vdev_id;
 		}
 	} else {
 		vdev = wlan_peer_get_vdev(peer);
@@ -241,7 +238,6 @@ QDF_STATUS tgt_p2p_mgmt_frame_rx_cb(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_NOMEM;
 	}
 
-	wh = (struct wlan_frame_hdr *)qdf_nbuf_data(buf);
 	pdata = (uint8_t *)qdf_nbuf_data(buf);
 	rx_mgmt->frame_len = mgmt_rx_params->buf_len;
 	rx_mgmt->rx_chan = mgmt_rx_params->channel;