Browse Source

qcacld-3.0: Update get bandwidth output without set bandwidth

When connect to an AP and if we don't set bandwidth, use get
bandwidth cmd and the result is zero. Fetch the bandwidth from
vdev->vdev_mlme.bss_chan which also will update in the process
of connection.

Change-Id: I94db0d841e127e18632f8b45d9c4e0d11ee04b16
CRs-Fixed: 3593807
Chunquan Luo 1 year ago
parent
commit
4d559d84f7
1 changed files with 15 additions and 9 deletions
  1. 15 9
      core/hdd/src/wlan_hdd_cfg80211.c

+ 15 - 9
core/hdd/src/wlan_hdd_cfg80211.c

@@ -12227,23 +12227,29 @@ static int hdd_get_rx_amsdu(struct wlan_hdd_link_info *link_info,
 static int hdd_get_channel_width(struct wlan_hdd_link_info *link_info,
 				 struct sk_buff *skb, const struct nlattr *attr)
 {
-	enum eSirMacHTChannelWidth chwidth;
 	uint8_t nl80211_chwidth;
+	struct wlan_channel *bss_chan;
+	struct wlan_objmgr_vdev *vdev;
 
-	chwidth = wma_cli_get_command(link_info->vdev_id,
-				      wmi_vdev_param_chwidth, VDEV_CMD);
-	if (chwidth < 0) {
-		hdd_err("Failed to get chwidth");
+	vdev = hdd_objmgr_get_vdev_by_user(link_info, WLAN_OSIF_ID);
+	if (!vdev)
 		return -EINVAL;
+
+
+	bss_chan = wlan_vdev_mlme_get_bss_chan(vdev);
+	if (!bss_chan) {
+		hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
+		hdd_err("get bss_chan failed");
+		return QDF_STATUS_E_FAILURE;
 	}
 
-	nl80211_chwidth = hdd_chwidth_to_nl80211_chwidth(chwidth);
-	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_WIDTH,
-		       nl80211_chwidth)) {
-		hdd_err("nla_put failure");
+	nl80211_chwidth = hdd_phy_chwidth_to_nl80211_chwidth(bss_chan->ch_width);
+	if (nla_put_u8(skb, CONFIG_CHANNEL_WIDTH, nl80211_chwidth)) {
+		hdd_err("nla_put chn width failure");
 		return -EINVAL;
 	}
 
+	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
 	return 0;
 }