Linux-Wireless Archive on lore.kernel.org
 help / color / Atom feed
From: Alexander Wetzel <alexander@wetzel-home.de>
To: Johannes Berg <johannes@sipsolutions.net>, luciano.coelho@intel.com
Cc: linux-wireless@vger.kernel.org, linuxwifi@intel.com
Subject: Re: [PATCH] iwlwifi: Extended Key ID support for mvm and dvm
Date: Mon, 19 Aug 2019 22:42:14 +0200
Message-ID: <ae57dab8-a6c2-c0a5-194b-27cef4c55e16@wetzel-home.de> (raw)
In-Reply-To: <52914e64663283eeff9445b8b1fb37986c15223d.camel@sipsolutions.net>



Am 19.08.19 um 22:03 schrieb Johannes Berg:
> On Mon, 2019-08-19 at 21:57 +0200, Alexander Wetzel wrote:
>>>> +
>>>> +	/* The new Tx API does not allow to pass the key or keyid of a MPDU to
>>>> +	 * the hw, preventing us to control which key(id) to use per MPDU.
>>>> +	 * Till that's fixed we can't use Extended Key ID for the newer cards.
>>>
>>> Technically we still don't need per MPDU, we just need to switch which
>>> one to use for TX after installing it for RX already.
>>
>> The Extended Key ID API we finally merged in mac80211 is not notifying
>> the driver when to switch the key over to the other id.
> 
> Oh, right, good point.
> 
>> The current API provides the key/keyid per MPDU and let's mac80211 have
>> the full control what's the correct key for each frame.
> 
> Yeah, but as you noticed we no longer have that control per MPDU with
> the new TX API in iwlmvm.
> 
>> That's especially critical for drivers setting
>> IEEE80211_KEY_FLAG_GENERATE_IV and/or supporting A-MPDU's. Allowing the
>> driver to override the mac80211 decision is only safe when the
>> driver/card generates the PNs itself and also handles the A-MPDU key
>> borders correctly.
> 
> Sure, the device does generate the PN itself now with the new TX API
> too. It doesn't care about A-MPDU key borders, but it probably could
> when taught to care about extended key ID.
> 
>> While less desirable we still could get that working: The mvm driver
>> would have to detect the key borders and then tell the firmware to
>> switch over to the other key. But we would have to make sure to not
>> re-enable A-MPDU aggregation till the card really has switched.
> 
> I'm not entirely sure off the top of my head how it works, but it seems
> possible that if we just assign a new PN to retransmits of the same
> frame but in a new A-MPDU after key switching, it wouldn't actually
> matter?

I was thinking about mac80211 re-enabling A-MPDU aggregation but the 
driver still using the old key for some frames and then switching to the 
new key within one A-MPDU, causing non-compliant A-MPDUs.

> But then again maybe somewhere it's stated that we must use the same key
> for all transmit attempts of a single frame? Not sure.

I know of course next to nothing how the hardware/firmware is handling 
that, but I'm surprised this could be a problem. I assumed the card 
would create a full MPDU (with the crypto headers) and use that for 
retransmit and not create the MPDU new... After all you still have to 
use the old PN and getting that right sounds tricky when you don't have 
the full MPDU cached somehow. But I guess the high bandwidth and the 
required buffer space forced you to extreme measures to conserve space...

> 
> I'm also not sure if we could actually assign a PN from the new key for
> the retransmit, the hardware has to store those back into memory
> normally.
> 
> So probably you're right, and we'd have to disable A-MPDUs until we have
> no outstanding old-key-retransmits, but that seems manageable.

Extending the A-MPDU block mac80211 is using to enforce the A-MPDU key 
borders should be not very hard. Figuring out the time when we safely 
can restart it - when re-transmits indeed are also an issue - I'm less 
sure about. I believe re-transmits are handled by the card and not the 
driver but so far had no reason to dig deeper into that topic. But I 
guess a call to switch over the keyid which blocks till that is done 
should take care of it.

Alexander

Alexander

  parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-19 18:05 Alexander Wetzel
2019-08-19 18:51 ` Johannes Berg
2019-08-19 19:57   ` Alexander Wetzel
2019-08-19 20:03     ` Johannes Berg
2019-08-19 20:09       ` Johannes Berg
2019-08-19 20:50         ` Alexander Wetzel
2019-08-19 20:42       ` Alexander Wetzel [this message]
2019-09-06 20:41 ` Alexander Wetzel

Reply instructions:

You may reply publically 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=ae57dab8-a6c2-c0a5-194b-27cef4c55e16@wetzel-home.de \
    --to=alexander@wetzel-home.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linuxwifi@intel.com \
    --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

Linux-Wireless Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \
		linux-wireless@vger.kernel.org linux-wireless@archiver.kernel.org
	public-inbox-index linux-wireless

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless


AGPL code for this site: git clone https://public-inbox.org/ public-inbox