Skip to contentSkip to conversation

remove custom Michael MIC implementation

RFC PATCH In review Tobin C. Harding 7 participants 19 messages Mar 31, 2017 – Apr 28, 2017 Staging

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 remove custom Michael MIC implementation

This RFC can be applied on op on Linus' tree 89970a0

Configuration options needed to build are

CONFIG_STAGING=y
CONFIG_KS7010=m

The ks7010 driver currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already. This patch is an attempt to replace the custom implementation with the in-tree implementation via the kernel cryptography API.

I am not an expert on the Michael Message Integrity Check or on cryptography in general. Actually, I'm not even an expert on kernel development.

I believe I have mirrored the behavior of the custom implementation. I do not know if I have done this completely correctly or, for that matter, if I have gone about it correctly. The only in-tree driver I could find that does the MIC check in software was the Orinoco driver (net/wireless/intersil/orinoco). I based this code off of the Orinoco code and the current implementation.

The whole thing is in one patch since there was no way to keep the driver in a sane state during the implementation replacement.

The steps I took were as follows;

1. Remove the custom implementation, michael_mic.[ch]

2. Implement helper functions that call the kernel crypto API, this is the code that is based of Orinoco, mic.[ch]

3. Replace driver calls to the custom implementation with calls to the newly defined helper functions.

The code is untested, I have hardware in the mail.

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

Thank you for taking the time to read this and for any tips you may be able to give me.

thanks,
Tobin.

Tobin C. Harding (1):
staging: ks7010: remove custom Michael MIC implementation

 drivers/staging/ks7010/Makefile      |   2 +-
 drivers/staging/ks7010/ks_hostif.c   |  48 +++++++-----
 drivers/staging/ks7010/ks_wlan.h     |   3 +
 drivers/staging/ks7010/mic.c         | 131 +++++++++++++++++++++++++++++++
 drivers/staging/ks7010/mic.h         |  22 ++++++
 drivers/staging/ks7010/michael_mic.c | 148 -----------------------------------
 drivers/staging/ks7010/michael_mic.h |  25 ------
 7 files changed, 186 insertions(+), 193 deletions(-)
 create mode 100644 drivers/staging/ks7010/mic.c
 create mode 100644 drivers/staging/ks7010/mic.h
 delete mode 100644 drivers/staging/ks7010/michael_mic.c
 delete mode 100644 drivers/staging/ks7010/michael_mic.h
Signature · 1 line
2.7.4
#1 lore raw

RFC PATCH 1/1 staging: ks7010: remove custom Michael MIC implementation

ks7010 currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already, we should use it.

Remove the custom implementation. Implement helper functions that call the in-tree implementation through the crypto API. Update the makefile. Replace driver calls to the custom implementation with calls to the newly defined helper functions.

---
 drivers/staging/ks7010/Makefile      |   2 +-
 drivers/staging/ks7010/ks_hostif.c   |  48 +++++++-----
 drivers/staging/ks7010/ks_wlan.h     |   3 +
 drivers/staging/ks7010/mic.c         | 131 +++++++++++++++++++++++++++++++
 drivers/staging/ks7010/mic.h         |  22 ++++++
 drivers/staging/ks7010/michael_mic.c | 148 -----------------------------------
 drivers/staging/ks7010/michael_mic.h |  25 ------
 7 files changed, 186 insertions(+), 193 deletions(-)
 create mode 100644 drivers/staging/ks7010/mic.c
 create mode 100644 drivers/staging/ks7010/mic.h
 delete mode 100644 drivers/staging/ks7010/michael_mic.c
 delete mode 100644 drivers/staging/ks7010/michael_mic.h
drivers/staging/ks7010/Makefile +1 -1
index 69fcf8d..195b570 100644
@@ -1,4 +1,4 @@
 obj-$(CONFIG_KS7010) += ks7010.o
 
 ccflags-y 	     += -DKS_WLAN_DEBUG=0
-ks7010-y	     := michael_mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o
+ks7010-y	     := mic.o ks_hostif.o ks_wlan_net.o ks7010_sdio.o
drivers/staging/ks7010/ks_hostif.c +29 -19

95 lines not on this page · raw message

drivers/staging/ks7010/ks_wlan.h +3 -0
index 9ab80e1..be475fa 100644
@@ -496,6 +496,9 @@ struct ks_wlan_private {
 	unsigned long last_wakeup;
 
 	uint wakeup_count;	/* for detect wakeup loop */
+
+	struct crypto_shash *rx_tfm_mic;
+	struct crypto_shash *tx_tfm_mic;
 };
 
 int ks_wlan_net_start(struct net_device *dev);
drivers/staging/ks7010/mic.c new file +131 -0

131 lines not on this page · raw message

drivers/staging/ks7010/mic.h new file +22 -0
new file mode 100644
index 0000000..eb048dc
@@ -0,0 +1,22 @@
+/*
+ *   MIC helpers
+ *
+ *   This program is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License version 2 as
+ *   published by the Free Software Foundation.
+ */
+#ifndef _KS7010_MIC_H_
+#define _KS7010_MIC_H_
+
+#include <linux/types.h>
+#include <crypto/hash.h>
+#include "ks_wlan.h"
+
+#define MICHAEL_MIC_LEN 8
+
+int ks_wlan_mic_init(struct ks_wlan_private *priv);
+void ks_wlan_mic_free(struct ks_wlan_private *priv);
+int ks_wlan_mic(struct crypto_shash *tfm_michael, u8 *key,
+		u8 priority, u8 *data, size_t data_len, u8 *mic);
+
+#endif /* _KS7010_MIC_H_ */
drivers/staging/ks7010/michael_mic.c deleted +0 -148

148 lines not on this page · raw message

drivers/staging/ks7010/michael_mic.h deleted +0 -25
deleted file mode 100644
index 248f849..0000000
@@ -1,25 +0,0 @@
-/*
- *   Driver for KeyStream wireless LAN
- *
- *   Copyright (C) 2005-2008 KeyStream Corp.
- *   Copyright (C) 2009 Renesas Technology Corp.
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License version 2 as
- *   published by the Free Software Foundation.
- */
-
-/* MichelMIC routine define */
-struct michel_mic_t {
-	u32 K0;	// Key
-	u32 K1;	// Key
-	u32 L;	// Current state
-	u32 R;	// Current state
-	u8 M[4];	// Message accumulator (single word)
-	int nBytesInM;	// # bytes in M
-	u8 Result[8];
-};
-
-void MichaelMICFunction(struct michel_mic_t *Mic, u8 *Key,
-			u8 *Data, int Len, u8 priority,
-			u8 *Result);
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH RFC] staging: ks7010: remove custom Michael MIC implementation

Quoted 3 lines · Tobin C. Harding

ks7010 currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already, we should use it.

ok, trivia:

Do please run your patch through checkpatch and fix a few style nits.

$ ./scripts/checkpatch.pl ~/1.mbox --strict --terse | cut -f2- -d":"
161: WARNING: line over 80 characters
170: WARNING: Missing a blank line after declarations
205: WARNING: line over 80 characters
229: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
263: WARNING: Prefer using "%s", __func__ to embedded function names
264: ERROR: code indent should use tabs where possible
264: WARNING: quoted string split across lines
272: WARNING: Prefer using "%s", __func__ to embedded function names
273: ERROR: code indent should use tabs where possible
273: WARNING: quoted string split across lines
325: WARNING: Prefer pr_warn(... to pr_warning(...
 2 errors, 9 warnings, 0 checks, 262 lines checked

and

drivers/staging/ks7010/mic.c

Quoted 1 line
drivers/staging/ks7010/mic.c +0 -0

[]

drivers/staging/ks7010/mic.c line 77

Quoted 5 lines
drivers/staging/ks7010/mic.c +5 -0
+int ks_wlan_mic(struct crypto_shash *tfm_michael, u8 *key,
+		u8 priority, u8 *data, size_t data_len, u8 *mic)
+{
+	SHASH_DESC_ON_STACK(desc, tfm_michael);
+	u8 hdr[ETH_HLEN + 2]; /* 16 bytes */

It might be better to declare a struct for this

drivers/staging/ks7010/mic.c line 106

Quoted 4 lines
drivers/staging/ks7010/mic.c +4 -0
+	hdr[ETH_ALEN * 2] = priority;
+	hdr[ETH_ALEN * 2 + 1] = 0;
+	hdr[ETH_ALEN * 2 + 2] = 0;
+	hdr[ETH_ALEN * 2 + 3] = 0;

And use struct members here.

#4 lore raw
In reply to Tobin C. Harding
Quoted 2 lines

The code is untested, I have hardware in the mail.

Cool!

Quoted 3 lines

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

I'll just repeat that the key move to get this driver out of staging is to get away from the WEXT interface to CFG80211. Otherwise no chance that wireless maintainers will even look at it. This is a huge change but once it is done, features like Michael MIC come with it for free (from what I recall, I am not a wireless expert myself).

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

But if you want a clean WEXT driver first, this is a step in the right direction.

#3 lore raw

Re: [PATCH RFC] staging: ks7010: remove custom Michael MIC implementation

In reply to Joe Perches
Quoted 9 lines · Joe Perches
Quoted 3 lines · Tobin C. Harding

ks7010 currently uses a custom implementation of the Michael MIC algorithm. The kernel has an implementation of this algorithm already, we should use it.

ok, trivia:

Do please run your patch through checkpatch and fix a few style nits.

Quoted 13 lines
$ ./scripts/checkpatch.pl ~/1.mbox --strict --terse | cut -f2- -d":"
161: WARNING: line over 80 characters
170: WARNING: Missing a blank line after declarations
205: WARNING: line over 80 characters
229: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
263: WARNING: Prefer using "%s", __func__ to embedded function names
264: ERROR: code indent should use tabs where possible
264: WARNING: quoted string split across lines
272: WARNING: Prefer using "%s", __func__ to embedded function names
273: ERROR: code indent should use tabs where possible
273: WARNING: quoted string split across lines
325: WARNING: Prefer pr_warn(... to pr_warning(...
 2 errors, 9 warnings, 0 checks, 262 lines checked

Face palm :)

Quoted 13 lines

and

drivers/staging/ks7010/mic.c

Quoted 1 line
drivers/staging/ks7010/mic.c +0 -0

[]

drivers/staging/ks7010/mic.c line 77

Quoted 5 lines
drivers/staging/ks7010/mic.c +5 -0
+int ks_wlan_mic(struct crypto_shash *tfm_michael, u8 *key,
+		u8 priority, u8 *data, size_t data_len, u8 *mic)
+{
+	SHASH_DESC_ON_STACK(desc, tfm_michael);
+	u8 hdr[ETH_HLEN + 2]; /* 16 bytes */

It might be better to declare a struct for this

Quoted 7 lines

drivers/staging/ks7010/mic.c line 106

Quoted 4 lines
drivers/staging/ks7010/mic.c +4 -0
+	hdr[ETH_ALEN * 2] = priority;
+	hdr[ETH_ALEN * 2 + 1] = 0;
+	hdr[ETH_ALEN * 2 + 2] = 0;
+	hdr[ETH_ALEN * 2 + 3] = 0;

And use struct members here.

Thanks Joe,
Tobin.

#5 lore raw
In reply to Wolfram Sang
Quoted 4 lines · Wolfram Sang
Quoted 2 lines

The code is untested, I have hardware in the mail.

Cool!

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver. I am going to attempt to get it running on a Raspberry Pi B+. I ordered the wrong size break out board originally so waiting on the new one now.

Quoted 10 lines
Quoted 4 lines

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

I'll just repeat that the key move to get this driver out of staging is to get away from the WEXT interface to CFG80211. Otherwise no chance that wireless maintainers will even look at it. This is a huge change but once it is done, features like Michael MIC come with it for free (from what I recall, I am not a wireless expert myself).

That would explain why I could not find more than the Orinoco driver using the Michael MIC module directly.

Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

Quoted 4 lines

But if you want a clean WEXT driver first, this is a step in the right direction.

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

thanks,
Tobin.

#6 lore raw

Hi,

Quoted 2 lines

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver.

Sorry, likely not. It is an early SDW-821 and has a MediaTek chipset for which no driver is known:
https://wikidevi.com/wiki/Spectec_SDW-821_%28MediaTek%29

For SDW-821 (SD size) and KS7010, you'd need a "S2Y-WLAN-11G-K" (but I have never seen one yet):
https://wikidevi.com/wiki/Spectec_SDW-821_%28KeyStream%29

One can find an SDW-823 (microSD) "S2Y-MWLAN-11B-G" once in a while:
https://wikidevi.com/wiki/Spectec_SDW-823

Quoted 8 lines
Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

That should do.

Quoted 3 lines

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Yes, have a look around and check if you like that task. I might have a spare SDW-823 lying around if you are up to it. But check first, it is not a trivial task. On the pro side, there are tons of interesting things about WiFI and kernel development to learn on the way :)

Regards,

Wolfram

#7 lore raw
Quoted 8 lines · Wolfram Sang

Hi,

Quoted 2 lines

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver.

Sorry, likely not. It is an early SDW-821 and has a MediaTek chipset for which no driver is known:
https://wikidevi.com/wiki/Spectec_SDW-821_%28MediaTek%29

Oh damn.

Quoted 7 lines

For SDW-821 (SD size) and KS7010, you'd need a "S2Y-WLAN-11G-K" (but I have never seen one yet):
https://wikidevi.com/wiki/Spectec_SDW-821_%28KeyStream%29

One can find an SDW-823 (microSD) "S2Y-MWLAN-11B-G" once in a while:
https://wikidevi.com/wiki/Spectec_SDW-823

That's actually the page I was reading, I didn't notice the 'M' in there.

Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

That should do.

Quoted 8 lines
Quoted 3 lines

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Yes, have a look around and check if you like that task. I might have a spare SDW-823 lying around if you are up to it. But check first, it is not a trivial task. On the pro side, there are tons of interesting things about WiFI and kernel development to learn on the way :)

I like the task. You had me at 'this is a huge change...' in your first email. Whether I have the ability is yet to be seen. Thanks for the offer of the card, let's wait first to see if I can make any progress that warrants testing. The new breakout board turned up in the mail today, super glad to read your email before I spent the day tomorrow trying to get it working :)

Quoted 5 lines

Regards,

Wolfram

Cheers Wolfram,
Tobin.

#10 lore raw
In reply to Tobin C. Harding

+ linux-wireless

Quoted 16 lines · Tobin C. Harding
Quoted 4 lines · Wolfram Sang
Quoted 2 lines

The code is untested, I have hardware in the mail.

Cool!

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver. I am going to attempt to get it running on a Raspberry Pi B+. I ordered the wrong size break out board originally so waiting on the new one now.

Quoted 5 lines
Quoted 4 lines

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

Quoted 8 lines
Quoted 5 lines

I'll just repeat that the key move to get this driver out of staging is to get away from the WEXT interface to CFG80211. Otherwise no chance that wireless maintainers will even look at it. This is a huge change but once it is done, features like Michael MIC come with it for free (from what I recall, I am not a wireless expert myself).

That would explain why I could not find more than the Orinoco driver using the Michael MIC module directly.

I think cfg80211 and mac80211 got mixed up. mac80211 (the full IEEE 802.11 stack for "softmac" devices) provides Michael MIC implementation, but cfg80211 (for "hardmac" devices) does not.

Quoted 10 lines
Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

But if you want a clean WEXT driver first, this is a step in the right direction.

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Please keep linux-wireless list in loop so that people on that list can help.

Signature · 1 line
Kalle Valo
#11 lore raw
Quoted 26 lines · Kalle Valo

+ linux-wireless

Quoted 22 lines · Tobin C. Harding
Quoted 4 lines · Wolfram Sang
Quoted 2 lines

The code is untested, I have hardware in the mail.

Cool!

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver. I am going to attempt to get it running on a Raspberry Pi B+. I ordered the wrong size break out board originally so waiting on the new one now.

Quoted 10 lines
Quoted 4 lines

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

I'll just repeat that the key move to get this driver out of staging is to get away from the WEXT interface to CFG80211. Otherwise no chance that wireless maintainers will even look at it. This is a huge change but once it is done, features like Michael MIC come with it for free (from what I recall, I am not a wireless expert myself).

Quoted 6 lines
Quoted 2 lines

That would explain why I could not find more than the Orinoco driver using the Michael MIC module directly.

I think cfg80211 and mac80211 got mixed up. mac80211 (the full IEEE 802.11 stack for "softmac" devices) provides Michael MIC implementation, but cfg80211 (for "hardmac" devices) does not.

Cool, thanks for clarifying. Hilariously I was just sitting down trying to figure out what was up after a day spent trying to merge ideas from ath6kl (fullmac) and ks7010. I finally spent some time reading the cw1200 driver (softmac) for further inspiration.

Quoted 13 lines
Quoted 13 lines
Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

Quoted 3 lines

But if you want a clean WEXT driver first, this is a step in the right direction.

Quoted 6 lines
Quoted 3 lines

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Please keep linux-wireless list in loop so that people on that list can help.

How newbie friendly is the linux-wireless list please? I am having trouble separating the data path code from the control path. I think I will spend a few more days on it though before asking any questions.

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

thanks,
Tobin.

#12 lore raw
Quoted 11 lines · Tobin C. Harding
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

But if you want a clean WEXT driver first, this is a step in the right direction.

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Please keep linux-wireless list in loop so that people on that list can help.

How newbie friendly is the linux-wireless list please?

I would claim quite friendly, but I'm finnish and our definition of "friendly" seems to be very different from rest of the world ;)

Quoted 3 lines

I am having trouble separating the data path code from the control path. I think I will spend a few more days on it though before asking any questions.

People do send questions to the list and most of the time they get answered. So go for it.

There's also an irc channel which usually is helpful:

https://wireless.wiki.kernel.org/en/users/support#linux_wireless_user_irc_channel

Quoted 2 lines

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

You mean a mac80211 driver? mac80211_hwsim is the simplest one, but that's not a real driver as it's a simulator. Just grep ieee80211_register() to find all the drivers. Smaller drivers like rtl8xxxu or wl1251 might be good starting points to get familiar with the stack.

And I guess you already saw the documentation:

https://wireless.wiki.kernel.org/en/developers/documentation/mac80211

Signature · 1 line
Kalle Valo
#14 lore raw

seems we are missing out again?

Quoted 6 lines · Toke Høiland-Jørgensen
Quoted 2 lines · Tobin C. Harding

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

I'll suggest taking a look at the ath9k driver :)

Looking at ks7010 driver it looks like it has 802.11 stack in firmware and not sure if Renesas is actively supporting this effort to come up with mac80211-friendly firmware or provide detailed chip info.

Regards,
Arend

#18 lore raw
In reply to Tobin C. Harding
Quoted 30 lines · Tobin C. Harding
Quoted 29 lines · Kalle Valo

+ linux-wireless

Quoted 24 lines · Tobin C. Harding
Quoted 4 lines · Wolfram Sang
Quoted 2 lines

The code is untested, I have hardware in the mail.

Cool!

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver. I am going to attempt to get it running on a Raspberry Pi B+. I ordered the wrong size break out board originally so waiting on the new one now.

Quoted 10 lines
Quoted 4 lines

If any one is interested and has any comments I would really like to hear them. I am open to all suggestions (even down to trivial coding style issues).

I'll just repeat that the key move to get this driver out of staging is to get away from the WEXT interface to CFG80211. Otherwise no chance that wireless maintainers will even look at it. This is a huge change but once it is done, features like Michael MIC come with it for free (from what I recall, I am not a wireless expert myself).

That would explain why I could not find more than the Orinoco driver using the Michael MIC module directly.

Quoted 8 lines
Quoted 3 lines

I think cfg80211 and mac80211 got mixed up. mac80211 (the full IEEE 802.11 stack for "softmac" devices) provides Michael MIC implementation, but cfg80211 (for "hardmac" devices) does not.

Cool, thanks for clarifying. Hilariously I was just sitting down trying to figure out what was up after a day spent trying to merge ideas from ath6kl (fullmac) and ks7010. I finally spent some time reading the cw1200 driver (softmac) for further inspiration.

As an example of a driver that has been moved from an internal wireless stack to using the kernel stack is the vt6655 driver. I think it's the only driver that has done this type of transition, so look at the patch history of it for an example of what to do.

good luck!

greg k-h

#15 lore raw
In reply to Arend Van Spriel
Quoted 1 line · Arend Van Spriel

seems we are missing out again?

Sorry, I don't understand what this comment means?

Quoted 11 lines · Toke Høiland-Jørgensen
Quoted 6 lines
Quoted 2 lines · Tobin C. Harding

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

I'll suggest taking a look at the ath9k driver :)

Looking at ks7010 driver it looks like it has 802.11 stack in firmware and not sure if Renesas is actively supporting this effort to come up with mac80211-friendly firmware or provide detailed chip info.

Thanks for taking a look. If the ks7010 driver has 802.11 stack in firmware does that mean it is not compatible with using the kernel mac80211 stack with the current firmware? I do not have my hopes up about getting any chip information out of Renesas, all I think we have to go in is the current WEXT driver.

This is an exercise in learning for me, but I do not want to take any ones time up with a project that is not that useful. Is getting the ks7010 driver out of staging something that is of use to the kernel community or are there other wi-fi tasks that our time is better spent on?

thanks,
Tobin.

#16 lore raw
Quoted 4 lines · Tobin C. Harding
Quoted 1 line · Arend Van Spriel

seems we are missing out again?

Sorry, I don't understand what this comment means?

My bad. I had to reset my email account in thunderbird and now it needs to learn anew what is spam and what is not. So I missed out on the conversation as some messages (a lot actually) ended up in my spam folder.

Quoted 12 lines
Quoted 11 lines · Toke Høiland-Jørgensen
Quoted 6 lines
Quoted 2 lines · Tobin C. Harding

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

I'll suggest taking a look at the ath9k driver :)

Looking at ks7010 driver it looks like it has 802.11 stack in firmware and not sure if Renesas is actively supporting this effort to come up with mac80211-friendly firmware or provide detailed chip info.

Quoted 5 lines

Thanks for taking a look. If the ks7010 driver has 802.11 stack in firmware does that mean it is not compatible with using the kernel mac80211 stack with the current firmware? I do not have my hopes up about getting any chip information out of Renesas, all I think we have to go in is the current WEXT driver.

Indeed. That is my gut feeling as well and if that is truly the case your best option would be a cfg80211-based driver like ath6kl, mwifiex, and brcmfmac.

Quoted 5 lines

This is an exercise in learning for me, but I do not want to take any ones time up with a project that is not that useful. Is getting the ks7010 driver out of staging something that is of use to the kernel community or are there other wi-fi tasks that our time is better spent on?

If there are linux users with this hardware than sure. Especially if it revised to interface with the latest wireless subsystem so tools like iw can operate on it.

Also I suppose it is preferred if a driver is maintained. I do not see the ks7010 listed in the MAINTAINERS file yet.

Quoted 3 lines

thanks,
Tobin.

#17 lore raw
Quoted 18 lines · Arend Van Spriel
Quoted 12 lines
Quoted 11 lines · Toke Høiland-Jørgensen
Quoted 6 lines
Quoted 2 lines · Tobin C. Harding

Except one: do you know off the top of your head of a canonical implementation of a softmac wi-fi driver.

I'll suggest taking a look at the ath9k driver :)

Looking at ks7010 driver it looks like it has 802.11 stack in firmware and not sure if Renesas is actively supporting this effort to come up with mac80211-friendly firmware or provide detailed chip info.

Quoted 5 lines

Thanks for taking a look. If the ks7010 driver has 802.11 stack in firmware does that mean it is not compatible with using the kernel mac80211 stack with the current firmware? I do not have my hopes up about getting any chip information out of Renesas, all I think we have to go in is the current WEXT driver.

Quoted 3 lines

Indeed. That is my gut feeling as well and if that is truly the case your best option would be a cfg80211-based driver like ath6kl, mwifiex, and brcmfmac.

Ok. So that would mean that we still have to do the Michael MIC in software (using kernel crypto API) right?

I think the best course of action is to totally clean up the WEXT interface, including getting Michael MIC working with kernel crypto, test it all, and then attempt the migration to cfg80211 interface.

If no one thinks that's a bad idea I'll keep working on the WEXT interface for now.

Quoted 6 lines
Quoted 5 lines

This is an exercise in learning for me, but I do not want to take any ones time up with a project that is not that useful. Is getting the ks7010 driver out of staging something that is of use to the kernel community or are there other wi-fi tasks that our time is better spent on?

Quoted 6 lines

If there are linux users with this hardware than sure. Especially if it revised to interface with the latest wireless subsystem so tools like iw can operate on it.

Also I suppose it is preferred if a driver is maintained. I do not see the ks7010 listed in the MAINTAINERS file yet.

How's this for a MAINTAINERS entry?

KS7010 KEYSTREAM DRIVER

M:      Wolfram Sang <[email protected]>
M:      Tobin Harding <[email protected]>
L:      [email protected]
S:      Maintained
F:      drivers/staging/ks7010/

Wolfram, is this ok by you;
(a) To put your name
(b) To put my name

Is the status correct, I'm happy to help maintain it if that is acceptable for someone of my experience level to do so. Is this driver part of your job?

thanks,
Tobin.

#8 lore raw
In reply to Wolfram Sang
Quoted 27 lines · Wolfram Sang

Hi,

Quoted 2 lines

The card I have is a Spectec FCC ID: S2Y-WLAN-11B-G which I believe is a SDW-823 and should use the ks7010 driver.

Sorry, likely not. It is an early SDW-821 and has a MediaTek chipset for which no driver is known:
https://wikidevi.com/wiki/Spectec_SDW-821_%28MediaTek%29

For SDW-821 (SD size) and KS7010, you'd need a "S2Y-WLAN-11G-K" (but I have never seen one yet):
https://wikidevi.com/wiki/Spectec_SDW-821_%28KeyStream%29

One can find an SDW-823 (microSD) "S2Y-MWLAN-11B-G" once in a while:
https://wikidevi.com/wiki/Spectec_SDW-823

Quoted 8 lines
Quoted 4 lines

Without the CFG80211 conversion, replacing the Michael custom implementation with the in-kernel one makes the driver a tad better and is good exercise. However, it will sadly not help to get the driver out of staging.

I'll drop it then. Could you please tell me, is there any thing else more I need to do to let LKML know that this RFC is dropped? Or is this reply enough. I don't want to use any ones time unnecessarily.

That should do.

Quoted 8 lines
Quoted 3 lines

Let's go for a CFG80211 driver and get out of staging :) So next step is I guess study the ath6kl driver, learn how CFG80211 is done and implement that interface in ks7010? Oh, and test that it works.

Yes, have a look around and check if you like that task. I might have a spare SDW-823 lying around if you are up to it. But check first, it is not a trivial task. On the pro side, there are tons of interesting things about WiFI and kernel development to learn on the way :)

Hi Wolfram,

After receiving this email a while back I spent a day or two trying to get started on the cfg80211 conversion. I was unable to make progress so I decided to spend some time cleaning up the WEXT interface and learning more about the driver (and wifi in general). As you may have seen, a series was just merged refactoring the SDIO code, and there is a series in flight refactoring the host interface code. I started working on ks_wlan_net.c and will likely put together a patch set next week if the hostif series gets merged.

At this stage, I think I have a fair handle on how the ks7010 driver functions. I have two ideas on how to continue. First, I think it may be time to do some testing and fix all of the bugs I have introduced over this last month :). This is the reason for this email. Can I please take you up on the offer of the SDW-823 card, if you can find it? Secondly, I think I should spend some time studying the mwifiex (SoftMAC) and ath6kl (FullMAC) drivers to get a handle on cfg80211.

Then I can have another crack at the ks7010 cfg80211 conversion.

Do you have any other data on the chipset? Have you had any interaction with Renesas?

Sorry to write you such a long email. Thanks for taking the time to read it.

Regards,
Tobin.

#9 lore raw

Hi Tobin,

Quoted 3 lines

over this last month :). This is the reason for this email. Can I please take you up on the offer of the SDW-823 card, if you can find it?

Sure, I have it here. Just mail me (privately) the address to send it to and I'll ship right away.

Quoted 2 lines

Secondly, I think I should spend some time studying the mwifiex (SoftMAC) and ath6kl (FullMAC) drivers to get a handle on cfg80211.

That sounds like a good plan. Great progress you made, really!

Quoted 2 lines

Do you have any other data on the chipset? Have you had any interaction with Renesas?

Nope, sadly not. I do work for Renesas as a contractor, but it is a huge company and I work for a totally different section (SoCs). Plus, it is 8 years old data and it might be only available in Japanese, so I wouldn't have high hopes. Any specific information you are missing?

All the best,

Wolfram