Browse Source

qcacld-3.0: Get netdev from wdev instead of iface name

Currently driver uses iface name to get netdev when it processes
ndp responder request. There is a possibility that framework does
not know the iface name when it sends the error response.

if driver does not receive iface name it fails to get the netdev
and fails to perform the dsc operation, because of which driver
drops the ndp responder request command.

To address this issue, use wdev to get netdev instead of iface name.

Change-Id: Ie230f19dbd895f81a4730160cbc9a2de3cc3179d
CRs-Fixed: 3136089
Ashish 3 years ago
parent
commit
1b0ec920c5
3 changed files with 20 additions and 18 deletions
  1. 1 1
      core/hdd/src/wlan_hdd_nan_datapath.c
  2. 3 1
      os_if/nan/inc/os_if_nan.h
  3. 16 16
      os_if/nan/src/os_if_nan.c

+ 1 - 1
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -565,7 +565,7 @@ static int __wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
 	}
 
 	return os_if_nan_process_ndp_cmd(hdd_ctx->psoc, data, data_len,
-					 hdd_is_ndp_allowed(hdd_ctx));
+					 hdd_is_ndp_allowed(hdd_ctx), wdev);
 }
 
 /**

+ 3 - 1
os_if/nan/inc/os_if_nan.h

@@ -55,12 +55,14 @@ struct ndi_find_vdev_filter {
  * @data_len: length of data
  * @is_ndp_allowed: Indicates whether to allow NDP creation.
  *		    NDI creation is always allowed.
+ * @wdev: Wireless device structure pointer
  *
  * Return: status of operation
  */
 int os_if_nan_process_ndp_cmd(struct wlan_objmgr_psoc *psoc,
 			      const void *data, int data_len,
-			      bool is_ndp_allowed);
+			      bool is_ndp_allowed,
+			      struct wireless_dev *wdev);
 
 /**
  * os_if_nan_register_hdd_callbacks: os_if api to register hdd callbacks

+ 16 - 16
os_if/nan/src/os_if_nan.c

@@ -756,7 +756,6 @@ static int os_if_nan_process_ndp_initiator_req(struct wlan_objmgr_psoc *psoc,
  * Return: 0 on success or error code on failure
  */
 static int __os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
-						 char *iface_name,
 						 struct nlattr **tb)
 {
 	int ret = 0;
@@ -764,6 +763,8 @@ static int __os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
 	enum nan_datapath_state state;
 	struct wlan_objmgr_vdev *nan_vdev = NULL;
 	struct nan_datapath_responder_req req = {0};
+	char *iface_name;
+	int errno;
 
 	if (!tb[QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE]) {
 		osif_err("ndp_rsp is unavailable");
@@ -772,6 +773,13 @@ static int __os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
 	req.ndp_rsp = nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE]);
 
 	if (req.ndp_rsp == NAN_DATAPATH_RESPONSE_ACCEPT) {
+		errno = osif_nla_str(tb, QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
+				     &iface_name);
+
+		if (errno) {
+			osif_err("NAN data iface not provided");
+			return errno;
+		}
 		/* Check for an existing NAN interface */
 		nan_vdev = os_if_get_ndi_vdev_by_ifname(psoc, iface_name);
 		if (!nan_vdev) {
@@ -899,26 +907,17 @@ responder_req_failed:
 }
 
 static int os_if_nan_process_ndp_responder_req(struct wlan_objmgr_psoc *psoc,
-					       struct nlattr **tb)
+					       struct nlattr **tb,
+					       struct wireless_dev *wdev)
 {
-	struct net_device *net_dev;
 	struct osif_vdev_sync *vdev_sync;
-	char *ifname;
 	int errno;
 
-	errno = osif_nla_str(tb, QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR, &ifname);
-	if (errno)
-		return errno;
-
-	errno = osif_net_dev_from_ifname(psoc, ifname, &net_dev);
-	if (errno)
-		return errno;
-
-	errno = osif_vdev_sync_op_start(net_dev, &vdev_sync);
+	errno = osif_vdev_sync_op_start(wdev->netdev, &vdev_sync);
 	if (errno)
 		return errno;
 
-	errno = __os_if_nan_process_ndp_responder_req(psoc, ifname, tb);
+	errno = __os_if_nan_process_ndp_responder_req(psoc, tb);
 
 	osif_vdev_sync_op_stop(vdev_sync);
 
@@ -1018,7 +1017,8 @@ static int os_if_nan_process_ndp_end_req(struct wlan_objmgr_psoc *psoc,
 
 int os_if_nan_process_ndp_cmd(struct wlan_objmgr_psoc *psoc,
 			      const void *data, int data_len,
-			      bool is_ndp_allowed)
+			      bool is_ndp_allowed,
+			      struct wireless_dev *wdev)
 {
 	uint32_t ndp_cmd_type;
 	uint16_t transaction_id;
@@ -1080,7 +1080,7 @@ int os_if_nan_process_ndp_cmd(struct wlan_objmgr_psoc *psoc,
 			osif_err("Unsupported concurrency for NAN datapath");
 			return -EOPNOTSUPP;
 		}
-		return os_if_nan_process_ndp_responder_req(psoc, tb);
+		return os_if_nan_process_ndp_responder_req(psoc, tb, wdev);
 	case QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST:
 		if (!is_ndp_allowed) {
 			osif_err("Unsupported concurrency for NAN datapath");