iwlwifi: move iwl_configure_rxq to be used by other op_modes
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Wed, 31 Mar 2021 09:14:49 +0000 (12:14 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 14 Apr 2021 09:07:17 +0000 (12:07 +0300)
All the op_modes need to send this command as well. Instead of
duplicating the code from mvm, put the code in a common place.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210331121101.deb71fce883a.I5eef009512f180e5974f3f491ff56c763cdcc878@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/init.c
drivers/net/wireless/intel/iwlwifi/fw/runtime.h
drivers/net/wireless/intel/iwlwifi/mvm/fw.c

index 986913f..2ecec00 100644 (file)
@@ -10,6 +10,8 @@
 
 #include "fw/api/soc.h"
 #include "fw/api/commands.h"
+#include "fw/api/rx.h"
+#include "fw/api/datapath.h"
 
 void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
                        const struct iwl_fw *fw,
@@ -95,3 +97,60 @@ int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt)
        return ret;
 }
 IWL_EXPORT_SYMBOL(iwl_set_soc_latency);
+
+int iwl_configure_rxq(struct iwl_fw_runtime *fwrt)
+{
+       int i, num_queues, size, ret;
+       struct iwl_rfh_queue_config *cmd;
+       struct iwl_host_cmd hcmd = {
+               .id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
+               .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
+       };
+
+       /*
+        * The default queue is configured via context info, so if we
+        * have a single queue, there's nothing to do here.
+        */
+       if (fwrt->trans->num_rx_queues == 1)
+               return 0;
+
+       if (fwrt->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_22000)
+               return 0;
+
+       /* skip the default queue */
+       num_queues = fwrt->trans->num_rx_queues - 1;
+
+       size = struct_size(cmd, data, num_queues);
+
+       cmd = kzalloc(size, GFP_KERNEL);
+       if (!cmd)
+               return -ENOMEM;
+
+       cmd->num_queues = num_queues;
+
+       for (i = 0; i < num_queues; i++) {
+               struct iwl_trans_rxq_dma_data data;
+
+               cmd->data[i].q_num = i + 1;
+               iwl_trans_get_rxq_dma_data(fwrt->trans, i + 1, &data);
+
+               cmd->data[i].fr_bd_cb = cpu_to_le64(data.fr_bd_cb);
+               cmd->data[i].urbd_stts_wrptr =
+                       cpu_to_le64(data.urbd_stts_wrptr);
+               cmd->data[i].ur_bd_cb = cpu_to_le64(data.ur_bd_cb);
+               cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
+       }
+
+       hcmd.data[0] = cmd;
+       hcmd.len[0] = size;
+
+       ret = iwl_trans_send_cmd(fwrt->trans, &hcmd);
+
+       kfree(cmd);
+
+       if (ret)
+               IWL_ERR(fwrt, "Failed to configure RX queues: %d\n", ret);
+
+       return ret;
+}
+IWL_EXPORT_SYMBOL(iwl_configure_rxq);
index 0dba544..35af85a 100644 (file)
@@ -190,5 +190,6 @@ void iwl_free_fw_paging(struct iwl_fw_runtime *fwrt);
 
 void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt);
 int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt);
+int iwl_configure_rxq(struct iwl_fw_runtime *fwrt);
 
 #endif /* __iwl_fw_runtime_h__ */
index 4f297ed..b8a2594 100644 (file)
@@ -73,56 +73,6 @@ static int iwl_send_rss_cfg_cmd(struct iwl_mvm *mvm)
        return iwl_mvm_send_cmd_pdu(mvm, RSS_CONFIG_CMD, 0, sizeof(cmd), &cmd);
 }
 
-static int iwl_configure_rxq(struct iwl_mvm *mvm)
-{
-       int i, num_queues, size, ret;
-       struct iwl_rfh_queue_config *cmd;
-       struct iwl_host_cmd hcmd = {
-               .id = WIDE_ID(DATA_PATH_GROUP, RFH_QUEUE_CONFIG_CMD),
-               .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
-       };
-
-       /*
-        * The default queue is configured via context info, so if we
-        * have a single queue, there's nothing to do here.
-        */
-       if (mvm->trans->num_rx_queues == 1)
-               return 0;
-
-       /* skip the default queue */
-       num_queues = mvm->trans->num_rx_queues - 1;
-
-       size = struct_size(cmd, data, num_queues);
-
-       cmd = kzalloc(size, GFP_KERNEL);
-       if (!cmd)
-               return -ENOMEM;
-
-       cmd->num_queues = num_queues;
-
-       for (i = 0; i < num_queues; i++) {
-               struct iwl_trans_rxq_dma_data data;
-
-               cmd->data[i].q_num = i + 1;
-               iwl_trans_get_rxq_dma_data(mvm->trans, i + 1, &data);
-
-               cmd->data[i].fr_bd_cb = cpu_to_le64(data.fr_bd_cb);
-               cmd->data[i].urbd_stts_wrptr =
-                       cpu_to_le64(data.urbd_stts_wrptr);
-               cmd->data[i].ur_bd_cb = cpu_to_le64(data.ur_bd_cb);
-               cmd->data[i].fr_bd_wid = cpu_to_le32(data.fr_bd_wid);
-       }
-
-       hcmd.data[0] = cmd;
-       hcmd.len[0] = size;
-
-       ret = iwl_mvm_send_cmd(mvm, &hcmd);
-
-       kfree(cmd);
-
-       return ret;
-}
-
 static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
 {
        struct iwl_dqa_enable_cmd dqa_cmd = {
@@ -1503,14 +1453,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
        }
 
        /* Init RSS configuration */
-       if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
-               ret = iwl_configure_rxq(mvm);
-               if (ret) {
-                       IWL_ERR(mvm, "Failed to configure RX queues: %d\n",
-                               ret);
-                       goto error;
-               }
-       }
+       ret = iwl_configure_rxq(&mvm->fwrt);
+       if (ret)
+               goto error;
 
        if (iwl_mvm_has_new_rx_api(mvm)) {
                ret = iwl_send_rss_cfg_cmd(mvm);