Browse Source

qcacld-3.0: Handle error condition when NDI start fail

Older versions of kernel (<5.12) support the interface creation
through vendor command. But newer versions of kernel (>5.12) expect
the NDI interface creation to happen in two phases due to RTNL lock
removal for the vendor commands.
1. Create an interface through add_virtual_intf in STA mode
2. Change the mode to NDI through vendor command.
Currently, if NDI start fails due to some reason (like vdev creation
unsuccessful), then driver tries to close the adapter for newer kernel
version (>=5.12) as well which causes crash in driver.
For kernel version (>=5.12), userspace handles the interface deletion,
so, close the adapter only when userspace provides the interface delete
cmd.

So, to fix this for the new kernel version, do not close the adapter

Change-Id: Ia11405823cf264eb3f2d81f67571c9e6e2fbff69
CRs-Fixed: 3601352
Rahul Gusain 1 year ago
parent
commit
237202b610
1 changed files with 22 additions and 1 deletions
  1. 22 1
      core/hdd/src/wlan_hdd_nan_datapath.c

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

@@ -68,6 +68,27 @@ void hdd_nan_datapath_target_config(struct hdd_context *hdd_ctx,
 		  tgt_cfg->nan_datapath_enabled);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
+/**
+ * hdd_close_ndi_adapter() - close the adapter
+ * @hdd_ctx: pointer to HDD context
+ * @adapter: adapter context
+ * @value: true or false
+ *
+ * Returns: void
+ */
+static void hdd_close_ndi_adapter(struct hdd_context *hdd_ctx,
+				  struct hdd_adapter *adapter, bool value)
+{
+}
+#else
+static void hdd_close_ndi_adapter(struct hdd_context *hdd_ctx,
+				  struct hdd_adapter *adapter, bool value)
+{
+	hdd_close_adapter(hdd_ctx, adapter, value);
+}
+#endif
+
 /**
  * hdd_close_ndi() - close NAN Data interface
  * @adapter: adapter context
@@ -101,7 +122,7 @@ static int hdd_close_ndi(struct hdd_adapter *adapter)
 
 	adapter->is_virtual_iface = true;
 	/* We are good to close the adapter */
-	hdd_close_adapter(hdd_ctx, adapter, true);
+	hdd_close_ndi_adapter(hdd_ctx, adapter, true);
 
 	hdd_exit();
 	return 0;