iwlwifi: move iwl_configure_rxq to be used by other op_modes
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>
This commit is contained in:
committed by
Luca Coelho
parent
9a0f28d862
commit
9cd243f24e
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "fw/api/soc.h"
|
#include "fw/api/soc.h"
|
||||||
#include "fw/api/commands.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,
|
void iwl_fw_runtime_init(struct iwl_fw_runtime *fwrt, struct iwl_trans *trans,
|
||||||
const struct iwl_fw *fw,
|
const struct iwl_fw *fw,
|
||||||
@@ -95,3 +97,60 @@ int iwl_set_soc_latency(struct iwl_fw_runtime *fwrt)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
IWL_EXPORT_SYMBOL(iwl_set_soc_latency);
|
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);
|
||||||
|
|||||||
@@ -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);
|
void iwl_get_shared_mem_conf(struct iwl_fw_runtime *fwrt);
|
||||||
int iwl_set_soc_latency(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__ */
|
#endif /* __iwl_fw_runtime_h__ */
|
||||||
|
|||||||
@@ -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);
|
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)
|
static int iwl_mvm_send_dqa_cmd(struct iwl_mvm *mvm)
|
||||||
{
|
{
|
||||||
struct iwl_dqa_enable_cmd dqa_cmd = {
|
struct iwl_dqa_enable_cmd dqa_cmd = {
|
||||||
@@ -1503,14 +1453,9 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Init RSS configuration */
|
/* Init RSS configuration */
|
||||||
if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) {
|
ret = iwl_configure_rxq(&mvm->fwrt);
|
||||||
ret = iwl_configure_rxq(mvm);
|
if (ret)
|
||||||
if (ret) {
|
goto error;
|
||||||
IWL_ERR(mvm, "Failed to configure RX queues: %d\n",
|
|
||||||
ret);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (iwl_mvm_has_new_rx_api(mvm)) {
|
if (iwl_mvm_has_new_rx_api(mvm)) {
|
||||||
ret = iwl_send_rss_cfg_cmd(mvm);
|
ret = iwl_send_rss_cfg_cmd(mvm);
|
||||||
|
|||||||
Reference in New Issue
Block a user