Re: [PATCH] MAINTAINERS: remove Adam Fritzler, update his email address in other sources

2007-12-22 Thread Andrew Morton
On Mon, 17 Dec 2007 20:48:03 -0800 Joe Perches [EMAIL PROTECTED] wrote:

 Back to Adam Fritzler...
 
 ...
 
 diff --git a/CREDITS b/CREDITS
 index ee909f2..449ec7f 100644
 --- a/CREDITS
 +++ b/CREDITS
 @@ -1124,6 +1124,9 @@ S: 1150 Ringwood Court
  S: San Jose, California 95131
  S: USA
  
 +N: Adam Fritzler
 +E: [EMAIL PROTECTED]
 +
  N: Fernando Fuganti
  E: [EMAIL PROTECTED]
  E: [EMAIL PROTECTED]
 diff --git a/MAINTAINERS b/MAINTAINERS
 index 9507b42..690f172 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -3758,13 +3758,6 @@ W: 
 http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/
  T:   git kernel.org:/pub/scm/linux/kernel/git/bunk/trivial.git
  S:   Maintained
  
 -TMS380 TOKEN-RING NETWORK DRIVER
 -P:   Adam Fritzler
 -M:   [EMAIL PROTECTED]
 -L:   [EMAIL PROTECTED]
 -W:   http://www.auk.cx/tms380tr/
 -S:   Maintained

What was the rationale for removing Adam from MAINTAINERS?

That should have been in the non-existent changelog.  Please always reissue
a complete changelog when resending any patch.

hm, linux-tr.net seems to be defunct.  So I guess that orphaning TMS380 is
appropriate, if Adam has left us.  Has he?

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: hard_start_xmit struct sk_buff read-only?

2007-12-22 Thread Jeff Garzik

Matti Linnanvuori wrote:

An old article about Linux's network drivers mentioned
that the struct sk_buff whose pointer is passed to a
driver's hard_start_xmit function is read-only to the
function. Is that still so? If it is, there is no
mention about it in the kernel tree as far as I know.


This begs the question, what are you trying to do?  ;-)

In terms of object lifetimes, control passes to the net driver when 
-hard_start_xmit() is called, but that does not mean you can freely 
scribble over things -- the skb may have been cloned, its destructor 
callback still needs to be called (via dev_kfree_skb), etc.


Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MAINTAINERS: remove Adam Fritzler, update his email address in other sources

2007-12-22 Thread Jeff Garzik

Andrew Morton wrote:

On Mon, 17 Dec 2007 20:48:03 -0800 Joe Perches [EMAIL PROTECTED] wrote:


Back to Adam Fritzler...

...

diff --git a/CREDITS b/CREDITS
index ee909f2..449ec7f 100644
--- a/CREDITS
+++ b/CREDITS
@@ -1124,6 +1124,9 @@ S: 1150 Ringwood Court
 S: San Jose, California 95131
 S: USA
 
+N: Adam Fritzler

+E: [EMAIL PROTECTED]
+
 N: Fernando Fuganti
 E: [EMAIL PROTECTED]
 E: [EMAIL PROTECTED]
diff --git a/MAINTAINERS b/MAINTAINERS
index 9507b42..690f172 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3758,13 +3758,6 @@ W:   
http://www.kernel.org/pub/linux/kernel/people/bunk/trivial/
 T: git kernel.org:/pub/scm/linux/kernel/git/bunk/trivial.git
 S: Maintained
 
-TMS380 TOKEN-RING NETWORK DRIVER

-P: Adam Fritzler
-M: [EMAIL PROTECTED]
-L: [EMAIL PROTECTED]
-W: http://www.auk.cx/tms380tr/
-S: Maintained


What was the rationale for removing Adam from MAINTAINERS?

That should have been in the non-existent changelog.  Please always reissue
a complete changelog when resending any patch.

hm, linux-tr.net seems to be defunct.  So I guess that orphaning TMS380 is
appropriate, if Adam has left us.  Has he?


I don't know that specific answer, but in terms of general policy...

I wouldn't apply this patch until they have been in 
Documentation/people-removal-schedule.txt for a year or so ;-)  More 
seriously, its not like MAINTAINERS is a mission critical correctness 
target -- so I think we can do a better job than just yanking people 
from the file like this.


Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] MAINTAINERS: remove Adam Fritzler, update his email address in other sources

2007-12-22 Thread Joe Perches
On Sat, 2007-12-22 at 03:53 -0500, Jeff Garzik wrote:
  What was the rationale for removing Adam from MAINTAINERS?

I sent him a patch to that address and it bounced.
I sent him a note asking if he was still a maintainer to
his new address and he replied:

http://www.gossamer-threads.com/lists/linux/kernel/855361

On Mon, Dec 17, 2007 at 01:03:48PM -0800, Joe Perches wrote: 
  You seem to have an old email address in the 
  linux-kernel MAINTAINERS file. 
  Should it be deleted or changed? 
On Mon, 2007-12-17 at 19:27 -0800, Adam Fritzler wrote: 
 I am no longer actively involved. If you can mark me as a former point 
 of contact, that's fine, or you can just delete the entry. My name is 
 still in the source, but with the old address. It'd great if the 
 address in source was updated. 

cheers, Joe

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: hard_start_xmit struct sk_buff read-only?

2007-12-22 Thread Matti Linnanvuori

--- Jeff Garzik [EMAIL PROTECTED] schrieb:

 This begs the question, what are you trying to do? 
 ;-)

I have seen network drivers whose hard_start_xmit
function calls skb_push or skb_put to extend the used
data area of the struct skb_buff passed to the
function. That avoids allocating a new buffer and
copying the whole data area to it. The drivers
apparently do that because the device expects a
specific header or suffix in the DMA buffer it
handles.

 In terms of object lifetimes, control passes to the
 net driver when 
 -hard_start_xmit() is called, but that does not
 mean you can freely 
 scribble over things -- the skb may have been
 cloned, its destructor 
 callback still needs to be called (via
 dev_kfree_skb), etc.

So I assume modifying the data or header area of
struct sk_buff is incorrect because it can break
cloned buffers.


  Heute schon einen Blick in die Zukunft von E-Mails wagen? 
www.yahoo.de/mail
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: skbuff data pointer alignment requirement

2007-12-22 Thread Jarek Poplawski
Keyur Chudgar wrote, On 12/21/2007 02:12 AM:
...

 If some hardware requirements, for example is, they need to have 256
 bytes aligned address for them to do the DMA, no matter what the
 packet size is. In this kind of cases, can you guide me what should I
 do? Is there any way already in Linux I can do this?

...

 In the above specified situation, I can define SKB_ADDR_MIN_ALIGN =
 256 in my Makefile or I don't define it at all if I am okay with
 default alignment size.

Do you mean hardware requirements of an architecture or a specific driver?
So, if you have more than one network card, is it needed by all of them,
while other (not network) drivers are happy with default allocations?

Regards,
Jarek P.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH v9 06/18] LSM: Add inet_sys_snd_skb() LSM hook (fwd)

2007-12-22 Thread Paul Moore
On Friday 21 December 2007 7:51:26 pm James Morris wrote:
 This is part of a large patchset which finally fixes labeled networking,
 which we're hoping to get into 2.6.25.

 Thread @ http://thread.gmane.org/gmane.linux.kernel.lsm/4894

 The patch below is the only one which is not self-contained  impacts on
 core networking code.

 If anyone has any objections or comments on this patch, please let us
 know.

Also, for the record, this is the same patch that was posted earlier in the 
week in an attempt to solicit comments.

 -- Forwarded message --
 Date: Fri, 21 Dec 2007 12:09:28 -0500
 From: Paul Moore [EMAIL PROTECTED]
 To: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: [RFC PATCH v9 06/18] LSM: Add inet_sys_snd_skb() LSM hook

 Add an inet_sys_snd_skb() LSM hook to allow the LSM to provide packet level
 access control for all outbound packets.  Using the existing postroute_last
 netfilter hook turns out to be problematic as it is can be invoked multiple
 times for a single packet, e.g. individual IPsec transforms, adding
 unwanted overhead and complicating the security policy.

 Signed-off-by: Paul Moore [EMAIL PROTECTED]
 ---

  include/linux/security.h |   11 +++
  net/ipv4/ip_output.c |7 +++
  net/ipv6/ip6_output.c|5 +
  security/dummy.c |8 +++-
  security/security.c  |6 ++
  5 files changed, 36 insertions(+), 1 deletions(-)

 diff --git a/include/linux/security.h b/include/linux/security.h
 index db19c92..1b8d332 100644
 --- a/include/linux/security.h
 +++ b/include/linux/security.h
 @@ -876,6 +876,10 @@ struct request_sock;
   * Sets the connection's peersid to the secmark on skb.
   * @req_classify_flow:
   *   Sets the flow's sid to the openreq sid.
 + * @inet_sys_snd_skb:
 + *   Check permissions on outgoing network packets.
 + *   @skb is the packet to check
 + *   @family is the packet's address family
   *
   * Security hooks for XFRM operations.
   *
 @@ -1416,6 +1420,7 @@ struct security_operations {
   void (*inet_csk_clone)(struct sock *newsk, const struct request_sock
 *req); void (*inet_conn_established)(struct sock *sk, struct sk_buff *skb);
 void (*req_classify_flow)(const struct request_sock *req, struct flowi
 *fl); +   int (*inet_sys_snd_skb)(struct sk_buff *skb, int family);
  #endif   /* CONFIG_SECURITY_NETWORK */

  #ifdef CONFIG_SECURITY_NETWORK_XFRM
 @@ -2328,6 +2333,7 @@ void security_sk_free(struct sock *sk);
  void security_sk_clone(const struct sock *sk, struct sock *newsk);
  void security_sk_classify_flow(struct sock *sk, struct flowi *fl);
  void security_req_classify_flow(const struct request_sock *req, struct
 flowi *fl); +int security_inet_sys_snd_skb(struct sk_buff *skb, int
 family);
  void security_sock_graft(struct sock*sk, struct socket *parent);
  int security_inet_conn_request(struct sock *sk,
   struct sk_buff *skb, struct request_sock *req);
 @@ -2471,6 +2477,11 @@ static inline void security_req_classify_flow(const
 struct request_sock *req, st {
  }

 +static inline int security_inet_sys_snd_skb(struct sk_buff *skb, int
 family) +{
 + return 0;
 +}
 +
  static inline void security_sock_graft(struct sock* sk, struct socket
 *parent) {
  }
 diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
 index fd99fbd..82a7297 100644
 --- a/net/ipv4/ip_output.c
 +++ b/net/ipv4/ip_output.c
 @@ -204,6 +204,8 @@ static inline int ip_skb_dst_mtu(struct sk_buff *skb)

  static int ip_finish_output(struct sk_buff *skb)
  {
 + int err;
 +
  #if defined(CONFIG_NETFILTER)  defined(CONFIG_XFRM)
   /* Policy lookup after SNAT yielded a new policy */
   if (skb-dst-xfrm != NULL) {
 @@ -211,6 +213,11 @@ static int ip_finish_output(struct sk_buff *skb)
   return dst_output(skb);
   }
  #endif
 +
 + err = security_inet_sys_snd_skb(skb, AF_INET);
 + if (err)
 + return err;
 +
   if (skb-len  ip_skb_dst_mtu(skb)  !skb_is_gso(skb))
   return ip_fragment(skb, ip_finish_output2);
   else
 diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
 index 6338a9c..44ddf32 100644
 --- a/net/ipv6/ip6_output.c
 +++ b/net/ipv6/ip6_output.c
 @@ -72,8 +72,13 @@ static __inline__ void ipv6_select_ident(struct sk_buff
 *skb, struct frag_hdr *f

  static int ip6_output_finish(struct sk_buff *skb)
  {
 + int err;
   struct dst_entry *dst = skb-dst;

 + err = security_inet_sys_snd_skb(skb, AF_INET6);
 + if (err)
 + return err;
 +
   if (dst-hh)
   return neigh_hh_output(dst-hh, skb);
   else if (dst-neighbour)
 diff --git a/security/dummy.c b/security/dummy.c
 index 0b62f95..384979a 100644
 --- a/security/dummy.c
 +++ b/security/dummy.c
 @@ -848,6 +848,11 @@ static inline void dummy_req_classify_flow(const
 struct request_sock *req, struct flowi *fl)
  {
  }
 +
 +static inline int dummy_inet_sys_snd_skb(struct sk_buff *skb, 

[PATCH] Documentation: add a guideline for hard_start_xmit method not to modify SKB

2007-12-22 Thread Matti Linnanvuori
From: Matti Linnanvuori [EMAIL PROTECTED]

Add a guideline for hard_start_xmit method not to
modify SKB.

Signed-off-by: Matti Linnanvuori
[EMAIL PROTECTED]

---


--- a/Documentation/networking/driver.txt   2007-12-22
18:50:28.062169500 +0200
+++ b/Documentation/networking/driver.txt   2007-12-22
19:10:58.726566000 +0200

@@ -74,6 +74,9 @@ Transmit path guidelines:
If you return 1 from the hard_start_xmit method,
you must not keep
any reference to that SKB and you must not attempt
to free it up.
 
+4) A hard_start_xmit method must not modify the
cloned parts of the
+   SKB.
+
 Probing guidelines:
 
 1) Any hardware layer address you obtain for your
device should



  Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: 
http://de.yahoo.com/set
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/8] Fix sparse warning: returning void-valued expression

2007-12-22 Thread Bjorge Dijkstra
rndis_unbind and usbnet_cdc_unbind don't return anything.

Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]
---
 drivers/net/usb/rndis_host.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 1ebe325..96ef6a9 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -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);
 }
 
 /*
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] Fix rndis packet filter flags.

2007-12-22 Thread Bjorge Dijkstra
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]
---
 drivers/net/usb/rndis_host.c |   23 ++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index c686025..3c116f9 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -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(0x0001)
+#define RNDIS_PACKET_TYPE_MULTICASTccpu2(0x0002)
+#define RNDIS_PACKET_TYPE_ALL_MULTICASTccpu2(0x0004)
+#define RNDIS_PACKET_TYPE_BROADCASTccpu2(0x0008)
+#define RNDIS_PACKET_TYPE_SOURCE_ROUTING   ccpu2(0x0010)
+#define RNDIS_PACKET_TYPE_PROMISCUOUS  ccpu2(0x0020)
+#define RNDIS_PACKET_TYPE_SMT  ccpu2(0x0040)
+#define RNDIS_PACKET_TYPE_ALL_LOCALccpu2(0x0080)
+#define RNDIS_PACKET_TYPE_GROUPccpu2(0x1000)
+#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL   ccpu2(0x2000)
+#define RNDIS_PACKET_TYPE_FUNCTIONAL   ccpu2(0x4000)
+#define RNDIS_PACKET_TYPE_MAC_FRAMEccpu2(0x8000)
+
+/* 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)) {
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/8] [PATCH] Halt device if rndis_bind fails.

2007-12-22 Thread Bjorge Dijkstra
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]
---
 drivers/net/usb/rndis_host.c |   12 +---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 42b161c..c686025 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -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);
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/8] RFC: Wireless Extensions for rndis_host

2007-12-22 Thread Bjorge Dijkstra
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
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/8] [PATCH] Use wlan device name for RNDIS wireless devices

2007-12-22 Thread Bjorge Dijkstra
From: 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]
---
 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(-)

diff --git a/drivers/net/usb/rndis_wext.c b/drivers/net/usb/rndis_wext.c
index a9ce944..1c28b2a 100644
--- a/drivers/net/usb/rndis_wext.c
+++ b/drivers/net/usb/rndis_wext.c
@@ -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,
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 8ed1fc5..a2a2d5e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -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))
diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
index 83860a0..5c98ddc 100644
--- a/drivers/net/usb/usbnet.h
+++ b/drivers/net/usb/usbnet.h
@@ -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 *);
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] [PATCH] Hardwire CDC descriptors when missing

2007-12-22 Thread Bjorge Dijkstra
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]
---
 drivers/net/usb/cdc_ether.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index a42acc3..97c17bb 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -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
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] [PATCH] Use 1KB buffer in rndis_unbind

2007-12-22 Thread Bjorge Dijkstra
From: Jussi Kivilinna [EMAIL PROTECTED]

rndis_command requires 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]
---
 drivers/net/usb/rndis_host.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
index 96ef6a9..42b161c 100644
--- a/drivers/net/usb/rndis_host.c
+++ b/drivers/net/usb/rndis_host.c
@@ -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);
-- 
1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] [PATCH] Split up rndis_host.c

2007-12-22 Thread Bjorge Dijkstra
Split 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.

Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]
---
 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

diff --git a/drivers/net/usb/Makefile b/drivers/net/usb/Makefile
index 595a539..611ab62 100644
--- a/drivers/net/usb/Makefile
+++ b/drivers/net/usb/Makefile
@@ -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
diff --git a/drivers/net/usb/rndis_base.c b/drivers/net/usb/rndis_base.c
new file mode 100644
index 000..f3b0c00
--- /dev/null
+++ b/drivers/net/usb/rndis_base.c
@@ -0,0 +1,548 @@
+/*
+ * Host Side support for RNDIS Networking Links
+ * Copyright (C) 2005 by David Brownell
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// #define DEBUG   // error path messages, extra info
+// #define VERBOSE // more; success messages
+
+#include linux/module.h
+#include linux/init.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/ethtool.h
+#include linux/workqueue.h
+#include linux/mii.h
+#include linux/usb.h
+#include linux/usb/cdc.h
+
+#include usbnet.h
+#include rndis_host.h
+
+
+/*
+ * RNDIS is NDIS remoted over USB.  It's a MSFT variant of CDC ACM ... of
+ * course ACM was intended for modems, not Ethernet links!  USB's standard
+ * for Ethernet links is CDC Ethernet, which is significantly simpler.
+ *
+ * NOTE that Microsoft's RNDIS 1.0 specification is incomplete.  Issues
+ * include:
+ *- Power management in particular relies on information that's scattered
+ * through other documentation, and which is incomplete or incorrect even
+ * there.
+ *- There are various undocumented protocol requirements, such as the
+ * need to send unused garbage in control-OUT messages.
+ *- In some cases, MS-Windows will emit undocumented requests; this
+ * matters more to peripheral implementations than host ones.
+ *
+ * Moreover there's a no-open-specs variant of RNDIS called ActiveSync.
+ *
+ * For these reasons and others, ** USE OF RNDIS IS STRONGLY DISCOURAGED ** in
+ * favor of such non-proprietary alternatives as CDC Ethernet or the newer (and
+ * currently rare) Ethernet Emulation Model (EEM).
+ */
+
+/*
+ * RNDIS notifications from device: command completion; reverse
+ * keepalives; etc
+ */
+void rndis_status(struct usbnet *dev, struct urb *urb)
+{
+   devdbg(dev, rndis status urb, len %d stat %d,
+   urb-actual_length, urb-status);
+   // FIXME for keepalives, respond immediately (asynchronously)
+   // if not an RNDIS status, do like cdc_status(dev,urb) does
+}
+EXPORT_SYMBOL_GPL(rndis_status);
+
+/*
+ * RPC done RNDIS-style.  Caller guarantees:
+ * - message is properly byteswapped
+ * - there's no other request pending
+ * - buf can hold up to 1KB response (required by RNDIS spec)
+ * On return, the first few entries are already byteswapped.
+ *
+ * Call context is likely probe(), before interface name is known,
+ * which is why we won't try to use it in the diagnostics.
+ */
+int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf)
+{
+   struct cdc_state*info = (void *) dev-data;
+   int master_ifnum;
+   int retval;
+   unsignedcount;
+   __le32  rsp;
+   u32 xid = 0, msg_len, request_id;
+
+   /* REVISIT when this gets called from contexts other than probe() or
+* 

Re: [PATCH 1/8] Fix sparse warning: returning void-valued expression

2007-12-22 Thread David Brownell
 From [EMAIL PROTECTED]  Sat Dec 22 13:52:53 2007
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: netdev@vger.kernel.org, [EMAIL PROTECTED]
 Subject: [PATCH 1/8] Fix sparse warning: returning void-valued expression
 Date: Sat, 22 Dec 2007 22:51:27 +0100

 rndis_unbind and usbnet_cdc_unbind don't return anything.

 Signed-off-by: Bjorge Dijkstra [EMAIL PROTECTED]

Acked-by: David Brownell [EMAIL PROTECTED]


 ---
  drivers/net/usb/rndis_host.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 1ebe325..96ef6a9 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -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);
  }
  
  /*
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/8] [PATCH] Hardwire CDC descriptors when missing

2007-12-22 Thread David Brownell
 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: netdev@vger.kernel.org, [EMAIL PROTECTED]
 Subject: [PATCH 2/8] [PATCH] Hardwire CDC descriptors when missing
 Date: Sat, 22 Dec 2007 22:51:28 +0100

 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]

Acked-by: David Brownell [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.)


 ---
  drivers/net/usb/cdc_ether.c |   10 +-
  1 files changed, 5 insertions(+), 5 deletions(-)

 diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
 index a42acc3..97c17bb 100644
 --- a/drivers/net/usb/cdc_ether.c
 +++ b/drivers/net/usb/cdc_ether.c
 @@ -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
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/8] [PATCH] Use 1KB buffer in rndis_unbind

2007-12-22 Thread David Brownell
 From [EMAIL PROTECTED]  Sat Dec 22 13:53:03 2007
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: netdev@vger.kernel.org, [EMAIL PROTECTED],
   Jussi Kivilinna [EMAIL PROTECTED]
 Subject: [PATCH 3/8] [PATCH] Use 1KB buffer in rndis_unbind
 Date: Sat, 22 Dec 2007 22:51:29 +0100

 From: Jussi Kivilinna [EMAIL PROTECTED]

 rndis_command requires 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]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
  drivers/net/usb/rndis_host.c |2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 96ef6a9..42b161c 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -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);
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/8] [PATCH] Halt device if rndis_bind fails.

2007-12-22 Thread David Brownell
 From [EMAIL PROTECTED]  Sat Dec 22 13:53:07 2007
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: netdev@vger.kernel.org, [EMAIL PROTECTED],
   Jussi Kivilinna [EMAIL PROTECTED]
 Subject: [PATCH 4/8] [PATCH] Halt device if rndis_bind fails.
 Date: Sat, 22 Dec 2007 22:51:30 +0100

 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]

Acked-by: David Brownell [EMAIL PROTECTED]

 ---
  drivers/net/usb/rndis_host.c |   12 +---
  1 files changed, 9 insertions(+), 3 deletions(-)

 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index 42b161c..c686025 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -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);
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/8] Fix rndis packet filter flags.

2007-12-22 Thread David Brownell
 From [EMAIL PROTECTED]  Sat Dec 22 13:53:12 2007
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: netdev@vger.kernel.org, [EMAIL PROTECTED],
   Jussi Kivilinna [EMAIL PROTECTED]
 Subject: [PATCH 5/8] Fix rndis packet filter flags.
 Date: Sat, 22 Dec 2007 22:51:31 +0100

 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]

Acked-by: David Brownell [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.


 ---
  drivers/net/usb/rndis_host.c |   23 ++-
  1 files changed, 22 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/usb/rndis_host.c b/drivers/net/usb/rndis_host.c
 index c686025..3c116f9 100644
 --- a/drivers/net/usb/rndis_host.c
 +++ b/drivers/net/usb/rndis_host.c
 @@ -256,6 +256,27 @@ struct rndis_keepalive_c {   /* IN (optionally OUT) 
 */
  #define OID_GEN_MAXIMUM_FRAME_SIZE   ccpu2(0x00010106)
  #define OID_GEN_CURRENT_PACKET_FILTERccpu2(0x0001010e)
  
 +/* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
 +#define RNDIS_PACKET_TYPE_DIRECTED   ccpu2(0x0001)
 +#define RNDIS_PACKET_TYPE_MULTICAST  ccpu2(0x0002)
 +#define RNDIS_PACKET_TYPE_ALL_MULTICAST  ccpu2(0x0004)
 +#define RNDIS_PACKET_TYPE_BROADCAST  ccpu2(0x0008)
 +#define RNDIS_PACKET_TYPE_SOURCE_ROUTING ccpu2(0x0010)
 +#define RNDIS_PACKET_TYPE_PROMISCUOUSccpu2(0x0020)
 +#define RNDIS_PACKET_TYPE_SMTccpu2(0x0040)
 +#define RNDIS_PACKET_TYPE_ALL_LOCAL  ccpu2(0x0080)
 +#define RNDIS_PACKET_TYPE_GROUP  ccpu2(0x1000)
 +#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL ccpu2(0x2000)
 +#define RNDIS_PACKET_TYPE_FUNCTIONAL ccpu2(0x4000)
 +#define RNDIS_PACKET_TYPE_MAC_FRAME  ccpu2(0x8000)
 +
 +/* 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)) {
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev 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

2007-12-22 Thread David Brownell
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 Subject: [PATCH 6/8] [PATCH] Split up rndis_host.c
 Date: Sat, 22 Dec 2007 22:51:32 +0100

 Split 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.

I'm fine with splitting out a header file and the EXPORT_SYMBOL_GPL.
But why not just have a separate rndis_wext module?


 ---
  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 netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/8] Add Wireless Extensions to rndis_host

2007-12-22 Thread David Brownell
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 Subject: [PATCH 7/8] Add Wireless Extensions to rndis_host
 Date: Sat, 22 Dec 2007 22:51:33 +0100

 The 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.

 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


 ---
  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
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 8/8] [PATCH] Use wlan device name for RNDIS wireless devices

2007-12-22 Thread David Brownell
 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 +0100

 From: 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]

Acked-by: David Brownell [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.


 ---
  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(-)

 diff --git a/drivers/net/usb/rndis_wext.c b/drivers/net/usb/rndis_wext.c
 index a9ce944..1c28b2a 100644
 --- a/drivers/net/usb/rndis_wext.c
 +++ b/drivers/net/usb/rndis_wext.c
 @@ -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,
 diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
 index 8ed1fc5..a2a2d5e 100644
 --- a/drivers/net/usb/usbnet.c
 +++ b/drivers/net/usb/usbnet.c
 @@ -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))
 diff --git a/drivers/net/usb/usbnet.h b/drivers/net/usb/usbnet.h
 index 83860a0..5c98ddc 100644
 --- a/drivers/net/usb/usbnet.h
 +++ b/drivers/net/usb/usbnet.h
 @@ -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_WLAN0x0080  /* use wlan%d names */
 +
  
   /* init device ... can sleep, or cause probe() failure */
   int (*bind)(struct usbnet *, struct usb_interface *);
 -- 
 1.5.2.5

--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/8] RFC: Wireless Extensions for rndis_host

2007-12-22 Thread David Brownell
 From: Bjorge Dijkstra [EMAIL PROTECTED]
 Subject: [PATCH 0/8] RFC: Wireless Extensions for rndis_host
 Date: Sat, 22 Dec 2007 22:51:26 +0100

 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).

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.


 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. 

I had no problem with those first five.  I take it none of
those should be prioritized for 2.6.24 integration?


 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


 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


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Reduce locking in TX path of forcedth driver

2007-12-22 Thread Jeff Garzik

Tom Herbert wrote:


(Tom, you failed to CC the maintainer at NVIDIA, please fix...)

 
Jeff,
 
Please pardon my naivety, but how would determine who the maintainer at 
NVDIA is?  The MAINTAINERS file lists an Nvidia maintainer only for the 
framebuffer driver, and I don't see this specified in the source file.


In general, you want to check with

git log drivers/net/forcedeth.c

in addition to MAINTAINERS, to see who is actively working on the driver.

In this case, the original authors are largely idle (though still 
respond to emails), and NVIDIA has been doing most of the maintenance 
for the past year or more.


MAINTAINERS certainly wants fixing though, if it doesn't reflect the 
current situation.


Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] dm9000 - fix spinlock issue, updated

2007-12-22 Thread Ben Dooks
On Wed, Nov 21, 2007 at 04:47:53PM +0300, dmitry pervushin wrote:
 The patch below fixes the problem with dm9000_timeout function: it calls
 dm9000_init under the spin_lock db-lock, which was going to be acquired
 again in dm9000_hash_table. From the other hand, dm9000_hash_table has
 to be called with db-lock held
 
 Signed-off-by: dmitry pervushin [EMAIL PROTECTED]
Acked-by: Ben Dooks [EMAIL PROTECTED]
 Index: linux/drivers/net/dm9000.c
 ===
 --- linux.orig/drivers/net/dm9000.c
 +++ linux/drivers/net/dm9000.c
 @@ -173,6 +173,7 @@ static void dm9000_phy_write(struct net_
  static u16 read_srom_word(board_info_t *, int);
  static void dm9000_rx(struct net_device *);
  static void dm9000_hash_table(struct net_device *);
 +static void dm9000_set_multicast(struct net_device *dev);
  
  //#define DM9000_PROGRAM_EEPROM
  #ifdef DM9000_PROGRAM_EEPROM
 @@ -556,7 +557,7 @@ dm9000_probe(struct platform_device *pde
   ndev-tx_timeout = dm9000_timeout;
   ndev-watchdog_timeo = msecs_to_jiffies(watchdog);
   ndev-stop   = dm9000_stop;
 - ndev-set_multicast_list = dm9000_hash_table;
 + ndev-set_multicast_list = dm9000_set_multicast;
  #ifdef CONFIG_NET_POLL_CONTROLLER
   ndev-poll_controller= dm9000_poll_controller;
  #endif
 @@ -620,6 +621,7 @@ static int
  dm9000_open(struct net_device *dev)
  {
   board_info_t *db = (board_info_t *) dev-priv;
 + unsigned long flags;
  
   PRINTK2(entering dm9000_open\n);
  
 @@ -627,8 +629,10 @@ dm9000_open(struct net_device *dev)
   return -EAGAIN;
  
   /* Initialize DM9000 board */
 + spin_lock_irqsave(db-lock, flags);
   dm9000_reset(db);
   dm9000_init_dm9000(dev);
 + spin_unlock_irqrestore(db-lock, flags);
  
   /* Init driver variable */
   db-dbug_cnt = 0;
 @@ -1030,6 +1034,18 @@ cal_CRC(unsigned char *Data, unsigned in
  /*
   *  Set DM9000 multicast address
   */
 +
 +static void
 +dm9000_set_multicast(struct net_device *dev)
 +{
 + board_info_t *db = (board_info_t *) dev-priv;
 + unsigned long flags;
 +
 + spin_lock_irqsave(db-lock,flags);
 + dm9000_hash_table(dev);
 + spin_unlock_irqrestore(db-lock, flags);
 +}
 +
  static void
  dm9000_hash_table(struct net_device *dev)
  {
 @@ -1038,12 +1054,9 @@ dm9000_hash_table(struct net_device *dev
   int mc_cnt = dev-mc_count;
   u32 hash_val;
   u16 i, oft, hash_table[4];
 - unsigned long flags;
  
   PRINTK2(dm9000_hash_table()\n);
  
 - spin_lock_irqsave(db-lock,flags);
 -
   for (i = 0, oft = 0x10; i  6; i++, oft++)
   iow(db, oft, dev-dev_addr[i]);
  
 @@ -1065,8 +1078,6 @@ dm9000_hash_table(struct net_device *dev
   iow(db, oft++, hash_table[i]  0xff);
   iow(db, oft++, (hash_table[i]  8)  0xff);
   }
 -
 - spin_unlock_irqrestore(db-lock,flags);
  }
  
  
 @@ -1155,12 +1166,15 @@ dm9000_drv_resume(struct platform_device
  {
   struct net_device *ndev = platform_get_drvdata(dev);
   board_info_t *db = (board_info_t *) ndev-priv;
 + unsigned long flags;
  
   if (ndev) {
  
   if (netif_running(ndev)) {
 + spin_lock_irqsave(db-lock, flags);
   dm9000_reset(db);
   dm9000_init_dm9000(ndev);
 + spin_unlock_irqrestore(db-lock, flags);
  
   netif_device_attach(ndev);
   }
 
 
 -
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben ([EMAIL PROTECTED], http://www.fluff.org/)

  'a smiley only costs 4 bytes'
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: delay via-rhine irq initialisation.

2007-12-22 Thread Jeff Garzik

Dave Jones wrote:

With CONFIG_DEBUG_SHIRQ set, via-rhine complains during init.
(See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=377721 for a report).

Does this diff look right?
(I don't have a via-rhine handy to test with)

We may be able to get away with moving the request_irq to just after the
alloc_tbufs(), but I feel if a real interrupt occured, this diff would
stand more chance of doing the right thing.

Comments?

Dave

Delay irq registration until after we've allocated ring buffers,
otherwise DEBUG_SHIRQ will complain.

Signed-off-by: Dave Jones [EMAIL PROTECTED]

diff --git a/drivers/net/via-rhine.c b/drivers/net/via-rhine.c
index 07263cd..37b3efb 100644
--- a/drivers/net/via-rhine.c
+++ b/drivers/net/via-rhine.c
@@ -1151,24 +1151,28 @@ static int rhine_open(struct net_device *dev)
void __iomem *ioaddr = rp-base;
int rc;
 
-	rc = request_irq(rp-pdev-irq, rhine_interrupt, IRQF_SHARED, dev-name,

-   dev);
-   if (rc)
-   return rc;
-
if (debug  1)
printk(KERN_DEBUG %s: rhine_open() irq %d.\n,
   dev-name, rp-pdev-irq);
 
 	rc = alloc_ring(dev);

-   if (rc) {
-   free_irq(rp-pdev-irq, dev);
+   if (rc)
return rc;
-   }
+
alloc_rbufs(dev);
alloc_tbufs(dev);
rhine_chip_reset(dev);
init_registers(dev);
+
+   rc = request_irq(rp-pdev-irq, rhine_interrupt, IRQF_SHARED, 
dev-name,
+   dev);
+   if (rc) {
+   free_rbufs(dev);
+   free_tbufs(dev);
+   free_ring(dev);
+   return rc;
+   }
+


Absolutely we want to do this.  DEBUG_SHIRQ is only one of many reasons 
-- quite simply, you are fixing an order-of-init bug that leads to races 
and other badness.


I would request that the error cleanup be done in the standard style for 
net drivers (indeed, most drivers):


rc = request_irq(...);
if (rc)
goto err_out;

...

return 0;

err_out:
...
return rc;

Also I would change the subject to something like fix order of init 
bugs or fix races or whatnot.


We must assume, when writing drivers, that an interrupt will be 
delivered _immediately_ once request_irq() is called -- possibly even 
before request_irq() has returned its return code.


Regards,

Jeff


--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [patch 3/6] netxen: improve MSI interrupt handling

2007-12-22 Thread Jeff Garzik

Patch does not apply to 2.6.24-rc.

Was this bug fix series meant for 2.6.25?

Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2007-12-22 Thread Al Viro
On Sun, Dec 23, 2007 at 12:33:14AM -0500, Jeff Garzik wrote:
 
 A couple [minorly] notable wireless bug fixes, and plenty of viro fixes
 for obscure issues :)

Heh...  FWIW, forcedeth patch (sent your way about two weeks ago) also
belongs in the same set.  If you need a resend - tell...

There's another pile in drivers/net/wireless, but that's for linville to
forward when he gets around to it.  Pure annotation patches belong to
past-2.6.24 merge.

I also have starfire and epic100 fixes, but that'll have to wait until
I get around to putting the cards into sparc box (mcast breakage for
starfire and full-driver one for epic100; since nobody had cared for
the latter since 2.3.late, well...)

I think I'll have an ipg fix for you tomorrow, but I want to RTFM first
to make sure that it makes sense.  And there are several interesting
issues in atl1, netxen and cxgb3, but those will have to wait for when
I get around to asking maintainers just what the hell did they mean those
to do.

FWIW, drivers/net is fairly noise-free wrt sparse endianness warnings
in my tree; the main exceptions are prism54 (oid_mgt.c and the nightmares
it pulls) and skfp (AIX-shared vendor driver; 'nuff said, IMO).

BTW, if you still have any documentation for xircom_cb from your fighting
tulip-related stuff, it would be welcome - there are some oddities with
rx ring handling (assuming that we care about that driver at all and it's
not on the way out, that is).
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2007-12-22 Thread Jeff Garzik

Al Viro wrote:

On Sun, Dec 23, 2007 at 12:33:14AM -0500, Jeff Garzik wrote:

A couple [minorly] notable wireless bug fixes, and plenty of viro fixes
for obscure issues :)


Heh...  FWIW, forcedeth patch (sent your way about two weeks ago) also
belongs in the same set.  If you need a resend - tell...


I applied it to #upstream (2.6.25) since forcedeth is not on any 
big-endian platforms AFAIK.


Is it .24 material for some obvious reason, which I missed?  :)



There's another pile in drivers/net/wireless, but that's for linville to
forward when he gets around to it.  Pure annotation patches belong to
past-2.6.24 merge.

I also have starfire and epic100 fixes, but that'll have to wait until
I get around to putting the cards into sparc box (mcast breakage for
starfire and full-driver one for epic100; since nobody had cared for
the latter since 2.3.late, well...)


I have an epic100 card too if you need it (though it sounds like you 
have something testable).




I think I'll have an ipg fix for you tomorrow, but I want to RTFM first
to make sure that it makes sense.  And there are several interesting
issues in atl1, netxen and cxgb3, but those will have to wait for when
I get around to asking maintainers just what the hell did they mean those
to do.

FWIW, drivers/net is fairly noise-free wrt sparse endianness warnings
in my tree; the main exceptions are prism54 (oid_mgt.c and the nightmares
it pulls) and skfp (AIX-shared vendor driver; 'nuff said, IMO).


Awesome :)



BTW, if you still have any documentation for xircom_cb from your fighting
tulip-related stuff, it would be welcome - there are some oddities with
rx ring handling (assuming that we care about that driver at all and it's
not on the way out, that is).


xircom_tulip_cb should probably be deleted, since it is the crappier of 
the two drivers for the same hardware (xircom_cb being the other one).


xircom_cb _the driver_ is pretty odd.  It is less like tulip than it 
should be, actually.  There are several things that could have been done 
to improve the throughput/etc. of the driver, but it was more important 
at the time to simply find a driver that always worked.  IIRC its RX 
filtering was broken, implying the need to enable promisc mode just to 
receive packets normally.


Jeff



--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2007-12-22 Thread Al Viro
On Sun, Dec 23, 2007 at 01:42:14AM -0500, Jeff Garzik wrote:
 I applied it to #upstream (2.6.25) since forcedeth is not on any 
 big-endian platforms AFAIK.

All right, then...  I hadn't been sure if it's onboard-only, that's all.
 
 I have an epic100 card too if you need it (though it sounds like you 
 have something testable).

Picked one for a fiver on ebay, just need to get around to putting it
into that U60 box and testing; not a problem, just hadn't got around to
doing that yet.
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html