Re: Assertions in latest kernels

2008-01-23 Thread Krishna Kumar2
David Miller [EMAIL PROTECTED] wrote on 01/23/2008 01:27:23 PM:

  iperf with multiple threads almost always gets these 4, *especially*
when I
  do some batching :).
 
  static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int
flag)
  {
...
if (WARN_ON(!tp-sacked_out  tp-fackets_out))
  tp-fackets_out = 0;
...
  }

 Does this assertion show up first or do you get the other TCP
 ones first?  It might be important, in that if you get the
 others ones first that corrupted state might be what leads to
 this one.

Hi Dave,

I looked at my *old* messages file and found this assert (2506) was first
to hit (atleast in
two messages file). It hit 5 times, then I got a different one that I had
not reported earlier:

KERNEL: assertion (packets = tp-packets_out) failed at
net/ipv4/tcp_input.c (2139)

(though this was hidden in my report under the panic for tcp_input.c:2528.

Then another two thousand times of the 2506 asserts.

Today I installed the latest untouched kernel, rebooted system and got the
following errors
in sequence, but no 2506 errors (which I have always got when running
batching in the last
2-3 weeks):

Jan 22 02:07:55 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:56 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:56 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:57 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:58 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:59 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:07:59 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:00 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:01 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:01 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:02 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:03 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:03 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:04 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:05 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:06 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:06 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:07 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
Jan 22 02:08:07 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:08 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:09 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:10 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:10 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:11 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:12 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:12 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:13 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:14 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:15 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:15 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
Jan 22 02:08:16 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
Jan 22 02:08:16 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
Jan 22 02:08:17 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:18 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:18 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
Jan 22 02:08:19 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
Jan 22 02:08:19 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169

and so on for another 700 counts.

The unique asserts are:
  1767: tcp_verify_left_out (from tcp_entry_frto)
  2169: tcp_verify_left_out (from tcp_mark_head_lost)
  2528: tcp_verify_left_out (from tcp_fastretrans_alert)
  3063: tcp_verify_left_out (from tcp_process_frto)
(where 2169 seems to preceed any other asserts)

The other two asserts that I got only with batching are:
  2139: BUG_TRAP(packets = tp-packets_out); (in tcp_mark_head_lost)
  2506: WARN_ON(!tp-sacked_out  tp-fackets_out) (in
tcp_fastretrans_alert)
(where 2506 always seems to preceed any other asserts).

thanks,

- KK

--
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.24-rc8-mm1 : net tcp_input.c warnings

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Dave Young wrote:

 On Jan 23, 2008 3:41 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
 
  On Tue, 22 Jan 2008, David Miller wrote:
 
   From: Dave Young [EMAIL PROTECTED]
   Date: Wed, 23 Jan 2008 09:44:30 +0800
  
On Jan 22, 2008 6:47 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
 [PATCH] [TCP]: debug S+L
   
Thanks, If there's new findings I will let you know.
  
   Thanks for helping with this bug Dave.
 
  I noticed btw that there thing might (is likely to) spuriously trigger at
  WARN_ON(sacked != tp-sacked_out); because those won't be equal when SACK
  is not enabled. If that does happen too often, I send a fixed patch for
  it, yet, the fact that I print print tp-rx_opt.sack_ok allows
  identification of those cases already as it's zero when SACK is not
  enabled.
 
  Just ask if you need the updated debug patch.
 
 Thanks,  please send, I would like to get it.

There you go. I fixed non-SACK case by adding tcp_is_sack checks there and 
also added two verifys to tcp_ack to see if there's corruption outside of 
TCP.

-- 
 i.

[PATCH] [TCP]: debug S+L

---
 include/net/tcp.h |8 +++-
 net/ipv4/tcp_input.c  |   10 +
 net/ipv4/tcp_ipv4.c   |  101 +
 net/ipv4/tcp_output.c |   21 +++---
 4 files changed, 133 insertions(+), 7 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7de4ea3..0685035 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -272,6 +272,8 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
 #define TCP_ADD_STATS_BH(field, val)   SNMP_ADD_STATS_BH(tcp_statistics, 
field, val)
 #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, 
field, val)
 
+extern voidtcp_verify_wq(struct sock *sk);
+
 extern voidtcp_v4_err(struct sk_buff *skb, u32);
 
 extern voidtcp_shutdown (struct sock *sk, int how);
@@ -768,7 +770,11 @@ static inline __u32 tcp_current_ssthresh(const struct sock 
*sk)
 }
 
 /* Use define here intentionally to get WARN_ON location shown at the caller */
-#define tcp_verify_left_out(tp)WARN_ON(tcp_left_out(tp)  
tp-packets_out)
+#define tcp_verify_left_out(tp)\
+   do { \
+   WARN_ON(tcp_left_out(tp)  tp-packets_out); \
+   tcp_verify_wq((struct sock *)tp); \
+   } while(0)
 
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fa2c85c..cdacf70 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2645,6 +2645,10 @@ static void tcp_fastretrans_alert(struct sock *sk, int 
pkts_acked, int flag)
if (do_lost || (tcp_is_fack(tp)  tcp_head_timedout(sk)))
tcp_update_scoreboard(sk, fast_rexmit);
tcp_cwnd_down(sk, flag);
+
+   WARN_ON(tcp_write_queue_head(sk) == NULL);
+   WARN_ON(!tp-packets_out);
+
tcp_xmit_retransmit_queue(sk);
 }
 
@@ -2848,6 +2852,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int 
prior_fackets)
tcp_clear_all_retrans_hints(tp);
}
 
+   tcp_verify_left_out(tp);
+
if (skb  (TCP_SKB_CB(skb)-sacked  TCPCB_SACKED_ACKED))
flag |= FLAG_SACK_RENEGING;
 
@@ -3175,6 +3181,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
prior_fackets = tp-fackets_out;
prior_in_flight = tcp_packets_in_flight(tp);
 
+   tcp_verify_left_out(tp);
+
if (!(flag  FLAG_SLOWPATH)  after(ack, prior_snd_una)) {
/* Window is constant, pure forward advance.
 * No more checks are required.
@@ -3237,6 +3245,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
if ((flag  FLAG_FORWARD_PROGRESS) || !(flag  FLAG_NOT_DUP))
dst_confirm(sk-sk_dst_cache);
 
+   tcp_verify_left_out(tp);
+
return 1;
 
 no_queue:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9aea88b..7e8ab40 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -108,6 +108,107 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
.lhash_wait  = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
 };
 
+void tcp_print_queue(struct sock *sk)
+{
+   struct tcp_sock *tp = tcp_sk(sk);
+   struct sk_buff *skb;
+   char s[50+1];
+   char h[50+1];
+   int idx = 0;
+   int i;
+
+   tcp_for_write_queue(skb, sk) {
+   if (skb == tcp_send_head(sk))
+   break;
+
+   for (i = 0; i  tcp_skb_pcount(skb); i++) {
+   if (TCP_SKB_CB(skb)-sacked  TCPCB_SACKED_ACKED) {
+   s[idx] = 'S';
+   if (TCP_SKB_CB(skb)-sacked  TCPCB_LOST)
+   s[idx] = 'B';
+
+   } else if (TCP_SKB_CB(skb)-sacked  

Re: Assertions in latest kernels

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Krishna Kumar2 wrote:

 David Miller [EMAIL PROTECTED] wrote on 01/23/2008 01:27:23 PM:
 
   iperf with multiple threads almost always gets these 4, *especially*
 when I
   do some batching :).
  
   static void tcp_fastretrans_alert(struct sock *sk, int pkts_acked, int
 flag)
   {
 ...
 if (WARN_ON(!tp-sacked_out  tp-fackets_out))
   tp-fackets_out = 0;
 ...
   }
 
  Does this assertion show up first or do you get the other TCP
  ones first?  It might be important, in that if you get the
  others ones first that corrupted state might be what leads to
  this one.
 
 Hi Dave,
 
 I looked at my *old* messages file and found this assert (2506) was first
 to hit (atleast in
 two messages file). It hit 5 times, then I got a different one that I had
 not reported earlier:
 
 KERNEL: assertion (packets = tp-packets_out) failed at
 net/ipv4/tcp_input.c (2139)
 
 (though this was hidden in my report under the panic for tcp_input.c:2528.
 
 Then another two thousand times of the 2506 asserts.
 
 Today I installed the latest untouched kernel, rebooted system and got the
 following errors
 in sequence, but no 2506 errors (which I have always got when running
 batching in the last
 2-3 weeks):
 
 Jan 22 02:07:55 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:56 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:56 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:57 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:58 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:59 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:07:59 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:00 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:01 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:01 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:02 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:03 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:03 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:04 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:05 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:06 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:06 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:07 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
 Jan 22 02:08:07 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:08 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:09 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:10 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:10 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:11 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:12 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:12 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:13 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:14 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:15 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:15 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
 Jan 22 02:08:16 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
 Jan 22 02:08:16 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:1767
 Jan 22 02:08:17 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:18 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:18 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 Jan 22 02:08:19 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2528
 Jan 22 02:08:19 elm3b39 kernel: Badness at net/ipv4/tcp_input.c:2169
 
 and so on for another 700 counts.

 The unique asserts are:
   1767: tcp_verify_left_out (from tcp_entry_frto)
   2169: tcp_verify_left_out (from tcp_mark_head_lost)
   2528: tcp_verify_left_out (from tcp_fastretrans_alert)
   3063: tcp_verify_left_out (from tcp_process_frto)
 (where 2169 seems to preceed any other asserts)

Once you get one of these, you'll get a large number of them, maybe I 
should just change it to WARN_ON_ONCE to stop confusing people with the 
rest.

 The other two asserts that I got only with batching are:
   2139: BUG_TRAP(packets = tp-packets_out); (in tcp_mark_head_lost)
   2506: WARN_ON(!tp-sacked_out  tp-fackets_out) (in
 tcp_fastretrans_alert)
 (where 2506 always seems to preceed any other asserts).

It's almost impossible to know which of these is the main cause and the 
first occuring due to reasons I'll not copy here. What a strange thing
that it has been super quiet on this front until now everybody is seeing 
it, could there be something unrelated to TCP which has broken it all 
recently?

Good thing is that you seem to be able to reproduce it were nicely.
Please try 

Re: [PATCH 12/12 net-2.6.25] [NETNS]: Add namespace for ICMP replying code.

2008-01-23 Thread Mathieu Lacage
hi,

On Tue, 2008-01-22 at 23:51 -0800, David Miller wrote:
 From: Denis V. Lunev [EMAIL PROTECTED]
 Date: Wed, 23 Jan 2008 10:46:27 +0300
 
  All needed API is done, the namespace is available when required from the
  device on the DST entry from the incoming packet. So, just replace init_net
  with proper namespace.
  
  Other protocols will follow.
  
  Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]
 
 Applied, thanks.

I have been following the netns patches on this ML for a while but I
still have not figured out in which tree the patches fed to David Miller
are applied. I have attempted to grep the public trees 'davem/net-2.6'
and 'davem/net-2.6.25' but without much success so far. Is there a
public git tree I can clone which contains all the netns patches which
David Miller state are 'Applied' ?

thank you,
Mathieu

--
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 12/12 net-2.6.25] [NETNS]: Add namespace for ICMP replying code.

2008-01-23 Thread YOSHIFUJI Hideaki / 吉藤英明
In article [EMAIL PROTECTED] (at Wed, 23 Jan 2008 10:16:29 +0100), Mathieu 
Lacage [EMAIL PROTECTED] says:

 I have been following the netns patches on this ML for a while but I
 still have not figured out in which tree the patches fed to David Miller
 are applied. I have attempted to grep the public trees 'davem/net-2.6'
 and 'davem/net-2.6.25' but without much success so far. Is there a
 public git tree I can clone which contains all the netns patches which
 David Miller state are 'Applied' ?

I'm cloning from
git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25.git

There may be some time-lag.

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


2.6.24-rc8 ppp regression

2008-01-23 Thread maximilian attems

when killing a wvdial usb modem session:

Jan 22 23:23:03 dual pppd[7941]: Terminating on signal 15
Jan 22 23:23:03 dual pppd[7941]: Connect time 92.2 minutes.
Jan 22 23:23:03 dual pppd[7941]: Sent 1322316 bytes, received 8587156 bytes.
Jan 22 23:23:03 dual pppd[7941]: Connection terminated.
Jan 22 23:23:05 dual kernel: usb 3-2: USB disconnect, address 5
Jan 22 23:23:05 dual kernel: option 3-2:1.0: device disconnected
Jan 22 23:23:05 dual kernel: option1 ttyUSB1: GSM modem (1-port) converter now 
disconnected from ttyUSB1
Jan 22 23:23:05 dual kernel: option 3-2:1.1: device disconnected
Jan 22 23:23:13 dual kernel: unregister_netdevice: waiting for ppp0 to become 
free. Usage count = 1
Jan 22 23:23:44 dual last message repeated 3 times
Jan 22 23:23:54 dual kernel: unregister_netdevice: waiting for ppp0 to become 
free. Usage count = 1


2.6.24-rc7 works fine, not yet bisected, will do later in the evening.

-- 
maks
--
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: Assertions in latest kernels

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Krishna Kumar2 wrote:

 Hi Ilpo,
 
  It's almost impossible to know which of these is the main cause and the
  first occuring due to reasons I'll not copy here. What a strange thing
  that it has been super quiet on this front until now everybody is seeing
  it, could there be something unrelated to TCP which has broken it all
  recently?
 
 I have been getting this for atleast 3 weeks but I was quiet since those
 were kernels that I had modified.

Since you can easily reproduce it, lets just figure out what's causing it 
hard way, rather than digging the endless git-logs... :-)

  Good thing is that you seem to be able to reproduce it were nicely.
  Please try with this beauty below... Hopefully got it correctly matching
  to mainline, in contrast to version I sent Dave Y., there's some added
  candy which catches highest_sack corruption as well, at least it compiles
 
  already :-).
 
 There were couple of patch apply failures in .c files which I fixed by
 hand.
 But when compiling, I got these errors (I am using DM's 2.6.24-rc7 kernel,
 net-2.6.25.git):

Well, that's annoying, you didn't mention net-2.6.25 back then, it sure 
is incompatible with it like already the patch title said... :-)


 net/ipv4/tcp_output.c: In function 'tcp_push_one':
 net/ipv4/tcp_output.c:1573: error: 'tp' undeclared (first use in this
 function)
 net/ipv4/tcp_output.c:1573: error: (Each undeclared identifier is reported
 only once
 net/ipv4/tcp_output.c:1573: error: for each function it appears in.)

...This is either due to mismerge or due your modifications.

Lets re-iterate, compiled ok for me tcp_{ipv4,input,output}.o...


-- 
 i.

[PATCH] [TCP]: debug S+L (for net-2.5.26 / mm, incompatible with mainline)

---
 include/net/tcp.h |8 +++-
 net/ipv4/tcp_input.c  |   10 +
 net/ipv4/tcp_ipv4.c   |  107 +
 net/ipv4/tcp_output.c |   21 +++---
 4 files changed, 139 insertions(+), 7 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 7de4ea3..0685035 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -272,6 +272,8 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
 #define TCP_ADD_STATS_BH(field, val)   SNMP_ADD_STATS_BH(tcp_statistics, 
field, val)
 #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, 
field, val)
 
+extern voidtcp_verify_wq(struct sock *sk);
+
 extern voidtcp_v4_err(struct sk_buff *skb, u32);
 
 extern voidtcp_shutdown (struct sock *sk, int how);
@@ -768,7 +770,11 @@ static inline __u32 tcp_current_ssthresh(const struct sock 
*sk)
 }
 
 /* Use define here intentionally to get WARN_ON location shown at the caller */
-#define tcp_verify_left_out(tp)WARN_ON(tcp_left_out(tp)  
tp-packets_out)
+#define tcp_verify_left_out(tp)\
+   do { \
+   WARN_ON(tcp_left_out(tp)  tp-packets_out); \
+   tcp_verify_wq((struct sock *)tp); \
+   } while(0)
 
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
 extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index fa2c85c..cdacf70 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2645,6 +2645,10 @@ static void tcp_fastretrans_alert(struct sock *sk, int 
pkts_acked, int flag)
if (do_lost || (tcp_is_fack(tp)  tcp_head_timedout(sk)))
tcp_update_scoreboard(sk, fast_rexmit);
tcp_cwnd_down(sk, flag);
+
+   WARN_ON(tcp_write_queue_head(sk) == NULL);
+   WARN_ON(!tp-packets_out);
+
tcp_xmit_retransmit_queue(sk);
 }
 
@@ -2848,6 +2852,8 @@ static int tcp_clean_rtx_queue(struct sock *sk, int 
prior_fackets)
tcp_clear_all_retrans_hints(tp);
}
 
+   tcp_verify_left_out(tp);
+
if (skb  (TCP_SKB_CB(skb)-sacked  TCPCB_SACKED_ACKED))
flag |= FLAG_SACK_RENEGING;
 
@@ -3175,6 +3181,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
prior_fackets = tp-fackets_out;
prior_in_flight = tcp_packets_in_flight(tp);
 
+   tcp_verify_left_out(tp);
+
if (!(flag  FLAG_SLOWPATH)  after(ack, prior_snd_una)) {
/* Window is constant, pure forward advance.
 * No more checks are required.
@@ -3237,6 +3245,8 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, 
int flag)
if ((flag  FLAG_FORWARD_PROGRESS) || !(flag  FLAG_NOT_DUP))
dst_confirm(sk-sk_dst_cache);
 
+   tcp_verify_left_out(tp);
+
return 1;
 
 no_queue:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 9aea88b..c95682e 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -108,6 +108,113 @@ struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
.lhash_wait  = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
 };
 
+void tcp_print_queue(struct sock *sk)

Re: [PATCH] pci-skeleton: Misc fixes to build neatly

2008-01-23 Thread Jeff Garzik

Jike Song wrote:

Hello Jeff,

The pci-skeleton.c has several problems with compilation, such as missing args
when calling synchronize_irq(). Fix it.

Signed-off-by: Jike Song [EMAIL PROTECTED]
---
 drivers/net/pci-skeleton.c |   49 ++-
 1 files changed, 25 insertions(+), 24 deletions(-)


ACK but git-am (everybody's patch import tool) says the patch is corrupted


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


[git patches] net driver fixes

2008-01-23 Thread Jeff Garzik

Francois noted that these warranted promotion from net-2.6.25.git to
current 2.6.24-rc.

NOTE:  These changesets were cherry-picked from net-2.6.25, without any
modifications.  Any future rebase or merge should hopefully notice this
automatically.



Please pull from 'upstream-davem' branch of
master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
upstream-davem

to receive the following updates:

 drivers/net/sis190.c |   21 ++---
 1 files changed, 10 insertions(+), 11 deletions(-)

Francois Romieu (4):
  sis190: add cmos ram access code for the SiS19x/968 chipset pair
  sis190: remove duplicate INIT_WORK
  sis190: mdio operation failure is not correctly detected
  sis190: scheduling while atomic error

diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index 7eab072..b570402 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -372,7 +372,7 @@ static void __mdio_cmd(void __iomem *ioaddr, u32 ctl)
msleep(1);
}
 
-   if (i  999)
+   if (i  99)
printk(KERN_ERR PFX PHY command failed !\n);
 }
 
@@ -847,10 +847,8 @@ static void sis190_soft_reset(void __iomem *ioaddr)
 {
SIS_W32(IntrControl, 0x8000);
SIS_PCI_COMMIT();
-   msleep(1);
SIS_W32(IntrControl, 0x0);
sis190_asic_down(ioaddr);
-   msleep(1);
 }
 
 static void sis190_hw_start(struct net_device *dev)
@@ -1041,8 +1039,6 @@ static int sis190_open(struct net_device *dev)
if (rc  0)
goto err_free_rx_1;
 
-   INIT_WORK(tp-phy_task, sis190_phy_task);
-
sis190_request_timer(dev);
 
rc = request_irq(dev-irq, sis190_interrupt, IRQF_SHARED, dev-name, 
dev);
@@ -1549,28 +1545,31 @@ static int __devinit 
sis190_get_mac_addr_from_eeprom(struct pci_dev *pdev,
 }
 
 /**
- * sis190_get_mac_addr_from_apc - Get MAC address for SiS965 model
+ * sis190_get_mac_addr_from_apc - Get MAC address for SiS96x model
  * @pdev: PCI device
  * @dev:  network device to get address for
  *
- * SiS965 model, use APC CMOS RAM to store MAC address.
+ * SiS96x model, use APC CMOS RAM to store MAC address.
  * APC CMOS RAM is accessed through ISA bridge.
  * MAC address is read into @net_dev-dev_addr.
  */
 static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
  struct net_device *dev)
 {
+   static const u16 __devinitdata ids[] = { 0x0965, 0x0966, 0x0968 };
struct sis190_private *tp = netdev_priv(dev);
struct pci_dev *isa_bridge;
u8 reg, tmp8;
-   int i;
+   unsigned int i;
 
net_probe(tp, KERN_INFO %s: Read MAC address from APC.\n,
  pci_name(pdev));
 
-   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL);
-   if (!isa_bridge)
-   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL);
+   for (i = 0; i  ARRAY_SIZE(ids); i++) {
+   isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, ids[i], NULL);
+   if (isa_bridge)
+   break;
+   }
 
if (!isa_bridge) {
net_probe(tp, KERN_INFO %s: Can not find ISA bridge.\n,
--
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] pci-skeleton: Misc fixes to build neatly

2008-01-23 Thread Jike Song
On 1/23/08, Jeff Garzik [EMAIL PROTECTED] wrote:

 ACK but git-am (everybody's patch import tool) says the patch is corrupted

Hi Jeff,

Thank you very much for your acknowledgement!  This is my first patch
for Linux kernel, sorry for the corruption.  I'll resend it ASAP.

Regards,
Jike
--
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: Assertions in latest kernels

2008-01-23 Thread Krishna Kumar2
[EMAIL PROTECTED] wrote on 01/23/2008 03:23:24 PM:

  There were couple of patch apply failures in .c files which I fixed by
  hand.
  But when compiling, I got these errors (I am using DM's 2.6.24-rc7
kernel,
  net-2.6.25.git):

 Well, that's annoying, you didn't mention net-2.6.25 back then, it sure
 is incompatible with it like already the patch title said... :-)

I did mention that in my first mail:

Bits are unmodified 2.6.24-rc7 bits downloaded today (Jan 23rd).

I tried it hoping it would not change a lot, but it didn't work
obviously :)

 ...This is either due to mismerge or due your modifications.

Again, it was due to wrong patch bits (to reiterate, I am using
unmodified bits without any modifications), but let's move ahead.
Your patch in this mail applied cleanly for me, and I am compiling
now.

- KK

--
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.24-rc8 ppp regression

2008-01-23 Thread Ben Hutchings
maximilian attems wrote:
 
 when killing a wvdial usb modem session:
 
 Jan 22 23:23:03 dual pppd[7941]: Terminating on signal 15
 Jan 22 23:23:03 dual pppd[7941]: Connect time 92.2 minutes.
 Jan 22 23:23:03 dual pppd[7941]: Sent 1322316 bytes, received 8587156 bytes.
 Jan 22 23:23:03 dual pppd[7941]: Connection terminated.
 Jan 22 23:23:05 dual kernel: usb 3-2: USB disconnect, address 5
 Jan 22 23:23:05 dual kernel: option 3-2:1.0: device disconnected
 Jan 22 23:23:05 dual kernel: option1 ttyUSB1: GSM modem (1-port) converter 
 now disconnected from ttyUSB1
 Jan 22 23:23:05 dual kernel: option 3-2:1.1: device disconnected
 Jan 22 23:23:13 dual kernel: unregister_netdevice: waiting for ppp0 to become 
 free. Usage count = 1
 Jan 22 23:23:44 dual last message repeated 3 times
 Jan 22 23:23:54 dual kernel: unregister_netdevice: waiting for ppp0 to become 
 free. Usage count = 1

This is a known bug which doesn't just affect PPP:
http://bugzilla.kernel.org/show_bug.cgi?id=9778.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
--
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: Assertions in latest kernels

2008-01-23 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 11:17:05 +0200 (EET)

 What a strange thing that it has been super quiet on this front
 until now everybody is seeing it, could there be something unrelated
 to TCP which has broken it all recently?

I think it is simply capture effect.

One person reports the problem, and then others see it and
say me too because they were previously too busy to report
their instance of the problem.

Another thing is that a developer is sometimes working on something
and they do not want to pollute the bug reporting if the code they are
writing is what is causing the bug via some indirect corruptions or
whatever :-)
--
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.6.25 1/1]S2io: Multiqueue network device support implementation

2008-01-23 Thread Andi Kleen
Sreenivasa Honnur [EMAIL PROTECTED] writes:

 Multiqueue netwrok device support implementation.
 - Added a loadable parameter multiq to enable/disable multiqueue support,
   by default it is disabled.
 - skb-queue_mapping is not used for queue/fifo selection. FIFO iselection is
   based on IP-TOS value, 0x0-0xF TOS values are mapped to 8 FIFOs.

Standard way to use that would be using skb-priority

But I'm surprised you bother with TOS for multi queues at all. TOS
isn't a too important mechanism.

I would have thought the primary use case would be per CPU TX completion
interrupts. With that the queue should be selected based on
the the current CPU.

-Andi
--
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.24-rc8 ppp regression

2008-01-23 Thread David Miller
From: maximilian attems [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 10:35:09 +0100

 Jan 22 23:23:54 dual kernel: unregister_netdevice: waiting for ppp0 to become 
 free. Usage count = 1

Already fixed by:

[NEIGH]: Revert 'Fix race between neigh_parms_release and neightbl_fill_parms'

Commit 9cd40029423701c376391da59d2c6469672b4bed (Fix race between
neigh_parms_release and neightbl_fill_parms) introduced device
reference counting regressions for several people, see:

http://bugzilla.kernel.org/show_bug.cgi?id=9778

for example.

Signed-off-by: David S. Miller [EMAIL PROTECTED]

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index cc8a2f1..29b8ee4 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1316,6 +1316,8 @@ void neigh_parms_release(struct neigh_table *tbl, struct 
neigh_parms *parms)
*p = parms-next;
parms-dead = 1;
write_unlock_bh(tbl-lock);
+   if (parms-dev)
+   dev_put(parms-dev);
call_rcu(parms-rcu_head, neigh_rcu_free_parms);
return;
}
@@ -1326,8 +1328,6 @@ void neigh_parms_release(struct neigh_table *tbl, struct 
neigh_parms *parms)
 
 void neigh_parms_destroy(struct neigh_parms *parms)
 {
-   if (parms-dev)
-   dev_put(parms-dev);
kfree(parms);
 }
 
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [git patches] net driver fixes

2008-01-23 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 05:05:18 -0500

 master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git 
 upstream-davem

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


Re: 2.6.24-rc8-mm1 : net tcp_input.c warnings

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Ilpo Järvinen wrote:

 On Wed, 23 Jan 2008, Dave Young wrote:
 
  On Jan 23, 2008 3:41 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
  
   On Tue, 22 Jan 2008, David Miller wrote:
  
From: Dave Young [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 09:44:30 +0800
   
 On Jan 22, 2008 6:47 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
  [PATCH] [TCP]: debug S+L

 Thanks, If there's new findings I will let you know.
   
Thanks for helping with this bug Dave.
  
   I noticed btw that there thing might (is likely to) spuriously trigger at
   WARN_ON(sacked != tp-sacked_out); because those won't be equal when SACK
   is not enabled. If that does happen too often, I send a fixed patch for
   it, yet, the fact that I print print tp-rx_opt.sack_ok allows
   identification of those cases already as it's zero when SACK is not
   enabled.
  
   Just ask if you need the updated debug patch.
  
  Thanks,  please send, I would like to get it.
 
 There you go. I fixed non-SACK case by adding tcp_is_sack checks there and 
 also added two verifys to tcp_ack to see if there's corruption outside of 
 TCP.

There's some discussion about a problem that is very likely the same as in 
here (sorry for not remembering to cc you in there due to rapid progress):

   http://marc.info/?t=12010717423r=1w=2


-- 
 i.

Re: 2.6.24-rc8 ppp regression

2008-01-23 Thread maximilian attems
On Wed, Jan 23, 2008 at 02:58:54AM -0800, David Miller wrote:
 From: maximilian attems [EMAIL PROTECTED]
 Date: Wed, 23 Jan 2008 10:35:09 +0100
 
  Jan 22 23:23:54 dual kernel: unregister_netdevice: waiting for ppp0 to 
  become free. Usage count = 1
 
 Already fixed by:
 

thanks.

-- 
maks
--
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: Assertions in latest kernels

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Ilpo Järvinen wrote:

 On Wed, 23 Jan 2008, Krishna Kumar2 wrote:
 
  Hi Ilpo,
  
   It's almost impossible to know which of these is the main cause and the
   first occuring due to reasons I'll not copy here. What a strange thing
   that it has been super quiet on this front until now everybody is seeing
   it, could there be something unrelated to TCP which has broken it all
   recently?
  
  I have been getting this for atleast 3 weeks but I was quiet since those
  were kernels that I had modified.
 
 Since you can easily reproduce it, lets just figure out what's causing it 
 hard way, rather than digging the endless git-logs... :-)

Hmm, perhaps it could be something related to this (and some untested 
path somewhere which is now exposed):

commit 4a55b553f691abadaa63570dfc714e20913561c1
Author: Ilpo Järvinen [EMAIL PROTECTED]
Date:   Thu Dec 20 20:36:03 2007 -0800

[TCP]: Fix TSO deferring

Dave, what do you think? Wouldn't explain the one -rc only report though 
from Denys. Another one I'm a bit unsure of is this:

commit 757c32944b80fd95542bd66f06032ab773034d53
Author: Ilpo Järvinen [EMAIL PROTECTED]
Date:   Thu Jan 3 20:39:01 2008 -0800

[TCP]: Perform setting of common control fields in one place

-sacked field is cleared in tcp_retransmit_skb due to a subtle change, 
which might be buggy However, I find it rather unlikely that this 
would explain Kumar's case. Anyway, here's the one that reverts the 
problematic part of it. ...and this is net-2.6.25 as well so it won't 
solve Denys' case either.

-- 
 i.

--
[PATCH] [TCP]: Revert part of [TCP]: Perform setting of common control...

This commit reverts part of 757c32944b80fd95542bd66f06032ab773034d53
([TCP]: Perform setting of common control fields in one place)
because it's not valid to clear -sacked field like that without
additional precautions with counters, mostly lost_out, sacked_out
should not be set due to reneging which kicks in much earlier than
this.

Signed-off-by: Ilpo Järvinen [EMAIL PROTECTED]
---
 net/ipv4/tcp_output.c |8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 648340f..f6cbc1f 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -1887,10 +1887,12 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff 
*skb)
(TCP_SKB_CB(skb)-flags  TCPCB_FLAG_FIN) 
tp-snd_una == (TCP_SKB_CB(skb)-end_seq - 1)) {
if (!pskb_trim(skb, 0)) {
-   /* Reuse, even though it does some unnecessary work */
-   tcp_init_nondata_skb(skb, TCP_SKB_CB(skb)-end_seq - 1,
-TCP_SKB_CB(skb)-flags);
+   TCP_SKB_CB(skb)-seq = TCP_SKB_CB(skb)-end_seq - 1;
+   skb_shinfo(skb)-gso_segs = 1;
+   skb_shinfo(skb)-gso_size = 0;
+   skb_shinfo(skb)-gso_type = 0;
skb-ip_summed = CHECKSUM_NONE;
+   skb-csum = 0;
}
}
 
-- 
1.5.2.2


Re: pull request: wireless-2.6 'upstream' 2008-01-22

2008-01-23 Thread Stefano Brivio
On Tue, 22 Jan 2008 20:45:21 -0500
John W. Linville [EMAIL PROTECTED] wrote:

   b43legacy: Remove the PHY spinlock

I hope you tested this. I still haven't been able to (I received the
needed hardware yesterday), and Michael said that the patch has been
compile-tested only.


-- 
Ciao
Stefano
--
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: pull request: wireless-2.6 'upstream' 2008-01-22

2008-01-23 Thread Michael Buesch
On Wednesday 23 January 2008 12:15:51 Stefano Brivio wrote:
 On Tue, 22 Jan 2008 20:45:21 -0500
 John W. Linville [EMAIL PROTECTED] wrote:
 
b43legacy: Remove the PHY spinlock
 
 I hope you tested this. I still haven't been able to (I received the
 needed hardware yesterday), and Michael said that the patch has been
 compile-tested only.

John, if we use subject lines such as:

[PATCH RFT] foobar: bizbaz

That means the patch is _not_ submitted for inclusion, yet.
The RFT means Request-For-Testing. Ususally, if I send out such
patches, they are completely untested. I usually compiletest them,
but that's it.
But in future I can also put a comment into the mailbody that
explains why to not apply it, yet.

For this particular patch, please leave it in now. I'm pretty
sure it is correct. So actual testing will be done upstream now. ;)

-- 
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: Assertions in latest kernels

2008-01-23 Thread David Miller
From: Ilpo_Järvinen [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 12:49:31 +0200 (EET)

 On Wed, 23 Jan 2008, Ilpo Järvinen wrote:
 
 Hmm, perhaps it could be something related to this (and some untested 
 path somewhere which is now exposed):
 
 commit 4a55b553f691abadaa63570dfc714e20913561c1
 Author: Ilpo Järvinen [EMAIL PROTECTED]
 Date:   Thu Dec 20 20:36:03 2007 -0800
 
 [TCP]: Fix TSO deferring
 
 Dave, what do you think? Wouldn't explain the one -rc only report though 
 from Denys. Another one I'm a bit unsure of is this:

Right, this would be something to consider for the net-2.6.25
and thus -mm cases, but not for 2.6.24* since this patch didn't
go there.

I don't see how this change could matter offhand.  Even with that
incorrect TSO test, the same set of write queue configurations can
still occur just some less likely than after the patch.

I would expect the usual global test coverage to narrow that gap.

 commit 757c32944b80fd95542bd66f06032ab773034d53
 Author: Ilpo Järvinen [EMAIL PROTECTED]
 Date:   Thu Jan 3 20:39:01 2008 -0800
 
 [TCP]: Perform setting of common control fields in one place
 
 -sacked field is cleared in tcp_retransmit_skb due to a subtle change, 
 which might be buggy However, I find it rather unlikely that this 
 would explain Kumar's case. Anyway, here's the one that reverts the 
 problematic part of it. ...and this is net-2.6.25 as well so it won't 
 solve Denys' case either.

I also suspect this one isn't the cause.

I think we'll be better off once we get some more data,
and therefore be able to make more correlations between
the various failures.

Anyways your patch here is a good start as it will provable
eliminate this as a possibility.
--
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.24-rc8 ppp regression

2008-01-23 Thread Evgeniy Polyakov
On Wed, Jan 23, 2008 at 10:35:09AM +0100, maximilian attems ([EMAIL PROTECTED]) 
wrote:
 Jan 22 23:23:13 dual kernel: unregister_netdevice: waiting for ppp0 to become 
 free. Usage count = 1
 Jan 22 23:23:44 dual last message repeated 3 times
 Jan 22 23:23:54 dual kernel: unregister_netdevice: waiting for ppp0 to become 
 free. Usage count = 1
 
 2.6.24-rc7 works fine, not yet bisected, will do later in the evening.

Fix (revert) is in Dave's tree already.

-- 
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: Assertions in latest kernels

2008-01-23 Thread Ilpo Järvinen
On Wed, 23 Jan 2008, Krishna Kumar2 wrote:

 While running with this patch, I got these errors (pasted at the end
 of this mail).

I don't have a clue why it didn't go to the checking func (or it didn't 
print anything) but just had those WARN_ONs... Hopefully this is giving 
somewhat better input (applies on top of the other debug patch).

--
 i.

[PATCH] [TCP]: more debug

---
 include/net/tcp.h|3 ++-
 net/ipv4/tcp_input.c |9 -
 net/ipv4/tcp_ipv4.c  |   19 ++-
 3 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0685035..129c3b1 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -272,6 +272,7 @@ DECLARE_SNMP_STAT(struct tcp_mib, tcp_statistics);
 #define TCP_ADD_STATS_BH(field, val)   SNMP_ADD_STATS_BH(tcp_statistics, 
field, val)
 #define TCP_ADD_STATS_USER(field, val) SNMP_ADD_STATS_USER(tcp_statistics, 
field, val)
 
+extern void tcp_print_queue(struct sock *sk);
 extern voidtcp_verify_wq(struct sock *sk);
 
 extern voidtcp_v4_err(struct sk_buff *skb, u32);
@@ -772,8 +773,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock 
*sk)
 /* Use define here intentionally to get WARN_ON location shown at the caller */
 #define tcp_verify_left_out(tp)\
do { \
-   WARN_ON(tcp_left_out(tp)  tp-packets_out); \
tcp_verify_wq((struct sock *)tp); \
+   WARN_ON(tcp_left_out(tp)  tp-packets_out); \
} while(0)
 
 extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cdacf70..295490e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2133,12 +2133,15 @@ static void tcp_verify_retransmit_hint(struct tcp_sock 
*tp, struct sk_buff *skb)
 static void tcp_mark_head_lost(struct sock *sk, int packets, int fast_rexmit)
 {
struct tcp_sock *tp = tcp_sk(sk);
-   struct sk_buff *skb;
+   struct sk_buff *skb, *prev = NULL;
int cnt;
 
+   tcp_verify_left_out(tp);
+
BUG_TRAP(packets = tp-packets_out);
if (tp-lost_skb_hint) {
skb = tp-lost_skb_hint;
+   prev = skb;
cnt = tp-lost_cnt_hint;
} else {
skb = tcp_write_queue_head(sk);
@@ -2166,6 +2169,10 @@ static void tcp_mark_head_lost(struct sock *sk, int 
packets, int fast_rexmit)
tcp_verify_retransmit_hint(tp, skb);
}
}
+   if (tcp_left_out(tp)  tp-packets_out) {
+   printk(KERN_ERR Prev hint: %p, exit %p\n, prev, skb);
+   tcp_print_queue(sk);
+   }
tcp_verify_left_out(tp);
 }
 
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index c95682e..c2a88c5 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -117,6 +117,15 @@ void tcp_print_queue(struct sock *sk)
int idx = 0;
int i;
 
+   i = 0;
+   tcp_for_write_queue(skb, sk) {
+   if (skb == tcp_send_head(sk))
+   printk(KERN_ERR head %u %p\n, i, skb);
+   else
+   printk(KERN_ERR skb %u %p\n, i, skb);
+   i++;
+   }
+
tcp_for_write_queue(skb, sk) {
if (skb == tcp_send_head(sk))
break;
@@ -195,11 +204,6 @@ void tcp_verify_wq(struct sock *sk)
packets += tcp_skb_pcount(skb);
}
 
-   WARN_ON(lost != tp-lost_out);
-   WARN_ON(tcp_is_sack(tp)  (sacked != tp-sacked_out));
-   WARN_ON(packets != tp-packets_out);
-   WARN_ON(fackets != tp-fackets_out);
-
if ((lost != tp-lost_out) ||
(tcp_is_sack(tp)  (sacked != tp-sacked_out)) ||
(packets != tp-packets_out) ||
@@ -213,6 +217,11 @@ void tcp_verify_wq(struct sock *sk)
tp-rx_opt.sack_ok);
tcp_print_queue(sk);
}
+
+   WARN_ON(lost != tp-lost_out);
+   WARN_ON(tcp_is_sack(tp)  (sacked != tp-sacked_out));
+   WARN_ON(packets != tp-packets_out);
+   WARN_ON(fackets != tp-fackets_out);
 }
 
 static int tcp_v4_get_port(struct sock *sk, unsigned short snum)
-- 
1.5.2.2

--
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] Introducing socket mark socket option

2008-01-23 Thread Laszlo Attila Toth
A userspace program may wish to set the mark for each packets its send
without using the netfilter MARK target. Changing the mark can be used
mark based routing without netfilter or for packet filtering.

It requires CAP_NET_ADMIN capability.

Signed-off-by: Laszlo Attila Toth [EMAIL PROTECTED]
---
 include/asm-alpha/socket.h|2 ++
 include/asm-arm/socket.h  |2 ++
 include/asm-avr32/socket.h|2 ++
 include/asm-blackfin/socket.h |3 +++
 include/asm-cris/socket.h |2 ++
 include/asm-frv/socket.h  |2 ++
 include/asm-h8300/socket.h|2 ++
 include/asm-ia64/socket.h |2 ++
 include/asm-m32r/socket.h |2 ++
 include/asm-m68k/socket.h |2 ++
 include/asm-mips/socket.h |2 ++
 include/asm-parisc/socket.h   |2 ++
 include/asm-powerpc/socket.h  |2 ++
 include/asm-s390/socket.h |2 ++
 include/asm-sh/socket.h   |2 ++
 include/asm-sparc/socket.h|2 ++
 include/asm-sparc64/socket.h  |1 +
 include/asm-v850/socket.h |2 ++
 include/asm-x86/socket.h  |2 ++
 include/asm-xtensa/socket.h   |2 ++
 include/net/route.h   |2 ++
 include/net/sock.h|2 ++
 net/core/sock.c   |   11 +++
 net/ipv4/icmp.c   |1 +
 net/ipv4/ip_output.c  |3 +++
 net/ipv4/raw.c|2 ++
 26 files changed, 61 insertions(+), 0 deletions(-)

diff --git a/include/asm-alpha/socket.h b/include/asm-alpha/socket.h
index 1fede7f..08c9793 100644
--- a/include/asm-alpha/socket.h
+++ b/include/asm-alpha/socket.h
@@ -60,4 +60,6 @@
 #define SO_SECURITY_ENCRYPTION_TRANSPORT   20
 #define SO_SECURITY_ENCRYPTION_NETWORK 21
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm/socket.h b/include/asm-arm/socket.h
index 65a1a64..6817be9 100644
--- a/include/asm-arm/socket.h
+++ b/include/asm-arm/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-avr32/socket.h b/include/asm-avr32/socket.h
index a0d0507..35863f2 100644
--- a/include/asm-avr32/socket.h
+++ b/include/asm-avr32/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* __ASM_AVR32_SOCKET_H */
diff --git a/include/asm-blackfin/socket.h b/include/asm-blackfin/socket.h
index 5213c96..2ca702e 100644
--- a/include/asm-blackfin/socket.h
+++ b/include/asm-blackfin/socket.h
@@ -50,4 +50,7 @@
 #define SO_PASSSEC 34
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
+
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-cris/socket.h b/include/asm-cris/socket.h
index 5b18dfd..9df0ca8 100644
--- a/include/asm-cris/socket.h
+++ b/include/asm-cris/socket.h
@@ -54,6 +54,8 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
 
 
diff --git a/include/asm-frv/socket.h b/include/asm-frv/socket.h
index a823bef..e51ca67 100644
--- a/include/asm-frv/socket.h
+++ b/include/asm-frv/socket.h
@@ -52,5 +52,7 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
 
diff --git a/include/asm-h8300/socket.h b/include/asm-h8300/socket.h
index 39911d8..da2520d 100644
--- a/include/asm-h8300/socket.h
+++ b/include/asm-h8300/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git a/include/asm-ia64/socket.h b/include/asm-ia64/socket.h
index 9e42ce4..d5ef0aa 100644
--- a/include/asm-ia64/socket.h
+++ b/include/asm-ia64/socket.h
@@ -61,4 +61,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_IA64_SOCKET_H */
diff --git a/include/asm-m32r/socket.h b/include/asm-m32r/socket.h
index 793d5d3..9a0e200 100644
--- a/include/asm-m32r/socket.h
+++ b/include/asm-m32r/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_M32R_SOCKET_H */
diff --git a/include/asm-m68k/socket.h b/include/asm-m68k/socket.h
index 6d21b90..dbc64e9 100644
--- a/include/asm-m68k/socket.h
+++ b/include/asm-m68k/socket.h
@@ -52,4 +52,6 @@
 #define SO_TIMESTAMPNS 35
 #define SCM_TIMESTAMPNSSO_TIMESTAMPNS
 
+#define SO_MARK36
+
 #endif /* _ASM_SOCKET_H */
diff --git 

Re: pull request: wireless-2.6 'upstream' 2008-01-22

2008-01-23 Thread John W. Linville
On Wed, Jan 23, 2008 at 12:15:51PM +0100, Stefano Brivio wrote:
 On Tue, 22 Jan 2008 20:45:21 -0500
 John W. Linville [EMAIL PROTECTED] wrote:
 
b43legacy: Remove the PHY spinlock
 
 I hope you tested this. I still haven't been able to (I received the
 needed hardware yesterday), and Michael said that the patch has been
 compile-tested only.

Larry said it worked for him.

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


Re: pull request: wireless-2.6 'upstream' 2008-01-22

2008-01-23 Thread John W. Linville
On Wed, Jan 23, 2008 at 12:30:07PM +0100, Michael Buesch wrote:
 On Wednesday 23 January 2008 12:15:51 Stefano Brivio wrote:
  On Tue, 22 Jan 2008 20:45:21 -0500
  John W. Linville [EMAIL PROTECTED] wrote:
  
 b43legacy: Remove the PHY spinlock
  
  I hope you tested this. I still haven't been able to (I received the
  needed hardware yesterday), and Michael said that the patch has been
  compile-tested only.
 
 John, if we use subject lines such as:
 
 [PATCH RFT] foobar: bizbaz
 
 That means the patch is _not_ submitted for inclusion, yet.
 The RFT means Request-For-Testing. Ususally, if I send out such

Thanks, I'm well aware.

Larry said he tested it, two weeks ago.  No one contradicted it.
And time is short for new development for 2.6.25 -- but there is
plenty of time for fixes. :-)

 For this particular patch, please leave it in now. I'm pretty
 sure it is correct. So actual testing will be done upstream now. ;)

Exactly.

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


Re: [PATCH 2.6.23+] ingress classify to [nf]mark

2008-01-23 Thread Dzianis Kahanovich

Too many pixels to smoke. Sorry.

May be so? ;)) (if undefined classid not overwrited by random value tc_classify)
Even tc say to classid=0 - 

--- 1/net/sched/sch_ingress.c   2008-01-12 17:27:05.0 +0200
+++ 2/net/sched/sch_ingress.c   2008-01-22 22:09:32.0 +0200
@@ -136,6 +136,9 @@
struct ingress_qdisc_data *p = PRIV(sch);
struct tcf_result res;
int result;
+#ifdef CONFIG_NET_SCH_INGRESS_TC2MARK
+   res.classid=0;
+#endif

D2PRINTK(ingress_enqueue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
result = tc_classify(skb, p-filter_list, res);
@@ -169,6 +172,11 @@
sch-bstats.packets++;
sch-bstats.bytes += skb-len;
 #endif
+#ifdef CONFIG_NET_SCH_INGRESS_TC2MARK
+   if(res.classid)
+   skb-mark =
(skb-mark(res.classid16))|(skb-tc_index=TC_H_MIN(res.classid));
+// skb-mark=res.classid; /* or just so */
+#endif

return result;
 }



jamal wrote:

[skipped]

--
WBR,
Denis Kaganovich,  [EMAIL PROTECTED]  http://mahatma.bspu.unibel.by

--
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: [Cbe-oss-dev] [PATCH 1/5] spidernet: add missing initialization

2008-01-23 Thread Jens Osterkamp
On Friday 11 January 2008, Ishizaki Kou wrote:
 This patch fixes initialization of aneg_count and medium fields in
 spider_net_card to make spidernet driver correctly sets link status.
 
 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Jens Osterkamp [EMAIL PROTECTED]

 ---
 
 Index: linux-powerpc-git/drivers/net/spider_net.c
 ===
 --- linux-powerpc-git.orig/drivers/net/spider_net.c
 +++ linux-powerpc-git/drivers/net/spider_net.c
 @@ -1399,6 +1399,8 @@ spider_net_link_reset(struct net_device 
   spider_net_write_reg(card, SPIDER_NET_GMACINTEN, 0);
 
   /* reset phy and setup aneg */
 + card-aneg_count = 0;
 + card-medium = BCM54XX_COPPER;
   spider_net_setup_aneg(card);
   mod_timer(card-aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER);
 
 @@ -1982,6 +1984,8 @@ spider_net_open(struct net_device *netde
   goto init_firmware_failed;
 
   /* start probing with copper */
 + card-aneg_count = 0;
 + card-medium = BCM54XX_COPPER;
   spider_net_setup_aneg(card);
   if (card-phy.def-phy_id)
   mod_timer(card-aneg_timer, jiffies + SPIDER_NET_ANEG_TIMER);
 ___
 cbe-oss-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/cbe-oss-dev

-- 

Gruß,

Jens

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
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: [Cbe-oss-dev] [PATCH 2/5] spidernet: increase auto-negotiation timeout to 5 seconds

2008-01-23 Thread Jens Osterkamp
On Friday 11 January 2008, Ishizaki Kou wrote:
 This patch extends the timeout for spidernet auto-negotiation.
 Auto-negotiation often fails to finish in 2 seconds.
 
 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Jens Osterkamp [EMAIL PROTECTED]

 ---
 
 Index: linux-powerpc-git/drivers/net/spider_net.h
 ===
 --- linux-powerpc-git.orig/drivers/net/spider_net.h
 +++ linux-powerpc-git/drivers/net/spider_net.h
 @@ -52,7 +52,7 @@ extern char spider_net_driver_name[];
 
  #define SPIDER_NET_TX_TIMER  (HZ/5)
  #define SPIDER_NET_ANEG_TIMER(HZ)
 -#define SPIDER_NET_ANEG_TIMEOUT  2
 +#define SPIDER_NET_ANEG_TIMEOUT  5
 
  #define SPIDER_NET_RX_CSUM_DEFAULT   1
 
 ___
 cbe-oss-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/cbe-oss-dev
 



-- 

Gruß,

Jens

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
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: [Cbe-oss-dev] [PATCH 3/5] spidernet: change interrupt masks

2008-01-23 Thread Jens Osterkamp
On Friday 11 January 2008, Ishizaki Kou wrote:
 This patch changes spidernet interrupt masks.
 
  - unmask GDAINVAINT. There is an operation to do by spidernet
interrupt handler.
  - mask some interrupts. There are no operations in the interrupt handler.
 
 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Jens Osterkamp [EMAIL PROTECTED]

 ---
 
 Index: linux-powerpc-git/drivers/net/spider_net.h
 ===
 --- linux-powerpc-git.orig/drivers/net/spider_net.h
 +++ linux-powerpc-git/drivers/net/spider_net.h
 @@ -159,9 +159,8 @@ extern char spider_net_driver_name[];
 
  /** interrupt mask registers */
  #define SPIDER_NET_INT0_MASK_VALUE   0x3f7fe2c7
 -#define SPIDER_NET_INT1_MASK_VALUE   0x7ff7
 -/* no MAC aborts - auto retransmission */
 -#define SPIDER_NET_INT2_MASK_VALUE   0xffef7ff1
 +#define SPIDER_NET_INT1_MASK_VALUE   0xfff2
 +#define SPIDER_NET_INT2_MASK_VALUE   0x03f1
 
  /* we rely on flagged descriptor interrupts */
  #define SPIDER_NET_FRAMENUM_VALUE0x
 ___
 cbe-oss-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/cbe-oss-dev
 



-- 

Gruß,

Jens

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
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: [Cbe-oss-dev] [PATCH 4/5] spidernet: fix error interrupt handling

2008-01-23 Thread Jens Osterkamp
On Friday 11 January 2008, Ishizaki Kou wrote:
 In addition to the value of GHIINT0STS, spidernet interrupt handler
 should check the values of GHIINT1STS/GHIINT2STS registers at the
 beginning of spider_net_interrupt() so as not to drop error
 interrupts.
 
 GHIINT1STS/GHIINT2STS registers indicates some of erroneous conditions
 in spidernet, and a few bits of GHIINT0STS register reflects these
 conditions. But GHIINT0MSK masks these bits, so you should check these
 conditions by reading GHIINT1STS/GHIINT2STS registers directly.
 
 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Jens Osterkamp [EMAIL PROTECTED]

 
 Index: linux-powerpc-git/drivers/net/spider_net.c
 ===
 --- linux-powerpc-git.orig/drivers/net/spider_net.c
 +++ linux-powerpc-git/drivers/net/spider_net.c
 @@ -1415,18 +1415,12 @@ spider_net_link_reset(struct net_device 
   * found when an interrupt is presented
   */
  static void
 -spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg)
 +spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
 + u32 error_reg1, u32 error_reg2)
  {
 - u32 error_reg1, error_reg2;
   u32 i;
   int show_error = 1;
 
 - error_reg1 = spider_net_read_reg(card, SPIDER_NET_GHIINT1STS);
 - error_reg2 = spider_net_read_reg(card, SPIDER_NET_GHIINT2STS);
 -
 - error_reg1 = SPIDER_NET_INT1_MASK_VALUE;
 - error_reg2 = SPIDER_NET_INT2_MASK_VALUE;
 -
   /* check GHIINT0STS /
   if (status_reg)
   for (i = 0; i  32; i++)
 @@ -1656,12 +1650,15 @@ spider_net_interrupt(int irq, void *ptr)
  {
   struct net_device *netdev = ptr;
   struct spider_net_card *card = netdev_priv(netdev);
 - u32 status_reg;
 + u32 status_reg, error_reg1, error_reg2;
 
   status_reg = spider_net_read_reg(card, SPIDER_NET_GHIINT0STS);
 - status_reg = SPIDER_NET_INT0_MASK_VALUE;
 + error_reg1 = spider_net_read_reg(card, SPIDER_NET_GHIINT1STS);
 + error_reg2 = spider_net_read_reg(card, SPIDER_NET_GHIINT2STS);
 
 - if (!status_reg)
 + if (!(status_reg  SPIDER_NET_INT0_MASK_VALUE) 
 + !(error_reg1  SPIDER_NET_INT1_MASK_VALUE) 
 + !(error_reg2  SPIDER_NET_INT2_MASK_VALUE))
   return IRQ_NONE;
 
   if (status_reg  SPIDER_NET_RXINT ) {
 @@ -1676,7 +1673,8 @@ spider_net_interrupt(int irq, void *ptr)
   spider_net_link_reset(netdev);
 
   if (status_reg  SPIDER_NET_ERRINT )
 - spider_net_handle_error_irq(card, status_reg);
 + spider_net_handle_error_irq(card, status_reg,
 + error_reg1, error_reg2);
 
   /* clear interrupt sources */
   spider_net_write_reg(card, SPIDER_NET_GHIINT0STS, status_reg);
 ___
 cbe-oss-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/cbe-oss-dev
 



-- 

Gruß,

Jens

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
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: [Cbe-oss-dev] [PATCH 5/5] spidernet: revise link status logging

2008-01-23 Thread Jens Osterkamp
On Friday 11 January 2008, Ishizaki Kou wrote:
 This patch revises the logging for link informations of spidernet.
 
   - The link down message is too verbose because auto-negotiation timeout
 occurs periodically while an ethernet cable is not connected. 
   - We want to see the link result, and we think it should be displayed. 
 
 Signed-off-by: Kou Ishizaki [EMAIL PROTECTED]

Acked-by: Jens Osterkamp [EMAIL PROTECTED]

 ---
 
 Index: linux-powerpc-git/drivers/net/spider_net.c
 ===
 --- linux-powerpc-git.orig/drivers/net/spider_net.c
 +++ linux-powerpc-git/drivers/net/spider_net.c
 @@ -2045,7 +2045,8 @@ static void spider_net_link_phy(unsigned
   /* if link didn't come up after SPIDER_NET_ANEG_TIMEOUT tries, setup 
 phy again */
   if (card-aneg_count  SPIDER_NET_ANEG_TIMEOUT) {
 
 - pr_info(%s: link is down trying to bring it up\n, 
 card-netdev-name);
 + pr_debug(%s: link is down trying to bring it up\n,
 +  card-netdev-name);
 
   switch (card-medium) {
   case BCM54XX_COPPER:
 @@ -2096,9 +2097,10 @@ static void spider_net_link_phy(unsigned
 
   card-aneg_count = 0;
 
 - pr_debug(Found %s with %i Mbps, %s-duplex %sautoneg.\n,
 - phy-def-name, phy-speed, phy-duplex==1 ? Full : Half,
 - phy-autoneg==1 ?  : no );
 + pr_info(%s: link up, %i Mbps, %s-duplex %sautoneg.\n,
 + card-netdev-name, phy-speed,
 + phy-duplex == 1 ? Full : Half,
 + phy-autoneg == 1 ?  : no );
 
   return;
  }
 ___
 cbe-oss-dev mailing list
 [EMAIL PROTECTED]
 https://ozlabs.org/mailman/listinfo/cbe-oss-dev
 



-- 

Gruß,

Jens

IBM Deutschland Entwicklung GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Herbert Kircher 
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
--
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


[IPV4 0/9] TRIE performance patches

2008-01-23 Thread Robert Olsson

Stephen Hemminger writes:

  Time to handle a full BGP load (163K of routes).
  
  Before:  LoadDumpFlush
 
  kmem_cache   3.8 13.07.2
  iter 3.9 12.36.9
  unordered3.1 11.94.9
  find_node3.1  0.31.2

 I certainly like the speed but what will we brake when
 we don't return in longest prefix order?

labb:/# ip r
default via 10.10.10.1 dev eth0 
5.0.0.0/8 via 192.168.2.2 dev eth3 
10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
10.10.11.0/24 dev eth1  proto kernel  scope link  src 10.10.11.1 
11.0.0.0/8 via 10.10.11.2 dev eth1 
192.168.1.0/24 dev eth2  proto kernel  scope link  src 192.168.1.2 
192.168.2.0/24 dev eth3  proto kernel  scope link  src 192.168.2.1 

labb:/# ip route list match 10.10.10.1
default via 10.10.10.1 dev eth0 
10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
labb:/# 

Maybe the unordered dump can be ordered cheaply...

Cheers.
--ro

--
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] Introducing socket mark socket option

2008-01-23 Thread Patrick McHardy

Laszlo Attila Toth wrote:

A userspace program may wish to set the mark for each packets its send
without using the netfilter MARK target. Changing the mark can be used
mark based routing without netfilter or for packet filtering.

It requires CAP_NET_ADMIN capability.




@@ -403,6 +403,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct 
sk_buff *skb)
  { .daddr = daddr,
.saddr = rt-rt_spec_dst,
.tos = RT_TOS(ip_hdr(skb)-tos) 
} },
+   .mark = sk-sk_mark,


This is useless, the icmp socket is not visible to userspace.


--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c

 ...

What about IPv6?
--
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] Cleanup and simplify virtnet header

2008-01-23 Thread Rusty Russell
1) Turn GSO on virtio net into an all-or-nothing (keep checksumming
   separate).  Having multiple bits is a pain: if you can't support something
   you should handle it in software, which is still a performance win.

2) Make VIRTIO_NET_HDR_GSO_ECN a flag in the header, so it can apply to
   IPv6 or v4.

3) Rename VIRTIO_NET_F_NO_CSUM to VIRTIO_NET_F_CSUM (ie. means we do
   checksumming).

4) Add csum and gso params to virtio_net to allow more testing.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/net/virtio_net.c   |   32 
 include/linux/virtio_net.h |   12 
 2 files changed, 20 insertions(+), 24 deletions(-)

diff -r 4fb788b18cf8 drivers/net/virtio_net.c
--- a/drivers/net/virtio_net.c  Wed Jan 23 13:07:59 2008 +1100
+++ b/drivers/net/virtio_net.c  Wed Jan 23 18:46:05 2008 +1100
@@ -26,6 +26,10 @@
 
 static int napi_weight = 128;
 module_param(napi_weight, int, 0444);
+
+static int csum = 1, gso = 1;
+module_param(csum, int, 0444);
+module_param(gso, int, 0444);
 
 MODULE_LICENSE(GPL);
 
@@ -95,12 +99,9 @@ static void receive_skb(struct net_devic
 
if (hdr-gso_type != VIRTIO_NET_HDR_GSO_NONE) {
pr_debug(GSO!\n);
-   switch (hdr-gso_type) {
+   switch (hdr-gso_type  ~VIRTIO_NET_HDR_GSO_ECN) {
case VIRTIO_NET_HDR_GSO_TCPV4:
skb_shinfo(skb)-gso_type = SKB_GSO_TCPV4;
-   break;
-   case VIRTIO_NET_HDR_GSO_TCPV4_ECN:
-   skb_shinfo(skb)-gso_type = SKB_GSO_TCP_ECN;
break;
case VIRTIO_NET_HDR_GSO_UDP:
skb_shinfo(skb)-gso_type = SKB_GSO_UDP;
@@ -114,6 +115,9 @@ static void receive_skb(struct net_devic
   dev-name, hdr-gso_type);
goto frame_err;
}
+
+   if (hdr-gso_type  VIRTIO_NET_HDR_GSO_ECN)
+   skb_shinfo(skb)-gso_type |= SKB_GSO_TCP_ECN;
 
skb_shinfo(skb)-gso_size = hdr-gso_size;
if (skb_shinfo(skb)-gso_size == 0) {
@@ -249,9 +253,7 @@ static int start_xmit(struct sk_buff *sk
if (skb_is_gso(skb)) {
hdr-hdr_len = skb_transport_header(skb) - skb-data;
hdr-gso_size = skb_shinfo(skb)-gso_size;
-   if (skb_shinfo(skb)-gso_type  SKB_GSO_TCP_ECN)
-   hdr-gso_type = VIRTIO_NET_HDR_GSO_TCPV4_ECN;
-   else if (skb_shinfo(skb)-gso_type  SKB_GSO_TCPV4)
+   if (skb_shinfo(skb)-gso_type  SKB_GSO_TCPV4)
hdr-gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
else if (skb_shinfo(skb)-gso_type  SKB_GSO_TCPV6)
hdr-gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
@@ -259,6 +261,8 @@ static int start_xmit(struct sk_buff *sk
hdr-gso_type = VIRTIO_NET_HDR_GSO_UDP;
else
BUG();
+   if (skb_shinfo(skb)-gso_type  SKB_GSO_TCP_ECN)
+   hdr-gso_type |= VIRTIO_NET_HDR_GSO_ECN;
} else {
hdr-gso_type = VIRTIO_NET_HDR_GSO_NONE;
hdr-gso_size = hdr-hdr_len = 0;
@@ -354,17 +358,13 @@ static int virtnet_probe(struct virtio_d
SET_NETDEV_DEV(dev, vdev-dev);
 
/* Do we support hardware checksums? */
-   if (vdev-config-feature(vdev, VIRTIO_NET_F_NO_CSUM)) {
+   if (csum  vdev-config-feature(vdev, VIRTIO_NET_F_CSUM)) {
/* This opens up the world of extra features. */
dev-features |= NETIF_F_HW_CSUM|NETIF_F_SG|NETIF_F_FRAGLIST;
-   if (vdev-config-feature(vdev, VIRTIO_NET_F_TSO4))
-   dev-features |= NETIF_F_TSO;
-   if (vdev-config-feature(vdev, VIRTIO_NET_F_UFO))
-   dev-features |= NETIF_F_UFO;
-   if (vdev-config-feature(vdev, VIRTIO_NET_F_TSO4_ECN))
-   dev-features |= NETIF_F_TSO_ECN;
-   if (vdev-config-feature(vdev, VIRTIO_NET_F_TSO6))
-   dev-features |= NETIF_F_TSO6;
+   if (gso  vdev-config-feature(vdev, VIRTIO_NET_F_GSO)) {
+   dev-features |= NETIF_F_TSO | NETIF_F_UFO
+   | NETIF_F_TSO_ECN | NETIF_F_TSO6;
+   }
}
 
/* Configuration may specify what MAC to use.  Otherwise random. */
diff -r 4fb788b18cf8 include/linux/virtio_net.h
--- a/include/linux/virtio_net.hWed Jan 23 13:07:59 2008 +1100
+++ b/include/linux/virtio_net.hWed Jan 23 18:46:05 2008 +1100
@@ -6,12 +6,9 @@
 #define VIRTIO_ID_NET  1
 
 /* The feature bitmap for virtio net */
-#define VIRTIO_NET_F_NO_CSUM   0
-#define VIRTIO_NET_F_TSO4  1
-#define VIRTIO_NET_F_UFO   2
-#define VIRTIO_NET_F_TSO4_ECN  3
-#define VIRTIO_NET_F_TSO6  4
-#define VIRTIO_NET_F_MAC   5
+#define VIRTIO_NET_F_CSUM  0   /* Can handle pkts 

[PATCH 2/3] partial checksum and GSO support for tun/tap.

2008-01-23 Thread Rusty Russell
(Changes since last time: we how have explicit IFF_RECV_CSUM and 
IFF_RECV_GSO bits, and some renaming of virtio_net hdr)

We use the virtio_net_hdr: it is an ABI already and designed to
encapsulate such metadata as GSO and partial checksums.

IFF_VIRTIO_HDR means you will write and read a 'struct virtio_net_hdr'
at the start of each packet.  You can always write packets with
partial checksum and gso to the tap device using this header.

IFF_RECV_CSUM means you can handle reading packets with partial
checksums.  If IFF_RECV_GSO is also set, it means you can handle
reading (all types of) GSO packets.

Note that there is no easy way to detect if these flags are supported:
see next patch.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/net/tun.c  |  259 +++--
 include/linux/if_tun.h |6 +
 2 files changed, 238 insertions(+), 27 deletions(-)

diff -r cb85fb035378 drivers/net/tun.c
--- a/drivers/net/tun.c Wed Jan 23 20:06:56 2008 +1100
+++ b/drivers/net/tun.c Wed Jan 23 20:12:51 2008 +1100
@@ -62,6 +62,7 @@
 #include linux/if_ether.h
 #include linux/if_tun.h
 #include linux/crc32.h
+#include linux/virtio_net.h
 #include net/net_namespace.h
 
 #include asm/system.h
@@ -238,35 +239,188 @@ static unsigned int tun_chr_poll(struct 
return mask;
 }
 
+static struct sk_buff *copy_user_skb(size_t align, struct iovec *iv, size_t 
len)
+{
+   struct sk_buff *skb;
+
+   if (!(skb = alloc_skb(len + align, GFP_KERNEL)))
+   return ERR_PTR(-ENOMEM);
+
+   if (align)
+   skb_reserve(skb, align);
+
+   if (memcpy_fromiovec(skb_put(skb, len), iv, len)) {
+   kfree_skb(skb);
+   return ERR_PTR(-EFAULT);
+   }
+   return skb;
+}
+
+/* This will fail if they give us a crazy iovec, but that's their own fault. */
+static int get_user_skb_frags(const struct iovec *iv, size_t count,
+ struct skb_frag_struct *f)
+{
+   unsigned int i, j, num_pg = 0;
+   int err;
+   struct page *pages[MAX_SKB_FRAGS];
+
+   down_read(current-mm-mmap_sem);
+   for (i = 0; i  count; i++) {
+   int n, npages;
+   unsigned long base, len;
+   base = (unsigned long)iv[i].iov_base;
+   len = (unsigned long)iv[i].iov_len;
+
+   if (len == 0)
+   continue;
+
+   /* How many pages will this take? */
+   npages = 1 + (base + len - 1)/PAGE_SIZE - base/PAGE_SIZE;
+   if (unlikely(num_pg + npages  MAX_SKB_FRAGS)) {
+   err = -ENOSPC;
+   goto fail;
+   }
+   n = get_user_pages(current, current-mm, base, npages,
+  0, 0, pages, NULL);
+   if (unlikely(n  0)) {
+   err = n;
+   goto fail;
+   }
+
+   /* Transfer pages to the frag array */
+   for (j = 0; j  n; j++) {
+   f[num_pg].page = pages[j];
+   if (j == 0) {
+   f[num_pg].page_offset = offset_in_page(base);
+   f[num_pg].size = min(len, PAGE_SIZE -
+f[num_pg].page_offset);
+   } else {
+   f[num_pg].page_offset = 0;
+   f[num_pg].size = min(len, PAGE_SIZE);
+   }
+   len -= f[num_pg].size;
+   base += f[num_pg].size;
+   num_pg++;
+   }
+
+   if (unlikely(n != npages)) {
+   err = -EFAULT;
+   goto fail;
+   }
+   }
+   up_read(current-mm-mmap_sem);
+   return num_pg;
+
+fail:
+   for (i = 0; i  num_pg; i++)
+   put_page(f[i].page);
+   up_read(current-mm-mmap_sem);
+   return err;
+}
+
+
+static struct sk_buff *map_user_skb(const struct virtio_net_hdr *gso,
+   size_t align, struct iovec *iv,
+   size_t count, size_t len)
+{
+   struct sk_buff *skb;
+   struct skb_shared_info *sinfo;
+   int err;
+
+   if (!(skb = alloc_skb(gso-hdr_len + align, GFP_KERNEL)))
+   return ERR_PTR(-ENOMEM);
+
+   if (align)
+   skb_reserve(skb, align);
+
+   sinfo = skb_shinfo(skb);
+   sinfo-gso_size = gso-gso_size;
+   sinfo-gso_type = SKB_GSO_DODGY;
+   switch (gso-gso_type  ~VIRTIO_NET_HDR_GSO_ECN) {
+   case VIRTIO_NET_HDR_GSO_TCPV4:
+   sinfo-gso_type |= SKB_GSO_TCPV4;
+   break;
+   case VIRTIO_NET_HDR_GSO_TCPV6:
+   sinfo-gso_type |= SKB_GSO_TCPV6;
+   break;
+   case VIRTIO_NET_HDR_GSO_UDP:
+   sinfo-gso_type |= SKB_GSO_UDP;
+ 

[PATCH 3/3] Interface to query tun/tap features.

2008-01-23 Thread Rusty Russell
(No real change, just updated with new bits)

The problem with introducing IFF_RECV_CSUM and IFF_RECV_GSO is that
they need to set dev-features to enable GSO and/or checksumming,
which is supposed to be done before register_netdevice(), ie. as part
of TUNSETIFF.

Unfortunately, TUNSETIFF has always just ignored flags it doesn't understand,
so there's no good way of detecting whether the kernel supports IFF_GSO_HDR.

This patch implements a TUNGETFEATURES ioctl which returns all the valid IFF
flags.  It could be extended later to include other features.

Here's an example program which uses it:

#include linux/if_tun.h
#include sys/types.h
#include sys/ioctl.h
#include sys/stat.h
#include fcntl.h
#include err.h
#include stdio.h

static struct {
unsigned int flag;
const char *name;
} known_flags[] = {
{ IFF_TUN, TUN },
{ IFF_TAP, TAP },
{ IFF_NO_PI, NO_PI },
{ IFF_ONE_QUEUE, ONE_QUEUE },
{ IFF_VIRTIO_HDR, VIRTIO_HDR },
{ IFF_RECV_CSUM, RECV_CSUM },
{ IFF_RECV_GSO, RECV_GSO },
};

int main()
{
unsigned int features, i;

int netfd = open(/dev/net/tun, O_RDWR);
if (netfd  0)
err(1, Opening /dev/net/tun);

if (ioctl(netfd, TUNGETFEATURES, features) != 0) {
printf(Kernel does not support TUNGETFEATURES, guessing\n);
features = (IFF_TUN|IFF_TAP|IFF_NO_PI|IFF_ONE_QUEUE);
}
printf(Available features are: );
for (i = 0; i  sizeof(known_flags)/sizeof(known_flags[0]); i++) {
if (features  known_flags[i].flag) {
features = ~known_flags[i].flag;
printf(%s , known_flags[i].name);
}
}
if (features)
printf((UNKNOWN %#x), features);
printf(\n);
return 0;
}

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/net/tun.c  |9 +
 include/linux/if_tun.h |3 +++
 2 files changed, 12 insertions(+)

diff -r c0e7a8b99325 drivers/net/tun.c
--- a/drivers/net/tun.c Wed Jan 23 20:12:51 2008 +1100
+++ b/drivers/net/tun.c Wed Jan 23 20:17:28 2008 +1100
@@ -790,6 +790,15 @@ static int tun_chr_ioctl(struct inode *i
return 0;
}
 
+   if (cmd == TUNGETFEATURES) {
+   /* Currently this just means: what IFF flags are valid?.
+* This is needed because we never checked for invalid flags on
+* TUNSETIFF.  This was introduced with IFF_GSO_HDR, so if a
+* kernel doesn't have this ioctl, it doesn't have GSO header
+* support. */
+   return put_user(IFF_ALL_FLAGS, (unsigned int __user*)argp);
+   }
+
if (!tun)
return -EBADFD;
 
diff -r c0e7a8b99325 include/linux/if_tun.h
--- a/include/linux/if_tun.hWed Jan 23 20:12:51 2008 +1100
+++ b/include/linux/if_tun.hWed Jan 23 20:17:28 2008 +1100
@@ -82,6 +82,7 @@ struct tun_struct {
 #define TUNSETOWNER   _IOW('T', 204, int)
 #define TUNSETLINK_IOW('T', 205, int)
 #define TUNSETGROUP   _IOW('T', 206, int)
+#define TUNGETFEATURES _IOR('T', 207, unsigned int)
 
 /* TUNSETIFF ifr flags */
 #define IFF_TUN0x0001
@@ -91,6 +92,8 @@ struct tun_struct {
 #define IFF_VIRTIO_HDR 0x4000
 #define IFF_RECV_CSUM  0x8000
 #define IFF_RECV_GSO   0x0800
+#define IFF_ALL_FLAGS (IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE | \
+  IFF_VIRTIO_HDR | IFF_RECV_CSUM | IFF_RECV_GSO)
 
 struct tun_pi {
unsigned short flags;
--
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 net-2.6.25] [PKTGEN] Remove an unused definition in pktgen.c.

2008-01-23 Thread Rami Rosen
Hi,
- Remove an unused definition (LAT_BUCKETS_MAX) in net/core/pktgen.c.
- Remove the corresponding comment.
- The LAT_BUCKETS_MAX seems to have to do with a patch from a long
time ago which was not applied (Ben Greear), which dealt with latency
counters.

See, for example : http://oss.sgi.com/archives/netdev/2002-09/msg00184.html

Regards,
Rami Rosen


Signed-off-by: Rami Rosen [EMAIL PROTECTED]
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index eebccdb..b7f2de1 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -170,8 +170,6 @@
 
 #define VERSION  pktgen v2.69: Packet Generator for packet performance 
testing.\n
 
-/* The buckets are exponential in 'width' */
-#define LAT_BUCKETS_MAX 32
 #define IP_NAME_SZ 32
 #define MAX_MPLS_LABELS 16 /* This is the max label stack depth */
 #define MPLS_STACK_BOTTOM htonl(0x0100)


My 802.3ad is my bond

2008-01-23 Thread Steven Whitehouse
Hi,

This commit: ece95f7fefe3afae19e641e1b3f5e64b00d5b948 seems to have
caused a problem with parsing bond arguments as now only the numeric
arguments seem to work (in modprobe.conf) and specifying 802.3ad fails.
When I revert that patch in my local tree all seems ok.

Also I notice that one of my two NICs now reports this:

bonding: bond0: link status definitely down for interface eth0,
disabling it
bonding: bond0: Interface eth0 is already enslaved!
bond0.5: no IPv6 routers present

which I think is also new with this set of bonding updates, before it
used to use both interfaces ok. I've not worked out which of the other
patches causes this so far, but I can if its helpful,

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: [IPV4 0/9] TRIE performance patches

2008-01-23 Thread Stephen Hemminger

Robert Olsson wrote:

Stephen Hemminger writes:

  Time to handle a full BGP load (163K of routes).
  
  Before:		Load		Dump		Flush

 
  kmem_cache3.8 13.07.2
  iter  3.9 12.36.9
  unordered 3.1 11.94.9
  find_node 3.1  0.31.2

 I certainly like the speed but what will we brake when
 we don't return in longest prefix order?

labb:/# ip r
default via 10.10.10.1 dev eth0 
5.0.0.0/8 via 192.168.2.2 dev eth3 
10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
10.10.11.0/24 dev eth1  proto kernel  scope link  src 10.10.11.1 
11.0.0.0/8 via 10.10.11.2 dev eth1 
192.168.1.0/24 dev eth2  proto kernel  scope link  src 192.168.1.2 
192.168.2.0/24 dev eth3  proto kernel  scope link  src 192.168.2.1 


labb:/# ip route list match 10.10.10.1
default via 10.10.10.1 dev eth0 
10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
labb:/# 


Maybe the unordered dump can be ordered cheaply...

Cheers.
--ro

  
Hash returned the routes in prefix order (then random).  Returning the 
routes in numerical order

seems just as logical. I'm going to test on quagga.

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


[NET_SCHED 00/15]: Make use of new netlink API features

2008-01-23 Thread Patrick McHardy
Hi Dave,

these patches change the packet schedulers/classifers/actions to make use
of the features of the new netlink API, like typeful attribute dumping and
parsing, automatic basic attribute validation etc. The also fix a bug and
a warning introduced by my last set of patches.

Please apply, thanks.


 include/linux/pkt_sched.h |2 +
 include/net/act_api.h |4 +-
 net/sched/act_api.c   |  197 +
 net/sched/act_gact.c  |   20 +++--
 net/sched/act_ipt.c   |   33 +---
 net/sched/act_mirred.c|   15 +++-
 net/sched/act_nat.c   |   15 +++-
 net/sched/act_pedit.c |   15 +++-
 net/sched/act_police.c|   43 +-
 net/sched/act_simple.c|   15 +++-
 net/sched/cls_api.c   |   30 ---
 net/sched/cls_basic.c |   33 
 net/sched/cls_fw.c|   41 +-
 net/sched/cls_route.c |   47 +--
 net/sched/cls_rsvp.h  |   45 +--
 net/sched/cls_tcindex.c   |   70 
 net/sched/cls_u32.c   |   56 +++--
 net/sched/em_meta.c   |   18 +++--
 net/sched/ematch.c|   31 +---
 net/sched/sch_api.c   |7 +-
 net/sched/sch_atm.c   |   45 ++
 net/sched/sch_cbq.c   |   75 +++--
 net/sched/sch_dsmark.c|   37 +
 net/sched/sch_gred.c  |   28 +--
 net/sched/sch_hfsc.c  |   30 ---
 net/sched/sch_htb.c   |   64 ++-
 net/sched/sch_ingress.c   |   12 ++--
 net/sched/sch_netem.c |   73 +++-
 net/sched/sch_prio.c  |9 ++-
 net/sched/sch_red.c   |   16 +++-
 net/sched/sch_tbf.c   |   29 +---
 31 files changed, 650 insertions(+), 505 deletions(-)

Patrick McHardy (15):
  [NET_SCHED]: sch_atm: fix format string warning
  [NET_SCHED]: sch_netem: use nla_parse_nested_compat
  [NET_SCHED]: act_api: fix netlink API conversion bug
  [NET_SCHED]: act_api: use nlmsg_parse
  [NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get
  [NET_SCHED]: Propagate nla_parse return value
  [NET_SCHED]: Use nla_nest_start/nla_nest_end
  [NET_SCHED]: Use NLA_PUT_STRING for string dumping
  [NET_SCHED]: Use typeful attribute construction helpers
  [NET_SCHED]: Use typeful attribute parsing helpers
  [NET_SCHED]: sch_api: introduce constant for rate table size
  [NET_SCHED]: Use nla_policy for attribute validation in packet schedulers
  [NET_SCHED]: Use nla_policy for attribute validation in classifiers
  [NET_SCHED]: Use nla_policy for attribute validation in actions
  [NET_SCHED]: Use nla_policy for attribute validation in ematches
--
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


[NET_SCHED 01/15]: sch_atm: fix format string warning

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: sch_atm: fix format string warning

Fix format string warning introduces by the netlink API conversion:

net/sched/sch_atm.c:250: warning: format '%lu' expects type 'long unsigned 
int', but argument 3 has type 'int'.

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

---
commit 3bab4166cf0350552419d7871b4df463c5aed2ea
tree c08015e39f6f1da0255f1325cc21dfda0c738bc2
parent a7f92e3b13a5e3db64383c503f2249dc74b41bd6
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 16:48:28 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 16:48:28 +0100

 net/sched/sch_atm.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index eb01aae..e587391 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -246,7 +246,7 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, 
u32 parent,
if (!excess)
return -ENOENT;
}
-   pr_debug(atm_tc_change: type %d, payload %lu, hdr_len %d\n,
+   pr_debug(atm_tc_change: type %d, payload %d, hdr_len %d\n,
 opt-nla_type, nla_len(opt), hdr_len);
sock = sockfd_lookup(fd, error);
if (!sock)
--
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


[NET_SCHED 02/15]: sch_netem: use nla_parse_nested_compat

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: sch_netem: use nla_parse_nested_compat

Replace open coded equivalent of nla_parse_nested_compat().

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

---
commit 1af28b79f4f0a67db344938ef6739ad2af1a72a7
tree 52294414fad2e6cd11aa719113f160a47bbe5bd5
parent 3bab4166cf0350552419d7871b4df463c5aed2ea
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 16:48:46 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 16:48:46 +0100

 net/sched/sch_netem.c |   58 ++---
 1 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index a7b58df..1a75579 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -407,13 +407,18 @@ static int get_corrupt(struct Qdisc *sch, const struct 
nlattr *attr)
 static int netem_change(struct Qdisc *sch, struct nlattr *opt)
 {
struct netem_sched_data *q = qdisc_priv(sch);
+   struct nlattr *tb[TCA_NETEM_MAX + 1];
struct tc_netem_qopt *qopt;
int ret;
 
-   if (opt == NULL || nla_len(opt)  sizeof(*qopt))
+   if (opt == NULL)
return -EINVAL;
 
-   qopt = nla_data(opt);
+   ret = nla_parse_nested_compat(tb, TCA_NETEM_MAX, opt, NULL, qopt,
+ sizeof(*qopt));
+   if (ret  0)
+   return ret;
+
ret = set_fifo_limit(q-qdisc, qopt-limit);
if (ret) {
pr_debug(netem: can't set fifo limit\n);
@@ -434,39 +439,28 @@ static int netem_change(struct Qdisc *sch, struct nlattr 
*opt)
if (q-gap)
q-reorder = ~0;
 
-   /* Handle nested options after initial queue options.
-* Should have put all options in nested format but too late now.
-*/
-   if (nla_len(opt)  sizeof(*qopt)) {
-   struct nlattr *tb[TCA_NETEM_MAX + 1];
-   if (nla_parse(tb, TCA_NETEM_MAX,
- nla_data(opt) + sizeof(*qopt),
- nla_len(opt) - sizeof(*qopt), NULL))
-   return -EINVAL;
-
-   if (tb[TCA_NETEM_CORR]) {
-   ret = get_correlation(sch, tb[TCA_NETEM_CORR]);
-   if (ret)
-   return ret;
-   }
+   if (tb[TCA_NETEM_CORR]) {
+   ret = get_correlation(sch, tb[TCA_NETEM_CORR]);
+   if (ret)
+   return ret;
+   }
 
-   if (tb[TCA_NETEM_DELAY_DIST]) {
-   ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]);
-   if (ret)
-   return ret;
-   }
+   if (tb[TCA_NETEM_DELAY_DIST]) {
+   ret = get_dist_table(sch, tb[TCA_NETEM_DELAY_DIST]);
+   if (ret)
+   return ret;
+   }
 
-   if (tb[TCA_NETEM_REORDER]) {
-   ret = get_reorder(sch, tb[TCA_NETEM_REORDER]);
-   if (ret)
-   return ret;
-   }
+   if (tb[TCA_NETEM_REORDER]) {
+   ret = get_reorder(sch, tb[TCA_NETEM_REORDER]);
+   if (ret)
+   return ret;
+   }
 
-   if (tb[TCA_NETEM_CORRUPT]) {
-   ret = get_corrupt(sch, tb[TCA_NETEM_CORRUPT]);
-   if (ret)
-   return ret;
-   }
+   if (tb[TCA_NETEM_CORRUPT]) {
+   ret = get_corrupt(sch, tb[TCA_NETEM_CORRUPT]);
+   if (ret)
+   return ret;
}
 
return 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


[NET_SCHED 03/15]: act_api: fix netlink API conversion bug

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: act_api: fix netlink API conversion bug

Fix two invalid attribute accesses, indices start at 1 with the new
netlink API.

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

---
commit 512b2ab20730e1d24e36fb94eab4a2731e90e315
tree e3583125570ee0c7a57feac7aa6fcabe2541112a
parent 1af28b79f4f0a67db344938ef6739ad2af1a72a7
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:10:00 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:10:00 +0100

 net/sched/act_api.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ebd21d2..ae077ed 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -997,11 +997,11 @@ find_dump_kind(struct nlmsghdr *n)
if (nla_parse(tb, TCA_ACT_MAX_PRIO, nla_data(tb1),
  NLMSG_ALIGN(nla_len(tb1)), NULL)  0)
return NULL;
-   if (tb[0] == NULL)
-   return NULL;
 
-   if (nla_parse(tb2, TCA_ACT_MAX, nla_data(tb[0]),
- nla_len(tb[0]), NULL)  0)
+   if (tb[1] == NULL)
+   return NULL;
+   if (nla_parse(tb2, TCA_ACT_MAX, nla_data(tb[1]),
+ nla_len(tb[1]), NULL)  0)
return NULL;
kind = tb2[TCA_ACT_KIND];
 
--
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


[NET_SCHED 04/15]: act_api: use nlmsg_parse

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: act_api: use nlmsg_parse

Convert open-coded nlmsg_parse to use the real function.

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

---
commit f9f9cbaccb1a58ea02318250192effe1e2e1e715
tree 7ea770493ca465a7aac1a7779b2aa4c593de3a97
parent 512b2ab20730e1d24e36fb94eab4a2731e90e315
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:10:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:10:31 +0100

 net/sched/act_api.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ae077ed..2fe0345 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -984,11 +984,8 @@ find_dump_kind(struct nlmsghdr *n)
struct nlattr *tb[TCA_ACT_MAX_PRIO + 1];
struct nlattr *nla[TCAA_MAX + 1];
struct nlattr *kind;
-   int min_len = NLMSG_LENGTH(sizeof(struct tcamsg));
-   int attrlen = n-nlmsg_len - NLMSG_ALIGN(min_len);
-   struct nlattr *attr = (void *) n + NLMSG_ALIGN(min_len);
 
-   if (nla_parse(nla, TCAA_MAX, attr, attrlen, NULL)  0)
+   if (nlmsg_parse(n, sizeof(struct tcamsg), nla, TCAA_MAX, NULL)  0)
return NULL;
tb1 = nla[TCA_ACT_TAB];
if (tb1 == NULL)
--
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


[NET_SCHED 05/15]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get

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

---
commit 0919ac24aa4bd6978806f35f8daefe32aa997823
tree 95e2c04521d6a09c080eac8735ab0598c3b3ff5b
parent f9f9cbaccb1a58ea02318250192effe1e2e1e715
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:41 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:41 +0100

 include/net/act_api.h |4 +--
 net/sched/act_api.c   |   71 +++--
 net/sched/cls_api.c   |   14 +-
 3 files changed, 48 insertions(+), 41 deletions(-)

diff --git a/include/net/act_api.h b/include/net/act_api.h
index c5ac61a..565eed8 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -114,8 +114,8 @@ extern int tcf_register_action(struct tc_action_ops *a);
 extern int tcf_unregister_action(struct tc_action_ops *a);
 extern void tcf_action_destroy(struct tc_action *a, int bind);
 extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct 
tcf_result *res);
-extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr 
*est, char *n, int ovr, int bind, int *err);
-extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr 
*est, char *n, int ovr, int bind, int *err);
+extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr 
*est, char *n, int ovr, int bind);
+extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr 
*est, char *n, int ovr, int bind);
 extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int);
 extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, 
int);
 extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, 
int);
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 2fe0345..ea80f82 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -18,6 +18,7 @@
 #include linux/skbuff.h
 #include linux/init.h
 #include linux/kmod.h
+#include linux/err.h
 #include net/net_namespace.h
 #include net/sock.h
 #include net/sch_generic.h
@@ -463,15 +464,16 @@ errout:
 }
 
 struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
-   char *name, int ovr, int bind, int *err)
+   char *name, int ovr, int bind)
 {
struct tc_action *a;
struct tc_action_ops *a_o;
char act_name[IFNAMSIZ];
struct nlattr *tb[TCA_ACT_MAX+1];
struct nlattr *kind;
+   int err;
 
-   *err = -EINVAL;
+   err = -EINVAL;
 
if (name == NULL) {
if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL)  0)
@@ -502,36 +504,35 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, 
struct nlattr *est,
 * indicate this using -EAGAIN.
 */
if (a_o != NULL) {
-   *err = -EAGAIN;
+   err = -EAGAIN;
goto err_mod;
}
 #endif
-   *err = -ENOENT;
+   err = -ENOENT;
goto err_out;
}
 
-   *err = -ENOMEM;
+   err = -ENOMEM;
a = kzalloc(sizeof(*a), GFP_KERNEL);
if (a == NULL)
goto err_mod;
 
/* backward compatibility for policer */
if (name == NULL)
-   *err = a_o-init(tb[TCA_ACT_OPTIONS], est, a, ovr, bind);
+   err = a_o-init(tb[TCA_ACT_OPTIONS], est, a, ovr, bind);
else
-   *err = a_o-init(nla, est, a, ovr, bind);
-   if (*err  0)
+   err = a_o-init(nla, est, a, ovr, bind);
+   if (err  0)
goto err_free;
 
/* module count goes up only when brand new policy is created
   if it exists and is only bound to in a_o-init() then
   ACT_P_CREATED is not returned (a zero is).
*/
-   if (*err != ACT_P_CREATED)
+   if (err != ACT_P_CREATED)
module_put(a_o-owner);
a-ops = a_o;
 
-   *err = 0;
return a;
 
 err_free:
@@ -539,24 +540,22 @@ err_free:
 err_mod:
module_put(a_o-owner);
 err_out:
-   return NULL;
+   return ERR_PTR(err);
 }
 
 struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est,
- char *name, int ovr, int bind, int *err)
+ char *name, int ovr, int bind)
 {
struct nlattr *tb[TCA_ACT_MAX_PRIO+1];
struct tc_action *head = NULL, *act, *act_prev = NULL;
int i;
 
-   if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL)  0) {
-   *err = -EINVAL;
-   return head;
-   }
+   if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL)  0)
+   return ERR_PTR(-EINVAL);
 
for (i = 1; i = TCA_ACT_MAX_PRIO  tb[i]; i++) {
-   act = tcf_action_init_1(tb[i], est, name, ovr, bind, err);
-   if (act == NULL)

[NET_SCHED 06/15]: Propagate nla_parse return value

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Propagate nla_parse return value

nla_parse() returns more detailed errno codes, propagate them back on error.

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

---
commit f9b5ab497909e836983bc31e5e7ad5065ccba6bc
tree 3b2ca0f7dcf925d113fce3e376cf7f2e995f0b7a
parent 0919ac24aa4bd6978806f35f8daefe32aa997823
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:54 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:54 +0100

 net/sched/act_api.c |   29 ++---
 net/sched/act_gact.c|7 ++-
 net/sched/act_ipt.c |6 +-
 net/sched/act_mirred.c  |8 ++--
 net/sched/act_nat.c |8 ++--
 net/sched/act_pedit.c   |8 ++--
 net/sched/act_police.c  |6 +-
 net/sched/act_simple.c  |8 ++--
 net/sched/cls_basic.c   |7 ---
 net/sched/cls_fw.c  |5 +++--
 net/sched/cls_route.c   |5 +++--
 net/sched/cls_rsvp.h|5 +++--
 net/sched/cls_tcindex.c |6 --
 net/sched/cls_u32.c |5 +++--
 net/sched/em_meta.c |6 --
 net/sched/ematch.c  |6 --
 net/sched/sch_atm.c |6 +-
 net/sched/sch_cbq.c |   14 +++---
 net/sched/sch_dsmark.c  |   14 --
 net/sched/sch_gred.c|   16 +---
 net/sched/sch_hfsc.c|7 ++-
 net/sched/sch_htb.c |   23 +++
 net/sched/sch_prio.c|9 ++---
 net/sched/sch_red.c |7 ++-
 net/sched/sch_tbf.c |   10 +++---
 25 files changed, 171 insertions(+), 60 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ea80f82..87818d7 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -473,17 +473,18 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, 
struct nlattr *est,
struct nlattr *kind;
int err;
 
-   err = -EINVAL;
-
if (name == NULL) {
-   if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL)  0)
+   err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
+   if (err  0)
goto err_out;
+   err = -EINVAL;
kind = tb[TCA_ACT_KIND];
if (kind == NULL)
goto err_out;
if (nla_strlcpy(act_name, kind, IFNAMSIZ) = IFNAMSIZ)
goto err_out;
} else {
+   err = -EINVAL;
if (strlcpy(act_name, name, IFNAMSIZ) = IFNAMSIZ)
goto err_out;
}
@@ -548,10 +549,12 @@ struct tc_action *tcf_action_init(struct nlattr *nla, 
struct nlattr *est,
 {
struct nlattr *tb[TCA_ACT_MAX_PRIO+1];
struct tc_action *head = NULL, *act, *act_prev = NULL;
+   int err;
int i;
 
-   if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL)  0)
-   return ERR_PTR(-EINVAL);
+   err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL);
+   if (err  0)
+   return ERR_PTR(err);
 
for (i = 1; i = TCA_ACT_MAX_PRIO  tb[i]; i++) {
act = tcf_action_init_1(tb[i], est, name, ovr, bind);
@@ -674,10 +677,11 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, 
u32 pid)
int index;
int err;
 
-   err = -EINVAL;
-   if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL)  0)
+   err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
+   if (err  0)
goto err_out;
 
+   err = -EINVAL;
if (tb[TCA_ACT_INDEX] == NULL ||
nla_len(tb[TCA_ACT_INDEX])  sizeof(index))
goto err_out;
@@ -759,9 +763,11 @@ static int tca_action_flush(struct nlattr *nla, struct 
nlmsghdr *n, u32 pid)
 
b = skb_tail_pointer(skb);
 
-   if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL)  0)
+   err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
+   if (err  0)
goto err_out;
 
+   err = -EINVAL;
kind = tb[TCA_ACT_KIND];
a-ops = tc_lookup_action(kind);
if (a-ops == NULL)
@@ -804,12 +810,13 @@ err_out:
 static int
 tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event)
 {
-   int i, ret = 0;
+   int i, ret;
struct nlattr *tb[TCA_ACT_MAX_PRIO+1];
struct tc_action *head = NULL, *act, *act_prev = NULL;
 
-   if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL)  0)
-   return -EINVAL;
+   ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL);
+   if (ret  0)
+   return ret;
 
if (event == RTM_DELACTION  n-nlmsg_flagsNLM_F_ROOT) {
if (tb[0] != NULL  tb[1] == NULL)
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 5402cf8..df214d4 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -61,10 +61,15 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr 
*est,
struct tcf_gact *gact;
struct tcf_common *pc;
int ret = 0;
+   int err;
 
-   if (nla == NULL 

[NET_SCHED 07/15]: Use nla_nest_start/nla_nest_end

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use nla_nest_start/nla_nest_end

Use nla_nest_start/nla_nest_end for dumping nested attributes.

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

---
commit bdd38a3b14cfa340da580f6e825d7f1142925926
tree 36dc82b63837c96b0f5e1b5c508f789abe7414e8
parent f9b5ab497909e836983bc31e5e7ad5065ccba6bc
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:54 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:54 +0100

 net/sched/act_api.c |   84 ++-
 net/sched/act_police.c  |   13 ---
 net/sched/cls_api.c |   14 +---
 net/sched/cls_basic.c   |   12 +++
 net/sched/cls_fw.c  |9 +++--
 net/sched/cls_route.c   |9 +++--
 net/sched/cls_rsvp.h|   10 +++---
 net/sched/cls_tcindex.c |   13 ---
 net/sched/cls_u32.c |   13 ---
 net/sched/ematch.c  |   16 ++---
 net/sched/sch_atm.c |   15 +---
 net/sched/sch_cbq.c |   24 +++--
 net/sched/sch_hfsc.c|   11 +++---
 net/sched/sch_htb.c |   32 +++---
 net/sched/sch_ingress.c |   12 +++
 net/sched/sch_tbf.c |   12 +++
 16 files changed, 166 insertions(+), 133 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 87818d7..3602260 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -69,7 +69,7 @@ static int tcf_dump_walker(struct sk_buff *skb, struct 
netlink_callback *cb,
 {
struct tcf_common *p;
int err = 0, index = -1,i = 0, s_i = 0, n_i = 0;
-   struct nlattr *r ;
+   struct nlattr *nest;
 
read_lock_bh(hinfo-lock);
 
@@ -84,15 +84,17 @@ static int tcf_dump_walker(struct sk_buff *skb, struct 
netlink_callback *cb,
continue;
a-priv = p;
a-order = n_i;
-   r = (struct nlattr *)skb_tail_pointer(skb);
-   NLA_PUT(skb, a-order, 0, NULL);
+
+   nest = nla_nest_start(skb, a-order);
+   if (nest == NULL)
+   goto nla_put_failure;
err = tcf_action_dump_1(skb, a, 0, 0);
if (err  0) {
index--;
-   nlmsg_trim(skb, r);
+   nlmsg_trim(skb, nest);
goto done;
}
-   r-nla_len = skb_tail_pointer(skb) - (u8 *)r;
+   nla_nest_end(skb, nest);
n_i++;
if (n_i = TCA_ACT_MAX_PRIO)
goto done;
@@ -105,7 +107,7 @@ done:
return n_i;
 
 nla_put_failure:
-   nlmsg_trim(skb, r);
+   nla_nest_cancel(skb, nest);
goto done;
 }
 
@@ -113,11 +115,12 @@ static int tcf_del_walker(struct sk_buff *skb, struct 
tc_action *a,
  struct tcf_hashinfo *hinfo)
 {
struct tcf_common *p, *s_p;
-   struct nlattr *r ;
+   struct nlattr *nest;
int i= 0, n_i = 0;
 
-   r = (struct nlattr *)skb_tail_pointer(skb);
-   NLA_PUT(skb, a-order, 0, NULL);
+   nest = nla_nest_start(skb, a-order);
+   if (nest == NULL)
+   goto nla_put_failure;
NLA_PUT(skb, TCA_KIND, IFNAMSIZ, a-ops-kind);
for (i = 0; i  (hinfo-hmask + 1); i++) {
p = hinfo-htab[tcf_hash(i, hinfo-hmask)];
@@ -131,11 +134,11 @@ static int tcf_del_walker(struct sk_buff *skb, struct 
tc_action *a,
}
}
NLA_PUT(skb, TCA_FCNT, 4, n_i);
-   r-nla_len = skb_tail_pointer(skb) - (u8 *)r;
+   nla_nest_end(skb, nest);
 
return n_i;
 nla_put_failure:
-   nlmsg_trim(skb, r);
+   nla_nest_cancel(skb, nest);
return -EINVAL;
 }
 
@@ -415,7 +418,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, 
int bind, int ref)
 {
int err = -EINVAL;
unsigned char *b = skb_tail_pointer(skb);
-   struct nlattr *r;
+   struct nlattr *nest;
 
if (a-ops == NULL || a-ops-dump == NULL)
return err;
@@ -423,10 +426,11 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action 
*a, int bind, int ref)
NLA_PUT(skb, TCA_KIND, IFNAMSIZ, a-ops-kind);
if (tcf_action_copy_stats(skb, a, 0))
goto nla_put_failure;
-   r = (struct nlattr *)skb_tail_pointer(skb);
-   NLA_PUT(skb, TCA_OPTIONS, 0, NULL);
+   nest = nla_nest_start(skb, TCA_OPTIONS);
+   if (nest == NULL)
+   goto nla_put_failure;
if ((err = tcf_action_dump_old(skb, a, bind, ref))  0) {
-   r-nla_len = skb_tail_pointer(skb) - (u8 *)r;
+   nla_nest_end(skb, nest);
return err;
}
 
@@ -441,17 +445,17 @@ tcf_action_dump(struct sk_buff *skb, struct tc_action 
*act, int bind, int ref)
 {
struct tc_action *a;
int err = -EINVAL;
-   unsigned 

[NET_SCHED 08/15]: Use NLA_PUT_STRING for string dumping

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use NLA_PUT_STRING for string dumping

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

---
commit ad688fbdf7dd0ebeb1b2fba0d7d2105bdf3c6de9
tree 68bb3e1dc3484d6ca0e7ddc55ad4e25864aaac84
parent bdd38a3b14cfa340da580f6e825d7f1142925926
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:55 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:55 +0100

 net/sched/act_api.c |4 ++--
 net/sched/act_ipt.c |2 +-
 net/sched/cls_api.c |2 +-
 net/sched/cls_fw.c  |2 +-
 net/sched/cls_u32.c |2 +-
 net/sched/sch_api.c |4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 3602260..e33e43a 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -121,7 +121,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct 
tc_action *a,
nest = nla_nest_start(skb, a-order);
if (nest == NULL)
goto nla_put_failure;
-   NLA_PUT(skb, TCA_KIND, IFNAMSIZ, a-ops-kind);
+   NLA_PUT_STRING(skb, TCA_KIND, a-ops-kind);
for (i = 0; i  (hinfo-hmask + 1); i++) {
p = hinfo-htab[tcf_hash(i, hinfo-hmask)];
 
@@ -423,7 +423,7 @@ tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, 
int bind, int ref)
if (a-ops == NULL || a-ops-dump == NULL)
return err;
 
-   NLA_PUT(skb, TCA_KIND, IFNAMSIZ, a-ops-kind);
+   NLA_PUT_STRING(skb, TCA_KIND, a-ops-kind);
if (tcf_action_copy_stats(skb, a, 0))
goto nla_put_failure;
nest = nla_nest_start(skb, TCA_OPTIONS);
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 1269334..ecda51d 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -257,7 +257,7 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct 
tc_action *a, int bind, int
NLA_PUT(skb, TCA_IPT_INDEX, 4, ipt-tcf_index);
NLA_PUT(skb, TCA_IPT_HOOK, 4, ipt-tcfi_hook);
NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), c);
-   NLA_PUT(skb, TCA_IPT_TABLE, IFNAMSIZ, ipt-tcfi_tname);
+   NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt-tcfi_tname);
tm.install = jiffies_to_clock_t(jiffies - ipt-tcf_tm.install);
tm.lastuse = jiffies_to_clock_t(jiffies - ipt-tcf_tm.lastuse);
tm.expires = jiffies_to_clock_t(ipt-tcf_tm.expires);
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 5584e7c..3377ca0 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -337,7 +337,7 @@ static int tcf_fill_node(struct sk_buff *skb, struct 
tcf_proto *tp,
tcm-tcm_ifindex = tp-q-dev-ifindex;
tcm-tcm_parent = tp-classid;
tcm-tcm_info = TC_H_MAKE(tp-prio, tp-protocol);
-   NLA_PUT(skb, TCA_KIND, IFNAMSIZ, tp-ops-kind);
+   NLA_PUT_STRING(skb, TCA_KIND, tp-ops-kind);
tcm-tcm_handle = fh;
if (RTM_DELTFILTER != event) {
tcm-tcm_handle = 0;
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index e3dfbb3..3107473 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -352,7 +352,7 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
NLA_PUT(skb, TCA_FW_CLASSID, 4, f-res.classid);
 #ifdef CONFIG_NET_CLS_IND
if (strlen(f-indev))
-   NLA_PUT(skb, TCA_FW_INDEV, IFNAMSIZ, f-indev);
+   NLA_PUT_STRING(skb, TCA_FW_INDEV, f-indev);
 #endif /* CONFIG_NET_CLS_IND */
if (head-mask != 0x)
NLA_PUT(skb, TCA_FW_MASK, 4, head-mask);
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index b51c2c3..7a15025 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -732,7 +732,7 @@ static int u32_dump(struct tcf_proto *tp, unsigned long fh,
 
 #ifdef CONFIG_NET_CLS_IND
if(strlen(n-indev))
-   NLA_PUT(skb, TCA_U32_INDEV, IFNAMSIZ, n-indev);
+   NLA_PUT_STRING(skb, TCA_U32_INDEV, n-indev);
 #endif
 #ifdef CONFIG_CLS_U32_PERF
NLA_PUT(skb, TCA_U32_PCNT,
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 7abb028..8db554d 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -834,7 +834,7 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc 
*q, u32 clid,
tcm-tcm_parent = clid;
tcm-tcm_handle = q-handle;
tcm-tcm_info = atomic_read(q-refcnt);
-   NLA_PUT(skb, TCA_KIND, IFNAMSIZ, q-ops-id);
+   NLA_PUT_STRING(skb, TCA_KIND, q-ops-id);
if (q-ops-dump  q-ops-dump(q, skb)  0)
goto nla_put_failure;
q-qstats.qlen = q-q.qlen;
@@ -1080,7 +1080,7 @@ static int tc_fill_tclass(struct sk_buff *skb, struct 
Qdisc *q,
tcm-tcm_parent = q-handle;
tcm-tcm_handle = q-handle;
tcm-tcm_info = 0;
-   NLA_PUT(skb, TCA_KIND, IFNAMSIZ, q-ops-id);
+   NLA_PUT_STRING(skb, TCA_KIND, q-ops-id);
if (cl_ops-dump  cl_ops-dump(q, cl, skb, tcm)  0)
goto nla_put_failure;
 
--
To unsubscribe from this list: send the line 

[NET_SCHED 10/15]: Use typeful attribute parsing helpers

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use typeful attribute parsing helpers

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

---
commit 3e73383f7c353af51e8cc475f1c217a6b81fcecf
tree 53d369ca2ffca26cf46c57d2a9043d53da7474f8
parent 04d3c2781cba0b4ab75005de0defdb2a58178f21
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:56 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:56 +0100

 net/sched/act_api.c |2 +-
 net/sched/act_ipt.c |4 ++--
 net/sched/act_police.c  |5 ++---
 net/sched/cls_basic.c   |2 +-
 net/sched/cls_fw.c  |6 +++---
 net/sched/cls_route.c   |8 
 net/sched/cls_rsvp.h|4 ++--
 net/sched/cls_tcindex.c |   11 +--
 net/sched/cls_u32.c |8 
 net/sched/em_meta.c |2 +-
 net/sched/sch_atm.c |4 ++--
 11 files changed, 27 insertions(+), 29 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 41fbd49..0b8eb23 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -690,7 +690,7 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, 
u32 pid)
if (tb[TCA_ACT_INDEX] == NULL ||
nla_len(tb[TCA_ACT_INDEX])  sizeof(index))
goto err_out;
-   index = *(int *)nla_data(tb[TCA_ACT_INDEX]);
+   index = nla_get_u32(tb[TCA_ACT_INDEX]);
 
err = -ENOMEM;
a = kzalloc(sizeof(struct tc_action), GFP_KERNEL);
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 5dd701a..7ab2419 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -123,7 +123,7 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr 
*est,
 
if (tb[TCA_IPT_INDEX] != NULL 
nla_len(tb[TCA_IPT_INDEX]) = sizeof(u32))
-   index = *(u32 *)nla_data(tb[TCA_IPT_INDEX]);
+   index = nla_get_u32(tb[TCA_IPT_INDEX]);
 
pc = tcf_hash_check(index, a, bind, ipt_hash_info);
if (!pc) {
@@ -140,7 +140,7 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr 
*est,
}
ipt = to_ipt(pc);
 
-   hook = *(u32 *)nla_data(tb[TCA_IPT_HOOK]);
+   hook = nla_get_u32(tb[TCA_IPT_HOOK]);
 
err = -ENOMEM;
tname = kmalloc(IFNAMSIZ, GFP_KERNEL);
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 79db6bb..62de806 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -203,7 +203,7 @@ override:
}
 
if (tb[TCA_POLICE_RESULT])
-   police-tcfp_result = *(u32*)nla_data(tb[TCA_POLICE_RESULT]);
+   police-tcfp_result = nla_get_u32(tb[TCA_POLICE_RESULT]);
police-tcfp_toks = police-tcfp_burst = parm-burst;
police-tcfp_mtu = parm-mtu;
if (police-tcfp_mtu == 0) {
@@ -216,8 +216,7 @@ override:
police-tcf_action = parm-action;
 
if (tb[TCA_POLICE_AVRATE])
-   police-tcfp_ewma_rate =
-   *(u32*)nla_data(tb[TCA_POLICE_AVRATE]);
+   police-tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]);
if (est)
gen_replace_estimator(police-tcf_bstats,
  police-tcf_rate_est,
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 58444fe..0c872a7 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -150,7 +150,7 @@ static inline int basic_set_parms(struct tcf_proto *tp, 
struct basic_filter *f,
goto errout;
 
if (tb[TCA_BASIC_CLASSID]) {
-   f-res.classid = *(u32*)nla_data(tb[TCA_BASIC_CLASSID]);
+   f-res.classid = nla_get_u32(tb[TCA_BASIC_CLASSID]);
tcf_bind_filter(tp, f-res, base);
}
 
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 61ebe25..b75696d 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -203,7 +203,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
if (tb[TCA_FW_CLASSID]) {
if (nla_len(tb[TCA_FW_CLASSID]) != sizeof(u32))
goto errout;
-   f-res.classid = *(u32*)nla_data(tb[TCA_FW_CLASSID]);
+   f-res.classid = nla_get_u32(tb[TCA_FW_CLASSID]);
tcf_bind_filter(tp, f-res, base);
}
 
@@ -218,7 +218,7 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
if (tb[TCA_FW_MASK]) {
if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
goto errout;
-   mask = *(u32*)nla_data(tb[TCA_FW_MASK]);
+   mask = nla_get_u32(tb[TCA_FW_MASK]);
if (mask != head-mask)
goto errout;
} else if (head-mask != 0x)
@@ -264,7 +264,7 @@ static int fw_change(struct tcf_proto *tp, unsigned long 
base,
if (tb[TCA_FW_MASK]) {
if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
return -EINVAL;
-   mask = *(u32*)nla_data(tb[TCA_FW_MASK]);
+   mask = 

[NET_SCHED 09/15]: Use typeful attribute construction helpers

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use typeful attribute construction helpers

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

---
commit 04d3c2781cba0b4ab75005de0defdb2a58178f21
tree a1b904b7f29ad1ff7cff310128b3fd67e2543278
parent ad688fbdf7dd0ebeb1b2fba0d7d2105bdf3c6de9
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:55 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:55 +0100

 net/sched/act_api.c |2 +-
 net/sched/act_ipt.c |4 ++--
 net/sched/act_police.c  |5 ++---
 net/sched/cls_basic.c   |2 +-
 net/sched/cls_fw.c  |4 ++--
 net/sched/cls_route.c   |8 
 net/sched/cls_rsvp.h|2 +-
 net/sched/cls_tcindex.c |   11 +--
 net/sched/cls_u32.c |8 
 net/sched/em_meta.c |3 +--
 net/sched/sch_atm.c |8 +++-
 11 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index e33e43a..41fbd49 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -133,7 +133,7 @@ static int tcf_del_walker(struct sk_buff *skb, struct 
tc_action *a,
p = s_p;
}
}
-   NLA_PUT(skb, TCA_FCNT, 4, n_i);
+   NLA_PUT_U32(skb, TCA_FCNT, n_i);
nla_nest_end(skb, nest);
 
return n_i;
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index ecda51d..5dd701a 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -254,8 +254,8 @@ static int tcf_ipt_dump(struct sk_buff *skb, struct 
tc_action *a, int bind, int
strcpy(t-u.user.name, ipt-tcfi_t-u.kernel.target-name);
 
NLA_PUT(skb, TCA_IPT_TARG, ipt-tcfi_t-u.user.target_size, t);
-   NLA_PUT(skb, TCA_IPT_INDEX, 4, ipt-tcf_index);
-   NLA_PUT(skb, TCA_IPT_HOOK, 4, ipt-tcfi_hook);
+   NLA_PUT_U32(skb, TCA_IPT_INDEX, ipt-tcf_index);
+   NLA_PUT_U32(skb, TCA_IPT_HOOK, ipt-tcfi_hook);
NLA_PUT(skb, TCA_IPT_CNT, sizeof(struct tc_cnt), c);
NLA_PUT_STRING(skb, TCA_IPT_TABLE, ipt-tcfi_tname);
tm.install = jiffies_to_clock_t(jiffies - ipt-tcf_tm.install);
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index ee2f1b6..79db6bb 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -339,10 +339,9 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action 
*a, int bind, int ref)
memset(opt.peakrate, 0, sizeof(opt.peakrate));
NLA_PUT(skb, TCA_POLICE_TBF, sizeof(opt), opt);
if (police-tcfp_result)
-   NLA_PUT(skb, TCA_POLICE_RESULT, sizeof(int),
-   police-tcfp_result);
+   NLA_PUT_U32(skb, TCA_POLICE_RESULT, police-tcfp_result);
if (police-tcfp_ewma_rate)
-   NLA_PUT(skb, TCA_POLICE_AVRATE, 4, police-tcfp_ewma_rate);
+   NLA_PUT_U32(skb, TCA_POLICE_AVRATE, police-tcfp_ewma_rate);
return skb-len;
 
 nla_put_failure:
diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 6d08b42..58444fe 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -258,7 +258,7 @@ static int basic_dump(struct tcf_proto *tp, unsigned long 
fh,
goto nla_put_failure;
 
if (f-res.classid)
-   NLA_PUT(skb, TCA_BASIC_CLASSID, sizeof(u32), f-res.classid);
+   NLA_PUT_U32(skb, TCA_BASIC_CLASSID, f-res.classid);
 
if (tcf_exts_dump(skb, f-exts, basic_ext_map)  0 ||
tcf_em_tree_dump(skb, f-ematches, TCA_BASIC_EMATCHES)  0)
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index 3107473..61ebe25 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -349,13 +349,13 @@ static int fw_dump(struct tcf_proto *tp, unsigned long fh,
goto nla_put_failure;
 
if (f-res.classid)
-   NLA_PUT(skb, TCA_FW_CLASSID, 4, f-res.classid);
+   NLA_PUT_U32(skb, TCA_FW_CLASSID, f-res.classid);
 #ifdef CONFIG_NET_CLS_IND
if (strlen(f-indev))
NLA_PUT_STRING(skb, TCA_FW_INDEV, f-indev);
 #endif /* CONFIG_NET_CLS_IND */
if (head-mask != 0x)
-   NLA_PUT(skb, TCA_FW_MASK, 4, head-mask);
+   NLA_PUT_U32(skb, TCA_FW_MASK, head-mask);
 
if (tcf_exts_dump(skb, f-exts, fw_ext_map)  0)
goto nla_put_failure;
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 1ce1f36..7752586 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -565,17 +565,17 @@ static int route4_dump(struct tcf_proto *tp, unsigned 
long fh,
 
if (!(f-handle0x8000)) {
id = f-id0xFF;
-   NLA_PUT(skb, TCA_ROUTE4_TO, sizeof(id), id);
+   NLA_PUT_U32(skb, TCA_ROUTE4_TO, id);
}
if (f-handle0x8000) {
if ((f-handle16) != 0x)
-   NLA_PUT(skb, TCA_ROUTE4_IIF, sizeof(f-iif), f-iif);
+   NLA_PUT_U32(skb, TCA_ROUTE4_IIF, f-iif);
} else {
id = f-id16;
-   NLA_PUT(skb, 

[NET_SCHED 11/15]: sch_api: introduce constant for rate table size

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: sch_api: introduce constant for rate table size

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

---
commit b21f31e516f993016f8a1ade331bcaf71576b4e2
tree e59049e1fb3f2711d83c196d2f54b5021dc68330
parent 3e73383f7c353af51e8cc475f1c217a6b81fcecf
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:56 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:56 +0100

 include/linux/pkt_sched.h |2 ++
 net/sched/sch_api.c   |3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 919af93..3276135 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -83,6 +83,8 @@ struct tc_ratespec
__u32   rate;
 };
 
+#define TC_RTAB_SIZE   1024
+
 /* FIFO section */
 
 struct tc_fifo_qopt
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 8db554d..7e3c048 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -244,7 +244,8 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec 
*r, struct nlattr *ta
}
}
 
-   if (tab == NULL || r-rate == 0 || r-cell_log == 0 || nla_len(tab) != 
1024)
+   if (tab == NULL || r-rate == 0 || r-cell_log == 0 ||
+   nla_len(tab) != TC_RTAB_SIZE)
return NULL;
 
rtab = kmalloc(sizeof(*rtab), GFP_KERNEL);
--
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


[NET_SCHED 12/15]: Use nla_policy for attribute validation in packet schedulers

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use nla_policy for attribute validation in packet schedulers

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

---
commit 76c3c24283fa9f78d8dc30c8eb73e0f11934bf69
tree bcc9baf4eae9086d377efff17fbd37a360ac64b7
parent b21f31e516f993016f8a1ade331bcaf71576b4e2
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:57 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:12:57 +0100

 net/sched/sch_atm.c|   12 
 net/sched/sch_cbq.c|   47 +--
 net/sched/sch_dsmark.c |   33 +++--
 net/sched/sch_gred.c   |   16 ++--
 net/sched/sch_hfsc.c   |   14 +++---
 net/sched/sch_htb.c|   17 +++--
 net/sched/sch_netem.c  |   19 ---
 net/sched/sch_red.c|   11 +++
 net/sched/sch_tbf.c|   11 ---
 9 files changed, 87 insertions(+), 93 deletions(-)

diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 0c71f2e..3352734 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -195,6 +195,11 @@ static const u8 llc_oui_ip[] = {
0x08, 0x00
 }; /* Ethertype IP (0800) */
 
+static const struct nla_policy atm_policy[TCA_ATM_MAX + 1] = {
+   [TCA_ATM_FD]= { .type = NLA_U32 },
+   [TCA_ATM_EXCESS]= { .type = NLA_U32 },
+};
+
 static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent,
 struct nlattr **tca, unsigned long *arg)
 {
@@ -225,11 +230,12 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, 
u32 parent,
return -EBUSY;
if (opt == NULL)
return -EINVAL;
-   error = nla_parse_nested(tb, TCA_ATM_MAX, opt, NULL);
+
+   error = nla_parse_nested(tb, TCA_ATM_MAX, opt, atm_policy);
if (error  0)
return error;
 
-   if (!tb[TCA_ATM_FD] || nla_len(tb[TCA_ATM_FD])  sizeof(fd))
+   if (!tb[TCA_ATM_FD])
return -EINVAL;
fd = nla_get_u32(tb[TCA_ATM_FD]);
pr_debug(atm_tc_change: fd %d\n, fd);
@@ -243,8 +249,6 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, 
u32 parent,
if (!tb[TCA_ATM_EXCESS])
excess = NULL;
else {
-   if (nla_len(tb[TCA_ATM_EXCESS]) != sizeof(u32))
-   return -EINVAL;
excess = (struct atm_flow_data *)
atm_tc_get(sch, nla_get_u32(tb[TCA_ATM_EXCESS]));
if (!excess)
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index da0f6c0..09969c1 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1377,6 +1377,16 @@ static int cbq_set_fopt(struct cbq_class *cl, struct 
tc_cbq_fopt *fopt)
return 0;
 }
 
+static const struct nla_policy cbq_policy[TCA_CBQ_MAX + 1] = {
+   [TCA_CBQ_LSSOPT]= { .len = sizeof(struct tc_cbq_lssopt) },
+   [TCA_CBQ_WRROPT]= { .len = sizeof(struct tc_cbq_wrropt) },
+   [TCA_CBQ_FOPT]  = { .len = sizeof(struct tc_cbq_fopt) },
+   [TCA_CBQ_OVL_STRATEGY]  = { .len = sizeof(struct tc_cbq_ovl) },
+   [TCA_CBQ_RATE]  = { .len = sizeof(struct tc_ratespec) },
+   [TCA_CBQ_RTAB]  = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
+   [TCA_CBQ_POLICE]= { .len = sizeof(struct tc_cbq_police) },
+};
+
 static int cbq_init(struct Qdisc *sch, struct nlattr *opt)
 {
struct cbq_sched_data *q = qdisc_priv(sch);
@@ -1384,16 +1394,11 @@ static int cbq_init(struct Qdisc *sch, struct nlattr 
*opt)
struct tc_ratespec *r;
int err;
 
-   err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, NULL);
+   err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy);
if (err  0)
return err;
 
-   if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL ||
-   nla_len(tb[TCA_CBQ_RATE])  sizeof(struct tc_ratespec))
-   return -EINVAL;
-
-   if (tb[TCA_CBQ_LSSOPT] 
-   nla_len(tb[TCA_CBQ_LSSOPT])  sizeof(struct tc_cbq_lssopt))
+   if (tb[TCA_CBQ_RTAB] == NULL || tb[TCA_CBQ_RATE] == NULL)
return -EINVAL;
 
r = nla_data(tb[TCA_CBQ_RATE]);
@@ -1771,36 +1776,10 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 
parentid, struct nlattr **t
if (opt == NULL)
return -EINVAL;
 
-   err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, NULL);
+   err = nla_parse_nested(tb, TCA_CBQ_MAX, opt, cbq_policy);
if (err  0)
return err;
 
-   if (tb[TCA_CBQ_OVL_STRATEGY] 
-   nla_len(tb[TCA_CBQ_OVL_STRATEGY])  sizeof(struct tc_cbq_ovl))
-   return -EINVAL;
-
-   if (tb[TCA_CBQ_FOPT] 
-   nla_len(tb[TCA_CBQ_FOPT])  sizeof(struct tc_cbq_fopt))
-   return -EINVAL;
-
-   if (tb[TCA_CBQ_RATE] 
-   nla_len(tb[TCA_CBQ_RATE])  sizeof(struct tc_ratespec))
-   return -EINVAL;
-
-   if 

[NET_SCHED 13/15]: Use nla_policy for attribute validation in classifiers

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use nla_policy for attribute validation in classifiers

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

---
commit d177578bdf08849a388f1bc42a1d0566c6a3aded
tree 2eda0cf1e0479dab464acda9def525df27bd4307
parent 76c3c24283fa9f78d8dc30c8eb73e0f11934bf69
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:14:08 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:14:08 +0100

 net/sched/cls_basic.c   |   12 +++-
 net/sched/cls_fw.c  |   17 -
 net/sched/cls_route.c   |   19 ---
 net/sched/cls_rsvp.h|   26 +++---
 net/sched/cls_tcindex.c |   31 +--
 net/sched/cls_u32.c |   22 --
 6 files changed, 59 insertions(+), 68 deletions(-)

diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
index 0c872a7..bfb4342 100644
--- a/net/sched/cls_basic.c
+++ b/net/sched/cls_basic.c
@@ -129,6 +129,11 @@ static int basic_delete(struct tcf_proto *tp, unsigned 
long arg)
return -ENOENT;
 }
 
+static const struct nla_policy basic_policy[TCA_BASIC_MAX + 1] = {
+   [TCA_BASIC_CLASSID] = { .type = NLA_U32 },
+   [TCA_BASIC_EMATCHES]= { .type = NLA_NESTED },
+};
+
 static inline int basic_set_parms(struct tcf_proto *tp, struct basic_filter *f,
  unsigned long base, struct nlattr **tb,
  struct nlattr *est)
@@ -137,10 +142,6 @@ static inline int basic_set_parms(struct tcf_proto *tp, 
struct basic_filter *f,
struct tcf_exts e;
struct tcf_ematch_tree t;
 
-   if (tb[TCA_BASIC_CLASSID])
-   if (nla_len(tb[TCA_BASIC_CLASSID])  sizeof(u32))
-   return err;
-
err = tcf_exts_validate(tp, tb, est, e, basic_ext_map);
if (err  0)
return err;
@@ -174,7 +175,8 @@ static int basic_change(struct tcf_proto *tp, unsigned long 
base, u32 handle,
if (tca[TCA_OPTIONS] == NULL)
return -EINVAL;
 
-   err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS], NULL);
+   err = nla_parse_nested(tb, TCA_BASIC_MAX, tca[TCA_OPTIONS],
+  basic_policy);
if (err  0)
return err;
 
diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
index b75696d..436a6e7 100644
--- a/net/sched/cls_fw.c
+++ b/net/sched/cls_fw.c
@@ -186,6 +186,12 @@ out:
return -EINVAL;
 }
 
+static const struct nla_policy fw_policy[TCA_FW_MAX + 1] = {
+   [TCA_FW_CLASSID]= { .type = NLA_U32 },
+   [TCA_FW_INDEV]  = { .type = NLA_STRING, .len = IFNAMSIZ },
+   [TCA_FW_MASK]   = { .type = NLA_U32 },
+};
+
 static int
 fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
struct nlattr **tb, struct nlattr **tca, unsigned long base)
@@ -201,8 +207,6 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
 
err = -EINVAL;
if (tb[TCA_FW_CLASSID]) {
-   if (nla_len(tb[TCA_FW_CLASSID]) != sizeof(u32))
-   goto errout;
f-res.classid = nla_get_u32(tb[TCA_FW_CLASSID]);
tcf_bind_filter(tp, f-res, base);
}
@@ -216,8 +220,6 @@ fw_change_attrs(struct tcf_proto *tp, struct fw_filter *f,
 #endif /* CONFIG_NET_CLS_IND */
 
if (tb[TCA_FW_MASK]) {
-   if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
-   goto errout;
mask = nla_get_u32(tb[TCA_FW_MASK]);
if (mask != head-mask)
goto errout;
@@ -246,7 +248,7 @@ static int fw_change(struct tcf_proto *tp, unsigned long 
base,
if (!opt)
return handle ? -EINVAL : 0;
 
-   err = nla_parse_nested(tb, TCA_FW_MAX, opt, NULL);
+   err = nla_parse_nested(tb, TCA_FW_MAX, opt, fw_policy);
if (err  0)
return err;
 
@@ -261,11 +263,8 @@ static int fw_change(struct tcf_proto *tp, unsigned long 
base,
 
if (head == NULL) {
u32 mask = 0x;
-   if (tb[TCA_FW_MASK]) {
-   if (nla_len(tb[TCA_FW_MASK]) != sizeof(u32))
-   return -EINVAL;
+   if (tb[TCA_FW_MASK])
mask = nla_get_u32(tb[TCA_FW_MASK]);
-   }
 
head = kzalloc(sizeof(struct fw_head), GFP_KERNEL);
if (head == NULL)
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index ae97238..f7e7d39 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -323,6 +323,13 @@ static int route4_delete(struct tcf_proto *tp, unsigned 
long arg)
return 0;
 }
 
+static const struct nla_policy route4_policy[TCA_ROUTE4_MAX + 1] = {
+   [TCA_ROUTE4_CLASSID]= { .type = NLA_U32 },
+   [TCA_ROUTE4_TO] = { .type = NLA_U32 },
+   [TCA_ROUTE4_FROM]   = { .type = NLA_U32 },
+   [TCA_ROUTE4_IIF]= { .type = NLA_U32 },
+};
+
 

[NET_SCHED 15/15]: Use nla_policy for attribute validation in ematches

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use nla_policy for attribute validation in ematches

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

---
commit 9420f06512465a8a90f3ff0df8b943989bc7e2e7
tree 7556b31b93647c9d2c30eb567b50671d368f8ced
parent 99302e1c1ed003305e9a0102aa772e2f2d61114c
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:23:09 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:23:09 +0100

 net/sched/em_meta.c |9 ++---
 net/sched/ematch.c  |   11 ++-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index d9f487d..a1e5619 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -745,6 +745,10 @@ static inline int meta_is_supported(struct meta_value *val)
return (!meta_id(val) || meta_ops(val)-get);
 }
 
+static const struct nla_policy meta_policy[TCA_EM_META_MAX + 1] = {
+   [TCA_EM_META_HDR]   = { .len = sizeof(struct tcf_meta_hdr) },
+};
+
 static int em_meta_change(struct tcf_proto *tp, void *data, int len,
  struct tcf_ematch *m)
 {
@@ -753,13 +757,12 @@ static int em_meta_change(struct tcf_proto *tp, void 
*data, int len,
struct tcf_meta_hdr *hdr;
struct meta_match *meta = NULL;
 
-   err = nla_parse(tb, TCA_EM_META_MAX, data, len, NULL);
+   err = nla_parse(tb, TCA_EM_META_MAX, data, len, meta_policy);
if (err  0)
goto errout;
 
err = -EINVAL;
-   if (tb[TCA_EM_META_HDR] == NULL ||
-   nla_len(tb[TCA_EM_META_HDR])  sizeof(*hdr))
+   if (tb[TCA_EM_META_HDR] == NULL)
goto errout;
hdr = nla_data(tb[TCA_EM_META_HDR]);
 
diff --git a/net/sched/ematch.c b/net/sched/ematch.c
index daa9c4e..74ff918 100644
--- a/net/sched/ematch.c
+++ b/net/sched/ematch.c
@@ -282,6 +282,11 @@ errout:
return err;
 }
 
+static const struct nla_policy em_policy[TCA_EMATCH_TREE_MAX + 1] = {
+   [TCA_EMATCH_TREE_HDR]   = { .len = sizeof(struct tcf_ematch_tree_hdr) },
+   [TCA_EMATCH_TREE_LIST]  = { .type = NLA_NESTED },
+};
+
 /**
  * tcf_em_tree_validate - validate ematch config TLV and build ematch tree
  *
@@ -312,7 +317,7 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct 
nlattr *nla,
return 0;
}
 
-   err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, NULL);
+   err = nla_parse_nested(tb, TCA_EMATCH_TREE_MAX, nla, em_policy);
if (err  0)
goto errout;
 
@@ -323,10 +328,6 @@ int tcf_em_tree_validate(struct tcf_proto *tp, struct 
nlattr *nla,
if (rt_hdr == NULL || rt_list == NULL)
goto errout;
 
-   if (nla_len(rt_hdr)  sizeof(*tree_hdr) ||
-   nla_len(rt_list)  sizeof(*rt_match))
-   goto errout;
-
tree_hdr = nla_data(rt_hdr);
memcpy(tree-hdr, tree_hdr, sizeof(*tree_hdr));
 
--
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


[NET_SCHED 14/15]: Use nla_policy for attribute validation in actions

2008-01-23 Thread Patrick McHardy
[NET_SCHED]: Use nla_policy for attribute validation in actions

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

---
commit 99302e1c1ed003305e9a0102aa772e2f2d61114c
tree 05286e8f9d74ad273d6a6e12d7bc794a19c4ea4c
parent d177578bdf08849a388f1bc42a1d0566c6a3aded
author Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:23:07 +0100
committer Patrick McHardy [EMAIL PROTECTED] Wed, 23 Jan 2008 17:23:07 +0100

 net/sched/act_gact.c   |   15 ---
 net/sched/act_ipt.c|   19 ---
 net/sched/act_mirred.c |9 ++---
 net/sched/act_nat.c|9 ++---
 net/sched/act_pedit.c  |9 ++---
 net/sched/act_police.c |   16 
 net/sched/act_simple.c |7 +--
 7 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index df214d4..422872c 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -53,6 +53,11 @@ typedef int (*g_rand)(struct tcf_gact *gact);
 static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
 #endif /* CONFIG_GACT_PROB */
 
+static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
+   [TCA_GACT_PARMS]= { .len = sizeof(struct tc_gact) },
+   [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
+};
+
 static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
 struct tc_action *a, int ovr, int bind)
 {
@@ -66,20 +71,16 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr 
*est,
if (nla == NULL)
return -EINVAL;
 
-   err = nla_parse_nested(tb, TCA_GACT_MAX, nla, NULL);
+   err = nla_parse_nested(tb, TCA_GACT_MAX, nla, gact_policy);
if (err  0)
return err;
 
-   if (tb[TCA_GACT_PARMS] == NULL ||
-   nla_len(tb[TCA_GACT_PARMS])  sizeof(*parm))
+   if (tb[TCA_GACT_PARMS] == NULL)
return -EINVAL;
parm = nla_data(tb[TCA_GACT_PARMS]);
 
+#ifndef CONFIG_GACT_PROB
if (tb[TCA_GACT_PROB] != NULL)
-#ifdef CONFIG_GACT_PROB
-   if (nla_len(tb[TCA_GACT_PROB])  sizeof(struct tc_gact_p))
-   return -EINVAL;
-#else
return -EOPNOTSUPP;
 #endif
 
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 7ab2419..da696fd 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -92,6 +92,13 @@ static int tcf_ipt_release(struct tcf_ipt *ipt, int bind)
return ret;
 }
 
+static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = {
+   [TCA_IPT_TABLE] = { .type = NLA_STRING, .len = IFNAMSIZ },
+   [TCA_IPT_HOOK]  = { .type = NLA_U32 },
+   [TCA_IPT_INDEX] = { .type = NLA_U32 },
+   [TCA_IPT_TARG]  = { .len = sizeof(struct ipt_entry_target) },
+};
+
 static int tcf_ipt_init(struct nlattr *nla, struct nlattr *est,
struct tc_action *a, int ovr, int bind)
 {
@@ -107,22 +114,20 @@ static int tcf_ipt_init(struct nlattr *nla, struct nlattr 
*est,
if (nla == NULL)
return -EINVAL;
 
-   err = nla_parse_nested(tb, TCA_IPT_MAX, nla, NULL);
+   err = nla_parse_nested(tb, TCA_IPT_MAX, nla, ipt_policy);
if (err  0)
return err;
 
-   if (tb[TCA_IPT_HOOK] == NULL ||
-   nla_len(tb[TCA_IPT_HOOK])  sizeof(u32))
+   if (tb[TCA_IPT_HOOK] == NULL)
return -EINVAL;
-   if (tb[TCA_IPT_TARG] == NULL ||
-   nla_len(tb[TCA_IPT_TARG])  sizeof(*t))
+   if (tb[TCA_IPT_TARG] == NULL)
return -EINVAL;
+
td = (struct ipt_entry_target *)nla_data(tb[TCA_IPT_TARG]);
if (nla_len(tb[TCA_IPT_TARG])  td-u.target_size)
return -EINVAL;
 
-   if (tb[TCA_IPT_INDEX] != NULL 
-   nla_len(tb[TCA_IPT_INDEX]) = sizeof(u32))
+   if (tb[TCA_IPT_INDEX] != NULL)
index = nla_get_u32(tb[TCA_IPT_INDEX]);
 
pc = tcf_hash_check(index, a, bind, ipt_hash_info);
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 6cb5e30..1aff005 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -54,6 +54,10 @@ static inline int tcf_mirred_release(struct tcf_mirred *m, 
int bind)
return 0;
 }
 
+static const struct nla_policy mirred_policy[TCA_MIRRED_MAX + 1] = {
+   [TCA_MIRRED_PARMS]  = { .len = sizeof(struct tc_mirred) },
+};
+
 static int tcf_mirred_init(struct nlattr *nla, struct nlattr *est,
   struct tc_action *a, int ovr, int bind)
 {
@@ -68,12 +72,11 @@ static int tcf_mirred_init(struct nlattr *nla, struct 
nlattr *est,
if (nla == NULL)
return -EINVAL;
 
-   err = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, NULL);
+   err = nla_parse_nested(tb, TCA_MIRRED_MAX, nla, mirred_policy);
if (err  0)
return err;
 
-   if (tb[TCA_MIRRED_PARMS] == NULL ||
-   nla_len(tb[TCA_MIRRED_PARMS])  sizeof(*parm))
+   if (tb[TCA_MIRRED_PARMS] == NULL)

Re: My 802.3ad is my bond

2008-01-23 Thread Jay Vosburgh
Steven Whitehouse [EMAIL PROTECTED] wrote:
[...]
This commit: ece95f7fefe3afae19e641e1b3f5e64b00d5b948 seems to have
caused a problem with parsing bond arguments as now only the numeric
arguments seem to work (in modprobe.conf) and specifying 802.3ad fails.
When I revert that patch in my local tree all seems ok.

Thanks for the report; I know what the problem here is.  I'll
get a fix out.

Also I notice that one of my two NICs now reports this:

bonding: bond0: link status definitely down for interface eth0,
disabling it
bonding: bond0: Interface eth0 is already enslaved!
bond0.5: no IPv6 routers present

which I think is also new with this set of bonding updates, before it
used to use both interfaces ok. I've not worked out which of the other
patches causes this so far, but I can if its helpful,

That would be helpful, as would some more details: e.g., the
various options passed to bonding, the complete dmesg log, contents of
/proc/net/bonding/bond0 [or whatever your interface is called], and
anything else you think would be helpful.

-J

---
-Jay Vosburgh, IBM Linux Technology Center, [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: My 802.3ad is my bond

2008-01-23 Thread Steven Whitehouse
Hi,

On Wed, 2008-01-23 at 09:13 -0800, Jay Vosburgh wrote:
 Steven Whitehouse [EMAIL PROTECTED] wrote:
 [...]
 This commit: ece95f7fefe3afae19e641e1b3f5e64b00d5b948 seems to have
 caused a problem with parsing bond arguments as now only the numeric
 arguments seem to work (in modprobe.conf) and specifying 802.3ad fails.
 When I revert that patch in my local tree all seems ok.
 
   Thanks for the report; I know what the problem here is.  I'll
 get a fix out.
 
 Also I notice that one of my two NICs now reports this:
 
 bonding: bond0: link status definitely down for interface eth0,
 disabling it
 bonding: bond0: Interface eth0 is already enslaved!
 bond0.5: no IPv6 routers present
 
 which I think is also new with this set of bonding updates, before it
 used to use both interfaces ok. I've not worked out which of the other
 patches causes this so far, but I can if its helpful,
 
   That would be helpful, as would some more details: e.g., the
 various options passed to bonding, the complete dmesg log, contents of
 /proc/net/bonding/bond0 [or whatever your interface is called], and
 anything else you think would be helpful.
 
   -J
 
 ---
   -Jay Vosburgh, IBM Linux Technology Center, [EMAIL PROTECTED]
Ok. I'll try and work out which patch it is, but in the mean time:

Ethernet Channel Bonding Driver: v3.2.3 (December 6, 2007)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation
Transmit Hash Policy: layer2 (0)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0

802.3ad info
LACP rate: slow
Active Aggregator Info:
Aggregator ID: 1
Number of ports: 1
Actor Key: 17
Partner Key: 4
Partner Mac Address: 00:12:a9:13:3f:67

Slave Interface: eth0
MII Status: down   -- this one should be up as well
Link Failure Count: 2
Permanent HW addr: 00:11:43:d7:75:74
Aggregator ID: 2

Slave Interface: eth1
MII Status: up
Link Failure Count: 1
Permanent HW addr: 00:11:43:d7:75:75
Aggregator ID: 1

Bonding options:
options bond0 miimon=100 mode=802.3ad

I'll send the dmesg by private email as its quite large,

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


SCTP NAT module for netfilter

2008-01-23 Thread Sohan Shetty
Is  anyone aware if there an  NAT module for netfilter being developed for SCTP 
protocol ?


I have searched the netfilter development tree source code and also mailing 
list and so far I have not found the NAT module for SCTP . There is SCTP 
conntrack module and packet match module. 

If anyone is aware and can point me to  some one who is already working on this 
or has evaluated this it would be of great help.


SCTP is defined in [RFC 2960] Stewart, R., Xie, Q., Morneault, K., Sharp, C., 
Schwarzbauer, H., Taylor, T., Rytina, I., Kalla, M., Zhang, L. and V. Paxson, 
Stream Control Transmission Protocol, RFC 2960, October 2000. 


Thanks and best regards
sohan

--
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: [ipw3945-devel] [PATCH 1/5] iwlwifi: iwl3945 flush interrupt mask

2008-01-23 Thread Chatre, Reinette
Joonwoo Park [EMAIL PROTECTED] wrote:

 interrupt mask
 
 After enabling/disabling interrupts flushing is required
 

I have been looking at this patch and I would like to get some more
feedback from the experts in the group.

First off, the register used for the read in order to flush has to be
safe. We have to make sure that the register has no side effects. To do
this we could use CSR_INT_MASK, as in #define iwl_flush32(iwl)
iwl_read32(iwl, CSR_INT_MASK) This also enables us to flush at the end
of a sequence of writes instead of after every write.

Digging deeper it is not 100% clear to me when we should do flushing to
handle write posting. I understand that it should be done in time
sensitive code, but that could on a high level mean any write operation
in the driver. How should it be decided which writes to the device need
to be flushed? 

Patch is kept below fyi.

Reinette

 Signed-off-by: Joonwoo Park [EMAIL PROTECTED] ---
 drivers/net/wireless/iwlwifi/iwl-io.h   |2 ++
 drivers/net/wireless/iwlwifi/iwl3945-base.c |6 ++
 2 files changed, 8 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h
 b/drivers/net/wireless/iwlwifi/iwl-io.h
 index 8a8b96f..f2bc30e 100644
 --- a/drivers/net/wireless/iwlwifi/iwl-io.h
 +++ b/drivers/net/wireless/iwlwifi/iwl-io.h
 @@ -87,6 +87,8 @@ static inline u32 __iwl_read32(char *f, u32
 l, struct iwl_priv *iwl, u32 ofs)
 #define iwl_read32(p, o) _iwl_read32(p, o)
 #endif
 
 +#define iwl_flush32(iwl, ofs) iwl_read32(iwl, ofs) +
 static inline int _iwl_poll_bit(struct iwl_priv *priv, u32 addr,
   u32 bits, u32 mask, int timeout)
 {
 diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c
 b/drivers/net/wireless/iwlwifi/iwl3945-base.c
 index 8ed898d..85f1112 100644
 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
 +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
 @@ -4410,6 +4410,7 @@ static void iwl_enable_interrupts(struct
   iwl_priv *priv) IWL_DEBUG_ISR(Enabling interrupts\n);
   set_bit(STATUS_INT_ENABLED, priv-status);
   iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
 + iwl_flush32(priv, CSR_INT_MASK);
 }
 
 static inline void iwl_disable_interrupts(struct iwl_priv *priv)
 @@ -4418,11 +4419,15 @@ static inline void
 iwl_disable_interrupts(struct iwl_priv *priv)
 
   /* disable interrupts from uCode/NIC to host */
   iwl_write32(priv, CSR_INT_MASK, 0x);
 + iwl_flush32(priv, CSR_INT_MASK);
 
   /* acknowledge/clear/reset any interrupts still pending
* from uCode or flow handler (Rx/Tx DMA) */
   iwl_write32(priv, CSR_INT, 0x);
 + iwl_flush32(priv, CSR_INT);
   iwl_write32(priv, CSR_FH_INT_STATUS, 0x);
 + iwl_flush32(priv, CSR_FH_INT_STATUS);
 +
   IWL_DEBUG_ISR(Disabled interrupts\n);
 }
 
 @@ -4840,6 +4845,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
* If we *don't* have something, we'll re-enable before
 leaving here. */
   inta_mask = iwl_read32(priv, CSR_INT_MASK);  /* just
 for debug */
   iwl_write32(priv, CSR_INT_MASK, 0x);
 + iwl_flush32(priv, CSR_INT_MASK);
 
   /* Discover which interrupts are active/pending */
   inta = iwl_read32(priv, CSR_INT);
 --
 1.5.3.rc5
 
 
 ---
 --
 Check out the new SourceForge.net Marketplace.
 It's the best place to buy or sell services for
 just about anything Open Source.
 http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.ne
 t/marketplace ___
 Ipw3945-devel mailing list
 [EMAIL PROTECTED]
 https://lists.sourceforge.net/lists/listinfo/ipw3945-devel

--
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] A few more pasemi_mac patches for 2.6.25

2008-01-23 Thread Olof Johansson
Hi,

This should be the last of my updates for 2.6.25:

1/3: pasemi_mac: Add support for changing mac address
2/3: pasemi_mac: add support for setting MTU
3/3: pasemi_mac: Disable interface on close



Thanks,

Olof
--
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] pasemi_mac: Disable interface on close

2008-01-23 Thread Olof Johansson
Turns out we never disable the interface. It doesn't really cause
any problems since the channel is off, but it's still better to do it
this way.

Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 059c6b0..2e39e02 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -1287,6 +1287,7 @@ static int pasemi_mac_close(struct net_device *dev)
pasemi_mac_pause_txchan(mac);
pasemi_mac_pause_rxint(mac);
pasemi_mac_pause_rxchan(mac);
+   pasemi_mac_intf_disable(mac);
 
free_irq(mac-tx-chan.irq, mac-tx);
free_irq(mac-rx-chan.irq, mac-rx);
--
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] pasemi_mac: Add support for changing mac address

2008-01-23 Thread Olof Johansson
Straightforward. It used to be hardcoded and impossible to override
with ifconfig.

Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bb88a41..59dea3f 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -221,6 +221,33 @@ static int pasemi_get_mac_addr(struct pasemi_mac *mac)
return 0;
 }
 
+static int pasemi_mac_set_mac_addr(struct net_device *dev, void *p)
+{
+   struct pasemi_mac *mac = netdev_priv(dev);
+   struct sockaddr *addr = p;
+   unsigned int adr0, adr1;
+
+   if (!is_valid_ether_addr(addr-sa_data))
+   return -EINVAL;
+
+   memcpy(dev-dev_addr, addr-sa_data, dev-addr_len);
+
+   adr0 = dev-dev_addr[2]  24 |
+  dev-dev_addr[3]  16 |
+  dev-dev_addr[4]  8 |
+  dev-dev_addr[5];
+   adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1);
+   adr1 = ~0x;
+   adr1 |= dev-dev_addr[0]  8 | dev-dev_addr[1];
+
+   pasemi_mac_intf_disable(mac);
+   write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0);
+   write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1);
+   pasemi_mac_intf_enable(mac);
+
+   return 0;
+}
+
 static int get_skb_hdr(struct sk_buff *skb, void **iphdr,
   void **tcph, u64 *hdr_flags, void *data)
 {
@@ -1475,6 +1502,7 @@ pasemi_mac_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
dev-stop = pasemi_mac_close;
dev-hard_start_xmit = pasemi_mac_start_tx;
dev-set_multicast_list = pasemi_mac_set_rx_mode;
+   dev-set_mac_address = pasemi_mac_set_mac_addr;
 
if (err)
goto out;
diff --git a/drivers/net/pasemi_mac.h b/drivers/net/pasemi_mac.h
index 8bee2a6..39d3259 100644
--- a/drivers/net/pasemi_mac.h
+++ b/drivers/net/pasemi_mac.h
@@ -96,6 +96,8 @@ struct pasemi_mac_buffer {
 /* MAC CFG register offsets */
 enum {
PAS_MAC_CFG_PCFG = 0x80,
+   PAS_MAC_CFG_ADR0 = 0x8c,
+   PAS_MAC_CFG_ADR1 = 0x90,
PAS_MAC_CFG_TXP = 0x98,
PAS_MAC_IPC_CHNL = 0x208,
 };
--
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] pasemi_mac: add support for setting MTU

2008-01-23 Thread Olof Johansson
Currently keeping it at 1500 bytes or below since jumbo frames need
special checksum offload on TX.

Signed-off-by: Olof Johansson [EMAIL PROTECTED]

diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 59dea3f..059c6b0 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -62,6 +62,10 @@
 
 #define LRO_MAX_AGGR 64
 
+#define PE_MIN_MTU 64
+#define PE_MAX_MTU 1500
+#define PE_DEF_MTU ETH_DATA_LEN
+
 #define DEFAULT_MSG_ENABLE   \
(NETIF_MSG_DRV  | \
 NETIF_MSG_PROBE| \
@@ -82,8 +86,6 @@
  ((ring)-size - 1))
 #define RING_AVAIL(ring)   ((ring-size) - RING_USED(ring))
 
-#define BUF_SIZE 1646 /* 1500 MTU + ETH_HLEN + VLAN_HLEN + 2 64B cachelines */
-
 MODULE_LICENSE(GPL);
 MODULE_AUTHOR (Olof Johansson [EMAIL PROTECTED]);
 MODULE_DESCRIPTION(PA Semi PWRficient Ethernet driver);
@@ -175,6 +177,24 @@ static int mac_to_intf(struct pasemi_mac *mac)
return -1;
 }
 
+static void pasemi_mac_intf_disable(struct pasemi_mac *mac)
+{
+   unsigned int flags;
+
+   flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
+   flags = ~PAS_MAC_CFG_PCFG_PE;
+   write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
+}
+
+static void pasemi_mac_intf_enable(struct pasemi_mac *mac)
+{
+   unsigned int flags;
+
+   flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
+   flags |= PAS_MAC_CFG_PCFG_PE;
+   write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
+}
+
 static int pasemi_get_mac_addr(struct pasemi_mac *mac)
 {
struct pci_dev *pdev = mac-pdev;
@@ -480,7 +500,7 @@ static void pasemi_mac_free_tx_resources(struct pasemi_mac 
*mac)
 
 }
 
-static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac)
+static void pasemi_mac_free_rx_buffers(struct pasemi_mac *mac)
 {
struct pasemi_mac_rxring *rx = rx_ring(mac);
unsigned int i;
@@ -500,7 +520,12 @@ static void pasemi_mac_free_rx_resources(struct pasemi_mac 
*mac)
}
 
for (i = 0; i  RX_RING_SIZE; i++)
-   RX_DESC(rx, i) = 0;
+   RX_BUFF(rx, i) = 0;
+}
+
+static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac)
+{
+   pasemi_mac_free_rx_buffers(mac);
 
dma_free_coherent(mac-dma_pdev-dev, RX_RING_SIZE * sizeof(u64),
  rx_ring(mac)-buffers, rx_ring(mac)-buf_dma);
@@ -530,14 +555,14 @@ static void pasemi_mac_replenish_rx_ring(const struct 
net_device *dev,
/* Entry in use? */
WARN_ON(*buff);
 
-   skb = dev_alloc_skb(BUF_SIZE);
+   skb = dev_alloc_skb(mac-bufsz);
skb_reserve(skb, LOCAL_SKB_ALIGN);
 
if (unlikely(!skb))
break;
 
dma = pci_map_single(mac-dma_pdev, skb-data,
-BUF_SIZE - LOCAL_SKB_ALIGN,
+mac-bufsz - LOCAL_SKB_ALIGN,
 PCI_DMA_FROMDEVICE);
 
if (unlikely(dma_mapping_error(dma))) {
@@ -547,7 +572,7 @@ static void pasemi_mac_replenish_rx_ring(const struct 
net_device *dev,
 
info-skb = skb;
info-dma = dma;
-   *buff = XCT_RXB_LEN(BUF_SIZE) | XCT_RXB_ADDR(dma);
+   *buff = XCT_RXB_LEN(mac-bufsz) | XCT_RXB_ADDR(dma);
fill++;
}
 
@@ -677,7 +702,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac_rxring *rx,
 
len = (macrx  XCT_MACRX_LLEN_M)  XCT_MACRX_LLEN_S;
 
-   pci_unmap_single(pdev, dma, BUF_SIZE-LOCAL_SKB_ALIGN,
+   pci_unmap_single(pdev, dma, mac-bufsz - LOCAL_SKB_ALIGN,
 PCI_DMA_FROMDEVICE);
 
if (macrx  XCT_MACRX_CRC) {
@@ -901,24 +926,6 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
return IRQ_HANDLED;
 }
 
-static void pasemi_mac_intf_disable(struct pasemi_mac *mac)
-{
-   unsigned int flags;
-
-   flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
-   flags = ~PAS_MAC_CFG_PCFG_PE;
-   write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
-}
-
-static void pasemi_mac_intf_enable(struct pasemi_mac *mac)
-{
-   unsigned int flags;
-
-   flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG);
-   flags |= PAS_MAC_CFG_PCFG_PE;
-   write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
-}
-
 static void pasemi_adjust_link(struct net_device *dev)
 {
struct pasemi_mac *mac = netdev_priv(dev);
@@ -1175,11 +1182,71 @@ out_rx_resources:
 
 #define MAX_RETRIES 5000
 
+static void pasemi_mac_pause_txchan(struct pasemi_mac *mac)
+{
+   unsigned int sta, retries;
+   int txch = tx_ring(mac)-chan.chno;
+
+   write_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch),
+ PAS_DMA_TXCHAN_TCMDSTA_ST);
+
+   for (retries = 0; retries  MAX_RETRIES; retries++) {
+   sta = read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(txch));
+   if (!(sta  PAS_DMA_TXCHAN_TCMDSTA_ACT))
+  

arp queries and ipsec policy

2008-01-23 Thread Marco Berizzi
Hello everybody.
I'm using openswan 2.4.x to drive the linux 2.4.23.14 ipsec
native stack (netkey).
Openswan by default insert a static route when an ipsec SA
is established: this is needed by the klips stack as it is
routing based. For example when a roadwarrior establish
an ipsec SA with the linux box I see a static route like
this:

# ip r s
road_warrior_public_ip dev eth0  scope link

This static route is placed by the default updown script.
When there is this route, I see linux doing arp queries for
the road_warrior_public_ip:

# tcpdump -pnvi eth0 arp
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
17:25:11.608179 arp who-has road_warrior_public_ip tell linux_public_ip_address
17:25:12.608171 arp who-has road_warrior_public_ip tell linux_public_ip_address
17:25:13.608224 arp who-has road_warrior_public_ip tell linux_public_ip_address

Is this behaviour expected?

I have seen this behaviour today because the ISP router
isn't configured with proxy_arp and linux is unable to
send the ESP packets because the is no arp reply from nobody.
However it is able to receive/decrypt them:

# tcpdump -pnvi eth0 ip host road_warrior_public_ip
tcpdump: listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes

17:24:55.107497 IP (tos 0x0, ttl 120, id 55048, offset 0, flags [none], proto:
ESP (50), length: 112) road_warrior_public_ip  linux_public_ip_address:
ESP(spi=0xe215d75f,seq=0x25), length 92

17:24:55.109304 IP (tos 0x0, ttl 128, id 2262, offset 0, flags [none], proto:
ICMP (1), length: 60) road_warrior_public_ip  172.25.5.4: ICMP echo request,
id 512, seq 50694, length 40

I have resolved the problem modifying the updown script so
it doesn't place the static route anymore.

PS: default parameters for eth0 on /proc except proxy_arp,
arp_announce and rp_filter
--
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] [IPV4] route: fix locking in rt_run_flush()

2008-01-23 Thread Eric Dumazet

[EMAIL PROTECTED] a écrit :

On Mon, Jan 21, 2008 at 02:40:43AM -0800, David Miller wrote:

From: Joonwoo Park [EMAIL PROTECTED]
Date: Tue, 22 Jan 2008 00:08:57 +0900

The rt_run_flush() can be stucked if it was called while netdev is on the 
high load.

It's possible when pushing rtable to rt_hash is faster than pulling
from it.

Signed-off-by: Joonwoo Park [EMAIL PROTECTED]

I agree with the analysis of the problem, however not the solution.

This will absolutely kill software interrupt latency.

In fact, we have moved much of the flush work into a workqueue in
net-2.6.25 because of how important that is

We need to find some other way to solve this.



Dave, Eric,
Thanks so much for comments.

I did stress tests and I found that the real problem was not consumer  supplier
issue.
It was the problem for me to innumerable enabling  disabling the softirq.
But I'm still thinking need of considering issue 'faster caching than flush'. :) 


ifconfig up on heavy loaded interface.
Before patching:
 time ifconfig eth1 up
 BUG: soft lockup - CPU#0 stuck for 11s! [events/0:9]
 ...

After patching:
 time ifconfig eth1 up
real0m0.007s
user0m0.000s
sys 0m0.004s

Thanks!
Joonwoo



From 87c29506de967e811ad5b57cd2e1a002134e878f Mon Sep 17 00:00:00 2001

From: Joonwoo Park [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 15:16:54 +0900
Subject: [PATCH] [IPV4] route: reduce locking/unlocking in rt_run_flush

The rt_run_flush does spin_lock_bh/spin_unlock_bh for rt_hash_mask + 1
times.
The rt_hash_mask takes from 32767 to 65535, so it's big overhead.
In addition, disable_bh/enable_bh for many times in the rt_run_flush
can cause stuck on a machine with heavily pended softirqs.

This patch reduces locking/unlocking as doing it with jumping the lock
slots.

ifconfig up on heavy loaded interface.
Before:
 time ifconfig eth1 up
 BUG: soft lockup - CPU#0 stuck for 11s! [events/0:9]
 ...

After:
 time ifconfig eth1 up
real0m0.007s
user0m0.000s
sys 0m0.004s



Unfortunatly, your patch doesnt work on CONFIG_SMP=n (softirq will be disabled 
for the whole scan of table)


Also, some machines around there have 2^22 slots in hash table, and NR_CPUS=4, 
so softirqs will be disabled for a too long time.


Please try net-2.6.25 and submit patches on top of it if necessary, since 
rt_run_flush() has pending changes, not in net-2.6


Note : The 'soft lockup' can be avoided by other means.

--
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.6.25 1/1]S2io: Multiqueue network device support implementation

2008-01-23 Thread Ramkrishna Vepa
 Sreenivasa Honnur [EMAIL PROTECTED] writes:
 
  Multiqueue netwrok device support implementation.
  - Added a loadable parameter multiq to enable/disable multiqueue
 support,
by default it is disabled.
  - skb-queue_mapping is not used for queue/fifo selection. FIFO
 iselection is
based on IP-TOS value, 0x0-0xF TOS values are mapped to 8 FIFOs.
 
 Standard way to use that would be using skb-priority
[Ram] Thanks. We can use this field to determine the priority. It should
simplify the code.

 
 But I'm surprised you bother with TOS for multi queues at all. TOS
 isn't a too important mechanism.
[Ram] Agreed TOS is not too important. The purpose of this patch was to
add the multiqueue functionality with a feature that can use it. With
multiple transmit fifos enabled, a whole new set of features that can be
enabled.

 
 I would have thought the primary use case would be per CPU TX
completion
 interrupts. With that the queue should be selected based on
 the the current CPU.
 
[Ram] I am assuming that this is with regards to msi-x interrupts. We
have done away with handling tx completion in the interrupt handler, and
are instead handling them in the context of the transmit. The slow path,
straggling transmit completions will be handled in the timer context.
This patch (along with other new features) will be sent soon.

Ram
 -Andi
--
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


arping

2008-01-23 Thread Michaelian Ennis
Someone filed a bug at bugs.gentoo.org reflecting a possible
enhancement to arping.  In short the patches author felt that select
should be used instead of signals to avoid missing a timeout.

The bug is located at:
http://bugs.gentoo.org/show_bug.cgi?id=144526

The diff follows:

--- arping.c2006-08-20 19:14:39.0 -0500
+++ /var/tmp/portage/iputils-021109-r3/work/iputils/arping.c2006-08-20
19:17:40.0 -0500
@@ -7,9 +7,6 @@
  * 2 of the License, or (at your option) any later version.
  *
  * Authors:Alexey Kuznetsov, [EMAIL PROTECTED]
- * 2006.08.18  erik quanstrom [EMAIL PROTECTED]
- * use select instead of signals so timeouts will 
work.
- * 
  */

 #include stdlib.h
@@ -18,6 +15,7 @@
 #include linux/sockios.h
 #include sys/file.h
 #include sys/time.h
+#include sys/signal.h
 #include sys/ioctl.h
 #include linux/if.h
 #include linux/if_arp.h
@@ -31,12 +29,12 @@
 #include string.h
 #include netinet/in.h
 #include arpa/inet.h
-#include stdarg.h

 #include SNAPSHOT.h

 static void usage(void) __attribute__((noreturn));

+int quit_on_reply=0;
 char *device=eth0;
 int ifindex;
 char *source;
@@ -45,10 +43,7 @@
 int dad, unsolicited, advert;
 int quiet;
 int count=-1;
-int ntosend=-1;
-int ntorecv=-1;
 int timeout;
-struct timeval timeouttv;
 int unicasting;
 int s;
 int broadcast_only;
@@ -64,19 +59,6 @@
 #define MS_TDIFF(tv1,tv2) ( ((tv1).tv_sec-(tv2).tv_sec)*1000 + \
   ((tv1).tv_usec-(tv2).tv_usec)/1000 )

-#define pkttrace(...)  /* fprintf(stderr, __VA_ARGS__) */
-
-void
-errexit(int err, const char* fmt, ...)
-{
-   va_list ap;
-
-   va_start(ap, fmt);
-   vfprintf(stderr, fmt, ap);
-   va_end(ap);
-   exit(err);
-}
-   
 void usage(void)
 {
fprintf(stderr,
@@ -97,6 +79,16 @@
exit(2);
 }

+void set_signal(int signo, void (*handler)(void))
+{
+   struct sigaction sa;
+
+   memset(sa, 0, sizeof(sa));
+   sa.sa_handler = (void (*)(int))handler;
+   sa.sa_flags = SA_RESTART;
+   sigaction(signo, sa, NULL);
+}
+
 int send_pack(int s, struct in_addr src, struct in_addr dst,
  struct sockaddr_ll *ME, struct sockaddr_ll *HE)
 {
@@ -130,9 +122,7 @@
p+=4;

gettimeofday(now, NULL);
-   pkttrace(sendto-\n);
err = sendto(s, buf, p-buf, 0, (struct sockaddr*)HE, sizeof(*HE));
-   pkttrace(sendto-\n);
if (err == p-buf) {
last = now;
sent++;
@@ -145,20 +135,20 @@
 void finish(void)
 {
if (!quiet) {
-   fflush(stdout);
-   fprintf(stderr, Sent %d probes (%d broadcast(s))\n, sent, 
brd_sent);
-   fprintf(stderr, Received %d response(s), received);
+   printf(Sent %d probes (%d broadcast(s))\n, sent, brd_sent);
+   printf(Received %d response(s), received);
if (brd_recv || req_recv) {
-   fprintf(stderr,  ();
+   printf( ();
if (req_recv)
-   fprintf(stderr, %d request(s), req_recv);
+   printf(%d request(s), req_recv);
if (brd_recv)
-   fprintf(stderr, %s%d broadcast(s),
+   printf(%s%d broadcast(s),
   req_recv ? ,  : ,
   brd_recv);
-   fprintf(stderr, ));
+   printf());
}
-   fprintf(stderr, \n);
+   printf(\n);
+   fflush(stdout);
}
if (dad)
exit(!!received);
@@ -167,13 +157,34 @@
exit(!received);
 }

+void catcher(void)
+{
+   struct timeval tv;
+
+   gettimeofday(tv, NULL);
+
+   if (start.tv_sec==0)
+   start = tv;
+
+   if (count-- == 0 || (timeout  MS_TDIFF(tv,start)  timeout*1000 + 
500))
+   finish();
+
+   if (last.tv_sec==0 || MS_TDIFF(tv,last)  500) {
+   send_pack(s, src, dst, me, he);
+   if (count == 0  unsolicited)
+   finish();
+   }
+   alarm(1);
+}
+
 void print_hex(unsigned char *p, int len)
 {
int i;
-   for (i=0; ilen-1; i++)
-   printf(%02X:, p[i]);
-   if(len)
+   for (i=0; ilen; i++) {
printf(%02X, p[i]);
+   if (i != len-1)
+   printf(:);
+   }
 }

 int recv_pack(unsigned char *buf, int len, struct sockaddr_ll *FROM)
@@ -274,6 +285,8 @@
brd_recv++;
if (ah-ar_op == htons(ARPOP_REQUEST))
req_recv++;
+   if (quit_on_reply)
+   finish();
if(!broadcast_only) {
memcpy(he.sll_addr, p, me.sll_halen);
unicasting=1;
@@ -281,75 +294,26 @@
return 1;
 }

-
-unsigned char 

Re: [PATCH] BUG_ON() bad input to request_irq

2008-01-23 Thread Andrew Morton
 On Thu, 17 Jan 2008 17:59:58 +1100 Rusty Russell [EMAIL PROTECTED] wrote:
 Is there any reason why these bugs should be treated gently?  The
 caller might not want to check NR_IRQS and IRQ_NOREQUEST cases, but
 a NULL handler or NULL dev_id w/ shared are coding bugs.
 
 Signed-off-by: Rusty Russell [EMAIL PROTECTED]
 ---
  kernel/irq/manage.c |7 +++
  1 file changed, 3 insertions(+), 4 deletions(-)
 
 diff -r c2eb8ef5a0be kernel/irq/manage.c
 --- a/kernel/irq/manage.c Thu Jan 17 15:48:03 2008 +1100
 +++ b/kernel/irq/manage.c Thu Jan 17 15:49:33 2008 +1100
 @@ -532,13 +532,12 @@ int request_irq(unsigned int irq, irq_ha
* which interrupt is which (messes up the interrupt freeing
* logic etc).
*/
 - if ((irqflags  IRQF_SHARED)  !dev_id)
 - return -EINVAL;
 + BUG_ON((irqflags  IRQF_SHARED)  !dev_id);
 + BUG_ON(!handler);
 +
   if (irq = NR_IRQS)
   return -EINVAL;
   if (irq_desc[irq].status  IRQ_NOREQUEST)
 - return -EINVAL;
 - if (!handler)
   return -EINVAL;
  
   action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);

If no driver is passing in args which will trigger this BUG, we presumably
don't need the patch.

If some driver _is_ passing in ags which will trigger these BUGs then it is
presumably working OK anyway.  Taking a working system and making it go BUG
is likely to upset people.

IOW: WARN_ON, please.
--
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] bluetooth : move children of connection device to NULL before connection down

2008-01-23 Thread Andrew Morton
 On Tue, 22 Jan 2008 07:18:16 +0100 Marcel Holtmann [EMAIL PROTECTED] wrote:
 Hi Dave,
 
   Add people missed in cc-list.
  
  Thanks Dave for your continued efforts on Bluetooth bugs like this.
  
  Marcel, are you going to review/ACK/integrate/push-upstream/whatever
  any of these Bluetooth patches?
  
  It hasn't been getting much love from you as of late, you are one of
  the listed maintainers, and I don't want to lose any of Dave's
  valuable bug fixing work.
 
 I will be fully back in business next week. Just got stuck in a project
 that needed 200% of my time to get it going.


These patches in -mm:

bluetooth-hidp_process_hid_control-remove-unnecessary-parameter-dealing.patch
bluetooth-uninlining.patch
drivers-bluetooth-bpa10xc-fix-memleak.patch
drivers-bluetooth-btsdioc-fix-double-free.patch
bluetooth-blacklist-another-broadcom-bcm2035-device.patch
bluetooth-rfcomm-tty_close-before-destruct.patch
hci_ldisc-fix-null-pointer-deref.patch

could benefit from some attention please.
--
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] BUG_ON() bad input to request_irq

2008-01-23 Thread Rusty Russell
On Thursday 24 January 2008 09:04:14 Andrew Morton wrote:
  On Thu, 17 Jan 2008 17:59:58 +1100 Rusty Russell [EMAIL PROTECTED]
 If no driver is passing in args which will trigger this BUG, we presumably
 don't need the patch.

You're only thinking of current code.  The BUG catches future changes, too.

 If some driver _is_ passing in args which will trigger these BUGs then it is
 presumably working OK anyway.  Taking a working system and making it go BUG
 is likely to upset people.

That's why I did the audit.  See patch below which preceeded it, which Jeff
hasn't responded to.  Breaking his drivers might make him notice :)

 IOW: WARN_ON, please.

At end of cycles, sure, but not for 2.6.25: they're even more invisible than
deprecated warnings :(

Rusty.
===
request_irq() always returns -EINVAL with a NULL handler.

I assume that these ancient network drivers were trying to find out if
an irq is available.  eepro.c expecting +EBUSY was doubly wrong.

Request_irq should BUG() on bad input, and these would have been found
earlier.

Signed-off-by: Rusty Russell [EMAIL PROTECTED]
---
 drivers/net/3c503.c |2 +-
 drivers/net/e2100.c |2 +-
 drivers/net/eepro.c |2 +-
 drivers/net/hp.c|2 +-
 kernel/irq/manage.c |1 +
 5 files changed, 5 insertions(+), 4 deletions(-)

diff -r 0b7e4fbb6238 drivers/net/3c503.c
--- a/drivers/net/3c503.c   Thu Jan 17 15:49:34 2008 +1100
+++ b/drivers/net/3c503.c   Thu Jan 17 16:40:28 2008 +1100
@@ -379,7 +379,7 @@ el2_open(struct net_device *dev)
 
outb(EGACFR_NORM, E33G_GACFR);  /* Enable RAM and interrupts. */
do {
-   if (request_irq (*irqp, NULL, 0, bogus, dev) != -EBUSY) {
+   if (can_request_irq(*irqp, 0)) {
/* Twinkle the interrupt, and check if it's seen. */
unsigned long cookie = probe_irq_on();
outb_p(0x04  ((*irqp == 9) ? 2 : *irqp), E33G_IDCFR);
diff -r 0b7e4fbb6238 drivers/net/e2100.c
--- a/drivers/net/e2100.c   Thu Jan 17 15:49:34 2008 +1100
+++ b/drivers/net/e2100.c   Thu Jan 17 16:40:28 2008 +1100
@@ -202,7 +202,7 @@ static int __init e21_probe1(struct net_
if (dev-irq  2) {
int irqlist[] = {15,11,10,12,5,9,3,4}, i;
for (i = 0; i  8; i++)
-   if (request_irq (irqlist[i], NULL, 0, bogus, NULL) != 
-EBUSY) {
+   if (can_request_irq(irqlist[i], 0)) {
dev-irq = irqlist[i];
break;
}
diff -r 0b7e4fbb6238 drivers/net/eepro.c
--- a/drivers/net/eepro.c   Thu Jan 17 15:49:34 2008 +1100
+++ b/drivers/net/eepro.c   Thu Jan 17 16:40:28 2008 +1100
@@ -914,7 +914,7 @@ static int  eepro_grab_irq(struct net_dev
 
eepro_sw2bank0(ioaddr); /* Switch back to Bank 0 */
 
-   if (request_irq (*irqp, NULL, IRQF_SHARED, bogus, dev) != 
EBUSY) {
+   if (can_request_irq(*irqp, IRQF_SHARED)) {
unsigned long irq_mask;
/* Twinkle the interrupt, and check if it's seen */
irq_mask = probe_irq_on();
diff -r 0b7e4fbb6238 drivers/net/hp.c
--- a/drivers/net/hp.c  Thu Jan 17 15:49:34 2008 +1100
+++ b/drivers/net/hp.c  Thu Jan 17 16:40:28 2008 +1100
@@ -170,7 +170,7 @@ static int __init hp_probe1(struct net_d
int *irqp = wordmode ? irq_16list : irq_8list;
do {
int irq = *irqp;
-   if (request_irq (irq, NULL, 0, bogus, NULL) != 
-EBUSY) {
+   if (can_request_irq(irq, 0)) {
unsigned long cookie = probe_irq_on();
/* Twinkle the interrupt, and check if it's 
seen. */
outb_p(irqmap[irq] | HP_RUN, ioaddr + 
HP_CONFIGURE);
diff -r 0b7e4fbb6238 kernel/irq/manage.c
--- a/kernel/irq/manage.c   Thu Jan 17 15:49:34 2008 +1100
+++ b/kernel/irq/manage.c   Thu Jan 17 16:40:28 2008 +1100
@@ -252,6 +252,7 @@ int can_request_irq(unsigned int irq, un
 
return !action;
 }
+EXPORT_SYMBOL(can_request_irq);
 
 void compat_irq_chip_set_default_handler(struct irq_desc *desc)
 {
--
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


[IPV4 1/5] fib_trie: more whitespace cleanup

2008-01-23 Thread Stephen Hemminger
Remove extra blank lines.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/net/ipv4/fib_trie.c   2008-01-22 17:46:28.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-01-22 17:50:44.0 -0800
@@ -447,7 +447,6 @@ static void tnode_put_child_reorg(struct
 
BUG_ON(i = 1tn-bits);
 
-
/* update emptyChildren */
if (n == NULL  chi != NULL)
tn-empty_children++;
@@ -1303,7 +1302,6 @@ err:
return err;
 }
 
-
 /* should be called with rcu_read_lock */
 static int check_leaf(struct trie *t, struct leaf *l,
  t_key key,  const struct flowi *flp,
@@ -1718,7 +1716,6 @@ static struct leaf *leaf_walk_rcu(struct
return NULL; /* Root of trie */
 }
 
-
 static struct leaf *trie_firstleaf(struct trie *t)
 {
struct tnode *n = (struct tnode *) rcu_dereference(t-trie);
@@ -1846,7 +1843,6 @@ static int fn_trie_dump_fa(t_key key, in
 {
int i, s_i;
struct fib_alias *fa;
-
__be32 xkey = htonl(key);
 
s_i = cb-args[4];
@@ -1879,7 +1875,6 @@ static int fn_trie_dump_fa(t_key key, in
return skb-len;
 }
 
-
 static int fn_trie_dump_leaf(struct leaf *l, struct fib_table *tb,
struct sk_buff *skb, struct netlink_callback *cb)
 {
@@ -2385,7 +2380,6 @@ static int fib_trie_seq_show(struct seq_
struct leaf *l = (struct leaf *) n;
struct leaf_info *li;
struct hlist_node *node;
-
__be32 val = htonl(l-key);
 
seq_indent(seq, iter-depth);

-- 
Stephen Hemminger [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


[IPV4 2/5] fib_trie: remove unneeded NULL check

2008-01-23 Thread Stephen Hemminger
Since fib_route_seq_show now uses hlist_for_each_entry(), the
leaf info can not be NULL.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/net/ipv4/fib_trie.c   2008-01-22 17:50:44.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-01-22 17:50:58.0 -0800
@@ -2474,9 +2474,6 @@ static int fib_route_seq_show(struct seq
struct fib_alias *fa;
__be32 mask, prefix;
 
-   if (!li)
-   continue;
-
mask = inet_make_mask(li-plen);
prefix = htonl(l-key);
 

-- 
Stephen Hemminger [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


[IPV4 4/5] fib_trie: version 0.410

2008-01-23 Thread Stephen Hemminger
Increase version to reflect recent changes.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/net/ipv4/fib_trie.c   2008-01-22 17:50:58.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-01-22 17:51:02.0 -0800
@@ -50,7 +50,7 @@
  * Patrick McHardy [EMAIL PROTECTED]
  */
 
-#define VERSION 0.408
+#define VERSION 0.410
 
 #include asm/uaccess.h
 #include asm/system.h

-- 
Stephen Hemminger [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


[IPV4 3/5] fib_trie: dump doesnt use RCU

2008-01-23 Thread Stephen Hemminger
Since fib dump (via netlink) holds the RTNL mutex, it is unnecessary
to use RCU, and it is impossible to get truncated (-EBUSY) result.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/net/ipv4/fib_trie.c   2008-01-23 13:55:12.0 -0800
+++ b/net/ipv4/fib_trie.c   2008-01-23 14:00:35.0 -0800
@@ -1684,7 +1684,7 @@ static int trie_flush_leaf(struct trie *
  * Scan for the next right leaf starting at node p-child[idx]
  * Since we have back pointer, no recursion necessary.
  */
-static struct leaf *leaf_walk_rcu(struct tnode *p, struct node *c)
+static struct leaf *leaf_walk(struct tnode *p, struct node *c)
 {
do {
t_key idx;
@@ -1695,7 +1695,7 @@ static struct leaf *leaf_walk_rcu(struct
idx = 0;
 
while (idx  1u  p-bits) {
-   c = tnode_get_child_rcu(p, idx++);
+   c = tnode_get_child(p, idx++);
if (!c)
continue;
 
@@ -1711,14 +1711,14 @@ static struct leaf *leaf_walk_rcu(struct
 
/* Node empty, walk back up to parent */
c = (struct node *) p;
-   } while ( (p = node_parent_rcu(c)) != NULL);
+   } while ( (p = node_parent(c)) != NULL);
 
return NULL; /* Root of trie */
 }
 
 static struct leaf *trie_firstleaf(struct trie *t)
 {
-   struct tnode *n = (struct tnode *) rcu_dereference(t-trie);
+   struct tnode *n = (struct tnode *) t-trie;
 
if (!n)
return NULL;
@@ -1726,7 +1726,7 @@ static struct leaf *trie_firstleaf(struc
if (IS_LEAF(n))  /* trie is just a leaf */
return (struct leaf *) n;
 
-   return leaf_walk_rcu(n, NULL);
+   return leaf_walk(n, NULL);
 }
 
 static struct leaf *trie_nextleaf(struct leaf *l)
@@ -1737,7 +1737,7 @@ static struct leaf *trie_nextleaf(struct
if (!p)
return NULL;/* trie with just one leaf */
 
-   return leaf_walk_rcu(p, c);
+   return leaf_walk(p, c);
 }
 
 /*
@@ -1848,9 +1848,7 @@ static int fn_trie_dump_fa(t_key key, in
s_i = cb-args[4];
i = 0;
 
-   /* rcu_read_lock is hold by caller */
-
-   list_for_each_entry_rcu(fa, fah, fa_list) {
+   list_for_each_entry(fa, fah, fa_list) {
if (i  s_i) {
i++;
continue;
@@ -1885,8 +1883,7 @@ static int fn_trie_dump_leaf(struct leaf
s_i = cb-args[3];
i = 0;
 
-   /* rcu_read_lock is hold by caller */
-   hlist_for_each_entry_rcu(li, node, l-list, hlist) {
+   hlist_for_each_entry(li, node, l-list, hlist) {
if (i  s_i) {
i++;
continue;
@@ -1916,35 +1913,25 @@ static int fn_trie_dump(struct fib_table
struct trie *t = (struct trie *) tb-tb_data;
t_key key = cb-args[2];
 
-   rcu_read_lock();
+   ASSERT_RTNL();
+
/* Dump starting at last key.
 * Note: 0.0.0.0/0 (ie default) is first key.
 */
if (!key)
l = trie_firstleaf(t);
-   else {
+   else
l = fib_find_node(t, key);
-   if (!l) {
-   /* The table changed during the dump, rather than
-* giving partial data, just make application retry.
-*/
-   rcu_read_unlock();
-   return -EBUSY;
-   }
-   }
 
while (l) {
cb-args[2] = l-key;
-   if (fn_trie_dump_leaf(l, tb, skb, cb)  0) {
-   rcu_read_unlock();
+   if (fn_trie_dump_leaf(l, tb, skb, cb)  0)
return -1;
-   }
 
l = trie_nextleaf(l);
memset(cb-args[3], 0,
   sizeof(cb-args) - 3*sizeof(cb-args[0]));
}
-   rcu_read_unlock();
 
return skb-len;
 }

-- 
Stephen Hemminger [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


[IPV4 5/5] fib_semantics: sparse warnings

2008-01-23 Thread Stephen Hemminger
The magic macro change_nexthops introduces a variable nh which overlaps
previous declaration of nh.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


--- a/net/ipv4/fib_semantics.c  2008-01-23 11:03:55.0 -0800
+++ b/net/ipv4/fib_semantics.c  2008-01-23 11:05:12.0 -0800
@@ -1059,14 +1059,14 @@ int fib_sync_down(__be32 local, struct n
unsigned int hash = fib_devindex_hashfn(dev-ifindex);
struct hlist_head *head = fib_info_devhash[hash];
struct hlist_node *node;
-   struct fib_nh *nh;
+   struct fib_nh *nh1;
 
-   hlist_for_each_entry(nh, node, head, nh_hash) {
-   struct fib_info *fi = nh-nh_parent;
+   hlist_for_each_entry(nh1, node, head, nh_hash) {
+   struct fib_info *fi = nh1-nh_parent;
int dead;
 
BUG_ON(!fi-fib_nhs);
-   if (nh-nh_dev != dev || fi == prev_fi)
+   if (nh1-nh_dev != dev || fi == prev_fi)
continue;
prev_fi = fi;
dead = 0;
@@ -1091,6 +1091,7 @@ int fib_sync_down(__be32 local, struct n
}
 #endif
} endfor_nexthops(fi)
+
if (dead == fi-fib_nhs) {
fi-fib_flags |= RTNH_F_DEAD;
ret++;
@@ -1114,7 +1115,7 @@ int fib_sync_up(struct net_device *dev)
unsigned int hash;
struct hlist_head *head;
struct hlist_node *node;
-   struct fib_nh *nh;
+   struct fib_nh *nh1;
int ret;
 
if (!(dev-flagsIFF_UP))
@@ -1125,12 +1126,12 @@ int fib_sync_up(struct net_device *dev)
head = fib_info_devhash[hash];
ret = 0;
 
-   hlist_for_each_entry(nh, node, head, nh_hash) {
-   struct fib_info *fi = nh-nh_parent;
+   hlist_for_each_entry(nh1, node, head, nh_hash) {
+   struct fib_info *fi = nh1-nh_parent;
int alive;
 
BUG_ON(!fi-fib_nhs);
-   if (nh-nh_dev != dev || fi == prev_fi)
+   if (nh1-nh_dev != dev || fi == prev_fi)
continue;
 
prev_fi = fi;

-- 
Stephen Hemminger [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] ppp: sparse warning fixes

2008-01-23 Thread Stephen Hemminger
Fix a bunch of warnings in PPP and related drivers. Mostly because
sparse doesn't like it when the the function is only marked private
in the forward declaration.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]


---
 drivers/net/ppp_deflate.c |4 ++--
 drivers/net/ppp_generic.c |2 +-
 drivers/net/ppp_synctty.c |2 +-
 drivers/net/pppoe.c   |2 ++
 drivers/net/slhc.c|4 ++--
 5 files changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/net/ppp_deflate.c 2008-01-23 15:35:22.0 -0800
+++ b/drivers/net/ppp_deflate.c 2008-01-23 15:35:40.0 -0800
@@ -206,7 +206,7 @@ static void z_comp_reset(void *arg)
  * Returns the length of the compressed packet, or 0 if the
  * packet is incompressible.
  */
-int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
+static int z_compress(void *arg, unsigned char *rptr, unsigned char *obuf,
   int isize, int osize)
 {
struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
@@ -435,7 +435,7 @@ static void z_decomp_reset(void *arg)
  * bug, so we return DECOMP_FATALERROR for them in order to turn off
  * compression, even though they are detected by inspecting the input.
  */
-int z_decompress(void *arg, unsigned char *ibuf, int isize,
+static int z_decompress(void *arg, unsigned char *ibuf, int isize,
 unsigned char *obuf, int osize)
 {
struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
--- a/drivers/net/ppp_generic.c 2008-01-23 15:34:40.0 -0800
+++ b/drivers/net/ppp_generic.c 2008-01-23 15:34:45.0 -0800
@@ -1871,7 +1871,7 @@ ppp_mp_insert(struct ppp *ppp, struct sk
  * complete packet, or we get to the sequence number for a fragment
  * which hasn't arrived but might still do so.
  */
-struct sk_buff *
+static struct sk_buff *
 ppp_mp_reconstruct(struct ppp *ppp)
 {
u32 seq = ppp-nextseq;
--- a/drivers/net/ppp_synctty.c 2008-01-23 15:35:04.0 -0800
+++ b/drivers/net/ppp_synctty.c 2008-01-23 15:35:08.0 -0800
@@ -560,7 +560,7 @@ static void ppp_sync_process(unsigned lo
  * Procedures for encapsulation and framing.
  */
 
-struct sk_buff*
+static struct sk_buff*
 ppp_sync_txmunge(struct syncppp *ap, struct sk_buff *skb)
 {
int proto;
--- a/drivers/net/pppoe.c   2008-01-23 15:35:52.0 -0800
+++ b/drivers/net/pppoe.c   2008-01-23 15:36:16.0 -0800
@@ -989,6 +989,7 @@ out:
 }
 
 static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos)
+   __acquires(pppoe_hash_lock)
 {
loff_t l = *pos;
 
@@ -1022,6 +1023,7 @@ out:
 }
 
 static void pppoe_seq_stop(struct seq_file *seq, void *v)
+   __releases(pppoe_hash_lock)
 {
read_unlock_bh(pppoe_hash_lock);
 }
--- a/drivers/net/slhc.c2008-01-23 15:36:45.0 -0800
+++ b/drivers/net/slhc.c2008-01-23 15:37:22.0 -0800
@@ -174,7 +174,7 @@ put16(unsigned char *cp, unsigned short 
 
 
 /* Encode a number */
-unsigned char *
+static unsigned char *
 encode(unsigned char *cp, unsigned short n)
 {
if(n = 256 || n == 0){
@@ -199,7 +199,7 @@ pull16(unsigned char **cpp)
 }
 
 /* Decode a number */
-long
+static long
 decode(unsigned char **cpp)
 {
register int x;
--
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: [IPV4 0/9] TRIE performance patches

2008-01-23 Thread Stephen Hemminger
On Wed, 23 Jan 2008 15:06:47 +0100
Robert Olsson [EMAIL PROTECTED] wrote:

 
 Stephen Hemminger writes:
 
   Time to handle a full BGP load (163K of routes).
   
   Before:LoadDumpFlush
  
   kmem_cache 3.8 13.07.2
   iter   3.9 12.36.9
   unordered  3.1 11.94.9
   find_node  3.1  0.31.2
 
  I certainly like the speed but what will we brake when
  we don't return in longest prefix order?
 
 labb:/# ip r
 default via 10.10.10.1 dev eth0 
 5.0.0.0/8 via 192.168.2.2 dev eth3 
 10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
 10.10.11.0/24 dev eth1  proto kernel  scope link  src 10.10.11.1 
 11.0.0.0/8 via 10.10.11.2 dev eth1 
 192.168.1.0/24 dev eth2  proto kernel  scope link  src 192.168.1.2 
 192.168.2.0/24 dev eth3  proto kernel  scope link  src 192.168.2.1 
 
 labb:/# ip route list match 10.10.10.1
 default via 10.10.10.1 dev eth0 
 10.10.10.0/24 dev eth0  proto kernel  scope link  src 10.10.10.2 
 labb:/# 
 
 Maybe the unordered dump can be ordered cheaply...

Dumping by prefix is possible, but unless 32x slower. Dumping in
address order is just as logical. Like I said, I'm investigating what
quagga handles.
-- 
Stephen Hemminger [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: [PATCH] bluetooth : move children of connection device to NULL before connection down

2008-01-23 Thread Dave Young
On Wed, Jan 23, 2008 at 02:06:29PM -0800, Andrew Morton wrote:
  On Tue, 22 Jan 2008 07:18:16 +0100 Marcel Holtmann [EMAIL PROTECTED] 
  wrote:
  Hi Dave,
  
Add people missed in cc-list.
   
   Thanks Dave for your continued efforts on Bluetooth bugs like this.
   
   Marcel, are you going to review/ACK/integrate/push-upstream/whatever
   any of these Bluetooth patches?
   
   It hasn't been getting much love from you as of late, you are one of
   the listed maintainers, and I don't want to lose any of Dave's
   valuable bug fixing work.
  
  I will be fully back in business next week. Just got stuck in a project
  that needed 200% of my time to get it going.
 
 
 These patches in -mm:
 
 bluetooth-hidp_process_hid_control-remove-unnecessary-parameter-dealing.patch
 bluetooth-uninlining.patch
 drivers-bluetooth-bpa10xc-fix-memleak.patch
 drivers-bluetooth-btsdioc-fix-double-free.patch
 bluetooth-blacklist-another-broadcom-bcm2035-device.patch
 bluetooth-rfcomm-tty_close-before-destruct.patch
 hci_ldisc-fix-null-pointer-deref.patch
 
 could benefit from some attention please.

Hi, andrew

For the patch bluetooth-rfcomm-tty_close-before-destruct.patch I have to 
rethinkabout it.

1. The subject is not correct, should be rfcomm-tty-destroy-before-tty_close.
2. Don't know what I was thinking that time, could you replace it with the 
following better one? Sorry for that.

---
rfcomm dev could be deleted in tty_hangup, so we must not call rfcomm_dev_del 
again to prevent from destroying rfcomm dev before tty close.

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

---
 net/bluetooth/rfcomm/tty.c |2 ++
 1 file changed, 2 insertions(+)

diff -upr a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c2008-01-24 09:03:59.0 +0800
+++ b/net/bluetooth/rfcomm/tty.c2008-01-24 09:03:59.0 +0800
@@ -429,6 +429,8 @@ static int rfcomm_release_dev(void __use
if (dev-tty)
tty_vhangup(dev-tty);
 
+   if (!test_bit(RFCOMM_RELEASE_ONHUP, dev-flags))
+   rfcomm_dev_del(dev);
rfcomm_dev_del(dev);
rfcomm_dev_put(dev);
return 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


Re: [PATCH] bluetooth : move children of connection device to NULL before connection down

2008-01-23 Thread Dave Young
On Thu, Jan 24, 2008 at 09:19:26AM +0800, Dave Young wrote:
 On Wed, Jan 23, 2008 at 02:06:29PM -0800, Andrew Morton wrote:
   On Tue, 22 Jan 2008 07:18:16 +0100 Marcel Holtmann [EMAIL PROTECTED] 
   wrote:
   Hi Dave,
   
 Add people missed in cc-list.

Thanks Dave for your continued efforts on Bluetooth bugs like this.

Marcel, are you going to review/ACK/integrate/push-upstream/whatever
any of these Bluetooth patches?

It hasn't been getting much love from you as of late, you are one of
the listed maintainers, and I don't want to lose any of Dave's
valuable bug fixing work.
   
   I will be fully back in business next week. Just got stuck in a project
   that needed 200% of my time to get it going.
  
  
  These patches in -mm:
  
  bluetooth-hidp_process_hid_control-remove-unnecessary-parameter-dealing.patch
  bluetooth-uninlining.patch
  drivers-bluetooth-bpa10xc-fix-memleak.patch
  drivers-bluetooth-btsdioc-fix-double-free.patch
  bluetooth-blacklist-another-broadcom-bcm2035-device.patch
  bluetooth-rfcomm-tty_close-before-destruct.patch
  hci_ldisc-fix-null-pointer-deref.patch
  
  could benefit from some attention please.
 
 Hi, andrew
 
 For the patch bluetooth-rfcomm-tty_close-before-destruct.patch I have to 
 rethinkabout it.
 
 1. The subject is not correct, should be rfcomm-tty-destroy-before-tty_close.
 2. Don't know what I was thinking that time, could you replace it with the 
 following better one? Sorry for that.
 
 ---
 rfcomm dev could be deleted in tty_hangup, so we must not call rfcomm_dev_del 
 again to prevent from destroying rfcomm dev before tty close.
 
 Signed-off-by: Dave Young [EMAIL PROTECTED] 
 
 ---
  net/bluetooth/rfcomm/tty.c |2 ++
  1 file changed, 2 insertions(+)
 
 diff -upr a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
 --- a/net/bluetooth/rfcomm/tty.c  2008-01-24 09:03:59.0 +0800
 +++ b/net/bluetooth/rfcomm/tty.c  2008-01-24 09:03:59.0 +0800
 @@ -429,6 +429,8 @@ static int rfcomm_release_dev(void __use
   if (dev-tty)
   tty_vhangup(dev-tty);
  
 + if (!test_bit(RFCOMM_RELEASE_ONHUP, dev-flags))
 + rfcomm_dev_del(dev);
   rfcomm_dev_del(dev);
~
   rfcomm_dev_put(dev);
   return 0;

Please ignore the previous silly one, now resubmit :
--

rfcomm dev could be deleted in tty_hangup, so we must not call rfcomm_dev_del 
again to prevent from destroying rfcomm dev before tty close.

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

---
 net/bluetooth/rfcomm/tty.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff -upr a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c2008-01-24 09:21:56.0 +0800
+++ b/net/bluetooth/rfcomm/tty.c2008-01-24 09:21:56.0 +0800
@@ -429,7 +429,8 @@ static int rfcomm_release_dev(void __use
if (dev-tty)
tty_vhangup(dev-tty);
 
-   rfcomm_dev_del(dev);
+   if (!test_bit(RFCOMM_RELEASE_ONHUP, dev-flags))
+   rfcomm_dev_del(dev);
rfcomm_dev_put(dev);
return 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


Re: [PATCH] [POWERPC] Add fixed-phy support for fs_enet

2008-01-23 Thread Kumar Gala
On Tue, 18 Dec 2007, Jochen Friedrich wrote:

 This patch adds support to use the fixed-link property
 of an ethernet node to fs_enet for the
 CONFIG_PPC_CPM_NEW_BINDING case.

 Signed-off-by: Jochen Friedrich [EMAIL PROTECTED]
 Acked-by: Jeff Garzik [EMAIL PROTECTED]
 Acked-by: Vitali Bordug [EMAIL PROTECTED]
 ---
  drivers/net/fs_enet/fs_enet-main.c |9 -
  1 files changed, 8 insertions(+), 1 deletions(-)


applied.

- k
--
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.24-rc8-mm1 : net tcp_input.c warnings

2008-01-23 Thread Dave Young
On Jan 23, 2008 7:01 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
 On Wed, 23 Jan 2008, Ilpo Järvinen wrote:

  On Wed, 23 Jan 2008, Dave Young wrote:
 
   On Jan 23, 2008 3:41 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
   
On Tue, 22 Jan 2008, David Miller wrote:
   
 From: Dave Young [EMAIL PROTECTED]
 Date: Wed, 23 Jan 2008 09:44:30 +0800

  On Jan 22, 2008 6:47 PM, Ilpo Järvinen [EMAIL PROTECTED] wrote:
   [PATCH] [TCP]: debug S+L
 
  Thanks, If there's new findings I will let you know.

 Thanks for helping with this bug Dave.
   
I noticed btw that there thing might (is likely to) spuriously trigger 
at
WARN_ON(sacked != tp-sacked_out); because those won't be equal when 
SACK
is not enabled. If that does happen too often, I send a fixed patch for
it, yet, the fact that I print print tp-rx_opt.sack_ok allows
identification of those cases already as it's zero when SACK is not
enabled.
   
Just ask if you need the updated debug patch.
  
   Thanks,  please send, I would like to get it.
 
  There you go. I fixed non-SACK case by adding tcp_is_sack checks there and
  also added two verifys to tcp_ack to see if there's corruption outside of
  TCP.

 There's some discussion about a problem that is very likely the same as in
 here (sorry for not remembering to cc you in there due to rapid progress):

http://marc.info/?t=12010717423r=1w=2

Thanks.

New warning trigged with your debug patch:

ACPI: PCI Interrupt :00:1b.0[A] - GSI 16 (level, low) - IRQ 16
PCI: Setting latency timer of device :00:1b.0 to 64
e100: Intel(R) PRO/100 Network Driver, 3.5.23-k4-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
ACPI: PCI Interrupt :03:08.0[A] - GSI 20 (level, low) - IRQ 20
e100: eth1: e100_probe: addr 0xefaff000, irq 20, MAC addr 00:13:72:e7:4d:66
eth0:  setting full-duplex.
[ cut here ]
WARNING: at net/ipv4/tcp_ipv4.c:197 tcp_verify_wq+0x1b6/0x1c0()
Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
Pid: 0, comm: swapper Not tainted 2.6.24-rc8-mm1 #8
 [c0132100] ? have_callable_console+0x20/0x30
 [c0131844] warn_on_slowpath+0x54/0x80
 [c0150030] ? timer_list_show_tickdevices+0xf0/0x110
 [c010af95] ? native_sched_clock+0x85/0xe0
 [c0153251] ? put_lock_stats+0x21/0x30
 [c01532c0] ? lock_release_holdtime+0x60/0x80
 [c0186af4] ? check_bytes_and_report+0x24/0xc0
 [c0186af4] ? check_bytes_and_report+0x24/0xc0
 [c0186bf1] ? check_pad_bytes+0x61/0x80
 [c0400096] tcp_verify_wq+0x1b6/0x1c0
 [c03f7509] ? tcp_clean_rtx_queue+0x2d9/0x5b0
 [c03f5540] tcp_add_reno_sack+0x30/0x50
 [c03f6d72] tcp_fastretrans_alert+0x3d2/0x700
 [c03f7e63] tcp_ack+0x1b3/0x3a0
 [c03fa21b] tcp_rcv_established+0x3eb/0x710
 [c0401c05] tcp_v4_do_rcv+0xe5/0x100
 [c04021fb] tcp_v4_rcv+0x5db/0x660
 [c0401fa7] ? tcp_v4_rcv+0x387/0x660
 [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
 [c03e5f44] ip_local_deliver_finish+0x84/0x1d0
 [c03e5eed] ? ip_local_deliver_finish+0x2d/0x1d0
 [c0156b97] ? __lock_release+0x47/0x70
 [c03e6147] ip_local_deliver+0xb7/0xc0
 [c03e6202] ip_rcv_finish+0xb2/0x3c0
 [c03c01d8] ? sock_def_readable+0x48/0xa0
 [c03be061] ? sock_queue_rcv_skb+0xb1/0x1a0
 [c03be0a7] ? sock_queue_rcv_skb+0xf7/0x1a0
 [c03e669f] ip_rcv+0x18f/0x290
 [c042fb10] ? packet_rcv_spkt+0xd0/0x130
 [c03c8da6] netif_receive_skb+0x2b6/0x330
 [c03c8c17] ? netif_receive_skb+0x127/0x330
 [c03c8ea3] ? process_backlog+0x83/0x100
 [c03c8eae] process_backlog+0x8e/0x100
 [c03c90bc] net_rx_action+0x13c/0x230
 [c03c8fd9] ? net_rx_action+0x59/0x230
 [c0136f3e] ? __do_softirq+0x6e/0x120
 [c0136f63] __do_softirq+0x93/0x120
 [c013706a] do_softirq+0x7a/0x80
 [c0137135] irq_exit+0x65/0x90
 [c01078b1] do_IRQ+0x41/0x80
 [c0155659] ? trace_hardirqs_on+0xb9/0x130
 [c01059ca] common_interrupt+0x2e/0x34
 [c0103390] ? mwait_idle_with_hints+0x40/0x50
 [c01033a0] ? mwait_idle+0x0/0x20
 [c01033b2] mwait_idle+0x12/0x20
 [c0103141] cpu_idle+0x61/0x110
 [c04339fd] rest_init+0x5d/0x60
 [c05a47fa] start_kernel+0x1fa/0x260
 [c05a4190] ? unknown_bootoption+0x0/0x130
 ===
---[ end trace 14b601818e6903ac ]---
P: 5 L: 0 vs 0 S: 0 vs 1 w: 2044790889-2044796616 (0)
TCP wq(s)  
TCP wq(h) +++h+
l0 s1 f0 p5 seq: su2044790889 hs2044795029 sn2044796616
[ cut here ]
WARNING: at net/ipv4/tcp_ipv4.c:197 tcp_verify_wq+0x1b6/0x1c0()
Modules linked in: snd_seq_dummy snd_seq_oss snd_seq_midi_event
snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss eeprom e100 psmouse
snd_hda_intel snd_pcm snd_timer btusb bluetooth serio_raw snd 3c59x sg
evdev thermal soundcore rtc_cmos snd_page_alloc rtc_core rtc_lib
i2c_i801 processor button intel_agp dcdbas pcspkr agpgart
Pid: 0, comm: swapper Not 

bluetooth : lockdep warning on rfcomm

2008-01-23 Thread Dave Young
=
[ INFO: possible recursive locking detected ]
2.6.24-rc8-mm1 #8
-
bluepush/3213 is trying to acquire lock:
 (sk_lock-AF_BLUETOOTH){--..}, at: [f8978c80]
l2cap_sock_bind+0x40/0x100 [l2cap]

but task is already holding lock:
 (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
rfcomm_sock_connect+0x3e/0xe0 [rfcomm]

other info that might help us debug this:
2 locks held by bluepush/3213:
 #0:  (sk_lock-AF_BLUETOOTH){--..}, at: [f894a31e]
rfcomm_sock_connect+0x3e/0xe0 [rfcomm]
 #1:  (rfcomm_mutex){--..}, at: [f8947556] rfcomm_dlc_open+0x26/0x60 [rfcomm]

stack backtrace:
Pid: 3213, comm: bluepush Not tainted 2.6.24-rc8-mm1 #8
 [c0132128] ? printk+0x18/0x20
 [c0154437] print_deadlock_bug+0xc7/0xe0
 [c01544bc] check_deadlock+0x6c/0x80
 [c01548fc] validate_chain+0x14c/0x320
 [c0156221] __lock_acquire+0x1c1/0x730
 [c0156d89] lock_acquire+0x79/0xb0
 [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
 [c03c05f5] lock_sock_nested+0x55/0x70
 [f8978c80] ? l2cap_sock_bind+0x40/0x100 [l2cap]
 [f8978c80] l2cap_sock_bind+0x40/0x100 [l2cap]
 [c03bdb4a] kernel_bind+0xa/0x10
 [f8947afc] rfcomm_session_create+0x4c/0x110 [rfcomm]
 [f8947509] __rfcomm_dlc_open+0x129/0x150 [rfcomm]
 [f8947568] rfcomm_dlc_open+0x38/0x60 [rfcomm]
 [f894a396] rfcomm_sock_connect+0xb6/0xe0 [rfcomm]
 [c03bcd39] sys_connect+0x99/0xd0
 [c010f509] ? cache_add_dev+0x39/0x1a0
 [c015323d] ? put_lock_stats+0xd/0x30
 [c01532c0] ? lock_release_holdtime+0x60/0x80
 [c018e86c] ? fget+0x7c/0x100
 [c0156b97] ? __lock_release+0x47/0x70
 [c018e86c] ? fget+0x7c/0x100
 [c02611b7] ? copy_from_user+0x37/0x70
 [c03bd855] sys_socketcall+0xa5/0x230
 [c0155659] ? trace_hardirqs_on+0xb9/0x130
 [c010501b] ? restore_nocheck+0x12/0x15
--
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/6] PS3: gelic: gelic updates for 2.6.25

2008-01-23 Thread John W. Linville
On Tue, Jan 22, 2008 at 07:12:44PM -0800, Geoff Levand wrote:
 On 01/22/2008 04:58 PM, John W. Linville wrote:

  I thought Geert's had been applied, but I guess I was looking at
  it wrong.  Is there a powerpc tree that has them?
 
 Not yet, they are now only in ps3-linux.git.  I sent them out to
 Paul last Friday the 18th for inclusion in 2.6.25.  Here is a link
 to the message:
 
   http://ozlabs.org/pipermail/linuxppc-dev/2008-January/050213.html
 
  Perhaps 1-6 above
  and the wireless patch should just be applied to that tree (if there
  is one) and all merged together?
 
 I think Paul will accept them if they have the Sign-off-by's of
 the proper network maintainers.

Feel free to add:

Signed-off-by: John W. Linville [EMAIL PROTECTED]

(Or Acked-by if you would prefer) to the wireless bits.  FWIW, the
wired bits seemed OK to me as well, but I didn't look too closely...

Thanks,

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 2/2] sky2: fix Wake On Lan interaction with BIOS

2008-01-23 Thread Stephen Hemminger
This patch disables config mode access after clearing PCI settings.
Some BIOS's seem to not do WOL if config bit still set.

Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=9721

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
Please get this into 2.6.24.

--- a/drivers/net/sky2.c2008-01-23 16:31:13.0 -0800
+++ b/drivers/net/sky2.c2008-01-23 16:31:16.0 -0800
@@ -621,6 +621,7 @@ static void sky2_phy_power(struct sky2_h
static const u32 phy_power[] = { PCI_Y2_PHY1_POWD, PCI_Y2_PHY2_POWD };
static const u32 coma_mode[] = { PCI_Y2_PHY1_COMA, PCI_Y2_PHY2_COMA };
 
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
/* Turn on/off phy power saving */
if (onoff)
@@ -632,7 +633,8 @@ static void sky2_phy_power(struct sky2_h
reg1 |= coma_mode[port];
 
sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
-   reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
+   sky2_pci_read32(hw, PCI_DEV_REG1);
 
udelay(100);
 }
@@ -2427,6 +2429,7 @@ static void sky2_hw_intr(struct sky2_hw 
if (status  (Y2_IS_MST_ERR | Y2_IS_IRQ_STAT)) {
u16 pci_err;
 
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
pci_err = sky2_pci_read16(hw, PCI_STATUS);
if (net_ratelimit())
dev_err(pdev-dev, PCI hardware error (0x%x)\n,
@@ -2434,12 +2437,14 @@ static void sky2_hw_intr(struct sky2_hw 
 
sky2_pci_write16(hw, PCI_STATUS,
  pci_err | PCI_STATUS_ERROR_BITS);
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
}
 
if (status  Y2_IS_PCI_EXP) {
/* PCI-Express uncorrectable Error occurred */
u32 err;
 
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
 0xul);
@@ -2447,6 +2452,7 @@ static void sky2_hw_intr(struct sky2_hw 
dev_err(pdev-dev, PCI Express error (0x%x)\n, err);
 
sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
}
 
if (status  Y2_HWE_L1_MASK)
@@ -2812,6 +2818,7 @@ static void sky2_reset(struct sky2_hw *h
}
 
sky2_power_on(hw);
+   sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_OFF);
 
for (i = 0; i  hw-ports; i++) {
sky2_write8(hw, SK_REG(i, GMAC_LINK_CTRL), GMLC_RST_SET);
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] sky2: restore multicast addresses after recovery

2008-01-23 Thread Stephen Hemminger
If the sky2 deadman timer forces a recovery, the multicast hash
list is lost. Move the call to sky2_set_multicast to the end
of sky2_up() so all paths that bring device up will restore multicast.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

---
Please apply for 2.6.24

--- a/drivers/net/sky2.c2008-01-23 16:00:34.0 -0800
+++ b/drivers/net/sky2.c2008-01-23 16:04:20.0 -0800
@@ -1412,6 +1412,7 @@ static int sky2_up(struct net_device *de
imask |= portirq_msk[port];
sky2_write32(hw, B0_IMSK, imask);
 
+   sky2_set_multicast(dev);
return 0;
 
 err_out:
@@ -3533,8 +3534,6 @@ static int sky2_set_ringparam(struct net
err = sky2_up(dev);
if (err)
dev_close(dev);
-   else
-   sky2_set_multicast(dev);
}
 
return err;
@@ -4368,8 +4367,6 @@ static int sky2_resume(struct pci_dev *p
dev_close(dev);
goto out;
}
-
-   sky2_set_multicast(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


[PATCH UCC TDM 0/3] UCC based TDM driver for QE based MPC83xx platforms

2008-01-23 Thread Aggrwal Poonam

Reworked patches after incorporating comments of Andrew, Stephen and
Tabi and Kumar.

Kumar could you please consider them for linux-2.6.25.

There are three patches
[PATCH 1/3] drivers/misc : UCC TDM driver for mpc83xx platforms. This
driver is usable in VoIP iind of applications to interface with SLIC
kind of devices to exchange TDM voice samples.
The driver is right now in misc category and exposes a kind of non
standard interface to the clients.

TDM Driver Interface Details

The TDM driver right now is a misc driver with no subsystem as such.

The dts file keeps a track of the TDM devices present on the board.
Depending on them the TDM driver initializes those many driver instances
while coming up.

The driver on the upper level can plug to more than one tdm clients
depending on the availablity of TDM devices.
At every new request of the TDM client to bind with a TDM device, a free
driver instance is allocated to the client.

The interface can be described as follows.

tdm_register_client(struct tdm_client *)
This API returns a pointer to the structure tdm_client which is
of type
struct tdm_client {
u32 client_id;
u32 (*tdm_read)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
u32 (*tdm_write)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
wait_queue_head_t *wakeup_event;
}

   It consists of:
   - driver_handle: It is basically to identify the particular TDM
device/driver instance.
   - tdm_read: It is a function pointer returned by the TDM driver to be
used to read TDM data from a particular TDM channel.
   - tdm_write: It is a function pointer returned by the TDM driver to
be used to write TDM data to a particular TDM channel.
   - wakeup_event: It is address of a wait_queue event on which the
client keeps on sleeping, and the TDM driver wakes it up periodically.
The driver is configured to wake up the client after every 10ms.

Once the TDM client gets registered to a TDM driver instance and a TDM
device, it interfaces with the driver using tdm_read, tdm_write and
wakeup_event.

Note: The TDM driver can be used by only kernel level modules. The
driver does not expose any file interface for User Applications. Can be
compared to the spi driver which interfaces with the SPI clients(kernel
mode clients) through some APIs.

This interface can be improved by writing a platform independent TDM
layer. Then all the TDM platforms can be supported below this wrapper
layer. This is planned to be done later.

[PATCH 2/3] arch/ : Platform changes
- device tree entries for UCC TDM driver for MPC8323ERDB platform.
- QE changes related to TDM , like,
 1) Modified ucc_fast_init so that it can be used by fast UCC
based TDM driver. Mainly changes have been made to configure TDM clocks
and Fsyncs.

2) Modified get_brg_clk so that it can return the input frequncy
and input source of any BRG by reading the corresponding entries from
device tree.

3) Added new nodes brg and clocks in the device tree which
represent input clocks for different BRGs.

4) Modified qe_setbrg accordingly.
- new device tree entries added for clocks and brg

[PATCH 3/3] Documentation
- Modified Documentation to explain the device tree entries related to
UCC TDM driver and the new nodes added(clocks and brg)

The patch applies over a merge of galak's for-2.6.25 plus for-2.6.24
plus of_doc_update branches.
In brief the steps were
git clone
git://git.kernel.org/pub/scm/linux/kernel/git/galak/powerpc.git
powerpc-galak
git checkout -b for-2.6.25 origin/for-2.6.25 git checkout -b for-2.6.24
origin/for-2.6.24 git checkout -b of_doc_update origin/of_doc_update
git pull . for-2.6.24# merge the other two
git pull . for-2.6.25 
git checkout -b tdm  # clean slate for tdm rebase work

Also after applying the patches changes have to be made corresponding to
Tabi's patch qe: add function qe_clock_source.

The driver has been tested with a VoIP stack and application on
MPC8323ERDB.

With Regards
Poonam 
 

--
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: [NET_SCHED 00/15]: Make use of new netlink API features

2008-01-23 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 17:36:35 +0100 (MET)

 these patches change the packet schedulers/classifers/actions to make use
 of the features of the new netlink API, like typeful attribute dumping and
 parsing, automatic basic attribute validation etc. The also fix a bug and
 a warning introduced by my last set of patches.
 
 Please apply, thanks.

All applied, thanks for doing this work Patrick.
--
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: [IPV4 1/5] fib_trie: more whitespace cleanup

2008-01-23 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 14:48:45 -0800

 Remove extra blank lines.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

Applied.
--
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: [IPV4 2/5] fib_trie: remove unneeded NULL check

2008-01-23 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 14:48:46 -0800

 Since fib_route_seq_show now uses hlist_for_each_entry(), the
 leaf info can not be NULL.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

Applied.
--
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] UCC TDM driver for QE based MPC83xx platforms.

2008-01-23 Thread Poonam_Aggrwal-b10812

From: Poonam Agarwal-b10812 [EMAIL PROTECTED]

The UCC TDM driver basically multiplexes and demultiplexes data from
different channels. It can interface with for example SLIC kind of devices
to receive TDM data  demultiplex it and send to upper modules. At the
transmit end it receives data for different channels multiplexes it and
sends them on the TDM channel. It internally uses TSA( Time Slot Assigner)
which does multiplexing and demultiplexing, UCC to perform SDMA between
host buffers and the TSA, CMX to connect TSA to UCC.

It can be used by a kernel module which can call tdm_register_client to
get access to a TDM device.

The driver is right now a misc driver with no subsystem as such.
There can be a platform independent TDM layer which is planned to be
done after this. TDM bus sort of thing.

The dts file keeps a track of the TDM devices present on the board.
Depending on them the TDM driver initializes those many driver instances
while coming up.

The driver on the upper level can plug to more than one tdm clients
depending on the availablity of TDM devices. At every new request of a TDM
client to bind with a TDM device, a free driver instance is allocated to 
the client.

The interface can be described as follows.

tdm_register_client(struct tdm_client *)
This API returns a pointer to the structure tdm_client which is of
type
   struct tdm_client {
u32 client_id;
u32 (*tdm_read)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
u32 (*tdm_write)(u32 client_id, short chn_id, short
*pcm_buffer, short len);
wait_queue_head_t *wakeup_event;
}

It consists of:
   - client_id: It is basically to identify the particular TDM
device/driver instance.
   - tdm_read: It is a function pointer returned by the TDM driver to be
used to read TDM data from a particular TDM channel.
   - tdm_write: It is a function pointer returned by the TDM driver to be
used to write TDM data to a particular TDM channel.
   - wakeup_event: It is address of a wait_queue event on which the client
keeps on sleeping, and the TDM driver wakes it up periodically. The driver 
is configured to
wake up the client after every 10ms.

Once the TDM client gets registered to a TDM driver instance and a TDM
device, it interfaces with the driver using tdm_read, tdm_write and 
wakeup_event.

This driver will run on MPC8323E-RDB platforms.

Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Michael Barkowski [EMAIL PROTECTED]

---
 drivers/misc/Kconfig   |   14 +
 drivers/misc/Makefile  |1 +
 drivers/misc/ucc_tdm.c | 1000 
 drivers/misc/ucc_tdm.h |  221 +++
 4 files changed, 1236 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/ucc_tdm.c
 create mode 100644 drivers/misc/ucc_tdm.h

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index b5e67c0..628b14b 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -232,4 +232,18 @@ config ATMEL_SSC
 
  If unsure, say N.
 
+config UCC_TDM
+   bool Freescale UCC  TDM Driver
+   depends on QUICC_ENGINE  UCC_FAST
+   default n
+   ---help---
+ The TDM driver is for UCC based TDM devices for example, TDM device on
+ MPC832x RDB. Select it to run PowerVoIP on MPC832x RDB board.
+ The TDM driver can interface with SLIC kind of devices to transmit
+ and receive TDM samples. The TDM driver receives Time Division
+ multiplexed samples(for different channels) from the SLIC device,
+ demutiplexes them and sends them to the upper layers. At the transmit
+ end the TDM drivers receives samples for different channels, it
+ multiplexes them and sends them to the SLIC device.
+
 endif # MISC_DEVICES
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 87f2685..6f0c49d 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -17,3 +17,4 @@ obj-$(CONFIG_SONY_LAPTOP) += sony-laptop.o
 obj-$(CONFIG_THINKPAD_ACPI)+= thinkpad_acpi.o
 obj-$(CONFIG_FUJITSU_LAPTOP)   += fujitsu-laptop.o
 obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
+obj-$(CONFIG_UCC_TDM)  += ucc_tdm.o
diff --git a/drivers/misc/ucc_tdm.c b/drivers/misc/ucc_tdm.c
new file mode 100644
index 000..98e7c72
--- /dev/null
+++ b/drivers/misc/ucc_tdm.c
@@ -0,0 +1,1000 @@
+/*
+ * drivers/misc/ucc_tdm.c
+ *
+ * UCC Based Linux TDM Driver
+ * This driver is designed to support UCC based TDM for PowerPC processors.
+ * This driver can interface with SLIC device to run VOIP kind of
+ * applications.
+ *
+ * Author: Ashish Kalra  Poonam Aggrwal
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * 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 

Re: [IPV4 3/5] fib_trie: dump doesnt use RCU

2008-01-23 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 14:48:47 -0800

 Since fib dump (via netlink) holds the RTNL mutex, it is unnecessary
 to use RCU, and it is impossible to get truncated (-EBUSY) result.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

You tested this patch, right? :-/

The whole reason we need the nlk-cb[] state is to hold things across
multiple recvmsg() calls that might be necessary to obtain the full
dump.

rtnetlink goes:

rtnl_lock();
netlink_rcv_skb(skb, rtnetlink_rcv_msg);
 ...
static int rtnetlink_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
{
 ...
if (kind == 2  nlh-nlmsg_flagsNLM_F_DUMP) {
struct sock *rtnl;
rtnl_dumpit_func dumpit;

dumpit = rtnl_get_dumpit(family, type);
if (dumpit == NULL)
return -EOPNOTSUPP;

__rtnl_unlock();
rtnl = net-rtnl;
err = netlink_dump_start(rtnl, skb, nlh, dumpit, NULL);
rtnl_lock();
return err;

(NOTE: Drops RTNL semaphore for netlink_dump_start() call)

 ...
int netlink_dump_start(struct sock *ssk, struct sk_buff *skb,
   struct nlmsghdr *nlh,
   int (*dump)(struct sk_buff *skb,
   struct netlink_callback *),
   int (*done)(struct netlink_callback *))
{
 ...
cb-dump = dump;
cb-done = done;
cb-nlh = nlh;
atomic_inc(skb-users);
cb-skb = skb;
 ...
mutex_lock(nlk-cb_mutex);
 ...
nlk-cb = cb;
mutex_unlock(nlk-cb_mutex);

netlink_dump(sk);
 ...

static int netlink_dump(struct sock *sk)
{
 ...
mutex_lock(nlk-cb_mutex);
 ...
len = cb-dump(skb, cb);

if (len  0) {
mutex_unlock(nlk-cb_mutex);
skb_queue_tail(sk-sk_receive_queue, skb);
sk-sk_data_ready(sk, len);
return 0;
}

(NOTE: Therefore cb-dump() runs without RTNL semaphore held)

 ...
static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock,
   struct msghdr *msg, size_t len,
   int flags)
{
 ...
if (nlk-cb  atomic_read(sk-sk_rmem_alloc) = sk-sk_rcvbuf / 2)
netlink_dump(sk);
 ...

Therefore, that RTNL assertion you added should have triggered on any
dump you may have tried since -dump() is always invoked without the
RTNL semaphore since rtnetlink drops it around the -dump() call and
the call chain for this fib_trie cause would be:

inet_dump_fib()
 fn_trie_dump()

and nothing in that code path retakes the RTNL semaphore.

What test did you run to validate this patch for correctness?
--
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] Platform changes for UCC TDM driver for MPC8323ERDB.Also includes related QE changes and dts entries.

2008-01-23 Thread Poonam_Aggrwal-b10812
From: Poonam Aggrwal [EMAIL PROTECTED]

This patch makes necessary changes in the QE and UCC framework to support 
TDM. It also adds support to configure the BRG properly through device 
tree entries. Includes the device tree changes for UCC TDM driver as well.
It also includes device tree entries for UCC TDM driver.

Tested on MPC8323ERDB platform.

Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Michael Barkowski [EMAIL PROTECTED] 
---
 arch/powerpc/boot/dts/mpc832x_rdb.dts |   58 +++
 arch/powerpc/sysdev/qe_lib/qe.c   |  205 --
 arch/powerpc/sysdev/qe_lib/ucc.c  |  265 +
 arch/powerpc/sysdev/qe_lib/ucc_fast.c |   37 +
 include/asm-powerpc/qe.h  |8 +
 include/asm-powerpc/ucc.h |4 +
 include/asm-powerpc/ucc_fast.h|4 +
 7 files changed, 568 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 388c8a7..c0e6283 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -105,6 +105,17 @@
device_type = par_io;
num-ports = 7;
 
+   ucc1pio:[EMAIL PROTECTED] {
+   pio-map = 
+   /* port  pin  dir  open_drain  assignment  has_irq */
+   0  e  2  0  1  0/* CLK11 */
+   3 16  1  0  2  0/* BRG9 */
+   3 1b  1  0  2  0/* BRG3 */
+   0  0  3  0  2  0/* TDMATxD0 */
+   0  4  3  0  2  0/* TDMARxD0 */
+   3 1b  2  0  1  0;  /* CLK1 */
+   };
+
ucc2pio:[EMAIL PROTECTED] {
pio-map = 
/* port  pin  dir  open_drain  assignment  has_irq */
@@ -169,6 +180,36 @@
};
};
 
+   clocks {
+   compatible = fsl,cpm-clocks;
+   /* clock freqs in Hz(for CLK1~CLK24).
+* CLK11 is 1024KHz,
+* all other clocks unused
+* #clock-cells define number of cells
+* used by the clock-frequency.
+* right now only #clock cells=1 is
+* implemented. Provision is there to
+* handle frequencies 4Gig
+*/
+   #clock-cells = 1;
+   clock-frequency = 0 0 0 0 0 0
+  0 0 0 0 d#1024000 0
+  0 0 0 0 0 0
+  0 0 0 0 0 0;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,cpm-brg;
+   /* input clock sources for all the 16 BRGs.
+* 1-24 for CLK1 to CLK24.
+* BRG9 uses CLK11,BRG1 and BRG2-8 use
+* the QE clock.
+*/
+   fsl,brg-sources = 0 0 0 0 0 0 0 0
+  b 0 0 0 0 0 0 0;
+   reg = 640 7f;
+   };
+
[EMAIL PROTECTED] {
device_type = spi;
compatible = fsl_spi;
@@ -187,6 +228,23 @@
mode = cpu;
};
 
+   [EMAIL PROTECTED] {
+   device_type = tdm;
+   compatible = fsl,ucc-tdm;
+   model = UCC;
+   device-id = 1;
+   fsl,tdm-num = 1;
+   fsl,si-num = 1;
+   fsl,tdm-tx-clk = CLK1;
+   fsl,tdm-rx-clk = CLK1;
+   fsl,tdm-tx-sync = BRG9;
+   fsl,tdm-rx-sync = BRG9;
+   reg = 2000 200;
+   interrupts = 20;
+   interrupt-parent = qeic;
+   pio-handle = ucc1pio;
+   };
+
[EMAIL PROTECTED] {
device_type = network;
compatible = ucc_geth;
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 1df3b4a..fddc3d8 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -149,20 +149,189 @@ EXPORT_SYMBOL(qe_issue_cmd);
  */
 static unsigned int brg_clk = 0;
 
-unsigned int get_brg_clk(void)
+u32 get_brg_clk(enum qe_clock brgclk, enum qe_clock *brg_source)
 {
-   struct device_node 

Re: [IPV4 4/5] fib_trie: version 0.410

2008-01-23 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 14:48:48 -0800

 Increase version to reflect recent changes.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

I'm dropping this and patch 5 for now.
--
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] ppp: sparse warning fixes

2008-01-23 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Wed, 23 Jan 2008 15:40:19 -0800

 Fix a bunch of warnings in PPP and related drivers. Mostly because
 sparse doesn't like it when the the function is only marked private
 in the forward declaration.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

Applied, thanks Stephen.
--
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


rebasing net-2.6.25...

2008-01-23 Thread David Miller

I am going to work throughout the evening to rebase the net-2.6.25 GIT
tree.

I'm heading off to LCA08 tomorrow afternoon so I wanted to get this
out of the way before leaving.
--
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 UCC TDM 3/3 ] Modified Documentation to explain dts entries for TDM driver

2008-01-23 Thread Poonam_Aggrwal-b10812
From: Poonam Aggrwal [EMAIL PROTECTED]

Modified Documentation to explain new properties introduced for UCC TDM 
driver. Also two new nodes have been added brg and clocks to configure 
a BRG from device tree.


Signed-off-by: Poonam Aggrwal [EMAIL PROTECTED]
Signed-off-by: Ashish Kalra [EMAIL PROTECTED]
Signed-off-by: Kim Phillips [EMAIL PROTECTED]
Signed-off-by: Michael Barkowski [EMAIL PROTECTED]
---
 Documentation/powerpc/booting-without-of.txt |   96 +-
 1 files changed, 94 insertions(+), 2 deletions(-)

diff --git a/Documentation/powerpc/booting-without-of.txt 
b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..94a6b4b 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1613,8 +1613,8 @@ platforms are moved over to use the flattened-device-tree 
model.
 
Required properties:
- device_type : should be network, hldc, uart, transparent
-bisync or atm.
-   - compatible : could be ucc_geth or fsl_atm and so on.
+bisync, atm or tdm.
+   - compatible : could be ucc_geth, fsl_atm or fsl,ucc_tdm and so on.
- model : should be UCC.
- device-id : the ucc number(1-8), corresponding to UCCx in UM.
- reg : Offset and length of the register set for the device
@@ -1666,7 +1666,44 @@ platforms are moved over to use the 
flattened-device-tree model.
pio-handle = 140001;
};
 
+   Required properties for tdm device_type:
+   - instead of tx-clock and rx-clock following clock properties are
+ required:
+   - fsl,tdm-tx-clk : This property selects the TX clock source for TDM
+   from a bank of clocks.
+   - fsl,tdm-rx-clk : This property selects the RX clock source for TDM
+   from a bank of clocks.
+   - fsl,tdm-tx-sync : This property selects the TX Frame sync source
+   for TDM from a bank of clocks.
+   - fsl,tdm-rx-sync : This property selects the TX Frame sync source
+   for TDM from a bank of clocks.
+
+   All the above mentioned properties are string type with possible
+   values
+   CLK1, CLK2, CLK3...CLK24 and so on
+   BRG1, BRG2, BRG3...BRG16 and so on
+
+  - fsl,tdm-num : TDM to be used (1,2,3 or 4 for TDMA TDMB TDMC TDMD)
+  - fsl,si-num :  Serial Interface to be used.
 
+   Example:
+   [EMAIL PROTECTED] {
+   device_type = tdm;
+   compatible = fsl,ucc-tdm;
+   model = UCC;
+   device-id = 1;
+   fsl,tdm-num = 1;
+   fsl,si-num = 1;
+   fsl,tdm-tx-clk = CLK1;
+   fsl,tdm-rx-clk = CLK1;
+   fsl,tdm-tx-sync = BRG9;
+   fsl,tdm-rx-sync = BRG9;
+   reg = 2000 200;
+   interrupts = 20;
+   interrupt-parent = qeic;
+   pio-handle = ucc1pio;
+   };
+
v) Parallel I/O Ports
 
This node configures Parallel I/O ports for CPUs with QE support.
@@ -1772,6 +1809,61 @@ platforms are moved over to use the 
flattened-device-tree model.
};
};
 
+  viii) Clocks (clocks)
+   This node specifies the frequency values for all the external clocks
+   viz CLK1 to CLK24 in Hz.
+
+  Required Properties:
+  - compatible : should be fsl,cpm-clocks.
+  - #clock-cells : It specifies the number of cells occupied by clock-frequency
+property. Currently #clock-cells = 1 is only supported and implemented.
+This property is kept for future in case we need frequencies higher than
+4 GHz.
+  - clock-frequency : It is a list of u32 values to represent the frequency
+of each external clock(CLK1 to CLK24) in Hz.Each entry occupies
+number of cells specified by #clock-cells property(1 for now).
+
+  Example:
+
+   clocks {
+   compatible = fsl,cpm-clocks;
+   #clock-cells = 1;
+   /* clock freqs in Hz(for CLK1~CLK24).
+* CLK11 is 1024KHz,
+* all other clocks unused
+*/
+   clock-frequency = 0 0 0 0 0 0
+  0 0 0 0 0 d#1024000 0
+  0 0 0 0 0 0
+  0 0 0 0 0 0;
+   };
+
+  ix) Baud Rate Generator (BRG)
+
+  Required properties:
+  - compatible : shpuld be fsl,cpm-brg
+  - fsl,brg-sources : define the input clock for all 16 BRGs. The input
+clock source could be 1 to 24 for CLK1 to CLK24. Zero means that the
+particular BRG will be driven by QE clock(BRGCLK).
+  - reg : This property defines the address and size of the memory-mapped
+registers of the BRG.
+
+  Example:
+
+   [EMAIL PROTECTED] {
+   compatible = fsl,qe-brg;
+   /* input clock sources for all the 16 BRGs.
+* 1-24 for CLK1 to CLK24.
+* BRG9 uses CLK11 others 

Re: [PATCH] [IPV4] route: fix locking in rt_run_flush()

2008-01-23 Thread Joonwoo Park
2008/1/24, Eric Dumazet [EMAIL PROTECTED]:

 Unfortunatly, your patch doesnt work on CONFIG_SMP=n (softirq will be disabled
 for the whole scan of table)

 Also, some machines around there have 2^22 slots in hash table, and NR_CPUS=4,
 so softirqs will be disabled for a too long time.

 Please try net-2.6.25 and submit patches on top of it if necessary, since
 rt_run_flush() has pending changes, not in net-2.6

 Note : The 'soft lockup' can be avoided by other means.



Eric,
Thank you for your help.

I checked net-2.6.25 in this morining :(
And it brought me a conclusion that the fashion of it is the best solution for
the all circumstances.

I believe that
 'cond_resched()'
and
 'if (!rth) continue' without disable softirq
of net-2.6.25 is correct answer.

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


[PATCH 6/6 v2] PS3: gelic: Add support for dual network interface

2008-01-23 Thread Masakazu Mokuno

Add support for dual network (net_device) interface so that ethernet
and wireless can own separate ethX interfaces.

V2
  - Fix the bug that bringing down and up the interface keeps rx
disabled.
  - Make 'gelic_net_poll_controller()' extern , as David Woodhouse
pointed out at the previous submission.
  - Fix weird usage of member names for the rx descriptor chain
V1
  - Export functions which are convenient for both interfaces
  - Move irq allocation/release code to driver probe/remove handlers
because interfaces share interrupts.
  - Allocate skbs by using dev_alloc_skb() instead of netdev_alloc_skb()
as the interfaces share the hardware rx queue.
  - Add gelic_port struct in order to abstract dual interface handling
  - Change handlers for hardware queues so that they can handle dual
{source,destination} interfaces.
  - Use new NAPI functions
This is a prerequisite for the new PS3 wireless support.

Signed-off-by: Masakazu Mokuno [EMAIL PROTECTED]
---
 drivers/net/ps3_gelic_net.c |  765 +++-
 drivers/net/ps3_gelic_net.h |  108 +-
 2 files changed, 564 insertions(+), 309 deletions(-)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -48,27 +48,22 @@
 #include ps3_gelic_net.h
 
 #define DRV_NAME Gelic Network Driver
-#define DRV_VERSION 1.0
+#define DRV_VERSION 1.1
 
 MODULE_AUTHOR(SCE Inc.);
 MODULE_DESCRIPTION(Gelic Network driver);
 MODULE_LICENSE(GPL);
 
-static inline struct device *ctodev(struct gelic_card *card)
-{
-   return card-dev-core;
-}
-static inline u64 bus_id(struct gelic_card *card)
-{
-   return card-dev-bus_id;
-}
-static inline u64 dev_id(struct gelic_card *card)
-{
-   return card-dev-dev_id;
-}
+
+static inline void gelic_card_enable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_rxdmac(struct gelic_card *card);
+static inline void gelic_card_disable_txdmac(struct gelic_card *card);
+static inline void gelic_card_reset_chain(struct gelic_card *card,
+ struct gelic_descr_chain *chain,
+ struct gelic_descr *start_descr);
 
 /* set irq_mask */
-static int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
+int gelic_card_set_irq_mask(struct gelic_card *card, u64 mask)
 {
int status;
 
@@ -76,20 +71,23 @@ static int gelic_card_set_irq_mask(struc
mask, 0);
if (status)
dev_info(ctodev(card),
-lv1_net_set_interrupt_mask failed %d\n, status);
+%s failed %d\n, __func__, status);
return status;
 }
+
 static inline void gelic_card_rx_irq_on(struct gelic_card *card)
 {
-   gelic_card_set_irq_mask(card, card-ghiintmask | GELIC_CARD_RXINT);
+   card-irq_mask |= GELIC_CARD_RXINT;
+   gelic_card_set_irq_mask(card, card-irq_mask);
 }
 static inline void gelic_card_rx_irq_off(struct gelic_card *card)
 {
-   gelic_card_set_irq_mask(card, card-ghiintmask  ~GELIC_CARD_RXINT);
+   card-irq_mask = ~GELIC_CARD_RXINT;
+   gelic_card_set_irq_mask(card, card-irq_mask);
 }
 
-static void
-gelic_card_get_ether_port_status(struct gelic_card *card, int inform)
+static void gelic_card_get_ether_port_status(struct gelic_card *card,
+int inform)
 {
u64 v2;
struct net_device *ether_netdev;
@@ -100,7 +98,7 @@ gelic_card_get_ether_port_status(struct 
card-ether_port_status, v2);
 
if (inform) {
-   ether_netdev = card-netdev;
+   ether_netdev = card-netdev[GELIC_PORT_ETHERNET];
if (card-ether_port_status  GELIC_LV1_ETHER_LINK_UP)
netif_carrier_on(ether_netdev);
else
@@ -108,6 +106,48 @@ gelic_card_get_ether_port_status(struct 
}
 }
 
+void gelic_card_up(struct gelic_card *card)
+{
+   pr_debug(%s: called\n, __func__);
+   down(card-updown_lock);
+   if (atomic_inc_return(card-users) == 1) {
+   pr_debug(%s: real do\n, __func__);
+   /* enable irq */
+   gelic_card_set_irq_mask(card, card-irq_mask);
+   /* start rx */
+   gelic_card_enable_rxdmac(card);
+
+   napi_enable(card-napi);
+   }
+   up(card-updown_lock);
+   pr_debug(%s: done\n, __func__);
+}
+
+void gelic_card_down(struct gelic_card *card)
+{
+   u64 mask;
+   pr_debug(%s: called\n, __func__);
+   down(card-updown_lock);
+   if (atomic_dec_if_positive(card-users) == 0) {
+   pr_debug(%s: real do\n, __func__);
+   napi_disable(card-napi);
+   /*
+* Disable irq. Wireless interrupts will
+* be disabled later if any
+*/
+   mask = card-irq_mask  (GELIC_CARD_WLAN_EVENT_RECEIVED |
+

  1   2   >