2012-05-10 07:23:08

by Andreas Hartmann

[permalink] [raw]
Subject: [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

This patch adds support for 802.11w for rt2800. This is achieved by
using the 802.11w implementation in mac80211.

To get this working, it is necessary to disable hw encryption of
rt2800pci / rt2800usb, because I don't know of any support in hardware
for 802.11w and therefore let mac80211 do the whole job.

The user can enable 802.11w with the new mod parameter enablemfp.
Enabling MFP disables hw encryption.

802.11w is deactivated per default.

Tested with rt2860 and rt3572.

This is a workaround as long as there isn't hardware support implemented
in the driver.

Signed-off-by: Andreas Hartmann <[email protected]>
---
diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
--- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2012-04-26 22:10:30.000000000 +0200
+++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c 2012-05-09 11:37:48.463278177 +0200
@@ -4519,6 +4519,15 @@
IEEE80211_HW_AMPDU_AGGREGATION |
IEEE80211_HW_REPORTS_TX_ACK_STATUS;

+ /*
+ * Enable support for 802.11w in mac80211. hwencryption must be disabled
+ */
+ if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
+ INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
+ rt2x00dev->hw->flags |=
+ IEEE80211_HW_MFP_CAPABLE;
+ }
+
/*
* Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
* unless we are capable of sending the buffered frames out after the
diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800pci.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800pci.c
--- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800pci.c 2012-04-26 22:10:30.000000000 +0200
+++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800pci.c 2012-05-09 13:29:47.159979903 +0200
@@ -54,6 +54,13 @@
module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");

+/*
+ * Enable support for 802.11w / MFP
+ */
+static bool modparam_enablemfp = false;
+module_param_named(enablemfp, modparam_enablemfp, bool, S_IRUGO);
+MODULE_PARM_DESC(enablemfp, "Enable 802.11w / MFP support. Hardware encryption gets disabled.");
+
static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
{
unsigned int i;
@@ -989,6 +996,8 @@
if (retval)
return retval;

+ rt2x00dev->mfprequested = modparam_enablemfp ? 1 : 0;
+
/*
* Initialize hw specifications.
*/
@@ -1018,8 +1027,14 @@
__set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
- if (!modparam_nohwcrypt)
+
+ if (!modparam_nohwcrypt && !modparam_enablemfp) {
+ INFO(rt2x00dev, "hw encryption enabled.\n");
__set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+ }
+ else
+ INFO(rt2x00dev, "hw encryption disabled. See modparams nohwcrypt or enablemfp.\n");
+
__set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);

diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800usb.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800usb.c
--- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800usb.c 2012-04-26 22:10:30.000000000 +0200
+++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800usb.c 2012-05-09 13:38:26.633954818 +0200
@@ -50,6 +50,13 @@
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");

/*
+ * Allow support for 802.11w / MFP to be enabled
+ */
+static bool modparam_enablemfp = false;
+module_param_named(enablemfp, modparam_enablemfp, bool, S_IRUGO);
+MODULE_PARM_DESC(enablemfp, "Enable 802.11w / MFP support. Hardware encryption gets disabled.");
+
+/*
* Queue handlers.
*/
static void rt2800usb_start_queue(struct data_queue *queue)
@@ -748,6 +755,8 @@
if (retval)
return retval;

+ rt2x00dev->mfprequested = modparam_enablemfp ? 1 : 0;
+
/*
* Initialize hw specifications.
*/
@@ -767,8 +776,14 @@
*/
__set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
- if (!modparam_nohwcrypt)
+
+ if (!modparam_nohwcrypt && !modparam_enablemfp) {
+ INFO(rt2x00dev, "hw encryption enabled.\n");
__set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
+ }
+ else
+ INFO(rt2x00dev, "hw encryption disabled. See modparams nohwcrypt or enablemfp.\n");
+
__set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
__set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2x00.h compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2x00.h
--- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2x00.h 2012-04-26 22:10:30.000000000 +0200
+++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2x00.h 2012-05-09 11:10:56.733118518 +0200
@@ -821,6 +821,11 @@
struct hw_mode_spec spec;

/*
+ * 802.11w (MFP) support requested by module parameter
+ */
+ u8 mfprequested;
+
+ /*
* This is the default TX/RX antenna setup as indicated
* by the device's EEPROM.
*/


2012-05-10 10:58:38

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

Hello!

Ivo Van Doorn schrieb:
> Hi,
>
> On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
> <[email protected]> wrote:
>> This patch adds support for 802.11w for rt2800. This is achieved by
>> using the 802.11w implementation in mac80211.
>>
>> To get this working, it is necessary to disable hw encryption of
>> rt2800pci / rt2800usb, because I don't know of any support in hardware
>> for 802.11w and therefore let mac80211 do the whole job.
>>
>> The user can enable 802.11w with the new mod parameter enablemfp.
>> Enabling MFP disables hw encryption.
>>
>> 802.11w is deactivated per default.
>>
>> Tested with rt2860 and rt3572.
>>
>> This is a workaround as long as there isn't hardware support implemented
>> in the driver.
>>
>> Signed-off-by: Andreas Hartmann <[email protected]>
>> ---
>> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
>> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2012-04-26 22:10:30.000000000 +0200
>> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c 2012-05-09 11:37:48.463278177 +0200
>> @@ -4519,6 +4519,15 @@
>> IEEE80211_HW_AMPDU_AGGREGATION |
>> IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>>
>> + /*
>> + * Enable support for 802.11w in mac80211. hwencryption must be disabled
>> + */
>> + if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
>> + INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>> + rt2x00dev->hw->flags |=
>> + IEEE80211_HW_MFP_CAPABLE;
>> + }
>
> Can't the whole patch be simplified into
>
> if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
> INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
> rt2x00dev->hw->flags |=
> IEEE80211_HW_MFP_CAPABLE;
> }

This would surely be possible, but it wouldn't be possible any more to
run the driver w/o MFP support as long as hw encryption is disabled.

Additionally, I would like to have an additional comment added to
nohwcrypt, which mentions, that activating nohwcrypt enables MFP, like:
"Disable hardware encryption, enable MFP." to let the user know, how to
enable MFP.

>
> Why need a extra moduleflag when all it does is toggle the nohwcrypto
> module parameter?

Because I wanted to achieve the old behaviour of the driver w/o hw
encryption.
If you think, this isn't necessary, I'm absolutely fine with removing it.


Andreas

2012-05-10 14:23:45

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

Hi Ivo,

Ivo Van Doorn wrote:
> Hi,
>
> On Thu, May 10, 2012 at 12:55 PM, Andreas Hartmann
> <[email protected]> wrote:
>> Hello!
>>
>> Ivo Van Doorn schrieb:
>>> Hi,
>>>
>>> On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
>>> <[email protected]> wrote:
>>>> This patch adds support for 802.11w for rt2800. This is achieved by
>>>> using the 802.11w implementation in mac80211.
>>>>
>>>> To get this working, it is necessary to disable hw encryption of
>>>> rt2800pci / rt2800usb, because I don't know of any support in hardware
>>>> for 802.11w and therefore let mac80211 do the whole job.
>>>>
>>>> The user can enable 802.11w with the new mod parameter enablemfp.
>>>> Enabling MFP disables hw encryption.
>>>>
>>>> 802.11w is deactivated per default.
>>>>
>>>> Tested with rt2860 and rt3572.
>>>>
>>>> This is a workaround as long as there isn't hardware support implemented
>>>> in the driver.
>>>>
>>>> Signed-off-by: Andreas Hartmann <[email protected]>
>>>> ---
>>>> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
>>>> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2012-04-26 22:10:30.000000000 +0200
>>>> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c 2012-05-09 11:37:48.463278177 +0200
>>>> @@ -4519,6 +4519,15 @@
>>>> IEEE80211_HW_AMPDU_AGGREGATION |
>>>> IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>>>>
>>>> + /*
>>>> + * Enable support for 802.11w in mac80211. hwencryption must be disabled
>>>> + */
>>>> + if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
>>>> + INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>>> + rt2x00dev->hw->flags |=
>>>> + IEEE80211_HW_MFP_CAPABLE;
>>>> + }
>>>
>>> Can't the whole patch be simplified into
>>>
>>> if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
>>> INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>> rt2x00dev->hw->flags |=
>>> IEEE80211_HW_MFP_CAPABLE;
>>> }
>>
>> This would surely be possible, but it wouldn't be possible any more to
>> run the driver w/o MFP support as long as hw encryption is disabled.
>>
>> Additionally, I would like to have an additional comment added to
>> nohwcrypt, which mentions, that activating nohwcrypt enables MFP, like:
>> "Disable hardware encryption, enable MFP." to let the user know, how to
>> enable MFP.
>
> I am wondering what the usecase would be for having an option to disable MFP?
> Isn't that a feature which technically should be enabled by default and in the
> userspace you have the configuration to use it or not?

It's the same idea as behind the nohwcrypt switch. If there are problems
with the feature in a special case, you have the possibility to disable it.
My understanding of nohwcrypt is to have a fallback mode, which I didn't
want to touch. That's all.


Regards,
Andreas

2012-05-10 08:58:19

by Ivo Van Doorn

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

Hi,

On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
<[email protected]> wrote:
> This patch adds support for 802.11w for rt2800. This is achieved by
> using the 802.11w implementation in mac80211.
>
> To get this working, it is necessary to disable hw encryption of
> rt2800pci / rt2800usb, because I don't know of any support in hardware
> for 802.11w and therefore let mac80211 do the whole job.
>
> The user can enable 802.11w with the new mod parameter enablemfp.
> Enabling MFP disables hw encryption.
>
> 802.11w is deactivated per default.
>
> Tested with rt2860 and rt3572.
>
> This is a workaround as long as there isn't hardware support implemented
> in the driver.
>
> Signed-off-by: Andreas Hartmann <[email protected]>
> ---
> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c ? ? 2012-04-26 22:10:30.000000000 +0200
> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c ?2012-05-09 11:37:48.463278177 +0200
> @@ -4519,6 +4519,15 @@
> ? ? ? ? ? ?IEEE80211_HW_AMPDU_AGGREGATION |
> ? ? ? ? ? ?IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>
> + ? ? ? /*
> + ? ? ? ?* Enable support for 802.11w in mac80211. hwencryption must be disabled
> + ? ? ? ?*/
> + ? ? ? if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
> + ? ? ? ? ? ? ? INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
> + ? ? ? ? ? ? ? rt2x00dev->hw->flags |=
> + ? ? ? ? ? ? ? ? ? ? ? IEEE80211_HW_MFP_CAPABLE;
> + ? ? ? }

Can't the whole patch be simplified into

if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
? ? ? ? ? ? ? INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
? ? ? ? ? ? ? rt2x00dev->hw->flags |=
? ? ? ? ? ? ? ? ? ? ? IEEE80211_HW_MFP_CAPABLE;
}

Why need a extra moduleflag when all it does is toggle the nohwcrypto
module parameter?

> ? ? ? ?/*
> ? ? ? ? * Don't set IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING for USB devices
> ? ? ? ? * unless we are capable of sending the buffered frames out after the
> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800pci.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800pci.c
> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800pci.c ? ? 2012-04-26 22:10:30.000000000 +0200
> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800pci.c ?2012-05-09 13:29:47.159979903 +0200
> @@ -54,6 +54,13 @@
> ?module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
> ?MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
>
> +/*
> + * Enable support for 802.11w / MFP
> + */
> +static bool modparam_enablemfp = false;
> +module_param_named(enablemfp, modparam_enablemfp, bool, S_IRUGO);
> +MODULE_PARM_DESC(enablemfp, "Enable 802.11w / MFP support. Hardware encryption gets disabled.");
> +
> ?static void rt2800pci_mcu_status(struct rt2x00_dev *rt2x00dev, const u8 token)
> ?{
> ? ? ? ?unsigned int i;
> @@ -989,6 +996,8 @@
> ? ? ? ?if (retval)
> ? ? ? ? ? ? ? ?return retval;
>
> + ? ? ? rt2x00dev->mfprequested = modparam_enablemfp ? 1 : 0;

If enablemfp is already a boolean, why need the ? 1 : 0 statement?
And the changes here are really needed (see earlier comment)
can't the mfprequested bit not be a flag in the cap_flags or something?

> ? ? ? ?/*
> ? ? ? ? * Initialize hw specifications.
> ? ? ? ? */
> @@ -1018,8 +1027,14 @@
> ? ? ? ?__set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
> - ? ? ? if (!modparam_nohwcrypt)
> +
> + ? ? ? if (!modparam_nohwcrypt && !modparam_enablemfp) {
> + ? ? ? ? ? ? ? INFO(rt2x00dev, "hw encryption enabled.\n");
> ? ? ? ? ? ? ? ?__set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
> + ? ? ? ? ? ? ? }
> + ? ? ? else
> + ? ? ? ? ? ? ? INFO(rt2x00dev, "hw encryption disabled. See modparams nohwcrypt or enablemfp.\n");
> +
> ? ? ? ?__set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
>
> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800usb.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800usb.c
> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800usb.c ? ? 2012-04-26 22:10:30.000000000 +0200
> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800usb.c ?2012-05-09 13:38:26.633954818 +0200
> @@ -50,6 +50,13 @@
> ?MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
>
> ?/*
> + * Allow support for 802.11w / MFP to be enabled
> + */
> +static bool modparam_enablemfp = false;
> +module_param_named(enablemfp, modparam_enablemfp, bool, S_IRUGO);
> +MODULE_PARM_DESC(enablemfp, "Enable 802.11w / MFP support. Hardware encryption gets disabled.");
> +
> +/*
> ?* Queue handlers.
> ?*/
> ?static void rt2800usb_start_queue(struct data_queue *queue)
> @@ -748,6 +755,8 @@
> ? ? ? ?if (retval)
> ? ? ? ? ? ? ? ?return retval;
>
> + ? ? ? rt2x00dev->mfprequested = modparam_enablemfp ? 1 : 0;
> +
> ? ? ? ?/*
> ? ? ? ? * Initialize hw specifications.
> ? ? ? ? */
> @@ -767,8 +776,14 @@
> ? ? ? ? */
> ? ? ? ?__set_bit(REQUIRE_FIRMWARE, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_L2PAD, &rt2x00dev->cap_flags);
> - ? ? ? if (!modparam_nohwcrypt)
> +
> + ? ? ? if (!modparam_nohwcrypt && !modparam_enablemfp) {
> + ? ? ? ? ? ? ? INFO(rt2x00dev, "hw encryption enabled.\n");
> ? ? ? ? ? ? ? ?__set_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags);
> + ? ? ? }
> + ? ? ? else
> + ? ? ? ? ? ? ? INFO(rt2x00dev, "hw encryption disabled. See modparams nohwcrypt or enablemfp.\n");
> +
> ? ? ? ?__set_bit(CAPABILITY_LINK_TUNING, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_HT_TX_DESC, &rt2x00dev->cap_flags);
> ? ? ? ?__set_bit(REQUIRE_TXSTATUS_FIFO, &rt2x00dev->cap_flags);
> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2x00.h compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2x00.h
> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2x00.h ? ? ? ?2012-04-26 22:10:30.000000000 +0200
> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2x00.h ? ? 2012-05-09 11:10:56.733118518 +0200
> @@ -821,6 +821,11 @@
> ? ? ? ?struct hw_mode_spec spec;
>
> ? ? ? ?/*
> + ? ? ? ?* 802.11w (MFP) support requested by module parameter
> + ? ? ? ?*/
> + ? ? ? u8 mfprequested;
> +
> + ? ? ? /*
> ? ? ? ? * This is the default TX/RX antenna setup as indicated
> ? ? ? ? * by the device's EEPROM.
> ? ? ? ? */
>
> _______________________________________________
> users mailing list
> [email protected]
> http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com

2012-05-10 12:34:31

by Ivo Van Doorn

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

Hi,

On Thu, May 10, 2012 at 12:55 PM, Andreas Hartmann
<[email protected]> wrote:
> Hello!
>
> Ivo Van Doorn schrieb:
>> Hi,
>>
>> On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
>> <[email protected]> wrote:
>>> This patch adds support for 802.11w for rt2800. This is achieved by
>>> using the 802.11w implementation in mac80211.
>>>
>>> To get this working, it is necessary to disable hw encryption of
>>> rt2800pci / rt2800usb, because I don't know of any support in hardware
>>> for 802.11w and therefore let mac80211 do the whole job.
>>>
>>> The user can enable 802.11w with the new mod parameter enablemfp.
>>> Enabling MFP disables hw encryption.
>>>
>>> 802.11w is deactivated per default.
>>>
>>> Tested with rt2860 and rt3572.
>>>
>>> This is a workaround as long as there isn't hardware support implemented
>>> in the driver.
>>>
>>> Signed-off-by: Andreas Hartmann <[email protected]>
>>> ---
>>> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
>>> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c ? ? 2012-04-26 22:10:30.000000000 +0200
>>> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c ?2012-05-09 11:37:48.463278177 +0200
>>> @@ -4519,6 +4519,15 @@
>>> ? ? ? ? ? ?IEEE80211_HW_AMPDU_AGGREGATION |
>>> ? ? ? ? ? ?IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>>>
>>> + ? ? ? /*
>>> + ? ? ? ?* Enable support for 802.11w in mac80211. hwencryption must be disabled
>>> + ? ? ? ?*/
>>> + ? ? ? if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
>>> + ? ? ? ? ? ? ? INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>> + ? ? ? ? ? ? ? rt2x00dev->hw->flags |=
>>> + ? ? ? ? ? ? ? ? ? ? ? IEEE80211_HW_MFP_CAPABLE;
>>> + ? ? ? }
>>
>> Can't the whole patch be simplified into
>>
>> if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
>> ? ? ? ? ? ? ? ?INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>> ? ? ? ? ? ? ? ?rt2x00dev->hw->flags |=
>> ? ? ? ? ? ? ? ? ? ? ? ?IEEE80211_HW_MFP_CAPABLE;
>> }
>
> This would surely be possible, but it wouldn't be possible any more to
> run the driver w/o MFP support as long as hw encryption is disabled.
>
> Additionally, I would like to have an additional comment added to
> nohwcrypt, which mentions, that activating nohwcrypt enables MFP, like:
> "Disable hardware encryption, enable MFP." to let the user know, how to
> enable MFP.

I am wondering what the usecase would be for having an option to disable MFP?
Isn't that a feature which technically should be enabled by default and in the
userspace you have the configuration to use it or not?

Ivo

>>
>> Why need a extra moduleflag when all it does is toggle the nohwcrypto
>> module parameter?
>
> Because I wanted to achieve the old behaviour of the driver w/o hw
> encryption.
> If you think, this isn't necessary, I'm absolutely fine with removing it.
>
>
> Andreas

2012-05-10 15:35:39

by Andreas Hartmann

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

Gertjan van Wingerde schrieb:
> On 05/10/12 16:21, Andreas Hartmann wrote:
>> Hi Ivo,
>>
>> Ivo Van Doorn wrote:
>>> Hi,
>>>
>>> On Thu, May 10, 2012 at 12:55 PM, Andreas Hartmann
>>> <[email protected]> wrote:
>>>> Hello!
>>>>
>>>> Ivo Van Doorn schrieb:
>>>>> Hi,
>>>>>
>>>>> On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
>>>>> <[email protected]> wrote:
>>>>>> This patch adds support for 802.11w for rt2800. This is achieved by
>>>>>> using the 802.11w implementation in mac80211.
>>>>>>
>>>>>> To get this working, it is necessary to disable hw encryption of
>>>>>> rt2800pci / rt2800usb, because I don't know of any support in hardware
>>>>>> for 802.11w and therefore let mac80211 do the whole job.
>>>>>>
>>>>>> The user can enable 802.11w with the new mod parameter enablemfp.
>>>>>> Enabling MFP disables hw encryption.
>>>>>>
>>>>>> 802.11w is deactivated per default.
>>>>>>
>>>>>> Tested with rt2860 and rt3572.
>>>>>>
>>>>>> This is a workaround as long as there isn't hardware support implemented
>>>>>> in the driver.
>>>>>>
>>>>>> Signed-off-by: Andreas Hartmann <[email protected]>
>>>>>> ---
>>>>>> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
>>>>>> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2012-04-26 22:10:30.000000000 +0200
>>>>>> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c 2012-05-09 11:37:48.463278177 +0200
>>>>>> @@ -4519,6 +4519,15 @@
>>>>>> IEEE80211_HW_AMPDU_AGGREGATION |
>>>>>> IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>>>>>>
>>>>>> + /*
>>>>>> + * Enable support for 802.11w in mac80211. hwencryption must be disabled
>>>>>> + */
>>>>>> + if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
>>>>>> + INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>>>>> + rt2x00dev->hw->flags |=
>>>>>> + IEEE80211_HW_MFP_CAPABLE;
>>>>>> + }
>>>>>
>>>>> Can't the whole patch be simplified into
>>>>>
>>>>> if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
>>>>> INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>>>> rt2x00dev->hw->flags |=
>>>>> IEEE80211_HW_MFP_CAPABLE;
>>>>> }
>>>>
>>>> This would surely be possible, but it wouldn't be possible any more to
>>>> run the driver w/o MFP support as long as hw encryption is disabled.
>>>>
>>>> Additionally, I would like to have an additional comment added to
>>>> nohwcrypt, which mentions, that activating nohwcrypt enables MFP, like:
>>>> "Disable hardware encryption, enable MFP." to let the user know, how to
>>>> enable MFP.
>>>
>>> I am wondering what the usecase would be for having an option to disable MFP?
>>> Isn't that a feature which technically should be enabled by default and in the
>>> userspace you have the configuration to use it or not?
>>
>> It's the same idea as behind the nohwcrypt switch. If there are problems
>> with the feature in a special case, you have the possibility to disable it.
>> My understanding of nohwcrypt is to have a fallback mode, which I didn't
>> want to touch. That's all.
>>
>
> The difference here is that nohwcrypt has no userspace choice to use it,
> MFP does have that. Therefore I do not believe there is a need to also
> be able to enable/disable it at the module level.

You're right. I'll remove this choice and provide a new version!


Thanks for reviewing,
regards,
Andreas

2012-05-10 14:47:14

by Gertjan van Wingerde

[permalink] [raw]
Subject: Re: [rt2x00-users] [PATCH][RFC/RFT] rt2800: Implement selectable support for 802.11w (MFP)

On 05/10/12 16:21, Andreas Hartmann wrote:
> Hi Ivo,
>
> Ivo Van Doorn wrote:
>> Hi,
>>
>> On Thu, May 10, 2012 at 12:55 PM, Andreas Hartmann
>> <[email protected]> wrote:
>>> Hello!
>>>
>>> Ivo Van Doorn schrieb:
>>>> Hi,
>>>>
>>>> On Thu, May 10, 2012 at 9:19 AM, Andreas Hartmann
>>>> <[email protected]> wrote:
>>>>> This patch adds support for 802.11w for rt2800. This is achieved by
>>>>> using the 802.11w implementation in mac80211.
>>>>>
>>>>> To get this working, it is necessary to disable hw encryption of
>>>>> rt2800pci / rt2800usb, because I don't know of any support in hardware
>>>>> for 802.11w and therefore let mac80211 do the whole job.
>>>>>
>>>>> The user can enable 802.11w with the new mod parameter enablemfp.
>>>>> Enabling MFP disables hw encryption.
>>>>>
>>>>> 802.11w is deactivated per default.
>>>>>
>>>>> Tested with rt2860 and rt3572.
>>>>>
>>>>> This is a workaround as long as there isn't hardware support implemented
>>>>> in the driver.
>>>>>
>>>>> Signed-off-by: Andreas Hartmann <[email protected]>
>>>>> ---
>>>>> diff -ur compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c
>>>>> --- compat-wireless-2012-04-26.orig/drivers/net/wireless/rt2x00/rt2800lib.c 2012-04-26 22:10:30.000000000 +0200
>>>>> +++ compat-wireless-2012-04-26/drivers/net/wireless/rt2x00/rt2800lib.c 2012-05-09 11:37:48.463278177 +0200
>>>>> @@ -4519,6 +4519,15 @@
>>>>> IEEE80211_HW_AMPDU_AGGREGATION |
>>>>> IEEE80211_HW_REPORTS_TX_ACK_STATUS;
>>>>>
>>>>> + /*
>>>>> + * Enable support for 802.11w in mac80211. hwencryption must be disabled
>>>>> + */
>>>>> + if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags) && rt2x00dev->mfprequested) {
>>>>> + INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>>>> + rt2x00dev->hw->flags |=
>>>>> + IEEE80211_HW_MFP_CAPABLE;
>>>>> + }
>>>>
>>>> Can't the whole patch be simplified into
>>>>
>>>> if (!test_bit(CAPABILITY_HW_CRYPTO, &rt2x00dev->cap_flags)) {
>>>> INFO(rt2x00dev, "802.11w support (MFP) enabled.\n");
>>>> rt2x00dev->hw->flags |=
>>>> IEEE80211_HW_MFP_CAPABLE;
>>>> }
>>>
>>> This would surely be possible, but it wouldn't be possible any more to
>>> run the driver w/o MFP support as long as hw encryption is disabled.
>>>
>>> Additionally, I would like to have an additional comment added to
>>> nohwcrypt, which mentions, that activating nohwcrypt enables MFP, like:
>>> "Disable hardware encryption, enable MFP." to let the user know, how to
>>> enable MFP.
>>
>> I am wondering what the usecase would be for having an option to disable MFP?
>> Isn't that a feature which technically should be enabled by default and in the
>> userspace you have the configuration to use it or not?
>
> It's the same idea as behind the nohwcrypt switch. If there are problems
> with the feature in a special case, you have the possibility to disable it.
> My understanding of nohwcrypt is to have a fallback mode, which I didn't
> want to touch. That's all.
>

The difference here is that nohwcrypt has no userspace choice to use it,
MFP does have that. Therefore I do not believe there is a need to also
be able to enable/disable it at the module level.

---
Gertjan