Browse Source

qcacmn: Update TDLS opclass correctly to FW

Due to change in Opclass calculation in the new
regulatory component invalid opclass is returned for the
TDLS component. Update arguments to calculate opclass correctly
to regulatory component.

Change-Id: I062bbb55d283f9525da241d32177e26d07aa8590
CRs-Fixed: 2325834
Bala Venkatesh 6 years ago
parent
commit
a670c5cc1d

+ 6 - 4
umac/tdls/core/src/wlan_tdls_ct.c

@@ -979,17 +979,19 @@ int tdls_set_tdls_secoffchanneloffset(struct tdls_soc_priv_obj *tdls_soc,
 
 	switch (offchanoffset) {
 	case TDLS_SEC_OFFCHAN_OFFSET_0:
-		tdls_soc->tdls_channel_offset = (1 << BW_20_OFFSET_BIT);
+		tdls_soc->tdls_channel_offset = BW20;
 		break;
 	case TDLS_SEC_OFFCHAN_OFFSET_40PLUS:
+		tdls_soc->tdls_channel_offset = BW40_LOW_PRIMARY;
+		break;
 	case TDLS_SEC_OFFCHAN_OFFSET_40MINUS:
-		tdls_soc->tdls_channel_offset = (1 << BW_40_OFFSET_BIT);
+		tdls_soc->tdls_channel_offset = BW40_LOW_PRIMARY;
 		break;
 	case TDLS_SEC_OFFCHAN_OFFSET_80:
-		tdls_soc->tdls_channel_offset = (1 << BW_80_OFFSET_BIT);
+		tdls_soc->tdls_channel_offset = BW80;
 		break;
 	case TDLS_SEC_OFFCHAN_OFFSET_160:
-		tdls_soc->tdls_channel_offset = (1 << BW_160_OFFSET_BIT);
+		tdls_soc->tdls_channel_offset = BWALL;
 		break;
 	default:
 		tdls_err("Invalid tdls secondary off channel offset %d",

+ 1 - 1
umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h

@@ -1140,7 +1140,7 @@ struct tdls_set_offchanmode {
  */
 struct tdls_set_secoffchanneloffset {
 	struct wlan_objmgr_vdev *vdev;
-	uint8_t offchan_offset;
+	int offchan_offset;
 	tdls_offchan_parms_callback callback;
 };
 

+ 41 - 1
wmi/src/wmi_unified_tlv.c

@@ -10272,11 +10272,49 @@ static uint8_t tdls_get_wmi_offchannel_mode(uint8_t tdls_sw_mode)
 	}
 	return off_chan_mode;
 }
+
+/**
+ * tdls_get_wmi_offchannel_bw - Get WMI tdls off channel Bandwidth
+ * @tdls_sw_mode: tdls_sw_mode
+ *
+ * This function returns wmi tdls offchannel bandwidth
+ *
+ * Return: TDLS offchannel bandwidth
+ */
+static uint8_t tdls_get_wmi_offchannel_bw(uint16_t tdls_off_ch_bw_offset)
+{
+	uint8_t off_chan_bw;
+
+	switch (tdls_off_ch_bw_offset) {
+	case BW20:
+		off_chan_bw = WMI_TDLS_OFFCHAN_20MHZ;
+		break;
+	case BW40_LOW_PRIMARY:
+	case BW40_HIGH_PRIMARY:
+		off_chan_bw = WMI_TDLS_OFFCHAN_40MHZ;
+		break;
+	case BW80:
+		off_chan_bw = WMI_TDLS_OFFCHAN_80MHZ;
+	case BWALL:
+		off_chan_bw = WMI_TDLS_OFFCHAN_160MHZ;
+	default:
+		WMI_LOGD(FL("unknown tdls_offchannel bw offset %d"),
+			 off_chan_bw);
+		off_chan_bw = WMI_TDLS_OFFCHAN_20MHZ;
+	}
+	return off_chan_bw;
+}
+
 #else
 static uint8_t tdls_get_wmi_offchannel_mode(uint8_t tdls_sw_mode)
 {
 	return WMI_TDLS_DISABLE_OFFCHANNEL;
 }
+
+static uint8_t tdls_get_wmi_offchannel_bw(uint16_t tdls_off_ch_bw_offset)
+{
+	return WMI_TDLS_OFFCHAN_20MHZ;
+}
 #endif
 
 /**
@@ -10314,7 +10352,9 @@ static QDF_STATUS send_set_tdls_offchan_mode_cmd_tlv(wmi_unified_t wmi_handle,
 		tdls_get_wmi_offchannel_mode(chan_switch_params->tdls_sw_mode);
 	cmd->is_peer_responder = chan_switch_params->is_responder;
 	cmd->offchan_num = chan_switch_params->tdls_off_ch;
-	cmd->offchan_bw_bitmap = chan_switch_params->tdls_off_ch_bw_offset;
+	cmd->offchan_bw_bitmap =
+		tdls_get_wmi_offchannel_bw(
+			chan_switch_params->tdls_off_ch_bw_offset);
 	cmd->offchan_oper_class = chan_switch_params->oper_class;
 
 	WMI_LOGD(FL("Peer MAC Addr mac_addr31to0: 0x%x, mac_addr47to32: 0x%x"),