RE: [REGRESSION] 2.6.24-rc7: e1000: Detected Tx Unit Hang

2008-01-20 Thread Brandeburg, Jesse
David Miller wrote:
 From: Robert Olsson [EMAIL PROTECTED]
 Date: Fri, 18 Jan 2008 14:00:57 +0100
 
  I don't understand the idea with semaphore for enabling/disabling
  irq's either the overall logic must safer/better without it.
 
 They must have had code paths where they didn't know if IRQs were
 enabled or not already, so they tried to create something which
 approximates the:
 
   local_irq_save(flags);
   local_irq_restore(flags);
 
 constructs we have for CPU interrupts, so they could go:
 
   e1000_irq_disable();
   /* ... */
   e1000_irq_enable();
 
 and this would work even if the caller was running
 with e1000 interrupts disabled already.
 
 Or, something like that... it is indeed confusing.
 
 Anyways, yes it's totally bogus and should be removed.

I agree, bogus, and in fact I've already removed it from our development
version of ixgbe.  Right now I wanted to report I can't remove e1000 at
all on 2.6.24-rc8+git

I continually get the
 kernel: unregister_netdevice: waiting for eth2 to become free. Usage
count = 1

Where 2.6.24-rc5 e1000 is okay still.  Seems like maybe we are still
missing a netif_rx_complete or a napi_disable somewhere.

I don't think this problem has anything to do with the irq_sem right
now.  Something is still badly broken.  I am just using the interface
regularly (no heavy load) and I can't unload the module.

Jesse
--
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: [REGRESSION] 2.6.24-rc7: e1000: Detected Tx Unit Hang

2008-01-20 Thread Andrey Rahmatullin
On Sun, Jan 20, 2008 at 01:20:11AM -0800, Brandeburg, Jesse wrote:
 I continually get the
  kernel: unregister_netdevice: waiting for eth2 to become free. Usage
 count = 1
http://bugzilla.kernel.org/show_bug.cgi?id=9778

-- 
WBR, wRAR (ALT Linux Team)


signature.asc
Description: Digital signature


Re: [Bugme-new] [Bug 9778] New: unregister_netdevice: waiting for [device] to become free

2008-01-20 Thread David Miller
From: Andrew Morton [EMAIL PROTECTED]
Date: Sat, 19 Jan 2008 16:58:02 -0800

 ouch.

Yep, several people are hitting this it seems.

If Pavel doesn't provide a fix or direction soon I'll just revert.
--
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: sctp use-uninitialized warning in net-2.6.25

2008-01-20 Thread Vlad Yasevich

David Miller wrote:

From: Vlad Yasevich [EMAIL PROTECTED]
Date: Fri, 18 Jan 2008 21:17:56 -0500


Hmm... in the code I am looking at, it's set in both zero and
non-zero cases so it does solve the issue.

So does initializing it to NO_ERROR like you did.


Here is the code block in question in net-2.6.25:

/* Verify the INIT chunk before processing it. */
err_chunk = NULL;
if (!sctp_verify_init(asoc, chunk-chunk_hdr-type,
  (sctp_init_chunk_t *)chunk-chunk_hdr, chunk,
  err_chunk)) {
 ...
if (err_chunk) {
 ...
if (packet) {
sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT,
SCTP_PACKET(packet));
SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
error = SCTP_ERROR_INV_PARAM;
} else {
error = SCTP_ERROR_NO_RESOURCE;
}
}
 ...
return sctp_stop_t1_and_abort(commands, error, ECONNREFUSED,
asoc, chunk-transport);

If err_chunk == NULL at the if (err_chunk) test, error
will be left uninitialized, even after being moved as you
have suggested (right after the sctp_verify_init() call).

Thanks.



Hi David

Thanks for beating into my thick scull that this is in 2.6.25.  I missed that
initially.

Anyway, here is a patch that sets the correct value.

-vlad
From 4788563632fae22023fc0d75b525d2d5f8e0735b Mon Sep 17 00:00:00 2001
From: Vlad Yasevich [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 00:22:06 -0500
Subject: [PATCH] [SCTP] Correctly initialize error when parameter validation failed.

When parameter validation fails, there should be error causes
that specify what type of failure we've encountered.  If the
causes are not there, we lacked memory to allocated them.  Thus
make that the default value for the error.

Signed-off-by: Vlad Yasevich [EMAIL PROTECTED]
---
 net/sctp/sm_statefuns.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 6e12757..da5497e 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -481,7 +481,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
 	sctp_init_chunk_t *initchunk;
 	struct sctp_chunk *err_chunk;
 	struct sctp_packet *packet;
-	sctp_error_t error = SCTP_ERROR_NO_ERROR;
 
 	if (!sctp_vtag_verify(chunk, asoc))
 		return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
@@ -506,6 +505,8 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
 			  (sctp_init_chunk_t *)chunk-chunk_hdr, chunk,
 			  err_chunk)) {
 
+		sctp_error_t error = SCTP_ERROR_NO_RESOURCE;
+
 		/* This chunk contains fatal error. It is to be discarded.
 		 * Send an ABORT, with causes.  If there are no causes,
 		 * then there wasn't enough memory.  Just terminate
@@ -525,9 +526,7 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep,
 		SCTP_PACKET(packet));
 SCTP_INC_STATS(SCTP_MIB_OUTCTRLCHUNKS);
 error = SCTP_ERROR_INV_PARAM;
-			} else {
-error = SCTP_ERROR_NO_RESOURCE;
-			}
+			} 
 		}
 
 		/* SCTP-AUTH, Section 6.3:
-- 
1.5.2.5



Re: sctp use-uninitialized warning in net-2.6.25

2008-01-20 Thread David Miller
From: Vlad Yasevich [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 05:47:13 -0500

 Anyway, here is a patch that sets the correct value.

Applied, but I had to fix up the trailing whitespace on
line 29 of your patch. :-/

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


Re: [Bugme-new] [Bug 9758] New: net_device refcnt bug when NFQUEUEing bridged packets

2008-01-20 Thread Patrick McHardy

Stephen Hemminger wrote:

This looks good, but you could use a structure assignment rather memcpy
(just a personal style preference because assignment is typed and memcpy
is not).


That doesn't work in this case since nf_bridge_info contains

unsigned long data[32 / sizeof(unsigned long)];

and I don't want to assign each array element seperately.
--
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 2.6.25 is broken when building with wireless/iwlwifi

2008-01-20 Thread Ian Brown
Hello,
net 2.6.25 is broken when building with the wireless/iwlwifi
subtree;  we get the following errors (we noticed that iwl_down() and
iwl_resume()
implementation do exist in garzik tree, but there are more differences
so a simple
patch with only adding these two methods might be risky)

...
...

  CHK include/linux/version.h
  CHK include/linux/utsrelease.h
  CALLscripts/checksyscalls.sh
  CHK include/linux/compile.h
  CC [M]  drivers/net/wireless/iwlwifi/iwl3945-base.o
drivers/net/wireless/iwlwifi/iwl3945-base.c: In function 'iwl3945_pci_remove':
drivers/net/wireless/iwlwifi/iwl3945-base.c:8639: error: implicit
declaration of function 'iwl_down'
drivers/net/wireless/iwlwifi/iwl3945-base.c: In function 'iwl3945_pci_resume':
drivers/net/wireless/iwlwifi/iwl3945-base.c:8779: error: implicit
declaration of function 'iwl_resume'
make[4]: *** [drivers/net/wireless/iwlwifi/iwl3945-base.o] Error 1
make[3]: *** [drivers/net/wireless/iwlwifi] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2
...
...
IB
--
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/09]: sch_ingress: formatting fixes

2008-01-20 Thread Patrick McHardy
commit e237be7bc5b3009d1021e0764d1745e9a4c3cefb
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:06 2008 +0100

[NET_SCHED]: sch_ingress: formatting fixes

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 89c32a9..4880d44 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -22,23 +22,20 @@
 #undef DEBUG_INGRESS
 
 #ifdef DEBUG_INGRESS  /* control */
-#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
+#define DPRINTK(format, args...) printk(KERN_DEBUG format,##args)
 #else
-#define DPRINTK(format,args...)
+#define DPRINTK(format, args...)
 #endif
 
 #if 0  /* data */
-#define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args)
+#define D2PRINTK(format, args...) printk(KERN_DEBUG format,##args)
 #else
-#define D2PRINTK(format,args...)
+#define D2PRINTK(format, args...)
 #endif
 
-
 #define PRIV(sch) qdisc_priv(sch)
 
-
-/* Thanks to Doron Oz for this hack
-*/
+/* Thanks to Doron Oz for this hack */
 #ifndef CONFIG_NET_CLS_ACT
 #ifdef CONFIG_NETFILTER
 static int nf_registered;
@@ -50,12 +47,10 @@ struct ingress_qdisc_data {
struct tcf_proto*filter_list;
 };
 
-
 /* - Class/flow operations - */
 
-
-static int ingress_graft(struct Qdisc *sch,unsigned long arg,
-struct Qdisc *new,struct Qdisc **old)
+static int ingress_graft(struct Qdisc *sch, unsigned long arg,
+struct Qdisc *new, struct Qdisc **old)
 {
 #ifdef DEBUG_INGRESS
struct ingress_qdisc_data *p = PRIV(sch);
@@ -67,37 +62,33 @@ static int ingress_graft(struct Qdisc *sch,unsigned long 
arg,
return 1;
 }
 
-
 static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
 {
return NULL;
 }
 
-
-static unsigned long ingress_get(struct Qdisc *sch,u32 classid)
+static unsigned long ingress_get(struct Qdisc *sch, u32 classid)
 {
 #ifdef DEBUG_INGRESS
struct ingress_qdisc_data *p = PRIV(sch);
 #endif
-   DPRINTK(ingress_get(sch %p,[qdisc %p],classid %x)\n, sch, p, classid);
+   DPRINTK(ingress_get(sch %p,[qdisc %p],classid %x)\n,
+   sch, p, classid);
return TC_H_MIN(classid) + 1;
 }
 
-
 static unsigned long ingress_bind_filter(struct Qdisc *sch,
-unsigned long parent, u32 classid)
+unsigned long parent, u32 classid)
 {
return ingress_get(sch, classid);
 }
 
-
 static void ingress_put(struct Qdisc *sch, unsigned long cl)
 {
 }
 
-
 static int ingress_change(struct Qdisc *sch, u32 classid, u32 parent,
-struct rtattr **tca, unsigned long *arg)
+ struct rtattr **tca, unsigned long *arg)
 {
 #ifdef DEBUG_INGRESS
struct ingress_qdisc_data *p = PRIV(sch);
@@ -108,9 +99,7 @@ static int ingress_change(struct Qdisc *sch, u32 classid, 
u32 parent,
return 0;
 }
 
-
-
-static void ingress_walk(struct Qdisc *sch,struct qdisc_walker *walker)
+static void ingress_walk(struct Qdisc *sch, struct qdisc_walker *walker)
 {
 #ifdef DEBUG_INGRESS
struct ingress_qdisc_data *p = PRIV(sch);
@@ -119,19 +108,16 @@ static void ingress_walk(struct Qdisc *sch,struct 
qdisc_walker *walker)
DPRINTK(No effect. sch_ingress doesn't maintain classes at the 
moment);
 }
 
-
-static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch,unsigned long cl)
+static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, unsigned long cl)
 {
struct ingress_qdisc_data *p = PRIV(sch);
 
return p-filter_list;
 }
 
-
 /* --- Qdisc operations  */
 
-
-static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
+static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
struct ingress_qdisc_data *p = PRIV(sch);
struct tcf_result res;
@@ -148,20 +134,20 @@ static int ingress_enqueue(struct sk_buff *skb,struct 
Qdisc *sch)
sch-bstats.packets++;
sch-bstats.bytes += skb-len;
switch (result) {
-   case TC_ACT_SHOT:
-   result = TC_ACT_SHOT;
-   sch-qstats.drops++;
-   break;
-   case TC_ACT_STOLEN:
-   case TC_ACT_QUEUED:
-   result = TC_ACT_STOLEN;
-   break;
-   case TC_ACT_RECLASSIFY:
-   case TC_ACT_OK:
-   skb-tc_index = TC_H_MIN(res.classid);
-   default:
-   result = TC_ACT_OK;
-   break;
+   case TC_ACT_SHOT:
+   result = TC_ACT_SHOT;
+   sch-qstats.drops++;
+   break;
+   case TC_ACT_STOLEN:
+   case TC_ACT_QUEUED:
+   result = TC_ACT_STOLEN;
+   break;
+   case TC_ACT_RECLASSIFY:
+   case TC_ACT_OK:
+   skb-tc_index = TC_H_MIN(res.classid);
+   

[NET_SCHED 00/09]: sch_ingress cleanups

2008-01-20 Thread Patrick McHardy
These patches clean up sch_ingress by reformatting the code to match the
usual kernel style, removing lots of debugging statements that seem
unnecessary after years of stable operation, removing some future use
stuff that doesn't seem likely to ever get used and some minor additional
cleanups.


 net/sched/Kconfig   |1 +
 net/sched/sch_ingress.c |  232 ---
 2 files changed, 41 insertions(+), 192 deletions(-)

Patrick McHardy (9):
  [NET_SCHED]: sch_ingress: formatting fixes
  [NET_SCHED]: sch_ingress: remove excessive debugging
  [NET_SCHED]: sch_ingress: remove qdisc_priv() wrapper
  [NET_SCHED]: sch_ingress: remove unused inner qdisc
  [NET_SCHED]: sch_ingress: return proper error code in ingress_graft()
  [NET_SCHED]: sch_ingress: remove unnecessary ops
  [NET_SCHED]: sch_ingress: move dependencies to Kconfig
  [NET_SCHED]: sch_ingress: avoid a few #ifdefs
  [NET_SCHED]: sch_ingress: remove useless printk
--
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/09]: sch_ingress: remove excessive debugging

2008-01-20 Thread Patrick McHardy
commit fdb1b974189eeab782ba3595d1ca550a1a5ee79e
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:06 2008 +0100

[NET_SCHED]: sch_ingress: remove excessive debugging

Remove excessive debugging statements and some future use stuff.

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 4880d44..bdda28d 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -19,20 +19,6 @@
 #include net/pkt_sched.h
 
 
-#undef DEBUG_INGRESS
-
-#ifdef DEBUG_INGRESS  /* control */
-#define DPRINTK(format, args...) printk(KERN_DEBUG format,##args)
-#else
-#define DPRINTK(format, args...)
-#endif
-
-#if 0  /* data */
-#define D2PRINTK(format, args...) printk(KERN_DEBUG format,##args)
-#else
-#define D2PRINTK(format, args...)
-#endif
-
 #define PRIV(sch) qdisc_priv(sch)
 
 /* Thanks to Doron Oz for this hack */
@@ -52,13 +38,6 @@ struct ingress_qdisc_data {
 static int ingress_graft(struct Qdisc *sch, unsigned long arg,
 struct Qdisc *new, struct Qdisc **old)
 {
-#ifdef DEBUG_INGRESS
-   struct ingress_qdisc_data *p = PRIV(sch);
-#endif
-
-   DPRINTK(ingress_graft(sch %p,[qdisc %p],new %p,old %p)\n,
-   sch, p, new, old);
-   DPRINTK(\n ingress_graft: You cannot add qdiscs to classes);
return 1;
 }
 
@@ -69,11 +48,6 @@ static struct Qdisc *ingress_leaf(struct Qdisc *sch, 
unsigned long arg)
 
 static unsigned long ingress_get(struct Qdisc *sch, u32 classid)
 {
-#ifdef DEBUG_INGRESS
-   struct ingress_qdisc_data *p = PRIV(sch);
-#endif
-   DPRINTK(ingress_get(sch %p,[qdisc %p],classid %x)\n,
-   sch, p, classid);
return TC_H_MIN(classid) + 1;
 }
 
@@ -90,22 +64,12 @@ static void ingress_put(struct Qdisc *sch, unsigned long cl)
 static int ingress_change(struct Qdisc *sch, u32 classid, u32 parent,
  struct rtattr **tca, unsigned long *arg)
 {
-#ifdef DEBUG_INGRESS
-   struct ingress_qdisc_data *p = PRIV(sch);
-#endif
-   DPRINTK(ingress_change(sch %p,[qdisc %p],classid %x,parent %x),
-   arg 0x%lx\n, sch, p, classid, parent, *arg);
-   DPRINTK(No effect. sch_ingress doesn't maintain classes at the 
moment);
return 0;
 }
 
 static void ingress_walk(struct Qdisc *sch, struct qdisc_walker *walker)
 {
-#ifdef DEBUG_INGRESS
-   struct ingress_qdisc_data *p = PRIV(sch);
-#endif
-   DPRINTK(ingress_walk(sch %p,[qdisc %p],walker %p)\n, sch, p, walker);
-   DPRINTK(No effect. sch_ingress doesn't maintain classes at the 
moment);
+   return;
 }
 
 static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, unsigned long cl)
@@ -123,9 +87,8 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
struct tcf_result res;
int result;
 
-   D2PRINTK(ingress_enqueue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
result = tc_classify(skb, p-filter_list, res);
-   D2PRINTK(result %d class 0x%04x\n, result, res.classid);
+
/*
 * Unlike normal enqueue functions, ingress_enqueue returns a
 * firewall FW_* code.
@@ -150,7 +113,6 @@ static int ingress_enqueue(struct sk_buff *skb, struct 
Qdisc *sch)
break;
}
 #else
-   D2PRINTK(Overriding result to ACCEPT\n);
result = NF_ACCEPT;
sch-bstats.packets++;
sch-bstats.bytes += skb-len;
@@ -161,28 +123,16 @@ static int ingress_enqueue(struct sk_buff *skb, struct 
Qdisc *sch)
 
 static struct sk_buff *ingress_dequeue(struct Qdisc *sch)
 {
-/*
-   struct ingress_qdisc_data *p = PRIV(sch);
-   D2PRINTK(ingress_dequeue(sch %p,[qdisc %p])\n,sch,PRIV(p));
-*/
return NULL;
 }
 
 static int ingress_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
-/*
-   struct ingress_qdisc_data *p = PRIV(sch);
-   D2PRINTK(ingress_requeue(skb %p,sch %p,[qdisc %p])\n,skb,sch,PRIV(p));
-*/
return 0;
 }
 
 static unsigned int ingress_drop(struct Qdisc *sch)
 {
-#ifdef DEBUG_INGRESS
-   struct ingress_qdisc_data *p = PRIV(sch);
-#endif
-   DPRINTK(ingress_drop(sch %p,[qdisc %p])\n, sch, p);
return 0;
 }
 
@@ -198,11 +148,6 @@ static unsigned int ing_hook(unsigned int hook, struct 
sk_buff *skb,
struct net_device *dev = skb-dev;
int fwres = NF_ACCEPT;
 
-   DPRINTK(ing_hook: skb %s dev=%s len=%u\n,
-   skb-sk ? (owned) : (unowned),
-   skb-dev ? skb-dev-name : (no dev),
-   skb-len);
-
if (dev-qdisc_ingress) {
spin_lock(dev-ingress_lock);
if ((q = dev-qdisc_ingress) != NULL)
@@ -259,26 +204,13 @@ static int ingress_init(struct Qdisc *sch, struct rtattr 
*opt)
}
 #endif
 #endif
-
-   DPRINTK(ingress_init(sch %p,[qdisc %p],opt %p)\n, sch, p, opt);
p-q = noop_qdisc;
return 0;
 }
 
 static void ingress_reset(struct Qdisc *sch)
 {
-   struct ingress_qdisc_data *p = PRIV(sch);
-
-

[NET_SCHED 03/09]: sch_ingress: remove qdisc_priv() wrapper

2008-01-20 Thread Patrick McHardy
commit ec46354d4ba87fe98b8510f2d91fff4e106022ec
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:07 2008 +0100

[NET_SCHED]: sch_ingress: remove qdisc_priv() wrapper

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index bdda28d..cb8ba8b 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -19,8 +19,6 @@
 #include net/pkt_sched.h
 
 
-#define PRIV(sch) qdisc_priv(sch)
-
 /* Thanks to Doron Oz for this hack */
 #ifndef CONFIG_NET_CLS_ACT
 #ifdef CONFIG_NETFILTER
@@ -74,7 +72,7 @@ static void ingress_walk(struct Qdisc *sch, struct 
qdisc_walker *walker)
 
 static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, unsigned long cl)
 {
-   struct ingress_qdisc_data *p = PRIV(sch);
+   struct ingress_qdisc_data *p = qdisc_priv(sch);
 
return p-filter_list;
 }
@@ -83,7 +81,7 @@ static struct tcf_proto **ingress_find_tcf(struct Qdisc *sch, 
unsigned long cl)
 
 static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
-   struct ingress_qdisc_data *p = PRIV(sch);
+   struct ingress_qdisc_data *p = qdisc_priv(sch);
struct tcf_result res;
int result;
 
@@ -180,7 +178,7 @@ static struct nf_hook_ops ing_ops[] __read_mostly = {
 
 static int ingress_init(struct Qdisc *sch, struct rtattr *opt)
 {
-   struct ingress_qdisc_data *p = PRIV(sch);
+   struct ingress_qdisc_data *p = qdisc_priv(sch);
 
/* Make sure either netfilter or preferably CLS_ACT is
 * compiled in */
@@ -217,7 +215,7 @@ static void ingress_reset(struct Qdisc *sch)
 
 static void ingress_destroy(struct Qdisc *sch)
 {
-   struct ingress_qdisc_data *p = PRIV(sch);
+   struct ingress_qdisc_data *p = qdisc_priv(sch);
 
tcf_destroy_chain(p-filter_list);
 }
--
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/09]: sch_ingress: remove unused inner qdisc

2008-01-20 Thread Patrick McHardy
commit bb582f29b1f403d0df8a4a54daca89eafd2bfb69
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:07 2008 +0100

[NET_SCHED]: sch_ingress: remove unused inner qdisc

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index cb8ba8b..d803cd1 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -27,7 +27,6 @@ static int nf_registered;
 #endif
 
 struct ingress_qdisc_data {
-   struct Qdisc*q;
struct tcf_proto*filter_list;
 };
 
@@ -178,8 +177,6 @@ static struct nf_hook_ops ing_ops[] __read_mostly = {
 
 static int ingress_init(struct Qdisc *sch, struct rtattr *opt)
 {
-   struct ingress_qdisc_data *p = qdisc_priv(sch);
-
/* Make sure either netfilter or preferably CLS_ACT is
 * compiled in */
 #ifndef CONFIG_NET_CLS_ACT
@@ -202,7 +199,6 @@ static int ingress_init(struct Qdisc *sch, struct rtattr 
*opt)
}
 #endif
 #endif
-   p-q = noop_qdisc;
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 05/09]: sch_ingress: return proper error code in ingress_graft()

2008-01-20 Thread Patrick McHardy
commit e039da57d244f15d4b920de63a20ab516a76ed5b
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:07 2008 +0100

[NET_SCHED]: sch_ingress: return proper error code in ingress_graft()

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index d803cd1..1bbc648 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -35,7 +35,7 @@ struct ingress_qdisc_data {
 static int ingress_graft(struct Qdisc *sch, unsigned long arg,
 struct Qdisc *new, struct Qdisc **old)
 {
-   return 1;
+   return -EOPNOTSUPP;
 }
 
 static struct Qdisc *ingress_leaf(struct Qdisc *sch, unsigned long arg)
--
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 06/09]: sch_ingress: remove unnecessary ops

2008-01-20 Thread Patrick McHardy
commit c96158287d0c87fc3e4d005ce8bf2c778a5c2cb6
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:07 2008 +0100

[NET_SCHED]: sch_ingress: remove unnecessary ops

- -reset is optional
- sch_api provides identical defaults for -dequeue/-requeue
- -drop can't happen since ingress never has a parent qdisc

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 1bbc648..c69e7bc 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -118,21 +118,6 @@ static int ingress_enqueue(struct sk_buff *skb, struct 
Qdisc *sch)
return result;
 }
 
-static struct sk_buff *ingress_dequeue(struct Qdisc *sch)
-{
-   return NULL;
-}
-
-static int ingress_requeue(struct sk_buff *skb, struct Qdisc *sch)
-{
-   return 0;
-}
-
-static unsigned int ingress_drop(struct Qdisc *sch)
-{
-   return 0;
-}
-
 #ifndef CONFIG_NET_CLS_ACT
 #ifdef CONFIG_NETFILTER
 static unsigned int ing_hook(unsigned int hook, struct sk_buff *skb,
@@ -202,11 +187,6 @@ static int ingress_init(struct Qdisc *sch, struct rtattr 
*opt)
return 0;
 }
 
-static void ingress_reset(struct Qdisc *sch)
-{
-   return;
-}
-
 /* - */
 
 static void ingress_destroy(struct Qdisc *sch)
@@ -248,11 +228,7 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
.id =   ingress,
.priv_size  =   sizeof(struct ingress_qdisc_data),
.enqueue=   ingress_enqueue,
-   .dequeue=   ingress_dequeue,
-   .requeue=   ingress_requeue,
-   .drop   =   ingress_drop,
.init   =   ingress_init,
-   .reset  =   ingress_reset,
.destroy=   ingress_destroy,
.dump   =   ingress_dump,
.owner  =   THIS_MODULE,
--
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 07/09]: sch_ingress: move dependencies to Kconfig

2008-01-20 Thread Patrick McHardy
commit 4c939213974319d9457dbbf038d38ef1fcf57ef9
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:08 2008 +0100

[NET_SCHED]: sch_ingress: move dependencies to Kconfig

Instead of complaining at scheduler initialization time, check the 
dependencies
in Kconfig.

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

diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 4eb73ec..a047cd5 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -204,6 +204,7 @@ config NET_SCH_NETEM
 
 config NET_SCH_INGRESS
tristate Ingress Qdisc
+   depends on NET_CLS_ACT || NETFILTER
---help---
  Say Y here if you want to use classifiers for incoming packets.
  If unsure, say Y.
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index c69e7bc..b30ca01 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -162,19 +162,10 @@ static struct nf_hook_ops ing_ops[] __read_mostly = {
 
 static int ingress_init(struct Qdisc *sch, struct rtattr *opt)
 {
-   /* Make sure either netfilter or preferably CLS_ACT is
-* compiled in */
 #ifndef CONFIG_NET_CLS_ACT
-#ifndef CONFIG_NETFILTER
-   printk(You MUST compile classifier actions into the kernel\n);
-   return -EINVAL;
-#else
+#ifdef CONFIG_NETFILTER
printk(Ingress scheduler: Classifier actions prefered over 
netfilter\n);
-#endif
-#endif
 
-#ifndef CONFIG_NET_CLS_ACT
-#ifdef CONFIG_NETFILTER
if (!nf_registered) {
if (nf_register_hooks(ing_ops, ARRAY_SIZE(ing_ops))  0) {
printk(ingress qdisc registration error \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


[NET_SCHED 09/09]: sch_ingress: remove useless printk

2008-01-20 Thread Patrick McHardy
commit f8d51e131177c26c1033dfc804f11d9cac7637f4
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Thu Jan 17 09:17:59 2008 +0100

[NET_SCHED]: sch_ingress: remove useless printk

The printk about ingress qdisc registration error can't be triggered under
normal circumstances. Since register_qdisc only fails for two identical
registrations, the only way to trigger it is by loading the sch_ingress
modules multiple times under different names, in which case we already
return -EEXIST to userspace.

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 4c7f7e7..7252571 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -221,14 +221,7 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
 
 static int __init ingress_module_init(void)
 {
-   int ret = 0;
-
-   if ((ret = register_qdisc(ingress_qdisc_ops))  0) {
-   printk(Unable to register Ingress qdisc\n);
-   return ret;
-   }
-
-   return ret;
+   return register_qdisc(ingress_qdisc_ops);
 }
 
 static void __exit ingress_module_exit(void)
--
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 08/09]: sch_ingress: avoid a few

2008-01-20 Thread Patrick McHardy
commit 3320bc3c5d9a6c1dd96d515b7b6a4dee9cd31fd7
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Thu Jan 17 09:17:58 2008 +0100

[NET_SCHED]: sch_ingress: avoid a few #ifdefs

Move the repeating ifndef CONFIG_NET_CLS_ACT/ifdef CONFIG_NETFILTER ifdefs
into a single condition.

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

diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index b30ca01..4c7f7e7 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -20,11 +20,9 @@
 
 
 /* Thanks to Doron Oz for this hack */
-#ifndef CONFIG_NET_CLS_ACT
-#ifdef CONFIG_NETFILTER
+#if !defined(CONFIG_NET_CLS_ACT)  defined(CONFIG_NETFILTER)
 static int nf_registered;
 #endif
-#endif
 
 struct ingress_qdisc_data {
struct tcf_proto*filter_list;
@@ -118,8 +116,7 @@ static int ingress_enqueue(struct sk_buff *skb, struct 
Qdisc *sch)
return result;
 }
 
-#ifndef CONFIG_NET_CLS_ACT
-#ifdef CONFIG_NETFILTER
+#if !defined(CONFIG_NET_CLS_ACT)  defined(CONFIG_NETFILTER)
 static unsigned int ing_hook(unsigned int hook, struct sk_buff *skb,
 const struct net_device *indev,
 const struct net_device *outdev,
@@ -158,12 +155,10 @@ static struct nf_hook_ops ing_ops[] __read_mostly = {
},
 };
 #endif
-#endif
 
 static int ingress_init(struct Qdisc *sch, struct rtattr *opt)
 {
-#ifndef CONFIG_NET_CLS_ACT
-#ifdef CONFIG_NETFILTER
+#if !defined(CONFIG_NET_CLS_ACT)  defined(CONFIG_NETFILTER)
printk(Ingress scheduler: Classifier actions prefered over 
netfilter\n);
 
if (!nf_registered) {
@@ -174,7 +169,6 @@ static int ingress_init(struct Qdisc *sch, struct rtattr 
*opt)
nf_registered++;
}
 #endif
-#endif
return 0;
 }
 
@@ -240,12 +234,10 @@ static int __init ingress_module_init(void)
 static void __exit ingress_module_exit(void)
 {
unregister_qdisc(ingress_qdisc_ops);
-#ifndef CONFIG_NET_CLS_ACT
-#ifdef CONFIG_NETFILTER
+#if !defined(CONFIG_NET_CLS_ACT)  defined(CONFIG_NETFILTER)
if (nf_registered)
nf_unregister_hooks(ing_ops, ARRAY_SIZE(ing_ops));
 #endif
-#endif
 }
 
 module_init(ingress_module_init)
--
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]: kill obsolete NET_CLS_POLICE option

2008-01-20 Thread Patrick McHardy
 commit 2af10cb220dd73b91323d052f7ca4cb808906e78
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:06 2008 +0100

[NET_SCHED]: kill obsolete NET_CLS_POLICE option

The code is already gone for about half a year, the config option
has been kept around to select the replacement options for easier
upgrades. This seems long enough, people upgrading from older
kernels will have to reconfigure a lot anyway.

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

diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 63882c5..4eb73ec 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -481,15 +481,6 @@ config NET_ACT_SIMP
  To compile this code as a module, choose M here: the
  module will be called simple.
 
-config NET_CLS_POLICE
-   bool Traffic Policing (obsolete)
-   select NET_CLS_ACT
-   select NET_ACT_POLICE
-   ---help---
- Say Y here if you want to do traffic policing, i.e. strict
- bandwidth limiting. This option is obsolete and just selects
- the option replacing it. It will be removed in the future.
-
 config NET_CLS_IND
bool Incoming device classification
depends on NET_CLS_U32 || NET_CLS_FW


[AF_KEY]: Fix skb leak on pfkey_send_migrate() error

2008-01-20 Thread Patrick McHardy
 commit 4dd3440faa345731c27337ee041c0e9abf2b70dc
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Sun Jan 20 16:10:04 2008 +0100

[AF_KEY]: Fix skb leak on pfkey_send_migrate() error

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

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 3667f44..16b72b5 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3591,27 +3591,29 @@ static int pfkey_send_migrate(struct xfrm_selector 
*sel, u8 dir, u8 type,
/* old ipsecrequest */
int mode = pfkey_mode_from_xfrm(mp-mode);
if (mode  0)
-   return -EINVAL;
+   goto err;
if (set_ipsecrequest(skb, mp-proto, mode,
 (mp-reqid ?  IPSEC_LEVEL_UNIQUE : 
IPSEC_LEVEL_REQUIRE),
 mp-reqid, mp-old_family,
-mp-old_saddr, mp-old_daddr)  0) {
-   return -EINVAL;
-   }
+mp-old_saddr, mp-old_daddr)  0)
+   goto err;
 
/* new ipsecrequest */
if (set_ipsecrequest(skb, mp-proto, mode,
 (mp-reqid ? IPSEC_LEVEL_UNIQUE : 
IPSEC_LEVEL_REQUIRE),
 mp-reqid, mp-new_family,
-mp-new_saddr, mp-new_daddr)  0) {
-   return -EINVAL;
-   }
+mp-new_saddr, mp-new_daddr)  0)
+   goto err;
}
 
/* broadcast migrate message to sockets */
pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL);
 
return 0;
+
+err:
+   kfree_skb(skb);
+   return -EINVAL;
 }
 #else
 static int pfkey_send_migrate(struct xfrm_selector *sel, u8 dir, u8 type,


Re: [PATCH] mv643xx_eth: fix byte order when checksum offload is enabled

2008-01-20 Thread Byron Bradley
The Marvell Orion system on chips have an integrated mv643xx MAC.
On these little endian ARM devices mv643xx will oops when checksum
offload is enabled. Swapping the byte order of the protocol and
checksum solves this problem.

Signed-off-by: Byron Bradley [EMAIL PROTECTED]
Cc: Dale Farnsworth [EMAIL PROTECTED]
Cc: Manish Lachwani [EMAIL PROTECTED]
---

Resubmitted after comments from Al Viro. udp_hdr(skb)-check returns
a __sum16 so I have called the function sum16_as_be(). Again lightly
tested only on two Marvell Orion boards.

 drivers/net/mv643xx_eth.c |   11 ---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index 651c269..b528ce7 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1652,6 +1652,11 @@ static void eth_tx_fill_frag_descs(struct 
mv643xx_private *mp,
}
 }

+static inline __be16 sum16_as_be(__sum16 sum)
+{
+   return (__force __be16)sum;
+}
+
 /**
  * eth_tx_submit_descs_for_skb - submit data from an skb to the tx hw
  *
@@ -1689,7 +1694,7 @@ static void eth_tx_submit_descs_for_skb(struct 
mv643xx_private *mp,
desc-buf_ptr = dma_map_single(NULL, skb-data, length, DMA_TO_DEVICE);

if (skb-ip_summed == CHECKSUM_PARTIAL) {
-   BUG_ON(skb-protocol != ETH_P_IP);
+   BUG_ON(skb-protocol != htons(ETH_P_IP));

cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
   ETH_GEN_IP_V_4_CHECKSUM  |
@@ -1698,10 +1703,10 @@ static void eth_tx_submit_descs_for_skb(struct 
mv643xx_private *mp,
switch (ip_hdr(skb)-protocol) {
case IPPROTO_UDP:
cmd_sts |= ETH_UDP_FRAME;
-   desc-l4i_chk = udp_hdr(skb)-check;
+   desc-l4i_chk = ntohs(sum16_as_be(udp_hdr(skb)-check));
break;
case IPPROTO_TCP:
-   desc-l4i_chk = tcp_hdr(skb)-check;
+   desc-l4i_chk = ntohs(sum16_as_be(tcp_hdr(skb)-check));
break;
default:
BUG();
-- 
1.5.4.rc2.38.gd6da3


--
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/09]: sch_ingress cleanups

2008-01-20 Thread jamal
On Sun, 2008-20-01 at 15:32 +0100, Patrick McHardy wrote:
 These patches clean up sch_ingress by reformatting the code to match the
 usual kernel style, removing lots of debugging statements that seem
 unnecessary after years of stable operation, removing some future use
 stuff that doesn't seem likely to ever get used and some minor additional
 cleanups.
 

Patrick - if you are in mopping-mode then you will find some of the same
things in dsmark (LinuxWay(tm)).

For all patches:
Acked-by: Jamal Hadi Salim [EMAIL PROTECTED]

cheers,
jamal

--
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/09]: sch_ingress cleanups

2008-01-20 Thread Patrick McHardy

jamal wrote:

On Sun, 2008-20-01 at 15:32 +0100, Patrick McHardy wrote:

These patches clean up sch_ingress by reformatting the code to match the
usual kernel style, removing lots of debugging statements that seem
unnecessary after years of stable operation, removing some future use
stuff that doesn't seem likely to ever get used and some minor additional
cleanups.



Patrick - if you are in mopping-mode then you will find some of the same
things in dsmark (LinuxWay(tm)).



Indeed, that one could use a bit of cleanup as well. I took care
of sch_ingress first since I had these patches queued for multiple
years now and always forgot to send them out, but I'll look into
sch_dsmark next time I'm in the area :)


For all patches:
Acked-by: Jamal Hadi Salim [EMAIL PROTECTED]



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


netconsole on bnx2 not working?

2008-01-20 Thread Denys Fedoryshchenko
Hi

I am trying to run netconsole on Dell PowerEdge 1950, equipped with two
Broadcom NIC, without any success.

Tried to load netconsole on eth1 and eth0 (interface was renamed by udev), and
after that i am loading ppp_generic (which generate some data in kernel log).
Watching by tcpdump on remote, and local host - nothing is shown there.

The same time i am testing on RTL8139, same commands(just ip/mac different,
and sure machine is different) work fine.

Is any specific reason for that here? How i can debug this issue?
Do i need to enable netpoll for that?

I tried to create target over configfs, without any luck. Still no data is sent.

visp-1 test # pwd
/config/netconsole/test
visp-1 test # ls
dev_name  enabled  local_ip  local_mac  local_port  remote_ip  remote_mac 
remote_port
visp-1 test # grep  *
dev_name:eth0
enabled:1
local_ip:217.151.X.Y
local_mac:00:13:72:f8:73:ac
local_port:6665
remote_ip:217.151.X.X
remote_mac:00:30:48:90:09:06
remote_port:514


dmesg
[537625.200501] Broadcom NetXtreme II Gigabit Ethernet Driver bnx2 v1.6.9
(December 8, 2007)
[537625.200888] ACPI: PCI Interrupt :08:00.0[A] - GSI 16 (level, low) -
IRQ 16
[537625.531219] eth0: Broadcom NetXtreme II BCM5708 1000Base-T (B1) PCI-X
64-bit 133MHz found at mem f400, IRQ 16, node addr 00:13:72:f8:73:ae
[537625.531268] ACPI: PCI Interrupt :04:00.0[A] - GSI 16 (level, low) -
IRQ 16
[537625.532352] udev: renamed network interface eth0 to eth1
[537625.888397] eth0: Broadcom NetXtreme II BCM5708 1000Base-T (B1) PCI-X
64-bit 133MHz found at mem f800, IRQ 16, node addr 00:13:72:f8:73:ac

dmesg on loading netconsole on eth0 and eth1
[538036.561776] netconsole: local port 111
[538036.561785] netconsole: local IP 217.151.X.X
[538036.561789] netconsole: interface eth1
[538036.561793] netconsole: remote port 514
[538036.561802] netconsole: remote IP 217.151.X.X
[538036.561808] netconsole: remote ethernet address 00:30:48:90:09:06
[538036.565989] console [netcon0] enabled
[538036.565998] netconsole: network logging started

[537899.157053] netconsole: couldn't parse config at 217.151.224.117!
[537899.157064] netconsole: cleaning up
[537942.772496] netconsole: local port 111
[537942.772505] netconsole: local IP 217.151.X.X
[537942.772510] netconsole: interface eth0
[537942.772514] netconsole: remote port 514
[537942.772518] netconsole: remote IP 217.151.X.X
[537942.772549] netconsole: remote ethernet address 00:30:48:90:09:06
[537942.780203] console [netcon0] enabled
[537942.780213] netconsole: network logging started




--
Denys Fedoryshchenko
Technical Manager
Virtual ISP S.A.L.

--
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/09]: sch_ingress cleanups

2008-01-20 Thread Stephen Hemminger
On Sun, 20 Jan 2008 16:35:01 +0100
Patrick McHardy [EMAIL PROTECTED] wrote:

 jamal wrote:
  On Sun, 2008-20-01 at 15:32 +0100, Patrick McHardy wrote:
  These patches clean up sch_ingress by reformatting the code to match the
  usual kernel style, removing lots of debugging statements that seem
  unnecessary after years of stable operation, removing some future use
  stuff that doesn't seem likely to ever get used and some minor additional
  cleanups.
 
  
  Patrick - if you are in mopping-mode then you will find some of the same
  things in dsmark (LinuxWay(tm)).
 
 
 Indeed, that one could use a bit of cleanup as well. I took care
 of sch_ingress first since I had these patches queued for multiple
 years now and always forgot to send them out, but I'll look into
 sch_dsmark next time I'm in the area :)
 
  For all patches:
  Acked-by: Jamal Hadi Salim [EMAIL PROTECTED]

I'll fix dsmark, I need it for some other stuff.

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


[VLAN 02/18]: Clean up vlan_hdr/vlan_ethhdr structs

2008-01-20 Thread Patrick McHardy
[VLAN]: Clean up vlan_hdr/vlan_ethhdr structs

Fix 3 space indentation and some overly long lines by moving the comments
to a kdoc structure description.

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

---
commit f12d203e024ce5e0c98a9e88f6fdf8517a665ce4
tree cebd9edb5b883aa901eaad4702ec428b2af87fc1
parent a8d2fc16ef0ffc7eb3502130f87994ba07129dae
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:52 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:52 +0100

 include/linux/if_vlan.h |   33 +++--
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a268051..a1b0066 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -34,12 +34,30 @@ struct hlist_node;
 #define VLAN_ETH_DATA_LEN  1500/* Max. octets in payload*/
 #define VLAN_ETH_FRAME_LEN 1518/* Max. octets in frame sans FCS */
 
+/*
+ * struct vlan_hdr - vlan header
+ * @h_vlan_TCI: priority and VLAN ID
+ * @h_vlan_encapsulated_proto: packet type ID or len
+ */
+struct vlan_hdr {
+   __be16  h_vlan_TCI;
+   __be16  h_vlan_encapsulated_proto;
+};
+
+/**
+ * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr)
+ * @h_dest: destination ethernet address
+ * @h_source: source ethernet address
+ * @h_vlan_proto: ethernet protocol (always 0x8100)
+ * @h_vlan_TCI: priority and VLAN ID
+ * @h_vlan_encapsulated_proto: packet type ID or len
+ */
 struct vlan_ethhdr {
-   unsigned char   h_dest[ETH_ALEN];  /* destination eth addr  
*/
-   unsigned char   h_source[ETH_ALEN];/* source ether addr */
-   __be16   h_vlan_proto;  /* Should always be 0x8100 
*/
-   __be16   h_vlan_TCI;/* Encapsulates priority 
and VLAN ID */
-   __be16  h_vlan_encapsulated_proto; /* packet type ID field (or 
len) */
+   unsigned char   h_dest[ETH_ALEN];
+   unsigned char   h_source[ETH_ALEN];
+   __be16  h_vlan_proto;
+   __be16  h_vlan_TCI;
+   __be16  h_vlan_encapsulated_proto;
 };
 
 #include linux/skbuff.h
@@ -49,11 +67,6 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct 
sk_buff *skb)
return (struct vlan_ethhdr *)skb_mac_header(skb);
 }
 
-struct vlan_hdr {
-   __be16   h_vlan_TCI;/* Encapsulates priority 
and VLAN ID */
-   __be16   h_vlan_encapsulated_proto; /* packet type ID field (or 
len) */
-};
-
 #define VLAN_VID_MASK  0xfff
 
 /* found in socket.c */
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[VLAN 00/18]: Vlan update

2008-01-20 Thread Patrick McHardy
Hi Dave,

the following patches contain a VLAN update for 2.6.25, consisting mainly
of minor cleanups removing duplicate code, avoiding forward declarations,
makeing functions static etc. Next I'll look into the skb-cb issues
with VLAN.

Please apply, thanks.


 drivers/net/cxgb3/l2t.c  |2 +-
 drivers/s390/net/qeth_main.c |4 +-
 include/linux/if_ether.h |1 +
 include/linux/if_vlan.h  |   61 +++---
 net/8021q/vlan.c |  437 ++
 net/8021q/vlan.h |   42 +
 net/8021q/vlan_dev.c |  484 --
 net/8021q/vlan_netlink.c |   17 +-
 net/8021q/vlanproc.c |  107 --
 net/8021q/vlanproc.h |   11 +-
 10 files changed, 436 insertions(+), 730 deletions(-)

Patrick McHardy (17):
  [VLAN]: Remove unnecessary structure declarations
  [VLAN]: Clean up vlan_hdr/vlan_ethhdr structs
  [VLAN]: Kill useless VLAN_NAME define
  [VLAN]: Use dev-stats
  [VLAN]: Move device setup to vlan_dev.c
  [VLAN]: Kill useless check
  [ETHER]: Bring back MAC_FMT
  [VLAN]: Clean up debugging and printks
  [VLAN]: Remove non-implemented ioctls
  [VLAN]: Clean up initialization code
  [VLAN]: Clean up unregister_vlan_dev
  [VLAN]: Simplify vlan unregistration
  [VLAN]: Turn VLAN_DEV_INFO into inline function
  [VLAN]: Turn __constant_htons into htons where possible
  [VLAN]: checkpatch cleanups
  [VLAN]: Update list address
  [VLAN]: Clean up vlan_skb_recv()

Pavel Emelyanov (1):
  [VLAN]: Move protocol determination to seperate function
--
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


[VLAN 01/18]: Remove unnecessary structure declarations

2008-01-20 Thread Patrick McHardy
[VLAN]: Remove unnecessary structure declarations

- struct packet_type is not used
- struct vlan_group is declared later in the file before the first use
- struct net_device is not needed since netdevice.h is included
- struct vlan_collection does not exist
- struct vlan_dev_info is declared later in the file before the first use

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

---
commit a8d2fc16ef0ffc7eb3502130f87994ba07129dae
tree 15638920f44a6854f8a570ce87caae9f748ba77f
parent ad50adbc891ee4e2fb0ea442303a5df16b9501ea
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:52 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:52 +0100

 include/linux/if_vlan.h |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 4562105..a268051 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -16,11 +16,6 @@
 #ifdef __KERNEL__
 
 /* externally defined structs */
-struct vlan_group;
-struct net_device;
-struct packet_type;
-struct vlan_collection;
-struct vlan_dev_info;
 struct hlist_node;
 
 #include linux/netdevice.h
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[VLAN 03/18]: Kill useless VLAN_NAME define

2008-01-20 Thread Patrick McHardy
[VLAN]: Kill useless VLAN_NAME define

The only user already includes __FUNCTION__ (vlan_proto_init) in the output,
which is enough to identify what the message is about.

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

---
commit 6fcdd6b0d244f103898c3a37be2a3f4fec50fbd8
tree 6554c7cab6fdf09ac27fa1c75c93f0c105e249bd
parent f12d203e024ce5e0c98a9e88f6fdf8517a665ce4
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:54 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:54 +0100

 include/linux/if_vlan.h |2 --
 net/8021q/vlan.c|4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index a1b0066..0325d6b 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -72,8 +72,6 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct 
sk_buff *skb)
 /* found in socket.c */
 extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
 
-#define VLAN_NAME vlan
-
 /* if this changes, algorithm will have to be reworked because this
  * depends on completely exhausting the VLAN identifier space.  Thus
  * it gives constant time look-up, but in many cases it wastes memory.
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 032bf44..af25255 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -89,8 +89,8 @@ static int __init vlan_proto_init(void)
err = vlan_proc_init();
if (err  0) {
printk(KERN_ERR
-  %s %s: can't create entry in proc filesystem!\n,
-  __FUNCTION__, VLAN_NAME);
+  %s: can't create entry in proc filesystem!\n,
+  __FUNCTION__);
return err;
}
 
--
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


[VLAN 05/18]: Move device setup to vlan_dev.c

2008-01-20 Thread Patrick McHardy
[VLAN]: Move device setup to vlan_dev.c

Move device setup to vlan_dev.c and make all the VLAN device methods
static.

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

---
commit aa7c9ed461cf1cf1977a7d5735d464a7539d2518
tree 06a7feef01dfd6494de6ed687895c6ca58a44f3d
parent fef4f968b4704bf2b37417ca6ba0dedda696e611
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:55 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:55 +0100

 net/8021q/vlan.c |   81 -
 net/8021q/vlan.h |   13 ---
 net/8021q/vlan_dev.c |  100 +++---
 3 files changed, 86 insertions(+), 108 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 54f2346..8bc6385 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -307,87 +307,6 @@ int unregister_vlan_device(struct net_device *dev)
return ret;
 }
 
-/*
- * vlan network devices have devices nesting below it, and are a special
- * super class of normal network devices; split their locks off into a
- * separate class since they always nest.
- */
-static struct lock_class_key vlan_netdev_xmit_lock_key;
-
-static const struct header_ops vlan_header_ops = {
-   .create  = vlan_dev_hard_header,
-   .rebuild = vlan_dev_rebuild_header,
-   .parse   = eth_header_parse,
-};
-
-static int vlan_dev_init(struct net_device *dev)
-{
-   struct net_device *real_dev = VLAN_DEV_INFO(dev)-real_dev;
-   int subclass = 0;
-
-   /* IFF_BROADCAST|IFF_MULTICAST; ??? */
-   dev-flags  = real_dev-flags  ~IFF_UP;
-   dev-iflink = real_dev-ifindex;
-   dev-state  = (real_dev-state  ((1__LINK_STATE_NOCARRIER) |
- (1__LINK_STATE_DORMANT))) |
- (1__LINK_STATE_PRESENT);
-
-   /* ipv6 shared card related stuff */
-   dev-dev_id = real_dev-dev_id;
-
-   if (is_zero_ether_addr(dev-dev_addr))
-   memcpy(dev-dev_addr, real_dev-dev_addr, dev-addr_len);
-   if (is_zero_ether_addr(dev-broadcast))
-   memcpy(dev-broadcast, real_dev-broadcast, dev-addr_len);
-
-   if (real_dev-features  NETIF_F_HW_VLAN_TX) {
-   dev-header_ops  = real_dev-header_ops;
-   dev-hard_header_len = real_dev-hard_header_len;
-   dev-hard_start_xmit = vlan_dev_hwaccel_hard_start_xmit;
-   } else {
-   dev-header_ops  = vlan_header_ops;
-   dev-hard_header_len = real_dev-hard_header_len + VLAN_HLEN;
-   dev-hard_start_xmit = vlan_dev_hard_start_xmit;
-   }
-
-   if (real_dev-priv_flags  IFF_802_1Q_VLAN)
-   subclass = 1;
-
-   lockdep_set_class_and_subclass(dev-_xmit_lock,
-   vlan_netdev_xmit_lock_key, subclass);
-   return 0;
-}
-
-void vlan_setup(struct net_device *new_dev)
-{
-   ether_setup(new_dev);
-
-   /* new_dev-ifindex = 0;  it will be set when added to
-* the global list.
-* iflink is set as well.
-*/
-   /* Make this thing known as a VLAN device */
-   new_dev-priv_flags |= IFF_802_1Q_VLAN;
-
-   /* Set us up to have no queue, as the underlying Hardware device
-* can do all the queueing we could want.
-*/
-   new_dev-tx_queue_len = 0;
-
-   /* set up method calls */
-   new_dev-change_mtu = vlan_dev_change_mtu;
-   new_dev-init = vlan_dev_init;
-   new_dev-open = vlan_dev_open;
-   new_dev-stop = vlan_dev_stop;
-   new_dev-set_mac_address = vlan_set_mac_address;
-   new_dev-set_multicast_list = vlan_dev_set_multicast_list;
-   new_dev-change_rx_flags = vlan_change_rx_flags;
-   new_dev-destructor = free_netdev;
-   new_dev-do_ioctl = vlan_dev_ioctl;
-
-   memset(new_dev-broadcast, 0, ETH_ALEN);
-}
-
 static void vlan_transfer_operstate(const struct net_device *dev, struct 
net_device *vlandev)
 {
/* Have to respect userspace enforced dormant state
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 2cd1393..7b615d6 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -49,19 +49,8 @@ struct net_device *__find_vlan_dev(struct net_device* 
real_dev,
   unsigned short VID); /* vlan.c */
 
 /* found in vlan_dev.c */
-int vlan_dev_rebuild_header(struct sk_buff *skb);
 int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
  struct packet_type *ptype, struct net_device *orig_dev);
-int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
-unsigned short type, const void *daddr,
-const void *saddr, unsigned len);
-int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev);
-int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, struct net_device 
*dev);
-int vlan_dev_change_mtu(struct net_device *dev, int new_mtu);
-int vlan_dev_open(struct net_device* dev);
-int 

[VLAN 06/18]: Kill useless check

2008-01-20 Thread Patrick McHardy
[VLAN]: Kill useless check

vlan-real_dev is always equal to the device since thats what we used
for the lookup. It doesn't even seem worth a WARN_ON or BUG_ON.

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

---
commit 99c94d927602635ca0994a99bf75edc0d2f80871
tree b7455cbbe55a60f0d13a3b9b64694099e718e6d9
parent aa7c9ed461cf1cf1977a7d5735d464a7539d2518
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:55 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 16:24:55 +0100

 net/8021q/vlan_dev.c |   18 --
 1 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 51ce421..50d8edc 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -181,24 +181,6 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
/* Take off the VLAN header (4 bytes currently) */
skb_pull_rcsum(skb, VLAN_HLEN);
 
-   /* Ok, lets check to make sure the device (dev) we
-* came in on is what this VLAN is attached to.
-*/
-
-   if (dev != VLAN_DEV_INFO(skb-dev)-real_dev) {
-   rcu_read_unlock();
-
-#ifdef VLAN_DEBUG
-   printk(VLAN_DBG %s: dropping skb: %p because came in on wrong 
device, dev: %s  real_dev: %s, skb_dev: %s\n,
-   __FUNCTION__, skb, dev-name,
-   VLAN_DEV_INFO(skb-dev)-real_dev-name,
-   skb-dev-name);
-#endif
-   kfree_skb(skb);
-   stats-rx_errors++;
-   return -1;
-   }
-
/*
 * Deal with ingress priority mapping.
 */
--
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


[ETHER 07/18]: Bring back MAC_FMT

2008-01-20 Thread Patrick McHardy
[ETHER]: Bring back MAC_FMT

The print_mac function is not very suitable for debugging printks
in performance critical paths since without ifdefs it will always
get called. MAC_FMT can be used with pr_debug without any overhead
when debugging is disabled.

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

---
commit ead4b3ca023de4d4f05d185e8111c01784ee08e2
tree d9616532b4fcc9137828d9ed9da941512bdc6841
parent 99c94d927602635ca0994a99bf75edc0d2f80871
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:28 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:28 +0100

 include/linux/if_ether.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h
index 7a1e011..e157c13 100644
--- a/include/linux/if_ether.h
+++ b/include/linux/if_ether.h
@@ -130,6 +130,7 @@ extern ssize_t sysfs_format_mac(char *buf, const unsigned 
char *addr, int len);
  * Display a 6 byte device address (MAC) in a readable format.
  */
 extern char *print_mac(char *buf, const unsigned char *addr);
+#define MAC_FMT %02x:%02x:%02x:%02x:%02x:%02x
 #define MAC_BUF_SIZE   18
 #define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused
 
--
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


[VLAN 08/18]: Clean up debugging and printks

2008-01-20 Thread Patrick McHardy
[VLAN]: Clean up debugging and printks

- use pr_* functions and common prefix for non-device related messages

- remove VLAN_ printk levels

- kill lots of useless debugging statements

- remove a few unnecessary printks like for double VID registration (already
  returns -EEXIST) and kill of a number of unnecessary checks in
  vlan_proc_{add,rem}_dev() that are already performed by the caller

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

---
commit 7d925b47858e2f18fd474c673a0a75a0cfd00ebf
tree 25c74a419d2f5451b57e810897d4704c4e5fa467
parent ead4b3ca023de4d4f05d185e8111c01784ee08e2
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 net/8021q/vlan.c |   58 +-
 net/8021q/vlan.h |   25 --
 net/8021q/vlan_dev.c |   56 
 net/8021q/vlanproc.c |   29 -
 4 files changed, 30 insertions(+), 138 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8bc6385..6edd191 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -80,16 +80,13 @@ static int __init vlan_proto_init(void)
 {
int err;
 
-   printk(VLAN_INF %s v%s %s\n,
-  vlan_fullname, vlan_version, vlan_copyright);
-   printk(VLAN_INF All bugs added by %s\n,
-  vlan_buggyright);
+   pr_info(%s v%s %s\n, vlan_fullname, vlan_version, vlan_copyright);
+   pr_info(All bugs added by %s\n, vlan_buggyright);
 
/* proc file system initialization */
err = vlan_proc_init();
if (err  0) {
-   printk(KERN_ERR
-  %s: can't create entry in proc filesystem!\n,
+   pr_err(%s: can't create entry in proc filesystem!\n,
   __FUNCTION__);
return err;
}
@@ -233,10 +230,6 @@ static int unregister_vlan_dev(struct net_device *real_dev,
struct vlan_group *grp;
int i, ret;
 
-#ifdef VLAN_DEBUG
-   printk(VLAN_DBG %s: VID: %i\n, __FUNCTION__, vlan_id);
-#endif
-
/* sanity check */
if (vlan_id = VLAN_VID_MASK)
return -EINVAL;
@@ -329,23 +322,22 @@ static void vlan_transfer_operstate(const struct 
net_device *dev, struct net_dev
 
 int vlan_check_real_dev(struct net_device *real_dev, unsigned short vlan_id)
 {
+   char *name = real_dev-name;
+
if (real_dev-features  NETIF_F_VLAN_CHALLENGED) {
-   printk(VLAN_DBG %s: VLANs not supported on %s.\n,
-   __FUNCTION__, real_dev-name);
+   pr_info(8021q: VLANs not supported on %s\n, name);
return -EOPNOTSUPP;
}
 
if ((real_dev-features  NETIF_F_HW_VLAN_RX) 
!real_dev-vlan_rx_register) {
-   printk(VLAN_DBG %s: Device %s has buggy VLAN hw accel.\n,
-   __FUNCTION__, real_dev-name);
+   pr_info(8021q: device %s has buggy VLAN hw accel\n, name);
return -EOPNOTSUPP;
}
 
if ((real_dev-features  NETIF_F_HW_VLAN_FILTER) 
(!real_dev-vlan_rx_add_vid || !real_dev-vlan_rx_kill_vid)) {
-   printk(VLAN_DBG %s: Device %s has buggy VLAN hw accel.\n,
-   __FUNCTION__, real_dev-name);
+   pr_info(8021q: Device %s has buggy VLAN hw accel\n, name);
return -EOPNOTSUPP;
}
 
@@ -355,11 +347,8 @@ int vlan_check_real_dev(struct net_device *real_dev, 
unsigned short vlan_id)
if (!(real_dev-flags  IFF_UP))
return -ENETDOWN;
 
-   if (__find_vlan_dev(real_dev, vlan_id) != NULL) {
-   /* was already registered. */
-   printk(VLAN_DBG %s: ALREADY had VLAN registered\n, 
__FUNCTION__);
+   if (__find_vlan_dev(real_dev, vlan_id) != NULL)
return -EEXIST;
-   }
 
return 0;
 }
@@ -399,8 +388,8 @@ int register_vlan_dev(struct net_device *dev)
real_dev-vlan_rx_add_vid(real_dev, vlan_id);
 
if (vlan_proc_add_dev(dev)  0)
-   printk(KERN_WARNING VLAN: failed to add proc entry for %s\n,
-  dev-name);
+   pr_warning(8021q: failed to add proc entry for %s\n,
+  dev-name);
return 0;
 
 out_free_group:
@@ -419,11 +408,6 @@ static int register_vlan_device(struct net_device 
*real_dev,
char name[IFNAMSIZ];
int err;
 
-#ifdef VLAN_DEBUG
-   printk(VLAN_DBG %s: if_name -:%s:- vid: %i\n,
-   __FUNCTION__, eth_IF_name, VLAN_ID);
-#endif
-
if (VLAN_ID = VLAN_VID_MASK)
return -ERANGE;
 
@@ -432,10 +416,6 @@ static int register_vlan_device(struct net_device 
*real_dev,
return err;
 
/* Gotta set up the fields for the device. */
-#ifdef VLAN_DEBUG
-   printk(VLAN_DBG About to allocate name, vlan_name_type: 

[VLAN 09/18]: Remove non-implemented ioctls

2008-01-20 Thread Patrick McHardy
[VLAN]: Remove non-implemented ioctls

The GET_VLAN_INGRESS_PRIORITY_CMD/GET_VLAN_EGRESS_PRIORITY_CMD ioctls are
not implemented and won't be, new functionality will be added to the netlink
interface. Remove the code and make the ioctl handler return -EOPNOTSUPP
for unknown commands instead of -EINVAL.

Also remove a comment about passing unknown commands to the underlying
device, that doesn't make any sense since its a VLAN specific ioctl and
if its not implemented here, its implemented nowhere.

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

---
commit 8798cc926478d29231ad48d5e0ff31e434660ddb
tree bd5a582834f284db01ad92e19153ad307a425510
parent 7d925b47858e2f18fd474c673a0a75a0cfd00ebf
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 net/8021q/vlan.c |   23 +--
 1 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 6edd191..69a9e02 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -688,26 +688,6 @@ static int vlan_ioctl_handler(struct net *net, void __user 
*arg)
err = unregister_vlan_device(dev);
break;
 
-   case GET_VLAN_INGRESS_PRIORITY_CMD:
-   /* TODO:  Implement
-  err = vlan_dev_get_ingress_priority(args);
-  if (copy_to_user((void*)arg, args,
-   sizeof(struct vlan_ioctl_args))) {
-   err = -EFAULT;
-  }
-   */
-   err = -EINVAL;
-   break;
-   case GET_VLAN_EGRESS_PRIORITY_CMD:
-   /* TODO:  Implement
-  err = vlan_dev_get_egress_priority(args.device1, 
(args.args);
-  if (copy_to_user((void*)arg, args,
-   sizeof(struct vlan_ioctl_args))) {
-   err = -EFAULT;
-  }
-   */
-   err = -EINVAL;
-   break;
case GET_VLAN_REALDEV_NAME_CMD:
err = 0;
vlan_dev_get_realdev_name(dev, args.u.device2);
@@ -728,8 +708,7 @@ static int vlan_ioctl_handler(struct net *net, void __user 
*arg)
break;
 
default:
-   /* pass on to underlying device instead?? */
-   err = -EINVAL;
+   err = -EOPNOTSUPP;
break;
}
 out:
--
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


[VLAN 10/18]: Clean up initialization code

2008-01-20 Thread Patrick McHardy
[VLAN]: Clean up initialization code

- move module init/exit functions to end of file, remove some now unnecessary
  forward declarations
- remove some obvious comments
- clean up proc init function and move a proc-related printk there

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

---
commit 9829059db87d43bb24e82683e6bb4ed4a655fc39
tree d4a062fb2a45e299eae6ac7aa1de6e3e05e9ad31
parent 8798cc926478d29231ad48d5e0ff31e434660ddb
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 net/8021q/vlan.c |  141 +-
 net/8021q/vlanproc.c |   21 ---
 2 files changed, 70 insertions(+), 92 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 69a9e02..006d9a9 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -50,16 +50,6 @@ static char vlan_version[] = DRV_VERSION;
 static char vlan_copyright[] = Ben Greear [EMAIL PROTECTED];
 static char vlan_buggyright[] = David S. Miller [EMAIL PROTECTED];
 
-static int vlan_device_event(struct notifier_block *, unsigned long, void *);
-static int vlan_ioctl_handler(struct net *net, void __user *);
-static int unregister_vlan_dev(struct net_device *, unsigned short );
-
-static struct notifier_block vlan_notifier_block = {
-   .notifier_call = vlan_device_event,
-};
-
-/* These may be changed at run-time through IOCTLs */
-
 /* Determines interface naming scheme. */
 unsigned short vlan_name_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
 
@@ -70,79 +60,6 @@ static struct packet_type vlan_packet_type = {
 
 /* End of global variables definitions. */
 
-/*
- * Function vlan_proto_init (pro)
- *
- *Initialize VLAN protocol layer,
- *
- */
-static int __init vlan_proto_init(void)
-{
-   int err;
-
-   pr_info(%s v%s %s\n, vlan_fullname, vlan_version, vlan_copyright);
-   pr_info(All bugs added by %s\n, vlan_buggyright);
-
-   /* proc file system initialization */
-   err = vlan_proc_init();
-   if (err  0) {
-   pr_err(%s: can't create entry in proc filesystem!\n,
-  __FUNCTION__);
-   return err;
-   }
-
-   dev_add_pack(vlan_packet_type);
-
-   /* Register us to receive netdevice events */
-   err = register_netdevice_notifier(vlan_notifier_block);
-   if (err  0)
-   goto err1;
-
-   err = vlan_netlink_init();
-   if (err  0)
-   goto err2;
-
-   vlan_ioctl_set(vlan_ioctl_handler);
-   return 0;
-
-err2:
-   unregister_netdevice_notifier(vlan_notifier_block);
-err1:
-   vlan_proc_cleanup();
-   dev_remove_pack(vlan_packet_type);
-   return err;
-}
-
-/*
- * Module 'remove' entry point.
- * o delete /proc/net/router directory and static entries.
- */
-static void __exit vlan_cleanup_module(void)
-{
-   int i;
-
-   vlan_ioctl_set(NULL);
-   vlan_netlink_fini();
-
-   /* Un-register us from receiving netdevice events */
-   unregister_netdevice_notifier(vlan_notifier_block);
-
-   dev_remove_pack(vlan_packet_type);
-
-   /* This table must be empty if there are no module
-* references left.
-*/
-   for (i = 0; i  VLAN_GRP_HASH_SIZE; i++) {
-   BUG_ON(!hlist_empty(vlan_group_hash[i]));
-   }
-   vlan_proc_cleanup();
-
-   synchronize_net();
-}
-
-module_init(vlan_proto_init);
-module_exit(vlan_cleanup_module);
-
 /* Must be invoked with RCU read lock (no preempt) */
 static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
 {
@@ -592,6 +509,10 @@ out:
return NOTIFY_DONE;
 }
 
+static struct notifier_block vlan_notifier_block __read_mostly = {
+   .notifier_call = vlan_device_event,
+};
+
 /*
  * VLAN IOCTL handler.
  * o execute requested action or pass command to the device driver
@@ -716,5 +637,59 @@ out:
return err;
 }
 
+static int __init vlan_proto_init(void)
+{
+   int err;
+
+   pr_info(%s v%s %s\n, vlan_fullname, vlan_version, vlan_copyright);
+   pr_info(All bugs added by %s\n, vlan_buggyright);
+
+   err = vlan_proc_init();
+   if (err  0)
+   goto err1;
+
+   err = register_netdevice_notifier(vlan_notifier_block);
+   if (err  0)
+   goto err2;
+
+   err = vlan_netlink_init();
+   if (err  0)
+   goto err3;
+
+   dev_add_pack(vlan_packet_type);
+   vlan_ioctl_set(vlan_ioctl_handler);
+   return 0;
+
+err3:
+   unregister_netdevice_notifier(vlan_notifier_block);
+err2:
+   vlan_proc_cleanup();
+err1:
+   return err;
+}
+
+static void __exit vlan_cleanup_module(void)
+{
+   unsigned int i;
+
+   vlan_ioctl_set(NULL);
+   vlan_netlink_fini();
+
+   unregister_netdevice_notifier(vlan_notifier_block);
+
+   dev_remove_pack(vlan_packet_type);
+
+   /* This table must be empty if there are no module references left. */
+   

[VLAN 11/18]: Clean up unregister_vlan_dev

2008-01-20 Thread Patrick McHardy
[VLAN]: Clean up unregister_vlan_dev

Save two levels of indentation by aborting on error conditions,
remove unnecessary initialization to NULL and remove two obvious
comments.

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

---
commit 9f39c0253f370dae13a81cda9cf119052bb11750
tree d27c1417f8f19e0aff3833b6a631453c509c787e
parent 9829059db87d43bb24e82683e6bb4ed4a655fc39
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 net/8021q/vlan.c |   72 --
 1 files changed, 32 insertions(+), 40 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 006d9a9..ad34e4a 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -142,63 +142,55 @@ static void vlan_rcu_free(struct rcu_head *rcu)
 static int unregister_vlan_dev(struct net_device *real_dev,
   unsigned short vlan_id)
 {
-   struct net_device *dev = NULL;
+   struct net_device *dev;
int real_dev_ifindex = real_dev-ifindex;
struct vlan_group *grp;
-   int i, ret;
+   unsigned int i;
+   int ret;
 
-   /* sanity check */
if (vlan_id = VLAN_VID_MASK)
return -EINVAL;
 
ASSERT_RTNL();
grp = __vlan_find_group(real_dev_ifindex);
+   if (!grp)
+   return -ENOENT;
 
-   ret = 0;
-
-   if (grp) {
-   dev = vlan_group_get_device(grp, vlan_id);
-   if (dev) {
-   /* Remove proc entry */
-   vlan_proc_rem_dev(dev);
-
-   /* Take it out of our own structures, but be sure to
-* interlock with HW accelerating devices or SW vlan
-* input packet processing.
-*/
-   if (real_dev-features  NETIF_F_HW_VLAN_FILTER)
-   real_dev-vlan_rx_kill_vid(real_dev, vlan_id);
+   dev = vlan_group_get_device(grp, vlan_id);
+   if (!dev)
+   return -ENOENT;
 
-   vlan_group_set_device(grp, vlan_id, NULL);
-   synchronize_net();
+   vlan_proc_rem_dev(dev);
 
+   /* Take it out of our own structures, but be sure to interlock with
+* HW accelerating devices or SW vlan input packet processing.
+*/
+   if (real_dev-features  NETIF_F_HW_VLAN_FILTER)
+   real_dev-vlan_rx_kill_vid(real_dev, vlan_id);
 
-   /* Caller unregisters (and if necessary, puts)
-* VLAN device, but we get rid of the reference to
-* real_dev here.
-*/
-   dev_put(real_dev);
+   vlan_group_set_device(grp, vlan_id, NULL);
+   synchronize_net();
 
-   /* If the group is now empty, kill off the
-* group.
-*/
-   for (i = 0; i  VLAN_VID_MASK; i++)
-   if (vlan_group_get_device(grp, i))
-   break;
+   /* Caller unregisters (and if necessary, puts) VLAN device, but we
+* get rid of the reference to real_dev here.
+*/
+   dev_put(real_dev);
 
-   if (i == VLAN_VID_MASK) {
-   if (real_dev-features  NETIF_F_HW_VLAN_RX)
-   real_dev-vlan_rx_register(real_dev, 
NULL);
+   /* If the group is now empty, kill off the group. */
+   ret = 0;
+   for (i = 0; i  VLAN_VID_MASK; i++)
+   if (vlan_group_get_device(grp, i))
+   break;
 
-   hlist_del_rcu(grp-hlist);
+   if (i == VLAN_VID_MASK) {
+   if (real_dev-features  NETIF_F_HW_VLAN_RX)
+   real_dev-vlan_rx_register(real_dev, NULL);
 
-   /* Free the group, after all cpu's are done. */
-   call_rcu(grp-rcu, vlan_rcu_free);
+   hlist_del_rcu(grp-hlist);
 
-   grp = NULL;
-   ret = 1;
-   }
-   }
+   /* Free the group, after all cpu's are done. */
+   call_rcu(grp-rcu, vlan_rcu_free);
+   ret = 1;
}
 
return ret;
--
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


[VLAN 12/18]: Simplify vlan unregistration

2008-01-20 Thread Patrick McHardy
[VLAN]: Simplify vlan unregistration

Keep track of the number of VLAN devices in a vlan group. This allows
to have the caller sense when the group is going to be destroyed and
stop using it, which in turn allows to remove the wrapper around
unregister_vlan_dev for the NETDEV_UNREGISTER notifier and avoid
iterating over all possible VLAN ids whenever a device in unregistered.

Also fix what looks like a use-after-free (but is actually safe since
we're holding the RTNL), the real_dev reference should not be dropped
while we still use it.

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

---
commit cd41c792d7df5107c05f2529426ae68f817e38f6
tree 469a2f8242654a34329d4b51e66e27f200ec314f
parent 9f39c0253f370dae13a81cda9cf119052bb11750
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 include/linux/if_vlan.h  |1 +
 net/8021q/vlan.c |   76 --
 net/8021q/vlan.h |2 +
 net/8021q/vlan_netlink.c |7 +---
 4 files changed, 23 insertions(+), 63 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 07db416..129fa87 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -82,6 +82,7 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void 
__user *));
 
 struct vlan_group {
int real_dev_ifindex; /* The ifindex of the ethernet(like) device the 
vlan is attached to. */
+   unsigned intnr_vlans;
struct hlist_node   hlist;  /* linked list */
struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
struct rcu_head rcu;
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index ad34e4a..ac79638 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -132,33 +132,17 @@ static void vlan_rcu_free(struct rcu_head *rcu)
vlan_group_free(container_of(rcu, struct vlan_group, rcu));
 }
 
-
-/* This returns 0 if everything went fine.
- * It will return 1 if the group was killed as a result.
- * A negative return indicates failure.
- *
- * The RTNL lock must be held.
- */
-static int unregister_vlan_dev(struct net_device *real_dev,
-  unsigned short vlan_id)
+void unregister_vlan_dev(struct net_device *dev)
 {
-   struct net_device *dev;
-   int real_dev_ifindex = real_dev-ifindex;
+   struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+   struct net_device *real_dev = vlan-real_dev;
struct vlan_group *grp;
-   unsigned int i;
-   int ret;
-
-   if (vlan_id = VLAN_VID_MASK)
-   return -EINVAL;
+   unsigned short vlan_id = vlan-vlan_id;
 
ASSERT_RTNL();
-   grp = __vlan_find_group(real_dev_ifindex);
-   if (!grp)
-   return -ENOENT;
 
-   dev = vlan_group_get_device(grp, vlan_id);
-   if (!dev)
-   return -ENOENT;
+   grp = __vlan_find_group(real_dev-ifindex);
+   BUG_ON(!grp);
 
vlan_proc_rem_dev(dev);
 
@@ -169,20 +153,12 @@ static int unregister_vlan_dev(struct net_device 
*real_dev,
real_dev-vlan_rx_kill_vid(real_dev, vlan_id);
 
vlan_group_set_device(grp, vlan_id, NULL);
-   synchronize_net();
+   grp-nr_vlans--;
 
-   /* Caller unregisters (and if necessary, puts) VLAN device, but we
-* get rid of the reference to real_dev here.
-*/
-   dev_put(real_dev);
+   synchronize_net();
 
/* If the group is now empty, kill off the group. */
-   ret = 0;
-   for (i = 0; i  VLAN_VID_MASK; i++)
-   if (vlan_group_get_device(grp, i))
-   break;
-
-   if (i == VLAN_VID_MASK) {
+   if (grp-nr_vlans == 0) {
if (real_dev-features  NETIF_F_HW_VLAN_RX)
real_dev-vlan_rx_register(real_dev, NULL);
 
@@ -190,23 +166,12 @@ static int unregister_vlan_dev(struct net_device 
*real_dev,
 
/* Free the group, after all cpu's are done. */
call_rcu(grp-rcu, vlan_rcu_free);
-   ret = 1;
}
 
-   return ret;
-}
-
-int unregister_vlan_device(struct net_device *dev)
-{
-   int ret;
+   /* Get rid of the vlan's reference to real_dev */
+   dev_put(real_dev);
 
-   ret = unregister_vlan_dev(VLAN_DEV_INFO(dev)-real_dev,
- VLAN_DEV_INFO(dev)-vlan_id);
unregister_netdevice(dev);
-
-   if (ret == 1)
-   ret = 0;
-   return ret;
 }
 
 static void vlan_transfer_operstate(const struct net_device *dev, struct 
net_device *vlandev)
@@ -291,6 +256,8 @@ int register_vlan_dev(struct net_device *dev)
 * it into our local structure.
 */
vlan_group_set_device(grp, vlan_id, dev);
+   grp-nr_vlans++;
+
if (ngrp  real_dev-features  NETIF_F_HW_VLAN_RX)
real_dev-vlan_rx_register(real_dev, ngrp);
if (real_dev-features  

[VLAN 13/18]: Turn VLAN_DEV_INFO into inline function

2008-01-20 Thread Patrick McHardy
[VLAN]: Turn VLAN_DEV_INFO into inline function

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

---
commit 84ea6a8ff0745f63e25d2d17664fd8c56448f985
tree de3ead8eda857231834d77e151be7ebc60ed3b5f
parent cd41c792d7df5107c05f2529426ae68f817e38f6
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 drivers/net/cxgb3/l2t.c  |2 +-
 drivers/s390/net/qeth_main.c |4 ++-
 include/linux/if_vlan.h  |7 -
 net/8021q/vlan.c |   14 +--
 net/8021q/vlan_dev.c |   56 +-
 net/8021q/vlan_netlink.c |   10 
 net/8021q/vlanproc.c |   12 +
 7 files changed, 54 insertions(+), 51 deletions(-)

diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index d660af7..17ed4c3 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -337,7 +337,7 @@ struct l2t_entry *t3_l2t_get(struct t3cdev *cdev, struct 
neighbour *neigh,
atomic_set(e-refcnt, 1);
neigh_replace(e, neigh);
if (neigh-dev-priv_flags  IFF_802_1Q_VLAN)
-   e-vlan = VLAN_DEV_INFO(neigh-dev)-vlan_id;
+   e-vlan = vlan_dev_info(neigh-dev)-vlan_id;
else
e-vlan = VLAN_NONE;
spin_unlock(e-lock);
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c
index f1866a2..62606ce 100644
--- a/drivers/s390/net/qeth_main.c
+++ b/drivers/s390/net/qeth_main.c
@@ -3890,7 +3890,7 @@ qeth_verify_vlan_dev(struct net_device *dev, struct 
qeth_card *card)
break;
}
}
-   if (rc  !(VLAN_DEV_INFO(dev)-real_dev-priv == (void *)card))
+   if (rc  !(vlan_dev_info(dev)-real_dev-priv == (void *)card))
return 0;
 
 #endif
@@ -3930,7 +3930,7 @@ qeth_get_card_from_dev(struct net_device *dev)
card = (struct qeth_card *)dev-priv;
else if (rc == QETH_VLAN_CARD)
card = (struct qeth_card *)
-   VLAN_DEV_INFO(dev)-real_dev-priv;
+   vlan_dev_info(dev)-real_dev-priv;
 
QETH_DBF_TEXT_(trace, 4, %d, rc);
return card ;
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 129fa87..82c2352 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -143,13 +143,16 @@ struct vlan_dev_info {
unsigned long cnt_encap_on_xmit;  /* How many times did we have to 
encapsulate the skb on TX. */
 };
 
-#define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x-priv))
+static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev)
+{
+   return netdev_priv(dev);
+}
 
 /* inline functions */
 static inline __u32 vlan_get_ingress_priority(struct net_device *dev,
  unsigned short vlan_tag)
 {
-   struct vlan_dev_info *vip = VLAN_DEV_INFO(dev);
+   struct vlan_dev_info *vip = vlan_dev_info(dev);
 
return vip-ingress_priority_map[(vlan_tag  13)  0x7];
 }
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index ac79638..d058c0e 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -134,7 +134,7 @@ static void vlan_rcu_free(struct rcu_head *rcu)
 
 void unregister_vlan_dev(struct net_device *dev)
 {
-   struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+   struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan-real_dev;
struct vlan_group *grp;
unsigned short vlan_id = vlan-vlan_id;
@@ -229,7 +229,7 @@ int vlan_check_real_dev(struct net_device *real_dev, 
unsigned short vlan_id)
 
 int register_vlan_dev(struct net_device *dev)
 {
-   struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev);
+   struct vlan_dev_info *vlan = vlan_dev_info(dev);
struct net_device *real_dev = vlan-real_dev;
unsigned short vlan_id = vlan-vlan_id;
struct vlan_group *grp, *ngrp = NULL;
@@ -328,10 +328,10 @@ static int register_vlan_device(struct net_device 
*real_dev,
 */
new_dev-mtu = real_dev-mtu;
 
-   VLAN_DEV_INFO(new_dev)-vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
-   VLAN_DEV_INFO(new_dev)-real_dev = real_dev;
-   VLAN_DEV_INFO(new_dev)-dent = NULL;
-   VLAN_DEV_INFO(new_dev)-flags = VLAN_FLAG_REORDER_HDR;
+   vlan_dev_info(new_dev)-vlan_id = VLAN_ID; /* 1 through VLAN_VID_MASK */
+   vlan_dev_info(new_dev)-real_dev = real_dev;
+   vlan_dev_info(new_dev)-dent = NULL;
+   vlan_dev_info(new_dev)-flags = VLAN_FLAG_REORDER_HDR;
 
new_dev-rtnl_link_ops = vlan_link_ops;
err = register_vlan_dev(new_dev);
@@ -348,7 +348,7 @@ out_free_newdev:
 static void vlan_sync_address(struct net_device *dev,
  struct net_device *vlandev)
 {
-   struct vlan_dev_info *vlan = VLAN_DEV_INFO(vlandev);
+   struct vlan_dev_info 

[VLAN 14/18]: Turn __constant_htons into htons where possible

2008-01-20 Thread Patrick McHardy
[VLAN]: Turn __constant_htons into htons where possible

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

---
commit 40048c4ab8a08ea7f0e2df52f0ec02a8010d2a0e
tree bf0486c7fd56dae810144d1695281fb39ce402e7
parent 84ea6a8ff0745f63e25d2d17664fd8c56448f985
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 include/linux/if_vlan.h |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 82c2352..34f40ef 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -271,12 +271,12 @@ static inline struct sk_buff *__vlan_put_tag(struct 
sk_buff *skb, unsigned short
memmove(skb-data, skb-data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
 
/* first, the ethernet type */
-   veth-h_vlan_proto = __constant_htons(ETH_P_8021Q);
+   veth-h_vlan_proto = htons(ETH_P_8021Q);
 
/* now, the tag */
veth-h_vlan_TCI = htons(tag);
 
-   skb-protocol = __constant_htons(ETH_P_8021Q);
+   skb-protocol = htons(ETH_P_8021Q);
skb-mac_header -= VLAN_HLEN;
skb-network_header -= VLAN_HLEN;
 
@@ -331,7 +331,7 @@ static inline int __vlan_get_tag(struct sk_buff *skb, 
unsigned short *tag)
 {
struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb-data;
 
-   if (veth-h_vlan_proto != __constant_htons(ETH_P_8021Q)) {
+   if (veth-h_vlan_proto != htons(ETH_P_8021Q)) {
return -EINVAL;
}
 
--
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


[VLAN 15/18]: checkpatch cleanups

2008-01-20 Thread Patrick McHardy
[VLAN]: checkpatch cleanups

Checkpatch cleanups, consisting mainly of overly long lines and missing
spaces.

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

---
commit bea0af04454189d656afd69168e0e3ec3209b6b2
tree 6b7d57540dbaf1e40c295d4ba0d40d021a0fec50
parent 40048c4ab8a08ea7f0e2df52f0ec02a8010d2a0e
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:31 +0100

 net/8021q/vlan.c |   20 ++
 net/8021q/vlan.h |2 +
 net/8021q/vlan_dev.c |   98 +-
 net/8021q/vlanproc.c |   42 +++--
 net/8021q/vlanproc.h |   11 +++---
 5 files changed, 89 insertions(+), 84 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index d058c0e..8b93799 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -43,7 +43,6 @@
 
 /* Our listing of VLAN group(s) */
 static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE];
-#define vlan_grp_hashfn(IDX)   IDX)  VLAN_GRP_HASH_SHIFT) ^ (IDX))  
VLAN_GRP_HASH_MASK)
 
 static char vlan_fullname[] = 802.1Q VLAN Support;
 static char vlan_version[] = DRV_VERSION;
@@ -60,6 +59,11 @@ static struct packet_type vlan_packet_type = {
 
 /* End of global variables definitions. */
 
+static inline unsigned int vlan_grp_hashfn(unsigned int idx)
+{
+   return ((idx  VLAN_GRP_HASH_SHIFT) ^ idx)  VLAN_GRP_HASH_MASK;
+}
+
 /* Must be invoked with RCU read lock (no preempt) */
 static struct vlan_group *__vlan_find_group(int real_dev_ifindex)
 {
@@ -94,7 +98,7 @@ static void vlan_group_free(struct vlan_group *grp)
 {
int i;
 
-   for (i=0; i  VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
+   for (i = 0; i  VLAN_GROUP_ARRAY_SPLIT_PARTS; i++)
kfree(grp-vlan_devices_arrays[i]);
kfree(grp);
 }
@@ -174,7 +178,8 @@ void unregister_vlan_dev(struct net_device *dev)
unregister_netdevice(dev);
 }
 
-static void vlan_transfer_operstate(const struct net_device *dev, struct 
net_device *vlandev)
+static void vlan_transfer_operstate(const struct net_device *dev,
+   struct net_device *vlandev)
 {
/* Have to respect userspace enforced dormant state
 * of real device, also must allow supplicant running
@@ -369,7 +374,8 @@ static void vlan_sync_address(struct net_device *dev,
memcpy(vlan-real_dev_addr, dev-dev_addr, ETH_ALEN);
 }
 
-static int vlan_device_event(struct notifier_block *unused, unsigned long 
event, void *ptr)
+static int vlan_device_event(struct notifier_block *unused, unsigned long 
event,
+void *ptr)
 {
struct net_device *dev = ptr;
struct vlan_group *grp = __vlan_find_group(dev-ifindex);
@@ -569,9 +575,8 @@ static int vlan_ioctl_handler(struct net *net, void __user 
*arg)
err = 0;
vlan_dev_get_realdev_name(dev, args.u.device2);
if (copy_to_user(arg, args,
-sizeof(struct vlan_ioctl_args))) {
+sizeof(struct vlan_ioctl_args)))
err = -EFAULT;
-   }
break;
 
case GET_VLAN_VID_CMD:
@@ -579,9 +584,8 @@ static int vlan_ioctl_handler(struct net *net, void __user 
*arg)
vlan_dev_get_vid(dev, vid);
args.u.VID = vid;
if (copy_to_user(arg, args,
-sizeof(struct vlan_ioctl_args))) {
+sizeof(struct vlan_ioctl_args)))
  err = -EFAULT;
-   }
break;
 
default:
diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h
index 0cfdf77..73efcc7 100644
--- a/net/8021q/vlan.h
+++ b/net/8021q/vlan.h
@@ -20,7 +20,7 @@ extern unsigned short vlan_name_type;
  *  Must be invoked with rcu_read_lock (ie preempt disabled)
  *  or with RTNL.
  */
-struct net_device *__find_vlan_dev(struct net_device* real_dev,
+struct net_device *__find_vlan_dev(struct net_device *real_dev,
   unsigned short VID); /* vlan.c */
 
 /* found in vlan_dev.c */
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index a846559..2ff7659 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -106,13 +106,13 @@ static inline struct sk_buff 
*vlan_check_reorder_header(struct sk_buff *skb)
  *  SANITY NOTE 2: We are referencing to the VLAN_HDR frields, which MAY be
  * stored UNALIGNED in the memory.  RISC systems don't like
  * such cases very much...
- *  SANITY NOTE 2a:  According to Dave Miller  Alexey, it will always be 
aligned,
- * so there doesn't need to be any of the unaligned stuff.  It 
has
- * been commented out now...  --Ben
+ *  SANITY NOTE 2a: According to Dave Miller  Alexey, it will always be
+ * aligned, so there doesn't need to be any of the unaligned
+ * 

[NET]: rtnl_link: fix use-after-free

2008-01-20 Thread Patrick McHardy
 commit 6e470bd53fb50632fe1878bb74bb8531a21b6731
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Sun Jan 20 18:19:15 2008 +0100

[NET]: rtnl_link: fix use-after-free

When unregistering the rtnl_link_ops, all existing devices using
the ops are destroyed. With nested devices this may lead to a
use-after-free despite the use of for_each_netdev_safe() in case
the upper device is next in the device list and is destroyed
by the NETDEV_UNREGISTER notifier.

The easy fix is to restart scanning the device list after removing
a device. Alternatively we could add new devices to the front of
the list to avoid having dependant devices follow the device they
depend on. A third option would be to only restart scanning if
dev-iflink of the next device matches dev-ifindex of the current
one. For now this seems like the safest solution.

With this patch, the veth rtnl_link_ops unregistration can use
rtnl_link_unregister() directly since it now also handles destruction
of multiple devices at once.

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

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 43af9e9..3f67a29 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -459,19 +459,7 @@ static __init int veth_init(void)
 
 static __exit void veth_exit(void)
 {
-   struct veth_priv *priv, *next;
-
-   rtnl_lock();
-   /*
-* cannot trust __rtnl_link_unregister() to unregister all
-* devices, as each -dellink call will remove two devices
-* from the list at once.
-*/
-   list_for_each_entry_safe(priv, next, veth_list, list)
-   veth_dellink(priv-dev);
-
-   __rtnl_link_unregister(veth_link_ops);
-   rtnl_unlock();
+   rtnl_link_unregister(veth_link_ops);
 }
 
 module_init(veth_init);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index e1ba26f..fed95a3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -308,9 +308,12 @@ void __rtnl_link_unregister(struct rtnl_link_ops *ops)
struct net *net;
 
for_each_net(net) {
+restart:
for_each_netdev_safe(net, dev, n) {
-   if (dev-rtnl_link_ops == ops)
+   if (dev-rtnl_link_ops == ops) {
ops-dellink(dev);
+   goto restart;
+   }
}
}
list_del(ops-list);


[VLAN 16/18]: Update list address

2008-01-20 Thread Patrick McHardy
[VLAN]: Update list address

VLAN related mail should go to netdev.

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

---
commit e7e221b07c3a3f77df617232ea0f76094edc1071
tree 347c69877e8e1b5fc5e730b099683739ba83a6d0
parent bea0af04454189d656afd69168e0e3ec3209b6b2
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100

 net/8021q/vlan.c |2 +-
 net/8021q/vlan_dev.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8b93799..dbc81b9 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -3,7 +3,7 @@
  * Ethernet-type device handling.
  *
  * Authors:Ben Greear [EMAIL PROTECTED]
- *  Please send support related email to: [EMAIL PROTECTED]
+ *  Please send support related email to: netdev@vger.kernel.org
  *  VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
  *
  * Fixes:
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2ff7659..e19e491 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -3,7 +3,7 @@
  * Ethernet-type device handling.
  *
  * Authors:Ben Greear [EMAIL PROTECTED]
- *  Please send support related email to: [EMAIL PROTECTED]
+ *  Please send support related email to: netdev@vger.kernel.org
  *  VLAN Home Page: http://www.candelatech.com/~greear/vlan.html
  *
  * Fixes:   Mar 22 2001: Martin Bokaemper [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


[VLAN 17/18]: Clean up vlan_skb_recv()

2008-01-20 Thread Patrick McHardy
[VLAN]: Clean up vlan_skb_recv()

- remove three instances of identical code
- remove unnecessary NULL initialization
- remove obvious and unnecessary comments

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

---
commit c314238cb2135e4bb812487ed47652a5e2e4b748
tree 42969440a4ea33d5addcbbce4758ed5f377b4a7e
parent e7e221b07c3a3f77df617232ea0f76094edc1071
author Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100

 net/8021q/vlan_dev.c |  113 +++---
 1 files changed, 24 insertions(+), 89 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index e19e491..57799af 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -114,77 +114,49 @@ static inline struct sk_buff 
*vlan_check_reorder_header(struct sk_buff *skb)
 int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
  struct packet_type *ptype, struct net_device *orig_dev)
 {
-   unsigned char *rawp = NULL;
+   unsigned char *rawp;
struct vlan_hdr *vhdr;
unsigned short vid;
struct net_device_stats *stats;
unsigned short vlan_TCI;
__be16 proto;
 
-   if (dev-nd_net != init_net) {
-   kfree_skb(skb);
-   return -1;
-   }
+   if (dev-nd_net != init_net)
+   goto err_free;
 
skb = skb_share_check(skb, GFP_ATOMIC);
if (skb == NULL)
-   return -1;
-
-   if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) {
-   kfree_skb(skb);
-   return -1;
-   }
+   goto err_free;
 
-   vhdr = (struct vlan_hdr *)(skb-data);
+   if (unlikely(!pskb_may_pull(skb, VLAN_HLEN)))
+   goto err_free;
 
-   /* vlan_TCI = ntohs(get_unaligned(vhdr-h_vlan_TCI)); */
+   vhdr = (struct vlan_hdr *)skb-data;
vlan_TCI = ntohs(vhdr-h_vlan_TCI);
-
vid = (vlan_TCI  VLAN_VID_MASK);
 
-   /* Ok, we will find the correct VLAN device, strip the header,
-* and then go on as usual.
-*/
-
-   /* We have 12 bits of vlan ID.
-*
-* We must not drop allow preempt until we hold a
-* reference to the device (netif_rx does that) or we
-* fail.
-*/
-
rcu_read_lock();
skb-dev = __find_vlan_dev(dev, vid);
if (!skb-dev) {
-   rcu_read_unlock();
pr_debug(%s: ERROR: No net_device for VID: %u on dev: %s\n,
 __FUNCTION__, (unsigned int)vid, dev-name);
-   kfree_skb(skb);
-   return -1;
+   goto err_unlock;
}
 
skb-dev-last_rx = jiffies;
 
-   /* Bump the rx counters for the VLAN device. */
stats = skb-dev-stats;
stats-rx_packets++;
stats-rx_bytes += skb-len;
 
-   /* Take off the VLAN header (4 bytes currently) */
skb_pull_rcsum(skb, VLAN_HLEN);
 
-   /*
-* Deal with ingress priority mapping.
-*/
skb-priority = vlan_get_ingress_priority(skb-dev,
  ntohs(vhdr-h_vlan_TCI));
 
pr_debug(%s: priority: %u for TCI: %hu\n,
 __FUNCTION__, skb-priority, ntohs(vhdr-h_vlan_TCI));
 
-   /* The ethernet driver already did the pkt_type calculations
-* for us...
-*/
switch (skb-pkt_type) {
case PACKET_BROADCAST: /* Yeah, stats collect these together.. */
/* stats-broadcast ++; // no such counter :-( */
@@ -201,7 +173,6 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
 */
if (!compare_ether_addr(eth_hdr(skb)-h_dest,
skb-dev-dev_addr))
-   /* It is for our (changed) MAC-address! */
skb-pkt_type = PACKET_HOST;
break;
default:
@@ -211,81 +182,45 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
/*  Was a VLAN packet, grab the encapsulated protocol, which the layer
 * three protocols care about.
 */
-   /* proto = get_unaligned(vhdr-h_vlan_encapsulated_proto); */
proto = vhdr-h_vlan_encapsulated_proto;
-
-   skb-protocol = proto;
if (ntohs(proto) = 1536) {
-   /* place it back on the queue to be handled by
-* true layer 3 protocols.
-*/
-
-   /* See if we are configured to re-write the VLAN header
-* to make it look like ethernet...
-*/
-   skb = vlan_check_reorder_header(skb);
-
-   /* Can be null if skb-clone fails when re-ordering */
-   if (skb) {
-   netif_rx(skb);
-   } else {
-   /* TODO:  Add a more specific counter here. */
-   stats-rx_errors++;
-  

[VLAN 18/18]: Move protocol determination to seperate function

2008-01-20 Thread Patrick McHardy
[VLAN]: Move protocol determination to seperate function

I think, that we can make this code flow easier to understand
by introducing the vlan_set_encap_proto() function (I hope the
name is good) to setup the skb proto and merge the paths calling
netif_rx() together.

[Patrick: Modified to apply on top of my previous patches]

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

---
commit 0e185e8a940c2780362ff815cfe638e7d1269972
tree 62b8568718057b7a12375c34af01d95bae463240
parent c314238cb2135e4bb812487ed47652a5e2e4b748
author Pavel Emelyanov [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100
committer Patrick McHardy [EMAIL PROTECTED] Sun, 20 Jan 2008 17:37:32 +0100

 net/8021q/vlan_dev.c |   63 --
 1 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 57799af..8059fa4 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -89,6 +89,40 @@ static inline struct sk_buff 
*vlan_check_reorder_header(struct sk_buff *skb)
return skb;
 }
 
+static inline void vlan_set_encap_proto(struct sk_buff *skb,
+   struct vlan_hdr *vhdr)
+{
+   __be16 proto;
+   unsigned char *rawp;
+
+   /*
+* Was a VLAN packet, grab the encapsulated protocol, which the layer
+* three protocols care about.
+*/
+
+   proto = vhdr-h_vlan_encapsulated_proto;
+   if (ntohs(proto) = 1536) {
+   skb-protocol = proto;
+   return;
+   }
+
+   rawp = skb-data;
+   if (*(unsigned short *)rawp == 0x)
+   /*
+* This is a magic hack to spot IPX packets. Older Novell
+* breaks the protocol design and runs IPX over 802.3 without
+* an 802.2 LLC layer. We look for  which isn't a used
+* 802.2 SSAP/DSAP. This won't work for fault tolerant netware
+* but does for the rest.
+*/
+   skb-protocol = htons(ETH_P_802_3);
+   else
+   /*
+* Real 802.2 LLC
+*/
+   skb-protocol = htons(ETH_P_802_2);
+}
+
 /*
  * Determine the packet's protocol ID. The rule here is that we
  * assume 802.3 if the type field is short enough to be a length.
@@ -114,12 +148,10 @@ static inline struct sk_buff 
*vlan_check_reorder_header(struct sk_buff *skb)
 int vlan_skb_recv(struct sk_buff *skb, struct net_device *dev,
  struct packet_type *ptype, struct net_device *orig_dev)
 {
-   unsigned char *rawp;
struct vlan_hdr *vhdr;
unsigned short vid;
struct net_device_stats *stats;
unsigned short vlan_TCI;
-   __be16 proto;
 
if (dev-nd_net != init_net)
goto err_free;
@@ -179,33 +211,8 @@ int vlan_skb_recv(struct sk_buff *skb, struct net_device 
*dev,
break;
}
 
-   /*  Was a VLAN packet, grab the encapsulated protocol, which the layer
-* three protocols care about.
-*/
-   proto = vhdr-h_vlan_encapsulated_proto;
-   if (ntohs(proto) = 1536) {
-   skb-protocol = proto;
-   goto recv;
-   }
-
-   /*
-* This is a magic hack to spot IPX packets. Older Novell breaks
-* the protocol design and runs IPX over 802.3 without an 802.2 LLC
-* layer. We look for  which isn't a used 802.2 SSAP/DSAP. This
-* won't work for fault tolerant netware but does for the rest.
-*/
-   rawp = skb-data;
-   if (*(unsigned short *)rawp == 0x) {
-   skb-protocol = htons(ETH_P_802_3);
-   goto recv;
-   }
-
-   /*
-*  Real 802.2 LLC
-*/
-   skb-protocol = htons(ETH_P_802_2);
+   vlan_set_encap_proto(skb, vhdr);
 
-recv:
skb = vlan_check_reorder_header(skb);
if (!skb) {
stats-rx_errors++;
--
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] ipv6: addrconf sparse warnings

2008-01-20 Thread Stephen Hemminger
Get rid of a couple of sparse warnings in IPV6 addrconf code.

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

--- a/net/ipv6/addrconf.c   2008-01-20 09:38:06.0 -0800
+++ b/net/ipv6/addrconf.c   2008-01-20 09:57:40.0 -0800
@@ -1900,7 +1900,7 @@ int addrconf_set_dstaddr(void __user *ar
p.iph.ihl = 5;
p.iph.protocol = IPPROTO_IPV6;
p.iph.ttl = 64;
-   ifr.ifr_ifru.ifru_data = (void __user *)p;
+   ifr.ifr_ifru.ifru_data = (__force void __user *)p;
 
oldfs = get_fs(); set_fs(KERNEL_DS);
err = dev-do_ioctl(dev, ifr, SIOCADDTUNNEL);
@@ -2799,6 +2799,7 @@ static struct inet6_ifaddr *if6_get_idx(
 }
 
 static void *if6_seq_start(struct seq_file *seq, loff_t *pos)
+   __acquires(addrconf_hash_lock)
 {
read_lock_bh(addrconf_hash_lock);
return if6_get_idx(seq, *pos);
@@ -2814,6 +2815,7 @@ static void *if6_seq_next(struct seq_fil
 }
 
 static void if6_seq_stop(struct seq_file *seq, void *v)
+   __releases(addrconf_hash_lock)
 {
read_unlock_bh(addrconf_hash_lock);
 }
--
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


[RFC NET_SCHED 00/05]: Pseudo-classful qdisc consolidation

2008-01-20 Thread Patrick McHardy
These patches contain some preparatory cleanups and consolidate the
Qdisc_class_ops for pseudo-classful qdiscs. The main reason for
RFC is that the naming is not particular appealing (both qdisc_q_...
and sch_pseudo_classful), suggestions for better names are welcome.


 include/net/pkt_sched.h |4 +
 include/net/sch_generic.h   |   78 +---
 net/core/dev.c  |4 +-
 net/sched/Kconfig   |6 ++
 net/sched/Makefile  |1 +
 net/sched/sch_atm.c |   17 +++--
 net/sched/sch_blackhole.c   |2 +-
 net/sched/sch_cbq.c |   18 +++--
 net/sched/sch_dsmark.c  |   11 +--
 net/sched/sch_fifo.c|   62 +---
 net/sched/sch_generic.c |   12 ++--
 net/sched/sch_gred.c|   18 ++--
 net/sched/sch_hfsc.c|   12 ++--
 net/sched/sch_htb.c |   11 ++-
 net/sched/sch_netem.c   |  157 +++
 net/sched/sch_prio.c|   13 ++-
 net/sched/sch_pseudo_classful.c |  101 +
 net/sched/sch_red.c |  152 ++
 net/sched/sch_sfq.c |2 +-
 net/sched/sch_tbf.c |  150 +
 20 files changed, 347 insertions(+), 484 deletions(-)
 create mode 100644 net/sched/sch_pseudo_classful.c

Patrick McHardy (5):
  [NET_SCHED]: Consolidate default fifo setup
  [NET_SCHED]: Rename qdisc helpers for built-in queue
  [NET_SCHED]: Introduce child qdisc helpers
  [NET_SCHED]: Use qdisc helpers
  [NET_SCHED]: Consolidate class ops for pseudo classful qdisc
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC NET_SCHED 05/05]: Consolidate class ops for pseudo classful qdisc

2008-01-20 Thread Patrick McHardy

Patrick McHardy wrote:

commit e97ba18f7a8f9342fa06d0f5606a186b18e1d7f8
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:06 2008 +0100

[NET_SCHED]: Consolidate class ops for pseudo classful qdisc

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





 config NET_SCH_TEQL
tristate True Link Equalizer (TEQL)
+   select NET_SCH_PC



Oops .. this should have been at the NET_SCH_RED entry.

commit d89898d2e77b5c1753d21174870277d235994afa
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Sun Jan 20 19:31:05 2008 +0100

[NET_SCHED]: Consolidate class ops for pseudo classful qdisc

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

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index decc339..ca6e4de 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -351,4 +351,10 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff *skb, gfp_t gfp_mask)
 }
 #endif
 
+struct pc_sched_data {
+	struct Qdisc	*qdisc;
+};
+
+extern const struct Qdisc_class_ops pseudo_classful_ops;
+
 #endif
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index f5ab54b..b6b4260 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -43,6 +43,9 @@ if NET_SCHED
 
 comment Queueing/Scheduling
 
+config NET_SCH_PC
+	tristate
+
 config NET_SCH_CBQ
 	tristate Class Based Queueing (CBQ)
 	---help---
@@ -119,6 +122,7 @@ config NET_SCH_RR
 
 config NET_SCH_RED
 	tristate Random Early Detection (RED)
+	select NET_SCH_PC
 	---help---
 	  Say Y here if you want to use the Random Early Detection (RED)
 	  packet scheduling algorithm.
@@ -153,6 +157,7 @@ config NET_SCH_TEQL
 
 config NET_SCH_TBF
 	tristate Token Bucket Filter (TBF)
+	select NET_SCH_PC
 	---help---
 	  Say Y here if you want to use the Token Bucket Filter (TBF) packet
 	  scheduling algorithm.
@@ -186,6 +191,7 @@ config NET_SCH_DSMARK
 
 config NET_SCH_NETEM
 	tristate Network emulator (NETEM)
+	select NET_SCH_PC
 	---help---
 	  Say Y if you want to emulate network delay, loss, and packet
 	  re-ordering. This is often useful to simulate networks when
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 81ecbe8..593bb3a 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_ACT_IPT)	+= act_ipt.o
 obj-$(CONFIG_NET_ACT_NAT)	+= act_nat.o
 obj-$(CONFIG_NET_ACT_PEDIT)	+= act_pedit.o
 obj-$(CONFIG_NET_ACT_SIMP)	+= act_simple.o
+obj-$(CONFIG_NET_SCH_PC)	+= sch_pseudo_classful.o
 obj-$(CONFIG_NET_SCH_FIFO)	+= sch_fifo.o
 obj-$(CONFIG_NET_SCH_CBQ)	+= sch_cbq.o
 obj-$(CONFIG_NET_SCH_HTB)	+= sch_htb.o
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index f6c24fd..2444a97 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -52,7 +52,8 @@
 */
 
 struct netem_sched_data {
-	struct Qdisc	*qdisc;
+	struct pc_sched_data class;
+
 	struct qdisc_watchdog watchdog;
 
 	psched_tdiff_t latency;
@@ -218,7 +219,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 		now = psched_get_time();
 		cb-time_to_send = now + delay;
 		++q-counter;
-		ret = qdisc_enqueue(skb, q-qdisc);
+		ret = qdisc_enqueue(skb, q-class.qdisc);
 	} else {
 		/*
 		 * Do re-ordering by putting one out of N packets at the front
@@ -226,7 +227,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 		 */
 		cb-time_to_send = psched_get_time();
 		q-counter = 0;
-		ret = qdisc_requeue(skb, q-qdisc);
+		ret = qdisc_requeue(skb, q-class.qdisc);
 	}
 
 	if (likely(ret == NET_XMIT_SUCCESS)) {
@@ -246,7 +247,7 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc *sch)
 	struct netem_sched_data *q = qdisc_priv(sch);
 	int ret;
 
-	ret = qdisc_requeue(skb, q-qdisc);
+	ret = qdisc_requeue(skb, q-class.qdisc);
 	if (ret == NET_XMIT_SUCCESS) {
 		sch-q.qlen++;
 		sch-qstats.requeues++;
@@ -260,7 +261,7 @@ static unsigned int netem_drop(struct Qdisc* sch)
 	struct netem_sched_data *q = qdisc_priv(sch);
 	unsigned int len = 0;
 
-	len = qdisc_drop(q-qdisc);
+	len = qdisc_drop(q-class.qdisc);
 	if (len  0) {
 		sch-q.qlen--;
 		sch-qstats.drops++;
@@ -277,7 +278,7 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
 	if (sch-flags  TCQ_F_THROTTLED)
 		return NULL;
 
-	skb = qdisc_dequeue(q-qdisc);
+	skb = qdisc_dequeue(q-class.qdisc);
 	if (skb) {
 		const struct netem_skb_cb *cb
 			= (const struct netem_skb_cb *)skb-cb;
@@ -290,11 +291,11 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
 			return skb;
 		}
 
-		if (unlikely(qdisc_requeue(skb, q-qdisc) != NET_XMIT_SUCCESS)) {
-			qdisc_tree_decrease_qlen(q-qdisc, 1);
+		if (unlikely(qdisc_requeue(skb, q-class.qdisc) != NET_XMIT_SUCCESS)) {
+			qdisc_tree_decrease_qlen(q-class.qdisc, 1);
 			sch-qstats.drops++;
 			printk(KERN_ERR netem: %s could not requeue\n,
-			   q-qdisc-ops-id);
+			   q-class.qdisc-ops-id);
 		}
 
 		qdisc_watchdog_schedule(q-watchdog, cb-time_to_send);
@@ -307,7 +308,7 @@ static void netem_reset(struct Qdisc *sch)
 {
 	struct netem_sched_data 

[RFC NET_SCHED 05/05]: Consolidate class ops for pseudo classful qdisc

2008-01-20 Thread Patrick McHardy
commit e97ba18f7a8f9342fa06d0f5606a186b18e1d7f8
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:06 2008 +0100

[NET_SCHED]: Consolidate class ops for pseudo classful qdisc

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

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index decc339..ca6e4de 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -351,4 +351,10 @@ static inline struct sk_buff *skb_act_clone(struct sk_buff 
*skb, gfp_t gfp_mask)
 }
 #endif
 
+struct pc_sched_data {
+   struct Qdisc*qdisc;
+};
+
+extern const struct Qdisc_class_ops pseudo_classful_ops;
+
 #endif
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index f5ab54b..63882c5 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -43,6 +43,9 @@ if NET_SCHED
 
 comment Queueing/Scheduling
 
+config NET_SCH_PC
+   tristate
+
 config NET_SCH_CBQ
tristate Class Based Queueing (CBQ)
---help---
@@ -141,6 +144,7 @@ config NET_SCH_SFQ
 
 config NET_SCH_TEQL
tristate True Link Equalizer (TEQL)
+   select NET_SCH_PC
---help---
  Say Y here if you want to use the True Link Equalizer (TLE) packet
  scheduling algorithm. This queueing discipline allows the combination
@@ -153,6 +157,7 @@ config NET_SCH_TEQL
 
 config NET_SCH_TBF
tristate Token Bucket Filter (TBF)
+   select NET_SCH_PC
---help---
  Say Y here if you want to use the Token Bucket Filter (TBF) packet
  scheduling algorithm.
@@ -186,6 +191,7 @@ config NET_SCH_DSMARK
 
 config NET_SCH_NETEM
tristate Network emulator (NETEM)
+   select NET_SCH_PC
---help---
  Say Y if you want to emulate network delay, loss, and packet
  re-ordering. This is often useful to simulate networks when
diff --git a/net/sched/Makefile b/net/sched/Makefile
index 81ecbe8..593bb3a 100644
--- a/net/sched/Makefile
+++ b/net/sched/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_NET_ACT_IPT) += act_ipt.o
 obj-$(CONFIG_NET_ACT_NAT)  += act_nat.o
 obj-$(CONFIG_NET_ACT_PEDIT)+= act_pedit.o
 obj-$(CONFIG_NET_ACT_SIMP) += act_simple.o
+obj-$(CONFIG_NET_SCH_PC)   += sch_pseudo_classful.o
 obj-$(CONFIG_NET_SCH_FIFO) += sch_fifo.o
 obj-$(CONFIG_NET_SCH_CBQ)  += sch_cbq.o
 obj-$(CONFIG_NET_SCH_HTB)  += sch_htb.o
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index f6c24fd..2444a97 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -52,7 +52,8 @@
 */
 
 struct netem_sched_data {
-   struct Qdisc*qdisc;
+   struct pc_sched_data class;
+
struct qdisc_watchdog watchdog;
 
psched_tdiff_t latency;
@@ -218,7 +219,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
now = psched_get_time();
cb-time_to_send = now + delay;
++q-counter;
-   ret = qdisc_enqueue(skb, q-qdisc);
+   ret = qdisc_enqueue(skb, q-class.qdisc);
} else {
/*
 * Do re-ordering by putting one out of N packets at the front
@@ -226,7 +227,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
 */
cb-time_to_send = psched_get_time();
q-counter = 0;
-   ret = qdisc_requeue(skb, q-qdisc);
+   ret = qdisc_requeue(skb, q-class.qdisc);
}
 
if (likely(ret == NET_XMIT_SUCCESS)) {
@@ -246,7 +247,7 @@ static int netem_requeue(struct sk_buff *skb, struct Qdisc 
*sch)
struct netem_sched_data *q = qdisc_priv(sch);
int ret;
 
-   ret = qdisc_requeue(skb, q-qdisc);
+   ret = qdisc_requeue(skb, q-class.qdisc);
if (ret == NET_XMIT_SUCCESS) {
sch-q.qlen++;
sch-qstats.requeues++;
@@ -260,7 +261,7 @@ static unsigned int netem_drop(struct Qdisc* sch)
struct netem_sched_data *q = qdisc_priv(sch);
unsigned int len = 0;
 
-   len = qdisc_drop(q-qdisc);
+   len = qdisc_drop(q-class.qdisc);
if (len  0) {
sch-q.qlen--;
sch-qstats.drops++;
@@ -277,7 +278,7 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
if (sch-flags  TCQ_F_THROTTLED)
return NULL;
 
-   skb = qdisc_dequeue(q-qdisc);
+   skb = qdisc_dequeue(q-class.qdisc);
if (skb) {
const struct netem_skb_cb *cb
= (const struct netem_skb_cb *)skb-cb;
@@ -290,11 +291,11 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)
return skb;
}
 
-   if (unlikely(qdisc_requeue(skb, q-qdisc) != NET_XMIT_SUCCESS)) 
{
-   qdisc_tree_decrease_qlen(q-qdisc, 1);
+   if (unlikely(qdisc_requeue(skb, q-class.qdisc) != 
NET_XMIT_SUCCESS)) {
+   qdisc_tree_decrease_qlen(q-class.qdisc, 1);

[RFC NET_SCHED 04/05]: Use qdisc helpers

2008-01-20 Thread Patrick McHardy
commit 8b0737e99efbf5b51f950d9fa95d69f96bf0a926
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:22:00 2008 +0100

[NET_SCHED]: Use qdisc helpers

Use the new qdisc helpers where possible. Also pull return value
assignments out of conditions and use proper NET_XMIT codes where
possible.

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

diff --git a/net/core/dev.c b/net/core/dev.c
index 385b799..663031c 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1673,7 +1673,7 @@ gso:
if (q-enqueue) {
/* reset queue_mapping to zero */
skb_set_queue_mapping(skb, 0);
-   rc = q-enqueue(skb, q);
+   rc = qdisc_enqueue(skb, q);
qdisc_run(dev);
spin_unlock(dev-queue_lock);
 
@@ -1970,7 +1970,7 @@ static int ing_filter(struct sk_buff *skb)
 
spin_lock(dev-ingress_lock);
if ((q = dev-qdisc_ingress) != NULL)
-   result = q-enqueue(skb, q);
+   result = qdisc_enqueue(skb, q);
spin_unlock(dev-ingress_lock);
 
return result;
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index d870a41..844774d 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -430,7 +430,8 @@ static int atm_tc_enqueue(struct sk_buff *skb, struct Qdisc 
*sch)
 #endif
}
 
-   if ((ret = flow-q-enqueue(skb, flow-q)) != 0) {
+   ret = qdisc_enqueue(skb, flow-q);
+   if (ret != NET_XMIT_SUCCESS) {
 drop: __maybe_unused
sch-qstats.drops++;
if (flow)
@@ -478,9 +479,9 @@ static void sch_atm_dequeue(unsigned long data)
 * If traffic is properly shaped, this won't generate nasty
 * little bursts. Otherwise, it may ... (but that's okay)
 */
-   while ((skb = flow-q-dequeue(flow-q))) {
+   while ((skb = qdisc_dequeue(flow-q))) {
if (!atm_may_send(flow-vcc, skb-truesize)) {
-   (void)flow-q-ops-requeue(skb, flow-q);
+   qdisc_requeue(skb, flow-q);
break;
}
D2PRINTK(atm_tc_dequeue: sending on class %p\n, flow);
@@ -514,7 +515,7 @@ static struct sk_buff *atm_tc_dequeue(struct Qdisc *sch)
 
D2PRINTK(atm_tc_dequeue(sch %p,[qdisc %p])\n, sch, p);
tasklet_schedule(p-task);
-   skb = p-link.q-dequeue(p-link.q);
+   skb = qdisc_dequeue(p-link.q);
if (skb)
sch-q.qlen--;
return skb;
@@ -526,7 +527,7 @@ static int atm_tc_requeue(struct sk_buff *skb, struct Qdisc 
*sch)
int ret;
 
D2PRINTK(atm_tc_requeue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
-   ret = p-link.q-ops-requeue(skb, p-link.q);
+   ret = qdisc_requeue(skb, p-link.q);
if (!ret) {
sch-q.qlen++;
sch-qstats.requeues++;
@@ -544,9 +545,11 @@ static unsigned int atm_tc_drop(struct Qdisc *sch)
unsigned int len;
 
DPRINTK(atm_tc_drop(sch %p,[qdisc %p])\n, sch, p);
-   for (flow = p-flows; flow; flow = flow-next)
-   if (flow-q-ops-drop  (len = flow-q-ops-drop(flow-q)))
+   for (flow = p-flows; flow; flow = flow-next) {
+   len = qdisc_drop(flow-q);
+   if (len  0)
return len;
+   }
return 0;
 }
 
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index bea123f..8731f51 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -396,7 +396,8 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 #ifdef CONFIG_NET_CLS_ACT
cl-q-__parent = sch;
 #endif
-   if ((ret = cl-q-enqueue(skb, cl-q)) == NET_XMIT_SUCCESS) {
+   ret = qdisc_enqueue(skb, cl-q);
+   if (ret == NET_XMIT_SUCCESS) {
sch-q.qlen++;
sch-bstats.packets++;
sch-bstats.bytes+=len;
@@ -432,7 +433,8 @@ cbq_requeue(struct sk_buff *skb, struct Qdisc *sch)
q-rx_class = cl;
cl-q-__parent = sch;
 #endif
-   if ((ret = cl-q-ops-requeue(skb, cl-q)) == 0) {
+   ret = qdisc_requeue(skb, cl-q);
+   if (ret == NET_XMIT_SUCCESS) {
sch-q.qlen++;
sch-qstats.requeues++;
if (!cl-next_alive)
@@ -580,9 +582,8 @@ static void cbq_ovl_lowprio(struct cbq_class *cl)
 
 static void cbq_ovl_drop(struct cbq_class *cl)
 {
-   if (cl-q-ops-drop)
-   if (cl-q-ops-drop(cl-q))
-   cl-qdisc-q.qlen--;
+   if (qdisc_drop(cl-q))
+   cl-qdisc-q.qlen--;
cl-xstats.overactions++;
cbq_ovl_classic(cl);
 }
@@ -680,7 +681,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct 
Qdisc *child)
q-rx_class = cl;
cl-q-__parent = sch;
 
-   if (cl-q-enqueue(skb, cl-q) == 0) {
+   if 

[RFC NET_SCHED 03/05]: Introduce child qdisc helpers

2008-01-20 Thread Patrick McHardy
commit a6d1954517202bffb14f5122756891d8c5b8e2e2
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 16 12:08:18 2008 +0100

[NET_SCHED]: Introduce child qdisc helpers

Introduce a few helpers to dispatch calls to child qdiscs without
repeating the qdisc argument every time.

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

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3ade673..decc339 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -180,6 +180,26 @@ extern struct Qdisc *qdisc_create_dflt(struct net_device 
*dev,
 extern void tcf_destroy(struct tcf_proto *tp);
 extern void tcf_destroy_chain(struct tcf_proto *fl);
 
+static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
+{
+   return sch-enqueue(skb, sch);
+}
+
+static inline struct sk_buff *qdisc_dequeue(struct Qdisc *sch)
+{
+   return sch-dequeue(sch);
+}
+
+static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch)
+{
+   return sch-ops-requeue(skb, sch);
+}
+
+static inline unsigned int qdisc_drop(struct Qdisc *sch)
+{
+   return sch-ops-drop ? sch-ops-drop(sch) : 0;
+}
+
 static inline int __qdisc_q_enqueue_tail(struct sk_buff *skb, struct Qdisc 
*sch,
 struct sk_buff_head *list)
 {
@@ -278,7 +298,7 @@ static inline unsigned int qdisc_q_drop(struct Qdisc *sch)
return __qdisc_q_drop(sch, sch-q);
 }
 
-static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch)
+static inline int qdisc_drop_skb(struct sk_buff *skb, struct Qdisc *sch)
 {
kfree_skb(skb);
sch-qstats.drops++;
diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c
index 507fb48..ac374eb 100644
--- a/net/sched/sch_blackhole.c
+++ b/net/sched/sch_blackhole.c
@@ -19,7 +19,7 @@
 
 static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
-   qdisc_drop(skb, sch);
+   qdisc_drop_skb(skb, sch);
return NET_XMIT_SUCCESS;
 }
 
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 6afd59e..8e186e1 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -347,7 +347,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct 
Qdisc* qdisc)
return __qdisc_q_enqueue_tail(skb, qdisc, list);
}
 
-   return qdisc_drop(skb, qdisc);
+   return qdisc_drop_skb(skb, qdisc);
 }
 
 static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index d933565..ca65e7c 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -233,10 +233,10 @@ static int gred_enqueue(struct sk_buff *skb, struct 
Qdisc* sch)
 
q-stats.pdrop++;
 drop:
-   return qdisc_drop(skb, sch);
+   return qdisc_drop_skb(skb, sch);
 
 congestion_drop:
-   qdisc_drop(skb, sch);
+   qdisc_drop_skb(skb, sch);
return NET_XMIT_CN;
 }
 
@@ -316,7 +316,7 @@ static unsigned int gred_drop(struct Qdisc* sch)
red_start_of_idle_period(q-parms);
}
 
-   qdisc_drop(skb, sch);
+   qdisc_drop_skb(skb, sch);
return len;
}
 
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 699f83d..acf06d9 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -104,7 +104,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* 
sch)
return ret;
 
 congestion_drop:
-   qdisc_drop(skb, sch);
+   qdisc_drop_skb(skb, sch);
return NET_XMIT_CN;
 }
 
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index c58fa6e..0b46589 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -257,7 +257,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 * i.e. drop _this_ packet.
 */
if (q-qs[x].qlen = q-limit)
-   return qdisc_drop(skb, sch);
+   return qdisc_drop_skb(skb, sch);
 
sch-qstats.backlog += skb-len;
__skb_queue_tail(q-qs[x], skb);
--
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


[RFC NET_SCHED 01/05]: Consolidate default fifo setup

2008-01-20 Thread Patrick McHardy
commit e56c933715900be7c6ad30bd07d342d31c457112
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 2 21:35:19 2008 +0100

[NET_SCHED]: Consolidate default fifo setup

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

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index ab61809..9d06d2d 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -72,6 +72,10 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
 extern struct Qdisc_ops pfifo_qdisc_ops;
 extern struct Qdisc_ops bfifo_qdisc_ops;
 
+extern int fifo_set_limit(struct Qdisc *q, unsigned int limit);
+extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
+ unsigned int limit);
+
 extern int register_qdisc(struct Qdisc_ops *qops);
 extern int unregister_qdisc(struct Qdisc_ops *qops);
 extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index d71dbfc..f9bf58b 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -108,3 +108,45 @@ struct Qdisc_ops bfifo_qdisc_ops __read_mostly = {
 
 EXPORT_SYMBOL(bfifo_qdisc_ops);
 EXPORT_SYMBOL(pfifo_qdisc_ops);
+
+/* Pass size change message down to embedded FIFO */
+int fifo_set_limit(struct Qdisc *q, unsigned int limit)
+{
+   struct rtattr *rta;
+   int ret = -ENOMEM;
+
+   /* Hack to avoid sending change message to non-FIFO */
+   if (strncmp(q-ops-id + 1, fifo, 4) != 0)
+   return 0;
+
+   rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
+   if (rta) {
+   rta-rta_type = RTM_NEWQDISC;
+   rta-rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
+   ((struct tc_fifo_qopt *)RTA_DATA(rta))-limit = limit;
+
+   ret = q-ops-change(q, rta);
+   kfree(rta);
+   }
+   return ret;
+}
+EXPORT_SYMBOL(fifo_set_limit);
+
+struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
+  unsigned int limit)
+{
+   struct Qdisc *q;
+   int err = -ENOMEM;
+
+   q = qdisc_create_dflt(sch-dev, ops, TC_H_MAKE(sch-handle, 1));
+   if (q) {
+   err = fifo_set_limit(q, limit);
+   if (err  0) {
+   qdisc_destroy(q);
+   q = NULL;
+   }
+   }
+
+   return q ? : ERR_PTR(err);
+}
+EXPORT_SYMBOL(fifo_create_dflt);
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index 6c344ad..5342a2f 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -310,28 +310,6 @@ static void netem_reset(struct Qdisc *sch)
qdisc_watchdog_cancel(q-watchdog);
 }
 
-/* Pass size change message down to embedded FIFO */
-static int set_fifo_limit(struct Qdisc *q, int limit)
-{
-   struct rtattr *rta;
-   int ret = -ENOMEM;
-
-   /* Hack to avoid sending change message to non-FIFO */
-   if (strncmp(q-ops-id + 1, fifo, 4) != 0)
-   return 0;
-
-   rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)), GFP_KERNEL);
-   if (rta) {
-   rta-rta_type = RTM_NEWQDISC;
-   rta-rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
-   ((struct tc_fifo_qopt *)RTA_DATA(rta))-limit = limit;
-
-   ret = q-ops-change(q, rta);
-   kfree(rta);
-   }
-   return ret;
-}
-
 /*
  * Distribution data is a variable size payload containing
  * signed 16 bit values.
@@ -414,7 +392,7 @@ static int netem_change(struct Qdisc *sch, struct rtattr 
*opt)
return -EINVAL;
 
qopt = RTA_DATA(opt);
-   ret = set_fifo_limit(q-qdisc, qopt-limit);
+   ret = fifo_set_limit(q-qdisc, qopt-limit);
if (ret) {
pr_debug(netem: can't set fifo limit\n);
return ret;
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index f1e9647..699f83d 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -174,33 +174,6 @@ static void red_destroy(struct Qdisc *sch)
qdisc_destroy(q-qdisc);
 }
 
-static struct Qdisc *red_create_dflt(struct Qdisc *sch, u32 limit)
-{
-   struct Qdisc *q;
-   struct rtattr *rta;
-   int ret;
-
-   q = qdisc_create_dflt(sch-dev, bfifo_qdisc_ops,
- TC_H_MAKE(sch-handle, 1));
-   if (q) {
-   rta = kmalloc(RTA_LENGTH(sizeof(struct tc_fifo_qopt)),
- GFP_KERNEL);
-   if (rta) {
-   rta-rta_type = RTM_NEWQDISC;
-   rta-rta_len = RTA_LENGTH(sizeof(struct tc_fifo_qopt));
-   ((struct tc_fifo_qopt *)RTA_DATA(rta))-limit = limit;
-
-   ret = q-ops-change(q, rta);
-   kfree(rta);
-
-   if (ret == 0)
-   return q;
-   }
-   qdisc_destroy(q);
-   }
-   return 

[RFC NET_SCHED 02/05]: Rename qdisc helpers for built-in queue

2008-01-20 Thread Patrick McHardy
commit c1f4198dd24ce854b7d55d0ed23a61d36d7defc9
Author: Patrick McHardy [EMAIL PROTECTED]
Date:   Wed Jan 2 21:35:21 2008 +0100

[NET_SCHED]: Rename qdisc helpers for built-in queue

Rename all helper functions dealing with the built-in queue of
struct Qdisc (sch-q) to qdisc_q_... to make the naming more
consistent and avoid naming clashes with the next patch, which
introduces a few simple helpers that should logically use those
names.

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

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 60b4b35..3ade673 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -180,8 +180,8 @@ extern struct Qdisc *qdisc_create_dflt(struct net_device 
*dev,
 extern void tcf_destroy(struct tcf_proto *tp);
 extern void tcf_destroy_chain(struct tcf_proto *fl);
 
-static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
-  struct sk_buff_head *list)
+static inline int __qdisc_q_enqueue_tail(struct sk_buff *skb, struct Qdisc 
*sch,
+struct sk_buff_head *list)
 {
__skb_queue_tail(list, skb);
sch-qstats.backlog += skb-len;
@@ -191,13 +191,13 @@ static inline int __qdisc_enqueue_tail(struct sk_buff 
*skb, struct Qdisc *sch,
return NET_XMIT_SUCCESS;
 }
 
-static inline int qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch)
+static inline int qdisc_q_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch)
 {
-   return __qdisc_enqueue_tail(skb, sch, sch-q);
+   return __qdisc_q_enqueue_tail(skb, sch, sch-q);
 }
 
-static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
-  struct sk_buff_head *list)
+static inline struct sk_buff *__qdisc_q_dequeue_head(struct Qdisc *sch,
+struct sk_buff_head *list)
 {
struct sk_buff *skb = __skb_dequeue(list);
 
@@ -207,13 +207,13 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct 
Qdisc *sch,
return skb;
 }
 
-static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
+static inline struct sk_buff *qdisc_q_dequeue_head(struct Qdisc *sch)
 {
-   return __qdisc_dequeue_head(sch, sch-q);
+   return __qdisc_q_dequeue_head(sch, sch-q);
 }
 
-static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
-  struct sk_buff_head *list)
+static inline struct sk_buff *__qdisc_q_dequeue_tail(struct Qdisc *sch,
+struct sk_buff_head *list)
 {
struct sk_buff *skb = __skb_dequeue_tail(list);
 
@@ -223,13 +223,13 @@ static inline struct sk_buff *__qdisc_dequeue_tail(struct 
Qdisc *sch,
return skb;
 }
 
-static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch)
+static inline struct sk_buff *qdisc_q_dequeue_tail(struct Qdisc *sch)
 {
-   return __qdisc_dequeue_tail(sch, sch-q);
+   return __qdisc_q_dequeue_tail(sch, sch-q);
 }
 
-static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,
- struct sk_buff_head *list)
+static inline int __qdisc_q_requeue(struct sk_buff *skb, struct Qdisc *sch,
+   struct sk_buff_head *list)
 {
__skb_queue_head(list, skb);
sch-qstats.backlog += skb-len;
@@ -238,13 +238,13 @@ static inline int __qdisc_requeue(struct sk_buff *skb, 
struct Qdisc *sch,
return NET_XMIT_SUCCESS;
 }
 
-static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch)
+static inline int qdisc_q_requeue(struct sk_buff *skb, struct Qdisc *sch)
 {
-   return __qdisc_requeue(skb, sch, sch-q);
+   return __qdisc_q_requeue(skb, sch, sch-q);
 }
 
-static inline void __qdisc_reset_queue(struct Qdisc *sch,
-  struct sk_buff_head *list)
+static inline void __qdisc_q_reset(struct Qdisc *sch,
+  struct sk_buff_head *list)
 {
/*
 * We do not know the backlog in bytes of this list, it
@@ -253,16 +253,16 @@ static inline void __qdisc_reset_queue(struct Qdisc *sch,
skb_queue_purge(list);
 }
 
-static inline void qdisc_reset_queue(struct Qdisc *sch)
+static inline void qdisc_q_reset(struct Qdisc *sch)
 {
-   __qdisc_reset_queue(sch, sch-q);
+   __qdisc_q_reset(sch, sch-q);
sch-qstats.backlog = 0;
 }
 
-static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
- struct sk_buff_head *list)
+static inline unsigned int __qdisc_q_drop(struct Qdisc *sch,
+ struct sk_buff_head *list)
 {
-   struct sk_buff *skb = __qdisc_dequeue_tail(sch, list);
+   struct sk_buff *skb = __qdisc_q_dequeue_tail(sch, list);
 
if (likely(skb != NULL)) {
unsigned int 

Re: net 2.6.25 is broken when building with wireless/iwlwifi

2008-01-20 Thread Jeff Garzik

Ian Brown wrote:

Hello,
net 2.6.25 is broken when building with the wireless/iwlwifi
subtree;  we get the following errors (we noticed that iwl_down() and
iwl_resume()
implementation do exist in garzik tree, but there are more differences
so a simple
patch with only adding these two methods might be risky)

...
...

  CHK include/linux/version.h
  CHK include/linux/utsrelease.h
  CALLscripts/checksyscalls.sh
  CHK include/linux/compile.h
  CC [M]  drivers/net/wireless/iwlwifi/iwl3945-base.o
drivers/net/wireless/iwlwifi/iwl3945-base.c: In function 'iwl3945_pci_remove':
drivers/net/wireless/iwlwifi/iwl3945-base.c:8639: error: implicit
declaration of function 'iwl_down'
drivers/net/wireless/iwlwifi/iwl3945-base.c: In function 'iwl3945_pci_resume':
drivers/net/wireless/iwlwifi/iwl3945-base.c:8779: error: implicit
declaration of function 'iwl_resume'
make[4]: *** [drivers/net/wireless/iwlwifi/iwl3945-base.o] Error 1
make[3]: *** [drivers/net/wireless/iwlwifi] Error 2
make[2]: *** [drivers/net/wireless] Error 2
make[1]: *** [drivers/net] Error 2
make: *** [drivers] Error 2


hrm, that sounds like a potential mis-merge on my part (though 
ultimately linville should be re-syncing with net-2.6.25 soon anyway)


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


2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread Andi Kleen

My workstation running 2.6.24-rc8 just hung during shutdown with an endless 
(or rather I didn't wait more than a few minutes) loop of 

unregister_netdev: waiting for ppp-device to become free. Usage count = 1

ppp-device was an active PPPoE device.

No more information currently.

-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 regression: reference count leak in PPPoE

2008-01-20 Thread Ingo Molnar

* Andi Kleen [EMAIL PROTECTED] wrote:

 My workstation running 2.6.24-rc8 just hung during shutdown with an 
 endless (or rather I didn't wait more than a few minutes) loop of
 
 unregister_netdev: waiting for ppp-device to become free. Usage count 
 = 1
 
 ppp-device was an active PPPoE device.
 
 No more information currently.

i've seen such problems (locked up box with endless loop of usage count 
== 1) with pppoe in the past, and it seemed to be related to dynamic 
IPs. (i saw that well before 2.6.24 - reported it once to davem)

It seems to have stopped when i stopped using ipsec and started using 
vpnc. (but no firm info - this was sporadic - happened every few months 
or so) Are you using ipsec and dynamic IPs by any chance?

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


Re: 2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread Daniel Lezcano

Andi Kleen wrote:
My workstation running 2.6.24-rc8 just hung during shutdown with an endless 
(or rather I didn't wait more than a few minutes) loop of 


unregister_netdev: waiting for ppp-device to become free. Usage count = 1

ppp-device was an active PPPoE device.

No more information currently.

-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



I think this bug has been identified.

[Bug 9778] New: unregister_netdevice: waiting for [device] to become free

Thanks.
  -- Daniel
--
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 regression: reference count leak in PPPoE

2008-01-20 Thread Frans Pop
Andi Kleen wrote:
 My workstation running 2.6.24-rc8 just hung during shutdown with an
 endless (or rather I didn't wait more than a few minutes) loop of
 
 unregister_netdev: waiting for ppp-device to become free. Usage count = 1

Same as http://lkml.org/lkml/2008/1/20/27? See also follow-up to that.

Cheers,
FJP
--
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 regression: reference count leak in PPPoE

2008-01-20 Thread Malte Schröder
On Sun, 20 Jan 2008 20:53:30 +0100
Andi Kleen [EMAIL PROTECTED] wrote:

 
 My workstation running 2.6.24-rc8 just hung during shutdown with an endless 
 (or rather I didn't wait more than a few minutes) loop of 
 
 unregister_netdev: waiting for ppp-device to become free. Usage count = 1
 
 ppp-device was an active PPPoE device.
 
 No more information currently.

Now that you mention it, this happened to me too this morning. My
system stops the ppp interface (pppoe) and starts it again (my provider
shuts down the link every 24 hours, I want that to happen during the
night, so I do a ifdown ppp0).




-- 
---
Malte Schröder
[EMAIL PROTECTED]
ICQ# 68121508
---



signature.asc
Description: PGP signature


Re: 2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread Andi Kleen

 It seems to have stopped when i stopped using ipsec and started using
 vpnc.

Kernel ipsec was active yes. However I normally don't see it although
it is often active, that was the first time I think

(except long ago) 

 (but no firm info - this was sporadic - happened every few months 
 or so) Are you using ipsec and dynamic IPs by any chance?

and the ISP uses dynamic IPs.

-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


[PATCH 2/4] dsmark: get rid of trivial function

2008-01-20 Thread Stephen Hemminger
Replace loop in dsmark_valid_indices with equivalent bit math.

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

--- a/net/sched/sch_dsmark.c2008-01-20 13:07:58.0 -0800
+++ b/net/sched/sch_dsmark.c2008-01-20 13:22:54.0 -0800
@@ -45,13 +45,8 @@ struct dsmark_qdisc_data {
 
 static inline int dsmark_valid_indices(u16 indices)
 {
-   while (indices != 1) {
-   if (indices  1)
-   return 0;
-   indices = 1;
-   }
-
-   return 1;
+   /* Must have only one bit set */
+   return (indices  (indices - 1)) == 0;
 }
 
 static inline int dsmark_valid_index(struct dsmark_qdisc_data *p, u16 index)
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] dsmark: checkpatch warning cleanup

2008-01-20 Thread Stephen Hemminger
Get rid of all style things checkpatch warns about, indentation
and whitespace.

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

--- a/net/sched/sch_dsmark.c2008-01-20 13:23:34.0 -0800
+++ b/net/sched/sch_dsmark.c2008-01-20 13:24:45.0 -0800
@@ -152,7 +152,7 @@ static int dsmark_delete(struct Qdisc *s
return 0;
 }
 
-static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker)
+static void dsmark_walk(struct Qdisc *sch, struct qdisc_walker *walker)
 {
struct dsmark_qdisc_data *p = qdisc_priv(sch);
int i;
@@ -176,7 +176,8 @@ ignore:
}
 }
 
-static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned 
long cl)
+static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,
+unsigned long cl)
 {
struct dsmark_qdisc_data *p = qdisc_priv(sch);
return p-filter_list;
@@ -184,7 +185,7 @@ static inline struct tcf_proto **dsmark_
 
 /* --- Qdisc operations  */
 
-static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
+static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
struct dsmark_qdisc_data *p = qdisc_priv(sch);
int err;
@@ -193,24 +194,24 @@ static int dsmark_enqueue(struct sk_buff
 
if (p-set_tc_index) {
switch (skb-protocol) {
-   case __constant_htons(ETH_P_IP):
-   if (skb_cow_head(skb, sizeof(struct iphdr)))
-   goto drop;
+   case __constant_htons(ETH_P_IP):
+   if (skb_cow_head(skb, sizeof(struct iphdr)))
+   goto drop;
 
-   skb-tc_index = ipv4_get_dsfield(ip_hdr(skb))
-~INET_ECN_MASK;
-   break;
+   skb-tc_index = ipv4_get_dsfield(ip_hdr(skb))
+~INET_ECN_MASK;
+   break;
 
-   case __constant_htons(ETH_P_IPV6):
-   if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
-   goto drop;
+   case __constant_htons(ETH_P_IPV6):
+   if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
+   goto drop;
 
-   skb-tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
-~INET_ECN_MASK;
-   break;
-   default:
-   skb-tc_index = 0;
-   break;
+   skb-tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
+~INET_ECN_MASK;
+   break;
+   default:
+   skb-tc_index = 0;
+   break;
}
}
 
@@ -243,7 +244,7 @@ static int dsmark_enqueue(struct sk_buff
}
}
 
-   err = p-q-enqueue(skb,p-q);
+   err = p-q-enqueue(skb, p-q);
if (err != NET_XMIT_SUCCESS) {
sch-qstats.drops++;
return err;
@@ -279,31 +280,31 @@ static struct sk_buff *dsmark_dequeue(st
pr_debug(index %d-%d\n, skb-tc_index, index);
 
switch (skb-protocol) {
-   case __constant_htons(ETH_P_IP):
-   ipv4_change_dsfield(ip_hdr(skb), p-mask[index],
-   p-value[index]);
+   case __constant_htons(ETH_P_IP):
+   ipv4_change_dsfield(ip_hdr(skb), p-mask[index],
+   p-value[index]);
break;
-   case __constant_htons(ETH_P_IPV6):
-   ipv6_change_dsfield(ipv6_hdr(skb), p-mask[index],
-   p-value[index]);
-   break;
-   default:
-   /*
-* Only complain if a change was actually attempted.
-* This way, we can send non-IP traffic through dsmark
-* and don't need yet another qdisc as a bypass.
-*/
-   if (p-mask[index] != 0xff || p-value[index])
-   printk(KERN_WARNING dsmark_dequeue: 
-  unsupported protocol %d\n,
-  ntohs(skb-protocol));
+   case __constant_htons(ETH_P_IPV6):
+   ipv6_change_dsfield(ipv6_hdr(skb), p-mask[index],
+   p-value[index]);
break;
+   default:
+   /*
+* Only complain if a change was actually attempted.
+* This way, we can send non-IP traffic through dsmark
+* and don't 

[PATCH 1/4] dsmark: get rid of wrappers

2008-01-20 Thread Stephen Hemminger
Remove extraneous macro wrappers for printk and qdisc_priv.

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


--- a/net/sched/sch_dsmark.c2008-01-20 08:36:10.0 -0800
+++ b/net/sched/sch_dsmark.c2008-01-20 08:47:26.0 -0800
@@ -15,23 +15,6 @@
 #include net/inet_ecn.h
 #include asm/byteorder.h
 
-
-#if 0 /* control */
-#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
-#else
-#define DPRINTK(format,args...)
-#endif
-
-#if 0 /* data */
-#define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args)
-#else
-#define D2PRINTK(format,args...)
-#endif
-
-
-#define PRIV(sch) ((struct dsmark_qdisc_data *) qdisc_priv(sch))
-
-
 /*
  * classid class   marking
  * --- -   ---
@@ -81,9 +64,9 @@ static inline int dsmark_valid_index(str
 static int dsmark_graft(struct Qdisc *sch, unsigned long arg,
struct Qdisc *new, struct Qdisc **old)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
 
-   DPRINTK(dsmark_graft(sch %p,[qdisc %p],new %p,old %p)\n,
+   pr_debug(dsmark_graft(sch %p,[qdisc %p],new %p,old %p)\n,
sch, p, new, old);
 
if (new == NULL) {
@@ -104,13 +87,14 @@ static int dsmark_graft(struct Qdisc *sc
 
 static struct Qdisc *dsmark_leaf(struct Qdisc *sch, unsigned long arg)
 {
-   return PRIV(sch)-q;
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
+   return p-q;
 }
 
 static unsigned long dsmark_get(struct Qdisc *sch, u32 classid)
 {
-   DPRINTK(dsmark_get(sch %p,[qdisc %p],classid %x)\n,
-   sch, PRIV(sch), classid);
+   pr_debug(dsmark_get(sch %p,[qdisc %p],classid %x)\n,
+   sch, qdisc_priv(sch), classid);
 
return TC_H_MIN(classid) + 1;
 }
@@ -128,13 +112,13 @@ static void dsmark_put(struct Qdisc *sch
 static int dsmark_change(struct Qdisc *sch, u32 classid, u32 parent,
 struct rtattr **tca, unsigned long *arg)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
struct rtattr *opt = tca[TCA_OPTIONS-1];
struct rtattr *tb[TCA_DSMARK_MAX];
int err = -EINVAL;
u8 mask = 0;
 
-   DPRINTK(dsmark_change(sch %p,[qdisc %p],classid %x,parent %x),
+   pr_debug(dsmark_change(sch %p,[qdisc %p],classid %x,parent %x),
arg 0x%lx\n, sch, p, classid, parent, *arg);
 
if (!dsmark_valid_index(p, *arg)) {
@@ -162,7 +146,7 @@ rtattr_failure:
 
 static int dsmark_delete(struct Qdisc *sch, unsigned long arg)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
 
if (!dsmark_valid_index(p, arg))
return -EINVAL;
@@ -175,10 +159,10 @@ static int dsmark_delete(struct Qdisc *s
 
 static void dsmark_walk(struct Qdisc *sch,struct qdisc_walker *walker)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
int i;
 
-   DPRINTK(dsmark_walk(sch %p,[qdisc %p],walker %p)\n, sch, p, walker);
+   pr_debug(dsmark_walk(sch %p,[qdisc %p],walker %p)\n, sch, p, walker);
 
if (walker-stop)
return;
@@ -197,19 +181,20 @@ ignore:
}
 }
 
-static struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned long cl)
+static inline struct tcf_proto **dsmark_find_tcf(struct Qdisc *sch,unsigned 
long cl)
 {
-   return PRIV(sch)-filter_list;
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
+   return p-filter_list;
 }
 
 /* --- Qdisc operations  */
 
 static int dsmark_enqueue(struct sk_buff *skb,struct Qdisc *sch)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
int err;
 
-   D2PRINTK(dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
+   pr_debug(dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
 
if (p-set_tc_index) {
/* FIXME: Safe with non-linear skbs? --RR */
@@ -234,7 +219,7 @@ static int dsmark_enqueue(struct sk_buff
struct tcf_result res;
int result = tc_classify(skb, p-filter_list, res);
 
-   D2PRINTK(result %d class 0x%04x\n, result, res.classid);
+   pr_debug(result %d class 0x%04x\n, result, res.classid);
 
switch (result) {
 #ifdef CONFIG_NET_CLS_ACT
@@ -272,11 +257,11 @@ static int dsmark_enqueue(struct sk_buff
 
 static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
 {
-   struct dsmark_qdisc_data *p = PRIV(sch);
+   struct dsmark_qdisc_data *p = qdisc_priv(sch);
struct sk_buff *skb;
u32 index;
 
-   D2PRINTK(dsmark_dequeue(sch %p,[qdisc %p])\n, sch, p);
+   pr_debug(dsmark_dequeue(sch %p,[qdisc %p])\n, sch, p);
 
skb = p-q-ops-dequeue(p-q);
if (skb == NULL)
@@ -285,7 +270,7 @@ static 

[PATCH 3/4] dsmark: handle cloned and non-linear skb's

2008-01-20 Thread Stephen Hemminger
Make dsmark work properly with non-linear and cloned skb's
Before modifying the header, it needs to check that skb header is
writeable.

Note: this makes the assumption, that if it queues a good skb
then a good skb will come out of the embedded qdisc.

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

--- a/net/sched/sch_dsmark.c2008-01-20 13:22:54.0 -0800
+++ b/net/sched/sch_dsmark.c2008-01-20 13:23:34.0 -0800
@@ -192,13 +192,19 @@ static int dsmark_enqueue(struct sk_buff
pr_debug(dsmark_enqueue(skb %p,sch %p,[qdisc %p])\n, skb, sch, p);
 
if (p-set_tc_index) {
-   /* FIXME: Safe with non-linear skbs? --RR */
switch (skb-protocol) {
case __constant_htons(ETH_P_IP):
+   if (skb_cow_head(skb, sizeof(struct iphdr)))
+   goto drop;
+
skb-tc_index = ipv4_get_dsfield(ip_hdr(skb))
 ~INET_ECN_MASK;
break;
+
case __constant_htons(ETH_P_IPV6):
+   if (skb_cow_head(skb, sizeof(struct ipv6hdr)))
+   goto drop;
+
skb-tc_index = ipv6_get_dsfield(ipv6_hdr(skb))
 ~INET_ECN_MASK;
break;
@@ -222,14 +228,14 @@ static int dsmark_enqueue(struct sk_buff
case TC_ACT_STOLEN:
kfree_skb(skb);
return NET_XMIT_SUCCESS;
+
case TC_ACT_SHOT:
-   kfree_skb(skb);
-   sch-qstats.drops++;
-   return NET_XMIT_BYPASS;
+   goto drop;
 #endif
case TC_ACT_OK:
skb-tc_index = TC_H_MIN(res.classid);
break;
+
default:
if (p-default_index != NO_DEFAULT_INDEX)
skb-tc_index = p-default_index;
@@ -248,6 +254,11 @@ static int dsmark_enqueue(struct sk_buff
sch-q.qlen++;
 
return NET_XMIT_SUCCESS;
+
+drop:
+   kfree_skb(skb);
+   sch-qstats.drops++;
+   return NET_XMIT_BYPASS;
 }
 
 static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
--
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 classifier: style cleanup's

2008-01-20 Thread Stephen Hemminger
Classifier code cleanup. Get rid of printk wrapper, and fix whitespace
and other style stuff reported by checkpatch

---
 net/sched/cls_api.c |  100 +++-
 net/sched/cls_tcindex.c |   60 +++-
 2 files changed, 73 insertions(+), 87 deletions(-)

--- a/net/sched/cls_api.c   2008-01-20 13:33:11.0 -0800
+++ b/net/sched/cls_api.c   2008-01-20 13:46:04.0 -0800
@@ -29,12 +29,6 @@
 #include net/pkt_sched.h
 #include net/pkt_cls.h
 
-#if 0 /* control */
-#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
-#else
-#define DPRINTK(format,args...)
-#endif
-
 /* The list of all installed classifier types */
 
 static struct tcf_proto_ops *tcf_proto_base;
@@ -44,7 +38,7 @@ static DEFINE_RWLOCK(cls_mod_lock);
 
 /* Find classifier type by string name */
 
-static struct tcf_proto_ops * tcf_proto_lookup_ops(struct rtattr *kind)
+static struct tcf_proto_ops *tcf_proto_lookup_ops(struct rtattr *kind)
 {
struct tcf_proto_ops *t = NULL;
 
@@ -81,6 +75,7 @@ out:
write_unlock(cls_mod_lock);
return rc;
 }
+EXPORT_SYMBOL(register_tcf_proto_ops);
 
 int unregister_tcf_proto_ops(struct tcf_proto_ops *ops)
 {
@@ -100,6 +95,7 @@ out:
write_unlock(cls_mod_lock);
return rc;
 }
+EXPORT_SYMBOL(unregister_tcf_proto_ops);
 
 static int tfilter_notify(struct sk_buff *oskb, struct nlmsghdr *n,
  struct tcf_proto *tp, unsigned long fh, int event);
@@ -107,9 +103,9 @@ static int tfilter_notify(struct sk_buff
 
 /* Select new prio value from the range, managed by kernel. */
 
-static __inline__ u32 tcf_auto_prio(struct tcf_proto *tp)
+static inline u32 tcf_auto_prio(struct tcf_proto *tp)
 {
-   u32 first = TC_H_MAKE(0xC000U,0U);
+   u32 first = TC_H_MAKE(0xC000U, 0U);
 
if (tp)
first = tp-prio-1;
@@ -154,21 +150,25 @@ replay:
/* If no priority is given, user wants we allocated it. */
if (n-nlmsg_type != RTM_NEWTFILTER || 
!(n-nlmsg_flagsNLM_F_CREATE))
return -ENOENT;
-   prio = TC_H_MAKE(0x8000U,0U);
+   prio = TC_H_MAKE(0x8000U, 0U);
}
 
/* Find head of filter chain. */
 
/* Find link */
-   if ((dev = __dev_get_by_index(init_net, t-tcm_ifindex)) == NULL)
+   dev = __dev_get_by_index(init_net, t-tcm_ifindex);
+   if (dev == NULL)
return -ENODEV;
 
/* Find qdisc */
if (!parent) {
q = dev-qdisc_sleeping;
parent = q-handle;
-   } else if ((q = qdisc_lookup(dev, TC_H_MAJ(t-tcm_parent))) == NULL)
-   return -EINVAL;
+   } else {
+   q = qdisc_lookup(dev, TC_H_MAJ(t-tcm_parent));
+   if (q == NULL)
+   return -EINVAL;
+   }
 
/* Is it classful? */
if ((cops = q-ops-cl_ops) == NULL)
@@ -213,7 +213,8 @@ replay:
/* Create new proto tcf */
 
err = -ENOBUFS;
-   if ((tp = kzalloc(sizeof(*tp), GFP_KERNEL)) == NULL)
+   tp = kzalloc(sizeof(*tp), GFP_KERNEL);
+   if (tp == NULL)
goto errout;
err = -EINVAL;
tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND-1]);
@@ -249,7 +250,9 @@ replay:
tp-q = q;
tp-classify = tp_ops-classify;
tp-classid = parent;
-   if ((err = tp_ops-init(tp)) != 0) {
+
+   err = tp_ops-init(tp);
+   if (err != 0) {
module_put(tp_ops-owner);
kfree(tp);
goto errout;
@@ -278,13 +281,14 @@ replay:
}
 
err = -ENOENT;
-   if (n-nlmsg_type != RTM_NEWTFILTER || 
!(n-nlmsg_flagsNLM_F_CREATE))
+   if (n-nlmsg_type != RTM_NEWTFILTER ||
+   !(n-nlmsg_flags  NLM_F_CREATE))
goto errout;
} else {
switch (n-nlmsg_type) {
case RTM_NEWTFILTER:
err = -EEXIST;
-   if (n-nlmsg_flagsNLM_F_EXCL)
+   if (n-nlmsg_flags  NLM_F_EXCL)
goto errout;
break;
case RTM_DELTFILTER:
@@ -314,9 +318,8 @@ errout:
return err;
 }
 
-static int
-tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp, unsigned long fh,
- u32 pid, u32 seq, u16 flags, int event)
+static int tcf_fill_node(struct sk_buff *skb, struct tcf_proto *tp,
+unsigned long fh, u32 pid, u32 seq, u16 flags, int 
event)
 {
struct tcmsg *tcm;
struct nlmsghdr  *nlh;
@@ -361,19 +364,20 @@ static int tfilter_notify(struct sk_buff
return -EINVAL;
}
 
-   return rtnetlink_send(skb, init_net, pid, RTNLGRP_TC, 

[PATCH] sch_atm: style cleanup

2008-01-20 Thread Stephen Hemminger
ATM scheduler clean house:
  * get rid of printk and qdisc_priv() wrapper
  * split some assignment in if() statements
  * whitespace and line breaks.

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

--- a/net/sched/sch_atm.c   2008-01-20 13:51:58.0 -0800
+++ b/net/sched/sch_atm.c   2008-01-20 13:59:16.0 -0800
@@ -16,18 +16,6 @@
 
 extern struct socket *sockfd_lookup(int fd, int *err); /* @@@ fix this */
 
-#if 0 /* control */
-#define DPRINTK(format,args...) printk(KERN_DEBUG format,##args)
-#else
-#define DPRINTK(format,args...)
-#endif
-
-#if 0 /* data */
-#define D2PRINTK(format,args...) printk(KERN_DEBUG format,##args)
-#else
-#define D2PRINTK(format,args...)
-#endif
-
 /*
  * The ATM queuing discipline provides a framework for invoking classifiers
  * (aka filters), which in turn select classes of this queuing discipline.
@@ -49,7 +37,6 @@ extern struct socket *sockfd_lookup(int 
  *  - should lock the flow while there is data in the queue (?)
  */
 
-#define PRIV(sch) qdisc_priv(sch)
 #define VCC2FLOW(vcc) ((struct atm_flow_data *) ((vcc)-user_back))
 
 struct atm_flow_data {
@@ -57,7 +44,7 @@ struct atm_flow_data {
struct tcf_proto*filter_list;
struct atm_vcc  *vcc;   /* VCC; NULL if VCC is closed */
void(*old_pop)(struct atm_vcc *vcc,
-  struct sk_buff * skb); /* chaining */
+  struct sk_buff *skb); /* chaining */
struct atm_qdisc_data   *parent;/* parent qdisc */
struct socket   *sock;  /* for closing */
u32 classid;/* x:y type ID */
@@ -84,17 +71,17 @@ static int find_flow(struct atm_qdisc_da
 {
struct atm_flow_data *walk;
 
-   DPRINTK(find_flow(qdisc %p,flow %p)\n, qdisc, flow);
+   pr_debug(find_flow(qdisc %p,flow %p)\n, qdisc, flow);
for (walk = qdisc-flows; walk; walk = walk-next)
if (walk == flow)
return 1;
-   DPRINTK(find_flow: not found\n);
+   pr_debug(find_flow: not found\n);
return 0;
 }
 
 static inline struct atm_flow_data *lookup_flow(struct Qdisc *sch, u32 classid)
 {
-   struct atm_qdisc_data *p = PRIV(sch);
+   struct atm_qdisc_data *p = qdisc_priv(sch);
struct atm_flow_data *flow;
 
for (flow = p-flows; flow; flow = flow-next)
@@ -106,10 +93,10 @@ static inline struct atm_flow_data *look
 static int atm_tc_graft(struct Qdisc *sch, unsigned long arg,
struct Qdisc *new, struct Qdisc **old)
 {
-   struct atm_qdisc_data *p = PRIV(sch);
+   struct atm_qdisc_data *p = qdisc_priv(sch);
struct atm_flow_data *flow = (struct atm_flow_data *)arg;
 
-   DPRINTK(atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n,
+   pr_debug(atm_tc_graft(sch %p,[qdisc %p],flow %p,new %p,old %p)\n,
sch, p, flow, new, old);
if (!find_flow(p, flow))
return -EINVAL;
@@ -125,20 +112,20 @@ static struct Qdisc *atm_tc_leaf(struct 
 {
struct atm_flow_data *flow = (struct atm_flow_data *)cl;
 
-   DPRINTK(atm_tc_leaf(sch %p,flow %p)\n, sch, flow);
+   pr_debug(atm_tc_leaf(sch %p,flow %p)\n, sch, flow);
return flow ? flow-q : NULL;
 }
 
 static unsigned long atm_tc_get(struct Qdisc *sch, u32 classid)
 {
-   struct atm_qdisc_data *p __maybe_unused = PRIV(sch);
+   struct atm_qdisc_data *p __maybe_unused = qdisc_priv(sch);
struct atm_flow_data *flow;
 
-   DPRINTK(atm_tc_get(sch %p,[qdisc %p],classid %x)\n, sch, p, classid);
+   pr_debug(atm_tc_get(sch %p,[qdisc %p],classid %x)\n, sch, p, classid);
flow = lookup_flow(sch, classid);
if (flow)
flow-ref++;
-   DPRINTK(atm_tc_get: flow %p\n, flow);
+   pr_debug(atm_tc_get: flow %p\n, flow);
return (unsigned long)flow;
 }
 
@@ -155,14 +142,14 @@ static unsigned long atm_tc_bind_filter(
  */
 static void atm_tc_put(struct Qdisc *sch, unsigned long cl)
 {
-   struct atm_qdisc_data *p = PRIV(sch);
+   struct atm_qdisc_data *p = qdisc_priv(sch);
struct atm_flow_data *flow = (struct atm_flow_data *)cl;
struct atm_flow_data **prev;
 
-   DPRINTK(atm_tc_put(sch %p,[qdisc %p],flow %p)\n, sch, p, flow);
+   pr_debug(atm_tc_put(sch %p,[qdisc %p],flow %p)\n, sch, p, flow);
if (--flow-ref)
return;
-   DPRINTK(atm_tc_put: destroying\n);
+   pr_debug(atm_tc_put: destroying\n);
for (prev = p-flows; *prev; prev = (*prev)-next)
if (*prev == flow)
break;
@@ -171,11 +158,11 @@ static void atm_tc_put(struct Qdisc *sch
return;
}
*prev = flow-next;
-   DPRINTK(atm_tc_put: qdisc %p\n, flow-q);
+   pr_debug(atm_tc_put: qdisc %p\n, flow-q);
qdisc_destroy(flow-q);
tcf_destroy_chain(flow-filter_list);
 

Re: 2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread Pavel Machek
Hi!

 My workstation running 2.6.24-rc8 just hung during shutdown with an endless 
 (or rather I didn't wait more than a few minutes) loop of 
 
 unregister_netdev: waiting for ppp-device to become free. Usage count = 1
 
 ppp-device was an active PPPoE device.
 
 No more information currently.

Actually, I'm getting something similar:

usb 2-2: USB disconnect, address 23
PM: Removing info for No Bus:usbdev2.23_ep83
usb0: unregister 'cdc_ether' usb-:00:1d.0-2, CDC Ethernet Device
PM: Removing info for No Bus:usb0
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
unregister_netdevice: waiting for usb0 to become free. Usage count = 1
PM: Removing info for usb:2-2:1.0
PM: Removing info for No Bus:usbdev2.23_ep81
PM: Removing info for No Bus:usbdev2.23_ep02

The unregister_netdevice made it onto console, that means pretty
severe log level. Happened while playing with openmoko connected with
USB cable.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3][NET] gen_estimator: faster gen_kill_estimator

2008-01-20 Thread Jarek Poplawski
gen_kill_estimator() is called during qdisc_destroy() with BHs disabled,
and each time does searching for each list member. This can block soft
interrupts for quite a long time when many classes are used. This patch 
changes this by storing a pointer to internal gen_estimator structures
with gnet_stats_rate_est structures used by clients of gen_estimator.

This method removes currently possibile registering in gen_estimator the
same structures more than once, but it isn't used after all. (There is
added a warning if gen_new_estimator() is called with structures being
used by gen_estimator already.)

Reported-by: Badalian Vyacheslav [EMAIL PROTECTED]
Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]

[needs more testing]

---

 include/linux/gen_stats.h |2 ++
 net/core/gen_estimator.c  |   36 +---
 2 files changed, 35 insertions(+), 3 deletions(-)

diff -Nurp 2.6.24-rc8-mm1-/include/linux/gen_stats.h 
2.6.24-rc8-mm1+/include/linux/gen_stats.h
--- 2.6.24-rc8-mm1-/include/linux/gen_stats.h   2007-10-09 22:31:38.0 
+0200
+++ 2.6.24-rc8-mm1+/include/linux/gen_stats.h   2008-01-20 20:37:08.0 
+0100
@@ -28,11 +28,13 @@ struct gnet_stats_basic
  * struct gnet_stats_rate_est - rate estimator
  * @bps: current byte rate
  * @pps: current packet rate
+ * @gen_estimator: internal data
  */
 struct gnet_stats_rate_est
 {
__u32   bps;
__u32   pps;
+   unsigned long   gen_estimator;
 };
 
 /**
diff -Nurp 2.6.24-rc8-mm1-/net/core/gen_estimator.c 
2.6.24-rc8-mm1+/net/core/gen_estimator.c
--- 2.6.24-rc8-mm1-/net/core/gen_estimator.c2008-01-19 17:54:45.0 
+0100
+++ 2.6.24-rc8-mm1+/net/core/gen_estimator.c2008-01-20 20:58:35.0 
+0100
@@ -139,6 +139,9 @@ skip:
rcu_read_unlock();
 }
 
+static void gen_kill_estimator_find(struct gnet_stats_basic *bstats,
+   struct gnet_stats_rate_est *rate_est);
+
 /**
  * gen_new_estimator - create a new rate estimator
  * @bstats: basic statistics
@@ -171,6 +174,10 @@ int gen_new_estimator(struct gnet_stats_
if (parm-interval  -2 || parm-interval  3)
return -EINVAL;
 
+   if (rate_est-gen_estimator)
+   /* not sure: not zeroed in alloc or reused */
+   gen_kill_estimator_find(bstats, rate_est);
+
est = kzalloc(sizeof(*est), GFP_KERNEL);
if (est == NULL)
return -ENOBUFS;
@@ -184,6 +191,7 @@ int gen_new_estimator(struct gnet_stats_
est-avbps = rate_est-bps5;
est-last_packets = bstats-packets;
est-avpps = rate_est-pps10;
+   rate_est-gen_estimator = (unsigned long)est;
 
if (!elist[idx].timer.function) {
INIT_LIST_HEAD(elist[idx].list);
@@ -209,13 +217,30 @@ static void __gen_kill_estimator(struct 
  * @bstats: basic statistics
  * @rate_est: rate estimator statistics
  *
- * Removes the rate estimator specified by bstats and rate_est
- * and deletes the timer.
+ * Removes the rate estimator specified by bstats and rate_est.
  *
  * NOTE: Called under rtnl_mutex
  */
 void gen_kill_estimator(struct gnet_stats_basic *bstats,
-   struct gnet_stats_rate_est *rate_est)
+   struct gnet_stats_rate_est *rate_est)
+{
+   if (rate_est  rate_est-gen_estimator) {
+   struct gen_estimator *e;
+   
+   e = (struct gen_estimator *)rate_est-gen_estimator;
+
+   rate_est-gen_estimator = 0;
+   write_lock_bh(est_lock);
+   e-bstats = NULL;
+   write_unlock_bh(est_lock);
+
+   list_del_rcu(e-list);
+   call_rcu(e-e_rcu, __gen_kill_estimator);
+   }
+}
+
+static void gen_kill_estimator_find(struct gnet_stats_basic *bstats,
+   struct gnet_stats_rate_est *rate_est)
 {
int idx;
struct gen_estimator *e, *n;
@@ -236,6 +261,11 @@ void gen_kill_estimator(struct gnet_stat
 
list_del_rcu(e-list);
call_rcu(e-e_rcu, __gen_kill_estimator);
+
+   WARN_ON_ONCE(1); /* gen_new_estimator() repeated? */
+   rate_est-gen_estimator = 0;
+
+   return;
}
}
 }
--
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][NET] gen_estimator: gen_replace_estimator() cosmetic changes

2008-01-20 Thread Jarek Poplawski
White spaces etc. are changed in gen_replace_estimator() to make it similar
to others in a file.

Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]

---

diff -Nurp 2.6.24-rc8-mm1-p2-/net/core/gen_estimator.c 
2.6.24-rc8-mm1-p2+/net/core/gen_estimator.c
--- 2.6.24-rc8-mm1-p2-/net/core/gen_estimator.c 2008-01-20 21:07:42.0 
+0100
+++ 2.6.24-rc8-mm1-p2+/net/core/gen_estimator.c 2008-01-20 21:15:36.0 
+0100
@@ -275,7 +275,7 @@ static void gen_kill_estimator_find(stru
 }
 
 /**
- * gen_replace_estimator - replace rate estimator configruation
+ * gen_replace_estimator - replace rate estimator configuration
  * @bstats: basic statistics
  * @rate_est: rate estimator statistics
  * @stats_lock: statistics lock
@@ -286,13 +286,12 @@ static void gen_kill_estimator_find(stru
  *
  * Returns 0 on success or a negative error code.
  */
-int
-gen_replace_estimator(struct gnet_stats_basic *bstats,
-   struct gnet_stats_rate_est *rate_est, spinlock_t *stats_lock,
-   struct rtattr *opt)
+int gen_replace_estimator(struct gnet_stats_basic *bstats,
+ struct gnet_stats_rate_est *rate_est,
+ spinlock_t *stats_lock, struct rtattr *opt)
 {
-gen_kill_estimator(bstats, rate_est);
-return gen_new_estimator(bstats, rate_est, stats_lock, opt);
+   gen_kill_estimator(bstats, rate_est);
+   return gen_new_estimator(bstats, rate_est, stats_lock, opt);
 }
 
 
--
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: add sparse annotation to ptype_seq_start/stop

2008-01-20 Thread Stephen Hemminger
Get rid of some more sparse warnings.

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

--- a/net/core/dev.c2008-01-20 14:25:00.0 -0800
+++ b/net/core/dev.c2008-01-20 14:25:48.0 -0800
@@ -2543,6 +2543,7 @@ static void *ptype_get_idx(loff_t pos)
 }
 
 static void *ptype_seq_start(struct seq_file *seq, loff_t *pos)
+   __acquires(rcu)
 {
rcu_read_lock();
return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN;
@@ -2578,6 +2579,7 @@ found:
 }
 
 static void ptype_seq_stop(struct seq_file *seq, void *v)
+   __releases(rcu)
 {
rcu_read_unlock();
 }
--
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/3][NET] gen_estimator: list_empty() check in est_timer() fixed

2008-01-20 Thread Stephen Hemminger
On Mon, 21 Jan 2008 00:49:59 +0100
Jarek Poplawski [EMAIL PROTECTED] wrote:

 This patch changes the method of checking for empty list in est_timer():
 list_empty() is not recommended for RCU protected lists. Now, it's simply
 a variable used for this.
 
 Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]
 
 ---
 
 diff -Nurp 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 
 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c
 --- 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c   2008-01-20 
 20:58:35.0 +0100
 +++ 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c   2008-01-20 
 21:07:42.0 +0100
 @@ -106,6 +106,7 @@ static void est_timer(unsigned long arg)
  {
   int idx = (int)arg;
   struct gen_estimator *e;
 + int list_not_empty = 0;

Using a negative name for what is a boolean value leads
to code that reads like a double negative sentence. Better to choose
a variable name that is direct, can't use list_empty because that
is a macro, so how about estimator_found.

  
   rcu_read_lock();
   list_for_each_entry_rcu(e, elist[idx].list, list) {
 @@ -118,6 +119,9 @@ static void est_timer(unsigned long arg)
   if (e-bstats == NULL)
   goto skip;
  
 + if (list_not_empty == 0)
 + list_not_empty = 1;
 +
   nbytes = e-bstats-bytes;
   npackets = e-bstats-packets;
   rate = (nbytes - e-last_bytes)(7 - idx);
 @@ -134,7 +138,7 @@ skip:
   spin_unlock(e-stats_lock);
   }
  
 - if (!list_empty(elist[idx].list))
 + if (list_not_empty)
   mod_timer(elist[idx].timer, jiffies + ((HZ/4)  idx));
   rcu_read_unlock();
  }
 --
 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
 


-- 
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: 2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread David Miller
From: Ingo Molnar [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 21:01:09 +0100

 
 * Andi Kleen [EMAIL PROTECTED] wrote:
 
  My workstation running 2.6.24-rc8 just hung during shutdown with an 
  endless (or rather I didn't wait more than a few minutes) loop of
  
  unregister_netdev: waiting for ppp-device to become free. Usage count 
  = 1
  
  ppp-device was an active PPPoE device.
  
  No more information currently.
 
 i've seen such problems (locked up box with endless loop of usage count 
 == 1) with pppoe in the past, and it seemed to be related to dynamic 
 IPs. (i saw that well before 2.6.24 - reported it once to davem)

No, this is a different bug Andi is seeing and it was
recently introduced:

http://bugzilla.kernel.org/show_bug.cgi?id=9778
--
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 regression: reference count leak in PPPoE

2008-01-20 Thread David Miller
From: Andi Kleen [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 20:53:30 +0100

 
 My workstation running 2.6.24-rc8 just hung during shutdown with an endless 
 (or rather I didn't wait more than a few minutes) loop of 
 
 unregister_netdev: waiting for ppp-device to become free. Usage count = 1
 
 ppp-device was an active PPPoE device.
 
 No more information currently.

http://bugzilla.kernel.org/show_bug.cgi?id=9778
--
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][NET] gen_estimator: list_empty() check in est_timer() fixed

2008-01-20 Thread Jarek Poplawski
This patch changes the method of checking for empty list in est_timer():
list_empty() is not recommended for RCU protected lists. Now, it's simply
a variable used for this.

Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]

---

diff -Nurp 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 
2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c
--- 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 2008-01-20 20:58:35.0 
+0100
+++ 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c 2008-01-20 21:07:42.0 
+0100
@@ -106,6 +106,7 @@ static void est_timer(unsigned long arg)
 {
int idx = (int)arg;
struct gen_estimator *e;
+   int list_not_empty = 0;
 
rcu_read_lock();
list_for_each_entry_rcu(e, elist[idx].list, list) {
@@ -118,6 +119,9 @@ static void est_timer(unsigned long arg)
if (e-bstats == NULL)
goto skip;
 
+   if (list_not_empty == 0)
+   list_not_empty = 1;
+
nbytes = e-bstats-bytes;
npackets = e-bstats-packets;
rate = (nbytes - e-last_bytes)(7 - idx);
@@ -134,7 +138,7 @@ skip:
spin_unlock(e-stats_lock);
}
 
-   if (!list_empty(elist[idx].list))
+   if (list_not_empty)
mod_timer(elist[idx].timer, jiffies + ((HZ/4)  idx));
rcu_read_unlock();
 }
--
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/4] dsmark: get rid of trivial function

2008-01-20 Thread Patrick McHardy

Stephen Hemminger wrote:

Replace loop in dsmark_valid_indices with equivalent bit math.

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

--- a/net/sched/sch_dsmark.c2008-01-20 13:07:58.0 -0800
+++ b/net/sched/sch_dsmark.c2008-01-20 13:22:54.0 -0800
@@ -45,13 +45,8 @@ struct dsmark_qdisc_data {
 
 static inline int dsmark_valid_indices(u16 indices)

 {
-   while (indices != 1) {
-   if (indices  1)
-   return 0;
-   indices = 1;
-   }
-
-   return 1;
+   /* Must have only one bit set */
+   return (indices  (indices - 1)) == 0;



hweight seems easier to understand, it took me a bit
to realize that the comment matches the code :)
--
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


post 2.6.24-rc7 regression: unregister_netdevice: waiting for eth1 to become free

2008-01-20 Thread Mariusz Kozlowski
Hello,

I found that on current Linus tree unplugging my pcmcia wifi
card (Cabletron RoamAbout) causes part of the system to hang. I.e. mouse works
but keyboard is frozen until reboot. Actually only sysrq works but I can not
type in any terminal.

Syslog shows:

kernel: pccard: card ejected from slot 1
kernel: hermes @ 00010100: Card removed while issuing command 0x0002.
kernel: eth1: Error -19 disabling MAC port
kernel: unregister_netdevice: waiting for eth1 to become free. Usage count = 1
last message repeated 2 times

sysrq-d:

Showing all locks held in the system:
3 locks held by events/0/5:
 #0:  (events){--..}, at: [c0126956] run_workqueue+0xd2/0x1c9
 #1:  ((linkwatch_work).work){--..}, at: [c012697c] run_workqueue+0xf8/0x1c9
 #2:  (net_todo_run_mutex){--..}, at: [c02d6c7a] netdev_run_todo+0x15/0x23f
2 locks held by pccardd/1189:
 #0:  (socket-skt_mutex){--..}, at: [c0286918] pccardd+0x129/0x227
 #1:  (net_todo_run_mutex){--..}, at: [c02d6c7a] netdev_run_todo+0x15/0x23f
1 lock held by agetty/5204:
 #0:  (tty-atomic_read_lock){--..}, at: [c022bb0f] read_chan+0x3da/0x5bb
1 lock held by agetty/5206:
 #0:  (tty-atomic_read_lock){--..}, at: [c022bb0f] read_chan+0x3da/0x5bb
1 lock held by agetty/5207:
 #0:  (tty-atomic_read_lock){--..}, at: [c022bb0f] read_chan+0x3da/0x5bb
1 lock held by agetty/5208:
 #0:  (tty-atomic_read_lock){--..}, at: [c022bb0f] read_chan+0x3da/0x5bb
1 lock held by agetty/5209:
 #0:  (tty-atomic_read_lock){--..}, at: [c022bb0f] read_chan+0x3da/0x5bb
1 lock held by ifconfig/5581:
 #0:  (net_todo_run_mutex){--..}, at: [c02d6c7a] netdev_run_todo+0x15/0x23f

sysrq-w:

SysRq : Show Blocked State
  taskPC stack   pid father
events/0  D dcd62780 0 5  2
   dd834ee0 0096 c033f2e0 dcd62780  c043f500 0246 dd846000 
   dd834f28 c033547a  0002 c02d6c7a dd834f0c c043f538 c043f524 
   c02d6c7a  dcfa5e54 c043f524 dd846000 c043f500 dd834f08 c043f744 
Call Trace:
 [c033547a] mutex_lock_nested+0xe6/0x306
 [c02d6c7a] netdev_run_todo+0x15/0x23f
 [c02de559] rtnl_unlock+0x12/0x14
 [c02df907] linkwatch_event+0x25/0x27
 [c01269a4] run_workqueue+0x120/0x1c9
 [c01272f6] worker_thread+0x71/0xab
 [c0129dbd] kthread+0x36/0x58
 [c0103507] kernel_thread_helper+0x7/0x10
 ===
pccardd   D dccaaa00 0  1189  2
   dce33e00 0096 c033f260 dccaaa00 0282 dce33e10 4f93 4f53 
   dce33e30 c0334b38 c043f6c0 dce33e30 c04dc740 c04dc740 4f93 c01202e9 
   dce16000 c04dc280 dcc09060 4811 dce33e38 c0334bab dce33e40 c01207ae 
Call Trace:
 [c0334b38] schedule_timeout+0x43/0xa2
 [c0334bab] schedule_timeout_uninterruptible+0x14/0x16
 [c01207ae] msleep+0x12/0x18
 [c02d6d2e] netdev_run_todo+0xc9/0x23f
 [c02de559] rtnl_unlock+0x12/0x14
 [c02d54ad] unregister_netdev+0x17/0x1b
 [ded1c111] orinoco_cs_detach+0x1b/0x2d [orinoco_cs]
 [ded0873b] pcmcia_device_remove+0x37/0xc6 [pcmcia]
 [c0258080] __device_release_driver+0x6a/0x92
 [c0258493] device_release_driver+0x2f/0x45
 [c025798f] bus_remove_device+0x53/0x75
 [c0256194] device_del+0x146/0x257
 [c02562b0] device_unregister+0xb/0x15
 [ded08683] pcmcia_card_remove+0x71/0x87 [pcmcia]
 [ded091ec] ds_event+0x54/0x99 [pcmcia]
 [c0285f5a] send_event+0x78/0xa4
 [c0286175] socket_remove_drivers+0x12/0x14
 [c0286185] socket_shutdown+0xe/0xc7
 [c0286264] socket_remove+0x26/0x2c
 [c02869e7] pccardd+0x1f8/0x227
 [c0129dbd] kthread+0x36/0x58
 [c0103507] kernel_thread_helper+0x7/0x10
 ===
ifconfig  D ddb5ea00 0  5581   5580
   dcfa5e2c 0096 c033f2e0 ddb5ea00  c043f500 0246 dce94000 
   dcfa5e74 c033547a  0002 c02d6c7a dce9456c c043f538 c043f524 
   c02d6c7a  c043f524 dd834f08 dce94000 c043f500 dcfa5e54  
Call Trace:
 [c033547a] mutex_lock_nested+0xe6/0x306
 [c02d6c7a] netdev_run_todo+0x15/0x23f
 [c02de559] rtnl_unlock+0x12/0x14
 [c02d614c] dev_ioctl+0x165/0x4f5
 [c02c9967] sock_ioctl+0xe2/0x211
 [c016e3c2] do_ioctl+0x22/0x71
 [c016e466] vfs_ioctl+0x55/0x28a
 [c016e6ce] sys_ioctl+0x33/0x51
 [c01028ca] sysenter_past_esp+0x5f/0xa5
 ===

I run bisection three times but it doesn't give a clear answer which commit is 
the culprit.
First bisection: current Linus bad - v2.6.23 good. First bad commit:

ecd2ebdea350c40e73c00d400d74c8a09c072082 is first bad commit
commit ecd2ebdea350c40e73c00d400d74c8a09c072082
Author: Jarek Poplawski [EMAIL PROTECTED]
Date:   Thu Jan 10 21:21:20 2008 -0800

[AX25] af_ax25: Possible circular locking.

Which is bogus because I don't even have ax25 compiled into the kernel.
Next two (to be sure) times I run bisection: current Linus bad - v2.6.24-rc7 
good.
Two times I got the same result, first bad commit:

9cd40029423701c376391da59d2c6469672b4bed is first bad commit
commit 9cd40029423701c376391da59d2c6469672b4bed
Author: Pavel Emelyanov [EMAIL PROTECTED]
Date:   Thu Jan 10 03:48:38 2008 -0800

[NEIGH]: Fix race between 

Re: [PATCH] [IrDA] af_irda memory leak fixes

2008-01-20 Thread David Miller
From: Samuel Ortiz [EMAIL PROTECTED]
Date: Fri, 18 Jan 2008 08:53:22 +0100

 Hi Dave,
 
 Here goes an IrDA patch against your latest net-2.6 tree.
 
 This patch fixes some af_irda memory leaks.
 It also checks for irias_new_obect() return value.
 
 Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
 Signed-off-by: Samuel Ortiz [EMAIL PROTECTED]

Applied, thanks Sam.
--
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 for 2.6.24? 1/1] bonding: locking fix

2008-01-20 Thread David Miller
From: Andrew Morton [EMAIL PROTECTED]
Date: Thu, 17 Jan 2008 15:42:43 -0800

 Applying this:
 
 --- a/drivers/net/bonding/bond_sysfs.c~bonding-locking-fix
 +++ a/drivers/net/bonding/bond_sysfs.c
 @@ -,8 +,6 @@ static ssize_t bonding_store_primary(str
  out:
   write_unlock_bh(bond-lock);
  
 - rtnl_unlock();
 -
   return count;
  }
  static DEVICE_ATTR(primary, S_IRUGO | S_IWUSR, bonding_show_primary, 
 bonding_store_primary);
 
 
 is better than doing nothing.

If you look at the change that introduced this:

commit 6603a6f25e4bca922a7dfbf0bf03072d98850176
Author: Jay Vosburgh [EMAIL PROTECTED]
Date:   Wed Oct 17 17:37:50 2007 -0700

bonding: Convert more locks to _bh, acquire rtnl, for new locking

Convert more lock acquisitions to _bh flavor to avoid deadlock
with workqueue activity and add acquisition of RTNL in appropriate places.
Affects ALB mode, as well as core bonding functions and sysfs.

Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
Signed-off-by: Jay Vosburgh [EMAIL PROTECTED]
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]

It is clearly the author's intent to surround the execution
of this function (and also bonding_show_active_slave() which
was done correctly) with RTNL semaphore holding.

Therefore the correct fix, which I'll push, is:

commit 991a15cb1cd60a918bd864bb79e7649c30aab275
Author: David S. Miller [EMAIL PROTECTED]
Date:   Sun Jan 20 16:55:20 2008 -0800

[BONDING]: Fix rtnl locking in bonding_store_primary().

Changeset 6603a6f25e4bca922a7dfbf0bf03072d98850176 (Convert more locks
to _bh, acquire rtnl, for new locking) added a regression.

A rtnl_unlock() was added but a rtnl_lock() was not.

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

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 11b76b3..4845c01 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1075,6 +1075,7 @@ static ssize_t bonding_store_primary(struct device *d,
struct slave *slave;
struct bonding *bond = to_bond(d);
 
+   rtnl_lock();
write_lock_bh(bond-lock);
if (!USES_PRIMARY(bond-params.mode)) {
printk(KERN_INFO DRV_NAME
--
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/3 net-2.6.25] call FIB rule-action in the correct namespace

2008-01-20 Thread David Miller
From: Denis V. Lunev [EMAIL PROTECTED]
Date: Thu, 17 Jan 2008 13:08:51 +0300

 FIB rule-action should operate in the same namespace as fib_lookup.
 This is definitely missed right now.
 
 There are two ways to implement this: pass struct net into another rules
 API call (2 levels) or place netns into rule struct directly. The second
 approach seems better as the code will grow less.
 
 Additionally, the patchset cleanups struct net from
 fib_rules_register/unregister to have network namespace context at the
 time of default rules creation.
 
 Signed-off-by: Denis V. Lunev [EMAIL PROTECTED]

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


Re: 2.6.24 regression: reference count leak in PPPoE

2008-01-20 Thread nigel

Hi.

Quoting Ingo Molnar [EMAIL PROTECTED]:



* Andi Kleen [EMAIL PROTECTED] wrote:


My workstation running 2.6.24-rc8 just hung during shutdown with an
endless (or rather I didn't wait more than a few minutes) loop of

unregister_netdev: waiting for ppp-device to become free. Usage count
= 1

ppp-device was an active PPPoE device.

No more information currently.


i've seen such problems (locked up box with endless loop of usage count
== 1) with pppoe in the past, and it seemed to be related to dynamic
IPs. (i saw that well before 2.6.24 - reported it once to davem)

It seems to have stopped when i stopped using ipsec and started using
vpnc. (but no firm info - this was sporadic - happened every few months
or so) Are you using ipsec and dynamic IPs by any chance?


This isn't PPPoE specific. It has also been seen with e1000, madwifi  
and an intel based card. It was introduced by a Jan 10 commit post rc7  
(sorry, don't have the details right now - my laptop died yesterday).  
A bugzilla has already been opened.


Nigel


This message was sent using IMP, the Internet Messaging Program.

--
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: post 2.6.24-rc7 regression: unregister_netdevice: waiting for eth1 to become free

2008-01-20 Thread David Miller
From: Mariusz Kozlowski [EMAIL PROTECTED]
Date: Mon, 21 Jan 2008 01:09:41 +0100

 kernel: unregister_netdevice: waiting for eth1 to become free. Usage count = 1

Known problem:

http://bugzilla.kernel.org/show_bug.cgi?id=9778
--
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/7] bonding: 7 fixes for 2.6.24

2008-01-20 Thread David Miller
From: Jay Vosburgh [EMAIL PROTECTED]
Date: Thu, 17 Jan 2008 16:24:56 -0800

   Following are seven patches to fix locking problems,
 silence locking-related warnings and resolve one recent regression
 in the current 2.6.24-rc.

Jeff, are you going to merge this stuff in?

I'll drop that rtnl_lock() one-liner if so...
--
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 1/3] sfq: timer is deferrable

2008-01-20 Thread David Miller
From: Paul E. McKenney [EMAIL PROTECTED]
Date: Fri, 18 Jan 2008 21:57:00 -0800

 On Fri, Jan 18, 2008 at 08:36:55PM -0800, Stephen Hemminger wrote:
  On Fri, 18 Jan 2008 20:34:46 -0800
  Paul E. McKenney [EMAIL PROTECTED] wrote:
  
   On Fri, Jan 18, 2008 at 02:49:00PM -0800, Stephen Hemminger wrote:
The perturbation timer used for re-keying can be deferred, it doesn't
need to be deterministic.
   
   The only concern that I can come up with is that the sfq_perturbation
   timer might be on one CPU, and all the operations using the corresponding
   SFQ on another.  This could in theory allow a nearly omniscient attacker
   to exploit an SFQ imbalance while preventing perturbation of the hash
   function.
   
   This does not seem to be a valid concern at this point, since there are
   very few uses of init_timer_deferrable().  And if it should become a
   problem, one approach would be to have some sort of per-timer limit to
   the deferral.  Of course, at that point one would need to figure out
   what this limit should be!
   
   Acked-by: Paul E. McKenney [EMAIL PROTECTED]
  
  But the only threat is getting more bandwidth for a longer interval.
  It is all kind of moot anyway because the bandwidth hogs all open
  multiple connections anyway, so SFQ is of no use.
 
 Good point, and an additional reason for my Acked-by above.  ;-)

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


Re: [PATCH 2/2] SFQ: use net_random

2008-01-20 Thread David Miller
From: Paul E. McKenney [EMAIL PROTECTED]
Date: Fri, 18 Jan 2008 20:18:20 -0800

 On Fri, Jan 18, 2008 at 02:47:30PM -0800, Stephen Hemminger wrote:
  SFQ doesn't need true random numbers, it is only using them to salt
  a hash. Therefore it is better to use net_random() and avoid any possible
  problems with depleting the entropy pool.
 
 The random-number algorithm used by net_random() certainly does appear
 to be considerably stronger than the one I used to generate the results
 in the 1990 paper.  ;-)
 
 Acked-by: Paul E. McKenney [EMAIL PROTECTED]

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


Re: [PATCH 3/3] sfq: whitespace cleanup

2008-01-20 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Fri, 18 Jan 2008 14:48:37 -0800

 Add whitespace around operators, and add a few blank lines
 to improve readability.
 
 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: [2.6 patch] atm/idt77105.c: fix section mismatch

2008-01-20 Thread David Miller
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sat, 19 Jan 2008 14:28:52 +0100

 On Sat, Jan 19, 2008 at 03:18:49PM +0200, Adrian Bunk wrote:
  EXPORT_SYMBOL'ed code mustn't be __*init.
  
  Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
 Acked-by: Sam Ravnborg [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: [2.6 patch] atm/suni.c: fix section mismatch

2008-01-20 Thread David Miller
From: Sam Ravnborg [EMAIL PROTECTED]
Date: Sat, 19 Jan 2008 14:29:04 +0100

 Acked-by: Sam Ravnborg [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: [AF_KEY]: Fix skb leak on pfkey_send_migrate() error

2008-01-20 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 16:12:28 +0100

 commit 4dd3440faa345731c27337ee041c0e9abf2b70dc
 Author: Patrick McHardy [EMAIL PROTECTED]
 Date:   Sun Jan 20 16:10:04 2008 +0100
 
 [AF_KEY]: Fix skb leak on pfkey_send_migrate() error
 
 Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

Applied, thanks 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: [NET]: rtnl_link: fix use-after-free

2008-01-20 Thread David Miller
From: Patrick McHardy [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 18:21:27 +0100

 commit 6e470bd53fb50632fe1878bb74bb8531a21b6731
 Author: Patrick McHardy [EMAIL PROTECTED]
 Date:   Sun Jan 20 18:19:15 2008 +0100
 
 [NET]: rtnl_link: fix use-after-free
 
 When unregistering the rtnl_link_ops, all existing devices using
 the ops are destroyed. With nested devices this may lead to a
 use-after-free despite the use of for_each_netdev_safe() in case
 the upper device is next in the device list and is destroyed
 by the NETDEV_UNREGISTER notifier.
 
 The easy fix is to restart scanning the device list after removing
 a device. Alternatively we could add new devices to the front of
 the list to avoid having dependant devices follow the device they
 depend on. A third option would be to only restart scanning if
 dev-iflink of the next device matches dev-ifindex of the current
 one. For now this seems like the safest solution.
 
 With this patch, the veth rtnl_link_ops unregistration can use
 rtnl_link_unregister() directly since it now also handles destruction
 of multiple devices at once.
 
 Signed-off-by: Patrick McHardy [EMAIL PROTECTED]

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


Re: [2.6 patch] atm/idt77105.c: fix section mismatch

2008-01-20 Thread Roel Kluin
Adrian Bunk wrote:
 EXPORT_SYMBOL'ed code mustn't be __*init.
 

Is it correct that the cases below are section mismatches as well?
If required I'll send separate patches to the respective maintainers
 lists.

__init
arch/arm/mach-imx/generic.c:330:EXPORT_SYMBOL(set_imx_fb_info);

__devinit
arch/parisc/kernel/pci.c:245:EXPORT_SYMBOL(pcibios_resource_to_bus);
arch/powerpc/kernel/pci_64.c:371:EXPORT_SYMBOL(of_scan_bus);
arch/powerpc/kernel/pci_64.c:460:EXPORT_SYMBOL(of_scan_pci_bridge);
arch/powerpc/kernel/pci_64.c:842:EXPORT_SYMBOL(pcibios_fixup_device_resources);
arch/powerpc/kernel/pci_64.c:862:EXPORT_SYMBOL(pcibios_setup_new_device);
arch/powerpc/kernel/pci_64.c:908:EXPORT_SYMBOL(pcibios_fixup_bus);
arch/ia64/pci/pci.c:477:EXPORT_SYMBOL_GPL(pcibios_fixup_device_resources);
arch/powerpc/kernel/vio.c:240:EXPORT_SYMBOL(vio_register_device_node);
arch/powerpc/kernel/vio.c:309:EXPORT_SYMBOL(vio_unregister_device);

__cpu_init
arch/x86/kernel/topology.c:60:EXPORT_SYMBOL(arch_register_cpu);
--
EXPORT_SYMBOL'ed code mustn't be __*init.

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
---
diff --git a/arch/arm/mach-imx/generic.c b/arch/arm/mach-imx/generic.c
index 4cfc9d3..92e098a 100644
--- a/arch/arm/mach-imx/generic.c
+++ b/arch/arm/mach-imx/generic.c
@@ -323,7 +323,7 @@ void __init imx_set_mmc_info(struct imxmmc_platform_data 
*info)
 
 static struct imxfb_mach_info imx_fb_info;
 
-void __init set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
+void set_imx_fb_info(struct imxfb_mach_info *hard_imx_fb_info)
 {
memcpy(imx_fb_info,hard_imx_fb_info,sizeof(struct imxfb_mach_info));
 }
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 488e48a..8c200a8 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -470,7 +470,7 @@ pcibios_fixup_resources(struct pci_dev *dev, int start, int 
limit)
}
 }
 
-void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
+void pcibios_fixup_device_resources(struct pci_dev *dev)
 {
pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
 }
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 507d0ac..9cf3cfc 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -195,7 +195,7 @@ void __init pcibios_init_bus(struct pci_bus *bus)
 }
 
 /* called by drivers/pci/setup-bus.c:pci_setup_bridge().  */
-void __devinit pcibios_resource_to_bus(struct pci_dev *dev,
+void pcibios_resource_to_bus(struct pci_dev *dev,
struct pci_bus_region *region, struct resource *res)
 {
 #ifdef CONFIG_64BIT
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 9f63bdc..5f1151a 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -338,7 +338,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 }
 EXPORT_SYMBOL(of_create_pci_dev);
 
-void __devinit of_scan_bus(struct device_node *node,
+void of_scan_bus(struct device_node *node,
  struct pci_bus *bus)
 {
struct device_node *child = NULL;
@@ -370,7 +370,7 @@ void __devinit of_scan_bus(struct device_node *node,
 }
 EXPORT_SYMBOL(of_scan_bus);
 
-void __devinit of_scan_pci_bridge(struct device_node *node,
+void of_scan_pci_bridge(struct device_node *node,
struct pci_dev *dev)
 {
struct pci_bus *bus;
@@ -818,7 +818,7 @@ static void __devinit fixup_resource(struct resource *res, 
struct pci_dev *dev)
}
 }
 
-void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
+void pcibios_fixup_device_resources(struct pci_dev *dev,
  struct pci_bus *bus)
 {
/* Update device resources.  */
@@ -841,7 +841,7 @@ void __devinit pcibios_fixup_device_resources(struct 
pci_dev *dev,
 }
 EXPORT_SYMBOL(pcibios_fixup_device_resources);
 
-void __devinit pcibios_setup_new_device(struct pci_dev *dev)
+void pcibios_setup_new_device(struct pci_dev *dev)
 {
struct dev_archdata *sd = dev-dev.archdata;
 
@@ -879,7 +879,7 @@ static void __devinit do_bus_setup(struct pci_bus *bus)
}
 }
 
-void __devinit pcibios_fixup_bus(struct pci_bus *bus)
+void pcibios_fixup_bus(struct pci_bus *bus)
 {
struct pci_dev *dev = bus-self;
struct device_node *np;
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 19a5656..70a2ce4 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -178,7 +178,7 @@ static void __devinit vio_dev_release(struct device *dev)
  * Returns a pointer to the created vio_dev or NULL if node has
  * NULL device_type or compatible fields.
  */
-struct vio_dev * __devinit vio_register_device_node(struct device_node 
*of_node)
+struct vio_dev * vio_register_device_node(struct device_node *of_node)
 {
struct vio_dev *viodev;
const unsigned int *unit_address;
@@ -302,7 +302,7 @@ static struct device_attribute vio_dev_attrs[] = {
__ATTR_NULL
 };
 
-void __devinit 

Re: [PATCH 0/7] bonding: 7 fixes for 2.6.24

2008-01-20 Thread Jeff Garzik

David Miller wrote:

From: Jay Vosburgh [EMAIL PROTECTED]
Date: Thu, 17 Jan 2008 16:24:56 -0800


Following are seven patches to fix locking problems,
silence locking-related warnings and resolve one recent regression
in the current 2.6.24-rc.


Jeff, are you going to merge this stuff in?

I'll drop that rtnl_lock() one-liner if so...


Linus has this series in linux-2.6.git, even...

Jeff



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


Re: [PATCH 0/7] bonding: 7 fixes for 2.6.24

2008-01-20 Thread Andrew Morton
On Sun, 20 Jan 2008 17:15:38 -0800 (PST) David Miller [EMAIL PROTECTED] wrote:

 From: Jay Vosburgh [EMAIL PROTECTED]
 Date: Thu, 17 Jan 2008 16:24:56 -0800
 
  Following are seven patches to fix locking problems,
  silence locking-related warnings and resolve one recent regression
  in the current 2.6.24-rc.
 
 Jeff, are you going to merge this stuff in?
 
 I'll drop that rtnl_lock() one-liner if so...

It's all in mainline.  The one-liner should be unneeded.
--
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/7] bonding: 7 fixes for 2.6.24

2008-01-20 Thread David Miller
From: Andrew Morton [EMAIL PROTECTED]
Date: Sun, 20 Jan 2008 17:36:44 -0800

 On Sun, 20 Jan 2008 17:15:38 -0800 (PST) David Miller [EMAIL PROTECTED] 
 wrote:
 
  From: Jay Vosburgh [EMAIL PROTECTED]
  Date: Thu, 17 Jan 2008 16:24:56 -0800
  
 Following are seven patches to fix locking problems,
   silence locking-related warnings and resolve one recent regression
   in the current 2.6.24-rc.
  
  Jeff, are you going to merge this stuff in?
  
  I'll drop that rtnl_lock() one-liner if so...
 
 It's all in mainline.  The one-liner should be unneeded.

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


Re: [PATCH 3/4] bonding: Fix work rearming

2008-01-20 Thread Makito SHIOKAWA

 (But new_value = 0 seems needed - just like from module_param()?)
Do you mean to initialize new_value before sscanf()? (There is a check 'if (sscanf(buf, 
%d, new_value) != 1)', so is it necesarry?)

 - maybe to test if the value has changed at all,
Tested.

For now, patch will be like below. Any slight comment for this will be helpful, 
regards.


Signed-off-by: Makito SHIOKAWA [EMAIL PROTECTED]
---
 drivers/net/bonding/bond_main.c  |   11 ---
 drivers/net/bonding/bond_sysfs.c |   19 +--
 2 files changed, 21 insertions(+), 9 deletions(-)

--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2699,7 +2699,7 @@ void bond_loadbalance_arp_mon(struct wor

read_lock(bond-lock);

-   delta_in_ticks = (bond-params.arp_interval * HZ) / 1000;
+   delta_in_ticks = ((bond-params.arp_interval * HZ) / 1000) ? : 1;

if (bond-kill_timers) {
goto out;
@@ -2801,8 +2801,7 @@ void bond_loadbalance_arp_mon(struct wor
}

 re_arm:
-   if (bond-params.arp_interval)
-   queue_delayed_work(bond-wq, bond-lb_arp_work, 
delta_in_ticks);
+   queue_delayed_work(bond-wq, bond-lb_arp_work, delta_in_ticks);
 out:
read_unlock(bond-lock);
 }
@@ -2832,7 +2831,7 @@ void bond_activebackup_arp_mon(struct wo

read_lock(bond-lock);

-   delta_in_ticks = (bond-params.arp_interval * HZ) / 1000;
+   delta_in_ticks = ((bond-params.arp_interval * HZ) / 1000) ? : 1;

if (bond-kill_timers) {
goto out;
@@ -3058,9 +3057,7 @@ void bond_activebackup_arp_mon(struct wo
}

 re_arm:
-   if (bond-params.arp_interval) {
-   queue_delayed_work(bond-wq, bond-ab_arp_work, 
delta_in_ticks);
-   }
+   queue_delayed_work(bond-wq, bond-ab_arp_work, delta_in_ticks);
 out:
read_unlock(bond-lock);
 }
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -644,6 +644,15 @@ static ssize_t bonding_store_arp_interva
   : %s: Setting ARP monitoring interval to %d.\n,
   bond-dev-name, new_value);
bond-params.arp_interval = new_value;
+   if (bond-params.arp_interval == 0  (bond-dev-flags  IFF_UP)) {
+   printk(KERN_INFO DRV_NAME
+  : %s: Disabling ARP monitoring.\n,
+  bond-dev-name);
+   if (bond-params.mode == BOND_MODE_ACTIVEBACKUP)
+   cancel_delayed_work_sync(bond-ab_arp_work);
+   else
+   cancel_delayed_work_sync(bond-lb_arp_work);
+   }
if (bond-params.miimon) {
printk(KERN_INFO DRV_NAME
   : %s: ARP monitoring cannot be used with MII monitoring. 

@@ -658,7 +667,7 @@ static ssize_t bonding_store_arp_interva
   but no ARP targets have been specified.\n,
   bond-dev-name);
}
-   if (bond-dev-flags  IFF_UP) {
+   if (bond-params.arp_interval  (bond-dev-flags  IFF_UP)) {
/* If the interface is up, we may need to fire off
 * the ARP timer.  If the interface is down, the
 * timer will get fired off when the open function
@@ -997,6 +1006,12 @@ static ssize_t bonding_store_miimon(stru
   : %s: Setting MII monitoring interval to %d.\n,
   bond-dev-name, new_value);
bond-params.miimon = new_value;
+   if (bond-params.miimon == 0  (bond-dev-flags  IFF_UP)) {
+   printk(KERN_INFO DRV_NAME
+  : %s: Disabling MII monitoring...\n,
+  bond-dev-name);
+   cancel_delayed_work_sync(bond-mii_work);
+   }
if(bond-params.updelay)
printk(KERN_INFO DRV_NAME
  : %s: Note: Updating updelay (to %d) 
@@ -1026,7 +1041,7 @@ static ssize_t bonding_store_miimon(stru
cancel_delayed_work_sync(bond-lb_arp_work);
}

-   if (bond-dev-flags  IFF_UP) {
+   if (bond-params.miimon  (bond-dev-flags  IFF_UP)) {
/* If the interface is up, we may need to fire off
 * the MII timer. If the interface is down, the
 * timer will get fired off when the open function


--
Makito SHIOKAWA
MIRACLE LINUX CORPORATION
--
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-20 Thread Dave Young
On Mon, Jan 21, 2008 at 12:49:13PM +0800, Dave Young wrote:
 The rfcomm tty device will possibly retain even when conn is down,
 and sysfs doesn't support zombie device moving, so this patch
 move the tty device before conn device is destroyed.
 
 For the bug refered please see :
 http://lkml.org/lkml/2007/12/28/87
 
 Signed-off-by: Dave Young [EMAIL PROTECTED] 
 
 ---
  net/bluetooth/hci_sysfs.c  |   17 +
  net/bluetooth/rfcomm/tty.c |3 ++-
  2 files changed, 19 insertions(+), 1 deletion(-)
 
 diff -upr linux/net/bluetooth/hci_sysfs.c linux.new/net/bluetooth/hci_sysfs.c
 --- linux/net/bluetooth/hci_sysfs.c   2008-01-21 11:29:34.0 +0800
 +++ linux.new/net/bluetooth/hci_sysfs.c   2008-01-21 11:33:46.0 
 +0800
 @@ -316,9 +316,26 @@ void hci_conn_add_sysfs(struct hci_conn 
   schedule_work(conn-work);
  }
  
 +static int __match_tty(struct device *dev, void *data)
 +{
 + /* The rfcomm tty device will possibly retain even when conn
 +  * is down, and sysfs doesn't support move zombie device,
 +  * so we should move the device before conn device is destroyed.
 +  * Due to the only child device of hci_conn dev is rfcomm
 +  * tty_dev, here just return 1
 +  */
 + return 1;
 +}
 +
  static void del_conn(struct work_struct *work)
  {
 + struct device *dev;
   struct hci_conn *conn = container_of(work, struct hci_conn, work);
 +
 + while (dev = device_find_child(conn-dev, NULL, __match_tty)) {
 + device_move(dev, NULL);
 + put_device(dev);
 + }
   device_del(conn-dev);
   put_device(conn-dev);
  }
 diff -upr linux/net/bluetooth/rfcomm/tty.c 
 linux.new/net/bluetooth/rfcomm/tty.c
 --- linux/net/bluetooth/rfcomm/tty.c  2008-01-21 11:30:44.0 +0800
 +++ linux.new/net/bluetooth/rfcomm/tty.c  2008-01-21 11:32:23.0 
 +0800
 @@ -696,7 +696,8 @@ static void rfcomm_tty_close(struct tty_
   BT_DBG(tty %p dev %p dlc %p opened %d, tty, dev, dev-dlc, 
 dev-opened);
  
   if (--dev-opened == 0) {
 - device_move(dev-tty_dev, NULL);
 + if (dev-tty_dev-parent)
 + device_move(dev-tty_dev, NULL);
  
   /* Close DLC and dettach TTY */
   rfcomm_dlc_close(dev-dlc, 0);

Add people missed in cc-list.
--
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] bluetooth : move children of connection device to NULL before connection down

2008-01-20 Thread Dave Young
The rfcomm tty device will possibly retain even when conn is down,
and sysfs doesn't support zombie device moving, so this patch
move the tty device before conn device is destroyed.

For the bug refered please see :
http://lkml.org/lkml/2007/12/28/87

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

---
 net/bluetooth/hci_sysfs.c  |   17 +
 net/bluetooth/rfcomm/tty.c |3 ++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff -upr linux/net/bluetooth/hci_sysfs.c linux.new/net/bluetooth/hci_sysfs.c
--- linux/net/bluetooth/hci_sysfs.c 2008-01-21 11:29:34.0 +0800
+++ linux.new/net/bluetooth/hci_sysfs.c 2008-01-21 11:33:46.0 +0800
@@ -316,9 +316,26 @@ void hci_conn_add_sysfs(struct hci_conn 
schedule_work(conn-work);
 }
 
+static int __match_tty(struct device *dev, void *data)
+{
+   /* The rfcomm tty device will possibly retain even when conn
+* is down, and sysfs doesn't support move zombie device,
+* so we should move the device before conn device is destroyed.
+* Due to the only child device of hci_conn dev is rfcomm
+* tty_dev, here just return 1
+*/
+   return 1;
+}
+
 static void del_conn(struct work_struct *work)
 {
+   struct device *dev;
struct hci_conn *conn = container_of(work, struct hci_conn, work);
+
+   while (dev = device_find_child(conn-dev, NULL, __match_tty)) {
+   device_move(dev, NULL);
+   put_device(dev);
+   }
device_del(conn-dev);
put_device(conn-dev);
 }
diff -upr linux/net/bluetooth/rfcomm/tty.c linux.new/net/bluetooth/rfcomm/tty.c
--- linux/net/bluetooth/rfcomm/tty.c2008-01-21 11:30:44.0 +0800
+++ linux.new/net/bluetooth/rfcomm/tty.c2008-01-21 11:32:23.0 
+0800
@@ -696,7 +696,8 @@ static void rfcomm_tty_close(struct tty_
BT_DBG(tty %p dev %p dlc %p opened %d, tty, dev, dev-dlc, 
dev-opened);
 
if (--dev-opened == 0) {
-   device_move(dev-tty_dev, NULL);
+   if (dev-tty_dev-parent)
+   device_move(dev-tty_dev, NULL);
 
/* Close DLC and dettach TTY */
rfcomm_dlc_close(dev-dlc, 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] net: add sparse annotation to ptype_seq_start/stop

2008-01-20 Thread Al Viro
On Sun, Jan 20, 2008 at 09:03:55PM -0800, Paul E. McKenney wrote:
 On Sun, Jan 20, 2008 at 03:21:46PM -0800, Stephen Hemminger wrote:
  Get rid of some more sparse warnings.
  
  Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
 
 Adding Josh to CC -- is __acquires() case-insensitive?  If not, this
 needs to be __acquires(RCU) and __releases(RCU).

__acquires(whatever_the_helk_you_put_as_its_argument) is all the same.
--
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] net: add sparse annotation to ptype_seq_start/stop

2008-01-20 Thread Paul E. McKenney
On Sun, Jan 20, 2008 at 03:21:46PM -0800, Stephen Hemminger wrote:
 Get rid of some more sparse warnings.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

Adding Josh to CC -- is __acquires() case-insensitive?  If not, this
needs to be __acquires(RCU) and __releases(RCU).

Thanx, Paul

 --- a/net/core/dev.c  2008-01-20 14:25:00.0 -0800
 +++ b/net/core/dev.c  2008-01-20 14:25:48.0 -0800
 @@ -2543,6 +2543,7 @@ static void *ptype_get_idx(loff_t pos)
  }
 
  static void *ptype_seq_start(struct seq_file *seq, loff_t *pos)
 + __acquires(rcu)
  {
   rcu_read_lock();
   return *pos ? ptype_get_idx(*pos - 1) : SEQ_START_TOKEN;
 @@ -2578,6 +2579,7 @@ found:
  }
 
  static void ptype_seq_stop(struct seq_file *seq, void *v)
 + __releases(rcu)
  {
   rcu_read_unlock();
  }
 --
 To unsubscribe from this list: send the line unsubscribe netdev in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed

2008-01-20 Thread Jarek Poplawski
On Sun, Jan 20, 2008 at 03:55:44PM -0800, Stephen Hemminger wrote:
 On Mon, 21 Jan 2008 00:49:59 +0100
 Jarek Poplawski [EMAIL PROTECTED] wrote:
 
  This patch changes the method of checking for empty list in est_timer():
  list_empty() is not recommended for RCU protected lists. Now, it's simply
  a variable used for this.
  
  Signed-off-by: Jarek Poplawski [EMAIL PROTECTED]
  
  ---
  
  diff -Nurp 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 
  2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c
  --- 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 2008-01-20 
  20:58:35.0 +0100
  +++ 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c 2008-01-20 
  21:07:42.0 +0100
  @@ -106,6 +106,7 @@ static void est_timer(unsigned long arg)
   {
  int idx = (int)arg;
  struct gen_estimator *e;
  +   int list_not_empty = 0;
 
 Using a negative name for what is a boolean value leads
 to code that reads like a double negative sentence. Better to choose
 a variable name that is direct, can't use list_empty because that
 is a macro, so how about estimator_found.
 

Hmm, seems right, but since just after sending this patch I started
to doubt this 2/3 patch could really matter here, I'll maybe wait with
this name change for some confirmation yet.

So, since it certainly doesn't matter for 1/3 and 3/3 I withdraw this
2/3 patch for now.

BTW, I've forgotten to mention with patch 1/3 that this checking with
warning on gen_new_estimator() double call should be only temporary,
and after more testing gen_estimator structure could be probably
decreased after removing bstats and rate_est fields.

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


Re: [REGRESSION] 2.6.24-rc7: e1000: Detected Tx Unit Hang

2008-01-20 Thread Badalian Vyacheslav

Hello. Its work, thanks for resend it!
Sorry, i understand that patch 53e52c729cc169db82a6105fac7a166e10c2ec36 
([NET]: Make -poll() breakout consistent in Intel ethernet drivers.) 
have regression and rollback it, i not see your patch.

Sorry again.

Thanks!

From: Badalian Vyacheslav [EMAIL PROTECTED]
Date: Wed, 16 Jan 2008 12:02:28 +0300

  

Also have regression after apply patch.



BTW, if you are using the e1000e driver then this initial
patch will not work.

My more recent patch posting for this problem, will.

I include it again below for you:

[NET]: Fix TX timeout regression in Intel drivers.

This fixes a regression added by changeset
53e52c729cc169db82a6105fac7a166e10c2ec36 ([NET]: Make -poll()
breakout consistent in Intel ethernet drivers.)

As pointed out by Jesse Brandeburg, for three of the drivers edited
above there is breakout logic in the *_clean_tx_irq() code to prevent
running TX reclaim forever.  If this occurs, we have to elide NAPI
poll completion or else those TX events will never be serviced.

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

diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 13d57b0..0c9a6f7 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -3919,7 +3919,7 @@ e1000_clean(struct napi_struct *napi, int budget)
 {
struct e1000_adapter *adapter = container_of(napi, struct 
e1000_adapter, napi);
struct net_device *poll_dev = adapter-netdev;
-   int work_done = 0;
+   int tx_cleaned = 0, work_done = 0;
 
 	/* Must NOT use netdev_priv macro here. */

adapter = poll_dev-priv;
@@ -3929,14 +3929,17 @@ e1000_clean(struct napi_struct *napi, int budget)
 * simultaneously.  A failure obtaining the lock means
 * tx_ring[0] is currently being cleaned anyway. */
if (spin_trylock(adapter-tx_queue_lock)) {
-   e1000_clean_tx_irq(adapter,
-  adapter-tx_ring[0]);
+   tx_cleaned = e1000_clean_tx_irq(adapter,
+   adapter-tx_ring[0]);
spin_unlock(adapter-tx_queue_lock);
}
 
 	adapter-clean_rx(adapter, adapter-rx_ring[0],

  work_done, budget);
 
+	if (tx_cleaned)

+   work_done = budget;
+
/* If budget not fully consumed, exit the polling mode */
if (work_done  budget) {
if (likely(adapter-itr_setting  3))
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index 4a6fc74..2ab3bfb 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -1384,7 +1384,7 @@ static int e1000_clean(struct napi_struct *napi, int 
budget)
 {
struct e1000_adapter *adapter = container_of(napi, struct 
e1000_adapter, napi);
struct net_device *poll_dev = adapter-netdev;
-   int work_done = 0;
+   int tx_cleaned = 0, work_done = 0;
 
 	/* Must NOT use netdev_priv macro here. */

adapter = poll_dev-priv;
@@ -1394,12 +1394,15 @@ static int e1000_clean(struct napi_struct *napi, int 
budget)
 * simultaneously.  A failure obtaining the lock means
 * tx_ring is currently being cleaned anyway. */
if (spin_trylock(adapter-tx_queue_lock)) {
-   e1000_clean_tx_irq(adapter);
+   tx_cleaned = e1000_clean_tx_irq(adapter);
spin_unlock(adapter-tx_queue_lock);
}
 
 	adapter-clean_rx(adapter, work_done, budget);
 
+	if (tx_cleaned)

+   work_done = budget;
+
/* If budget not fully consumed, exit the polling mode */
if (work_done  budget) {
if (adapter-itr_setting  3)
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index a564916..de3f45e 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1468,13 +1468,16 @@ static int ixgbe_clean(struct napi_struct *napi, int 
budget)
struct ixgbe_adapter *adapter = container_of(napi,
struct ixgbe_adapter, napi);
struct net_device *netdev = adapter-netdev;
-   int work_done = 0;
+   int tx_cleaned = 0, work_done = 0;
 
 	/* In non-MSIX case, there is no multi-Tx/Rx queue */

-   ixgbe_clean_tx_irq(adapter, adapter-tx_ring);
+   tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter-tx_ring);
ixgbe_clean_rx_irq(adapter, adapter-rx_ring[0], work_done,
   budget);
 
+	if (tx_cleaned)

+   work_done = budget;
+
/* If budget not fully consumed, exit the polling mode */
if (work_done  budget) {
netif_rx_complete(netdev, napi);

  


--
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/3][NET] gen_estimator: list_empty() check in est_timer() fixed

2008-01-20 Thread Jarek Poplawski
On Mon, Jan 21, 2008 at 07:34:55AM +0100, Jarek Poplawski wrote:
...
 BTW, I've forgotten to mention with patch 1/3 that this checking with
 warning on gen_new_estimator() double call should be only temporary,
 and after more testing gen_estimator structure could be probably
 decreased after removing bstats and rate_est fields.

Hmm, let's forget about this again: it's too early in the morning...

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


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

2008-01-20 Thread Joonwoo Park
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.

The commands 'ifconfig up or ifconfig mtu' and netif_carrier_on() can
introduce soft lockup like this:

[  363.528001] BUG: soft lockup - CPU#0 stuck for 11s! [events/0:9]
[  363.531492]
[  363.535027] Pid: 9, comm: events/0 Not tainted (2.6.24-rc8 #14)
[  363.538837] EIP: 0060:[c4086a39] EFLAGS: 0286 CPU: 0
[  363.542762] EIP is at kfree+0xa9/0xf0
...
[  363.660815]  [c42fb0fd] skb_release_data+0x5d/0x90
[  363.666989]  [c42fb7dc] skb_release_all+0x5c/0xd0
[  363.673207]  [c42faf8b] __kfree_skb+0xb/0x90
[  363.679474]  [c42fb029] kfree_skb+0x19/0x40
[  363.685811]  [c4322d87] ip_rcv+0x27/0x290
[  363.692223]  [c4300ae5] netif_receive_skb+0x255/0x320
[  363.698759]  [f88465aa] e1000_clean_rx_irq+0x14a/0x4f0 [e1000]
[  363.705456]  [f88437c2] e1000_clean+0x62/0x270 [e1000]
[  363.712217]  [c43031ee] net_rx_action+0x16e/0x220
[  363.719065]  [c40346d7] __do_softirq+0x87/0x100
[  363.726001]  [c40347a7] do_softirq+0x57/0x60
[  363.732979]  [c4034b4e] local_bh_enable_ip+0xae/0x100
[  363.740094]  [c43e73f5] _spin_unlock_bh+0x25/0x30
[  363.747283]  [c431ec88] rt_run_flush+0xc8/0xe0
[  363.754566]  [c4320c76] rt_cache_flush+0xd6/0xe0
[  363.761917]  [c4350269] fib_netdev_event+0x89/0xa0
[  363.769361]  [c4047d67] notifier_call_chain+0x37/0x80
...

This patch makes rt_run_flush() to run with softirq is disabled.

Signed-off-by: Joonwoo Park [EMAIL PROTECTED]
---
 net/ipv4/route.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 28484f3..454e71c 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -620,18 +620,20 @@ static void rt_run_flush(unsigned long dummy)
 
get_random_bytes(rt_hash_rnd, 4);
 
+   local_bh_disable();
for (i = rt_hash_mask; i = 0; i--) {
-   spin_lock_bh(rt_hash_lock_addr(i));
+   spin_lock(rt_hash_lock_addr(i));
rth = rt_hash_table[i].chain;
if (rth)
rt_hash_table[i].chain = NULL;
-   spin_unlock_bh(rt_hash_lock_addr(i));
+   spin_unlock(rt_hash_lock_addr(i));
 
for (; rth; rth = next) {
next = rth-u.dst.rt_next;
rt_free(rth);
}
}
+   local_bh_enable();
 }
 
 static DEFINE_SPINLOCK(rt_flush_lock);
-- 
1.5.3.rc5

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


  1   2   >