All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@openwrt.org>
To: Janusz Dziedzic <janusz.dziedzic@tieto.com>,
	linux-wireless@vger.kernel.org
Cc: johannes@sipsolutions.net
Subject: Re: [RFC/RFT 1/2] mac80211: Add NEED_ALIGNED4_SKBS hw flag
Date: Thu, 17 Dec 2015 11:12:33 +0100	[thread overview]
Message-ID: <56728A91.7010503@openwrt.org> (raw)
In-Reply-To: <1450344029-5296-1-git-send-email-janusz.dziedzic@tieto.com>

On 2015-12-17 10:20, Janusz Dziedzic wrote:
> HW/driver should set NEED_ALIGNED4_SKBS flag in case require
> aligned skbs to four-byte boundaries.
> 
> Before we have to do memmove() in the driver before
> pass this to HW and memmove() back in tx completion.
> This patch allow to save CPU and skip such memmoves.
> For each skb we called memmove(ieee80211_hdrsize()) twice.
> 
> Currently this was tested with ath9k, both hw/sw crypt for
> tkip/ccmp.
> For sure more tests required.
> 
> Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
> ---
>  include/net/mac80211.h |  4 ++++
>  net/mac80211/debugfs.c |  1 +
>  net/mac80211/tkip.c    | 15 ++++++++++++---
>  net/mac80211/tx.c      | 21 +++++++++++++++++++--
>  net/mac80211/wep.c     |  6 ++++++
>  net/mac80211/wpa.c     | 35 +++++++++++++++++++++++++++--------
>  6 files changed, 69 insertions(+), 13 deletions(-)
> 
> diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
> index 0ae2077..26b2663 100644
> --- a/net/mac80211/tkip.c
> +++ b/net/mac80211/tkip.c
> @@ -204,9 +204,18 @@ void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
>  	const u8 *tk = &key->conf.key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY];
>  	struct tkip_ctx *ctx = &key->u.tkip.tx;
>  	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
> -	const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
> -	u32 iv32 = get_unaligned_le32(&data[4]);
> -	u16 iv16 = data[2] | (data[0] << 8);
> +	unsigned int hdrlen;
> +	const u8 *data;
> +	u32 iv32;
> +	u16 iv16;
> +
> +	hdrlen = ieee80211_hdrlen(hdr->frame_control);
> +	if (ieee80211_hw_check(&key->local->hw, NEEDS_ALIGNED4_SKBS))
> +		hdrlen += hdrlen & 3;
I think this check is duplicated way too often, maybe you should
implement a wrapper for ieee80211_hdrlen and convert all relevant call
sites. Makes it easier to spot places where this was forgotten.

- Felix

  parent reply	other threads:[~2015-12-17 10:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  9:20 [RFC/RFT 1/2] mac80211: Add NEED_ALIGNED4_SKBS hw flag Janusz Dziedzic
2015-12-17  9:20 ` [RFC/RFT 2/2] ath9k: request aligned skb Janusz Dziedzic
2015-12-21 18:53   ` Souptick Joarder
2015-12-21 22:48     ` Julian Calaby
2015-12-17  9:39 ` [RFC/RFT 1/2] mac80211: Add NEED_ALIGNED4_SKBS hw flag Felix Fietkau
2015-12-17 10:04 ` Johannes Berg
2015-12-17 10:09   ` Felix Fietkau
2015-12-17 10:12 ` Felix Fietkau [this message]
2015-12-18  8:43   ` Janusz Dziedzic
2015-12-17 10:29 ` Johannes Berg
2015-12-17 10:35   ` Felix Fietkau
2015-12-17 10:45     ` Johannes Berg

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=56728A91.7010503@openwrt.org \
    --to=nbd@openwrt.org \
    --cc=janusz.dziedzic@tieto.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /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.