wlan: To get correct link speed while multiple clients are there.
When WFD client is connected, return the link speed for first
client connected.
CRs-Fixed: 533928
Change-Id: Ibeab93547f52b381cffe12d638d48a8029735d7b
diff --git a/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h b/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
index ec4a80b..5168123 100644
--- a/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
+++ b/CORE/HDD/inc/wlan_hdd_softap_tx_rx.h
@@ -319,4 +319,14 @@
=========================================================================== */
extern VOS_STATUS hdd_softap_GetStaId( hdd_adapter_t *pAdapter, v_MACADDR_t *pMacAddress, v_U8_t *staId);
+/**============================================================================
+ @brief hdd_softap_GetConnectedStaId - Helper function to get station Id of the connected device
+
+ @param pAdapter : [in] pointer to adapter context
+ @param staId : [out] station id
+ @return : VOS_STATUS_E_FAILURE if any errors encountered
+ : VOS_STATUS_SUCCESS otherwise
+ =========================================================================== */
+extern VOS_STATUS hdd_softap_GetConnectedStaId( hdd_adapter_t *pAdapter, v_U8_t *staId);
+
#endif // end #if !defined( WLAN_HDD_SOFTAP_TX_RX_H )
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index c8dea7c..84f325a 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -3633,13 +3633,26 @@
return valid;
}
- if ( hdd_string_to_hex ((char *)wrqu->data.pointer, wrqu->data.length, macAddress ) )
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s wrqu->data.length= %d\n", __func__, wrqu->data.length);
+ status = hdd_string_to_hex ((char *)wrqu->data.pointer, wrqu->data.length, macAddress );
+
+ if (!VOS_IS_STATUS_SUCCESS(status ))
{
- hddLog(VOS_TRACE_LEVEL_FATAL, FL("ERROR: Command not found"));
- return -EINVAL;
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("String to Hex conversion Failed"));
}
- status = hdd_softap_GetStaId(pHostapdAdapter, (v_MACADDR_t *)macAddress, (void *)(&staId));
+ /* If no mac address is passed and/or its length is less than 18,
+ * link speed for first connected client will be returned.
+ */
+ if (!VOS_IS_STATUS_SUCCESS(status ) || wrqu->data.length < 18)
+ {
+ status = hdd_softap_GetConnectedStaId(pHostapdAdapter, (void *)(&staId));
+ }
+ else
+ {
+ status = hdd_softap_GetStaId(pHostapdAdapter,
+ (v_MACADDR_t *)macAddress, (void *)(&staId));
+ }
if (!VOS_IS_STATUS_SUCCESS(status))
{
diff --git a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
index 6052b58..8111af2 100644
--- a/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_softap_tx_rx.c
@@ -1707,3 +1707,18 @@
return VOS_STATUS_E_FAILURE;
}
+VOS_STATUS hdd_softap_GetConnectedStaId(hdd_adapter_t *pAdapter, v_U8_t *staId)
+{
+ v_U8_t i;
+
+ for (i = 0; i < WLAN_MAX_STA_COUNT; i++)
+ {
+ if (pAdapter->aStaInfo[i].isUsed)
+ {
+ *staId = i;
+ return VOS_STATUS_SUCCESS;
+ }
+ }
+
+ return VOS_STATUS_E_FAILURE;
+}