瀏覽代碼

qcacld-3.0: Update channel bandwidth value described in the attribute

Update channel bandwidth value enum in nl80211_chan_width which
described by vendor attribute QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_WIDTH.

CRs-Fixed: 3605833
Change-Id: I2ec4debe271ded93bba2c7403d3dbc9b084bf917
Chunquan Luo 1 年之前
父節點
當前提交
edcdc5f925
共有 3 個文件被更改,包括 34 次插入14 次删除
  1. 8 0
      core/hdd/inc/wlan_hdd_main.h
  2. 12 14
      core/hdd/src/wlan_hdd_cfg80211.c
  3. 14 0
      core/hdd/src/wlan_hdd_main.c

+ 8 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -5245,6 +5245,14 @@ hdd_nl80211_chwidth_to_chwidth(uint8_t nl80211_chwidth);
  */
 uint8_t hdd_chwidth_to_nl80211_chwidth(enum eSirMacHTChannelWidth chwidth);
 
+/**
+ * hdd_phy_chwidth_to_nl80211_chwidth() - Get nl chan width from phy chan width
+ * @chwidth: enum phy_ch_width
+ *
+ * Return: enum nl80211_chan_width or 0xFF for unsupported phy chan width
+ */
+uint8_t hdd_phy_chwidth_to_nl80211_chwidth(enum phy_ch_width chwidth);
+
 /**
  * wlan_hdd_get_channel_bw() - get channel bandwidth
  * @width: input channel width in nl80211_chan_width value

+ 12 - 14
core/hdd/src/wlan_hdd_cfg80211.c

@@ -10915,6 +10915,7 @@ static int hdd_set_channel_width(struct wlan_hdd_link_info *link_info,
 	struct nlattr *curr_attr;
 	struct nlattr *chn_bd = NULL;
 	struct nlattr *mlo_link_id;
+	enum eSirMacHTChannelWidth chwidth;
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MLO_LINKS])
 		goto skip_mlo;
@@ -10960,15 +10961,17 @@ skip_mlo:
 
 	nl80211_chwidth = nla_get_u8(chn_bd);
 
-	if (nl80211_chwidth < eHT_CHANNEL_WIDTH_20MHZ ||
-	    nl80211_chwidth > eHT_MAX_CHANNEL_WIDTH) {
-		hdd_err("Invalid channel width");
+set_chan_width:
+	chwidth = hdd_nl80211_chwidth_to_chwidth(nl80211_chwidth);
+
+	if (chwidth < eHT_CHANNEL_WIDTH_20MHZ ||
+	    chwidth > eHT_MAX_CHANNEL_WIDTH) {
+		hdd_err("Invalid channel width %u", chwidth);
 		return -EINVAL;
 	}
 
-set_chan_width:
 	return hdd_set_mac_chan_width(link_info->adapter,
-				      nl80211_chwidth, link_id);
+				      chwidth, link_id);
 }
 
 /**
@@ -12263,6 +12266,7 @@ static int hdd_get_mlo_max_band_info(struct wlan_hdd_link_info *link_info,
 	uint32_t link_id = 0;
 	struct wlan_objmgr_vdev *vdev, *link_vdev;
 	struct wlan_channel *bss_chan;
+	uint8_t nl80211_chwidth;
 
 	chwidth = wma_cli_get_command(link_info->vdev_id,
 				      wmi_vdev_param_chwidth, VDEV_CMD);
@@ -12275,14 +12279,7 @@ static int hdd_get_mlo_max_band_info(struct wlan_hdd_link_info *link_info,
 	if (!vdev)
 		return -EINVAL;
 
-	if (!wlan_vdev_mlme_is_mlo_vdev(vdev)) {
-		bss_chan = wlan_vdev_mlme_get_bss_chan(vdev);
-
-		if (nla_put_u8(skb, CONFIG_CHANNEL_WIDTH,
-			       (uint8_t)bss_chan->ch_width)) {
-			hdd_err("nla_put chn width failure");
-		}
-	} else {
+	if (wlan_vdev_mlme_is_mlo_vdev(vdev)) {
 		mlo_bd_info = nla_nest_start(skb, CONFIG_MLO_LINKS);
 		for (link_id = 0; link_id < WLAN_MAX_LINK_ID; link_id++) {
 			link_vdev = mlo_get_vdev_by_link_id(vdev, link_id);
@@ -12310,8 +12307,9 @@ static int hdd_get_mlo_max_band_info(struct wlan_hdd_link_info *link_info,
 				return -EINVAL;
 			}
 
+			nl80211_chwidth = hdd_phy_chwidth_to_nl80211_chwidth(bss_chan->ch_width);
 			if (nla_put_u8(skb, CONFIG_CHANNEL_WIDTH,
-				       (uint8_t)bss_chan->ch_width)) {
+				       nl80211_chwidth)) {
 				hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
 				mlo_release_vdev_ref(link_vdev);
 				hdd_err("nla_put failure");

+ 14 - 0
core/hdd/src/wlan_hdd_main.c

@@ -21389,6 +21389,20 @@ uint8_t hdd_chwidth_to_nl80211_chwidth(enum eSirMacHTChannelWidth chwidth)
 	return 0xFF;
 }
 
+uint8_t hdd_phy_chwidth_to_nl80211_chwidth(enum phy_ch_width chwidth)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(chwidth_info); i++) {
+		if (chwidth_info[i].sir_chwidth_valid &&
+		    chwidth_info[i].phy_chwidth == chwidth)
+			return i;
+	}
+
+	hdd_err("Unsupported channel width %d", chwidth);
+	return 0xFF;
+}
+
 enum hw_mode_bandwidth wlan_hdd_get_channel_bw(enum nl80211_chan_width width)
 {
 	if (width >= ARRAY_SIZE(chwidth_info)) {