]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
QCA vendor attribute to indicate NDP interface managemtn using nl80211
authorKiran Kumar Lokere <quic_klokere@quicinc.com>
Thu, 24 Mar 2022 23:57:22 +0000 (16:57 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 1 Apr 2022 15:57:09 +0000 (18:57 +0300)
Add a QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI
flag to indicate that the driver requires add/del virtual interface
path using the generic nl80211 commands for NDP interface create/delete
and to register/unregister of netdev instead of creating/deleting
the NDP interface using vendor commands.

With the latest Linux kernel (5.12 version onward), interface
creation/deletion is not allowed using vendor commands as it leads to a
deadlock while acquiring the RTNL_LOCK during the register/unregister of
netdev. Create and delete NDP interface using NL80211_CMD_NEW_INTERFACE
and NL80211_CMD_DEL_INTERFACE commands respectively if the driver
advertises this capability.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/common/qca-vendor.h

index 22424829eb30868e4f24213263e20b65f512b6a7..5298e9ebcc7ce0ba40af040c50e20be7bbc46c54 100644 (file)
@@ -1599,6 +1599,18 @@ enum qca_wlan_vendor_acs_hw_mode {
  *     synchronous (in vendor command reply) to the request. Each TWT
  *     operation is specifically mentioned (against its respective
  *     documentation) to support either of these or both modes.
+ * @QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI: Flag indicates
+ *     that the driver requires add/del virtual interface path using the
+ *     generic nl80211 commands for NDP interface create/delete and to
+ *     register/unregister the netdev instead of creating/deleting the NDP
+ *     interface using the vendor commands
+ *     QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE and
+ *     QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE. With the latest kernel
+ *     (5.12 version onward), interface creation/deletion is not allowed using
+ *     vendor commands as it leads to a deadlock while acquiring the RTNL_LOCK
+ *     during the register/unregister of netdev. Create and delete NDP
+ *     interface using NL80211_CMD_NEW_INTERFACE and NL80211_CMD_DEL_INTERFACE
+ *     commands respectively if the driver advertises this capability set.
  * @NUM_QCA_WLAN_VENDOR_FEATURES: Number of assigned feature bits
  */
 enum qca_wlan_vendor_features {
@@ -1617,6 +1629,7 @@ enum qca_wlan_vendor_features {
        QCA_WLAN_VENDOR_FEATURE_ADAPTIVE_11R            = 12,
        QCA_WLAN_VENDOR_FEATURE_CONCURRENT_BAND_SESSIONS = 13,
        QCA_WLAN_VENDOR_FEATURE_TWT_ASYNC_SUPPORT       = 14,
+       QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI = 15,
        NUM_QCA_WLAN_VENDOR_FEATURES /* keep last */
 };
 
@@ -7454,9 +7467,24 @@ enum qca_wlan_vendor_attr_ndp_params {
 
 enum qca_wlan_ndp_sub_cmd {
        QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
-       /* Command to create a NAN data path interface */
+       /* Command to create a NAN data path interface.
+        * This command was initially designed to both create and start a NAN
+        * data path interface. However, changes to Linux 5.12 no longer allow
+        * interface creation via vendor commands. When the driver advertises
+        * QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI
+        * userspace must explicitly first create the interface using
+        * NL80211_CMD_NEW_INTERFACE before subsequently invoking this command
+        * to start the interface.
+        */
        QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
-       /* Command to delete a NAN data path interface */
+       /* Command to delete a NAN data path interface.
+        * This command was initially designed to both stop and delete a NAN
+        * data path interface. However, changes to Linux 5.12 no longer allow
+        * interface deletion via vendor commands. When the driver advertises
+        * QCA_WLAN_VENDOR_FEATURE_USE_ADD_DEL_VIRTUAL_INTF_FOR_NDI
+        * userspace must explicitly delete the interface using
+        * NL80211_CMD_DEL_INTERFACE after calling this command.
+        */
        QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
        /* Command to initiate a NAN data path session */
        QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,