RFC: Wireless Extensions for rndis_host
Subsystems (5)
cover RFC: Wireless Extensions for rndis_host
Hello all,
I have here a patchset that needs some review. This patchset adds wireless extensions for rndis_host to enable support for RNDIS based USB wireless LAN adapters (e.g. Linksys WUSB54GS, Belkin F05D7051).
In this patchset:
1. Fix sparse warning: returning void valued expression 2. Hardwire CDC descriptors when missing 3. Use 1KB buffer in rndis_unbind 4. Halt device if rndis_bind fails 5. Fix rndis packet filter flags 6. Split up rndis_host.c 7. Add Wireless Extensions for rndis_host 8. Use wlan device name for RNDIS wireless devices
The first five patches are more generic fixes that I think can be applied as they are. Of these, patch 2 is required to get these wireless devices working.
Patches 6-8 introduce some larger changes that may need a closer look.
All these patches should be applied in order. The entire series should apply cleanly to current linux kernel and net-2.6.25 trees.
regards,
Bjorge Dijkstra
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/8 Fix sparse warning: returning void-valued expression
rndis_unbind and usbnet_cdc_unbind don't return anything.
--- drivers/net/usb/rndis_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/usb/rndis_host.c +1 -1
@@ -585,7 +585,7 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)kfree (halt); } -return usbnet_cdc_unbind (dev, intf); +usbnet_cdc_unbind (dev, intf); }/*
Signature · 1 line
1.5.2.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
David Brownell
Acked-byRe: [PATCH 1/8] Fix sparse warning: returning void-valued expression
Quoted 10 lines
From [email protected] Sat Dec 22 13:52:53 2007
From: Bjorge Dijkstra <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [PATCH 1/8] Fix sparse warning: returning void-valued expression
Date: Sat, 22 Dec 2007 22:51:27 +0100
rndis_unbindandusbnet_cdc_unbinddon't return anything.Signed-off-by Bjorge Dijkstra <[email protected]>
Quoted 20 lines
--- drivers/net/usb/rndis_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/usb/rndis_host.c +1
-1@@ -585,7 +585,7 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)kfree (halt); } -return usbnet_cdc_unbind (dev, intf); +usbnet_cdc_unbind (dev, intf); }/* Signature · 1 line
1.5.2.5
PATCH 4/8 Halt device if rndis_bind fails.
In reply to a message not in the archiveFrom: Jussi Kivilinna <[email protected]>
When bind fails after device was initialized, shutdown device properly by sending RNDIS_MSG_HALT.
--- drivers/net/usb/rndis_host.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/usb/rndis_host.c +9 -3
@@ -467,6 +467,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)struct rndis_query_c *get_c;struct rndis_set *set;struct rndis_set_c *set_c; +struct rndis_halt *halt; } u;u32 tmp;int reply_len;
@@ -517,7 +518,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)"dev can't take %u byte packets (max %u)\n" , dev->hard_mtu, tmp); retval = -EINVAL ; - goto fail_and_release; + goto halt_fail_and_release; } dev->hard_mtu = tmp; net->mtu = dev->hard_mtu - net->hard_header_len;
@@ -539,7 +540,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) 48, (void **) &bp, &reply_len);if (unlikely (retval<0 )) {dev_err (&intf->dev,"rndis get ethaddr, %d\n" , retval); - goto fail_and_release; + goto halt_fail_and_release; }memcpy (net->dev_addr, bp,ETH_ALEN );
@@ -555,7 +556,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) retval =rndis_command (dev, u.header);if (unlikely (retval <0 )) {dev_err (&intf->dev,"rndis set packet filter, %d\n" , retval); - goto fail_and_release; + goto halt_fail_and_release; } retval =0 ;
@@ -563,6 +564,11 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)kfree (u.buf);return retval; +halt_fail_and_release: +memset (u.halt,0 ,sizeof *u.halt); + u.halt->msg_type =RNDIS_MSG_HALT ; + u.halt->msg_len =ccpu2 (sizeof *u.halt); + (void )rndis_command (dev, (void *)u.halt); fail_and_release:usb_set_intfdata (info->data,NULL );usb_driver_release_interface (driver_of (intf), info->data);
Signature · 1 line
1.5.2.5
Re: [PATCH 4/8] [PATCH] Halt device if rndis_bind fails.
Quoted 8 lines
From [email protected] Sat Dec 22 13:53:07 2007
From: Bjorge Dijkstra <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
Jussi Kivilinna <[email protected]>
Subject: [PATCH 4/8] [PATCH] Halt device ifrndis_bindfails.
Date: Sat, 22 Dec 2007 22:51:30 +0100
Quoted 7 lines
From: Jussi Kivilinna <[email protected]>
When bind fails after device was initialized, shutdown device properly by sending
RNDIS_MSG_HALT.Signed-off-by Jussi Kivilinna <[email protected]>Signed-off-by Bjorge Dijkstra <[email protected]>
Quoted 58 lines
--- drivers/net/usb/rndis_host.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)drivers/net/usb/rndis_host.c +9
-3@@ -467,6 +467,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)struct rndis_query_c *get_c;struct rndis_set *set;struct rndis_set_c *set_c; +struct rndis_halt *halt; } u;u32 tmp;int reply_len;@@ -517,7 +518,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)"dev can't take %u byte packets (max %u)\n" , dev->hard_mtu, tmp); retval = -EINVAL ; - goto fail_and_release; + goto halt_fail_and_release; } dev->hard_mtu = tmp; net->mtu = dev->hard_mtu - net->hard_header_len;@@ -539,7 +540,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) 48, (void **) &bp, &reply_len);if (unlikely (retval<0 )) {dev_err (&intf->dev,"rndis get ethaddr, %d\n" , retval); - goto fail_and_release; + goto halt_fail_and_release; }memcpy (net->dev_addr, bp,ETH_ALEN );@@ -555,7 +556,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) retval =rndis_command (dev, u.header);if (unlikely (retval <0 )) {dev_err (&intf->dev,"rndis set packet filter, %d\n" , retval); - goto fail_and_release; + goto halt_fail_and_release; } retval =0 ;@@ -563,6 +564,11 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf)kfree (u.buf);return retval; +halt_fail_and_release: +memset (u.halt,0 ,sizeof *u.halt); + u.halt->msg_type =RNDIS_MSG_HALT ; + u.halt->msg_len =ccpu2 (sizeof *u.halt); + (void )rndis_command (dev, (void *)u.halt); fail_and_release:usb_set_intfdata (info->data,NULL );usb_driver_release_interface (driver_of (intf), info->data);Signature · 1 line
1.5.2.5
PATCH 5/8 Fix rndis packet filter flags.
In reply to a message not in the archiveFrom: Jussi Kivilinna <[email protected]>
RNDIS packet filter flags are not exactly the same as CDC flags so we cannot reuse them.
--- drivers/net/usb/rndis_host.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-)
drivers/net/usb/rndis_host.c +22 -1
@@ -256,6 +256,27 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) +/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001) +#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002) +#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004) +#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008) +#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010) +#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020) +#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040) +#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080) +#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000) +#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000) +#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000) +#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000) + +/* default filter used with RNDIS devices */ +#define RNDIS_DEFAULT_FILTER ( \ + RNDIS_PACKET_TYPE_DIRECTED | \ + RNDIS_PACKET_TYPE_BROADCAST | \ + RNDIS_PACKET_TYPE_ALL_MULTICAST | \ + RNDIS_PACKET_TYPE_PROMISCUOUS ) +/* * RNDIS notifications from device: command completion; "reverse" * keepalives; etc
@@ -551,7 +572,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) u.set->oid =OID_GEN_CURRENT_PACKET_FILTER ; u.set->len =ccpu2 (4 ); u.set->offset =ccpu2 ((sizeof *u.set) -8 ); - *(__le32 *)(u.buf +sizeof *u.set) =ccpu2 (DEFAULT_FILTER ); + *(__le32 *)(u.buf +sizeof *u.set) =RNDIS_DEFAULT_FILTER ; retval =rndis_command (dev, u.header);if (unlikely (retval <0 )) {
Signature · 1 line
1.5.2.5
Re: [PATCH 5/8] Fix rndis packet filter flags.
Quoted 8 lines
From [email protected] Sat Dec 22 13:53:12 2007
From: Bjorge Dijkstra <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
Jussi Kivilinna <[email protected]>
Subject: [PATCH 5/8] Fix rndis packet filter flags.
Date: Sat, 22 Dec 2007 22:51:31 +0100
Quoted 7 lines
From: Jussi Kivilinna <[email protected]>
RNDIS packet filter flags are not exactly the same as CDC flags so we cannot reuse them.
Signed-off-by Jussi Kivilinna <[email protected]>Signed-off-by Bjorge Dijkstra <[email protected]>
Hmm, the list seems to have grown since I last looked at it. Or maybe it's just that the MSFT documentation was so hard to make sense of ... I never could figure out what the RNDIS power management messages were supposed to be doing, or what the extra seemingly-undocumented messages were there for.
Quoted 48 lines
--- drivers/net/usb/rndis_host.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-)drivers/net/usb/rndis_host.c +22
-1@@ -256,6 +256,27 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) +/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ +#define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001) +#define RNDIS_PACKET_TYPE_MULTICAST ccpu2(0x00000002) +#define RNDIS_PACKET_TYPE_ALL_MULTICAST ccpu2(0x00000004) +#define RNDIS_PACKET_TYPE_BROADCAST ccpu2(0x00000008) +#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x00000010) +#define RNDIS_PACKET_TYPE_PROMISCUOUS ccpu2(0x00000020) +#define RNDIS_PACKET_TYPE_SMT ccpu2(0x00000040) +#define RNDIS_PACKET_TYPE_ALL_LOCAL ccpu2(0x00000080) +#define RNDIS_PACKET_TYPE_GROUP ccpu2(0x00001000) +#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x00002000) +#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x00004000) +#define RNDIS_PACKET_TYPE_MAC_FRAME ccpu2(0x00008000) + +/* default filter used with RNDIS devices */ +#define RNDIS_DEFAULT_FILTER ( \ + RNDIS_PACKET_TYPE_DIRECTED | \ + RNDIS_PACKET_TYPE_BROADCAST | \ + RNDIS_PACKET_TYPE_ALL_MULTICAST | \ + RNDIS_PACKET_TYPE_PROMISCUOUS ) +/* * RNDIS notifications from device: command completion; "reverse" * keepalives; etc @@ -551,7 +572,7 @@ static int rndis_bind(struct usbnet *dev, struct usb_interface *intf) u.set->oid =OID_GEN_CURRENT_PACKET_FILTER ; u.set->len =ccpu2 (4 ); u.set->offset =ccpu2 ((sizeof *u.set) -8 ); - *(__le32 *)(u.buf +sizeof *u.set) =ccpu2 (DEFAULT_FILTER ); + *(__le32 *)(u.buf +sizeof *u.set) =RNDIS_DEFAULT_FILTER ; retval =rndis_command (dev, u.header);if (unlikely (retval <0 )) {Signature · 1 line
1.5.2.5
PATCH 8/8 Use wlan device name for RNDIS wireless devices
In reply to a message not in the archiveFrom: Jussi Kivilinna <[email protected]>
Use wlan device name for RNDIS wireless devices.
--- drivers/net/usb/rndis_wext.c | 2 +- drivers/net/usb/usbnet.c | 3 +++ drivers/net/usb/usbnet.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletions(-)
drivers/net/usb/rndis_wext.c +1 -1
@@ -2166,7 +2166,7 @@ static int rndis_wext_reset(struct usbnet *dev)struct driver_info rndis_wext_info = { .description ="Wireless RNDIS device" , - .flags =FLAG_ETHER |FLAG_FRAMING_RN |FLAG_NO_SETINT , + .flags =FLAG_WLAN |FLAG_FRAMING_RN |FLAG_NO_SETINT , .bind = rndis_wext_bind, .unbind = rndis_wext_unbind, .status = rndis_status,
drivers/net/usb/usbnet.c +3 -0
@@ -1204,6 +1204,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)if ((dev->driver_info->flags &FLAG_ETHER ) !=0 && (net->dev_addr [0 ] &0x02 ) ==0 )strcpy (net->name,"eth%d" ); +/* WLAN devices should always be named "wlan%d" */ +if ((dev->driver_info->flags &FLAG_WLAN ) !=0 ) +strcpy (net->name,"wlan%d" );/* maybe the remote can't receive an Ethernet MTU */ if (net->mtu > (dev->hard_mtu - net->hard_header_len))
drivers/net/usb/usbnet.h +2 -0
@@ -88,6 +88,8 @@ struct driver_info {#define FLAG_ETHER 0x0020/* maybe use "eth%d" names */ #define FLAG_FRAMING_AX 0x0040/* AX88772/178 packets */ +#define FLAG_WLAN 0x0080/* use "wlan%d" names */ +/* init device ... can sleep, or cause probe() failure */ int (*bind)(struct usbnet *,struct usb_interface *);
Signature · 1 line
1.5.2.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
David Brownell
Acked-byRe: [PATCH 8/8] [PATCH] Use wlan device name for RNDIS wireless devices
Quoted 10 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 8/8] [PATCH] Use wlan device name for RNDIS wireless devices
Date: Sat, 22 Dec 2007 22:51:34 +0100From: Jussi Kivilinna <[email protected]>
Use wlan device name for RNDIS wireless devices.
Signed-off-by Jussi Kivilinna <[email protected]>Signed-off-by Bjorge Dijkstra <[email protected]>
... though it'd be a bit nicer IMO to see this before patch #7, and just have one (or two) patches that only add infrastructure to the usbnet core code, before the rndis_wext patch which uses that new infrastructure.
Quoted 49 lines
--- drivers/net/usb/rndis_wext.c | 2 +- drivers/net/usb/usbnet.c | 3 +++ drivers/net/usb/usbnet.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletions(-)drivers/net/usb/rndis_wext.c +1
-1@@ -2166,7 +2166,7 @@ static int rndis_wext_reset(struct usbnet *dev)struct driver_info rndis_wext_info = { .description ="Wireless RNDIS device" , - .flags =FLAG_ETHER |FLAG_FRAMING_RN |FLAG_NO_SETINT , + .flags =FLAG_WLAN |FLAG_FRAMING_RN |FLAG_NO_SETINT , .bind = rndis_wext_bind, .unbind = rndis_wext_unbind, .status = rndis_status,drivers/net/usb/usbnet.c +3
-0@@ -1204,6 +1204,9 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)if ((dev->driver_info->flags &FLAG_ETHER ) !=0 && (net->dev_addr [0 ] &0x02 ) ==0 )strcpy (net->name,"eth%d" ); +/* WLAN devices should always be named "wlan%d" */ +if ((dev->driver_info->flags &FLAG_WLAN ) !=0 ) +strcpy (net->name,"wlan%d" );/* maybe the remote can't receive an Ethernet MTU */ if (net->mtu > (dev->hard_mtu - net->hard_header_len))drivers/net/usb/usbnet.h +2
-0@@ -88,6 +88,8 @@ struct driver_info {#define FLAG_ETHER 0x0020/* maybe use "eth%d" names */ #define FLAG_FRAMING_AX 0x0040/* AX88772/178 packets */ +#define FLAG_WLAN 0x0080/* use "wlan%d" names */ +/* init device ... can sleep, or cause probe() failure */ int (*bind)(struct usbnet *,struct usb_interface *);Signature · 1 line
1.5.2.5
Quoted 10 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 0/8] RFC: Wireless Extensions forrndis_host
Date: Sat, 22 Dec 2007 22:51:26 +0100Hello all,
I have here a patchset that needs some review. This patchset adds wireless extensions for
rndis_hostto enable support for RNDIS based USB wireless LAN adapters (e.g. Linksys WUSB54GS, Belkin F05D7051).
Cool! We always like to see support for more USB peripherals. Even (especially?) if they'e previously been Windows-only, penguin-deprived hardware. ;)
Is all that stuff adequately documented? What I recall from working with RNDIS before is that docs were lacking in some critical details, and were sometimes wrong.
Quoted 10 lines
In this patchset:
1. Fix sparse warning: returning void valued expression 2. Hardwire CDC descriptors when missing 3. Use 1KB buffer in rndis_unbind 4. Halt device if rndis_bind fails 5. Fix rndis packet filter flags 6. Split up rndis_host.c 7. Add Wireless Extensions for rndis_host 8. Use wlan device name for RNDIS wireless devices
Quoted 3 lines
The first five patches are more generic fixes that I think can be applied as they are. Of these, patch 2 is required to get these wireless devices working.
I had no problem with those first five. I take it none of those should be prioritized for 2.6.24 integration?
Quoted 2 lines
Patches 6-8 introduce some larger changes that may need a closer look.
And you saw my feedback on those. Minimally, please split out the usbnet core extensions, instead of combining them with rndis_wext patches ... and on first princples I'd think rndis_wext should live in its own module.
I just skimmed patch #7. There are people far more aware of the issues with Linux wireless drivers than me. :)
- Dave
Quoted 7 lines
All these patches should be applied in order. The entire series should apply cleanly to current linux kernel and net-2.6.25 trees.
regards,
Bjorge Dijkstra
PATCH 2/8 Hardwire CDC descriptors when missing
In reply to Bjorge DijkstraJust as ActiveSync devices, some regular RNDIS devices also lack the CDC descriptors (e.g. devices based on BCM4320 WLAN chip). This patch hardwires the CDC descriptors for all RNDIS style devices when they are missing.
--- drivers/net/usb/cdc_ether.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/usb/cdc_ether.c +5 -5
@@ -228,15 +228,16 @@ next_desc: buf += buf [0 ]; } -/* Microsoft ActiveSync based RNDIS devices lack the CDC descriptors, -* so we'll hard-wire the interfaces and not check for descriptors. +/* Microsoft ActiveSync based and some regular RNDIS devices lack the +* CDC descriptors, so we'll hard-wire the interfaces and not check +* for descriptors. */ -if (is_activesync (&intf->cur_altsetting->desc) && !info->u) { +if (rndis && !info->u) { info->control =usb_ifnum_to_if (dev->udev,0 ); info->data =usb_ifnum_to_if (dev->udev,1 );if (!info->control || !info->data) {dev_dbg (&intf->dev, -"activesync: master #0/%p slave #1/%p\n" , +"rndis: master #0/%p slave #1/%p\n" , info->control, info->data); goto bad_desc;
@@ -316,7 +317,6 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf) }EXPORT_SYMBOL_GPL (usbnet_cdc_unbind); -/*------------------------------------------------------------------------- * * Communications Device Class, Ethernet Control model
Signature · 1 line
1.5.2.5
Re: [PATCH 2/8] [PATCH] Hardwire CDC descriptors when missing
Quoted 8 lines
From [email protected] Sat Dec 22 13:53:00 2007
X-SourceIP: 213.93.131.145
From: Bjorge Dijkstra <[email protected]>
To: [email protected]
Cc: [email protected], [email protected]
Subject: [PATCH 2/8] [PATCH] Hardwire CDC descriptors when missing
Date: Sat, 22 Dec 2007 22:51:28 +0100
Quoted 6 lines
Just as ActiveSync devices, some regular RNDIS devices also lack the CDC descriptors (e.g. devices based on BCM4320 WLAN chip). This patch hardwires the CDC descriptors for all RNDIS style devices when they are missing.
Signed-off-by Bjorge Dijkstra <[email protected]>
Note what this tells us about how little Microsoft cares about the interoperability specs they claim to conform to. Having those descriptors is *NOT* optional in their (incomplete and in adequate) RNDIS specification. (I've not seen ActiveSync specs, so that support is pure guesswork.)
Quoted 40 lines
--- drivers/net/usb/cdc_ether.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)drivers/net/usb/cdc_ether.c +5
-5@@ -228,15 +228,16 @@ next_desc: buf += buf [0 ]; } -/* Microsoft ActiveSync based RNDIS devices lack the CDC descriptors, -* so we'll hard-wire the interfaces and not check for descriptors. +/* Microsoft ActiveSync based and some regular RNDIS devices lack the +* CDC descriptors, so we'll hard-wire the interfaces and not check +* for descriptors. */ -if (is_activesync (&intf->cur_altsetting->desc) && !info->u) { +if (rndis && !info->u) { info->control =usb_ifnum_to_if (dev->udev,0 ); info->data =usb_ifnum_to_if (dev->udev,1 );if (!info->control || !info->data) {dev_dbg (&intf->dev, -"activesync: master #0/%p slave #1/%p\n" , +"rndis: master #0/%p slave #1/%p\n" , info->control, info->data); goto bad_desc;@@ -316,7 +317,6 @@ void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf) }EXPORT_SYMBOL_GPL (usbnet_cdc_unbind); -?/*------------------------------------------------------------------------- * * Communications Device Class, Ethernet Control model Signature · 1 line
1.5.2.5
PATCH 3/8 Use 1KB buffer in rndis_unbind
In reply to Bjorge DijkstraFrom: Jussi Kivilinna <[email protected]>
rndis_command requires the caller to pass in a buffer of at least 1KB.
--- drivers/net/usb/rndis_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/usb/rndis_host.c +1 -1
@@ -577,7 +577,7 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)struct rndis_halt *halt;/* try to clear any rndis state/activity (no i/o from stack!) */ - halt =kzalloc (sizeof *halt,GFP_KERNEL ); + halt =kzalloc (CONTROL_BUFFER_SIZE ,GFP_KERNEL );if (halt) { halt->msg_type =RNDIS_MSG_HALT ; halt->msg_len =ccpu2 (sizeof *halt);
Signature · 1 line
1.5.2.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
David Brownell
Acked-byRe: [PATCH 3/8] [PATCH] Use 1KB buffer in rndis_unbind
Quoted 8 lines
From [email protected] Sat Dec 22 13:53:03 2007
From: Bjorge Dijkstra <[email protected]>
To: [email protected]
Cc: [email protected], [email protected],
Jussi Kivilinna <[email protected]>
Subject: [PATCH 3/8] [PATCH] Use 1KB buffer inrndis_unbind
Date: Sat, 22 Dec 2007 22:51:29 +0100
Quoted 6 lines
From: Jussi Kivilinna <[email protected]>
rndis_commandrequires the caller to pass in a buffer of at least 1KB.Signed-off-by Jussi Kivilinna <[email protected]>Signed-off-by Bjorge Dijkstra <[email protected]>
Quoted 20 lines
--- drivers/net/usb/rndis_host.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/net/usb/rndis_host.c +1
-1@@ -577,7 +577,7 @@ static void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)struct rndis_halt *halt;/* try to clear any rndis state/activity (no i/o from stack!) */ - halt =kzalloc (sizeof *halt,GFP_KERNEL ); + halt =kzalloc (CONTROL_BUFFER_SIZE ,GFP_KERNEL );if (halt) { halt->msg_type =RNDIS_MSG_HALT ; halt->msg_len =ccpu2 (sizeof *halt);Signature · 1 line
1.5.2.5
PATCH 6/8 Split up rndis_host.c
In reply to Bjorge DijkstraSplit up rndis_host.c into rndis_host.h and rndis_base.c and change Makefile accordingly. This is done so we can add extra source files to the rndis_host module later on.
--- drivers/net/usb/Makefile | 1 + drivers/net/usb/rndis_base.c | 548 ++++++++++++++++++++++++++++++ drivers/net/usb/rndis_host.c | 763 ------------------------------------------ drivers/net/usb/rndis_host.h | 256 ++++++++++++++ 4 files changed, 805 insertions(+), 763 deletions(-) create mode 100644 drivers/net/usb/rndis_base.c delete mode 100644 drivers/net/usb/rndis_host.c create mode 100644 drivers/net/usb/rndis_host.h
drivers/net/usb/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_NET_GL620A) += gl620a.o obj-$(CONFIG_USB_NET_NET1080) += net1080.o obj-$(CONFIG_USB_NET_PLUSB) += plusb.o obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o +rndis_host-objs += rndis_base.o obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
drivers/net/usb/rndis_base.c new file +548 -0
548 lines not on this page · raw message
drivers/net/usb/rndis_host.c deleted +0 -763
763 lines not on this page · raw message
drivers/net/usb/rndis_host.h new file +256 -0
256 lines not on this page · raw message
Signature · 1 line
1.5.2.5
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
Quoted 7 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 6/8] [PATCH] Split uprndis_host.c
Date: Sat, 22 Dec 2007 22:51:32 +0100Split up
rndis_host.cintorndis_host.handrndis_base.cand changeMakefileaccordingly. This is done so we can add extra source files to therndis_hostmodule later on.
I'm fine with splitting out a header file and the EXPORT_SYMBOL_GPL. But why not just have a separate "rndis_wext" module?
Quoted 9 lines
--- drivers/net/usb/Makefile | 1 + drivers/net/usb/rndis_base.c | 548 ++++++++++++++++++++++++++++++ drivers/net/usb/rndis_host.c | 763 ------------------------------------------ drivers/net/usb/rndis_host.h | 256 ++++++++++++++ 4 files changed, 805 insertions(+), 763 deletions(-) create mode 100644 drivers/net/usb/rndis_base.c delete mode 100644 drivers/net/usb/rndis_host.c create mode 100644 drivers/net/usb/rndis_host.h
A message that is not in the archive (sent off-list or not yet received): 20071223011707.1798C2360C6-ZcXrCSuhvln6VZ3dlLfH/[email protected]
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
Hello,
Bjorge was not comfortable with double probing rndis_wext requires, wireless RNDIS devices have same device id as the rest of RNDIS. Our module version checks OID_GEN_PHYSICAL_MEDIUM in generic_rndis_bind, with rndis_host bind fails if OID is supported and wireless media type is returned, with rndis_wext if OID isn't supported or type isn't wireless. Should this be ok?
Should separate rndis_wext be located in drivers/net/wireless instead of drivers/net/usb?
- Jussi Kivilinna
Quoted 26 lines · David Brownell
Quoted 7 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 6/8] [PATCH] Split uprndis_host.c
Date: Sat, 22 Dec 2007 22:51:32 +0100Split up
rndis_host.cintorndis_host.handrndis_base.cand changeMakefileaccordingly. This is done so we can add extra source files to therndis_hostmodule later on.I'm fine with splitting out a header file and the
EXPORT_SYMBOL_GPL. But why not just have a separate "rndis_wext" module?Quoted 9 lines
--- drivers/net/usb/Makefile | 1 + drivers/net/usb/rndis_base.c | 548 ++++++++++++++++++++++++++++++ drivers/net/usb/rndis_host.c | 763 ------------------------------------------ drivers/net/usb/rndis_host.h | 256 ++++++++++++++ 4 files changed, 805 insertions(+), 763 deletions(-) create mode 100644 drivers/net/usb/rndis_base.c delete mode 100644 drivers/net/usb/rndis_host.c create mode 100644 drivers/net/usb/rndis_host.h-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
Quoted 4 lines · Jussi Kivilinna
Hello,
Bjorge was not comfortable with double probing
rndis_wextrequires, wireless RNDIS devices have same device id as the rest of RNDIS.
I should have known Microsoft wouldn't start by assuming systems software module boundaries should be natural and obvious ones. :(
I see that the rndis_wext.c Kconfig won't kick in unless the 802.11 stuff is available ... what additional dependencies does that imply for a fatter rndis_host module? If it doesn't cause extra modules to be loaded (even for non-WLAN devices), then I suppose I could just live with the RNDIS module being bigger than it needs to be. It was pretty thin to start with!
What would bother me would be seeing that systems with this WLAN support option configured could no longer load the basic RNDIS code without also loading a bunch of extra modules that weren't needed for all RNDIS devices.
Quoted 5 lines
Our
module version checksOID_GEN_PHYSICAL_MEDIUMingeneric_rndis_bind, withrndis_hostbind fails if OID is supported and wireless media type is returned, withrndis_wextif OID isn't supported or type isn't wireless. Should this be ok?
Sounds like if you can go the different-modules route, then rndis_bind() should maybe accept a parameter giving it that option. Then
rndis_wlan_bind(...) == rndis_bind(..., check_wlan_media) rndis_generic_bind(...) == rndis_bind(..., non_wlan_media)
That would be getting pretty complicated, since as you say the same USB-level binding (hence hotplugging) would need to kick in ... but having different modules for different RNDIS flavors would need a new hotplug mechanism keying on media type. Ugh.
Quoted 2 lines
Should separate
rndis_wextbe located indrivers/net/wirelessinstead ofdrivers/net/usb?
If that doesn't complicate maintaining that software, I can't see why it shouldn't go there. It might imply moving the usbnet interface declarations to someplace linux/include though. (And that presumes there's actually a sane way to split that stuff into its own module, too...)
- Dave
Quoted 26 lines
- Jussi Kivilinna
Quoted 22 lines · David Brownell
Quoted 7 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 6/8] [PATCH] Split uprndis_host.c
Date: Sat, 22 Dec 2007 22:51:32 +0100Split up
rndis_host.cintorndis_host.handrndis_base.cand changeMakefileaccordingly. This is done so we can add extra source files to therndis_hostmodule later on.I'm fine with splitting out a header file and the
EXPORT_SYMBOL_GPL. But why not just have a separate "rndis_wext" module?Quoted 9 lines
--- drivers/net/usb/Makefile | 1 + drivers/net/usb/rndis_base.c | 548 ++++++++++++++++++++++++++++++ drivers/net/usb/rndis_host.c | 763 ------------------------------------------ drivers/net/usb/rndis_host.h | 256 ++++++++++++++ 4 files changed, 805 insertions(+), 763 deletions(-) create mode 100644 drivers/net/usb/rndis_base.c delete mode 100644 drivers/net/usb/rndis_host.c create mode 100644 drivers/net/usb/rndis_host.h
A message that is not in the archive (sent off-list or not yet received): 200801080319.23299.david-b-yBeKhBN/[email protected]
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
Quoted 4 lines
I see that the
rndis_wext.cKconfigwon't kick in unless the 802.11 stuff is available ... what additional dependencies does that imply for a fatterrndis_hostmodule?
No extra modules are currently required for just plain wext [1]. In the future, we hope to migrate stuff to cfg80211 though, which is a separate module.
johannes
[1] mostly because all the code is simply compiled into the kernel...
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
Quoted 8 lines · Johannes Berg
Quoted 4 lines
I see that the
rndis_wext.cKconfigwon't kick in unless the 802.11 stuff is available ... what additional dependencies does that imply for a fatterrndis_hostmodule?No extra modules are currently required for just plain wext [1]. In the future, we hope to migrate stuff to cfg80211 though, which is a separate module.
Hmmm. Well, go the current route then ... but come up with a good plan to split it up later, so that connecting a typical non-wireless RNDIS device won't incur such needless extra modules.
- Dave
Quoted 4 lines
johannes
[1] mostly because all the code is simply compiled into the kernel...
Re: [PATCH 6/8] [PATCH] Split up rndis_host.c
In reply to a message not in the archiveQuoted 3 lines · David Brownell
Quoted 3 lines
Our
module version checksOID_GEN_PHYSICAL_MEDIUMingeneric_rndis_bind, withrndis_hostbind fails if OID is supported and wireless media
type
Quoted 4 lines
Quoted 2 lines
is returned, with
rndis_wextif OID isn't supported or type isn't wireless. Should this be ok?Sounds like if you can go the different-modules route, then
rndis_bind()
Quoted 9 lines
should maybe accept a parameter giving it that option. Then
rndis_wlan_bind(...) == rndis_bind(..., check_wlan_media) rndis_generic_bind(...) == rndis_bind(..., non_wlan_media)That would be getting pretty complicated, since as you say the same USB-level binding (hence hotplugging) would need to kick in ... but having different modules for different RNDIS flavors would need a new hotplug mechanism keying on media type. Ugh.
Different modules works with rndis_generic_bind(..., media type option). dmesg shows following:
[11214.496773] usb 3-3: new high speed USB device using ehci_hcd and address 7 [11214.622861] usb 3-3: configuration #1 chosen from 1 choice [11214.784874] usbcore: registered new interface driver cdc_ether [11214.805700] rndis_host 3-3:1.0: driver requires wired physical medium, but device is wireless. [11214.806823] usbcore: registered new interface driver rndis_host [11215.190824] wlan0: register 'rndis_wext' at usb-0000:00:10.3-3, Wireless RNDIS device, 00:xx:xx:xx:xx:xx [11215.190853] usbcore: registered new interface driver rndis_wext [11215.398850] rndis_wext 3-3:1.0: rndis media disconnect
I assume that rndis_host gets always bind first as it's first in alphabetic, so rndis_wext is only loaded if RNDIS device has wireless media type.
I have new patchset that prepares rndis_host/usbnet for separate rndis_wext but not sure should I submit (I haven't managed to get into contact with Bjorge Dijkstra for 3,5 weeks now to have him decide how to proceed).
- Jussi Kivilinna
PATCH 7/8 Add Wireless Extensions to rndis_host
In reply to Bjorge DijkstraThe bulk of this patch is the addition of a new file that implements the wireless extensions for RNDIS devices. The rest are some smaller changes to usbnet and rndis_host to hook the wireless extensions into them:
* a private data pointer is added to usbnet.
* a callback is added to driver_info to signal link state changes.
* a physical medium type check is added to rndis_bind to check for wireless lan devices and turn on the wireless extensions.
* and finally a Kconfig option to enable/disable this all.
--- drivers/net/usb/Kconfig | 7 + drivers/net/usb/Makefile | 4 + drivers/net/usb/rndis_base.c | 50 +- drivers/net/usb/rndis_host.h | 18 + drivers/net/usb/rndis_wext.c | 2177 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/usb/usbnet.h | 4 + 6 files changed, 2255 insertions(+), 5 deletions(-) create mode 100644 drivers/net/usb/rndis_wext.c
drivers/net/usb/Kconfig +7 -0
@@ -239,6 +239,13 @@ config USB_NET_RNDIS_HOST The protocol specification is incomplete, and is controlled by (and for) Microsoft; it isn't an "Open" ecosystem or market. +config USB_NET_RNDIS_WEXT + boolean "Wireless Extensions for RNDIS host driver" + depends on USB_NET_RNDIS_HOST && WLAN_80211 && EXPERIMENTAL + select WIRELESS_EXT + help + This option enables support for RNDIS based wireless LAN devices. + config USB_NET_CDC_SUBSET tristate "Simple USB Network Links (CDC Ethernet subset)" depends on USB_USBNET
drivers/net/usb/Makefile +4 -0
@@ -14,6 +14,10 @@ obj-$(CONFIG_USB_NET_NET1080) += net1080.o obj-$(CONFIG_USB_NET_PLUSB) += plusb.o obj-$(CONFIG_USB_NET_RNDIS_HOST) += rndis_host.o rndis_host-objs += rndis_base.o +ifeq ($(CONFIG_USB_NET_RNDIS_WEXT),y) +rndis_host-objs += rndis_wext.o +endif + obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o obj-$(CONFIG_USB_NET_MCS7830) += mcs7830.o
drivers/net/usb/rndis_base.c +45 -5
68 lines not on this page · raw message
drivers/net/usb/rndis_host.h +18 -0
@@ -82,6 +82,18 @@ struct rndis_msg_hdr {#define RNDIS_STATUS_MEDIA_CONNECT ccpu2(0x4001000b)#define RNDIS_STATUS_MEDIA_DISCONNECT ccpu2(0x4001000c) +/* codes for OID_GEN_PHYSICAL_MEDIUM */ +#define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED ccpu2(0x00000000) +#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN ccpu2(0x00000001) +#define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM ccpu2(0x00000002) +#define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE ccpu2(0x00000003) +#define RNDIS_PHYSICAL_MEDIUM_POWER_LINE ccpu2(0x00000004) +#define RNDIS_PHYSICAL_MEDIUM_DSL ccpu2(0x00000005) +#define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL ccpu2(0x00000006) +#define RNDIS_PHYSICAL_MEDIUM_1394 ccpu2(0x00000007) +#define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN ccpu2(0x00000008) +#define RNDIS_PHYSICAL_MEDIUM_MAX ccpu2(0x00000009) +struct rndis_data_hdr {__le32 msg_type;/* RNDIS_MSG_PACKET */
@@ -222,6 +234,7 @@ struct rndis_keepalive_c { /* IN (optionally OUT) */#define OID_802_3_PERMANENT_ADDRESS ccpu2(0x01010101)#define OID_GEN_MAXIMUM_FRAME_SIZE ccpu2(0x00010106)#define OID_GEN_CURRENT_PACKET_FILTER ccpu2(0x0001010e) +#define OID_GEN_PHYSICAL_MEDIUM ccpu2(0x00010202)/* packet filter bits used by NDIS_OID_PACKET_FILTER */ #define RNDIS_PACKET_TYPE_DIRECTED ccpu2(0x00000001)
@@ -252,5 +265,10 @@ extern int rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb);extern struct sk_buff *rndis_tx_fixup (struct usbnet *dev,struct sk_buff *skb,gfp_t flags); +#ifdef CONFIG_USB_NET_RNDIS_WEXT +/* from rndis_wext.c */ +extern struct driver_info rndis_wext_info; +#endif +#endif /* __RNDIS_HOST_H */
drivers/net/usb/rndis_wext.c new file +2177 -0
2,177 lines not on this page · raw message
drivers/net/usb/usbnet.h +4 -0
@@ -31,6 +31,7 @@ struct usbnet {struct usb_interface *intf;struct driver_info *driver_info;const char *driver_name; +void *driver_priv;wait_queue_head_t *wait;struct mutex phy_mutex;unsigned char suspend_count;
@@ -109,6 +110,9 @@ struct driver_info {/* fixup rx packet (strip framing) */ int (*rx_fixup)(struct usbnet *dev,struct sk_buff *skb); +/* called when link state changes */ +void (*link_change)(struct usbnet *dev,int state); +/* fixup tx packet (add framing) */ struct sk_buff *(*tx_fixup)(struct usbnet *dev,struct sk_buff *skb,gfp_t flags);
Signature · 1 line
1.5.2.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 7/8] Add Wireless Extensions to rndis_host
Quoted 14 lines
From: Bjorge Dijkstra <[email protected]>
Subject: [PATCH 7/8] Add Wireless Extensions torndis_host
Date: Sat, 22 Dec 2007 22:51:33 +0100The bulk of this patch is the addition of a new file that implements the wireless extensions for RNDIS devices. The rest are some smaller changes to usbnet and
rndis_hostto hook the wireless extensions into them:
* a private data pointer is added to usbnet.
* a callback is added todriver_infoto signal link state changes.
* a physical medium type check is added torndis_bindto check for wireless lan devices and turn on the wireless extensions.
* and finally aKconfigoption to enable/disable this all.
Quoted 2 lines
Signed-off-by Jussi Kivilinna <[email protected]>Signed-off-by Bjorge Dijkstra <[email protected]>
I'm basically fine with this, but I'll hold off any ack until the issue with the preceding patch (6/8) is resolved. That would boil down to making this a standalone module, or knowing why that's not such a good idea.
I'd prefer to see the usbnet core extension packaged separately instead of buried in this patch. :)
And I think a MAINTAINERS update for rndis_wext would be appropriate. No way can I take care of that code!
(In fact, would you feel comfortable taking over rndis_host too?)
- Dave
Quoted 9 lines
--- drivers/net/usb/Kconfig | 7 + drivers/net/usb/Makefile | 4 + drivers/net/usb/rndis_base.c | 50 +- drivers/net/usb/rndis_host.h | 18 + drivers/net/usb/rndis_wext.c | 2177 ++++++++++++++++++++++++++++++++++++++++++ drivers/net/usb/usbnet.h | 4 + 6 files changed, 2255 insertions(+), 5 deletions(-) create mode 100644 drivers/net/usb/rndis_wext.c