浏览代码

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
Naveen Rawat 8 年之前
父节点
当前提交
4edb682f08
共有 2 个文件被更改,包括 37 次插入0 次删除
  1. 12 0
      core/hdd/inc/wlan_hdd_main.h
  2. 25 0
      core/hdd/src/wlan_hdd_main.c

+ 12 - 0
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);

+ 25 - 0
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