Răsfoiți Sursa

qcacmn: Converge on struct tdls_peer_update_state

As part of the original TDLS componentization the legacy typedef
tTdlsPeerStateParams was replicated as qca-wifi-host-cmn struct
tdls_peer_state_params. Subsequently when the TDLS component was
relocated back to qcacld-3.0 this struct was replicated again as
struct tdls_peer_update_state in the qcacld-3.0 TDLS public structs.
Unfortunately this left the driver with three different data
structures which serve the same purpose. Not only is this pointless,
but due to the way in which these structures are used there is an
implicit requirement that they be exactly identical. Further
complicating matters is the fact that these three structures each have
embedded structs which are also replicated. This approach is very
fragile since any change to any of these structs must be replicated
across the entire set. To align with the converged software
architecture and to improve code maintainability exclusively use the
TDLS public structs.

Change-Id: Ifc976815fea57afae86cc91b91c6b48f70b2a9a7
CRs-Fixed: 2395340
Jeff Johnson 6 ani în urmă
părinte
comite
1d002854d3

+ 1 - 1
wmi/inc/wmi_unified_priv.h

@@ -939,7 +939,7 @@ QDF_STATUS (*send_update_fw_tdls_state_cmd)(wmi_unified_t wmi_handle,
 					    enum wmi_tdls_state tdls_state);
 
 QDF_STATUS (*send_update_tdls_peer_state_cmd)(wmi_unified_t wmi_handle,
-				struct tdls_peer_state_params *peerStateParams,
+				struct tdls_peer_update_state *peer_state,
 				uint32_t *ch_mhz);
 
 QDF_STATUS (*extract_vdev_tdls_ev_param)(wmi_unified_t wmi_handle,

+ 3 - 3
wmi/inc/wmi_unified_sta_api.h

@@ -197,12 +197,12 @@ QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(void *wmi_hdl,
 /**
  * wmi_unified_update_tdls_peer_state_cmd() - update TDLS peer state
  * @wmi_handle: wmi handle
- * @peerStateParams: TDLS peer state params
+ * @peer_state: TDLS peer state params
  *
  * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
  */
-QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(void *wmi_hdl,
-				struct tdls_peer_state_params *peerStateParams,
+QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(wmi_unified_t wmi_handle,
+				struct tdls_peer_update_state *peer_state,
 				uint32_t *ch_mhz);
 
 /**

+ 0 - 65
wmi/inc/wmi_unified_sta_param.h

@@ -99,73 +99,8 @@ struct wlm_latency_level_param {
 	uint16_t vdev_id;
 };
 
-#define WMI_TDLS_MAX_SUPP_CHANNELS       128
-#define WMI_TDLS_MAX_SUPP_OPER_CLASSES   32
 #define WMI_2_4_GHZ_MAX_FREQ  3000
 
-/**
- * struct tdls_update_ch_params - channel parameters
- * @chanId: ID of the channel
- * @pwr: power level
- * @dfsSet: is dfs supported or not
- * @half_rate: is the channel operating at 10MHz
- * @quarter_rate: is the channel operating at 5MHz
- */
-struct tdls_update_ch_params {
-	uint8_t chanId;
-	uint8_t pwr;
-	bool dfsSet;
-	bool half_rate;
-	bool quarter_rate;
-};
-
-/**
- * struct tdls_peer_cap_params - TDLS peer capablities parameters
- * @isPeerResponder: is peer responder or not
- * @peerUapsdQueue: peer uapsd queue
- * @peerMaxSp: peer max SP value
- * @peerBuffStaSupport: peer buffer sta supported or not
- * @peerOffChanSupport: peer offchannel support
- * @peerCurrOperClass: peer current operating class
- * @selfCurrOperClass: self current operating class
- * @peerChanLen: peer channel length
- * @peerChan: peer channel list
- * @peerOperClassLen: peer operating class length
- * @peerOperClass: peer operating class
- * @prefOffChanNum: peer offchannel number
- * @prefOffChanBandwidth: peer offchannel bandwidth
- * @opClassForPrefOffChan: operating class for offchannel
- */
-struct tdls_peer_cap_params {
-	uint8_t isPeerResponder;
-	uint8_t peerUapsdQueue;
-	uint8_t peerMaxSp;
-	uint8_t peerBuffStaSupport;
-	uint8_t peerOffChanSupport;
-	uint8_t peerCurrOperClass;
-	uint8_t selfCurrOperClass;
-	uint8_t peerChanLen;
-	struct tdls_update_ch_params peerChan[WMI_TDLS_MAX_SUPP_CHANNELS];
-	uint8_t peerOperClassLen;
-	uint8_t peerOperClass[WMI_TDLS_MAX_SUPP_OPER_CLASSES];
-	uint8_t prefOffChanNum;
-	uint8_t prefOffChanBandwidth;
-	uint8_t opClassForPrefOffChan;
-};
-
-/**
- * struct tdls_peer_state_params - TDLS peer state parameters
- * @vdevId: vdev id
- * @peerMacAddr: peer mac address
- * @peerCap: peer capabality
- */
-struct tdls_peer_state_params {
-	uint32_t vdevId;
-	uint8_t peerMacAddr[IEEE80211_ADDR_LEN];
-	uint32_t peerState;
-	struct tdls_peer_cap_params peerCap;
-};
-
 /**
  * struct vdev_ie_info_param - IE info
  * @vdev_id - vdev for which the IE is being sent

+ 4 - 6
wmi/src/wmi_unified_sta_api.c

@@ -173,15 +173,13 @@ QDF_STATUS wmi_unified_update_fw_tdls_state_cmd(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
-QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(void *wmi_hdl,
-			       struct tdls_peer_state_params *peerStateParams,
-				   uint32_t *ch_mhz)
+QDF_STATUS wmi_unified_update_tdls_peer_state_cmd(wmi_unified_t wmi_handle,
+				struct tdls_peer_update_state *peer_state,
+				uint32_t *ch_mhz)
 {
-	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
-
 	if (wmi_handle->ops->send_update_tdls_peer_state_cmd)
 		return wmi_handle->ops->send_update_tdls_peer_state_cmd(wmi_handle,
-			    peerStateParams, ch_mhz);
+			    peer_state, ch_mhz);
 
 	return QDF_STATUS_E_FAILURE;
 }

+ 42 - 48
wmi/src/wmi_unified_sta_tlv.c

@@ -722,14 +722,17 @@ send_update_fw_tdls_state_cmd_tlv(wmi_unified_t wmi_handle,
 /**
  * send_update_tdls_peer_state_cmd_tlv() - update TDLS peer state
  * @wmi_handle: wmi handle
- * @peerStateParams: TDLS peer state params
+ * @peer_state: TDLS peer state params
  *
  * Return: QDF_STATUS_SUCCESS for success or error code
  */
-static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
-			       struct tdls_peer_state_params *peerStateParams,
-				   uint32_t *ch_mhz)
+static QDF_STATUS
+send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
+				    struct tdls_peer_update_state *peer_state,
+				    uint32_t *ch_mhz)
 {
+	struct tdls_peer_params *in_peer_cap;
+	struct tdls_ch_params *in_chan_info;
 	wmi_tdls_peer_update_cmd_fixed_param *cmd;
 	wmi_tdls_peer_capabilities *peer_cap;
 	wmi_channel *chan_info;
@@ -739,8 +742,9 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 	int32_t len = sizeof(wmi_tdls_peer_update_cmd_fixed_param) +
 		      sizeof(wmi_tdls_peer_capabilities);
 
+	in_peer_cap = &peer_state->peer_cap;
 	len += WMI_TLV_HDR_SIZE +
-	       sizeof(wmi_channel) * peerStateParams->peerCap.peerChanLen;
+	       sizeof(wmi_channel) * in_peer_cap->peer_chanlen;
 
 	wmi_buf = wmi_buf_alloc(wmi_handle, len);
 	if (!wmi_buf) {
@@ -754,16 +758,16 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 		       WMITLV_GET_STRUCT_TLVLEN
 			       (wmi_tdls_peer_update_cmd_fixed_param));
 
-	cmd->vdev_id = peerStateParams->vdevId;
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(peerStateParams->peerMacAddr,
+	cmd->vdev_id = peer_state->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_state->peer_macaddr,
 				   &cmd->peer_macaddr);
 
-	cmd->peer_state = peerStateParams->peerState;
+	cmd->peer_state = peer_state->peer_state;
 
-	WMI_LOGD("%s: vdev_id: %d, peerStateParams->peerMacAddr: %pM, "
+	WMI_LOGD("%s: vdev_id: %d, peermac: %pM, "
 		 "peer_macaddr.mac_addr31to0: 0x%x, "
 		 "peer_macaddr.mac_addr47to32: 0x%x, peer_state: %d",
-		 __func__, cmd->vdev_id, peerStateParams->peerMacAddr,
+		 __func__, cmd->vdev_id, peer_state->peer_macaddr,
 		 cmd->peer_macaddr.mac_addr31to0,
 		 cmd->peer_macaddr.mac_addr47to32, cmd->peer_state);
 
@@ -773,49 +777,41 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 		       WMITLV_TAG_STRUC_wmi_tdls_peer_capabilities,
 		       WMITLV_GET_STRUCT_TLVLEN(wmi_tdls_peer_capabilities));
 
-	if ((peerStateParams->peerCap.peerUapsdQueue & 0x08) >> 3)
+	if ((in_peer_cap->peer_uapsd_queue & 0x08) >> 3)
 		WMI_SET_TDLS_PEER_VO_UAPSD(peer_cap);
-	if ((peerStateParams->peerCap.peerUapsdQueue & 0x04) >> 2)
+	if ((in_peer_cap->peer_uapsd_queue & 0x04) >> 2)
 		WMI_SET_TDLS_PEER_VI_UAPSD(peer_cap);
-	if ((peerStateParams->peerCap.peerUapsdQueue & 0x02) >> 1)
+	if ((in_peer_cap->peer_uapsd_queue & 0x02) >> 1)
 		WMI_SET_TDLS_PEER_BK_UAPSD(peer_cap);
-	if (peerStateParams->peerCap.peerUapsdQueue & 0x01)
+	if (in_peer_cap->peer_uapsd_queue & 0x01)
 		WMI_SET_TDLS_PEER_BE_UAPSD(peer_cap);
 
 	/* Ack and More Data Ack are sent as 0, so no need to set
 	 * but fill SP
 	 */
-	WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap,
-				   peerStateParams->peerCap.peerMaxSp);
-
-	peer_cap->buff_sta_support =
-		peerStateParams->peerCap.peerBuffStaSupport;
-	peer_cap->off_chan_support =
-		peerStateParams->peerCap.peerOffChanSupport;
-	peer_cap->peer_curr_operclass =
-		peerStateParams->peerCap.peerCurrOperClass;
+	WMI_SET_TDLS_PEER_SP_UAPSD(peer_cap, in_peer_cap->peer_max_sp);
+
+	peer_cap->buff_sta_support = in_peer_cap->peer_buff_sta_support;
+	peer_cap->off_chan_support = in_peer_cap->peer_off_chan_support;
+	peer_cap->peer_curr_operclass = in_peer_cap->peer_curr_operclass;
 	/* self curr operclass is not being used and so pass op class for
 	 * preferred off chan in it.
 	 */
-	peer_cap->self_curr_operclass =
-		peerStateParams->peerCap.opClassForPrefOffChan;
-	peer_cap->peer_chan_len = peerStateParams->peerCap.peerChanLen;
-	peer_cap->peer_operclass_len =
-		peerStateParams->peerCap.peerOperClassLen;
+	peer_cap->self_curr_operclass = in_peer_cap->opclass_for_prefoffchan;
+	peer_cap->peer_chan_len = in_peer_cap->peer_chanlen;
+	peer_cap->peer_operclass_len = in_peer_cap->peer_oper_classlen;
 
 	WMI_LOGD("%s: peer_operclass_len: %d",
 		 __func__, peer_cap->peer_operclass_len);
 	for (i = 0; i < WMI_TDLS_MAX_SUPP_OPER_CLASSES; i++) {
-		peer_cap->peer_operclass[i] =
-			peerStateParams->peerCap.peerOperClass[i];
+		peer_cap->peer_operclass[i] = in_peer_cap->peer_oper_class[i];
 		WMI_LOGD("%s: peer_operclass[%d]: %d",
 			 __func__, i, peer_cap->peer_operclass[i]);
 	}
 
-	peer_cap->is_peer_responder = peerStateParams->peerCap.isPeerResponder;
-	peer_cap->pref_offchan_num = peerStateParams->peerCap.prefOffChanNum;
-	peer_cap->pref_offchan_bw =
-		peerStateParams->peerCap.prefOffChanBandwidth;
+	peer_cap->is_peer_responder = in_peer_cap->is_peer_responder;
+	peer_cap->pref_offchan_num = in_peer_cap->pref_off_channum;
+	peer_cap->pref_offchan_bw = in_peer_cap->pref_off_chan_bandwidth;
 
 	WMI_LOGD
 		("%s: peer_qos: 0x%x, buff_sta_support: %d, off_chan_support: %d, "
@@ -833,10 +829,12 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 	WMITLV_SET_HDR(buf_ptr,
 		       WMITLV_TAG_ARRAY_STRUC,
 		       sizeof(wmi_channel) *
-		       peerStateParams->peerCap.peerChanLen);
+		       in_peer_cap->peer_chanlen);
+
 	chan_info = (wmi_channel *) (buf_ptr + WMI_TLV_HDR_SIZE);
+	in_chan_info = in_peer_cap->peer_chan;
 
-	for (i = 0; i < peerStateParams->peerCap.peerChanLen; ++i) {
+	for (i = 0; i < in_peer_cap->peer_chanlen; ++i) {
 		WMITLV_SET_HDR(&chan_info->tlv_header,
 			       WMITLV_TAG_STRUC_wmi_channel,
 			       WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
@@ -846,11 +844,11 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 
 		WMI_LOGD("%s: chan[%d] = %u", __func__, i, chan_info->mhz);
 
-		if (peerStateParams->peerCap.peerChan[i].dfsSet) {
+		if (in_chan_info->dfs_set) {
 			WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_PASSIVE);
-			WMI_LOGI("chan[%d] DFS[%d]\n",
-				 peerStateParams->peerCap.peerChan[i].chanId,
-				 peerStateParams->peerCap.peerChan[i].dfsSet);
+			WMI_LOGI("chan[%d] DFS[%d]",
+				 in_chan_info->chan_id,
+				 in_chan_info->dfs_set);
 		}
 
 		if (chan_info->mhz < WMI_2_4_GHZ_MAX_FREQ)
@@ -858,17 +856,13 @@ static QDF_STATUS send_update_tdls_peer_state_cmd_tlv(wmi_unified_t wmi_handle,
 		else
 			WMI_SET_CHANNEL_MODE(chan_info, MODE_11A);
 
-		WMI_SET_CHANNEL_MAX_TX_POWER(chan_info,
-					     peerStateParams->peerCap.
-					     peerChan[i].pwr);
-
-		WMI_SET_CHANNEL_REG_POWER(chan_info,
-					  peerStateParams->peerCap.peerChan[i].
-					  pwr);
+		WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, in_chan_info->pwr);
+		WMI_SET_CHANNEL_REG_POWER(chan_info, in_chan_info->pwr);
 		WMI_LOGD("Channel TX power[%d] = %u: %d", i, chan_info->mhz,
-			 peerStateParams->peerCap.peerChan[i].pwr);
+			 in_chan_info->pwr);
 
 		chan_info++;
+		in_chan_info++;
 	}
 
 	wmi_mtrace(WMI_TDLS_PEER_UPDATE_CMDID, cmd->vdev_id, 0);