diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 9476d818d2a5..af241b60a305 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -670,6 +670,9 @@ struct hdd_station_ctx { uint8_t broadcast_ibss_staid; struct hdd_mon_set_ch_info ch_info; +#ifdef WLAN_FEATURE_NAN_DATAPATH + struct nan_datapath_ctx ndp_ctx; +#endif }; #define BSS_STOP 0 @@ -957,9 +960,6 @@ struct hdd_adapter_s { union { hdd_station_ctx_t station; hdd_ap_ctx_t ap; -#ifdef WLAN_FEATURE_NAN_DATAPATH - struct nan_datapath_ctx ndp_ctx; -#endif } sessionCtx; #ifdef WLAN_FEATURE_TSF @@ -1079,13 +1079,15 @@ struct hdd_adapter_s { #endif #ifdef WLAN_FEATURE_NAN_DATAPATH -#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) (&(adapter)->sessionCtx.ndp_ctx) -#define WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter) \ - (&(adapter)->sessionCtx.ndp_ctx.wext_state) +#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) \ + (&(adapter)->sessionCtx.station.ndp_ctx) #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) ((hdd_ctx)->nan_datapath_enabled) #else -#define WLAN_HDD_GET_NDP_CTX_PTR(adapter) (NULL) -#define WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter) (NULL) +/* WLAN_HDD_GET_NDP_CTX_PTR and WLAN_HDD_GET_NDP_WEXT_STATE_PTR are not defined + * intentionally so that all references to these must be within NDP code. + * non-NDP code can call WLAN_HDD_IS_NDP_ENABLED(), and when it is enabled, + * invoke NDP code to do all work. + */ #define WLAN_HDD_IS_NDP_ENABLED(hdd_ctx) (false) #endif diff --git a/core/hdd/src/wlan_hdd_nan_datapath.c b/core/hdd/src/wlan_hdd_nan_datapath.c index c38ccf7303a4..8e4e08c15a57 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.c +++ b/core/hdd/src/wlan_hdd_nan_datapath.c @@ -161,7 +161,7 @@ static int hdd_ndi_start_bss(hdd_adapter_t *adapter, int ret; uint32_t roam_id; hdd_wext_state_t *wext_state = - WLAN_HDD_GET_NDP_WEXT_STATE_PTR(adapter); + WLAN_HDD_GET_WEXT_STATE_PTR(adapter); tCsrRoamProfile *roam_profile = &wext_state->roamProfile; ENTER(); diff --git a/core/hdd/src/wlan_hdd_nan_datapath.h b/core/hdd/src/wlan_hdd_nan_datapath.h index 46ce34edf4c9..9c22a19abf2e 100644 --- a/core/hdd/src/wlan_hdd_nan_datapath.h +++ b/core/hdd/src/wlan_hdd_nan_datapath.h @@ -40,17 +40,6 @@ struct wireless_dev; #define NDP_APP_INFO_LEN 255 #define NDP_QOS_INFO_LEN 255 -#ifdef WLAN_FEATURE_NAN_DATAPATH -#define WLAN_HDD_NDP_GET_SSID(adapter) ( \ - &(adapter)->sessionCtx.ndp_ctx.conn_info.SSID) - -#define WLAN_HDD_NDP_GET_BSSID(adapter) ( \ - &(adapter)->sessionCtx.ndp_ctx.conn_info.bssId) -#else -#define WLAN_HDD_NDP_GET_SSID(adapter) (NULL) -#define WLAN_HDD_NDP_GET_BSSID(adapter) (NULL) -#endif /* WLAN_FEATURE_NAN_DATAPATH */ - /** * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command @@ -182,10 +171,6 @@ enum nan_datapath_state { * @active_ndp_sessions: active ndp sessions per adapter * @ndp_create_transaction_id: transaction id for create req * @ndp_delete_transaction_id: transaction id for delete req - * @wext_state: Wext state variable - * @conn_info: NDP connection info - * @roam_info: NDP roam info - * @gtk_offload_req_params: GTK offload request params * @ndp_key_installed: NDP security key installed * @ndp_enc_key: NDP encryption key info * @ndp_debug_state: debug state info @@ -195,11 +180,6 @@ struct nan_datapath_ctx { uint32_t active_ndp_sessions; uint16_t ndp_create_transaction_id; uint16_t ndp_delete_transaction_id; - hdd_wext_state_t wext_state; - connection_info_t conn_info; -#ifdef WLAN_FEATURE_GTK_OFFLOAD - tSirGtkOffloadParams gtk_offload_req_params; -#endif bool ndp_key_installed; tCsrRoamSetKey ndp_enc_key; uint32_t ndp_debug_state; diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index c2d262a68f38..809176854e26 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -1603,12 +1603,9 @@ void hdd_statistics_cb(void *pStats, void *pContext) void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter) { int i = 0; - hdd_wext_state_t *pWextState; + hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); - if (QDF_NDI_MODE == pAdapter->device_mode) - pWextState = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter); - else - pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); + ENTER(); /* clear WPA/RSN/WSC IE information in the profile */ pWextState->roamProfile.nWPAReqIELength = 0; @@ -1659,7 +1656,7 @@ void hdd_clear_roam_profile_ie(hdd_adapter_t *pAdapter) #endif qdf_zero_macaddr(&pWextState->req_bssId); - + EXIT(); } /** @@ -10875,30 +10872,34 @@ const struct iw_handler_def we_handler_def = { .get_wireless_stats = NULL, }; +/* hdd_set_wext() - configures bss parameters + * @pAdapter: handle to adapter context + * + * Returns: none + */ int hdd_set_wext(hdd_adapter_t *pAdapter) { - hdd_wext_state_t *pwextBuf; - hdd_station_ctx_t *pHddStaCtx; - tCsrSSIDInfo *ssid_list; - struct qdf_mac_addr *bssid; + hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); + hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); - if (QDF_NDI_MODE == pAdapter->device_mode) { - pwextBuf = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter); - ssid_list = WLAN_HDD_NDP_GET_SSID(pAdapter); - bssid = WLAN_HDD_NDP_GET_BSSID(pAdapter); - } else { - pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); - pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); - ssid_list = &pHddStaCtx->conn_info.SSID; - bssid = &pHddStaCtx->conn_info.bssId; + ENTER(); + + if (!pwextBuf) { + hdd_err("ERROR: pwextBuf is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (!pHddStaCtx) { + hdd_err("ERROR: pHddStaCtx is NULL"); + return QDF_STATUS_E_FAILURE; } /* Now configure the roaming profile links. To SSID and bssid. */ pwextBuf->roamProfile.SSIDs.numOfSSIDs = 0; - pwextBuf->roamProfile.SSIDs.SSIDList = ssid_list; + pwextBuf->roamProfile.SSIDs.SSIDList = &pHddStaCtx->conn_info.SSID; pwextBuf->roamProfile.BSSIDs.numOfBSSIDs = 0; - pwextBuf->roamProfile.BSSIDs.bssid = bssid; + pwextBuf->roamProfile.BSSIDs.bssid = &pHddStaCtx->conn_info.bssId; /*Set the numOfChannels to zero to scan all the channels */ pwextBuf->roamProfile.ChannelInfo.numOfChannels = 0; @@ -10927,6 +10928,7 @@ int hdd_set_wext(hdd_adapter_t *pAdapter) hdd_clear_roam_profile_ie(pAdapter); + EXIT(); return QDF_STATUS_SUCCESS; } @@ -10942,15 +10944,15 @@ int hdd_set_wext(hdd_adapter_t *pAdapter) int hdd_register_wext(struct net_device *dev) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); - hdd_wext_state_t *pwextBuf; + hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); QDF_STATUS status; ENTER(); - if (QDF_NDI_MODE == pAdapter->device_mode) - pwextBuf = WLAN_HDD_GET_NDP_WEXT_STATE_PTR(pAdapter); - else - pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); + if (!pwextBuf) { + hdd_err(FL("ERROR: pwextBuf is NULL")); + return QDF_STATUS_E_FAILURE; + } /* Zero the memory. This zeros the profile structure */ memset(pwextBuf, 0, sizeof(hdd_wext_state_t));