Parcourir la source

qcacld-3.0: Convert nl80211 band to reg band

Currently host is sending nl80211 band to get curr
chan list but enum values are different for 6G, so
reg_get_band_from_cur_chan_list may not consider 6G
band even userspace sends 6G band in vendor command.

Fix is to convert nl80211 band to reg band to get correct
usable channel list in case of 6G.

Change-Id: I51b86c5f4f83b764847756a20a911d9b8af75b56
CRs-Fixed: 2973283
sheenam monga il y a 3 ans
Parent
commit
89fa5c4633
1 fichiers modifiés avec 30 ajouts et 3 suppressions
  1. 30 3
      core/hdd/src/wlan_hdd_cfg80211.c

+ 30 - 3
core/hdd/src/wlan_hdd_cfg80211.c

@@ -15522,9 +15522,9 @@ hdd_get_all_band_mask(void)
 {
 	uint32_t band_mask = 0;
 
-	band_mask = (1 << NL80211_BAND_2GHZ) |
-			(1 << NL80211_BAND_5GHZ) |
-			(1 << NL80211_BAND_6GHZ);
+	band_mask = (1 << REG_BAND_2G) |
+			(1 << REG_BAND_5G) |
+			(1 << REG_BAND_6G);
 
 	return band_mask;
 }
@@ -15549,6 +15549,30 @@ hdd_get_all_iface_mode_mask(void)
 	return mode_mask;
 }
 
+/**
+ * hdd_convert_nl80211_to_reg_band_mask() - convert n80211 band to reg band
+ * @band: nl80211 band
+ *
+ * Return: reg band value
+ */
+
+static uint32_t
+hdd_convert_nl80211_to_reg_band_mask(enum nl80211_band band)
+{
+	uint32_t reg_band = 0;
+
+	if (band & 1 << NL80211_BAND_2GHZ)
+		reg_band |= 1 << REG_BAND_2G;
+	if (band & 1 << NL80211_BAND_5GHZ)
+		reg_band |= 1 << REG_BAND_5G;
+	if (band & 1 << NL80211_BAND_6GHZ)
+		reg_band |= 1 << REG_BAND_6G;
+	if (band & 1 << NL80211_BAND_60GHZ)
+		hdd_err("band: %d not supported", NL80211_BAND_60GHZ);
+
+	return reg_band;
+}
+
 /**
  * __wlan_hdd_cfg80211_get_usable_channel() - get chain rssi
  * @wiphy: wiphy pointer
@@ -15599,6 +15623,9 @@ static int __wlan_hdd_cfg80211_get_usable_channel(struct wiphy *wiphy,
 		nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_BAND_MASK]);
 		if (!req_msg.band_mask)
 			req_msg.band_mask = hdd_get_all_band_mask();
+		else
+			req_msg.band_mask =
+			hdd_convert_nl80211_to_reg_band_mask(req_msg.band_mask);
 	}
 	if (!tb[QCA_WLAN_VENDOR_ATTR_USABLE_CHANNELS_IFACE_MODE_MASK]) {
 		hdd_err("iface mode mask not present");