]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: Add a new version for mac config command
authorYedidya Benshimol <yedidya.ben.shimol@intel.com>
Tue, 6 May 2025 19:40:51 +0000 (22:40 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Fri, 9 May 2025 12:36:10 +0000 (15:36 +0300)
Add a new version of mac configuration command
which includes UHR support indication.

Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
Link: https://patch.msgid.link/20250506194102.3407967-5-miriam.rachel.korenblit@intel.com
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/mac-cfg.h
drivers/net/wireless/intel/iwlwifi/mld/iface.c
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac.c

index 58690bb6577d56c163e166d34a8c2de79d3703bb..53b7340ef8a1d4b8a122408c5296c4e6bbe228de 100644 (file)
@@ -310,9 +310,42 @@ enum iwl_mac_config_filter_flags {
        MAC_CFG_FILTER_ACCEPT_PROBE_REQ         = BIT(5),
 }; /* MAC_FILTER_FLAGS_MASK_E_VER_1 */
 
+/**
+ * struct iwl_mac_wifi_gen_support_v2 - parameters of iwl_mac_config_cmd
+ *     with support up to eht as in version 2 of the command
+ *
+ * @he_support: does this MAC support HE
+ * @he_ap_support: HE AP enabled, "pseudo HE", no trigger frame handling
+ * @eht_support: does this MAC support EHT. Requires he_support
+ */
+struct iwl_mac_wifi_gen_support_v2 {
+       __le16 he_support;
+       __le16 he_ap_support;
+       __le32 eht_support;
+} __packed;
+
+/**
+ * struct iwl_mac_wifi_gen_support - parameters of iwl_mac_config_cmd
+ *     with support up to uhr as in version 3 of the command
+ * ( MAC_CONTEXT_CONFIG_CMD = 0x8 )
+ *
+ * @he_support: does this MAC support HE
+ * @he_ap_support: HE AP enabled, "pseudo HE", no trigger frame handling
+ * @eht_support: does this MAC support EHT. Requires he_support
+ * @uhr_support: does this MAC support UHR. Requires eht_support
+ * @reserved: reserved for alignment and to match version 2's size
+ */
+struct iwl_mac_wifi_gen_support {
+       u8 he_support;
+       u8 he_ap_support;
+       u8 eht_support;
+       u8 uhr_support;
+       __le32 reserved;
+} __packed;
+
 /**
  * struct iwl_mac_config_cmd - command structure to configure MAC contexts in
- *     MLD API
+ *     MLD API for versions 2 and 3
  * ( MAC_CONTEXT_CONFIG_CMD = 0x8 )
  *
  * @id_and_color: ID and color of the MAC
@@ -321,9 +354,8 @@ enum iwl_mac_config_filter_flags {
  * @local_mld_addr: mld address
  * @reserved_for_local_mld_addr: reserved
  * @filter_flags: combination of &enum iwl_mac_config_filter_flags
- * @he_support: does this MAC support HE
- * @he_ap_support: HE AP enabled, "pseudo HE", no trigger frame handling
- * @eht_support: does this MAC support EHT. Requires he_support
+ * @wifi_gen_v2: he/eht parameters as in cmd version 2
+ * @wifi_gen: he/eht/uhr parameters as in cmd version 3
  * @nic_not_ack_enabled: mark that the NIC doesn't support receiving
  *     ACK-enabled AGG, (i.e. both BACK and non-BACK frames in single AGG).
  *     If the NIC is not ACK_ENABLED it may use the EOF-bit in first non-0
@@ -332,7 +364,6 @@ enum iwl_mac_config_filter_flags {
  * @p2p_dev: mac data for p2p device
  */
 struct iwl_mac_config_cmd {
-       /* COMMON_INDEX_HDR_API_S_VER_1 */
        __le32 id_and_color;
        __le32 action;
        /* MAC_CONTEXT_TYPE_API_E */
@@ -340,16 +371,17 @@ struct iwl_mac_config_cmd {
        u8 local_mld_addr[6];
        __le16 reserved_for_local_mld_addr;
        __le32 filter_flags;
-       __le16 he_support;
-       __le16 he_ap_support;
-       __le32 eht_support;
+       union {
+               struct iwl_mac_wifi_gen_support_v2 wifi_gen_v2;
+               struct iwl_mac_wifi_gen_support wifi_gen;
+       };
        __le32 nic_not_ack_enabled;
        /* MAC_CONTEXT_CONFIG_SPECIFIC_DATA_API_U_VER_2 */
        union {
                struct iwl_mac_client_data client;
                struct iwl_mac_p2p_dev_data p2p_dev;
        };
-} __packed; /* MAC_CONTEXT_CONFIG_CMD_API_S_VER_2 */
+} __packed; /* MAC_CONTEXT_CONFIG_CMD_API_S_VER_2_VER_3 */
 
 /**
  * enum iwl_link_ctx_modify_flags - indicate to the fw what fields are being
index 47b5b31b5b9173e51b21fae04e5ca506df6e77dd..c083ba416d403d8b37c0a5374bb4c1c6ad04829b 100644 (file)
@@ -103,6 +103,24 @@ static bool iwl_mld_is_nic_ack_enabled(struct iwl_mld *mld,
                               IEEE80211_HE_MAC_CAP2_ACK_EN);
 }
 
+static void iwl_mld_set_he_support(struct iwl_mld *mld,
+                                  struct ieee80211_vif *vif,
+                                  struct iwl_mac_config_cmd *cmd,
+                                  int cmd_ver)
+{
+       if (vif->type == NL80211_IFTYPE_AP) {
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.he_ap_support = cpu_to_le16(1);
+               else
+                       cmd->wifi_gen.he_ap_support = 1;
+       } else {
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.he_support = cpu_to_le16(1);
+               else
+                       cmd->wifi_gen.he_support = 1;
+       }
+}
+
 /* fill the common part for all interface types */
 static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld,
                                        struct ieee80211_vif *vif,
@@ -112,6 +130,9 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld,
        struct iwl_mld_vif *mld_vif = iwl_mld_vif_from_mac80211(vif);
        struct ieee80211_bss_conf *link_conf;
        unsigned int link_id;
+       int cmd_ver = iwl_fw_lookup_cmd_ver(mld->fw,
+                                           WIDE_ID(MAC_CONF_GROUP,
+                                                   MAC_CONFIG_CMD), 0);
 
        lockdep_assert_wiphy(mld->wiphy);
 
@@ -138,12 +159,11 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld,
         * and enable both when we have MLO.
         */
        if (ieee80211_vif_is_mld(vif)) {
-               if (vif->type == NL80211_IFTYPE_AP)
-                       cmd->he_ap_support = cpu_to_le16(1);
+               iwl_mld_set_he_support(mld, vif, cmd, cmd_ver);
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.eht_support = cpu_to_le32(1);
                else
-                       cmd->he_support = cpu_to_le16(1);
-
-               cmd->eht_support = cpu_to_le32(1);
+                       cmd->wifi_gen.eht_support = 1;
                return;
        }
 
@@ -151,10 +171,7 @@ static void iwl_mld_mac_cmd_fill_common(struct iwl_mld *mld,
                if (!link_conf->he_support)
                        continue;
 
-               if (vif->type == NL80211_IFTYPE_AP)
-                       cmd->he_ap_support = cpu_to_le16(1);
-               else
-                       cmd->he_support = cpu_to_le16(1);
+               iwl_mld_set_he_support(mld, vif, cmd, cmd_ver);
 
                /* EHT, if supported, was already set above */
                break;
index bb7851042177a20dee5160019e7e1d1e0e80d294..81ca9ff67be96192b35f07fa01d6a4ec505a0a46 100644 (file)
@@ -1,17 +1,25 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2022 - 2024 Intel Corporation
+ * Copyright (C) 2022 - 2025 Intel Corporation
  */
 #include "mvm.h"
 
 static void iwl_mvm_mld_set_he_support(struct iwl_mvm *mvm,
                                       struct ieee80211_vif *vif,
-                                      struct iwl_mac_config_cmd *cmd)
+                                      struct iwl_mac_config_cmd *cmd,
+                                      int cmd_ver)
 {
-       if (vif->type == NL80211_IFTYPE_AP)
-               cmd->he_ap_support = cpu_to_le16(1);
-       else
-               cmd->he_support = cpu_to_le16(1);
+       if (vif->type == NL80211_IFTYPE_AP) {
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.he_ap_support = cpu_to_le16(1);
+               else
+                       cmd->wifi_gen.he_ap_support = 1;
+       } else {
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.he_support = cpu_to_le16(1);
+               else
+                       cmd->wifi_gen.he_support = 1;
+       }
 }
 
 static void iwl_mvm_mld_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
@@ -22,6 +30,12 @@ static void iwl_mvm_mld_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
        struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
        struct ieee80211_bss_conf *link_conf;
        unsigned int link_id;
+       int cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
+                                           WIDE_ID(MAC_CONF_GROUP,
+                                                   MAC_CONFIG_CMD), 0);
+
+       if (WARN_ON(cmd_ver < 1 && cmd_ver > 3))
+               return;
 
        cmd->id_and_color = cpu_to_le32(mvmvif->id);
        cmd->action = cpu_to_le32(action);
@@ -30,8 +44,8 @@ static void iwl_mvm_mld_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
 
        memcpy(cmd->local_mld_addr, vif->addr, ETH_ALEN);
 
-       cmd->he_support = 0;
-       cmd->eht_support = 0;
+       cmd->wifi_gen_v2.he_support = 0;
+       cmd->wifi_gen_v2.eht_support = 0;
 
        /* should be set by specific context type handler */
        cmd->filter_flags = 0;
@@ -51,8 +65,11 @@ static void iwl_mvm_mld_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
         * and enable both when we have MLO.
         */
        if (ieee80211_vif_is_mld(vif)) {
-               iwl_mvm_mld_set_he_support(mvm, vif, cmd);
-               cmd->eht_support = cpu_to_le32(1);
+               iwl_mvm_mld_set_he_support(mvm, vif, cmd, cmd_ver);
+               if (cmd_ver == 2)
+                       cmd->wifi_gen_v2.eht_support = cpu_to_le32(1);
+               else
+                       cmd->wifi_gen.eht_support = 1;
                return;
        }
 
@@ -63,16 +80,19 @@ static void iwl_mvm_mld_mac_ctxt_cmd_common(struct iwl_mvm *mvm,
                        continue;
 
                if (link_conf->he_support)
-                       iwl_mvm_mld_set_he_support(mvm, vif, cmd);
+                       iwl_mvm_mld_set_he_support(mvm, vif, cmd, cmd_ver);
 
-               /* it's not reasonable to have EHT without HE and FW API doesn't
+               /* It's not reasonable to have EHT without HE and FW API doesn't
                 * support it. Ignore EHT in this case.
                 */
                if (!link_conf->he_support && link_conf->eht_support)
                        continue;
 
                if (link_conf->eht_support) {
-                       cmd->eht_support = cpu_to_le32(1);
+                       if (cmd_ver == 2)
+                               cmd->wifi_gen_v2.eht_support = cpu_to_le32(1);
+                       else
+                               cmd->wifi_gen.eht_support = 1;
                        break;
                }
        }