diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 254cc82157520..f509544aa9a2b 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -5433,11 +5433,11 @@ QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr) } struct linkspeed_priv { - tSirLinkSpeedInfo linkspeed_info; + struct link_speed_info linkspeed_info; }; static void -hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *context) +hdd_get_link_speed_cb(struct link_speed_info *linkspeed_info, void *context) { struct osif_request *request; struct linkspeed_priv *priv; @@ -5466,7 +5466,7 @@ int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter, int ret; QDF_STATUS status; void *cookie; - tSirLinkSpeedInfo *linkspeed_info; + struct link_speed_info *linkspeed_info; struct osif_request *request; struct linkspeed_priv *priv; static const struct osif_request_params params = { diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 04cc22fa70140..acbd04f9bfcd7 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2670,11 +2670,11 @@ typedef struct sSirChAvoidUpdateReq { } tSirChAvoidUpdateReq; #endif /* FEATURE_WLAN_CH_AVOID */ -typedef struct sSirLinkSpeedInfo { +struct link_speed_info { /* MAC Address for the peer */ struct qdf_mac_addr peer_macaddr; uint32_t estLinkSpeed; /* Linkspeed from firmware */ -} tSirLinkSpeedInfo, *tpSirLinkSpeedInfo; +}; /** * struct sir_peer_info_req - peer info request struct diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 735c1fbb039db..c71758eec277b 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -946,11 +946,22 @@ QDF_STATUS sme_init_thermal_info(mac_handle_t mac_handle); QDF_STATUS sme_set_thermal_level(mac_handle_t mac_handle, uint8_t level); QDF_STATUS sme_txpower_limit(mac_handle_t mac_handle, tSirTxPowerLimit *psmetx); + +/** + * sme_get_link_speed() - Retrieve current link speed + * @mac_handle: Global MAC handle + * @req: Link speed request structure + * @context: User context to be passed back when invoking @cb + * @cb: Callback function to be invoked with link speed results + * + * Return: QDF_STATUS_SUCCESS if the request was accepted, otherwise + * an appropriate error status. + */ QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, - tSirLinkSpeedInfo *lsReq, - void *plsContext, - void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, - void *pContext)); + struct link_speed_info *req, + void *context, + sme_link_speed_cb cb); + QDF_STATUS sme_modify_add_ie(mac_handle_t mac_handle, tSirModifyIE *pModifyIE, eUpdateIEsType updateType); QDF_STATUS sme_update_add_ie(mac_handle_t mac_handle, diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 77b3d1464df73..55feca21ed5da 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -129,6 +129,18 @@ typedef void (*link_layer_stats_cb)(hdd_handle_t hdd_handle, typedef void (*ext_scan_ind_cb)(hdd_handle_t hdd_handle, const uint16_t, void *); +/** + * typedef sme_link_speed_cb - sme_get_link_speed() callback function + * @info: link speed information + * @context: user context supplied to sme_get_link_speed() + * + * This is the signature of a callback function whose addresses is + * passed as the asynchronous callback function to sme_get_link_speed(). + */ + +typedef void (*sme_link_speed_cb)(struct link_speed_info *info, + void *context); + typedef void (*ocb_callback)(void *context, void *response); typedef void (*sme_set_thermal_level_callback)(hdd_handle_t hdd_handle, u_int8_t level); @@ -273,9 +285,8 @@ typedef struct tagSmeStruct { stats_ext_cb stats_ext_cb; stats_ext2_cb stats_ext2_cb; /* linkspeed callback */ - void (*pLinkSpeedIndCb)(tSirLinkSpeedInfo *indParam, - void *pDevContext); - void *pLinkSpeedCbContext; + sme_link_speed_cb link_speed_cb; + void *link_speed_context; /* get peer info callback */ void (*pget_peer_info_ind_cb)(struct sir_peer_info_resp *param, void *pcontext); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 0d1efbe923429..ac0c7746cef3c 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -7237,17 +7237,16 @@ bool sme_is_feature_supported_by_fw(enum cap_bitmap feature) return IS_FEATURE_SUPPORTED_BY_FW(feature); } -QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq, - void *plsContext, - void (*pCallbackfn)(tSirLinkSpeedInfo *indParam, - void *pContext)) +QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, + struct link_speed_info *req, + void *context, + sme_link_speed_cb cb) { - - QDF_STATUS status = QDF_STATUS_SUCCESS; + QDF_STATUS status; struct mac_context *mac; void *wma_handle; - if (!mac_handle || !pCallbackfn || !lsReq) { + if (!mac_handle || !cb || !req) { QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, FL("Invalid parameter")); return QDF_STATUS_E_FAILURE; @@ -7267,9 +7266,9 @@ QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq, return QDF_STATUS_E_FAILURE; } - mac->sme.pLinkSpeedCbContext = plsContext; - mac->sme.pLinkSpeedIndCb = pCallbackfn; - status = wma_get_link_speed(wma_handle, lsReq); + mac->sme.link_speed_context = context; + mac->sme.link_speed_cb = cb; + status = wma_get_link_speed(wma_handle, req); sme_release_global_lock(&mac->sme); return status; } diff --git a/core/wma/inc/wma_api.h b/core/wma/inc/wma_api.h index 7257a4a30af7c..b6cd01b35fc1c 100644 --- a/core/wma/inc/wma_api.h +++ b/core/wma/inc/wma_api.h @@ -148,7 +148,8 @@ void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb); QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr, uint32_t param_id, uint32_t param_value, uint32_t vdev_id); -QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed); +QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, + struct link_speed_info *pLinkSpeed); #ifdef NOT_YET QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info); #endif diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index c17a1c9718e6b..97eb95d664446 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -805,7 +805,8 @@ WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width, * * Return: QDF status */ -QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed) +QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, + struct link_speed_info *pLinkSpeed) { tp_wma_handle wma_handle = (tp_wma_handle) handle; wmi_mac_addr peer_macaddr; diff --git a/core/wma/src/wma_utils.c b/core/wma/src/wma_utils.c index cb1f0b12b09ff..b6c8fc8c52b0a 100644 --- a/core/wma/src/wma_utils.c +++ b/core/wma/src/wma_utils.c @@ -3470,7 +3470,7 @@ int wma_peer_info_event_handler(void *handle, u_int8_t *cmd_param_info, QDF_STATUS wma_send_link_speed(uint32_t link_speed) { struct mac_context *mac_ctx; - tSirLinkSpeedInfo *ls_ind; + struct link_speed_info *ls_ind; mac_ctx = cds_get_context(QDF_MODULE_ID_PE); if (!mac_ctx) { @@ -3478,16 +3478,16 @@ QDF_STATUS wma_send_link_speed(uint32_t link_speed) return QDF_STATUS_E_INVAL; } - ls_ind = qdf_mem_malloc(sizeof(tSirLinkSpeedInfo)); + ls_ind = qdf_mem_malloc(sizeof(*ls_ind)); if (!ls_ind) return QDF_STATUS_E_NOMEM; ls_ind->estLinkSpeed = link_speed; - if (mac_ctx->sme.pLinkSpeedIndCb) - mac_ctx->sme.pLinkSpeedIndCb(ls_ind, - mac_ctx->sme.pLinkSpeedCbContext); + if (mac_ctx->sme.link_speed_cb) + mac_ctx->sme.link_speed_cb(ls_ind, + mac_ctx->sme.link_speed_context); else - WMA_LOGD("%s: pLinkSpeedIndCb is null", __func__); + WMA_LOGD("%s: link_speed_cb is null", __func__); qdf_mem_free(ls_ind); return QDF_STATUS_SUCCESS;