]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mvm: Offload RLC/SMPS functionality to firmware
authorDaniel Gabay <daniel.gabay@intel.com>
Thu, 8 Aug 2024 20:22:37 +0000 (23:22 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 27 Aug 2024 08:28:54 +0000 (10:28 +0200)
Currently, the driver handles SMPS decisions by tracking AP
capabilities, BT coexistence changes, sending necessary SMPS
frames to the AP, and updating firmware with RX chain info
using the RLC_CONFIG_CMD.

Starting with version 3 of the RLC_CONFIG_CMD, the firmware
takes over this responsibility. It now tracks SMPS, sends
frames, and configures the RLC.

In this patch:
1. Stop sending RLC_CONFIG_CMD when firmware supports RLC
   offload (version 3), as rlc.rx_chain_info is not needed by
   firmware, and no other field in the cmd is used.
2. Prevent the driver from forwarding any SMPS requests to
   mac80211, i.e., the driver should not transmit SMPS frames
   to the AP as firmware handles that.
3. Set NL80211_FEATURE_DYNAMIC_SMPS and NL80211_FEATURE_STATIC_SMPS
   conditionally based on RLC version.

Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240808232017.45da23be1f65.I0d46db82dd990a82e8a66876fe2f5310bc9513be@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
drivers/net/wireless/intel/iwlwifi/mvm/ops.c
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/utils.c

index d6f4caa939bd7841708b15c0b71d0f3f4acf923a..af892c8291d4a24a61a0def2f07313f70c9c23c7 100644 (file)
@@ -635,10 +635,15 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
                               NL80211_FEATURE_LOW_PRIORITY_SCAN |
                               NL80211_FEATURE_P2P_GO_OPPPS |
                               NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
-                              NL80211_FEATURE_DYNAMIC_SMPS |
-                              NL80211_FEATURE_STATIC_SMPS |
                               NL80211_FEATURE_SUPPORTS_WMM_ADMISSION;
 
+       /* when firmware supports RLC/SMPS offload, do not set these
+        * driver features, since it's no longer supported by driver.
+        */
+       if (!iwl_mvm_has_rlc_offload(mvm))
+               hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS |
+                                      NL80211_FEATURE_DYNAMIC_SMPS;
+
        if (fw_has_capa(&mvm->fw->ucode_capa,
                        IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT))
                hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION;
index bd754b8a71fc1807a4c5c658a132ffaca8c3fce9..4cacaa7b398e90e3c296cd6607fabcc8fe4224a5 100644 (file)
@@ -1768,6 +1768,13 @@ static inline u8 iwl_mvm_mac_ac_to_tx_fifo(struct iwl_mvm *mvm,
        return iwl_mvm_ac_to_tx_fifo[ac];
 }
 
+static inline bool iwl_mvm_has_rlc_offload(struct iwl_mvm *mvm)
+{
+       return iwl_fw_lookup_cmd_ver(mvm->fw,
+                                    WIDE_ID(DATA_PATH_GROUP, RLC_CONFIG_CMD),
+                                    0) >= 3;
+}
+
 struct iwl_rate_info {
        u8 plcp;        /* uCode API:  IWL_RATE_6M_PLCP, etc. */
        u8 plcp_siso;   /* uCode API:  IWL_RATE_SISO_6M_PLCP, etc. */
index 8896d9792feb295e2a728413dc19f5be45e1a40d..be20c8e3a389a1f139e55acf7d5de989bd55306d 100644 (file)
@@ -261,6 +261,12 @@ static void iwl_mvm_rx_thermal_dual_chain_req(struct iwl_mvm *mvm,
        struct iwl_rx_packet *pkt = rxb_addr(rxb);
        struct iwl_thermal_dual_chain_request *req = (void *)pkt->data;
 
+       /* firmware is expected to handle that in RLC offload mode */
+       if (IWL_FW_CHECK(mvm, iwl_mvm_has_rlc_offload(mvm),
+                        "Got THERMAL_DUAL_CHAIN_REQUEST (0x%x) in RLC offload mode\n",
+                        req->event))
+               return;
+
        /*
         * We could pass it to the iterator data, but also need to remember
         * it for new interfaces that are added while in this state.
index ce264b386029caa84df65354e17299a9219a237c..7cab5373c8ae140d36a0cdaca487394135a1cc57 100644 (file)
@@ -159,7 +159,11 @@ int iwl_mvm_phy_send_rlc(struct iwl_mvm *mvm, struct iwl_mvm_phy_ctxt *ctxt,
                .phy_id = cpu_to_le32(ctxt->id),
        };
 
-       if (ctxt->rlc_disabled)
+       /* From version 3, RLC is offloaded to firmware, so the driver no
+        * longer needs to send cmd.rlc, note that we are not using any
+        * other fields in the command - don't send it.
+        */
+       if (iwl_mvm_has_rlc_offload(mvm) || ctxt->rlc_disabled)
                return 0;
 
        if (iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(DATA_PATH_GROUP,
index 0e5fa8374103f4f50adce2bf9dd27db510596937..edcc6e2cb76a84880cf1e72c14ad3e1ec24168cd 100644 (file)
@@ -297,6 +297,10 @@ void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
        if (vif->type != NL80211_IFTYPE_STATION)
                return;
 
+       /* SMPS is handled by firmware */
+       if (iwl_mvm_has_rlc_offload(mvm))
+               return;
+
        mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
        if (WARN_ON_ONCE(!mvmvif->link[link_id]))