提交 521dc6c7 编写于 作者: E Emmanuel Grumbach 提交者: Johannes Berg

iwlwiif: mvm: refactor iwl_mvm_notify_rx_queue

Instead of allocating memory for which we have an upper
limit, use a small buffer on stack.
Signed-off-by: NEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 c61b655a
...@@ -776,7 +776,6 @@ struct iwl_rss_config_cmd { ...@@ -776,7 +776,6 @@ struct iwl_rss_config_cmd {
u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE]; u8 indirection_table[IWL_RSS_INDIRECTION_TABLE_SIZE];
} __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */ } __packed; /* RSS_CONFIG_CMD_API_S_VER_1 */
#define IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE 128
#define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0 #define IWL_MULTI_QUEUE_SYNC_SENDER_POS 0
#define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf #define IWL_MULTI_QUEUE_SYNC_SENDER_MSK 0xf
......
...@@ -465,18 +465,20 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue, ...@@ -465,18 +465,20 @@ static bool iwl_mvm_is_dup(struct ieee80211_sta *sta, int queue,
int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
const u8 *data, u32 count) const u8 *data, u32 count)
{ {
struct iwl_rxq_sync_cmd *cmd; u8 buf[sizeof(struct iwl_rxq_sync_cmd) +
sizeof(struct iwl_mvm_rss_sync_notif)];
struct iwl_rxq_sync_cmd *cmd = (void *)buf;
u32 data_size = sizeof(*cmd) + count; u32 data_size = sizeof(*cmd) + count;
int ret; int ret;
/* should be DWORD aligned */ /*
if (WARN_ON(count & 3 || count > IWL_MULTI_QUEUE_SYNC_MSG_MAX_SIZE)) * size must be a multiple of DWORD
* Ensure we don't overflow buf
*/
if (WARN_ON(count & 3 ||
count > sizeof(struct iwl_mvm_rss_sync_notif)))
return -EINVAL; return -EINVAL;
cmd = kzalloc(data_size, GFP_KERNEL);
if (!cmd)
return -ENOMEM;
cmd->rxq_mask = cpu_to_le32(rxq_mask); cmd->rxq_mask = cpu_to_le32(rxq_mask);
cmd->count = cpu_to_le32(count); cmd->count = cpu_to_le32(count);
cmd->flags = 0; cmd->flags = 0;
...@@ -487,7 +489,6 @@ int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask, ...@@ -487,7 +489,6 @@ int iwl_mvm_notify_rx_queue(struct iwl_mvm *mvm, u32 rxq_mask,
TRIGGER_RX_QUEUES_NOTIF_CMD), TRIGGER_RX_QUEUES_NOTIF_CMD),
0, data_size, cmd); 0, data_size, cmd);
kfree(cmd);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册