wifi: ath11k: change interface combination for P2P mode
authorKang Yang <quic_kangyang@quicinc.com>
Wed, 28 Feb 2024 09:35:32 +0000 (17:35 +0800)
committerKalle Valo <quic_kvalo@quicinc.com>
Thu, 14 Mar 2024 16:41:23 +0000 (18:41 +0200)
Current interface combination doesn't support P2P mode.

So change it for P2P mode.

Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37
Tested-on: QCA2066 hw2.1 PCI WLAN.HSP.1.1-03926.13-QCAHSPSWPL_V2_SILICONZ_CE-2.52297.2

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/20240228093537.25052-2-quic_kangyang@quicinc.com
drivers/net/wireless/ath/ath11k/mac.c

index 42a6a51a6a9d31083a1d7a30bb1dc94dba724d23..8842e590df48847617ec6c2301a793d6db0948cf 100644 (file)
@@ -9850,12 +9850,18 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar)
        struct ieee80211_iface_combination *combinations;
        struct ieee80211_iface_limit *limits;
        int n_limits;
+       bool p2p;
+
+       p2p = ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_P2P_DEVICE);
 
        combinations = kzalloc(sizeof(*combinations), GFP_KERNEL);
        if (!combinations)
                return -ENOMEM;
 
-       n_limits = 2;
+       if (p2p)
+               n_limits = 3;
+       else
+               n_limits = 2;
 
        limits = kcalloc(n_limits, sizeof(*limits), GFP_KERNEL);
        if (!limits) {
@@ -9863,39 +9869,29 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar)
                return -ENOMEM;
        }
 
+       limits[0].types |= BIT(NL80211_IFTYPE_STATION);
+       limits[1].types |= BIT(NL80211_IFTYPE_AP);
+       if (IS_ENABLED(CONFIG_MAC80211_MESH) &&
+           ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
+               limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT);
+
+       combinations[0].limits = limits;
+       combinations[0].n_limits = n_limits;
+       combinations[0].beacon_int_infra_match = true;
+       combinations[0].beacon_int_min_gcd = 100;
+
        if (ab->hw_params.support_dual_stations) {
                limits[0].max = 2;
-               limits[0].types |= BIT(NL80211_IFTYPE_STATION);
-
                limits[1].max = 1;
-               limits[1].types |= BIT(NL80211_IFTYPE_AP);
-               if (IS_ENABLED(CONFIG_MAC80211_MESH) &&
-                   ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
-                       limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT);
 
-               combinations[0].limits = limits;
-               combinations[0].n_limits = 2;
                combinations[0].max_interfaces = ab->hw_params.num_vdevs;
                combinations[0].num_different_channels = 2;
-               combinations[0].beacon_int_infra_match = true;
-               combinations[0].beacon_int_min_gcd = 100;
        } else {
                limits[0].max = 1;
-               limits[0].types |= BIT(NL80211_IFTYPE_STATION);
-
                limits[1].max = 16;
-               limits[1].types |= BIT(NL80211_IFTYPE_AP);
-
-               if (IS_ENABLED(CONFIG_MAC80211_MESH) &&
-                   ab->hw_params.interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
-                       limits[1].types |= BIT(NL80211_IFTYPE_MESH_POINT);
 
-               combinations[0].limits = limits;
-               combinations[0].n_limits = 2;
                combinations[0].max_interfaces = 16;
                combinations[0].num_different_channels = 1;
-               combinations[0].beacon_int_infra_match = true;
-               combinations[0].beacon_int_min_gcd = 100;
                combinations[0].radar_detect_widths = BIT(NL80211_CHAN_WIDTH_20_NOHT) |
                                                        BIT(NL80211_CHAN_WIDTH_20) |
                                                        BIT(NL80211_CHAN_WIDTH_40) |
@@ -9904,6 +9900,13 @@ static int ath11k_mac_setup_iface_combinations(struct ath11k *ar)
                                                        BIT(NL80211_CHAN_WIDTH_160);
        }
 
+       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);
+       }
+
        ar->hw->wiphy->iface_combinations = combinations;
        ar->hw->wiphy->n_iface_combinations = 1;