Browse Source

qcacld-3.0: Add cmd_id as unique number to legacy sme command

Current driver keeps cmd_id as 0 for all non-scan commands which
makes serialization module's logic more complex in order to identify
between duplicate commands.

Add unique cmd_id and attach it to each legacy sme command to make
serialization module's logic easy to distinguish between duplicate
commands.

CRs-Fixed: 2267418
Change-Id: Id2ccb435137061c963120822326fe5b90f857eb7
Krunal Soni 6 years ago
parent
commit
da0e1e7d34

+ 1 - 0
core/mac/inc/ani_global.h

@@ -896,6 +896,7 @@ typedef struct sAniSirGlobal {
 	uint8_t hw_dbs_capable;
 	uint32_t sta_sap_scc_on_dfs_chan;
 	sir_mgmt_frame_ind_callback mgmt_frame_ind_cb;
+	qdf_atomic_t global_cmd_id;
 	struct wlan_objmgr_psoc *psoc;
 	struct wlan_objmgr_pdev *pdev;
 	void (*chan_info_cb)(struct scan_chan_info *chan_info);

+ 1 - 0
core/sme/inc/sme_inside.h

@@ -149,6 +149,7 @@ struct s_nss_update_cmd {
 typedef struct tagSmeCmd {
 	tListElem Link;
 	eSmeCommandType command;
+	uint32_t cmd_id;
 	uint32_t sessionId;
 	union {
 		struct roam_cmd roamCmd;

+ 17 - 4
core/sme/src/csr/csr_api_roam.c

@@ -20055,8 +20055,8 @@ void csr_release_command(tpAniSirGlobal mac_ctx, tSmeCmd *sme_cmd)
 	qdf_mem_zero(&cmd_info,
 			sizeof(struct wlan_serialization_queued_cmd_info));
 
-	sme_debug("filled cmd_id = 0");
-	cmd_info.cmd_id = 0;
+	sme_debug("filled cmd_id = %d", sme_cmd->cmd_id);
+	cmd_info.cmd_id = sme_cmd->cmd_id;
 	cmd_info.req_type = WLAN_SER_CANCEL_NON_SCAN_CMD;
 	cmd_info.cmd_type = csr_get_cmd_type(sme_cmd);
 	cmd_info.vdev = vdev;
@@ -20215,6 +20215,18 @@ enum wlan_serialization_cmd_type csr_get_cmd_type(tSmeCmd *sme_cmd)
 	return cmd_type;
 }
 
+static uint32_t csr_get_monotonous_number(tpAniSirGlobal mac_ctx)
+{
+	uint32_t cmd_id;
+	uint32_t mask = 0x00FFFFFF, prefix = 0x0D000000;
+
+	cmd_id = qdf_atomic_inc_return(&mac_ctx->global_cmd_id);
+	cmd_id = (cmd_id & mask);
+	cmd_id = (cmd_id | prefix);
+
+	return cmd_id;
+}
+
 QDF_STATUS csr_set_serialization_params_to_cmd(tpAniSirGlobal mac_ctx,
 		tSmeCmd *sme_cmd, struct wlan_serialization_command *cmd,
 		uint8_t high_priority)
@@ -20234,8 +20246,9 @@ QDF_STATUS csr_set_serialization_params_to_cmd(tpAniSirGlobal mac_ctx,
 	 * no need to fill command id for non-scan as they will be
 	 * zero always
 	 */
-	sme_debug("cmd_id = 0");
-	cmd->cmd_id = 0;
+	sme_cmd->cmd_id = csr_get_monotonous_number(mac_ctx);
+	cmd->cmd_id = sme_cmd->cmd_id;
+	sme_debug("cmd_id = %d", cmd->cmd_id);
 
 	cmd->cmd_type = csr_get_cmd_type(sme_cmd);
 	sme_debug("filled cmd_type[%d] cmd_id[%d]",

+ 1 - 1
core/sme/src/csr/csr_util.c

@@ -575,7 +575,7 @@ tListElem *csr_nonscan_pending_ll_next(struct sAniSirGlobal *mac_ctx,
 	if (!entry)
 		return NULL;
 	sme_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
-	cmd.cmd_id = 0;
+	cmd.cmd_id = sme_cmd->cmd_id;
 	cmd.cmd_type = csr_get_cmd_type(sme_cmd);
 	cmd.vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc,
 				sme_cmd->sessionId, WLAN_LEGACY_SME_ID);