diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 186b89189ae9..6d9836165a1c 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1993,6 +1993,18 @@ const char *hdd_get_fwpath(void); void hdd_indicate_mgmt_frame(tSirSmeMgmtFrameInd *frame_ind); hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx, uint32_t sme_session_id); +/** + * hdd_get_adapter_by_iface_name() - Return adapter with given interface name + * @hdd_ctx: hdd context. + * @iface_name: interface name + * + * This function is used to get the adapter with given interface name + * + * Return: adapter pointer if found, NULL otherwise + * + */ +hdd_adapter_t *hdd_get_adapter_by_iface_name(hdd_context_t *hdd_ctx, + const char *iface_name); enum phy_ch_width hdd_map_nl_chan_width(enum nl80211_chan_width ch_width); uint8_t wlan_hdd_find_opclass(tHalHandle hal, uint8_t channel, uint8_t bw_offset); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index f4bbf27a7e4a..343530ed2aed 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4749,6 +4749,31 @@ hdd_adapter_t *hdd_get_adapter_by_sme_session_id(hdd_context_t *hdd_ctx, return NULL; } +hdd_adapter_t *hdd_get_adapter_by_iface_name(hdd_context_t *hdd_ctx, + const char *iface_name) +{ + hdd_adapter_list_node_t *adapter_node = NULL, *next = NULL; + hdd_adapter_t *adapter; + QDF_STATUS qdf_status; + + qdf_status = hdd_get_front_adapter(hdd_ctx, &adapter_node); + + while ((NULL != adapter_node) && + (QDF_STATUS_SUCCESS == qdf_status)) { + adapter = adapter_node->pAdapter; + + if (adapter && + !qdf_str_cmp(adapter->dev->name, iface_name)) + return adapter; + + qdf_status = + hdd_get_next_adapter(hdd_ctx, + adapter_node, &next); + adapter_node = next; + } + return NULL; +} + /** * hdd_get_adapter() - to get adapter matching the mode * @hdd_ctx: hdd context