wifi: ath12k: change interface combination for P2P mode
authorKang Yang <quic_kangyang@quicinc.com>
Mon, 5 Feb 2024 17:03:27 +0000 (19:03 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 7 Feb 2024 15:06:58 +0000 (17:06 +0200)
Current interface combination doesn't support P2P mode. Change the
combination for P2P mode.

Also, there is a bug that when mesh is enabled but ap is not enabled.
In this situation, the mesh's max_interface of interface combination
won't be set.

So assign the max_interfaces for mesh directly.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Kang Yang <quic_kangyang@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://msgid.link/20240130040303.370590-4-quic_kangyang@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index 078dda43dded318a852ad15726dfceec9b77518e..f2920a3401c652c631a1854f4ebbea428472e9cc 100644 (file)
@@ -7539,9 +7539,10 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah)
        struct ieee80211_iface_combination *combinations;
        struct ieee80211_iface_limit *limits;
        int n_limits, max_interfaces;
-       bool ap, mesh;
+       bool ap, mesh, p2p;
 
        ap = ath12k_mac_is_iface_mode_enable(ah, NL80211_IFTYPE_AP);
+       p2p = ath12k_mac_is_iface_mode_enable(ah, NL80211_IFTYPE_P2P_DEVICE);
 
        mesh = IS_ENABLED(CONFIG_MAC80211_MESH) &&
                ath12k_mac_is_iface_mode_enable(ah, NL80211_IFTYPE_MESH_POINT);
@@ -7550,9 +7551,15 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah)
        if (!combinations)
                return -ENOMEM;
 
-       if (ap || mesh) {
+       if ((ap || mesh) && !p2p) {
                n_limits = 2;
                max_interfaces = 16;
+       } else if (p2p) {
+               n_limits = 3;
+               if (ap || mesh)
+                       max_interfaces = 16;
+               else
+                       max_interfaces = 3;
        } else {
                n_limits = 1;
                max_interfaces = 1;
@@ -7567,14 +7574,22 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k_hw *ah)
        limits[0].max = 1;
        limits[0].types |= BIT(NL80211_IFTYPE_STATION);
 
-       if (ap) {
+       if (ap || mesh || p2p)
                limits[1].max = max_interfaces;
+
+       if (ap)
                limits[1].types |= BIT(NL80211_IFTYPE_AP);
-       }
 
        if (mesh)
                limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT);
 
+       if (p2p) {
+               limits[1].types |= BIT(NL80211_IFTYPE_P2P_CLIENT) |
+                                  BIT(NL80211_IFTYPE_P2P_GO);
+               limits[2].max = 1;
+               limits[2].types |= BIT(NL80211_IFTYPE_P2P_DEVICE);
+       }
+
        combinations[0].limits = limits;
        combinations[0].n_limits = n_limits;
        combinations[0].max_interfaces = max_interfaces;