All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: linux-wireless@vger.kernel.org
Cc: kvalo@codeaurora.org, Johannes Berg <johannes.berg@intel.com>,
	Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 19/25] iwlwifi: mvm: align copy-break SKB payload for MQ RX
Date: Fri,  3 Feb 2017 16:38:06 +0200	[thread overview]
Message-ID: <20170203143812.7525-20-luca@coelho.fi> (raw)
In-Reply-To: <20170203143812.7525-1-luca@coelho.fi>

From: Johannes Berg <johannes.berg@intel.com>

When a small frame is copied completely into the skb->head, the code
doesn't take alignment into account, making mac80211 copy it again
later on architectures that need the alignment. Avoid this by taking
the PAD flag from the device into account when copying.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 6c802cee900c..c154ab42c80d 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -149,8 +149,17 @@ static void iwl_mvm_create_skb(struct sk_buff *skb, struct ieee80211_hdr *hdr,
 	unsigned int headlen, fraglen, pad_len = 0;
 	unsigned int hdrlen = ieee80211_hdrlen(hdr->frame_control);
 
-	if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD)
+	if (desc->mac_flags2 & IWL_RX_MPDU_MFLG2_PAD) {
 		pad_len = 2;
+
+		/*
+		 * If the device inserted padding it means that (it thought)
+		 * the 802.11 header wasn't a multiple of 4 bytes long. In
+		 * this case, reserve two bytes at the start of the SKB to
+		 * align the payload properly in case we end up copying it.
+		 */
+		skb_reserve(skb, pad_len);
+	}
 	len -= pad_len;
 
 	/* If frame is small enough to fit in skb->head, pull it completely.
-- 
2.11.0

  parent reply	other threads:[~2017-02-03 14:40 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03 14:37 [PATCH 00/25] iwlwifi: updates intended for v4.11 2017-02-03 Luca Coelho
2017-02-03 14:37 ` [PATCH 01/25] iwlwifi: mvm: fix PS-Poll enablement Luca Coelho
2017-02-03 14:37 ` [PATCH 02/25] iwlwifi: mvm: support unification of INIT and RT images Luca Coelho
2017-02-03 14:37 ` [PATCH 03/25] iwlwifi: mvm: support v2 of mfuart load notification Luca Coelho
2017-02-03 14:37 ` [PATCH 04/25] iwlwifi: mvm: Use aux queue for offchannel frames in dqa Luca Coelho
2017-02-03 14:37 ` [PATCH 05/25] iwlwifi: mvm: cleanup incorrect and redundant define Luca Coelho
2017-02-03 14:37 ` [PATCH 06/25] iwlwifi: mvm: support new statistics APIs Luca Coelho
2017-02-03 14:37 ` [PATCH 07/25] iwlwifi: mvm: support new scan API Luca Coelho
2017-02-03 14:37 ` [PATCH 08/25] iwlwifi: mvm: always free inactive queue when moving ownership Luca Coelho
2017-02-03 14:37 ` [PATCH 09/25] iwlwifi: mvm: reduce usage of IEEE80211_SKB_CB() Luca Coelho
2017-02-03 14:37 ` [PATCH 10/25] iwlwifi: mvm: support new alive notification Luca Coelho
2017-02-03 14:37 ` [PATCH 11/25] iwlwifi: mvm: synchronize firmware DMA paging memory Luca Coelho
2017-02-03 14:37 ` [PATCH 12/25] iwlwifi: mvm: fix D3 replay counter value Luca Coelho
2017-02-03 14:38 ` [PATCH 13/25] iwlwifi: mvm: set AID to firmware only for associated stations Luca Coelho
2017-02-03 14:38 ` [PATCH 14/25] iwlwifi: mvm: overwrite skb info later Luca Coelho
2017-02-06 14:01   ` Kalle Valo
2017-02-03 14:38 ` [PATCH 15/25] iwlwifi: mvm/pcie: adjust A-MSDU tx_cmd length in PCIe Luca Coelho
2017-02-06 14:05   ` Kalle Valo
2017-02-06 14:31     ` Luca Coelho
2017-02-03 14:38 ` [PATCH 16/25] iwlwifi: mvm: release static queues on bcast release Luca Coelho
2017-02-03 14:38 ` [PATCH 17/25] iwlwifi: pcie: fix the set of DMA memory mask Luca Coelho
2017-02-03 14:38 ` [PATCH 18/25] iwlwifi: mvm: fix pending frame counter calculation Luca Coelho
2017-02-03 14:38 ` Luca Coelho [this message]
2017-02-03 14:38 ` [PATCH 20/25] iwlwifi: mvm: cleanup iwl_mvm_tx_mpdu a bit Luca Coelho
2017-02-03 14:38 ` [PATCH 21/25] iwlwifi: remove unnecessary argument to iwl_drv_start() Luca Coelho
2017-02-03 14:38 ` [PATCH 22/25] iwlwifi: remove unnecessary cfg element in iwl_drv Luca Coelho
2017-02-03 14:38 ` [PATCH 23/25] iwlwifi: support two phys for a000 devices Luca Coelho
2017-02-03 14:38 ` [PATCH 24/25] iwlwifi: pcie: fix another RF-kill race Luca Coelho
2017-02-03 14:38 ` [PATCH 25/25] iwlwifi: mvm: support new beacon template command Luca Coelho

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170203143812.7525-20-luca@coelho.fi \
    --to=luca@coelho.fi \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.