iwlwifi: mvm: avoid unnecessary cache trashing in Tx path
When sending a Tx Command with a Tx packet, we allocate the Tx command separately from the payload of the packet. The WiFi MAC header is then copied into the buffer that was allocated for the Tx Command. This means that this buffer needs to be big enough to contain both. This is why it is allocated with iwl_trans_alloc_tx_cmd which returns a pointer to a newly allocated not zeroed struct iwl_device_cmd. The Tx command has a few bit fields and hence it needs to be zeroed, but all the rest of the buffer doesn't need to be zeroed since it will either be memcopy'ed with the MAC header, or not even sent to the device. This means that we don't need to zero all the iwl_device_cmd structure, but rather only the size of the iwl_tx_cmd structure. Since sizeof(iwl_tx_cmd) - sizeof(iwl_tx_cmd) is about 260 bytes, this can avoid touching 4 cache lines for each packet. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
85aeb58cec
commit
6f2f019495
|
@ -473,7 +473,10 @@ iwl_mvm_set_tx_params(struct iwl_mvm *mvm, struct sk_buff *skb,
|
|||
if (unlikely(!dev_cmd))
|
||||
return NULL;
|
||||
|
||||
memset(dev_cmd, 0, sizeof(*dev_cmd));
|
||||
/* Make sure we zero enough of dev_cmd */
|
||||
BUILD_BUG_ON(sizeof(struct iwl_tx_cmd_gen2) > sizeof(*tx_cmd));
|
||||
|
||||
memset(dev_cmd, 0, sizeof(dev_cmd->hdr) + sizeof(*tx_cmd));
|
||||
dev_cmd->hdr.cmd = TX_CMD;
|
||||
|
||||
if (iwl_mvm_has_new_tx_api(mvm)) {
|
||||
|
|
Loading…
Reference in New Issue