Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b57b6842 authored by hangtian's avatar hangtian
Browse files

qcacld-3.0: Fix cfg80211_ops.set_tx_power invalid bssid issue

Fix cfg80211_ops.set_tx_power invalid bssid issue. User could set
txpower via cfg80211 interface.

Change-Id: Ie103a45e426b920846b8e4d23c4995ce660dde70
CRs-Fixed: 2468749
parent 7f1a2a95
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -15695,6 +15695,7 @@ int wlan_hdd_cfg80211_init(struct device *dev,
#endif
#endif
	wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER;
	wiphy->features |= NL80211_FEATURE_INACTIVITY_TIMER;
	wiphy->features |= NL80211_FEATURE_VIF_TXPOWER;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) || \
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) || \
	defined(CFG80211_BEACON_TX_RATE_CUSTOM_BACKPORT)
	defined(CFG80211_BEACON_TX_RATE_CUSTOM_BACKPORT)
	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
	wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_BEACON_RATE_LEGACY);
+17 −2
Original line number Original line Diff line number Diff line
@@ -2048,8 +2048,9 @@ static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
{
{
	struct hdd_context *hdd_ctx = (struct hdd_context *) wiphy_priv(wiphy);
	struct hdd_context *hdd_ctx = (struct hdd_context *) wiphy_priv(wiphy);
	mac_handle_t mac_handle;
	mac_handle_t mac_handle;
	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(wdev->netdev);
	struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT;
	struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT;
	struct qdf_mac_addr selfMac = QDF_MAC_ADDR_BCAST_INIT;
	struct qdf_mac_addr selfmac;
	QDF_STATUS status;
	QDF_STATUS status;
	int errno;
	int errno;
	int dbm;
	int dbm;
@@ -2069,6 +2070,20 @@ static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
	if (errno)
	if (errno)
		return errno;
		return errno;


	if (adapter->device_mode == QDF_SAP_MODE ||
	    adapter->device_mode == QDF_P2P_GO_MODE) {
		qdf_copy_macaddr(&bssid, &adapter->mac_addr);
	} else {
		struct hdd_station_ctx *sta_ctx =
			WLAN_HDD_GET_STATION_CTX_PTR(adapter);

		if (eConnectionState_Associated ==
		    sta_ctx->conn_info.connState)
			qdf_copy_macaddr(&bssid, &sta_ctx->conn_info.bssId);
	}

	qdf_copy_macaddr(&selfmac, &adapter->mac_addr);

	mac_handle = hdd_ctx->mac_handle;
	mac_handle = hdd_ctx->mac_handle;


	dbm = MBM_TO_DBM(mbm);
	dbm = MBM_TO_DBM(mbm);
@@ -2097,7 +2112,7 @@ static int __wlan_hdd_cfg80211_set_txpower(struct wiphy *wiphy,
	/* Fall through */
	/* Fall through */
	case NL80211_TX_POWER_LIMITED:
	case NL80211_TX_POWER_LIMITED:
	/* Limit TX power by the mBm parameter */
	/* Limit TX power by the mBm parameter */
		status = sme_set_max_tx_power(mac_handle, bssid, selfMac, dbm);
		status = sme_set_max_tx_power(mac_handle, bssid, selfmac, dbm);
		if (QDF_IS_STATUS_ERROR(status)) {
		if (QDF_IS_STATUS_ERROR(status)) {
			hdd_err("Setting maximum tx power failed, %d", status);
			hdd_err("Setting maximum tx power failed, %d", status);
			return -EIO;
			return -EIO;