summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <naveenrawat@codeaurora.org>2017-04-12 10:09:17 -0700
committerspuligil <spuligil@codeaurora.org>2017-04-15 12:50:03 -0700
commit721829695fdf00bb7250dcdf8997c3b66bd31d19 (patch)
treee93837a13c6f54889a467a4e30122e8c60c78267
parent4e343c3961fac56ffec3845d64fd902ec57f8b02 (diff)
qcacld-3.0: Define API to retrieve adapter by interface name
Define HDD API to get adapter by interface name. This will be used in NDI + NDI and similar scenarios. Change-Id: Icd7fb7c60c67e73aa030752b2e6840853a242fc9 CRs-Fixed: 2032704
-rw-r--r--core/hdd/inc/wlan_hdd_main.h12
-rw-r--r--core/hdd/src/wlan_hdd_main.c25
2 files changed, 37 insertions, 0 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h
index 94bf859cc44e..c5221124b411 100644
--- a/core/hdd/inc/wlan_hdd_main.h
+++ b/core/hdd/inc/wlan_hdd_main.h
@@ -2071,6 +2071,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 e30d59891369..5089ee6d1ae4 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -4518,6 +4518,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