Jelajahi Sumber

qcacmn: Enable support for multiple NAN Data Interfaces

Enable support for multiple nan data interfaces. The usespace
may need to create multiple NDIs depending on whether it
requires IP isolation or not.

Change-Id: I4391f2efdc6bdede52a73915531d39dd7798c39d
CRs-Fixed: 2072501
Naveen Rawat 7 tahun lalu
induk
melakukan
5d1f85ccb8
1 mengubah file dengan 17 tambahan dan 7 penghapusan
  1. 17 7
      src/os_if_nan.c

+ 17 - 7
src/os_if_nan.c

@@ -140,7 +140,7 @@ static int os_if_nan_process_ndi_delete(struct wlan_objmgr_psoc *psoc,
 		return -EINVAL;
 	}
 
-	nan_vdev = ucfg_nan_get_ndi_vdev(psoc, WLAN_NAN_ID);
+	nan_vdev = wlan_util_get_vdev_by_ifname(psoc, iface_name, WLAN_NAN_ID);
 	if (!nan_vdev) {
 		cfg80211_err("Nan datapath interface is not present");
 		return -EINVAL;
@@ -151,9 +151,8 @@ static int os_if_nan_process_ndi_delete(struct wlan_objmgr_psoc *psoc,
 	vdev_id = wlan_vdev_get_id(nan_vdev);
 	num_peers = ucfg_nan_get_active_peers(nan_vdev);
 	/*
-	 * wlan_objmgr_get_vdev_by_opmode_from_psoc API will have incremented
-	 * ref count - decrement here since vdev returned by that api is not
-	 * used any more
+	 * wlan_util_get_vdev_by_ifname increments ref count
+	 * decrement here since vdev returned by that api is not used any more
 	 */
 	wlan_objmgr_vdev_release_ref(nan_vdev, WLAN_NAN_ID);
 
@@ -272,12 +271,17 @@ static int os_if_nan_process_ndp_initiator_req(struct wlan_objmgr_psoc *psoc,
 	}
 
 	iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]);
-	nan_vdev = ucfg_nan_get_ndi_vdev(psoc, WLAN_NAN_ID);
+	nan_vdev = wlan_util_get_vdev_by_ifname(psoc, iface_name, WLAN_NAN_ID);
 	if (!nan_vdev) {
 		cfg80211_err("NAN data interface %s not available", iface_name);
 		return -EINVAL;
 	}
 
+	if (nan_vdev->vdev_mlme.vdev_opmode != QDF_NDI_MODE) {
+		cfg80211_err("Interface found is not NDI");
+		return -EINVAL;
+	}
+
 	state = ucfg_nan_get_ndi_state(nan_vdev);
 	if (state == NAN_DATA_NDI_DELETED_STATE ||
 	    state == NAN_DATA_NDI_DELETING_STATE ||
@@ -401,12 +405,17 @@ static int os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
 
 	iface_name = nla_data(tb[QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR]);
 	/* Check if there is already an existing NAN interface */
-	nan_vdev = ucfg_nan_get_ndi_vdev(psoc, WLAN_NAN_ID);
+	nan_vdev = wlan_util_get_vdev_by_ifname(psoc, iface_name, WLAN_NAN_ID);
 	if (!nan_vdev) {
 		cfg80211_err("NAN data interface %s not available", iface_name);
 		return -EINVAL;
 	}
 
+	if (nan_vdev->vdev_mlme.vdev_opmode != QDF_NDI_MODE) {
+		cfg80211_err("Interface found is not NDI");
+		return -EINVAL;
+	}
+
 	state = ucfg_nan_get_ndi_state(nan_vdev);
 	if (state == NAN_DATA_NDI_DELETED_STATE ||
 	    state == NAN_DATA_NDI_DELETING_STATE ||
@@ -526,7 +535,8 @@ static int os_if_nan_process_ndp_end_req(struct wlan_objmgr_psoc *psoc,
 	cfg80211_debug("sending ndp_end_req to SME, transaction_id: %d",
 		req.transaction_id);
 
-	nan_vdev = ucfg_nan_get_ndi_vdev(psoc, WLAN_NAN_ID);
+	nan_vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(psoc, QDF_NDI_MODE,
+							    WLAN_NAN_ID);
 	if (!nan_vdev) {
 		cfg80211_err("NAN data interface is not available");
 		return -EINVAL;