linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Janusz Dziedzic <janusz.dziedzic@tieto.com>,
	linux-wireless@vger.kernel.org
Cc: nbd@openwrt.org
Subject: Re: [RFC/RFT v3] mac80211: Add NEED_ALIGNED4_SKBS hw flag
Date: Thu, 14 Jan 2016 13:32:18 +0100	[thread overview]
Message-ID: <1452774738.2444.22.camel@sipsolutions.net> (raw)
In-Reply-To: <1451999161-7286-1-git-send-email-janusz.dziedzic@tieto.com> (sfid-20160105_140614_128232_306916F3)

On Tue, 2016-01-05 at 14:06 +0100, Janusz Dziedzic wrote:

> +++ b/net/mac80211/status.c
> @@ -678,9 +678,22 @@ void ieee80211_tx_monitor(struct ieee80211_local
> *local, struct sk_buff *skb,
>  	struct sk_buff *skb2;
>  	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
>  	struct ieee80211_sub_if_data *sdata;
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb-
> >data;

Could be (void *) cast

>  	struct net_device *prev_dev = NULL;
> +	unsigned int padsize, hdrlen;
>  	int rtap_len;
>  
> +	/* Remove padding if was added */
> +	if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS)) {
> +		hdrlen = ieee80211_hdrlen(hdr->frame_control);
> +		padsize = hdrlen & 3;
> +
> +		if (padsize && skb->len > hdrlen + padsize) {
> +			memmove(skb->data + padsize, skb->data,
> hdrlen);
> +			skb_pull(skb, padsize);
> +		}
> +	}

But perhaps this should just be done by the driver?

>  /* tx handlers */
>  static ieee80211_tx_result debug_noinline
> +ieee80211_tx_h_hdrlen_add(struct ieee80211_tx_data *tx)
> +{
> +	struct ieee80211_hw *hw = &tx->local->hw;
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx->skb-
> >data;
> +
> +	tx->hdrlen = ieee80211_hdrlen(hdr->frame_control);
> +
> +	if (ieee80211_hw_check(hw, NEEDS_ALIGNED4_SKBS))
> +		tx->hdrlen += tx->hdrlen & 3;
> +
> +	return TX_CONTINUE;
> +}

Can't we do this in the same place that actually adds the padding? Even
if not, I don't think it should be a separate TX handler, most of the
tx setup is done elsewhere.

> +	/* Check if aligned skb required */
> +	if (ieee80211_hw_check(&local->hw, NEEDS_ALIGNED4_SKBS))
> +		build.hdr_len += build.hdr_len & 3;

Pretty sure you need to increase the reserved space in the fast-xmit
struct?

> -	hdrlen = ieee80211_hdrlen(hdr->frame_control);
> +	hdrlen = tx->hdrlen;

maybe you can also do all these changes separately?

>  	pos += IEEE80211_CCMP_HDR_LEN;
> +
>  	ccmp_special_blocks(skb, pn, b_0, aad);

spurious change

johannes

  reply	other threads:[~2016-01-14 12:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 13:06 [RFC/RFT v3] mac80211: Add NEED_ALIGNED4_SKBS hw flag Janusz Dziedzic
2016-01-14 12:32 ` Johannes Berg [this message]
2016-01-14 12:47   ` Felix Fietkau

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=1452774738.2444.22.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=janusz.dziedzic@tieto.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).