qcacld-3.0: HDD clean up for CDP API cdp_register_peer
Currently, the cdp API cdp_register_peer takes as input the sta_id. As a
part of cleaning up the usage of sta_id, replace it by peer mac address.
Change-Id: I0e92258777aff02940dd619c4d2ad784aa3e7f31
CRs-Fixed: 2502996
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 7d98804..c28c7e2 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -2102,7 +2102,7 @@
struct bss_description *bss_desc)
{
QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
- struct ol_txrx_desc_type txrx_desc = { 0 };
+ struct ol_txrx_desc_type txrx_desc = {0};
struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
struct ol_txrx_ops txrx_ops;
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
@@ -2113,6 +2113,7 @@
/* Get the Station ID from the one saved during the association */
txrx_desc.sta_id = sta_id;
+ WLAN_ADDR_COPY(txrx_desc.peer_addr.bytes, roam_info->bssid.bytes);
/* set the QoS field appropriately */
if (hdd_wmm_is_active(adapter))
@@ -4075,7 +4076,7 @@
* TDLS sta in BSS should be set as STA type TDLS and STA MAC should
* be peer MAC, here we are working on direct Link
*/
- txrx_desc.sta_id = sta_id;
+ WLAN_ADDR_COPY(txrx_desc.peer_addr.bytes, peerMac);
/* set the QoS field appropriately .. */
txrx_desc.is_qos_enabled = qos;
diff --git a/core/hdd/src/wlan_hdd_ocb.c b/core/hdd/src/wlan_hdd_ocb.c
index 72d11cd..61dc0fd 100644
--- a/core/hdd/src/wlan_hdd_ocb.c
+++ b/core/hdd/src/wlan_hdd_ocb.c
@@ -218,6 +218,7 @@
struct ol_txrx_desc_type sta_desc = {0};
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
struct hdd_station_ctx *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+ /* To be cleaned up */
uint8_t peer_id;
struct ol_txrx_ops txrx_ops;
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
@@ -239,7 +240,9 @@
hdd_ctx->sta_to_adapter[peer_id] = adapter;
+ /* To be cleaned up */
sta_desc.sta_id = peer_id;
+ WLAN_ADDR_COPY(sta_desc.peer_addr.bytes, adapter->mac_addr.bytes);
sta_desc.is_qos_enabled = 1;
/* Register the vdev transmit and receive functions */
diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c
index 4224d6e..25bc858 100644
--- a/core/hdd/src/wlan_hdd_softap_tx_rx.c
+++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c
@@ -44,6 +44,7 @@
#include "wlan_ipa_ucfg_api.h"
#include "wlan_policy_mgr_ucfg.h"
#include <wma_types.h>
+#include <sap_internal.h>
/* Preprocessor definitions and constants */
#undef QCA_HDD_SAP_DUMP_SK_BUFF
@@ -1058,16 +1059,21 @@
bool wmm_enabled)
{
QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE;
- struct ol_txrx_desc_type txrx_desc = { 0 };
+ struct ol_txrx_desc_type txrx_desc = {0};
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
struct ol_txrx_ops txrx_ops;
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
void *pdev = cds_get_context(QDF_MODULE_ID_TXRX);
struct cdp_vdev *txrx_vdev = NULL;
+ struct hdd_ap_ctx *ap_ctx;
hdd_info("STA:%u, Auth:%u, Priv:%u, WMM:%u",
sta_id, auth_required, privacy_required, wmm_enabled);
+ ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
+ if (!ap_ctx)
+ hdd_err("Invalid AP context");
+
if (sta_id >= WLAN_MAX_STA_COUNT) {
hdd_err("Error: Invalid sta_id: %u", sta_id);
return qdf_status;
@@ -1084,6 +1090,16 @@
/* Get the Station ID from the one saved during the association. */
txrx_desc.sta_id = sta_id;
+ /*
+ * If the address is a broadcast address, then provide the self mac addr
+ * to the data path. Else provide the mac address of the connected peer.
+ */
+ if (qdf_is_macaddr_broadcast(sta_mac) && ap_ctx)
+ qdf_copy_macaddr(&txrx_desc.peer_addr,
+ &ap_ctx->sap_context->bssid);
+ else
+ qdf_copy_macaddr(&txrx_desc.peer_addr, sta_mac);
+
/* Save the adapter Pointer for this sta_id */
hdd_ctx->sta_to_adapter[sta_id] = adapter;
@@ -1185,7 +1201,6 @@
struct qdf_mac_addr broadcast_macaddr = QDF_MAC_ADDR_BCAST_INIT;
struct hdd_ap_ctx *ap_ctx;
uint8_t sta_id;
-
ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(adapter);
sta_id = ap_ctx->broadcast_sta_id;