Re: [1/1] Kevent subsystem.

2006-06-23 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Thu, 22 Jun 2006 21:14:37 +0400), Evgeniy 
Polyakov [EMAIL PROTECTED] says:

 Patch against linux-2.6.17-git tree attached (gzipped).
 I would like to hear some comments about the overall design,
 implementation and plans about it's usefullness for generic kernel.
 
 Design notes, patches, userspace application and perfomance tests can be
 found at project's homepages.

| diff --git a/arch/i386/kernel/syscall_table.S 
b/arch/i386/kernel/syscall_table.S
| index af56987..93e23ff 100644
| --- a/arch/i386/kernel/syscall_table.S
| +++ b/arch/i386/kernel/syscall_table.S
| @@ -316,3 +316,7 @@ ENTRY(sys_call_table)
|   .long sys_sync_file_range
|   .long sys_tee   /* 315 */
|   .long sys_vmsplice
| + .long sys_aio_recv
| + .long sys_aio_send
| + .long sys_aio_sendfile
| + .long sys_kevent_ctl
:

We do not waste syscall entries; we can probably use socketcall
for sys_aio_recv, sys_aio_send (and maybe, sys_aio_sendfile).


| diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
| index 25ecc6e..05d7086 100644
| --- a/net/ipv4/tcp_ipv4.c
| +++ b/net/ipv4/tcp_ipv4.c
:

Please do for tcp_ipv6.c as well.  Thank you.

-- 
YOSHIFUJI Hideaki @ USAGI Project  [EMAIL PROTECTED]
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
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: [1/1] Kevent subsystem.

2006-06-23 Thread David Miller
From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
Date: Fri, 23 Jun 2006 15:12:44 +0900 (JST)

 We do not waste syscall entries; we can probably use socketcall
 for sys_aio_recv, sys_aio_send (and maybe, sys_aio_sendfile).

socketcall is deprecated and some architectures do not even
have a slot for it in their system call tables, one example
is x86_64
-
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: [1/1] Kevent subsystem.

2006-06-23 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Thu, 22 Jun 2006 23:14:07 -0700 (PDT)), 
David Miller [EMAIL PROTECTED] says:

 From: YOSHIFUJI Hideaki [EMAIL PROTECTED]
 Date: Fri, 23 Jun 2006 15:12:44 +0900 (JST)
 
  We do not waste syscall entries; we can probably use socketcall
  for sys_aio_recv, sys_aio_send (and maybe, sys_aio_sendfile).
 
 socketcall is deprecated and some architectures do not even
 have a slot for it in their system call tables, one example
 is x86_64

Ah, okay.  Thanks.

--yoshfuji
-
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


[1/4] kevent: core files.

2006-06-23 Thread Evgeniy Polyakov
This patch includes core kevent files:
 - userspace controlling
 - kernelspace interfaces
 - initialisation
 - notification state machines

It might also inlclude parts from other subsystem (like network related
syscalls so it is possible that it will not compile without other
patches applied).

Signed-off-by: Evgeniy Polyakov [EMAIL PROTECTED]

diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index af56987..93e23ff 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -316,3 +316,7 @@ ENTRY(sys_call_table)
.long sys_sync_file_range
.long sys_tee   /* 315 */
.long sys_vmsplice
+   .long sys_aio_recv
+   .long sys_aio_send
+   .long sys_aio_sendfile
+   .long sys_kevent_ctl
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 5a92fed..534d516 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -696,4 +696,8 @@ #endif
.quad sys_sync_file_range
.quad sys_tee
.quad compat_sys_vmsplice
+   .quad sys_aio_recv
+   .quad sys_aio_send
+   .quad sys_aio_sendfile
+   .quad sys_kevent_ctl
 ia32_syscall_end:  
diff --git a/include/asm-i386/unistd.h b/include/asm-i386/unistd.h
index de2ccc1..52f8642 100644
--- a/include/asm-i386/unistd.h
+++ b/include/asm-i386/unistd.h
@@ -322,10 +322,14 @@ #define __NR_splice   313
 #define __NR_sync_file_range   314
 #define __NR_tee   315
 #define __NR_vmsplice  316
+#define __NR_aio_recv  317
+#define __NR_aio_send  318
+#define __NR_aio_sendfile  319
+#define __NR_kevent_ctl320
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 317
+#define NR_syscalls 321
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
diff --git a/include/asm-x86_64/socket.h b/include/asm-x86_64/socket.h
index f2cdbea..1f31f86 100644
--- a/include/asm-x86_64/socket.h
+++ b/include/asm-x86_64/socket.h
@@ -49,4 +49,6 @@ #define SO_ACCEPTCONN 30
 
 #define SO_PEERSEC 31
 
+#define SO_ASYNC_SOCK  34
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-x86_64/unistd.h b/include/asm-x86_64/unistd.h
index 0aff22b..352c34b 100644
--- a/include/asm-x86_64/unistd.h
+++ b/include/asm-x86_64/unistd.h
@@ -617,11 +617,18 @@ #define __NR_sync_file_range  277
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
 #define __NR_vmsplice  278
 __SYSCALL(__NR_vmsplice, sys_vmsplice)
+#define __NR_aio_recv  279
+__SYSCALL(__NR_aio_recv, sys_aio_recv)
+#define __NR_aio_send  280
+__SYSCALL(__NR_aio_send, sys_aio_send)
+#define __NR_aio_sendfile  281
+__SYSCALL(__NR_aio_sendfile, sys_aio_sendfile)
+#define __NR_kevent_ctl282
+__SYSCALL(__NR_kevent_ctl, sys_kevent_ctl)
 
 #ifdef __KERNEL__
 
-#define __NR_syscall_max __NR_vmsplice
-
+#define __NR_syscall_max __NR_kevent_ctl
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */

diff --git a/include/linux/kevent.h b/include/linux/kevent.h
new file mode 100644
index 000..e94a7bf
--- /dev/null
+++ b/include/linux/kevent.h
@@ -0,0 +1,263 @@
+/*
+ * kevent.h
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov [EMAIL PROTECTED]
+ * All rights reserved.
+ * 
+ * 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
+ */
+
+#ifndef __KEVENT_H
+#define __KEVENT_H
+
+/*
+ * Kevent request flags.
+ */
+
+#define KEVENT_REQ_ONESHOT 0x1 /* Process this event only once 
and then dequeue. */
+
+/*
+ * Kevent return flags.
+ */
+#define KEVENT_RET_BROKEN  0x1 /* Kevent is broken. */
+#define KEVENT_RET_DONE0x2 /* Kevent processing 
was finished successfully. */
+
+/*
+ * Kevent type set.
+ */
+#define KEVENT_SOCKET  0
+#define KEVENT_INODE   1
+#define KEVENT_TIMER   2
+#define KEVENT_POLL3
+#define KEVENT_NAIO4
+#define KEVENT_AIO 5
+#defineKEVENT_MAX  6
+
+/*
+ * Per-type event sets.
+ * Number of per-event sets should be exactly as number of kevent types.
+ */
+
+/*
+ * Timer events.
+ */
+#defineKEVENT_TIMER_FIRED  0x1
+
+/*
+ * Socket/network asynchronous IO events.
+ */
+#define   

[2/4] kevent: network notifications.

2006-06-23 Thread Evgeniy Polyakov
This patchset includes socket notifications and network asynchronous IO.

Signed-off-by: Evgeniy Polyakov [EMAIL PROTECTED]

diff --git a/include/asm-i386/socket.h b/include/asm-i386/socket.h
index 802ae76..3473f5c 100644
--- a/include/asm-i386/socket.h
+++ b/include/asm-i386/socket.h
@@ -49,4 +49,6 @@ #define SO_ACCEPTCONN 30
 
 #define SO_PEERSEC 31
 
+#define SO_ASYNC_SOCK  34
+
 #endif /* _ASM_SOCKET_H */

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 66f8819..ea914c3 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1269,6 +1269,8 @@ extern struct sk_buff *skb_recv_datagram
 int noblock, int *err);
 extern unsigned intdatagram_poll(struct file *file, struct socket *sock,
 struct poll_table_struct *wait);
+extern intskb_copy_datagram(const struct sk_buff *from, 
+int offset, void *dst, int size);
 extern intskb_copy_datagram_iovec(const struct sk_buff *from,
   int offset, struct iovec *to,
   int size);
diff --git a/include/net/sock.h b/include/net/sock.h
index d10dfec..7a2bee3 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -47,6 +47,7 @@ #include linux/module.h
 #include linux/netdevice.h
 #include linux/skbuff.h  /* struct sk_buff */
 #include linux/security.h
+#include linux/kevent.h
 
 #include linux/filter.h
 
@@ -386,6 +387,8 @@ enum sock_flags {
SOCK_NO_LARGESEND, /* whether to sent large segments or not */
SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
+   SOCK_ASYNC,
+   SOCK_ASYNC_INUSE,
 };
 
 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -445,6 +448,21 @@ static inline int sk_stream_memory_free(
 
 extern void sk_stream_rfree(struct sk_buff *skb);
 
+struct socket_alloc {
+   struct socket socket;
+   struct inode vfs_inode;
+};
+
+static inline struct socket *SOCKET_I(struct inode *inode)
+{
+   return container_of(inode, struct socket_alloc, vfs_inode)-socket;
+}
+
+static inline struct inode *SOCK_INODE(struct socket *socket)
+{
+   return container_of(socket, struct socket_alloc, socket)-vfs_inode;
+}
+
 static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk)
 {
skb-sk = sk;
@@ -472,6 +490,7 @@ static inline void sk_add_backlog(struct
sk-sk_backlog.tail = skb;
}
skb-next = NULL;
+   kevent_socket_notify(sk, KEVENT_SOCKET_RECV);
 }
 
 #define sk_wait_event(__sk, __timeo, __condition)  \
@@ -543,6 +562,12 @@ struct proto {
 
int (*backlog_rcv) (struct sock *sk, 
struct sk_buff *skb);
+   
+   int (*async_recv) (struct sock *sk, 
+   void *dst, size_t size);
+   int (*async_send) (struct sock *sk, 
+   struct page **pages, unsigned 
int poffset, 
+   size_t size);
 
/* Keeping track of sk's, looking them up, and port selection methods. 
*/
void(*hash)(struct sock *sk);
@@ -674,21 +699,6 @@ static inline struct kiocb *siocb_to_kio
return si-kiocb;
 }
 
-struct socket_alloc {
-   struct socket socket;
-   struct inode vfs_inode;
-};
-
-static inline struct socket *SOCKET_I(struct inode *inode)
-{
-   return container_of(inode, struct socket_alloc, vfs_inode)-socket;
-}
-
-static inline struct inode *SOCK_INODE(struct socket *socket)
-{
-   return container_of(socket, struct socket_alloc, socket)-vfs_inode;
-}
-
 extern void __sk_stream_mem_reclaim(struct sock *sk);
 extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind);
 
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 5f4eb5c..820cd5a 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -364,6 +364,8 @@ extern int  compat_tcp_setsockopt(struc
int level, int optname,
char __user *optval, int optlen);
 extern voidtcp_set_keepalive(struct sock *sk, int val);
+extern int tcp_async_recv(struct sock *sk, void *dst, 
size_t size);
+extern int tcp_async_send(struct sock *sk, struct page 
**pages, unsigned int poffset, size_t size);
 extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
struct msghdr *msg,
size_t len, int nonblock, 
@@ -857,6 +859,7 @@ static inline int tcp_prequeue(struct so
 

[4/4] kevent: generic poll and timer notifications.

2006-06-23 Thread Evgeniy Polyakov
This patch includes generic poll/select and timer notifications.

Signed-off-by: Evgeniy Polyakov [EMAIL PROTECTED]

diff --git a/kernel/kevent/kevent_poll.c b/kernel/kevent/kevent_poll.c
new file mode 100644
index 000..4950e7c
--- /dev/null
+++ b/kernel/kevent/kevent_poll.c
@@ -0,0 +1,223 @@
+/*
+ * kevent_poll.c
+ * 
+ * 2006 Copyright (c) Evgeniy Polyakov [EMAIL PROTECTED]
+ * All rights reserved.
+ * 
+ * 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.
+ */
+
+#include linux/kernel.h
+#include linux/types.h
+#include linux/list.h
+#include linux/slab.h
+#include linux/spinlock.h
+#include linux/timer.h
+#include linux/file.h
+#include linux/kevent.h
+#include linux/poll.h
+#include linux/fs.h
+
+static kmem_cache_t *kevent_poll_container_cache;
+static kmem_cache_t *kevent_poll_priv_cache;
+
+struct kevent_poll_ctl
+{
+   struct poll_table_structpt;
+   struct kevent   *k;
+};
+
+struct kevent_poll_wait_container
+{
+   struct list_headcontainer_entry;
+   wait_queue_head_t   *whead;
+   wait_queue_twait;
+   struct kevent   *k;
+};
+
+struct kevent_poll_private
+{
+   struct list_headcontainer_list;
+   spinlock_t  container_lock;
+};
+
+static int kevent_poll_enqueue(struct kevent *k);
+static int kevent_poll_dequeue(struct kevent *k);
+static int kevent_poll_callback(struct kevent *k);
+
+static int kevent_poll_wait_callback(wait_queue_t *wait, 
+   unsigned mode, int sync, void *key)
+{
+   struct kevent_poll_wait_container *cont = 
+   container_of(wait, struct kevent_poll_wait_container, wait);
+   struct kevent *k = cont-k;
+   struct file *file = k-st-origin;
+   unsigned long flags;
+   u32 revents, event;
+
+   revents = file-f_op-poll(file, NULL);
+   spin_lock_irqsave(k-lock, flags);
+   event = k-event.event;
+   spin_unlock_irqrestore(k-lock, flags);
+
+   kevent_storage_ready(k-st, NULL, revents);
+
+   return 0;
+}
+
+static void kevent_poll_qproc(struct file *file, wait_queue_head_t *whead, 
+   struct poll_table_struct *poll_table)
+{
+   struct kevent *k = 
+   container_of(poll_table, struct kevent_poll_ctl, pt)-k;
+   struct kevent_poll_private *priv = k-priv;
+   struct kevent_poll_wait_container *cont;
+   unsigned long flags;
+
+   cont = kmem_cache_alloc(kevent_poll_container_cache, SLAB_KERNEL);
+   if (!cont) {
+   kevent_break(k);
+   return;
+   }
+   
+   cont-k = k;
+   init_waitqueue_func_entry(cont-wait, kevent_poll_wait_callback);
+   cont-whead = whead;
+
+   spin_lock_irqsave(priv-container_lock, flags);
+   list_add_tail(cont-container_entry, priv-container_list);
+   spin_unlock_irqrestore(priv-container_lock, flags);
+
+   add_wait_queue(whead, cont-wait);
+}
+
+static int kevent_poll_enqueue(struct kevent *k)
+{
+   struct file *file;
+   int err, ready = 0;
+   unsigned int revents;
+   struct kevent_poll_ctl ctl;
+   struct kevent_poll_private *priv;
+
+   file = fget(k-event.id.raw[0]);
+   if (!file)
+   return -ENODEV;
+
+   err = -EINVAL;
+   if (!file-f_op || !file-f_op-poll)
+   goto err_out_fput;
+
+   err = -ENOMEM;
+   priv = kmem_cache_alloc(kevent_poll_priv_cache, SLAB_KERNEL);
+   if (!priv)
+   goto err_out_fput;
+
+   spin_lock_init(priv-container_lock);
+   INIT_LIST_HEAD(priv-container_list);
+
+   k-priv = priv;
+
+   ctl.k = k;
+   init_poll_funcptr(ctl.pt, kevent_poll_qproc);
+
+   err = kevent_storage_enqueue(file-st, k);
+   if (err)
+   goto err_out_free;
+
+   revents = file-f_op-poll(file, ctl.pt);
+   if (revents  k-event.event) {
+   ready = 1;
+   kevent_poll_dequeue(k);
+   }
+   
+   return ready;
+
+err_out_free:
+   kmem_cache_free(kevent_poll_priv_cache, priv);
+err_out_fput:
+   fput(file);
+   return err;
+}
+
+static int kevent_poll_dequeue(struct kevent *k)
+{
+   struct file *file = k-st-origin;
+   struct kevent_poll_private *priv = k-priv;
+   struct kevent_poll_wait_container *w, *n;
+   unsigned long flags;
+
+   kevent_storage_dequeue(k-st, k);
+
+   spin_lock_irqsave(priv-container_lock, flags);
+   

Re: Locking validator output on DCCP

2006-06-23 Thread Ingo Molnar

* Ian McDonald [EMAIL PROTECTED] wrote:

 OK. This is in net/ipv4/tcp_ipv4.c tcp_v4_rcv with the 
 bh_lock_sock_nested which I presume is clashing with the nested of 
 skb_clone

yeah, that's exactly what happens.

 Can we not do two levels nested?

we can - but it needs to be thought through (and needs to be tested). 
But an initial glance seems to suggest that two levels, one used for 
clone and another one used for tcp_v4_rcv nesting ought to do the trick.

 Is there extra documentation for the locking validation suite so that 
 I can stop asking stupid questions? If not I'll just read more of the 
 source code.

i'd suggest to start with: Documentation/lockdep-design.txt, then with 
include/linux/lockdep.h and also look at some of the existing patches 
that introduce multiple nesting levels, such as:


http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17/2.6.17-mm1/broken-out/lock-validator-special-locking-dcache.patch

the best method is to find the proper central header for the level enum, 
and then make use of it. The enum should have a descriptive name, and 
the enum values too.

If one particular lock has multiple levels then SINGLE_DEPTH_NESTING 
should not be used. (to keep the levels architecture clean) I.e. 
possibly the best idea would be to extend bh_lock_sock_nested() with a 
'subtype' parameter, and to pass that into spin_lock_nested().

Or even better: define bh_lock_sock_nested() as an inline function with 
the right enum parameter, which will make sure only the right type of 
enum will be used. [if it's possible to do it as an inline there - it's 
a macro right now and i'm not sure all the types necessary for the 
inline are declared up to that point in the sock.h include file]

Ingo
-
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: [2.6 patch] make net/core/skbuff.c:skb_release_data() static

2006-06-23 Thread David Miller
From: Adrian Bunk [EMAIL PROTECTED]
Date: Fri, 23 Jun 2006 12:56:23 +0200

 skb_release_data() no longer has any users in other files.
 
 Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

If you are going to do this, you need to remove the reference
in arch/x86_64/kernel/functionlist too.

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


[2.6 patch] make net/core/skbuff.c:skb_release_data() static

2006-06-23 Thread Adrian Bunk
skb_release_data() no longer has any users in other files.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]

---

 include/linux/skbuff.h |2 --
 net/core/skbuff.c  |2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

--- linux-2.6.17-mm1-full/include/linux/skbuff.h.old2006-06-23 
00:45:40.0 +0200
+++ linux-2.6.17-mm1-full/include/linux/skbuff.h2006-06-23 
00:46:37.0 +0200
@@ -1289,8 +1289,6 @@
 extern void   skb_split(struct sk_buff *skb,
 struct sk_buff *skb1, const u32 len);
 
-extern void   skb_release_data(struct sk_buff *skb);
-
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
   int len, void *buffer)
 {
--- linux-2.6.17-mm1-full/net/core/skbuff.c.old 2006-06-23 00:46:44.0 
+0200
+++ linux-2.6.17-mm1-full/net/core/skbuff.c 2006-06-23 00:46:50.0 
+0200
@@ -292,7 +292,7 @@
skb_get(list);
 }
 
-void skb_release_data(struct sk_buff *skb)
+static void skb_release_data(struct sk_buff *skb)
 {
if (!skb-cloned ||
!atomic_sub_return(skb-nohdr ? (1  SKB_DATAREF_SHIFT) + 1 : 1,

-
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 1/2] Hardware button support for Wireless cards: radiobtn

2006-06-23 Thread Vojtech Pavlik
On Thu, Jun 22, 2006 at 05:55:46PM +0200, Jiri Benc wrote:

 On Sat, 17 Jun 2006 17:05:55 +0200, Ivo van Doorn wrote:
  With this approach more buttons can be registered,
  it includes the optional field to report an update of the key status
  to the driver that registered it, and it supports for non-polling keys.
 
 I think this is not specific to networking anymore, so it should go to
 lkml. Please be sure to Cc: input devices maintainer, Dmitry Torokhov.
 
 Regarding rfkill button, I talked about that with Vojtech Pavlik (Cc:ed)
 and he suggests this solution:
 
 - driver is responsible for turning on/off radio when the input device
   is not opened;
 - when something opens the input device, it receives input events and 
   gets responsible to turn on/off the radio (by ioctl or putting the 
   network interfaces up/down).
 
 This is of course not possible for all hardware, but it gives the most
 flexibility while keeping the possibility to switch of the radio without
 userspace support.
 
Let me elaborate a little bit on the possible implementation:

1) 802.11 card drivers will implement an input device for each card in
the system that has a user-controlled RF-Kill button or switch.

2) 802.11 card drivers will implement an interface to enable/disable the
radio, be it through a call, ioctl, or whatever, that is accessible from
both the kernel and userspace.

3) ACPI buttons drivers, and keyboard drivers will generate KEY_RFKILL
on machines where RF-Kill keys are reported using ACPI events or
keyboard scancodes.

3) A rfkill.ko input handler module will be implemented, that listens to
the SW_RFKILL and KEY_RFKILL events from all devices in the system, and
will enable/disable radios on all 802.11 devices in the system.

The above will make the RF-Kill button work under all real scenarios as
user expects - it will enable/disable the radio. In the case where a
user has an additional PCMCIA card, both the radios will be disabled by
presing the RF-Kill button, which is arguably what the user expects.
Even BlueTooth or other RF technologies (CDMA, EDGE) can hook into this
mechanism.

4) When userspace wants to take over the control over RF-Kill, and start
additional services based on that, it can open the input devices to get
the state of the buttons/switches, AND it can issue the EVIOCGRAB
ioctl() to prevent the rfkill.ko and any other handlers from getting the
events.

This allows simple implementation of dbus notifications and
NetworkManager-style configuration of network interfaces.

-- 
Vojtech Pavlik
Director SuSE Labs
-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Jiri Benc
On Thu, 22 Jun 2006 08:12:24 -0400, Luis R. Rodriguez wrote:
 Kernel level:
 
 (1) Use the new *configfs* for all user-specific attributes
 (2) Use *sysfs* read-only kobjects for device-specific attributes like
 values which can be saved for suspend() and collected for resume().
 IEEE 802.11 capabilities, features (for example radiotap), and what is
 currently settable/gettable from private ioctl realm along with its
 restrictions can also be exported via sysfs.
 (3) On resume() talk to userspace via netlink to read our sysfs and configfs 
 us

We need a new hostapd-stack communication protocol. It definitely
cannot be configfs as we need asynchronous events; netlink seems to be
the best solution for this. Why should be a part of 802.11
userspace-kernel communication done by netlink and part by
configfs/sysfs?

Second, all new network stuff is configured via netlink (or by ioctls,
but that doesn't count). Why should be 802.11 different?

I'd rather choose the way of extending current WE-netlink.

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs
-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Dan Williams
On Thu, 2006-06-22 at 08:12 -0400, Luis R. Rodriguez wrote:
 (4) At resume() we could just have our driver read our sysfs
 attributes and try to set all of them back exactly how they were
 before but to reduce bloat on our drivers and since our state is
 already exported we could just have userspace do it for us so... we
 use netlink to communicate to userspace to go ahead and ask it to
 resume() us. Advantages of this would be userspace would always
 consistantly handle the assoc/desassoc and WPA in a consistent manner
 and as mentioned above, driver bloatness killing.

I think having the driver try to set all its state back is pretty much
useless in a large number of cases.  While definitely useful for some
cases, consider:

a) suspend, drive to work, resume
b) WPA-related stuff, which takes much more than simply setting SSID and
encryption key back on the card

Neither of these instances allows the driver to just stick its fingers
in its ears, hum loudly, and pretend nothing happened between suspend
and resume.  Essentially, drivers would be doing all this work for
unencrypted and WEP cases, and then only those cases where the machine
hasn't physically moved.

Our effort is probably better spent elsewhere, especially since many
popular userspace tools already handle resume for us just fine.  More
useful to have drivers just come back from resume in an initialized
state similar to system boot.

Dan


-
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: System hangs after running 2.6.17rc6 with broadcom 4309 and device scape stack

2006-06-23 Thread Jiri Benc
On Sun, 18 Jun 2006 18:25:54 -0700 (PDT), Alex Davis wrote:
 Here is dmesg output for module loading.
 [...]
 Jun 16 20:04:06 siafu kernel: [4294720.505000] bcm43xx_d80211: Virtual 
 interface added (type:
 0x0002, ID: 4, MAC: 00:90:96:ba:32:20)
 Jun 16 20:04:06 siafu kernel: [4294720.511000] bcm43xx_d80211: PHY connected
 Jun 16 20:04:07 siafu kernel: [4294720.779000] bcm43xx_d80211: Radio turned on
 Jun 16 20:04:07 siafu kernel: [4294720.971000] bcm43xx_d80211: Chip 
 initialized
 Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: DMA initialized
 Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: 80211 cores 
 initialized
 Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: Keys cleared
 Jun 16 20:04:07 siafu kernel: [4294720.988000] wmaster0: Does not support 
 passive scan, disabled
 Jun 16 20:04:09 siafu kernel: [4294723.027000] bcm43xx_d80211: ASSERTION 
 FAILED
 (bcm-interface.if_id == if_id) at:
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c:4344:bcm43xx_config_interface()

This is really strange. Is this reproducible with latest wireless-dev?

There was ifconfig up (or similar) command at 20:04:06 but
wpa_supplicant was started at 20:04:14. What happened in-between?

Most important, what happened between 20:04:07 and 20:04:09? (I.e. what
commands were invoked?) 

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs
-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread John W. Linville
On Fri, Jun 23, 2006 at 07:50:47AM -0400, Dan Williams wrote:

 Our effort is probably better spent elsewhere, especially since many
 popular userspace tools already handle resume for us just fine.  More
 useful to have drivers just come back from resume in an initialized
 state similar to system boot.

I think Dan makes a lot of sense here.  Does anyone disagree?

John
-- 
John W. Linville
[EMAIL PROTECTED]
-
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/5] d80211: update tx.skb after TX handler calls

2006-06-23 Thread Jiri Benc
TX and RX handlers are allowed to change skb. Fix (hopefully) the last place
where this is not taken into account.

This is similar to e81b1bc0f272a50458ab6ae8777f6327af0248e5.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

9372ebe184ff953be4f9d05b029477a57dd43bbd
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index a8ca8d1..944b89f 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1760,6 +1760,7 @@ ieee80211_get_buffered_bc(struct net_dev
break;
}
dev_put(tx.dev);
+   skb = tx.skb; /* handlers are allowed to change skb */
 
if (res == TXRX_DROP) {
I802_DEBUG_INC(local-tx_handlers_drop);
-- 
1.3.0

-
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/5] d80211: handle full queue when sending fragments

2006-06-23 Thread Jiri Benc
When the queue gets filled up while sending fragments, do not discard the
frame.

Partially sent frames are stored in a buffer in ieee80211_local (there is
place for one frame for each queue there). When the space in hw queue gets
available again, stored frame for that queue is sent first.

Also, the case when driver returns NETDEV_TX_BUSY is handled properly now.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c   |  227 --
 net/d80211/ieee80211_i.h |   14 +++
 net/d80211/wme.c |5 +
 3 files changed, 198 insertions(+), 48 deletions(-)

975a964398a0beb665747691350282b0a0b809c1
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 65f32a8..0f01311 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1153,6 +1153,74 @@ static void inline ieee80211_tx_prepare(
__ieee80211_tx_prepare(tx, skb, dev, control);
 }
 
+static inline int __ieee80211_queue_stopped(struct ieee80211_local *local,
+   int queue)
+{
+   return test_bit(IEEE80211_LINK_STATE_XOFF, local-state[queue]);
+}
+
+static inline int __ieee80211_queue_pending(struct ieee80211_local *local,
+   int queue)
+{
+   return test_bit(IEEE80211_LINK_STATE_PENDING, local-state[queue]);
+}
+
+#define IEEE80211_TX_OK0
+#define IEEE80211_TX_AGAIN 1
+#define IEEE80211_TX_FRAG_AGAIN2
+
+static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
+ struct ieee80211_txrx_data *tx)
+{
+   struct ieee80211_tx_control *control = tx-u.tx.control;
+   int ret, i;
+
+   if (skb) {
+   ieee80211_dump_frame(local-mdev-name, TX to low-level 
driver, skb);
+   ret = local-hw-tx(local-mdev, skb, control);
+   if (ret)
+   return IEEE80211_TX_AGAIN;
+#ifdef IEEE80211_LEDS
+   if (local-tx_led_counter++ == 0) {
+   ieee80211_tx_led(1, local-mdev);
+   }
+#endif /* IEEE80211_LEDS */
+   }
+   if (tx-u.tx.extra_frag) {
+   control-use_rts_cts = 0;
+   control-use_cts_protect = 0;
+   control-clear_dst_mask = 0;
+   for (i = 0; i  tx-u.tx.num_extra_frag; i++) {
+   if (!tx-u.tx.extra_frag[i])
+   continue;
+   if (__ieee80211_queue_stopped(local, control-queue))
+   return IEEE80211_TX_FRAG_AGAIN;
+   if (i == tx-u.tx.num_extra_frag) {
+   control-tx_rate = tx-u.tx.last_frag_hwrate;
+   control-rateidx = tx-u.tx.last_frag_rateidx;
+   control-rate_ctrl_probe =
+   tx-u.tx.probe_last_frag;
+   }
+
+   ieee80211_dump_frame(local-mdev-name,
+TX to low-level driver, skb);
+   ret = local-hw-tx(local-mdev, tx-u.tx.extra_frag[i],
+   control);
+   if (ret)
+   return IEEE80211_TX_FRAG_AGAIN;
+#ifdef IEEE80211_LEDS
+   if (local-tx_led_counter++ == 0) {
+   ieee80211_tx_led(1, local-mdev);
+   }
+#endif /* IEEE80211_LEDS */
+   tx-u.tx.extra_frag[i] = NULL;
+   }
+   kfree(tx-u.tx.extra_frag);
+   tx-u.tx.extra_frag = NULL;
+   }
+   return IEEE80211_TX_OK;
+}
+
 static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb,
struct ieee80211_tx_control *control, int mgmt)
 {
@@ -1163,6 +1231,8 @@ static int ieee80211_tx(struct net_devic
ieee80211_txrx_result res = TXRX_DROP;
 int ret, i;
 
+   WARN_ON(__ieee80211_queue_pending(local, control-queue));
+
if (unlikely(skb-len  10)) {
dev_kfree_skb(skb);
return 0;
@@ -1193,65 +1263,60 @@ static int ieee80211_tx(struct net_devic
return 0;
}
 
-   ieee80211_dump_frame(local-mdev-name, TX to low-level driver, skb);
-   ret = local-hw-tx(local-mdev, skb, control);
-#ifdef IEEE80211_LEDS
-   if (!ret  local-tx_led_counter++ == 0) {
-ieee80211_tx_led(1, dev);
-}
-#endif /* IEEE80211_LEDS */
if (tx.u.tx.extra_frag) {
-   if (ret  0) {
-   /* Must free all fragments and return 0 since skb data
-* has been fragmented into multiple buffers.
-* TODO: could free extra fragments and restore skb to
-* the original form since the data is still there and
-* then return nonzero so that Linux 

[PATCH 0/5] d80211: pull request - fragmentation, fixes

2006-06-23 Thread Jiri Benc
Please pull from
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git master
to obtain following patches:

Jiri Benc:
  d80211: update tx.skb after TX handler calls
  d80211: per-queue TX flow control
  d80211: handle full queue when sending fragments
  d80211: add first_fragment flag to ieee80211_tx_control

Michael Buesch:
  d80211: allow NULL for control in beacon_get

 include/net/d80211.h |   32 +
 net/d80211/ieee80211.c   |  293 --
 net/d80211/ieee80211_i.h |   20 +++
 net/d80211/wme.c |9 +
 4 files changed, 285 insertions(+), 69 deletions(-)


-- 
Jiri Benc
SUSE Labs
-
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/5] d80211: add first_fragment flag to ieee80211_tx_control

2006-06-23 Thread Jiri Benc
If a driver needs to find out if the fragment it is supposed to pass to the
hardware is the first fragment, the only way to do this is to check if
a Fragment Number part of seq_ctrl field in the frame header equals to 0.
Let's make it easier.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 include/net/d80211.h   |2 ++
 net/d80211/ieee80211.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

e360f2605cbb71f359de21a59eff1bcbab150e7f
diff --git a/include/net/d80211.h b/include/net/d80211.h
index 141f776..6ae4325 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -158,6 +158,8 @@ struct ieee80211_tx_control {
unsigned int rate_ctrl_probe:1;
unsigned int clear_dst_mask:1;
unsigned int requeue:1;
+   unsigned int first_fragment:1;  /* This is a first fragment of the
+* frame */
 /* following three flags are only used with Atheros Super A/G */
unsigned int compress:1;
unsigned int turbo_prime_notify:1; /* notify HostaAPd after frame
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 0f01311..9fc3518 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1120,6 +1120,7 @@ __ieee80211_tx_prepare(struct ieee80211_
u8 *pos = skb-data[hdrlen + sizeof(rfc1042_header)];
tx-ethertype = (pos[0]  8) | pos[1];
}
+   control-first_fragment = 1;
 
 }
 
@@ -1190,6 +1191,7 @@ #endif /* IEEE80211_LEDS */
control-use_rts_cts = 0;
control-use_cts_protect = 0;
control-clear_dst_mask = 0;
+   control-first_fragment = 0;
for (i = 0; i  tx-u.tx.num_extra_frag; i++) {
if (!tx-u.tx.extra_frag[i])
continue;
-- 
1.3.0

-
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/5] d80211: allow NULL for control in beacon_get

2006-06-23 Thread Jiri Benc
From: Michael Buesch [EMAIL PROTECTED]

bcm43xx has no use for the control data provided by
ieee80211_beacon_get(), so allow passing a NULL pointer
to avoid setting up a dummy struct and throwing the data
away afterwards in the driver.

Signed-off-by: Michael Buesch [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 net/d80211/ieee80211.c |   40 +---
 1 files changed, 21 insertions(+), 19 deletions(-)

634f9d6f4bbafbcf218ac303087a0e83c5c95cda
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 9fc3518..ffb0f18 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -1806,28 +1806,30 @@ #endif /* CONFIG_D80211_VERBOSE_DEBUG */
memcpy(skb_put(skb, bt_len), b_tail, bt_len);
}
 
-   memset(extra, 0, sizeof(extra));
-   extra.endidx = local-num_curr_rates;
+   if (control) {
+   memset(extra, 0, sizeof(extra));
+   extra.endidx = local-num_curr_rates;
 
-   rate = rate_control_get_rate(dev, skb, extra);
-   if (rate == NULL) {
-   if (net_ratelimit()) {
-   printk(KERN_DEBUG %s: ieee80211_beacon_get: no rate 
-  found\n, dev-name);
+   rate = rate_control_get_rate(dev, skb, extra);
+   if (rate == NULL) {
+   if (net_ratelimit()) {
+   printk(KERN_DEBUG %s: ieee80211_beacon_get: no 
rate 
+  found\n, dev-name);
+   }
+   dev_kfree_skb(skb);
+   return NULL;
}
-   dev_kfree_skb(skb);
-   return NULL;
-   }
 
-   control-tx_rate = (local-short_preamble 
-   (rate-flags  IEEE80211_RATE_PREAMBLE2)) ?
-   rate-val2 : rate-val;
-   control-antenna_sel = local-conf.antenna_sel;
-   control-power_level = local-conf.power_level;
-   control-no_ack = 1;
-   control-retry_limit = 1;
-   control-rts_cts_duration = 0;
-   control-clear_dst_mask = 1;
+   control-tx_rate = (local-short_preamble 
+   (rate-flags  IEEE80211_RATE_PREAMBLE2)) ?
+   rate-val2 : rate-val;
+   control-antenna_sel = local-conf.antenna_sel;
+   control-power_level = local-conf.power_level;
+   control-no_ack = 1;
+   control-retry_limit = 1;
+   control-rts_cts_duration = 0;
+   control-clear_dst_mask = 1;
+   }
 
ap-num_beacons++;
return skb;
-- 
1.3.0

-
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/3] rt2x00: per-queue TX flow control

2006-06-23 Thread Jiri Benc
From: Ivo van Doorn [EMAIL PROTECTED]

Based on Jiri's patch for rt2x00 driver to do TX flow control.

Signed-off-by: Ivo van Doorn [EMAIL PROTECTED]
Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

diff --git a/drivers/net/wireless/d80211/rt2x00/rt2400pci.c 
b/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
index 8b856dd..946cf86 100644
--- a/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/d80211/rt2x00/rt2400pci.c
@@ -1002,6 +1002,12 @@ rt2400pci_txdone(void *data)
struct txd  *txd;
int tx_status;
int ack;
+   int ring_full;
+
+   /*
+* Store the current status of the ring.
+*/
+   ring_full = rt2x00_ring_full(ring);
 
while (!rt2x00_ring_empty(ring)) {
entry = rt2x00_get_data_entry_done(ring);
@@ -1062,6 +1068,16 @@ rt2400pci_txdone(void *data)
rt2x00pci-scan-status = SCANNING_READY;
complete(rt2x00pci-scan-completion);
}
+
+   /*
+* If the data ring was full before the txdone handler
+* we must make sure the packet queue in the d80211 stack
+* is reenabled when the txdone handler has finished.
+*/
+   entry = ring-entry;
+   if (ring_full  !rt2x00_ring_full(ring))
+   ieee80211_wake_queue(ring-net_dev,
+   entry-tx_status.control.queue);
 }
 
 static irqreturn_t
@@ -1541,18 +1557,26 @@ rt2400pci_tx(struct net_device *net_dev,
ERROR(Attempt to send packet over invalid queue %d.\n
Please file bug report to %s.\n,
control-queue, DRV_PROJECT);
-   return NET_XMIT_DROP;
+   dev_kfree_skb_any(skb);
+   return NETDEV_TX_OK;
}
 
-   if (rt2x00_ring_full(ring))
-   return NET_XMIT_DROP;
+   if (rt2x00_ring_full(ring)) {
+   ieee80211_stop_queue(net_dev, control-queue);
+   return NETDEV_TX_BUSY;
+   }
 
entry = rt2x00_get_data_entry(ring);
txd = entry-desc_addr;
 
if (rt2x00_get_field32(txd-word0, TXD_W0_OWNER_NIC)
-   || rt2x00_get_field32(txd-word0, TXD_W0_VALID))
-   return NET_XMIT_DROP;
+   || rt2x00_get_field32(txd-word0, TXD_W0_VALID)) {
+   ERROR(Arrived at non-free entry in the non-full queue %d.\n
+   Please file bug report to %s.\n,
+   control-queue, DRV_PROJECT);
+   ieee80211_stop_queue(net_dev, control-queue);
+   return NETDEV_TX_BUSY;
+   }
 
memcpy(entry-data_addr, skb-data, skb-len);
rt2400pci_write_tx_desc(rt2x00pci, txd, skb, control);
@@ -1560,6 +1584,9 @@ rt2400pci_tx(struct net_device *net_dev,
 
rt2x00_ring_index_inc(ring);
 
+   if (rt2x00_ring_full(ring))
+   ieee80211_stop_queue(net_dev, control-queue);
+
rt2x00_register_read(rt2x00pci, TXCSR0, reg);
if (control-queue == IEEE80211_TX_QUEUE_DATA0)
rt2x00_set_field32(reg, TXCSR0_KICK_PRIO, 1);
@@ -1569,7 +1596,7 @@ rt2400pci_tx(struct net_device *net_dev,
rt2x00_set_field32(reg, TXCSR0_KICK_ATIM, 1);
rt2x00_register_write(rt2x00pci, TXCSR0, reg);
 
-   return 0;
+   return NETDEV_TX_OK;
 }
 
 static int
@@ -1669,6 +1696,8 @@ rt2400pci_open(struct net_device *net_de
 
SET_FLAG(rt2x00pci, RADIO_ENABLED);
 
+   ieee80211_start_queues(net_dev);
+
return 0;
 
 exit_fail:
diff --git a/drivers/net/wireless/d80211/rt2x00/rt2500pci.c 
b/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
index 6aeaf1a..ca0edd5 100644
--- a/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/d80211/rt2x00/rt2500pci.c
@@ -1090,6 +1090,12 @@ rt2500pci_txdone(void *data)
struct txd  *txd;
int tx_status;
int ack;
+   int ring_full;
+
+   /*
+* Store the current status of the ring.
+*/
+   ring_full = rt2x00_ring_full(ring);
 
while (!rt2x00_ring_empty(ring)) {
entry = rt2x00_get_data_entry_done(ring);
@@ -1150,6 +1156,16 @@ rt2500pci_txdone(void *data)
rt2x00pci-scan-status = SCANNING_READY;
complete(rt2x00pci-scan-completion);
}
+
+   /*
+* If the data ring was full before the txdone handler
+* we must make sure the packet queue in the d80211 stack
+* is reenabled when the txdone handler has finished.
+*/
+   entry = ring-entry;
+   if (ring_full  !rt2x00_ring_full(ring))
+   ieee80211_wake_queue(ring-net_dev,
+   entry-tx_status.control.queue);
 }
 
 static irqreturn_t
@@ -1664,18 +1680,26 @@ rt2500pci_tx(struct net_device *net_dev,
ERROR(Attempt to send packet over invalid queue %d.\n
   

[PATCH 2/3] bcm43xx-d80211: fix sending of fragments

2006-06-23 Thread Jiri Benc
This makes fragmentation work with bcm43xx.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]
Signed-off-by: Michael Buesch [EMAIL PROTECTED]

---
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c |2 +-
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c
@@ -703,7 +703,7 @@ static int dma_tx_fragment(struct bcm43x
bcm43xx_generate_txhdr(ring-bcm,
   (struct bcm43xx_txhdr *)hdr_skb-data,
   skb-data, skb-len,
-  1,//FIXME
+  ctl-first_fragment,
   generate_cookie(ring, slot),
   ctl);
 
--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_pio.c
@@ -186,7 +186,7 @@ static void pio_tx_write_fragment(struct
assert(skb_shinfo(skb)-nr_frags == 0);
bcm43xx_generate_txhdr(queue-bcm,
   txhdr, skb-data, skb-len,
-  1,//FIXME
+  packet-txstat.control.first_fragment,
   generate_cookie(queue, packet),
   packet-txstat.control);
 
-
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


[incomplete 3/3] bcm43xx-d80211: per-queue TX flow control

2006-06-23 Thread Jiri Benc
This is an attempt to fix bcm43xx driver. It is for DMA mode only and
incomplete even for that mode - ieee80211_hw-tx() callback should return
NETDEV_TX_* contants which is not completely fixed by this patch.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c  |6 +-
 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_dma.c
@@ -778,13 +778,16 @@ int bcm43xx_dma_tx(struct bcm43xx_privat
 * recognizes if the device queue is full and does
 * not send data anymore.
 */
+   ieee80211_stop_queue(bcm-net_dev, 0);
printk(KERN_ERR PFX DMA queue overflow\n);
-   return -ENOMEM;
+   return NETDEV_TX_BUSY;
}
 
err = dma_tx_fragment(ring, skb, ctl);
if (likely(!err))
ring-nr_tx_packets++;
+   if (free_slots(ring)  SLOTS_PER_PACKET)
+   ieee80211_stop_queue(bcm-net_dev, 0);
 
return err;
 }
@@ -833,6 +836,7 @@ void bcm43xx_dma_handle_xmitstatus(struc
slot = next_slot(ring, slot);
}
bcm-stats.last_tx = jiffies;
+   ieee80211_wake_queue(bcm-net_dev, 0);
 }
 
 void bcm43xx_dma_get_tx_stats(struct bcm43xx_private *bcm,
--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -3813,6 +3813,7 @@ static int bcm43xx_init_board(struct bcm
bcm43xx_security_init(bcm);
bcm43xx_measure_channel_change_time(bcm);
ieee80211_update_hw(bcm-net_dev, bcm-ieee);
+   ieee80211_start_queues(bcm-net_dev);
ieee80211_netif_oper(bcm-net_dev, NETIF_ATTACH);
ieee80211_netif_oper(bcm-net_dev, NETIF_START);
ieee80211_netif_oper(bcm-net_dev, NETIF_WAKE);
-
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/3] d80211 drivers: fixes for last d80211 patches

2006-06-23 Thread Jiri Benc
These are fixes for d80211 drivers to work after last d80211 patches. Note
that bcm43xx-d80211 TX flow patch is still incomplete.

-- 
Jiri Benc
SUSE Labs
-
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/2][RFC] Network Event Notifier Mechanism

2006-06-23 Thread Steve Wise
On Thu, 2006-06-22 at 20:56 -0400, jamal wrote:
 On Thu, 2006-22-06 at 15:58 -0700, David Miller wrote:
 
  Anyways, we can create normal notifiers for neighbour and route
  events just like we have for network device stuff.
 

So did you agree with a new notifier head for these events as in my
original patch?  Or do you think I should add these to the netdev
notifier?  

  There should be netlink counterparts for that stuff too, which
  are generated by the notifier calls or similar.
 

Ok.

 PS:- I do think what they need is to hear route cache generation
 as opposed to ARP+FIB updates; but lets wait and see how clever 
 the patches would look.
 

Based on what I undestand from this thread, I should keep a notifier
block for these events and integrate that so the events also get passed
up to user space via netlink.  

Can you expand on your statement above?  If hooking route cache
generation gets all the events I described, then I'd like to use that.
I'm still learning the Linux routing subsystem.  Any help would be
GREAT!

Thanks,

Steve.



-
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 v3 1/7] AMSO1100 Low Level Driver.

2006-06-23 Thread Steve Wise
On Fri, 2006-06-23 at 15:48 +0200, Arjan van de Ven wrote:
+   /* Tell HW to xmit */
+   __raw_writeq(cpu_to_be64(mapaddr), elem-hw_desc + C2_TXP_ADDR);
+   __raw_writew(cpu_to_be16(maplen), elem-hw_desc + C2_TXP_LEN);
+   __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem-hw_desc + 
C2_TXP_FLAGS);
   
   or here
   
  
  No need here.  This logic submits the packet for transmission.  We don't
  assume it is transmitted until we (after a completion interrupt usually)
  read back the HTXD entry and see the TXP_HTXD_DONE bit set (see
  c2_tx_interrupt()). 
 
 ... but will that interrupt happen at all if these 3 writes never hit
 the hardware?
 

I thought the posted write WILL eventually get to adapter memory.  Not
stall forever cached in a bridge.  I'm wrong?

My point is for a given HTXD entry, we write it to post a packet for
transmission, then only free the packet memory and reuse this entry
_after_ reading the HTXD and seeing the DONE bit set.  So I still don't
see a problem.  But I've been wrong before ;-)

Steve.




-
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 v3 1/7] AMSO1100 Low Level Driver.

2006-06-23 Thread Steve Wise

 
 Also on a related note, have you checked the driver for the needed PCI
 posting flushes?
 
  +
  +   /* Disable IRQs by clearing the interrupt mask */
  +   writel(1, c2dev-regs + C2_IDIS);
  +   writel(0, c2dev-regs + C2_NIMR0);
 
 like here...

This code is followed by a call to c2_reset(), which interacts with the
firmware on the adapter to quiesce the hardware.  So I don't think we
need to wait here for the posted writes to flush...

  +
  +   elem = tx_ring-to_use;
  +   elem-skb = skb;
  +   elem-mapaddr = mapaddr;
  +   elem-maplen = maplen;
  +
  +   /* Tell HW to xmit */
  +   __raw_writeq(cpu_to_be64(mapaddr), elem-hw_desc + C2_TXP_ADDR);
  +   __raw_writew(cpu_to_be16(maplen), elem-hw_desc + C2_TXP_LEN);
  +   __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem-hw_desc + C2_TXP_FLAGS);
 
 or here
 

No need here.  This logic submits the packet for transmission.  We don't
assume it is transmitted until we (after a completion interrupt usually)
read back the HTXD entry and see the TXP_HTXD_DONE bit set (see
c2_tx_interrupt()). 


Steve.


-
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 v3 1/7] AMSO1100 Low Level Driver.

2006-06-23 Thread Arjan van de Ven

   + /* Tell HW to xmit */
   + __raw_writeq(cpu_to_be64(mapaddr), elem-hw_desc + C2_TXP_ADDR);
   + __raw_writew(cpu_to_be16(maplen), elem-hw_desc + C2_TXP_LEN);
   + __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem-hw_desc + C2_TXP_FLAGS);
  
  or here
  
 
 No need here.  This logic submits the packet for transmission.  We don't
 assume it is transmitted until we (after a completion interrupt usually)
 read back the HTXD entry and see the TXP_HTXD_DONE bit set (see
 c2_tx_interrupt()). 

... but will that interrupt happen at all if these 3 writes never hit
the hardware?


-
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 v3 1/7] AMSO1100 Low Level Driver.

2006-06-23 Thread Arjan van de Ven
On Fri, 2006-06-23 at 08:56 -0500, Steve Wise wrote:
 On Fri, 2006-06-23 at 15:48 +0200, Arjan van de Ven wrote:
 + /* Tell HW to xmit */
 + __raw_writeq(cpu_to_be64(mapaddr), elem-hw_desc + C2_TXP_ADDR);
 + __raw_writew(cpu_to_be16(maplen), elem-hw_desc + C2_TXP_LEN);
 + __raw_writew(cpu_to_be16(TXP_HTXD_READY), elem-hw_desc + 
 C2_TXP_FLAGS);

or here

   
   No need here.  This logic submits the packet for transmission.  We don't
   assume it is transmitted until we (after a completion interrupt usually)
   read back the HTXD entry and see the TXP_HTXD_DONE bit set (see
   c2_tx_interrupt()). 
  
  ... but will that interrupt happen at all if these 3 writes never hit
  the hardware?
  
 
 I thought the posted write WILL eventually get to adapter memory.  Not
 stall forever cached in a bridge.  I'm wrong?

I'm not sure there is a theoretical upper bound 

(and if it's several msec per bridge, then you have a lot of latency
anyway)

-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Luis R. Rodriguez

On 6/23/06, Jiri Benc [EMAIL PROTECTED] wrote:

On Thu, 22 Jun 2006 08:12:24 -0400, Luis R. Rodriguez wrote:
 Kernel level:

 (1) Use the new *configfs* for all user-specific attributes
 (2) Use *sysfs* read-only kobjects for device-specific attributes like
 values which can be saved for suspend() and collected for resume().
 IEEE 802.11 capabilities, features (for example radiotap), and what is
 currently settable/gettable from private ioctl realm along with its
 restrictions can also be exported via sysfs.
 (3) On resume() talk to userspace via netlink to read our sysfs and configfs 
us

We need a new hostapd-stack communication protocol. It definitely
cannot be configfs as we need asynchronous events; netlink seems to be
the best solution for this. Why should be a part of 802.11
userspace-kernel communication done by netlink and part by
configfs/sysfs?


I can see how a hostapd--stack communication should be done via
netlink. I wasn't looking for everything to be done via configfs but
just its configuration which parallels perfectly with the design goals
of configfs. I still think it would ease tuning and configuration for
userspace while being nice if used sysfs to export capabilities. A
simple tree on the sysfs tree for the wireless device would list all
the details for the device. Configf's usefulness here may become more
evident if you think in terms of tuning for radiotap -- disalbe/enable
a few bits here and there.


Second, all new network stuff is configured via netlink (or by ioctls,
but that doesn't count). Why should be 802.11 different?

I'd rather choose the way of extending current WE-netlink.


Forget about the resume() idea then, what I suggest is just the
configuration of the drivers to be done via configfs while the
driver's capabilities listed via sysfs. I think this would be useful.

 Luis
-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Luis R. Rodriguez

On 6/23/06, John W. Linville [EMAIL PROTECTED] wrote:

On Fri, Jun 23, 2006 at 07:50:47AM -0400, Dan Williams wrote:

 Our effort is probably better spent elsewhere, especially since many
 popular userspace tools already handle resume for us just fine.  More
 useful to have drivers just come back from resume in an initialized
 state similar to system boot.

I think Dan makes a lot of sense here.  Does anyone disagree?


How would we handle resume() when using WPA, for example? Dan are you
suggesting we just bring up the driver clean and expect userspace to
have handled recovery from anything we were doing? This is important.

Or should we just expect the driver to re-set all settings again and
expect wpa_supplicant to pick up well where it left off? If sysfs will
get cleared after resume then there is no point in using it, but if
its stateful after suspend then this is where I suspected
wpa_supplicant could make use of sysfs. Perhaps there is a better way
-- what I suggested was just an idea while we discussed resume/suspend
in another thread. The reason I started a new thread was I figured
configfs/sysfs could be used for other things as well.

 Luis
-
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/2] NET: Accurate packet scheduling for ATM/ADSL

2006-06-23 Thread Patrick McHardy
jamal wrote:
 On Tue, 2006-20-06 at 17:09 +0200, Patrick McHardy wrote:
 
The thing I'm not sure about is whether this wouldn't be handled better
by userspace, 
 
 
 If you do it in user space you will need a daemon of some form; this is
 my preference but it seems a lot of people hate daemons - the standard
 claim is it is counter-usability. Such people are forgiving if you built
 the daemon into the kernel as a thread. Perhaps the netcarrier that
 Stefan Rompf has added could be extended to handle this)

I absolutely disagree, in my opinion we currently have too few
specialized daemons and a lot too much wild shell scripting with
seding, awking, grepping. I'm actually working on a daemon that
provides a small scripting language to express networking configuration
states and react to result set changes and state transitions.
Its far from complete, but already allows you to express things like
on transition from { none, link flags !up } to { link flags up }
execute /etc/network/link/$LINK_NAME up (same for routes, addresses,
basically all object types) or for each link with flags lowerup,up
execute add-to-bridge.sh. The value of each expression is dumped
into the environment on execution, so you can comfortably use
$LINK_NAME or $LINK_MTU instead of having to cut it out the
ip link list output. Should be trivial to support link speed changes
once we have notifications for that.

if the link layer speed changes you might not want
proportional scaling but prefer to still give a fixed amount of that
bandwidth to some class, for example VoIP traffic. Do we have netlink
notifications for link speed changes?
 
 
 Not there at the moment - but we do emit event for other link layer
 stuff like carrier on/off - so adding this should be trivial and a
 reasonable thing to have; with a caveat: it will be link-layer specific;
 so whoever ends up adding will have to be careful to make sure it is not
 hard-coded to be specific to ethernet-like netdevices. It could probably
 be reported together with link state as a TLV like ETHER_SPEED_CHANGED
 which carries probably old speed and new speed
 and maybe even reason why it changed.

I don't think it should carry both old and new speed. Netlink
notifications usually provide a snapshot of the new state, but
no indication what changed, with one notable exception, the
ifi_change field, which IMO is a hack for lazy userspace. Since
notifications can get lost, userspace needs to resync occasionally.
The naiive approach (works for every other object) to determine if
the object state changed from my last known state is to compare
all attributes .. but the ifi_change field will be different
between notifications and dumps even if the object itself didn't
change. Lazy userspace because looking at ifi_change is obviously
only useful if it doesn't keep its last known state and tries to
derive the change from update notifications alone .. which means it
fails when notifications are lost.

-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Dan Williams
On Fri, 2006-06-23 at 10:20 -0400, Luis R. Rodriguez wrote:
 On 6/23/06, John W. Linville [EMAIL PROTECTED] wrote:
  On Fri, Jun 23, 2006 at 07:50:47AM -0400, Dan Williams wrote:
 
   Our effort is probably better spent elsewhere, especially since many
   popular userspace tools already handle resume for us just fine.  More
   useful to have drivers just come back from resume in an initialized
   state similar to system boot.
 
  I think Dan makes a lot of sense here.  Does anyone disagree?
 
 How would we handle resume() when using WPA, for example? Dan are you
 suggesting we just bring up the driver clean and expect userspace to
 have handled recovery from anything we were doing? This is important.

Well, for WPA you pretty much need a tool like wpa_supplicant to handle
connections for you, otherwise there wouldn't be a reason for
wpa_supplicant to exist.  I don't think we really want a bunch of code
in the driver to handle the reconnect cases, because this is exactly
what wpa_supplicant already does and does well.

I'm suggesting that instead of trying to stuff more logic in the drivers
to handle reconnect on resume, that the drivers just come back from
resume in the same state as system boot.  They are initialized with
default values and default state.  They allow userspace tools that
already know about policy and security to configure them, as these tools
would do right after a system boot.  We can't assume that policy and
security are exactly the same as before sleep.

 Or should we just expect the driver to re-set all settings again and
 expect wpa_supplicant to pick up well where it left off? If sysfs will
 get cleared after resume then there is no point in using it, but if
 its stateful after suspend then this is where I suspected
 wpa_supplicant could make use of sysfs. Perhaps there is a better way
 -- what I suggested was just an idea while we discussed resume/suspend
 in another thread. The reason I started a new thread was I figured
 configfs/sysfs could be used for other things as well.

I don't know that you can really pick up where it left off in many
cases.  Again, the system can be moved, access points can go away, more
networks can appear, and WPA is just more complicated than WEP.  You
simply cannot expect a driver to return to its exact pre-sleep state
when using stuff like 802.1x/WPA[12] Enterprise.  What if your session
keys expired while you were sleeping, for example?

Besides, userspace tools like NetworkManager and wpa_supplicant are just
going to overwrite the config settings the driver restores anyway, since
you need to do another scan, check results, and set the connection back
up after accounting for stuff that may have changed.  Blindly attempting
to connect with all the old settings doesn't make much sense.

It's an optimization to have the driver restore settings, and it might
make things a second or three quicker in some cases, but in many other
cases it's completely useless to do this, possibly detrimental.  I don't
see the overall benefit right now.  We've got better things to do with
drivers at the moment.

Dan


-
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/2] NET: Accurate packet scheduling for ATM/ADSL (userspace)

2006-06-23 Thread Patrick McHardy
jamal wrote:
 On Tue, 2006-20-06 at 18:51 +0200, Patrick McHardy wrote:
 
 [..]

contrary to a local link that would be best managed
in work-conserving mode. And I think for better accuracy it is
necessary to manage effective throughput, especially if you're
interested in guaranteed delays.

 
 
 Indeed - but fixing the scheduler to achieve such management is not
 the first choice (would be fine if it is generic and non-intrusive)

I have a patch that introduces sizetables similar to ratetables
and performs the mapping once and stores the calculated size in the
cb. The schedulers take the size from the cb. Its not very large and
only has minimum overhead. I got distracted during testing by
inaccuracies in the 100mbit range with small packets caused by the
clock source resolution, so I've added a ktime() clocksource and am
currently busy auditing for integer overflows caused by the increased
clock rate. I'll clean up the patch once I'm done with that and post it.

 [..]

I think that point can be used to argue in favour of that Linux should
be able to manage effective throughput :)

 
 I think you have convinced me this is valuable I even suggest probes
 above to discover goodput;-). I hope i have convinced you how rude it
 would be to make extensive changes to compensate for goodput;-

Sure :) So far I haven't been able to measure any improvement by
accounting for link layer overhead, but probably because my test
scenario was chosen badly (very small overhead, large speed) and the
differences were lost in the noise.

I am saying that #2 is the choice to go with hence my assertion earlier,
it should be fine to tell the scheduler all it has is 1Mbps and nobody
gets hurt. #1 if i could do it with minimal intrusion and still get to
use it when i have 802.11g. 

Not sure i made sense.

HFSC is actually capable of handling this quite well. If you use it
in work-conserving mode (and the card doesn't do (much) internal
queueing) it will get clocked by successful transmissions. Using
link-sharing classes you can define proportions for use of available
bandwidth, possibly with upper limits. No hacks required :)

 
 
 HFSC sounds very interesting - I should go and study it a little more.
 My understanding is though that it is a bit of a CPU pig, true?

It does more calculations at runtime than token-bucket based schedulers,
but it does perform comparable to HTB with a large number of classes,
in which case the constant overhead is probably not visible anymore
because much more time is spent searching, walking lists and trees and
so on. I didn't do any comparisons of constant costs.

Anyway, this again goes more in the direction of handling link speed
changes.

 
 
 The more we discuss this, the more i think they are the same thing ;-

Not really. Link speed changes can be expressed by constant factors
that apply to bandwidth and delay (bandwidth *= f, delay /= f). Link
layer overhead usually can't be expressed this way.

ip dev add compensate_header 100 bytes

[...]

Unforunately I can't think of a way to handle the ATM case without
a division .. or iteration.

 
 I am not thinking straight right now but it does not sound like a big
 change to me i.e within reason.

I also got rid of the division ..

 Note, it may be valuable to think of
 this as related to the speed changing daemon as i stated earlier.
 Only in this case it is static discovery of link layer
 goodput/throughput vs some other way to dynamically discover things. 

I still think these are two quite different things. Link speed
changes also can't be handled very well by scaling packet sizes
since TBF-based qdiscs have configured maxima for the packet sizes
they can handle.

-
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] sysfs + configfs on 802.11 wireless drivers

2006-06-23 Thread Johannes Berg
On Fri, 2006-06-23 at 13:52 +0200, Jiri Benc wrote:

 I'd rather choose the way of extending current WE-netlink.

Nah, let's rewrite the blob of magic. Well, at least that's how I see it
right now ;)

johannes


signature.asc
Description: This is a digitally signed message part


Re: [PATCH 0/2] NET: Accurate packet scheduling for ATM/ADSL

2006-06-23 Thread Patrick McHardy
Russell Stuart wrote:
 On Thu, 2006-06-22 at 14:29 -0400, jamal wrote: 
 

 On Tue, 2006-06-20 at 03:04 +0200, Patrick McHardy wrote: 
 
What about qdiscs like SFQ (which uses the packet size in quantum
calculations)? I guess it would make sense to use the wire-length
there as well.
 
 
 Being pedantic, SQF automatically assigns traffic to classes 
 and gives each class an equal share of the available bandwidth.  
 As I am sure you are aware SQF's trick is that it randomly 
 changes its classification algorithm - every second in the Linux 
 implementation.  If there are errors in rate calculation this 
 randomisation will ensure they are distributed equally between 
 the classes as time goes on.  So no, accurate packets sizes are 
 not that important to SQF.
 
 But they are important to many other qdiscs, and I am sure 
 that was your point.  SQF just happened to be a bad example.

Not really. The randomization doesn't happen by default, but it doesn't
influence this anyway. SFQ allows flows to send up to quantum bytes
at a time before moving on to the next one. A flow that sends 75 * 20
byte will in the eyes of SFQ use 1500bytes, on the (ethernet) wire it
needs 4800bytes. A flow that sents 1500byte packets will only need
1504 bytes on the wire, but will be treated equally. So it does make
a different for SFQ.

 On Tue, 2006-06-20 at 16:45 +0200, Patrick McHardy wrote: 
 
Handling all qdiscs would mean adding a pointer to a mapping table
to struct net_device and using something like skb_wire_len(skb, dev)
instead of skb-len in the queueing layer. That of course doesn't
mean that we can't still provide pre-adjusted ratetables for qdiscs
that use them.
 
 
 Yes, that would work well, and is probably how it should of
 been done when the kernel stuff was originally written.  As 
 it happens Jesper's original solution was closer to this.  The 
 reason we choose not to go that way it is would change the 
 kernel-userspace API.   The current patch solves the problem 
 and works well as possible on all kernel versions - both 
 patched and unpatched.

Not a problem as long as the new stuff doesn't break anything existing.
My patch introduces a TCA_STAB (for size table), similar to the _RTAB
attributes. Old iproute with new kernel and new iproute with old kernel
both work fine.

 Now that I think about to change things the way you suggest
 here does seem simple enough.  But it probably belongs in a 
 different patch.  We wrote this patch to fix a specific problem 
 with ATM links, and it should succeed or fail on the merits 
 of doing that.  Cleaning up the kernel code to do what you 
 suggest is a different issue.  Let whether it to should be 
 done, or not, be based on its own merits.

Its not about cleanup, its about providing the same capabilities
to all qdiscs instead of just a few selected ones and generalizing
it so it is also usable for non-ATM overhead calculations.
-
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


ixgb EEH/PCI errors on reset

2006-06-23 Thread Linas Vepstas


Hi,

I've got another ixgb driver bug I'm struggling with; clues or hints
appreciated.

I've got a patch for PCI error recovery for the ixgb, which works on 
many older kernels but seems to be broken on linux-2.6.17-rc6-mm2
(which is ixgb version 1.0.109).  After performing a PCI reset on the 
card, I try to re-initialize the cad and the driver, with the following
sequence:

   pci_set_master(pdev);
   netif_carrier_off(netdev);
   netif_stop_queue(netdev);
   ixgb_check_options(adapter);
   ixgb_reset(adapter);

This is only a subset of the ixgb_probe code, since I don't need to 
request regions or do any of the other setup.  However, this code 
fails in an unexpected way.  The last call invokes ixgb_mac_reset()
which writes a reset bit, delays a few millisecs, and reads the reset
bit.  The problem I'm seeing is that the read 

  ctrl_reg = IXGB_READ_REG(hw, CTRL0);

triggers some PCI bus error that off-lines the device. Any hints
about where to look? This doesn't occur on other driver versions,
and doesn't occur on this driver during the ordinary probe() sequence.
Increasing the dealy doesn't seem to help. 

--linas


-
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


Kernel Janitor TODO: dev_kfree_skb

2006-06-23 Thread John Daiker
I was running through the kernel janitors TODO list 
(http://janitor.kernelnewbies.org/TODO) and thought I'd try to find 
something easy for my first attempt at kernel hacking/maintenance.


The Balancing Function header suggests that all net_device interrupt 
functions should use dev_kfree_skb_irq as opposed to dev_kfree_skb.
Should we ever be calling dev_kfree_skb directly, or would the better 
practice be to always call dev_kfree_skb_any (thus letting the kernel 
decide to call dev_kfree_skb or dev_kfree_skb_irq)?


dev_kfree_skb_any is defined in 'net/core/dev.c:1118'

John Daiker
-
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


[IPROUTE 05/05]: Add sprint_ticks() function and use in CBQ

2006-06-23 Thread Patrick McHardy
[IPROUTE]: Add sprint_ticks() function and use in CBQ

Add helper function to print ticks to avoid assumptions about clock
resolution in CBQ.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit 182666ac89f3089a1771564620998fb4f315bd87
tree ce7c3109b7e8ff9a4665e175490a62f8c300ea33
parent 67edfb2c86323a1c52a60538f677310f6c75efdf
author Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:52:11 +0200
committer Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:52:11 +0200

 tc/q_cbq.c   |7 ---
 tc/q_netem.c |6 --
 tc/tc_util.c |5 +
 tc/tc_util.h |1 +
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index 648acd0..abf0468 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -418,6 +418,7 @@ static int cbq_print_opt(struct qdisc_ut
struct tc_cbq_wrropt *wrr = NULL;
struct tc_cbq_fopt *fopt = NULL;
struct tc_cbq_ovl *ovl = NULL;
+   SPRINT_BUF(b1);
 
if (opt == NULL)
return 0;
@@ -500,17 +501,17 @@ static int cbq_print_opt(struct qdisc_ut
if (lss  show_details) {
fprintf(f, \nlevel %u ewma %u avpkt %ub , lss-level, 
lss-ewma_log, lss-avpkt);
if (lss-maxidle) {
-   fprintf(f, maxidle %luus , 
tc_core_tick2time(lss-maxidlelss-ewma_log));
+   fprintf(f, maxidle %s , 
sprint_ticks(lss-maxidlelss-ewma_log, b1));
if (show_raw)
fprintf(f, [%08x] , lss-maxidle);
}
if (lss-minidle!=0x7fff) {
-   fprintf(f, minidle %luus , 
tc_core_tick2time(lss-minidlelss-ewma_log));
+   fprintf(f, minidle %s , 
sprint_ticks(lss-minidlelss-ewma_log, b1));
if (show_raw)
fprintf(f, [%08x] , lss-minidle);
}
if (lss-offtime) {
-   fprintf(f, offtime %luus , 
tc_core_tick2time(lss-offtime));
+   fprintf(f, offtime %s , sprint_ticks(lss-offtime, 
b1));
if (show_raw)
fprintf(f, [%08x] , lss-offtime);
}
diff --git a/tc/q_netem.c b/tc/q_netem.c
index cc16a28..0d7f4d5 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -115,12 +115,6 @@ static int get_ticks(__u32 *ticks, const
return 0;
 }
 
-static char *sprint_ticks(__u32 ticks, char *buf)
-{
-   return sprint_time(tc_core_tick2time(ticks), buf);
-}
-
-
 static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv, 
   struct nlmsghdr *n)
 {
diff --git a/tc/tc_util.c b/tc/tc_util.c
index 321bac0..c1e02f4 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -255,6 +255,11 @@ char * sprint_time(__u32 time, char *buf
return buf;
 }
 
+char * sprint_ticks(__u32 ticks, char *buf)
+{
+   return sprint_time(tc_core_tick2time(ticks), buf);
+}
+
 int get_size(unsigned *size, const char *str)
 {
double sz;
diff --git a/tc/tc_util.h b/tc/tc_util.h
index aba4adb..17e7b99 100644
--- a/tc/tc_util.h
+++ b/tc/tc_util.h
@@ -57,6 +57,7 @@ extern char * sprint_size(__u32 size, ch
 extern char * sprint_qdisc_handle(__u32 h, char *buf);
 extern char * sprint_tc_classid(__u32 h, char *buf);
 extern char * sprint_time(__u32 time, char *buf);
+extern char * sprint_ticks(__u32 ticks, char *buf);
 extern char * sprint_percent(__u32 percent, char *buf);
 
 extern void print_tcstats_attr(FILE *fp, struct rtattr *tb[], char *prefix, 
struct rtattr **xstats);
-
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


[IPROUTE 04/05]: Replace usec by time in function names

2006-06-23 Thread Patrick McHardy
[IPROUTE]: Replace usec by time in function names

Rename functions containing usec since they don't necessarily return
usec units anymore.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit 67edfb2c86323a1c52a60538f677310f6c75efdf
tree 37302dfd036340aac8c7f2070ebcbc570fd634ed
parent 8e2cc14ba6fb8f940de72f307e67eb9040a5d4f7
author Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:47:14 +0200
committer Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:47:14 +0200

 tc/m_estimator.c |4 ++--
 tc/q_cbq.c   |6 +++---
 tc/q_hfsc.c  |6 +++---
 tc/q_netem.c |6 +++---
 tc/q_tbf.c   |8 
 tc/tc_cbq.c  |4 ++--
 tc/tc_core.c |   10 +-
 tc/tc_core.h |4 ++--
 tc/tc_util.c |   14 +++---
 tc/tc_util.h |6 +++---
 10 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/tc/m_estimator.c b/tc/m_estimator.c
index 78eda7a..898ff80 100644
--- a/tc/m_estimator.c
+++ b/tc/m_estimator.c
@@ -45,12 +45,12 @@ int parse_estimator(int *p_argc, char **
duparg(estimator, *argv);
if (matches(*argv, help) == 0)
est_help();
-   if (get_usecs(A, *argv))
+   if (get_time(A, *argv))
invarg(estimator, invalid estimator interval);
NEXT_ARG();
if (matches(*argv, help) == 0)
est_help();
-   if (get_usecs(time_const, *argv))
+   if (get_time(time_const, *argv))
invarg(estimator, invalid estimator time constant);
if (tc_setup_estimator(A, time_const, est)  0) {
fprintf(stderr, Error: estimator parameters are out of 
range.\n);
diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index 045c377..648acd0 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -500,17 +500,17 @@ static int cbq_print_opt(struct qdisc_ut
if (lss  show_details) {
fprintf(f, \nlevel %u ewma %u avpkt %ub , lss-level, 
lss-ewma_log, lss-avpkt);
if (lss-maxidle) {
-   fprintf(f, maxidle %luus , 
tc_core_tick2usec(lss-maxidlelss-ewma_log));
+   fprintf(f, maxidle %luus , 
tc_core_tick2time(lss-maxidlelss-ewma_log));
if (show_raw)
fprintf(f, [%08x] , lss-maxidle);
}
if (lss-minidle!=0x7fff) {
-   fprintf(f, minidle %luus , 
tc_core_tick2usec(lss-minidlelss-ewma_log));
+   fprintf(f, minidle %luus , 
tc_core_tick2time(lss-minidlelss-ewma_log));
if (show_raw)
fprintf(f, [%08x] , lss-minidle);
}
if (lss-offtime) {
-   fprintf(f, offtime %luus , 
tc_core_tick2usec(lss-offtime));
+   fprintf(f, offtime %luus , 
tc_core_tick2time(lss-offtime));
if (show_raw)
fprintf(f, [%08x] , lss-offtime);
}
diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c
index be0587f..6c160c9 100644
--- a/tc/q_hfsc.c
+++ b/tc/q_hfsc.c
@@ -226,7 +226,7 @@ hfsc_print_sc(FILE *f, char *name, struc
 
fprintf(f, %s , name);
fprintf(f, m1 %s , sprint_rate(sc-m1, b1));
-   fprintf(f, d %s , sprint_usecs(tc_core_ktime2time(sc-d), b1));
+   fprintf(f, d %s , sprint_time(tc_core_ktime2time(sc-d), b1));
fprintf(f, m2 %s , sprint_rate(sc-m2, b1));
 }
 
@@ -303,7 +303,7 @@ hfsc_get_sc1(int *argcp, char ***argvp, 
 
if (matches(*argv, d) == 0) {
NEXT_ARG();
-   if (get_usecs(d, *argv)  0) {
+   if (get_time(d, *argv)  0) {
explain1(d);
return -1;
}
@@ -346,7 +346,7 @@ hfsc_get_sc2(int *argcp, char ***argvp, 
 
if (matches(*argv, dmax) == 0) {
NEXT_ARG();
-   if (get_usecs(dmax, *argv)  0) {
+   if (get_time(dmax, *argv)  0) {
explain1(dmax);
return -1;
}
diff --git a/tc/q_netem.c b/tc/q_netem.c
index 757edca..cc16a28 100644
--- a/tc/q_netem.c
+++ b/tc/q_netem.c
@@ -108,16 +108,16 @@ static int get_ticks(__u32 *ticks, const
 {
unsigned t;
 
-   if(get_usecs(t, str))
+   if(get_time(t, str))
return -1;

-   *ticks = tc_core_usec2tick(t);
+   *ticks = tc_core_time2tick(t);
return 0;
 }
 
 static char *sprint_ticks(__u32 ticks, char *buf)
 {
-   return sprint_usecs(tc_core_tick2usec(ticks), buf);
+   return sprint_time(tc_core_tick2time(ticks), buf);
 }
 
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index f2ffb7e..4db4b44 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -67,7 +67,7 @@ static int tbf_parse_opt(struct qdisc_ut
fprintf(stderr, Double \limit/latency\ 
spec\n);
return -1;
}
-   if 

[RFC IPROUTE 00/05]: Time cleanups

2006-06-23 Thread Patrick McHardy
I'm currently adding support for ktime as clocksource to the qdisc layer and
in the course of doing that cleaned up the iproute time handling a bit to
make it easier to use a different internal clock resultion and audit for
integer overflows.

Increasing iproutes internal clock resolution is necessary for all token bucket
based schedulers to take advantage of a higher kernel clock resolution because
the kernel only does lookups and additions/subtractions, which can never result
in values that have a higher precision that those passed from userspace.

The way I imagine it we have to keep the old clock sources around for userspace
compatibility since they can't deal with the higher precision values. iproute is
changed to use nsec internally and reads the kernel clock resulution from
/proc/net/psched (third value, currently assumed to always be 10^6) to convert
it's internal resolution to that of the kernel. With ktime as clocksource the
kernel will report a resulution of 10^9. The downside is that distributors can't
enable ktime unless they want to break compatibility with old iproute versions.
Any better suggestions are welcome of course.


 tc/m_estimator.c  |4 ++--
 tc/m_police.c |2 +-
 tc/q_cbq.c|   15 ---
 tc/q_hfsc.c   |   18 +-
 tc/q_htb.c|4 ++--
 tc/q_netem.c  |   12 +++-
 tc/q_tbf.c|   20 ++--
 tc/tc_cbq.c   |8 
 tc/tc_core.c  |   31 +++
 tc/tc_core.h  |9 +++--
 tc/tc_estimator.c |2 +-
 tc/tc_red.c   |2 +-
 tc/tc_util.c  |   33 +++--
 tc/tc_util.h  |7 ---
 14 files changed, 94 insertions(+), 73 deletions(-)

Patrick McHardy:
  [IPROUTE]: Use tc_calc_xmittime where appropriate
  [IPROUTE]: Introduce tc_calc_xmitsize and use where appropriate
  [IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock 
resulution
  [IPROUTE]: Replace usec by time in function names
  [IPROUTE]: Add sprint_ticks() function and use in CBQ
-
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


[IPROUTE 03/05]: Introduce TIME_UNITS_PER_SEC to represent internal clock resulution

2006-06-23 Thread Patrick McHardy
[IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock resulution

Introduce TIME_UNITS_PER_SEC and conversion functions between internal
resulution and resulution expected by the kernel (currently implemented as
NOPs, only needed by HFSC, which currently always uses microseconds).

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit 8e2cc14ba6fb8f940de72f307e67eb9040a5d4f7
tree da8e068525029b6571f95e7eeffcbab901f2e1be
parent 06a5350c47d028448850788031625ac1961d722b
author Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:40:34 +0200
committer Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:40:34 +0200

 tc/q_hfsc.c   |   12 ++--
 tc/q_tbf.c|4 ++--
 tc/tc_cbq.c   |4 ++--
 tc/tc_core.c  |   14 --
 tc/tc_core.h  |4 
 tc/tc_estimator.c |2 +-
 tc/tc_util.c  |   14 +++---
 7 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/tc/q_hfsc.c b/tc/q_hfsc.c
index f09c606..be0587f 100644
--- a/tc/q_hfsc.c
+++ b/tc/q_hfsc.c
@@ -226,7 +226,7 @@ hfsc_print_sc(FILE *f, char *name, struc
 
fprintf(f, %s , name);
fprintf(f, m1 %s , sprint_rate(sc-m1, b1));
-   fprintf(f, d %s , sprint_usecs(sc-d, b1));
+   fprintf(f, d %s , sprint_usecs(tc_core_ktime2time(sc-d), b1));
fprintf(f, m2 %s , sprint_rate(sc-m2, b1));
 }
 
@@ -320,7 +320,7 @@ hfsc_get_sc1(int *argcp, char ***argvp, 
return -1;
 
sc-m1 = m1;
-   sc-d  = d;
+   sc-d  = tc_core_time2ktime(d);
sc-m2 = m2;
 
*argvp = argv;
@@ -367,13 +367,13 @@ hfsc_get_sc2(int *argcp, char ***argvp, 
return -1;
}
 
-   if (dmax != 0  ceil(umax * 100.0 / dmax)  rate) {
+   if (dmax != 0  ceil(1.0 * umax * TIME_UNITS_PER_SEC / dmax)  rate) {
/*
 * concave curve, slope of first segment is umax/dmax,
 * intersection is at dmax
 */
-   sc-m1 = ceil(umax * 100.0 / dmax); /* in bps */
-   sc-d  = dmax;
+   sc-m1 = ceil(1.0 * umax * TIME_UNITS_PER_SEC / dmax); /* in 
bps */
+   sc-d  = tc_core_time2ktime(dmax);
sc-m2 = rate;
} else {
/*
@@ -381,7 +381,7 @@ hfsc_get_sc2(int *argcp, char ***argvp, 
 * is at dmax - umax / rate
 */
sc-m1 = 0;
-   sc-d  = ceil(dmax - umax * 100.0 / rate); /* in usec */
+   sc-d  = tc_core_time2ktime(ceil(dmax - umax * 
TIME_UNITS_PER_SEC / rate));
sc-m2 = rate;
}
 
diff --git a/tc/q_tbf.c b/tc/q_tbf.c
index bb13d77..f2ffb7e 100644
--- a/tc/q_tbf.c
+++ b/tc/q_tbf.c
@@ -161,9 +161,9 @@ static int tbf_parse_opt(struct qdisc_ut
}
 
if (opt.limit == 0) {
-   double lim = opt.rate.rate*(double)latency/100 + buffer;
+   double lim = opt.rate.rate*(double)latency/TIME_UNITS_PER_SEC + 
buffer;
if (opt.peakrate.rate) {
-   double lim2 = opt.peakrate.rate*(double)latency/100 
+ mtu;
+   double lim2 = 
opt.peakrate.rate*(double)latency/TIME_UNITS_PER_SEC + mtu;
if (lim2  lim)
lim = lim2;
}
diff --git a/tc/tc_cbq.c b/tc/tc_cbq.c
index 0abcc9d..c7b3a2d 100644
--- a/tc/tc_cbq.c
+++ b/tc/tc_cbq.c
@@ -38,7 +38,7 @@ unsigned tc_cbq_calc_maxidle(unsigned bn
if (vxmt  maxidle)
maxidle = vxmt;
}
-   return tc_core_usec2tick(maxidle*(1ewma_log)*100);
+   return tc_core_usec2tick(maxidle*(1ewma_log)*TIME_UNITS_PER_SEC);
 }
 
 unsigned tc_cbq_calc_offtime(unsigned bndw, unsigned rate, unsigned avpkt,
@@ -53,5 +53,5 @@ unsigned tc_cbq_calc_offtime(unsigned bn
offtime *= pow(g, -(double)minburst) - 1;
else
offtime *= 1 + (pow(g, -(double)(minburst-1)) - 1)/(1-g);
-   return tc_core_usec2tick(offtime*100);
+   return tc_core_usec2tick(offtime*TIME_UNITS_PER_SEC);
 }
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 7d6dd7d..cf49d83 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -37,14 +37,24 @@ long tc_core_tick2usec(long tick)
return tick/tick_in_usec;
 }
 
+long tc_core_time2ktime(long time)
+{
+   return time;
+}
+
+long tc_core_ktime2time(long ktime)
+{
+   return ktime;
+}
+
 unsigned tc_calc_xmittime(unsigned rate, unsigned size)
 {
-   return tc_core_usec2tick(100*((double)size/rate));
+   return tc_core_usec2tick(TIME_UNITS_PER_SEC*((double)size/rate));
 }
 
 unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks)
 {
-   return ((double)rate*tc_core_tick2usec(ticks))/100;
+   return ((double)rate*tc_core_tick2usec(ticks))/TIME_UNITS_PER_SEC;
 }
 
 /*
diff --git a/tc/tc_core.h b/tc/tc_core.h
index d97c011..720b6d6 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -4,8 +4,12 @@ 

Re: [RFC IPROUTE 00/05]: Time cleanups

2006-06-23 Thread Patrick McHardy
D'oh, got Stephen's address wrong. Please fix it (add 's' in front) in
replies to this thread.

Patrick McHardy wrote:
 I'm currently adding support for ktime as clocksource to the qdisc layer and
 in the course of doing that cleaned up the iproute time handling a bit to
 make it easier to use a different internal clock resultion and audit for
 integer overflows.
 
 Increasing iproutes internal clock resolution is necessary for all token 
 bucket
 based schedulers to take advantage of a higher kernel clock resolution because
 the kernel only does lookups and additions/subtractions, which can never 
 result
 in values that have a higher precision that those passed from userspace.
 
 The way I imagine it we have to keep the old clock sources around for 
 userspace
 compatibility since they can't deal with the higher precision values. iproute 
 is
 changed to use nsec internally and reads the kernel clock resulution from
 /proc/net/psched (third value, currently assumed to always be 10^6) to convert
 it's internal resolution to that of the kernel. With ktime as clocksource the
 kernel will report a resulution of 10^9. The downside is that distributors 
 can't
 enable ktime unless they want to break compatibility with old iproute 
 versions.
 Any better suggestions are welcome of course.
 
 
  tc/m_estimator.c  |4 ++--
  tc/m_police.c |2 +-
  tc/q_cbq.c|   15 ---
  tc/q_hfsc.c   |   18 +-
  tc/q_htb.c|4 ++--
  tc/q_netem.c  |   12 +++-
  tc/q_tbf.c|   20 ++--
  tc/tc_cbq.c   |8 
  tc/tc_core.c  |   31 +++
  tc/tc_core.h  |9 +++--
  tc/tc_estimator.c |2 +-
  tc/tc_red.c   |2 +-
  tc/tc_util.c  |   33 +++--
  tc/tc_util.h  |7 ---
  14 files changed, 94 insertions(+), 73 deletions(-)
 
 Patrick McHardy:
   [IPROUTE]: Use tc_calc_xmittime where appropriate
   [IPROUTE]: Introduce tc_calc_xmitsize and use where appropriate
   [IPROUTE]: Introduce TIME_UNITS_PER_SEC to represent internal clock 
 resulution
   [IPROUTE]: Replace usec by time in function names
   [IPROUTE]: Add sprint_ticks() function and use in CBQ
-
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/3] bcm43xx-d80211: use host_gen_beacon_template

2006-06-23 Thread Jiri Benc
Use new host_gen_beacon_template flag. This also means workaround with
iwconfig essid after hostapd is run is not necessary anymore.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |   36 ++---
 1 files changed, 11 insertions(+), 25 deletions(-)

--- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -1710,17 +1710,12 @@ static void bcm43xx_write_probe_resp_tem
kfree(probe_resp_data);
 }
 
-static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm)
+static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm,
+struct sk_buff *beacon)
 {
-   struct ieee80211_tx_control control;
-
if (bcm-cached_beacon)
kfree_skb(bcm-cached_beacon);
-   bcm-cached_beacon = ieee80211_beacon_get(bcm-net_dev,
- bcm-interface.if_id,
- control);
-   if (unlikely(!bcm-cached_beacon))
-   return -ENOMEM;
+   bcm-cached_beacon = beacon;
 
return 0;
 }
@@ -1743,16 +1738,15 @@ static void bcm43xx_update_templates(str
bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, status);
 }
 
-static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm)
+static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm,
+ struct sk_buff *beacon)
 {
int err;
 
-   err = bcm43xx_refresh_cached_beacon(bcm);
+   err = bcm43xx_refresh_cached_beacon(bcm, beacon);
if (unlikely(err))
return;
bcm43xx_update_templates(bcm);
-   kfree_skb(bcm-cached_beacon);
-   bcm-cached_beacon = NULL;
 }
 
 static void bcm43xx_set_ssid(struct bcm43xx_private *bcm,
@@ -1792,19 +1786,11 @@ static void bcm43xx_set_beacon_int(struc
 static void handle_irq_beacon(struct bcm43xx_private *bcm)
 {
u32 status;
-   int err;
 
bcm-irq_savedstate = ~BCM43xx_IRQ_BEACON;
status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD);
 
-   if (!bcm-cached_beacon) {
-   err = bcm43xx_refresh_cached_beacon(bcm);
-   if (unlikely(err))
-   goto ack;
-   }
-
-   if ((status  0x1)  (status  0x2)) {
-ack:
+   if (!bcm-cached_beacon || ((status  0x1)  (status  0x2))) {
/* ACK beacon IRQ. */
bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON,
BCM43xx_IRQ_BEACON);
@@ -4382,7 +4368,6 @@ static int bcm43xx_net_config(struct net
 
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
bcm43xx_set_beacon_int(bcm, conf-beacon_int);
-   bcm43xx_refresh_templates(bcm);
}
 
bcm43xx_unlock_irqonly(bcm, flags);
@@ -4553,7 +4538,7 @@ static int bcm43xx_add_interface(struct 
if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
bcm43xx_select_opmode(bcm);
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP))
-   bcm43xx_refresh_templates(bcm);
+   bcm43xx_refresh_templates(bcm, NULL);
}
err = 0;
 
@@ -4606,7 +4591,8 @@ static int bcm43xx_config_interface(stru
if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
assert(conf-type == IEEE80211_IF_TYPE_AP);
bcm43xx_set_ssid(bcm, conf-ssid, conf-ssid_len);
-   bcm43xx_refresh_templates(bcm);
+   if (conf-beacon)
+   bcm43xx_refresh_templates(bcm, conf-beacon);
}
}
bcm43xx_unlock_irqsafe(bcm, flags);
@@ -4701,7 +4687,7 @@ static int __devinit bcm43xx_init_one(st
goto out;
ieee-version = IEEE80211_VERSION;
ieee-name = KBUILD_MODNAME;
-   ieee-host_gen_beacon = 1;
+   ieee-host_gen_beacon_template = 1;
ieee-rx_includes_fcs = 1;
ieee-monitor_during_oper = 1;
ieee-tx = bcm43xx_net_hard_start_xmit;
-
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/3] d80211: do not receive through master interface

2006-06-23 Thread Jiri Benc
Arrived packets should not go into master interface - it leads to duplicate
packets reception.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---
 net/d80211/ieee80211.c |4 
 1 files changed, 4 insertions(+)

--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -3586,6 +3586,10 @@ void __ieee80211_rx(struct net_device *d
   !ieee80211_bssid_match(bssid,
sdata-dev-dev_addr))
continue;
+   if (sdata-dev == sdata-master)
+   /* do not receive anything via
+* master device */
+   continue;
break;
case IEEE80211_IF_TYPE_WDS:
if (bssid ||
-
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/3] d80211: AP mode fixes

2006-06-23 Thread Jiri Benc
This a series of experimental AP mode fixes.

It is also available (together with patches for bcm43xx AP mode support) in
a 'devel' branch of my dscape tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/jbenc/dscape.git devel

-- 
Jiri Benc
SUSE Labs
-
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/3] d80211: host_gen_beacon_template flag

2006-06-23 Thread Jiri Benc
This is a partial support for devices requiring beacon template. Please note
that there is no support for PS mode for such cards yet.

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---
 include/net/d80211.h |6 ++
 net/d80211/ieee80211.c   |   22 +-
 net/d80211/ieee80211_i.h |1 +
 net/d80211/ieee80211_ioctl.c |2 +-
 4 files changed, 29 insertions(+), 2 deletions(-)

--- dscape.orig/include/net/d80211.h
+++ dscape/include/net/d80211.h
@@ -349,6 +349,9 @@ struct ieee80211_if_init_conf {
  * only during config_interface() callback (so copy the value somewhere
  * if you need it).
  * @generic_elem_len: length of the generic element.
+ * @beacon: beacon template. Valid only if @host_gen_beacon_template in
+ * struct ieee80211_hw is set. The driver is responsible of freeing
+ * the sk_buff.
  *
  * This structure is passed to config_interface() callback of
  * struct ieee80211_hw.
@@ -360,6 +363,7 @@ struct ieee80211_if_conf {
size_t ssid_len;
u8 *generic_elem;
size_t generic_elem_len;
+   struct sk_buff *beacon;
 };
 
 typedef enum { ALG_NONE, ALG_WEP, ALG_TKIP, ALG_CCMP, ALG_NULL }
@@ -439,6 +443,8 @@ struct ieee80211_hw {
 * beacon frame. */
int host_gen_beacon:1;
 
+   /* The device needs to be supplied with a beacon template only. */
+   int host_gen_beacon_template:1;
 
/* Some devices handle decryption internally and do not
 * indicate whether the frame was encrypted (unencrypted frames
--- dscape.orig/net/d80211/ieee80211.c
+++ dscape/net/d80211/ieee80211.c
@@ -1902,7 +1902,8 @@ ieee80211_get_buffered_bc(struct net_dev
return skb;
 }
 
-int ieee80211_if_config(struct net_device *dev)
+static int __ieee80211_if_config(struct net_device *dev,
+struct sk_buff *beacon)
 {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = dev-ieee80211_ptr;
@@ -1925,10 +1926,29 @@ int ieee80211_if_config(struct net_devic
conf.ssid_len = sdata-u.ap.ssid_len;
conf.generic_elem = sdata-u.ap.generic_elem;
conf.generic_elem_len = sdata-u.ap.generic_elem_len;
+   conf.beacon = beacon;
}
return local-hw-config_interface(local-mdev, dev-ifindex, conf);
 }
 
+int ieee80211_if_config(struct net_device *dev)
+{
+   return __ieee80211_if_config(dev, NULL);
+}
+
+int ieee80211_if_config_beacon(struct net_device *dev)
+{
+   struct ieee80211_local *local = dev-ieee80211_ptr;
+   struct sk_buff *skb;
+
+   if (!local-hw-host_gen_beacon_template)
+   return 0;
+   skb = ieee80211_beacon_get(local-mdev, dev-ifindex, NULL);
+   if (!skb)
+   return -ENOMEM;
+   return __ieee80211_if_config(dev, skb);
+}
+
 int ieee80211_hw_config(struct net_device *dev)
 {
struct ieee80211_local *local = dev-ieee80211_ptr;
--- dscape.orig/net/d80211/ieee80211_i.h
+++ dscape/net/d80211/ieee80211_i.h
@@ -545,6 +545,7 @@ struct sta_attribute {
 void ieee80211_release_hw(struct ieee80211_local *local);
 int ieee80211_hw_config(struct net_device *dev);
 int ieee80211_if_config(struct net_device *dev);
+int ieee80211_if_config_beacon(struct net_device *dev);
 struct ieee80211_key_conf *
 ieee80211_key_data2conf(struct ieee80211_local *local,
struct ieee80211_key *data);
--- dscape.orig/net/d80211/ieee80211_ioctl.c
+++ dscape/net/d80211/ieee80211_ioctl.c
@@ -110,7 +110,7 @@ static int ieee80211_ioctl_set_beacon(st
}
}
 
-   return 0;
+   return ieee80211_if_config_beacon(dev);
 }
 
 
-
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]: e1000: Janitor: Use #defined values for literals

2006-06-23 Thread Auke Kok

Linas Vepstas wrote:

Minor janitorial patch: use #defines for literal values.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]


Ack! I thought we had gotten these out already.

Cheers,

Auke






 drivers/net/e1000/e1000_main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6.17-rc6-mm2/drivers/net/e1000/e1000_main.c
===
--- linux-2.6.17-rc6-mm2.orig/drivers/net/e1000/e1000_main.c2006-06-13 
18:13:30.0 -0500
+++ linux-2.6.17-rc6-mm2/drivers/net/e1000/e1000_main.c 2006-06-23 
11:27:47.0 -0500
@@ -4663,8 +4663,8 @@ static pci_ers_result_t e1000_io_slot_re
}
pci_set_master(pdev);
 
-	pci_enable_wake(pdev, 3, 0);

-   pci_enable_wake(pdev, 4, 0); /* 4 == D3 cold */
+   pci_enable_wake(pdev, PCI_D3hot, 0);
+   pci_enable_wake(pdev, PCI_D3cold, 0);
 
 	/* Perform card reset only on one instance of the card */

if (PCI_FUNC (pdev-devfn) != 0)
-
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

-
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


hostapd patch for d80211

2006-06-23 Thread Jiri Benc
On Mon, 19 Jun 2006 11:07:34 +0200, Michael Buesch wrote:
 Important notes from Alexander Tsvyashchenko's initial mail follow:
 [...]
 Although my previous patch to hostapd to make it interoperable with
 bcm43xx  dscape has been merged already in their CVS version, due to
 the subsequent changes in dscape stack current hostapd is again
 incompartible :-(

This patch allows devicescape driver in hostapd to work with recent d80211.
No manipulation with network interfaces is needed anymore - hostapd even
switches the interface to AP mode automatically now. Just modprobe
bcm43xx-d80211, run hostapd and enjoy :-)

Signed-off-by: Jiri Benc [EMAIL PROTECTED]

---

 driver_devicescape.c |   77 ++-
 1 files changed, 64 insertions(+), 13 deletions(-)

--- hostapd-0.5-2006-06-19.orig/driver_devicescape.c
+++ hostapd-0.5-2006-06-19/driver_devicescape.c
@@ -73,6 +73,7 @@ struct i802_driver_data {
 
char iface[IFNAMSIZ + 1];
char mgmt_iface[IFNAMSIZ + 1];
+   int mgmt_ifindex;
int sock; /* raw packet socket for driver access */
int ioctl_sock; /* socket for ioctl() use */
int wext_sock; /* socket for wireless events */
@@ -88,6 +89,21 @@ static const struct driver_ops devicesca
 static int i802_sta_set_flags(void *priv, const u8 *addr,
  int flags_or, int flags_and);
 
+static int i802_set_ap_mode(struct i802_driver_data *drv)
+{
+   struct iwreq iwr;
+
+   memset(iwr, 0, sizeof(iwr));
+   strncpy(iwr.ifr_name, drv-iface, IFNAMSIZ);
+   iwr.u.mode = IW_MODE_MASTER;
+
+   if (ioctl(drv-ioctl_sock, SIOCSIWMODE, iwr)  0) {
+   perror(ioctl[SIOCSIWMODE]);
+   return -1;
+   }
+
+   return 0;
+}
 
 static int hostapd_set_iface_flags(struct i802_driver_data *drv, int dev_up)
 {
@@ -96,13 +112,16 @@ static int hostapd_set_iface_flags(struc
if (drv-ioctl_sock  0)
return -1;
 
+   if (dev_up)
+   i802_set_ap_mode(drv);
+
memset(ifr, 0, sizeof(ifr));
-   snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-mgmt_iface);
+   snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-iface);
 
if (ioctl(drv-ioctl_sock, SIOCGIFFLAGS, ifr) != 0) {
perror(ioctl[SIOCGIFFLAGS]);
wpa_printf(MSG_DEBUG, Could not read interface flags (%s),
-  drv-mgmt_iface);
+  drv-iface);
return -1;
}
 
@@ -303,7 +322,35 @@ static int hostap_ioctl_prism2param(stru
return hostap_ioctl_prism2param_iface(drv-iface, drv, param, value);
 }
 
- 
+static int hostap_ioctl_get_prism2param_iface(const char *iface,
+ struct i802_driver_data *drv,
+ int param)
+{
+   struct iwreq iwr;
+   int *i;
+
+   memset(iwr, 0, sizeof(iwr));
+   strncpy(iwr.ifr_name, iface, IFNAMSIZ);
+   i = (int *) iwr.u.name;
+   *i = param;
+
+   if (ioctl(drv-ioctl_sock, PRISM2_IOCTL_GET_PRISM2_PARAM, iwr)  0) {
+   char buf[128];
+   snprintf(buf, sizeof(buf),
+%s: ioctl[PRISM2_IOCTL_GET_PRISM2_PARAM], iface);
+   perror(buf);
+   return -1;
+   }
+
+   return *i;
+}
+
+static int hostap_ioctl_get_prism2param(struct i802_driver_data *drv,
+   int param)
+{
+   return hostap_ioctl_get_prism2param_iface(drv-iface, drv, param);
+}
+
 static int i802_set_ssid(void *priv, const u8 *buf, int len)
 {
struct i802_driver_data *drv = priv;
@@ -1338,12 +1385,20 @@ static int i802_init_sockets(struct i802
return -1;
}
 
+   /* Enable management interface */
+   if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_MGMT_IF, 1)  0)
+   return -1;
+   drv-mgmt_ifindex =
+   hostap_ioctl_get_prism2param(drv, PRISM2_PARAM_MGMT_IF);
+   if (drv-mgmt_ifindex  0)
+   return -1;
 memset(ifr, 0, sizeof(ifr));
-snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), %s, drv-mgmt_iface);
-if (ioctl(drv-ioctl_sock, SIOCGIFINDEX, ifr) != 0) {
-   perror(ioctl(SIOCGIFINDEX));
+   ifr.ifr_ifindex = drv-mgmt_ifindex;
+   if (ioctl(drv-ioctl_sock, SIOCGIFNAME, ifr) != 0) {
+   perror(ioctl(SIOCGIFNAME));
return -1;
 }
+   snprintf(drv-mgmt_iface, sizeof(drv-mgmt_iface), %s, ifr.ifr_name);
 
if (hostapd_set_iface_flags(drv, 1))
return -1;
@@ -1716,13 +1771,6 @@ static int i802_init(struct hostapd_data
drv-ops = devicescape_driver_ops;
drv-hapd = hapd;
memcpy(drv-iface, hapd-conf-iface, sizeof(drv-iface));
-   if (strncmp(hapd-conf-iface, wlan, 4) == 0) {
-   snprintf(drv-mgmt_iface, sizeof(drv-mgmt_iface),
-wmaster%sap, hapd-conf-iface + 4);

Re: [IPROUTE 01/05]: Use tc_calc_xmittime where appropriate

2006-06-23 Thread Patrick McHardy
Patrick McHardy wrote:
 [IPROUTE]: Use tc_calc_xmittime where appropriate
 
 diff --git a/tc/q_tbf.c b/tc/q_tbf.c
 index 6ed5e0b..87b1b29 100644
 --- a/tc/q_tbf.c
 +++ b/tc/q_tbf.c
 @@ -245,9 +245,9 @@ static int tbf_print_opt(struct qdisc_ut
   if (show_raw)
   fprintf(f, limit %s , sprint_size(qopt-limit, b1));
  
 - latency = 100*(qopt-limit/(double)qopt-rate.rate) - 
 tc_core_tick2usec(qopt-buffer);
 + latency = tc_calc_xmittime(qopt-rate.rate, qopt-limit) - 
 tc_core_tick2usec(qopt-buffer);
   if (qopt-peakrate.rate) {
 - double lat2 = 100*(qopt-limit/(double)qopt-peakrate.rate) 
 - tc_core_tick2usec(qopt-mtu);
 + double lat2 = tc_calc_xmittime(qopt-peakrate.rate, 
 qopt-limit) - tc_core_tick2usec(qopt-mtu);
   if (lat2  latency)


I think I should start reviewing my own patches in a mail client :)
The two cases above are wrong, tc_calc_xmittime does an additional
tc_core_usec2tick(). Corrected patch attached.
[IPROUTE]: Use tc_calc_xmittime where appropriate

Replace expressions of the form 100 * size/rate by tc_calc_xmittime().
The CBQ case deserves an extra comment: when called with bnwd=rate
tc_cbq_calc_maxidle behaves identical to tc_calc_xmittime, so use it
for clarity.

Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

---
commit c25b0a7730d72f266e46fee3cfd53ce9f2a15c2f
tree 39c6fbd3395e8a41170739d6cff8d3a00d31a915
parent 8f8a36487119a3cd1afe86a9649704aca088567b
author Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:02:46 +0200
committer Patrick McHardy [EMAIL PROTECTED] Fri, 23 Jun 2006 19:02:46 +0200

 tc/q_cbq.c   |2 +-
 tc/q_tbf.c   |4 ++--
 tc/tc_core.c |2 +-
 tc/tc_red.c  |2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tc/q_cbq.c b/tc/q_cbq.c
index a456eda..045c377 100644
--- a/tc/q_cbq.c
+++ b/tc/q_cbq.c
@@ -147,7 +147,7 @@ static int cbq_parse_opt(struct qdisc_ut
if (ewma_log  0)
ewma_log = TC_CBQ_DEF_EWMA;
lss.ewma_log = ewma_log;
-   lss.maxidle = tc_cbq_calc_maxidle(r.rate, r.rate, avpkt, lss.ewma_log, 
0);
+   lss.maxidle = tc_calc_xmittime(r.rate, avpkt);
lss.change = TCF_CBQ_LSS_MAXIDLE|TCF_CBQ_LSS_EWMA|TCF_CBQ_LSS_AVPKT;
lss.avpkt = avpkt;
 
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 07cf2fa..8688b63 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -67,7 +67,7 @@ int tc_calc_rtable(unsigned bps, __u32 *
sz += overhead;
if (sz  mpu)
sz = mpu;
-   rtab[i] = tc_core_usec2tick(100*((double)sz/bps));
+   rtab[i] = tc_calc_xmittime(bps, sz);
}
return cell_log;
 }
diff --git a/tc/tc_red.c b/tc/tc_red.c
index 385e7af..8f9bde0 100644
--- a/tc/tc_red.c
+++ b/tc/tc_red.c
@@ -71,7 +71,7 @@ int tc_red_eval_ewma(unsigned qmin, unsi
 
 int tc_red_eval_idle_damping(int Wlog, unsigned avpkt, unsigned bps, __u8 
*sbuf)
 {
-   double xmit_time = tc_core_usec2tick(100*(double)avpkt/bps);
+   double xmit_time = tc_calc_xmittime(bps, avpkt);
double lW = -log(1.0 - 1.0/(1Wlog))/xmit_time;
double maxtime = 31/lW;
int clog;


Re: [PATCH] 2.6.17 missing a call to ieee80211softmac_capabilities from ieee80211softmac_assoc_req

2006-06-23 Thread Luis R. Rodriguez

This fixes Assoc with Cisco Aironet 1200 series Wireless Access Points
as well. Tested with zd1211. Without this the zd1211 was not able to
complete assoc. Nice catch.

 Luis

On 6/20/06, Larry Finger [EMAIL PROTECTED] wrote:

In commit ba9b28d19a3251bb1dfe6a6f8cc89b96fb85f683, routine 
ieee80211softmac_capabilities was added
to net/ieee80211/softmac/ieee80211softmac_io.c. As denoted by its name, it 
completes the
capabilities IE that is needed in the associate and reassociate requests sent 
to the AP. For at
least one AP, the Linksys WRT54G V5, the capabilities field must set the 'short 
preamble' bit or the
AP refuses to associate. In the commit noted above, there is a call to the new 
routine from
ieee80211softmac_reassoc_req, but not from ieee80211softmac_assoc_req. This 
patch fixes that oversight.

As noted in the subject, v2.6.17 is affected. My bcm43xx card had been unable 
to associate since I
was forced to buy a new AP. I finally was able to get a packet dump and traced 
the problem to the
capabilities info. Although I had heard that a patch was floating around, I 
had not seen it before
2.6.17 was released. As this bug does not affect security and I seem to have 
the only AP affected by
it, there should be no problem in leaving it for 2.6.18.

Signed-Off-By: Larry Finger [EMAIL PROTECTED]

index 0954161..8cc8b20 100644
--- a/net/ieee80211/softmac/ieee80211softmac_io.c
+++ b/net/ieee80211/softmac/ieee80211softmac_io.c
@@ -229,6 +229,9 @@ ieee80211softmac_assoc_req(struct ieee8
return 0;
ieee80211softmac_hdr_3addr(mac, ((*pkt)-header), IEEE80211_STYPE_ASSOC_REQ, 
net-bssid, net-bssid);

+   /* Fill in the capabilities */
+   (*pkt)-capability = ieee80211softmac_capabilities(mac, net);
+
/* Fill in Listen Interval (?) */
(*pkt)-listen_interval = cpu_to_le16(10);

-
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


-
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: [1/4] kevent: core files.

2006-06-23 Thread Benjamin LaHaise
On Fri, Jun 23, 2006 at 11:09:34AM +0400, Evgeniy Polyakov wrote:
 This patch includes core kevent files:
  - userspace controlling
  - kernelspace interfaces
  - initialisation
  - notification state machines

We don't need yet another event mechanism in the kernel, so I don't see 
why the new syscalls should be added when they don't interoperate with 
existing solutions.  If your results are enough to sway akpm that it is 
worth taking the patches, then it would make sense to merge the code with 
the already in-tree APIs.

-ben
-
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 1/2] Hardware button support for Wireless cards: radiobtn

2006-06-23 Thread Ivo van Doorn
On Thursday 22 June 2006 17:55, Jiri Benc wrote:
 On Sat, 17 Jun 2006 17:05:55 +0200, Ivo van Doorn wrote:
  With this approach more buttons can be registered,
  it includes the optional field to report an update of the key status
  to the driver that registered it, and it supports for non-polling keys.
 
 I think this is not specific to networking anymore, so it should go to
 lkml. Please be sure to Cc: input devices maintainer, Dmitry Torokhov.

Thanks, I am currently discussing the driver with developers
from button drivers like acerhk and acpi_acer.
If I am sending the driver to the lkml will depend on their
reaction and input for the driver. No use sending drivers to
lkml when no other driver will want to use it. ;)

Ivo


pgprPwcMR31XL.pgp
Description: PGP signature


Re: [RFC PATCH 1/2] Hardware button support for Wireless cards: radiobtn

2006-06-23 Thread Ivo van Doorn
Hi,

  On Sat, 17 Jun 2006 17:05:55 +0200, Ivo van Doorn wrote:
   With this approach more buttons can be registered,
   it includes the optional field to report an update of the key status
   to the driver that registered it, and it supports for non-polling keys.
  
  I think this is not specific to networking anymore, so it should go to
  lkml. Please be sure to Cc: input devices maintainer, Dmitry Torokhov.
  
  Regarding rfkill button, I talked about that with Vojtech Pavlik (Cc:ed)
  and he suggests this solution:
  
  - driver is responsible for turning on/off radio when the input device
is not opened;
  - when something opens the input device, it receives input events and 
gets responsible to turn on/off the radio (by ioctl or putting the 
network interfaces up/down).
  
  This is of course not possible for all hardware, but it gives the most
  flexibility while keeping the possibility to switch of the radio without
  userspace support.
  
 Let me elaborate a little bit on the possible implementation:
 
   1) 802.11 card drivers will implement an input device for each card in
   the system that has a user-controlled RF-Kill button or switch.

So basicly 1 input device for every single wireless driver that implements
the RF-Kill button?
Is there any particular reason for not using 1 input device shared by all?

   2) 802.11 card drivers will implement an interface to enable/disable the
   radio, be it through a call, ioctl, or whatever, that is accessible from
   both the kernel and userspace.

Userspace could switch off the radio by using the txpower ioctl of
ifdown/ifup. Or should an approach call be implemented?

   3) ACPI buttons drivers, and keyboard drivers will generate KEY_RFKILL
   on machines where RF-Kill keys are reported using ACPI events or
   keyboard scancodes.

Why both an input and ACPI event?
With ACPI restricted to x86 only, wouldn't a more generic approach be desired?

   3) A rfkill.ko input handler module will be implemented, that listens to
   the SW_RFKILL and KEY_RFKILL events from all devices in the system, and
   will enable/disable radios on all 802.11 devices in the system.

 The above will make the RF-Kill button work under all real scenarios as
 user expects - it will enable/disable the radio. In the case where a
 user has an additional PCMCIA card, both the radios will be disabled by
 presing the RF-Kill button, which is arguably what the user expects.
 Even BlueTooth or other RF technologies (CDMA, EDGE) can hook into this
 mechanism.
 
   4) When userspace wants to take over the control over RF-Kill, and start
   additional services based on that, it can open the input devices to get
   the state of the buttons/switches, AND it can issue the EVIOCGRAB
   ioctl() to prevent the rfkill.ko and any other handlers from getting the
   events.

 This allows simple implementation of dbus notifications and
 NetworkManager-style configuration of network interfaces.
 


pgp7erjTTJ8GP.pgp
Description: PGP signature


Re: [RFC 3/7] NetLabel: CIPSOv4 engine

2006-06-23 Thread Ted
On Thu, 2006-06-22 at 02:12 -0700, David Miller wrote:
 From: [EMAIL PROTECTED]
 Date: Wed, 21 Jun 2006 15:42:38 -0400
 
  Add support for the Commercial IP Security Option (CIPSO) to the
  IPv4 network stack.  CIPSO has become a de-facto standard for
  trusted/labeled networking amongst existing Trusted Operating
  Systems such as Trusted Solaris, HP-UX CMW, etc.  This
  implementation is designed to be used with the NetLabel subsystem to
  provide explicit packet labeling to LSM developers.
 
 The thing that concerns me most about CIPSO is that even once users
 migrate to a more SELINUX native approach from this CIPSO stuff, the
 CIPSO code, it's bloat, and it's maintainence burdon will remain.
 
 It's easy to put stuff it, it's impossible to take stuff out even
 once it's largely unused by even it's original target audience.
 
 And that's what I see happening here.
 
 This is why, to be perfectly honest with you, I'd much rather
 something like this stay out-of-tree and people are strongly
 encouraged to use the more native stuff under Linux.
 

Realistically customers most likely to adopt use of SELinux are going to
be ones that currently use other trusted OSs such as TSOL and HP-UX CMW.
These users are unlikely to take an all (SELinux) or nothing approach.
Also they are more than likely customers who will want a fully
configured and supported distribution as opposed to one they'd have to
patch themselves.  With these points in mind I think CIPSO as a
integrated interoperability mechanism is critical. FYI, over the last
couple of weeks I've validated the interoperability of the CIPSO
inplementation with TSOL and HP-UX CMW.

Ted

 --
 redhat-lspp mailing list
 redhat-lspp@redhat.com
 https://www.redhat.com/mailman/listinfo/redhat-lspp

-
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: [1/4] kevent: core files.

2006-06-23 Thread Evgeniy Polyakov
On Fri, Jun 23, 2006 at 02:44:57PM -0400, Benjamin LaHaise ([EMAIL PROTECTED]) 
wrote:
 On Fri, Jun 23, 2006 at 11:09:34AM +0400, Evgeniy Polyakov wrote:
  This patch includes core kevent files:
   - userspace controlling
   - kernelspace interfaces
   - initialisation
   - notification state machines
 
 We don't need yet another event mechanism in the kernel, so I don't see 
 why the new syscalls should be added when they don't interoperate with 
 existing solutions.  If your results are enough to sway akpm that it is 
 worth taking the patches, then it would make sense to merge the code with 
 the already in-tree APIs.

What API are you talking about?
There is only epoll(), which is 40% slower than kevent, and AIO, which
works not as state machine, but as repeated call for the same work.
There is also inotify, which allocates new message each time event
occurs, which is not a good solution for every situation.

Linux just does not have unified event processing mechanism, which was
pointed to many times in AIO mail list and when epoll() was only
introduced. I would even say, that Linux does not have such mechanism at
all, since every potential user implements it's own, which can not be
used with others.

Kevent fixes that. Although implementation itself can be suboptimal for
some cases or even unacceptible at all, but it is really needed
functionality.

Every existing notification can be built on top of kevent. One can find
how easy it was to implement generic poll/select notifications (what
epoll() does) or socket notifications (which are similar to epoll(), but
are called from inside socket state machine, thus improving processing
performance).

   -ben

-- 
Evgeniy Polyakov
-
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: [3/5] [NET]: Add software TSOv4

2006-06-23 Thread Michael Chan
On Thu, 2006-06-22 at 18:14 +1000, Herbert Xu wrote:
 [NET]: Add software TSOv4
 
 This patch adds the GSO implementation for IPv4 TCP.

Herbert, Looks like there were some problems in the CHECKSUM_HW case.
This patch should fix it.  Please double-check my checksum math.

[NET]: Fix CHECKSUM_HW GSO problems.

Fix the following 2 problems in the GSO code path for CHECKSUM_HW
packets:

1. Adjust ipv4 TCP pseudo header checksum.

2. Initialize skb-tail.

Signed-off-by: Michael Chan [EMAIL PROTECTED]


diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8e5044b..3f19b3d 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1954,6 +1954,7 @@ struct sk_buff *skb_segment(struct sk_bu
nskb-data_len = len - hsize;
nskb-len += nskb-data_len;
nskb-truesize += nskb-data_len;
+   nskb-tail += nskb-data_len;
} while ((offset += len)  skb-len);
 
return segs;
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0e029c4..3399110 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2186,7 +2186,8 @@ struct sk_buff *tcp_tso_segment(struct s
if (skb-ip_summed == CHECKSUM_NONE) {
th-check = csum_fold(csum_partial(
skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   } else if (skb-ip_summed == CHECKSUM_HW)
+   th-check = ~csum_fold(csum_add(th-check, delta));
 
seq += len;
skb = skb-next;
@@ -2196,11 +2197,12 @@ struct sk_buff *tcp_tso_segment(struct s
th-cwr = 0;
} while (skb-next);
 
+   delta = csum_add(oldlen, htonl(skb-tail - skb-h.raw));
if (skb-ip_summed == CHECKSUM_NONE) {
-   delta = csum_add(oldlen, htonl(skb-tail - skb-h.raw));
th-check = csum_fold(csum_partial(
skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   } else if (skb-ip_summed == CHECKSUM_HW)
+   th-check = ~csum_fold(csum_add(th-check, delta));
 
 out:
return segs;


-
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: System hangs after running 2.6.17rc6 with broadcom 4309 and device scape stack

2006-06-23 Thread Alex Davis
--- Jiri Benc [EMAIL PROTECTED] wrote:

 On Sun, 18 Jun 2006 18:25:54 -0700 (PDT), Alex Davis wrote:
  Here is dmesg output for module loading.
  [...]
  Jun 16 20:04:06 siafu kernel: [4294720.505000] bcm43xx_d80211: Virtual 
  interface added (type:
  0x0002, ID: 4, MAC: 00:90:96:ba:32:20)
  Jun 16 20:04:06 siafu kernel: [4294720.511000] bcm43xx_d80211: PHY connected
  Jun 16 20:04:07 siafu kernel: [4294720.779000] bcm43xx_d80211: Radio turned 
  on
  Jun 16 20:04:07 siafu kernel: [4294720.971000] bcm43xx_d80211: Chip 
  initialized
  Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: DMA 
  initialized
  Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: 80211 cores 
  initialized
  Jun 16 20:04:07 siafu kernel: [4294720.972000] bcm43xx_d80211: Keys cleared
  Jun 16 20:04:07 siafu kernel: [4294720.988000] wmaster0: Does not support 
  passive scan,
 disabled
  Jun 16 20:04:09 siafu kernel: [4294723.027000] bcm43xx_d80211: ASSERTION 
  FAILED
  (bcm-interface.if_id == if_id) at:
  drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c:4344:bcm43xx_config_interface()
 
 This is really strange. Is this reproducible with latest wireless-dev?
I was using the latest: John Linville's git development release (2.6.17rc6).
I cloned it from 
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-dev.git
on 6/15/2006 21:00 EDT. As of today (6/23), there have been no changes.

 There was ifconfig up (or similar) command at 20:04:06 but
 wpa_supplicant was started at 20:04:14. What happened in-between?
Nothing. I start everything up by hand, hence the delay.

I use the following commands:
modprobe bcm43xx-d80211
wpa_supplicant -i wlan0 
dmesg  # to make sure I'm associated with the access point, and see any 
debugging info.
dhcpcd wlan0
ping 
login as non-root user and start x.


 Most important, what happened between 20:04:07 and 20:04:09? (I.e. what
 commands were invoked?) 
No commands were invoked during that period.


I'm currently using the rc5 version with no problems.


 Thanks,
 
  Jiri
 
 -- 
 Jiri Benc
 SUSE Labs
 


I code, therefore I am

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-
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/2][RFC] Network Event Notifier Mechanism

2006-06-23 Thread David Miller
From: Steve Wise [EMAIL PROTECTED]
Date: Fri, 23 Jun 2006 08:24:43 -0500

 On Thu, 2006-06-22 at 20:56 -0400, jamal wrote:
  On Thu, 2006-22-06 at 15:58 -0700, David Miller wrote:
  
   Anyways, we can create normal notifiers for neighbour and route
   events just like we have for network device stuff.
  
 
 So did you agree with a new notifier head for these events as in my
 original patch?  Or do you think I should add these to the netdev
 notifier?  

Pretty much.  I may not agree with the details of your implementation.

So let's start by you doing a repost of the first patch and let's
review that, ok?
-
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: [1/4] kevent: core files.

2006-06-23 Thread Benjamin LaHaise
On Fri, Jun 23, 2006 at 11:24:29PM +0400, Evgeniy Polyakov wrote:
 What API are you talking about?
 There is only epoll(), which is 40% slower than kevent, and AIO, which
 works not as state machine, but as repeated call for the same work.
 There is also inotify, which allocates new message each time event
 occurs, which is not a good solution for every situation.

AIO can be implemented as a state machine.  Nothing in the API stops 
you from doing that, and in fact there was code which was implemented as 
a state machine used on 2.4 kernels.

 Linux just does not have unified event processing mechanism, which was
 pointed to many times in AIO mail list and when epoll() was only
 introduced. I would even say, that Linux does not have such mechanism at
 all, since every potential user implements it's own, which can not be
 used with others.

The epoll event API doesn't have space in the event fields for result codes 
as needed for AIO.  The AIO API does -- how is it lacking in this regard?

 Kevent fixes that. Although implementation itself can be suboptimal for
 some cases or even unacceptible at all, but it is really needed
 functionality.

At the expense of adding another API?  How is this a good thing?  Why 
not spit out events in the existing format?

 Every existing notification can be built on top of kevent. One can find
 how easy it was to implement generic poll/select notifications (what
 epoll() does) or socket notifications (which are similar to epoll(), but
 are called from inside socket state machine, thus improving processing
 performance).

So far your code is adding a lot without unifying anything.

-ben
-- 
Time is of no importance, Mr. President, only life is important.
Don't Email: [EMAIL PROTECTED].
-
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 IPROUTE 00/05]: Time cleanups

2006-06-23 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Fri, 23 Jun 2006 20:09:18 +0200

 D'oh, got Stephen's address wrong. Please fix it (add 's' in front) in
 replies to this thread.

Stephen's also on vacation for a week, so it might be a while
until this stuff is integrated :)
-
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/2][RFC] Network Event Notifier Mechanism

2006-06-23 Thread Steve Wise
On Fri, 2006-06-23 at 12:57 -0700, David Miller wrote:
 From: Steve Wise [EMAIL PROTECTED]
 Date: Fri, 23 Jun 2006 08:24:43 -0500
 
  On Thu, 2006-06-22 at 20:56 -0400, jamal wrote:
   On Thu, 2006-22-06 at 15:58 -0700, David Miller wrote:
   
Anyways, we can create normal notifiers for neighbour and route
events just like we have for network device stuff.
   
  
  So did you agree with a new notifier head for these events as in my
  original patch?  Or do you think I should add these to the netdev
  notifier?  
 
 Pretty much.  I may not agree with the details of your implementation.
 
 So let's start by you doing a repost of the first patch and let's
 review that, ok?

Ok.  Stay tuned.

Steve.





-
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: ixgb EEH/PCI errors on reset

2006-06-23 Thread Brandeburg, Jesse
On Fri, 23 Jun 2006, Linas Vepstas wrote:
 I've got another ixgb driver bug I'm struggling with; clues or hints
 appreciated.
 
 I've got a patch for PCI error recovery for the ixgb, which works on
 many older kernels but seems to be broken on linux-2.6.17-rc6-mm2
 (which is ixgb version 1.0.109).  After performing a PCI reset on the
 card, I try to re-initialize the cad and the driver, with the following
 sequence:
 
pci_set_master(pdev);
netif_carrier_off(netdev);
netif_stop_queue(netdev);
ixgb_check_options(adapter);
ixgb_reset(adapter);
 
 This is only a subset of the ixgb_probe code, since I don't need to
 request regions or do any of the other setup.  However, this code
 fails in an unexpected way.  The last call invokes ixgb_mac_reset()
 which writes a reset bit, delays a few millisecs, and reads the reset
 bit.  The problem I'm seeing is that the read
 
   ctrl_reg = IXGB_READ_REG(hw, CTRL0);
 
 triggers some PCI bus error that off-lines the device. Any hints
 about where to look? This doesn't occur on other driver versions,
 and doesn't occur on this driver during the ordinary probe() sequence.
 Increasing the dealy doesn't seem to help.

you probably need to do something similar to stopping the transmitter and 
receiver using the TCTL and RCTL registers, and then waiting for any 
pending master requests to finish.

Ah, it appears the code in ixgb_adapter_stop is missing a IXGB_WRITE_FLUSH 
before the msec_delay.

try this patch?  it is compile tested.


snip

[PATCH] ixgb: make sure to flush writes before waiting
ixgb is missing some write flushes when issuing the reset, and a few 
others for that matter.

Signed-off-by: Jesse Brandeburg [EMAIL PROTECTED]

---

 drivers/net/ixgb/ixgb_ee.c |9 +
 drivers/net/ixgb/ixgb_hw.c |5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgb/ixgb_ee.c b/drivers/net/ixgb/ixgb_ee.c
index 8357c55..2359973 100644
--- a/drivers/net/ixgb/ixgb_ee.c
+++ b/drivers/net/ixgb/ixgb_ee.c
@@ -55,6 +55,7 @@ ixgb_raise_clock(struct ixgb_hw *hw,
 */
*eecd_reg = *eecd_reg | IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, *eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
return;
 }
@@ -74,6 +75,7 @@ ixgb_lower_clock(struct ixgb_hw *hw,
 */
*eecd_reg = *eecd_reg  ~IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, *eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
return;
 }
@@ -112,6 +114,7 @@ ixgb_shift_out_bits(struct ixgb_hw *hw,
eecd_reg |= IXGB_EECD_DI;
 
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
 
udelay(50);
 
@@ -208,21 +211,25 @@ ixgb_standby_eeprom(struct ixgb_hw *hw)
/*  Deselct EEPROM  */
eecd_reg = ~(IXGB_EECD_CS | IXGB_EECD_SK);
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
 
/*  Clock high  */
eecd_reg |= IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
 
/*  Select EEPROM  */
eecd_reg |= IXGB_EECD_CS;
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
 
/*  Clock low  */
eecd_reg = ~IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
return;
 }
@@ -242,11 +249,13 @@ ixgb_clock_eeprom(struct ixgb_hw *hw)
/*  Rising edge of clock  */
eecd_reg |= IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
 
/*  Falling edge of clock  */
eecd_reg = ~IXGB_EECD_SK;
IXGB_WRITE_REG(hw, EECD, eecd_reg);
+   IXGB_WRITE_FLUSH(hw);
udelay(50);
return;
 }
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index f7fa10e..3e08ba8 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -81,7 +81,7 @@ static uint32_t ixgb_mac_reset(struct ix
 #else
IXGB_WRITE_REG(hw, CTRL0, ctrl_reg);
 #endif
-
+   IXGB_WRITE_FLUSH(hw);
/* Delay a few ms just to allow the reset to complete */
msec_delay(IXGB_DELAY_AFTER_RESET);
ctrl_reg = IXGB_READ_REG(hw, CTRL0);
@@ -133,6 +133,7 @@ ixgb_adapter_stop(struct ixgb_hw *hw)
 */
IXGB_WRITE_REG(hw, RCTL, IXGB_READ_REG(hw, RCTL)  ~IXGB_RCTL_RXEN);
IXGB_WRITE_REG(hw, TCTL, IXGB_READ_REG(hw, TCTL)  ~IXGB_TCTL_TXEN);
+   IXGB_WRITE_FLUSH(hw);
msec_delay(IXGB_DELAY_BEFORE_RESET);
 
/* Issue a global reset to the MAC.  This will reset the chip's
@@ -287,7 +288,7 @@ ixgb_init_hw(struct ixgb_hw *hw)
 #else
IXGB_WRITE_REG(hw, CTRL1, IXGB_CTRL1_EE_RST);
 #endif
-
+   IXGB_WRITE_FLUSH(hw);
/* Delay a few ms just to allow the reset to complete */
msec_delay(IXGB_DELAY_AFTER_EE_RESET);
 
-
To unsubscribe from this list: 

[PATCH REPOST 2/2] Core network changes to support network event notification.

2006-06-23 Thread Steve Wise

This patch adds event calls for neighbour change, route update, and
routing redirect events.

TODO: PMTU change events.
---

 net/core/Makefile|2 +-
 net/core/neighbour.c |8 
 net/ipv4/fib_semantics.c |7 +++
 net/ipv4/route.c |6 ++
 4 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/net/core/Makefile b/net/core/Makefile
index e9bd246..2645ba4 100644
--- a/net/core/Makefile
+++ b/net/core/Makefile
@@ -7,7 +7,7 @@ obj-y := sock.o request_sock.o skbuff.o 
 
 obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 
-obj-y   += dev.o ethtool.o dev_mcast.o dst.o \
+obj-y   += dev.o ethtool.o dev_mcast.o dst.o netevent.o \
neighbour.o rtnetlink.o utils.o link_watch.o filter.o
 
 obj-$(CONFIG_XFRM) += flow.o
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 50a8c73..c637897 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -30,9 +30,11 @@ #include linux/times.h
 #include net/neighbour.h
 #include net/dst.h
 #include net/sock.h
+#include net/netevent.h
 #include linux/rtnetlink.h
 #include linux/random.h
 #include linux/string.h
+#include linux/notifier.h
 
 #define NEIGH_DEBUG 1
 
@@ -755,6 +757,7 @@ #endif
neigh-nud_state = NUD_STALE;
neigh-updated = jiffies;
neigh_suspect(neigh);
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
}
} else if (state  NUD_DELAY) {
if (time_before_eq(now, 
@@ -763,6 +766,7 @@ #endif
neigh-nud_state = NUD_REACHABLE;
neigh-updated = jiffies;
neigh_connect(neigh);
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
next = neigh-confirmed + neigh-parms-reachable_time;
} else {
NEIGH_PRINTK2(neigh %p is probed.\n, neigh);
@@ -783,6 +787,7 @@ #endif
neigh-nud_state = NUD_FAILED;
neigh-updated = jiffies;
notify = 1;
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
NEIGH_CACHE_STAT_INC(neigh-tbl, res_failed);
NEIGH_PRINTK2(neigh %p is failed.\n, neigh);
 
@@ -1056,6 +1061,9 @@ out:
(neigh-flags | NTF_ROUTER) :
(neigh-flags  ~NTF_ROUTER);
}
+
+   call_netevent_notifiers(NETEVENT_NEIGH_UPDATE, neigh);
+
write_unlock_bh(neigh-lock);
 #ifdef CONFIG_ARPD
if (notify  neigh-parms-app_probes)
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 0f4145b..67a30af 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -45,6 +45,7 @@ #include net/tcp.h
 #include net/sock.h
 #include net/ip_fib.h
 #include net/ip_mp_alg.h
+#include net/netevent.h
 
 #include fib_lookup.h
 
@@ -278,9 +279,15 @@ void rtmsg_fib(int event, u32 key, struc
   struct nlmsghdr *n, struct netlink_skb_parms *req)
 {
struct sk_buff *skb;
+   struct netevent_route_change rev;
+
u32 pid = req ? req-pid : n-nlmsg_pid;
int size = NLMSG_SPACE(sizeof(struct rtmsg)+256);
 
+   rev.event = event;
+   rev.fib_info = fa-fa_info;
+   call_netevent_notifiers(NETEVENT_ROUTE_UPDATE, rev);
+
skb = alloc_skb(size, GFP_KERNEL);
if (!skb)
return;
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index cc9423d..e9ba831 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -105,6 +105,7 @@ #include net/tcp.h
 #include net/icmp.h
 #include net/xfrm.h
 #include net/ip_mp_alg.h
+#include net/netevent.h
 #ifdef CONFIG_SYSCTL
 #include linux/sysctl.h
 #endif
@@ -1120,6 +1121,7 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
struct rtable *rth, **rthp;
u32  skeys[2] = { saddr, 0 };
int  ikeys[2] = { dev-ifindex, 0 };
+   struct netevent_redirect netevent;
 
if (!in_dev)
return;
@@ -1211,6 +1213,10 @@ void ip_rt_redirect(u32 old_gw, u32 dadd
rt_drop(rt);
goto do_next;
}
+   
+   netevent.old = rth-u.dst;
+   netevent.new = rt-u.dst;
+   call_netevent_notifiers(NETEVENT_REDIRECT, 
netevent);
 
rt_del(hash, rth);
if (!rt_intern_hash(hash, rt, rt))
-
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: [1/4] kevent: core files.

2006-06-23 Thread Evgeniy Polyakov
On Fri, Jun 23, 2006 at 04:44:42PM -0400, Benjamin LaHaise ([EMAIL PROTECTED]) 
wrote:
  AIO completion approach was designed to be used with process context VFS
  update. read/write approach can not cover other types of notifications,
  like inode updates or timers.
 
 The completion event is 100% generic and does not need to come from process 
 context.  Calling aio_complete() from irq context is entirely valid.

put_ioctx() can sleep.
And the whole approach is different: AIO just wakes up requesting
thread, so user must provide a lot to be able to work with AIO.
It perfectly fits VFS design, but it is not acceptible for generic event
notifications.

  Format of the structure transferred between the objects does not matter
  at all. We can create a wrapper on kevent structures or kevent can
  transform data from AIO objects.
 
  The main design goal of kevent is to provide easy connected hooks into
  any state machine, which might be used by kernelspace to notify about
  any kind of events without any knowledge of it's background nature.
  Kevent can be used for example as notification blocks for address
  changes or it can replace netlink completely (it can even emulate
  event multicasting).
  
  Kevent is queue of events, which can be transferred from any object to
  any destination.
 
 And io_getevents() reads a queue of events, so I'm not sure why you need 
 a new syscall.

It is not syscall, but overall design should be analyzed.
It is possible to use existing ssycalls, kevent design does not care
about how it's data structures are delivered to the internal
processor.

  Not at all!
  Kevent is a mechanism, which allows to impleement AIO, network AIO, poll
  and select, timer control, adaptive readhead (as example of AIO VFS
  update). All the code I present shows how to use kevent, it is not part
  of the kevent. One can find Makefile in kevent dir to check what is the
  core of the subsystem, which allows to be used as a transport for
  events.
  
  AIO, NAIO, poll/select, socket and timer notifications are just users.
  One can add it's own usage as easy as to call kevent_storage
  initialization function and event generation function. All other pieces
  are hidded in the implementation.
 
 I'll look at adapting your code to use the existing syscalls.  Maybe code 
 will be better at expressing my concerns.

That would be great.

   -ben

-- 
Evgeniy Polyakov
-
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/3] bcm43xx-d80211: use host_gen_beacon_template

2006-06-23 Thread Michael Buesch
On Friday 23 June 2006 20:16, Jiri Benc wrote:
 Use new host_gen_beacon_template flag. This also means workaround with
 iwconfig essid after hostapd is run is not necessary anymore.
 
 Signed-off-by: Jiri Benc [EMAIL PROTECTED]

Signed-off-by: Michael Buesch [EMAIL PROTECTED]

John, please apply.

 ---
 
  drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c |   36 
 ++---
  1 files changed, 11 insertions(+), 25 deletions(-)
 
 --- dscape.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
 +++ dscape/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
 @@ -1710,17 +1710,12 @@ static void bcm43xx_write_probe_resp_tem
   kfree(probe_resp_data);
  }
  
 -static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm)
 +static int bcm43xx_refresh_cached_beacon(struct bcm43xx_private *bcm,
 +  struct sk_buff *beacon)
  {
 - struct ieee80211_tx_control control;
 -
   if (bcm-cached_beacon)
   kfree_skb(bcm-cached_beacon);
 - bcm-cached_beacon = ieee80211_beacon_get(bcm-net_dev,
 -   bcm-interface.if_id,
 -   control);
 - if (unlikely(!bcm-cached_beacon))
 - return -ENOMEM;
 + bcm-cached_beacon = beacon;
  
   return 0;
  }
 @@ -1743,16 +1738,15 @@ static void bcm43xx_update_templates(str
   bcm43xx_write32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD, status);
  }
  
 -static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm)
 +static void bcm43xx_refresh_templates(struct bcm43xx_private *bcm,
 +   struct sk_buff *beacon)
  {
   int err;
  
 - err = bcm43xx_refresh_cached_beacon(bcm);
 + err = bcm43xx_refresh_cached_beacon(bcm, beacon);
   if (unlikely(err))
   return;
   bcm43xx_update_templates(bcm);
 - kfree_skb(bcm-cached_beacon);
 - bcm-cached_beacon = NULL;
  }
  
  static void bcm43xx_set_ssid(struct bcm43xx_private *bcm,
 @@ -1792,19 +1786,11 @@ static void bcm43xx_set_beacon_int(struc
  static void handle_irq_beacon(struct bcm43xx_private *bcm)
  {
   u32 status;
 - int err;
  
   bcm-irq_savedstate = ~BCM43xx_IRQ_BEACON;
   status = bcm43xx_read32(bcm, BCM43xx_MMIO_STATUS2_BITFIELD);
  
 - if (!bcm-cached_beacon) {
 - err = bcm43xx_refresh_cached_beacon(bcm);
 - if (unlikely(err))
 - goto ack;
 - }
 -
 - if ((status  0x1)  (status  0x2)) {
 -ack:
 + if (!bcm-cached_beacon || ((status  0x1)  (status  0x2))) {
   /* ACK beacon IRQ. */
   bcm43xx_write32(bcm, BCM43xx_MMIO_GEN_IRQ_REASON,
   BCM43xx_IRQ_BEACON);
 @@ -4382,7 +4368,6 @@ static int bcm43xx_net_config(struct net
  
   if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
   bcm43xx_set_beacon_int(bcm, conf-beacon_int);
 - bcm43xx_refresh_templates(bcm);
   }
  
   bcm43xx_unlock_irqonly(bcm, flags);
 @@ -4553,7 +4538,7 @@ static int bcm43xx_add_interface(struct 
   if (bcm43xx_status(bcm) == BCM43xx_STAT_INITIALIZED) {
   bcm43xx_select_opmode(bcm);
   if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP))
 - bcm43xx_refresh_templates(bcm);
 + bcm43xx_refresh_templates(bcm, NULL);
   }
   err = 0;
  
 @@ -4606,7 +4591,8 @@ static int bcm43xx_config_interface(stru
   if (bcm43xx_is_mode(bcm, IEEE80211_IF_TYPE_AP)) {
   assert(conf-type == IEEE80211_IF_TYPE_AP);
   bcm43xx_set_ssid(bcm, conf-ssid, conf-ssid_len);
 - bcm43xx_refresh_templates(bcm);
 + if (conf-beacon)
 + bcm43xx_refresh_templates(bcm, conf-beacon);
   }
   }
   bcm43xx_unlock_irqsafe(bcm, flags);
 @@ -4701,7 +4687,7 @@ static int __devinit bcm43xx_init_one(st
   goto out;
   ieee-version = IEEE80211_VERSION;
   ieee-name = KBUILD_MODNAME;
 - ieee-host_gen_beacon = 1;
 + ieee-host_gen_beacon_template = 1;
   ieee-rx_includes_fcs = 1;
   ieee-monitor_during_oper = 1;
   ieee-tx = bcm43xx_net_hard_start_xmit;
 

-- 
Greetings Michael.
-
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: Streamline testing of 802.11 drivers

2006-06-23 Thread Luis R. Rodriguez

Oh and mini-PCI please :)

On 6/23/06, Luis R. Rodriguez [EMAIL PROTECTED] wrote:

I've mentioned this to a few but here it is out to everyone. So as you
know we have a lot of work ahead of us for linux wireless development.
To help speed this up, we at Winlab, would like to start hosting a
testbed for linux wireless development, open to the public. Short term
goals would be to start off a couple of nodes for each driver
currently under development like bcm43xx, zd1211, rt2x00, ipw3945,
ipw2200 and the like, and a provide a set streamlined tests we can use
to really put to test the drivers and stacks.

This wouldn't be easy if we didn't have infrastructure but we already
do. Our grid consists of 400 nodes with 2 wireless cards each and 3
ethernet ports (one for control) --
http://orbit-lab.org/wiki/Tutorial/Testbed. 90% of our nodes use the
atheros 5213 chipset and the rest ipw2200s. We'd like to expand this
with the more wireless cards currently being worked on for linux.

Right now we have zome zd1211s so we'll start with that (I'll start
working on a port to d80211) but will try to accomodate other nodes as
we get more wireless cards. We will need some help too though, to
streamline the testing. If you have ideas or would like to contribute
please let me know. We can purchase wireless cards but if you already
have reliable confirmed wireless cards which can be used for putting
into the testbed let me know.

  Luis


-
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: hostapd patch for d80211

2006-06-23 Thread Michael Buesch
On Friday 23 June 2006 20:19, Jiri Benc wrote:
 On Mon, 19 Jun 2006 11:07:34 +0200, Michael Buesch wrote:
  Important notes from Alexander Tsvyashchenko's initial mail follow:
  [...]
  Although my previous patch to hostapd to make it interoperable with
  bcm43xx  dscape has been merged already in their CVS version, due to
  the subsequent changes in dscape stack current hostapd is again
  incompartible :-(
 
 This patch allows devicescape driver in hostapd to work with recent d80211.
 No manipulation with network interfaces is needed anymore - hostapd even
 switches the interface to AP mode automatically now. Just modprobe
 bcm43xx-d80211, run hostapd and enjoy :-)
 
 Signed-off-by: Jiri Benc [EMAIL PROTECTED]

Well, if it works Jouni, please apply.
I did not test it. But I trust Jiri. If he says it works, then
it does work :)

 ---
 
  driver_devicescape.c |   77 
 ++-
  1 files changed, 64 insertions(+), 13 deletions(-)
 
 --- hostapd-0.5-2006-06-19.orig/driver_devicescape.c
 +++ hostapd-0.5-2006-06-19/driver_devicescape.c
 @@ -73,6 +73,7 @@ struct i802_driver_data {
  
   char iface[IFNAMSIZ + 1];
   char mgmt_iface[IFNAMSIZ + 1];
 + int mgmt_ifindex;
   int sock; /* raw packet socket for driver access */
   int ioctl_sock; /* socket for ioctl() use */
   int wext_sock; /* socket for wireless events */
 @@ -88,6 +89,21 @@ static const struct driver_ops devicesca
  static int i802_sta_set_flags(void *priv, const u8 *addr,
 int flags_or, int flags_and);
  
 +static int i802_set_ap_mode(struct i802_driver_data *drv)
 +{
 + struct iwreq iwr;
 +
 + memset(iwr, 0, sizeof(iwr));
 + strncpy(iwr.ifr_name, drv-iface, IFNAMSIZ);
 + iwr.u.mode = IW_MODE_MASTER;
 +
 + if (ioctl(drv-ioctl_sock, SIOCSIWMODE, iwr)  0) {
 + perror(ioctl[SIOCSIWMODE]);
 + return -1;
 + }
 +
 + return 0;
 +}
  
  static int hostapd_set_iface_flags(struct i802_driver_data *drv, int dev_up)
  {
 @@ -96,13 +112,16 @@ static int hostapd_set_iface_flags(struc
   if (drv-ioctl_sock  0)
   return -1;
  
 + if (dev_up)
 + i802_set_ap_mode(drv);
 +
   memset(ifr, 0, sizeof(ifr));
 - snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-mgmt_iface);
 + snprintf(ifr.ifr_name, IFNAMSIZ, %s, drv-iface);
  
   if (ioctl(drv-ioctl_sock, SIOCGIFFLAGS, ifr) != 0) {
   perror(ioctl[SIOCGIFFLAGS]);
   wpa_printf(MSG_DEBUG, Could not read interface flags (%s),
 -drv-mgmt_iface);
 +drv-iface);
   return -1;
   }
  
 @@ -303,7 +322,35 @@ static int hostap_ioctl_prism2param(stru
   return hostap_ioctl_prism2param_iface(drv-iface, drv, param, value);
  }
  
 - 
 +static int hostap_ioctl_get_prism2param_iface(const char *iface,
 +   struct i802_driver_data *drv,
 +   int param)
 +{
 + struct iwreq iwr;
 + int *i;
 +
 + memset(iwr, 0, sizeof(iwr));
 + strncpy(iwr.ifr_name, iface, IFNAMSIZ);
 + i = (int *) iwr.u.name;
 + *i = param;
 +
 + if (ioctl(drv-ioctl_sock, PRISM2_IOCTL_GET_PRISM2_PARAM, iwr)  0) {
 + char buf[128];
 + snprintf(buf, sizeof(buf),
 +  %s: ioctl[PRISM2_IOCTL_GET_PRISM2_PARAM], iface);
 + perror(buf);
 + return -1;
 + }
 +
 + return *i;
 +}
 +
 +static int hostap_ioctl_get_prism2param(struct i802_driver_data *drv,
 + int param)
 +{
 + return hostap_ioctl_get_prism2param_iface(drv-iface, drv, param);
 +}
 +
  static int i802_set_ssid(void *priv, const u8 *buf, int len)
  {
   struct i802_driver_data *drv = priv;
 @@ -1338,12 +1385,20 @@ static int i802_init_sockets(struct i802
   return -1;
   }
  
 + /* Enable management interface */
 + if (hostap_ioctl_prism2param(drv, PRISM2_PARAM_MGMT_IF, 1)  0)
 + return -1;
 + drv-mgmt_ifindex =
 + hostap_ioctl_get_prism2param(drv, PRISM2_PARAM_MGMT_IF);
 + if (drv-mgmt_ifindex  0)
 + return -1;
  memset(ifr, 0, sizeof(ifr));
 -snprintf(ifr.ifr_name, sizeof(ifr.ifr_name), %s, drv-mgmt_iface);
 -if (ioctl(drv-ioctl_sock, SIOCGIFINDEX, ifr) != 0) {
 - perror(ioctl(SIOCGIFINDEX));
 + ifr.ifr_ifindex = drv-mgmt_ifindex;
 + if (ioctl(drv-ioctl_sock, SIOCGIFNAME, ifr) != 0) {
 + perror(ioctl(SIOCGIFNAME));
   return -1;
  }
 + snprintf(drv-mgmt_iface, sizeof(drv-mgmt_iface), %s, ifr.ifr_name);
  
   if (hostapd_set_iface_flags(drv, 1))
   return -1;
 @@ -1716,13 +1771,6 @@ static int i802_init(struct hostapd_data
   drv-ops = devicescape_driver_ops;
   drv-hapd = hapd;
   memcpy(drv-iface, hapd-conf-iface, sizeof(drv-iface));
 - if 

Re: ixgb EEH/PCI errors on reset

2006-06-23 Thread Linas Vepstas
On Fri, Jun 23, 2006 at 01:15:53PM -0700, Brandeburg, Jesse wrote:
  fails in an unexpected way.  The last call invokes ixgb_mac_reset()
  which writes a reset bit, delays a few millisecs, and reads the reset
  bit.  The problem I'm seeing is that the read
  
ctrl_reg = IXGB_READ_REG(hw, CTRL0);
  
  triggers some PCI bus error that off-lines the device. Any hints
 
 try this patch?  it is compile tested.

[...]

   IXGB_WRITE_REG(hw, EECD, *eecd_reg);
 + IXGB_WRITE_FLUSH(hw);
   udelay(50);

With such a response, I had high hopes that the patch would work. 
Alas, it didn't help. I am in the process of rolling back to 
the driver v 1.0.100, which doesn'thave the problem, to see 
if I can isolate what changed.

--linas
-
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 1/2] Hardware button support for Wireless cards: radiobtn

2006-06-23 Thread Ivo van Doorn
  So basicly 1 input device for every single wireless driver that implements
  the RF-Kill button?
 
 Yes.
 
  Is there any particular reason for not using 1 input device shared by all?
 
 Yes.
 
 In the unlikely case where there are two devices which implement a
 rfkill button in the system, the input core doesn't have a way how to
 express the state of these two different buttons with the same meaning
 (and hence the same code - KEY_RFKILL) in a single input device.
 
 You'd have to assign a range of codes to the shared device, which goes
 agains the design of the Linux inpu layer.
 
 Anyway, for the most common case, where you have a single RF-Kill key in
 the whole system, there will not be any difference to using the shared
 device.
 
 What do you consider the benefits of using a shared input device?

Well it is a matter of preference, especially on how this rfkill.ko would
be implemented. When the user has 2 buttons, should all radios
(wifi, bluetooth etc) be switched off by pressing each individual key
or just 1 key to switch off everything.
But now that I am further thinking about this, (and looking on how
my laptop currently works with 1 wifi button and 1 bluetooth button)
perhaps multiple input devices would indeed be best.
userspace can decide if more interfaces should be attached to the button
or not. And this would be the preferred situation.

  Userspace could switch off the radio by using the txpower ioctl of
  ifdown/ifup. Or should an approach call be implemented?
 
 I'm an input guy, the details of how to disable the radio I'll leave up
 to you - the WiFi folks on netdev.

:)

 You may want to consider that the radio chip usually synthesizes a
 frequency that it mixes with the incoming signal to frequency-shift it
 to a low frequency which then can be demodulated. Because of that, even
 the receiver, when working, can affect devices nearby. This is why FM
 radio receivers are not allowed on airplanes.
 
 Hardware RF-Kill disables both RX and TX, by stopping the radio chip.
 Setting TX power to an extremely low value might not be the same.
 
 On the other hand, you may define in the API that setting TX power to
 zero also disables the receiver.

ok, no need for new ioctl calls in that case I believe.
Using the txpower the radio can be switched on and off, without giving a low or 
0 as value.
But the decision to use ifup and ifdown or iwconfig txpower on/off could be 
done later,
since it can handled in user space.

 3) ACPI buttons drivers, and keyboard drivers will generate KEY_RFKILL
 on machines where RF-Kill keys are reported using ACPI events or
 keyboard scancodes.
  
  Why both an input and ACPI event?
  With ACPI restricted to x86 only, wouldn't a more generic approach be 
  desired?
 
 I was talking about the ACPI EC sending us an event. This is how are
 ACPI buttons implemented in certain notebooks. I definitely don't want
 to use the acpi events as received by acpid now as the interface. Sorry
 for the confusion.

ah ok. :)

 3) A rfkill.ko input handler module will be implemented, that listens to
 the SW_RFKILL and KEY_RFKILL events from all devices in the system, and
 will enable/disable radios on all 802.11 devices in the system.
  
   The above will make the RF-Kill button work under all real scenarios as
   user expects - it will enable/disable the radio. In the case where a
   user has an additional PCMCIA card, both the radios will be disabled by
   presing the RF-Kill button, which is arguably what the user expects.
   Even BlueTooth or other RF technologies (CDMA, EDGE) can hook into this
   mechanism.
   
 4) When userspace wants to take over the control over RF-Kill, and start
 additional services based on that, it can open the input devices to get
 the state of the buttons/switches, AND it can issue the EVIOCGRAB
 ioctl() to prevent the rfkill.ko and any other handlers from getting the
 events.
  
   This allows simple implementation of dbus notifications and
   NetworkManager-style configuration of network interfaces.
 


pgpO8KLnVKMo8.pgp
Description: PGP signature


Re: New Qlogic qla3xxx NIC Driver v2.02.00k34 for upstream inclusion

2006-06-23 Thread Jeff Garzik

Ron Mercer wrote:
9) [minor] N/A appears to be an inaccurate value for fw_version in 
ql_get_drvinfo()


Does anyone know what would be appropriate for this ethtool command?  My
device does not use firmware.  I took the N/A idea from e1000 and
skge.


It does both ethernet and iSCSI entirely in silicon?

Is there an easy way to get silicon rev?

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


[NETROM] Fix possible null pointer dereference.

2006-06-23 Thread Ralf Baechle
If in nr_link_failed the neighbour list is non-empty but the node list
is empty we'll end dereferencing a  in a NULL pointer.

This fixes coverity 362.

Signed-off-by: Ralf Baechle [EMAIL PROTECTED]

 net/netrom/nr_route.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

Index: linux-net/net/netrom/nr_route.c
===
--- linux-net.orig/net/netrom/nr_route.c2006-06-23 22:40:27.0 
+0100
+++ linux-net/net/netrom/nr_route.c 2006-06-23 22:42:52.0 +0100
@@ -725,15 +725,17 @@ void nr_link_failed(ax25_cb *ax25, int r
struct nr_node  *nr_node = NULL;
 
spin_lock_bh(nr_neigh_list_lock);
-   nr_neigh_for_each(s, node, nr_neigh_list)
+   nr_neigh_for_each(s, node, nr_neigh_list) {
if (s-ax25 == ax25) {
nr_neigh_hold(s);
nr_neigh = s;
break;
}
+   }
spin_unlock_bh(nr_neigh_list_lock);
 
-   if (nr_neigh == NULL) return;
+   if (nr_neigh == NULL)
+   return;
 
nr_neigh-ax25 = NULL;
ax25_cb_put(ax25);
@@ -743,11 +745,13 @@ void nr_link_failed(ax25_cb *ax25, int r
return;
}
spin_lock_bh(nr_node_list_lock);
-   nr_node_for_each(nr_node, node, nr_node_list)
+   nr_node_for_each(nr_node, node, nr_node_list) {
nr_node_lock(nr_node);
-   if (nr_node-which  nr_node-count  
nr_node-routes[nr_node-which].neighbour == nr_neigh)
+   if (nr_node-which  nr_node-count 
+   nr_node-routes[nr_node-which].neighbour == nr_neigh)
nr_node-which++;
nr_node_unlock(nr_node);
+   }
spin_unlock_bh(nr_node_list_lock);
nr_neigh_put(nr_neigh);
 }
-
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: [1/4] kevent: core files.

2006-06-23 Thread Evgeniy Polyakov
On Fri, Jun 23, 2006 at 05:31:44PM -0400, Benjamin LaHaise ([EMAIL PROTECTED]) 
wrote:
 On Sat, Jun 24, 2006 at 01:08:27AM +0400, Evgeniy Polyakov wrote:
  On Fri, Jun 23, 2006 at 04:44:42PM -0400, Benjamin LaHaise ([EMAIL 
  PROTECTED]) wrote:
AIO completion approach was designed to be used with process context VFS
update. read/write approach can not cover other types of notifications,
like inode updates or timers.
   
   The completion event is 100% generic and does not need to come from 
   process 
   context.  Calling aio_complete() from irq context is entirely valid.
  
  put_ioctx() can sleep.
 
 Err, no, that should definately not be the case.  If it can, someone has 
 completely broken aio.

When reference counter hits zero it flushes aio workqueue, which can
sleep.
put_ioctx() - __put_ioctx() - cancel_delayed_work()/flush_workqueue().

It is there at least from 2.6.15 days (it is the oldest tree I can
access using my extremely slow GPRS link).

Hang the looter!

   -ben

-- 
Evgeniy Polyakov
-
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: Streamline testing of 802.11 drivers

2006-06-23 Thread Ivo van Doorn
Hi,

 I've mentioned this to a few but here it is out to everyone. So as you
 know we have a lot of work ahead of us for linux wireless development.
 To help speed this up, we at Winlab, would like to start hosting a
 testbed for linux wireless development, open to the public. Short term
 goals would be to start off a couple of nodes for each driver
 currently under development like bcm43xx, zd1211, rt2x00, ipw3945,
 ipw2200 and the like, and a provide a set streamlined tests we can use
 to really put to test the drivers and stacks.

This would be really interesting. :)

 This wouldn't be easy if we didn't have infrastructure but we already
 do. Our grid consists of 400 nodes with 2 wireless cards each and 3
 ethernet ports (one for control) --
 http://orbit-lab.org/wiki/Tutorial/Testbed. 90% of our nodes use the
 atheros 5213 chipset and the rest ipw2200s. We'd like to expand this
 with the more wireless cards currently being worked on for linux.
 
 Right now we have zome zd1211s so we'll start with that (I'll start
 working on a port to d80211) but will try to accomodate other nodes as
 we get more wireless cards. We will need some help too though, to
 streamline the testing. If you have ideas or would like to contribute
 please let me know. We can purchase wireless cards but if you already
 have reliable confirmed wireless cards which can be used for putting
 into the testbed let me know.

I'll discuss this in the rt2x00 team, and see if we can donate some
hardware.

Ivo


pgpQQcVYpiRCJ.pgp
Description: PGP signature


Re: [1/4] kevent: core files.

2006-06-23 Thread Benjamin LaHaise
On Fri, Jun 23, 2006 at 01:54:23PM -0700, David Miller wrote:
 From: Benjamin LaHaise [EMAIL PROTECTED]
 Date: Fri, 23 Jun 2006 16:31:14 -0400
 
  Eh?  Nobody has posted any numbers comparing the approaches yet, so this 
  is pure handwaving, unless you have real concrete results?
 
 Evgeniy posts numbers and performance graphs on his kevent work all
 the time.

But you're argueing that the performance of something that hasn't been 
tested is worse simply by nature of it not having been tested.  That's a 
fallacy of omission, iiuc.

 Van Jacobson did in his LCA2006 net channel slides too, perhaps you
 missed that.

I have yet to be convinced that the layering violation known as net channels 
is the right way to go, mostly because it breaks horribly in a few cases -- 
think what happens during periods of CPU overcommit, in which case doing too 
much in interrupt context will kill a system (which is why softirqs are 
needed).  The effect of doing all processing in user context creates issues 
with delayed acks (due to context switching to other tasks in the system), 
which will cause excess retransmits.  The hard problems associated with 
packet filtering and security are also still unresolved, which is okay for 
a paper, but a concern in real life.

There are also a number of performance flaws in the current stack that 
show up under profiling, some of which I posted fixes for, some of which 
have yet to be fixed.  The pushf/popf pipeline stall was one of the bigger 
instances of CPU wastage that Van Jacobson noticed (it shows up as bottom 
halves using lots of CPU).  Iirc, Ingo's real time patches may avoid that 
by way of reworking the irq disable/enable mechanism, which would mean the 
results need retesting.  Using the cr8 register to enable/disable 
interrupts on x86-64 might also improve things, as that would eliminate the 
flags dependancy of cli/sti...

In short, there's a lot of work that still has to be done.

-ben
-- 
Time is of no importance, Mr. President, only life is important.
Don't Email: [EMAIL PROTECTED].
-
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: [3/5] [NET]: Add software TSOv4

2006-06-23 Thread Herbert Xu
On Fri, Jun 23, 2006 at 02:26:16PM -0700, Michael Chan wrote:

 This patch is more correct.  Please ignore the previous one.
 
 [NET]: Fix CHECKSUM_HW GSO problems.
 
 Fix checksum problems in the GSO code path for CHECKSUM_HW packets.
 
 The ipv4 TCP pseudo header checksum has to be adjusted for GSO
 segmented packets.
 
 Signed-off-by: Michael Chan [EMAIL PROTECTED]

Good catch.  Obviously the only CHECKSUM_HW I tested was loop :)
Looking at this again it seems that we can optimise it further so
how about this?

[NET]: Fix CHECKSUM_HW GSO problems.

Fix checksum problems in the GSO code path for CHECKSUM_HW packets.

The ipv4 TCP pseudo header checksum has to be adjusted for GSO
segmented packets.

The adjustment is needed because the length field in the pseudo-header
changes.  However, because we have the inequality oldlen  newlen, we
know that delta = (u16)~oldlen + newlen is still a 16-bit quantity.
This also means that htonl(delta) + th-check still fits in 32 bits.
Therefore we don't have to use csum_add on this operations.

This is based on a patch by Michael Chan [EMAIL PROTECTED].

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0e029c4..10f1a8c 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2166,7 +2166,7 @@ struct sk_buff *tcp_tso_segment(struct s
if (!pskb_may_pull(skb, thlen))
goto out;
 
-   oldlen = ~htonl(skb-len);
+   oldlen = (u16)~skb-len;
__skb_pull(skb, thlen);
 
segs = skb_segment(skb, sg);
@@ -2174,7 +2174,7 @@ struct sk_buff *tcp_tso_segment(struct s
goto out;
 
len = skb_shinfo(skb)-gso_size;
-   delta = csum_add(oldlen, htonl(thlen + len));
+   delta = htonl(oldlen + (thlen + len));
 
skb = segs;
th = skb-h.th;
@@ -2183,10 +2183,10 @@ struct sk_buff *tcp_tso_segment(struct s
do {
th-fin = th-psh = 0;
 
-   if (skb-ip_summed == CHECKSUM_NONE) {
-   th-check = csum_fold(csum_partial(
-   skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   th-check = ~csum_fold(th-check + delta);
+   if (skb-ip_summed != CHECKSUM_HW)
+   th-check = csum_fold(csum_partial(skb-h.raw, thlen,
+  skb-csum));
 
seq += len;
skb = skb-next;
@@ -2196,11 +2196,11 @@ struct sk_buff *tcp_tso_segment(struct s
th-cwr = 0;
} while (skb-next);
 
-   if (skb-ip_summed == CHECKSUM_NONE) {
-   delta = csum_add(oldlen, htonl(skb-tail - skb-h.raw));
-   th-check = csum_fold(csum_partial(
-   skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   delta = htonl(oldlen + (skb-tail - skb-h.raw));
+   th-check = ~csum_fold(th-check + delta);
+   if (skb-ip_summed != CHECKSUM_HW)
+   th-check = csum_fold(csum_partial(skb-h.raw, thlen,
+  skb-csum));
 
 out:
return segs;
-
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: Kernel Janitor TODO: dev_kfree_skb

2006-06-23 Thread Herbert Xu
John Daiker [EMAIL PROTECTED] wrote:
 
 The Balancing Function header suggests that all net_device interrupt 
 functions should use dev_kfree_skb_irq as opposed to dev_kfree_skb.
 Should we ever be calling dev_kfree_skb directly, or would the better 
 practice be to always call dev_kfree_skb_any (thus letting the kernel 
 decide to call dev_kfree_skb or dev_kfree_skb_irq)?

It's best if you write code in a way so that you always know whether it's
IRQ context or not.  You should only use dev_kfree_skb_any when you fail
to write code like that.

Now once you've achieved that, then the next objective is to strive to
not have to call kfree_skb in IRQ context at all.  Have a look at the TG3
driver for an example where IRQ context is kept to a minimum.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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: [3/5] [NET]: Add software TSOv4

2006-06-23 Thread Herbert Xu
On Sat, Jun 24, 2006 at 09:38:40AM +1000, herbert wrote:
 
 Good catch.  Obviously the only CHECKSUM_HW I tested was loop :)
 Looking at this again it seems that we can optimise it further so
 how about this?

Nevermind, I obviously complete ignored your other fix to the length of
the last segment :) Here is a fixed version.

[NET]: Fix CHECKSUM_HW GSO problems.

Fix checksum problems in the GSO code path for CHECKSUM_HW packets.

The ipv4 TCP pseudo header checksum has to be adjusted for GSO
segmented packets.

The adjustment is needed because the length field in the pseudo-header
changes.  However, because we have the inequality oldlen  newlen, we
know that delta = (u16)~oldlen + newlen is still a 16-bit quantity.
This also means that htonl(delta) + th-check still fits in 32 bits.
Therefore we don't have to use csum_add on this operations.

This is based on a patch by Michael Chan [EMAIL PROTECTED].

Signed-off-by: Herbert Xu [EMAIL PROTECTED]

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
cfecbf18c32a6dca8954538b5d5fb7186ed336d1
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0e029c4..c04176b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2166,7 +2166,7 @@ struct sk_buff *tcp_tso_segment(struct s
if (!pskb_may_pull(skb, thlen))
goto out;
 
-   oldlen = ~htonl(skb-len);
+   oldlen = (u16)~skb-len;
__skb_pull(skb, thlen);
 
segs = skb_segment(skb, sg);
@@ -2174,7 +2174,7 @@ struct sk_buff *tcp_tso_segment(struct s
goto out;
 
len = skb_shinfo(skb)-gso_size;
-   delta = csum_add(oldlen, htonl(thlen + len));
+   delta = htonl(oldlen + (thlen + len));
 
skb = segs;
th = skb-h.th;
@@ -2183,10 +2183,10 @@ struct sk_buff *tcp_tso_segment(struct s
do {
th-fin = th-psh = 0;
 
-   if (skb-ip_summed == CHECKSUM_NONE) {
-   th-check = csum_fold(csum_partial(
-   skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   th-check = ~csum_fold(th-check + delta);
+   if (skb-ip_summed != CHECKSUM_HW)
+   th-check = csum_fold(csum_partial(skb-h.raw, thlen,
+  skb-csum));
 
seq += len;
skb = skb-next;
@@ -2196,11 +2196,11 @@ struct sk_buff *tcp_tso_segment(struct s
th-cwr = 0;
} while (skb-next);
 
-   if (skb-ip_summed == CHECKSUM_NONE) {
-   delta = csum_add(oldlen, htonl(skb-tail - skb-h.raw));
-   th-check = csum_fold(csum_partial(
-   skb-h.raw, thlen, csum_add(skb-csum, delta)));
-   }
+   delta = htonl(oldlen + (skb-tail - skb-h.raw) + skb-data_len);
+   th-check = ~csum_fold(th-check + delta);
+   if (skb-ip_summed != CHECKSUM_HW)
+   th-check = csum_fold(csum_partial(skb-h.raw, thlen,
+  skb-csum));
 
 out:
return segs;
-
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: [3/5] [NET]: Add software TSOv4

2006-06-23 Thread Michael Chan
On Sat, 2006-06-24 at 09:53 +1000, Herbert Xu wrote:

 Nevermind, I obviously complete ignored your other fix to the length of
 the last segment :) Here is a fixed version.
 
 [NET]: Fix CHECKSUM_HW GSO problems.
 
 Fix checksum problems in the GSO code path for CHECKSUM_HW packets.
 
 The ipv4 TCP pseudo header checksum has to be adjusted for GSO
 segmented packets.
 
 The adjustment is needed because the length field in the pseudo-header
 changes.  However, because we have the inequality oldlen  newlen, we
 know that delta = (u16)~oldlen + newlen is still a 16-bit quantity.
 This also means that htonl(delta) + th-check still fits in 32 bits.
 Therefore we don't have to use csum_add on this operations.
 
 This is based on a patch by Michael Chan [EMAIL PROTECTED].
 
 Signed-off-by: Herbert Xu [EMAIL PROTECTED]
 
Yes, this should work. ACK.


-
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: [0/5] GSO: Generic Segmentation Offload

2006-06-23 Thread Herbert Xu
On Thu, Jun 22, 2006 at 11:28:01PM +0900, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:
 
 Can you measure some with other sizes,
 e.g. 4kByte, 8kByte, 9000Byte?

GSO like TSO is less effective when the MTU is larger.  However, NICs
supporting larger MTUs also support SG.  So the figures I included for
lo should apply.  In those scenarios, GSO is basically on par with the
default segmentation.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
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