IPVS: use proper timeout instead of fixed value

2007-10-29 Thread Simon Horman
From: Andy Gospodarek [EMAIL PROTECTED]

Instead of using the default timeout of 3 minutes, this uses the timeout
specific to the protocol used for the connection. The 3 minute timeout
seems somewhat arbitrary (though I know it is used other places in the
ipvs code) and when failing over it would be much nicer to use one of
the configured timeout values.

Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
Acked-by: Simon Horman [EMAIL PROTECTED]

---

Hi,

I'd like to revisit this patch which was originally posted
to netdev in May 2006.

Looking through the archives as far as I can see there was
some discussion as to whether it would be good to send timeout
information in the synchronisation packet, and some discussion
as to whether it would be good to make the timeout configurable
on the slave side, and then the ball was dropped.

It seems to me that regardless of whether or not the syncronisation
protocol should be expanded to include timeout information,
and wheather or not it should be configurable on the slave side,
this patch is a good idea as the default that it provides seems
to be much more sensible than the current arrangement.

Andreas Lundqvist provided me with an example where his
cluser has long often idle connections and that in this case
the short, 3 minute default timeout, really is quite useless.

 ip_vs_sync.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c
--- a/net/ipv4/ipvs/ip_vs_sync.c
+++ b/net/ipv4/ipvs/ip_vs_sync.c
@@ -67,7 +67,6 @@ struct ip_vs_sync_conn_options {
struct ip_vs_seqout_seq;/* outgoing seq. struct */
 };
 
-#define IP_VS_SYNC_CONN_TIMEOUT (3*60*HZ)
 #define SIMPLE_CONN_SIZE  (sizeof(struct ip_vs_sync_conn))
 #define FULL_CONN_SIZE  \
 (sizeof(struct ip_vs_sync_conn) + sizeof(struct ip_vs_sync_conn_options))
@@ -279,6 +278,7 @@ static void ip_vs_process_message(const 
struct ip_vs_sync_conn *s;
struct ip_vs_sync_conn_options *opt;
struct ip_vs_conn *cp;
+   struct ip_vs_protocol *pp;
char *p;
int i;
 
@@ -337,7 +337,8 @@ static void ip_vs_process_message(const 
p += SIMPLE_CONN_SIZE;
 
atomic_set(cp-in_pkts, sysctl_ip_vs_sync_threshold[0]);
-   cp-timeout = IP_VS_SYNC_CONN_TIMEOUT;
+   pp = ip_vs_proto_get(s-protocol);
+   cp-timeout = pp-timeout_table[cp-state];
ip_vs_conn_put(cp);
 
if (p  buffer+buflen) {
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] Preparatory refactoring part 2.

2007-10-29 Thread Corey Hickey
Factor code out of sfq_init() so that the new function can be used
by sfq_change() later.

Actually, as the diff itself shows, most of the sfq_q_init() code
comes from the original sfq_change(), but sfq_change() is only
called by sfq_init() right now. Thus, it is safe to remove
sfq_change(); tc qdisc change doesn't yet work for sfq anyway.

Setting default parameters is moved into a separate function for
clarity.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 net/sched/sch_sfq.c |   88 +++---
 1 files changed, 47 insertions(+), 41 deletions(-)

diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 10e2f3d..8ea816a 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -413,43 +413,41 @@ static void sfq_perturbation(unsigned long arg)
mod_timer(q-perturb_timer, jiffies + q-perturb_period);
 }
 
-static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
+static void
+sfq_default_parameters(struct Qdisc *sch)
 {
struct sfq_sched_data *q = qdisc_priv(sch);
-   struct tc_sfq_qopt *ctl = RTA_DATA(opt);
-   unsigned int qlen;
-
-   if (opt-rta_len  RTA_LENGTH(sizeof(*ctl)))
-   return -EINVAL;
-
-   sch_tree_lock(sch);
-   q-quantum = ctl-quantum ? : psched_mtu(sch-dev);
-   q-perturb_period = ctl-perturb_period*HZ;
-   if (ctl-limit)
-   q-limit = min_t(u32, ctl-limit, SFQ_DEPTH - 1);
 
-   qlen = sch-q.qlen;
-   while (sch-q.qlen  q-limit)
-   sfq_drop(sch);
-   qdisc_tree_decrease_qlen(sch, qlen - sch-q.qlen);
-
-   del_timer(q-perturb_timer);
-   if (q-perturb_period) {
-   mod_timer(q-perturb_timer, jiffies + q-perturb_period);
-   get_random_bytes(q-perturbation, 4);
-   }
-   sch_tree_unlock(sch);
-   return 0;
+   q-quantum= psched_mtu(sch-dev);
+   q-perturbation   = 0;
+   q-perturb_period = 0;
+   q-limit  = SFQ_DEPTH - 1;
 }
 
-static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
+static int
+sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
 {
-   struct sfq_sched_data *q = qdisc_priv(sch);
int i;
 
-   init_timer(q-perturb_timer);
-   q-perturb_timer.data = (unsigned long)sch;
-   q-perturb_timer.function = sfq_perturbation;
+   /* At this point, parameters are set to either defaults (sfq_init) or
+* the previous values (sfq_change). So, overwrite the parameters as
+* specified. */
+   if (opt) {
+   struct tc_sfq_qopt *ctl = RTA_DATA(opt);
+
+   if (opt-rta_len  RTA_LENGTH(sizeof(*ctl)))
+   return -EINVAL;
+
+   if (ctl-quantum)
+   q-quantum = ctl-quantum;
+   if (ctl-perturb_period)
+   q-perturb_period = ctl-perturb_period * HZ;
+   if (ctl-limit)
+   q-limit = ctl-limit;
+   }
+   q-limit = min_t(u32, q-limit, SFQ_DEPTH - 1);
+   q-tail = SFQ_DEPTH;
+   q-max_depth = 0;
 
for (i=0; iSFQ_HASH_DIVISOR; i++)
q-ht[i] = SFQ_DEPTH;
@@ -458,23 +456,31 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
q-dep[i+SFQ_DEPTH].next = i+SFQ_DEPTH;
q-dep[i+SFQ_DEPTH].prev = i+SFQ_DEPTH;
}
-   q-limit = SFQ_DEPTH - 1;
-   q-max_depth = 0;
-   q-tail = SFQ_DEPTH;
-   if (opt == NULL) {
-   q-quantum = psched_mtu(sch-dev);
-   q-perturb_period = 0;
-   get_random_bytes(q-perturbation, 4);
-   } else {
-   int err = sfq_change(sch, opt);
-   if (err)
-   return err;
-   }
for (i=0; iSFQ_DEPTH; i++)
sfq_link(q, i);
return 0;
 }
 
+static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
+{
+   struct sfq_sched_data *q = qdisc_priv(sch);
+   int err;
+
+   sfq_default_parameters(sch);
+   if ((err = sfq_q_init(q, opt)))
+   return err;
+
+   init_timer(q-perturb_timer);
+   q-perturb_timer.data = (unsigned long)sch;
+   q-perturb_timer.function = sfq_perturbation;
+   if (q-perturb_period) {
+   q-perturb_timer.expires = jiffies + q-perturb_period;
+   add_timer(q-perturb_timer);
+   }
+
+   return 0;
+}
+
 static void sfq_destroy(struct Qdisc *sch)
 {
struct sfq_sched_data *q = qdisc_priv(sch);
-- 
1.5.3.4

-
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


SFQ: backport some features from ESFQ (try 5)

2007-10-29 Thread Corey Hickey

Patchset try 2 addresses the review by Michael Buesch.
Patchset try 3 addresses the review by Patrick McHardy.
Patchset try 4 has a few cosmetic improvements.
Patchset try 5 addresses further review by Patrick McHardy.

This set of patches is substantially the same as my previous try, with
changes made according to Patrick's recommendations.

Iproute2 patches will follow shortly.



The following is the original patch text.

This set of patches adds some of ESFQ's modifications to the original 
SFQ. Thus far, I have received support for this approach rather than for 
trying to get ESFQ included as a separate qdisc.

http://mailman.ds9a.nl/pipermail/lartc/2007q2/021056.html

My patches here implement tc qdisc change, user-configurable depth 
(number of flows), and user-configurable divisor (for setting hash table 
size). I've left out the remaining ESFQ features (usage of jhash and 
different hashing methods) because Patrick McHardy intends to submit a 
patch that will supersede that functionality; see the URL above.

Default values remain the same, and SFQ's default behavior remains the 
same, so there should be no user disruption.

Thanks for your consideration,
Corey


 include/linux/pkt_sched.h |   23 ++-
 net/sched/sch_sfq.c   |  434 +++--
 2 files changed, 319 insertions(+), 138 deletions(-)


[PATCH 1/8] Preparatory refactoring part 1.
[PATCH 2/8] Preparatory refactoring part 2.
[PATCH 3/8] Make depth (number of queues) user-configurable
[PATCH 4/8] Add divisor.
[PATCH 5/8] Make qdisc changeable.
[PATCH 6/8] Remove comments about hardcoded values.
[PATCH 7/8] Rework perturb_period.
[PATCH 8/8] Use nested compat attributes to pass parameters.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/8] Remove comments about hardcoded values.

2007-10-29 Thread Corey Hickey
None of these are true anymore (hooray!).

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 include/linux/pkt_sched.h |8 
 net/sched/sch_sfq.c   |   13 +
 2 files changed, 1 insertions(+), 20 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 919af93..d754a3d 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -148,14 +148,6 @@ struct tc_sfq_qopt
unsignedflows;  /* Maximal number of flows  */
 };
 
-/*
- *  NOTE: limit, divisor and flows are hardwired to code at the moment.
- *
- * limit=flows=128, divisor=1024;
- *
- * The only reason for this is efficiency, it is possible
- * to change these parameters in compile time.
- */
 
 /* RED section */
 
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index ca8716f..7b11086 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -62,18 +62,7 @@
 
We still need true WFQ for top level CSZ, but using WFQ
for the best effort traffic is absolutely pointless:
-   SFQ is superior for this purpose.
-
-   IMPLEMENTATION:
-   This implementation limits maximal queue length to 128;
-   maximal mtu to 2^15-1; number of hash buckets to 1024.
-   The only goal of this restrictions was that all data
-   fit into one 4K page :-). Struct sfq_sched_data is
-   organized in anti-cache manner: all the data for a bucket
-   are scattered over different locations. This is not good,
-   but it allowed me to put it into 4K.
-
-   It is easy to increase these values, but not in flight.  */
+   SFQ is superior for this purpose. */
 
 #define SFQ_DEPTH_DEFAULT  128
 #define SFQ_DIVISOR_DEFAULT10
-- 
1.5.3.4

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


[PATCH 4/8] Add divisor.

2007-10-29 Thread Corey Hickey
Make hash divisor user-configurable.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 net/sched/sch_sfq.c |   27 +--
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 1c1bf08..c74d5ce 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -76,7 +76,7 @@
It is easy to increase these values, but not in flight.  */
 
 #define SFQ_DEPTH_DEFAULT  128
-#define SFQ_HASH_DIVISOR   1024
+#define SFQ_DIVISOR_DEFAULT10
 
 #define SFQ_HEAD 0
 #define SFQ_TAIL 1
@@ -86,6 +86,10 @@
 typedef unsigned int sfq_index;
 #define SFQ_MAX_DEPTH (UINT_MAX / 2 - 1)
 
+/* In practice, the actual divisor size is limited by kcalloc, but we still
+ * don't want to left shift by more than 31. */
+#define SFQ_MAX_DIVISOR 31
+
 struct sfq_head
 {
sfq_index   next;
@@ -99,6 +103,7 @@ struct sfq_sched_data
unsignedquantum;/* Allotment per round: MUST BE = MTU 
*/
int limit;
unsigneddepth;
+   unsignedhash_divisor;
 
 /* Variables */
struct timer_list perturb_timer;
@@ -106,7 +111,7 @@ struct sfq_sched_data
sfq_index   tail;   /* Index of current slot in round */
sfq_index   max_depth;  /* Maximal depth */
 
-   sfq_index   ht[SFQ_HASH_DIVISOR];   /* Hash table */
+   sfq_index   *ht;/* Hash table */
sfq_index   *next;  /* Active slots link */
short   *allot; /* Current allotment per slot */
unsigned short  *hash;  /* Hash value indexed by slots 
*/
@@ -116,7 +121,9 @@ struct sfq_sched_data
 
 static __inline__ unsigned sfq_fold_hash(struct sfq_sched_data *q, u32 h, u32 
h1)
 {
-   return jhash_2words(h, h1, q-perturbation)  (SFQ_HASH_DIVISOR - 1);
+   unsigned mask = (1q-hash_divisor) - 1;
+
+   return jhash_2words(h, h1, q-perturbation)  mask;
 }
 
 static unsigned sfq_hash(struct sfq_sched_data *q, struct sk_buff *skb)
@@ -418,6 +425,7 @@ static void sfq_perturbation(unsigned long arg)
 
 static void sfq_q_destroy(struct sfq_sched_data *q)
 {
+   kfree(q-ht);
kfree(q-dep);
kfree(q-next);
kfree(q-allot);
@@ -441,6 +449,7 @@ sfq_default_parameters(struct Qdisc *sch)
q-quantum= psched_mtu(sch-dev);
q-perturbation   = 0;
q-perturb_period = 0;
+   q-hash_divisor   = SFQ_DIVISOR_DEFAULT;
q-depth  = SFQ_DEPTH_DEFAULT;
q-limit  = SFQ_DEPTH_DEFAULT - 1;
 }
@@ -463,18 +472,24 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
q-quantum = ctl-quantum;
if (ctl-perturb_period)
q-perturb_period = ctl-perturb_period * HZ;
+   if (ctl-divisor)
+   q-hash_divisor = ctl-divisor;
if (ctl-flows)
q-depth = ctl-flows;
if (ctl-limit)
q-limit = ctl-limit;
 
-   if (q-depth  SFQ_MAX_DEPTH)
+   if (q-depth SFQ_MAX_DEPTH ||
+   q-hash_divisor  SFQ_MAX_DIVISOR)
return -EINVAL;
}
q-limit = min_t(u32, q-limit, q-depth - 1);
q-tail = q-depth;
q-max_depth = 0;
 
+   q-ht = kcalloc(1q-hash_divisor, sizeof(sfq_index), GFP_KERNEL);
+   if (!q-ht)
+   goto err_case;
q-dep = kcalloc(1 + q-depth*2, sizeof(struct sfq_head), GFP_KERNEL);
if (!q-dep)
goto err_case;
@@ -491,7 +506,7 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
if (!q-qs)
goto err_case;
 
-   for (i=0; iSFQ_HASH_DIVISOR; i++)
+   for (i=0; i  1q-hash_divisor; i++)
q-ht[i] = q-depth;
for (i=0; i  q-depth; i++) {
skb_queue_head_init(q-qs[i]);
@@ -537,7 +552,7 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
opt.perturb_period = q-perturb_period/HZ;
 
opt.limit = q-limit;
-   opt.divisor = SFQ_HASH_DIVISOR;
+   opt.divisor = q-hash_divisor;
opt.flows = q-depth;
 
RTA_PUT(skb, TCA_OPTIONS, sizeof(opt), opt);
-- 
1.5.3.4

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


[PATCH 5/8] Make qdisc changeable.

2007-10-29 Thread Corey Hickey
Re-implement sfq_change() and enable Qdisc_opts.change so tc qdisc
change will work.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 net/sched/sch_sfq.c |   67 ++-
 1 files changed, 66 insertions(+), 1 deletions(-)

diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index c74d5ce..ca8716f 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -454,6 +454,17 @@ sfq_default_parameters(struct Qdisc *sch)
q-limit  = SFQ_DEPTH_DEFAULT - 1;
 }
 
+static void
+sfq_copy_parameters(struct sfq_sched_data *dst, struct sfq_sched_data *src)
+{
+   dst-quantum= src-quantum;
+   dst-perturbation   = src-perturbation;
+   dst-perturb_period = src-perturb_period;
+   dst-hash_divisor   = src-hash_divisor;
+   dst-limit  = src-limit;
+   dst-depth  = src-depth;
+}
+
 static int
 sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
 {
@@ -542,6 +553,60 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
return 0;
 }
 
+static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
+{
+   struct sfq_sched_data *q = qdisc_priv(sch);
+   struct sfq_sched_data tmp;
+   struct sk_buff *skb;
+   unsigned int qlen;
+   int err;
+
+   /* set up tmp queue */
+   memset(tmp, 0, sizeof(struct sfq_sched_data));
+   sfq_copy_parameters(tmp, q);
+   if ((err = sfq_q_init(tmp, opt)))
+   return err;
+
+   /* handle perturbation */
+   /* This code avoids resetting the perturb_timer unless perturb_period
+* is changed. Note that the rest of this function leaves
+* q-perturb_timer alone, whereas all other members of q get
+* overwritten from tmp. */
+   if (!tmp.perturb_period) {
+   tmp.perturbation = 0;
+   del_timer(q-perturb_timer);
+   } else if (tmp.perturb_period != q-perturb_period) {
+   mod_timer(q-perturb_timer, jiffies + tmp.perturb_period);
+   }
+
+   /* move packets from the old queue to the tmp queue */
+   sch_tree_lock(sch);
+   qlen = sch-q.qlen;
+   while (sch-q.qlen = tmp.limit - 1)
+   sfq_drop(sch);
+   qdisc_tree_decrease_qlen(sch, qlen - sch-q.qlen);
+   while ((skb = sfq_q_dequeue(q)) != NULL)
+   sfq_q_enqueue(skb, tmp, SFQ_TAIL);
+
+   /* clean up the old queue */
+   sfq_q_destroy(q);
+
+   /* copy elements of the tmp queue into the old queue */
+   sfq_copy_parameters(q, tmp);
+   q-tail  = tmp.tail;
+   q-max_depth = tmp.max_depth;
+   q-ht= tmp.ht;
+   q-dep   = tmp.dep;
+   q-next  = tmp.next;
+   q-allot = tmp.allot;
+   q-hash  = tmp.hash;
+   q-qs= tmp.qs;
+
+   /* finish up */
+   sch_tree_unlock(sch);
+   return 0;
+}
+
 static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
 {
struct sfq_sched_data *q = qdisc_priv(sch);
@@ -576,7 +641,7 @@ static struct Qdisc_ops sfq_qdisc_ops = {
.init   =   sfq_init,
.reset  =   sfq_reset,
.destroy=   sfq_destroy,
-   .change =   NULL,
+   .change =   sfq_change,
.dump   =   sfq_dump,
.owner  =   THIS_MODULE,
 };
-- 
1.5.3.4

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


[PATCH 8/8] Use nested compat attributes to pass parameters.

2007-10-29 Thread Corey Hickey
This fixes the ambiguity between, for example:
tc qdisc change ... perturb 0
tc qdisc change ...

Without this patch, there is no way for SFQ to differentiate between
a parameter specified to be 0 and a parameter that was omitted.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 include/linux/pkt_sched.h |   13 
 net/sched/sch_sfq.c   |   69 ++--
 2 files changed, 66 insertions(+), 16 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 14a08ad..b1a1a52 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -148,6 +148,19 @@ struct tc_sfq_qopt
unsignedflows;  /* Maximal number of flows  */
 };
 
+enum
+{
+   TCA_SFQ_UNSPEC,
+   TCA_SFQ_COMPAT,
+   TCA_SFQ_QUANTUM,
+   TCA_SFQ_PERTURB,
+   TCA_SFQ_LIMIT,
+   TCA_SFQ_DIVISOR,
+   TCA_SFQ_FLOWS,
+   __TCA_SFQ_MAX,
+};
+
+#define TCA_SFQ_MAX (__TCA_SFQ_MAX - 1)
 
 /* RED section */
 
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 2764a54..5c25b05 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -456,6 +456,29 @@ sfq_copy_parameters(struct sfq_sched_data *dst, struct 
sfq_sched_data *src)
dst-depth  = src-depth;
 }
 
+/* SFQ parameters exist as individual rtattr attributes, with a nested
+ * struct tc_sfq_qopt for compatibility with older userspace tools. If an
+ * individual attribute is set, we want to use it; otherwise, fall back to the
+ * nested struct.
+ * There is one caveat: if a member of the nested struct is 0, we cannot
+ * determine if that parameter is supposed to be 0 or if it is merely unset.
+ * So, only set a parameter if the corresponding struct member (u32 compat) is
+ * nonzero. When setting a parameter to 0, it is necessary to use the
+ * individual attribute. */
+static inline int
+sfq_get_parameter(u32 *dst, struct rtattr *tb[TCA_SFQ_MAX], int attr,
+ u32 compat)
+{
+   struct rtattr *rta = tb[(attr - 1)];
+   if (rta)
+   *dst = RTA_GET_U32(rta);
+   else if (compat)
+   *dst = compat;
+
+   rtattr_failure:
+   return -EINVAL;
+}
+   
 static int
 sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
 {
@@ -465,21 +488,24 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
 * the previous values (sfq_change). So, overwrite the parameters as
 * specified. */
if (opt) {
-   struct tc_sfq_qopt *ctl = RTA_DATA(opt);
-
-   if (opt-rta_len  RTA_LENGTH(sizeof(*ctl)))
-   return -EINVAL;
-
-   if (ctl-quantum)
-   q-quantum = ctl-quantum;
-   if (ctl-perturb_period)
-   q-perturb_period = ctl-perturb_period;
-   if (ctl-divisor)
-   q-hash_divisor = ctl-divisor;
-   if (ctl-flows)
-   q-depth = ctl-flows;
-   if (ctl-limit)
-   q-limit = ctl-limit;
+   struct tc_sfq_qopt *ctl;
+   struct rtattr *tb[TCA_SFQ_MAX];
+
+   if (rtattr_parse_nested_compat(tb, TCA_SFQ_MAX, opt, ctl,
+   sizeof(*ctl)))
+   goto rtattr_failure;
+
+   if (sfq_get_parameter((q-quantum),tb, TCA_SFQ_QUANTUM,
+   ctl-quantum)||
+   sfq_get_parameter((q-perturb_period), tb, TCA_SFQ_PERTURB,
+   ctl-perturb_period) ||
+   sfq_get_parameter((q-hash_divisor),   tb, TCA_SFQ_DIVISOR,
+   ctl-divisor)||
+   sfq_get_parameter((q-depth),  tb, TCA_SFQ_FLOWS,
+   ctl-flows)  ||
+   sfq_get_parameter((q-limit),  tb, TCA_SFQ_LIMIT,
+   ctl-limit))
+   goto rtattr_failure;
 
if (q-depth SFQ_MAX_DEPTH ||
q-hash_divisor  SFQ_MAX_DIVISOR)
@@ -519,6 +545,8 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
for (i=0; i  q-depth; i++)
sfq_link(q, i);
return 0;
+rtattr_failure:
+   return -EINVAL;
 err_case:
sfq_q_destroy(q);
return -ENOBUFS;
@@ -602,17 +630,26 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff 
*skb)
 {
struct sfq_sched_data *q = qdisc_priv(sch);
unsigned char *b = skb_tail_pointer(skb);
+   struct rtattr *nest;
struct tc_sfq_qopt opt;
 
opt.quantum = q-quantum;
opt.perturb_period = q-perturb_period;
-
opt.limit = q-limit;
opt.divisor = q-hash_divisor;
opt.flows = q-depth;
 
+   nest = RTA_NEST_COMPAT(skb, TCA_OPTIONS, sizeof(opt), opt);
+
+   RTA_PUT_U32(skb, TCA_SFQ_QUANTUM, q-quantum);
+   RTA_PUT_U32(skb, 

[PATCH 7/8] Rework perturb_period.

2007-10-29 Thread Corey Hickey
perturb_period is the only parameter that doesn't match 1:1 with the
value from userspace. Multiplying perturb_period by HZ when used rather
than when assigned makes it easy and clean to use a small function for
setting parameters (in a subsequent patch).

perturb_period is currently a signed integer, but I can't see any good
reason why this is so--a negative perturbation period will add a timer
that expires in the past, causing constant perturbation, which makes
hashing useless.

Strictly speaking, this will break binary compatibility with older
versions of tc, but that ought not to be a problem because (a) there's
no valid use for a negative perturb_period, and (b) negative values
will be seen as high values ( INT_MAX), which don't work anyway.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 include/linux/pkt_sched.h |2 +-
 net/sched/sch_sfq.c   |   14 --
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index d754a3d..14a08ad 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -142,7 +142,7 @@ enum
 struct tc_sfq_qopt
 {
unsignedquantum;/* Bytes per round allocated to flow */
-   int perturb_period; /* Period of hash perturbation */
+   unsignedperturb_period; /* Period of hash perturbation */
__u32   limit;  /* Maximal packets in queue */
unsigneddivisor;/* Hash divisor  */
unsignedflows;  /* Maximal number of flows  */
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 7b11086..2764a54 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -70,6 +70,8 @@
 #define SFQ_HEAD 0
 #define SFQ_TAIL 1
 
+#define SFQ_PERTURB(period) (jiffies + (unsigned long)period * HZ)
+
 /* This type must contain greater than depth*2 values, so depth is constrained 
  * accordingly. */
 typedef unsigned int sfq_index;
@@ -88,7 +90,7 @@ struct sfq_head
 struct sfq_sched_data
 {
 /* Parameters */
-   int perturb_period;
+   unsignedperturb_period;
unsignedquantum;/* Allotment per round: MUST BE = MTU 
*/
int limit;
unsigneddepth;
@@ -409,7 +411,7 @@ static void sfq_perturbation(unsigned long arg)
get_random_bytes(q-perturbation, 4);
 
if (q-perturb_period)
-   mod_timer(q-perturb_timer, jiffies + q-perturb_period);
+   mod_timer(q-perturb_timer, SFQ_PERTURB(q-perturb_period));
 }
 
 static void sfq_q_destroy(struct sfq_sched_data *q)
@@ -471,7 +473,7 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
if (ctl-quantum)
q-quantum = ctl-quantum;
if (ctl-perturb_period)
-   q-perturb_period = ctl-perturb_period * HZ;
+   q-perturb_period = ctl-perturb_period;
if (ctl-divisor)
q-hash_divisor = ctl-divisor;
if (ctl-flows)
@@ -535,7 +537,7 @@ static int sfq_init(struct Qdisc *sch, struct rtattr *opt)
q-perturb_timer.data = (unsigned long)sch;
q-perturb_timer.function = sfq_perturbation;
if (q-perturb_period) {
-   q-perturb_timer.expires = jiffies + q-perturb_period;
+   q-perturb_timer.expires = SFQ_PERTURB(q-perturb_period);
add_timer(q-perturb_timer);
}
 
@@ -565,7 +567,7 @@ static int sfq_change(struct Qdisc *sch, struct rtattr *opt)
tmp.perturbation = 0;
del_timer(q-perturb_timer);
} else if (tmp.perturb_period != q-perturb_period) {
-   mod_timer(q-perturb_timer, jiffies + tmp.perturb_period);
+   mod_timer(q-perturb_timer, SFQ_PERTURB(tmp.perturb_period));
}
 
/* move packets from the old queue to the tmp queue */
@@ -603,7 +605,7 @@ static int sfq_dump(struct Qdisc *sch, struct sk_buff *skb)
struct tc_sfq_qopt opt;
 
opt.quantum = q-quantum;
-   opt.perturb_period = q-perturb_period/HZ;
+   opt.perturb_period = q-perturb_period;
 
opt.limit = q-limit;
opt.divisor = q-hash_divisor;
-- 
1.5.3.4

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


[PATCH 3/8] Make depth (number of queues) user-configurable

2007-10-29 Thread Corey Hickey
* replace #define with a parameter
* use old hardcoded value as a default
* kcalloc() arrays in sfq_q_init()
* free() arrays in new function sfq_q_destroy()
* move sfq_destroy() to near sfq_q_destroy(), for clarity

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 net/sched/sch_sfq.c |  104 +++
 1 files changed, 72 insertions(+), 32 deletions(-)

diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 8ea816a..1c1bf08 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -75,14 +75,16 @@
 
It is easy to increase these values, but not in flight.  */
 
-#define SFQ_DEPTH  128
+#define SFQ_DEPTH_DEFAULT  128
 #define SFQ_HASH_DIVISOR   1024
 
 #define SFQ_HEAD 0
 #define SFQ_TAIL 1
 
-/* This type should contain at least SFQ_DEPTH*2 values */
-typedef unsigned char sfq_index;
+/* This type must contain greater than depth*2 values, so depth is constrained 
+ * accordingly. */
+typedef unsigned int sfq_index;
+#define SFQ_MAX_DEPTH (UINT_MAX / 2 - 1)
 
 struct sfq_head
 {
@@ -96,6 +98,7 @@ struct sfq_sched_data
int perturb_period;
unsignedquantum;/* Allotment per round: MUST BE = MTU 
*/
int limit;
+   unsigneddepth;
 
 /* Variables */
struct timer_list perturb_timer;
@@ -104,11 +107,11 @@ struct sfq_sched_data
sfq_index   max_depth;  /* Maximal depth */
 
sfq_index   ht[SFQ_HASH_DIVISOR];   /* Hash table */
-   sfq_index   next[SFQ_DEPTH];/* Active slots link */
-   short   allot[SFQ_DEPTH];   /* Current allotment per slot */
-   unsigned short  hash[SFQ_DEPTH];/* Hash value indexed by slots 
*/
-   struct sk_buff_head qs[SFQ_DEPTH];  /* Slot queue */
-   struct sfq_head dep[SFQ_DEPTH*2];   /* Linked list of slots, 
indexed by depth */
+   sfq_index   *next;  /* Active slots link */
+   short   *allot; /* Current allotment per slot */
+   unsigned short  *hash;  /* Hash value indexed by slots 
*/
+   struct sk_buff_head *qs;/* Slot queue */
+   struct sfq_head *dep;   /* Linked list of slots, 
indexed by depth */
 };
 
 static __inline__ unsigned sfq_fold_hash(struct sfq_sched_data *q, u32 h, u32 
h1)
@@ -160,7 +163,7 @@ static unsigned sfq_hash(struct sfq_sched_data *q, struct 
sk_buff *skb)
 static inline void sfq_link(struct sfq_sched_data *q, sfq_index x)
 {
sfq_index p, n;
-   int d = q-qs[x].qlen + SFQ_DEPTH;
+   int d = q-qs[x].qlen + q-depth;
 
p = d;
n = q-dep[d].next;
@@ -211,7 +214,7 @@ static unsigned int sfq_drop(struct Qdisc *sch)
   drop a packet from it */
 
if (d  1) {
-   sfq_index x = q-dep[d+SFQ_DEPTH].next;
+   sfq_index x = q-dep[d + q-depth].next;
skb = q-qs[x].prev;
len = skb-len;
__skb_unlink(skb, q-qs[x]);
@@ -234,7 +237,7 @@ static unsigned int sfq_drop(struct Qdisc *sch)
kfree_skb(skb);
sfq_dec(q, d);
sch-q.qlen--;
-   q-ht[q-hash[d]] = SFQ_DEPTH;
+   q-ht[q-hash[d]] = q-depth;
sch-qstats.drops++;
sch-qstats.backlog -= len;
return len;
@@ -250,8 +253,8 @@ sfq_q_enqueue(struct sk_buff *skb, struct sfq_sched_data 
*q, int end)
sfq_index x;
 
x = q-ht[hash];
-   if (x == SFQ_DEPTH) {
-   q-ht[hash] = x = q-dep[SFQ_DEPTH].next;
+   if (x == q-depth) {
+   q-ht[hash] = x = q-dep[q-depth].next;
q-hash[x] = hash;
}
 
@@ -287,7 +290,7 @@ sfq_q_enqueue(struct sk_buff *skb, struct sfq_sched_data 
*q, int end)
 
sfq_inc(q, x);
if (q-qs[x].qlen == 1) {   /* The flow is new */
-   if (q-tail == SFQ_DEPTH) { /* It is the first flow */
+   if (q-tail == q-depth) {  /* It is the first flow */
q-tail = x;
q-next[x] = x;
q-allot[x] = q-quantum;
@@ -351,7 +354,7 @@ sk_buff *sfq_q_dequeue(struct sfq_sched_data *q)
sfq_index a, old_a;
 
/* No active slots */
-   if (q-tail == SFQ_DEPTH)
+   if (q-tail == q-depth)
return NULL;
 
a = old_a = q-next[q-tail];
@@ -362,10 +365,10 @@ sk_buff *sfq_q_dequeue(struct sfq_sched_data *q)
 
/* Is the slot empty? */
if (q-qs[a].qlen == 0) {
-   q-ht[q-hash[a]] = SFQ_DEPTH;
+   q-ht[q-hash[a]] = q-depth;
a = q-next[a];
if (a == old_a) {
-   q-tail = SFQ_DEPTH;
+   q-tail = q-depth;
return skb;
}
q-next[q-tail] = a;
@@ -413,6 +416,23 @@ static 

[PATCH 1/8] Preparatory refactoring part 1.

2007-10-29 Thread Corey Hickey
Make a new function sfq_q_enqueue() that operates directly on the
queue data. This will be useful for implementing sfq_change() in
a later patch. A pleasant side-effect is reducing most of the
duplicate code in sfq_enqueue() and sfq_requeue().

Similarly, make a new function sfq_q_dequeue().

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 net/sched/sch_sfq.c |  119 ++-
 1 files changed, 70 insertions(+), 49 deletions(-)

diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index b542c87..10e2f3d 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -78,6 +78,9 @@
 #define SFQ_DEPTH  128
 #define SFQ_HASH_DIVISOR   1024
 
+#define SFQ_HEAD 0
+#define SFQ_TAIL 1
+
 /* This type should contain at least SFQ_DEPTH*2 values */
 typedef unsigned char sfq_index;
 
@@ -241,9 +244,8 @@ static unsigned int sfq_drop(struct Qdisc *sch)
 }
 
 static int
-sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
+sfq_q_enqueue(struct sk_buff *skb, struct sfq_sched_data *q, int end)
 {
-   struct sfq_sched_data *q = qdisc_priv(sch);
unsigned hash = sfq_hash(q, skb);
sfq_index x;
 
@@ -252,15 +254,37 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
q-ht[hash] = x = q-dep[SFQ_DEPTH].next;
q-hash[x] = hash;
}
-   /* If selected queue has length q-limit, this means that
-* all another queues are empty and that we do simple tail drop,
-* i.e. drop _this_ packet.
-*/
-   if (q-qs[x].qlen = q-limit)
-   return qdisc_drop(skb, sch);
 
-   sch-qstats.backlog += skb-len;
-   __skb_queue_tail(q-qs[x], skb);
+   if (end == SFQ_TAIL) {
+   /* If selected queue has length q-limit, this means that
+* all other queues are empty and that we do simple tail drop,
+* i.e. drop _this_ packet.
+*/
+   if (q-qs[x].qlen = q-limit) {
+   unsigned int drop_len = skb-len;
+
+   kfree_skb(skb);
+   return drop_len;
+   }
+   __skb_queue_tail(q-qs[x], skb);
+   } else { /* end == SFQ_HEAD */
+   __skb_queue_head(q-qs[x], skb);
+   /* If selected queue has length q-limit+1, this means that
+* all other queues are empty and we do simple tail drop.
+* This packet is still requeued at head of queue, tail packet
+* is dropped.
+*/
+   if (q-qs[x].qlen  q-limit) {
+   unsigned int drop_len;
+
+   skb = q-qs[x].prev;
+   drop_len = skb-len;
+   __skb_unlink(skb, q-qs[x]);
+   kfree_skb(skb);
+   return drop_len;
+   }
+   }
+
sfq_inc(q, x);
if (q-qs[x].qlen == 1) {   /* The flow is new */
if (q-tail == SFQ_DEPTH) { /* It is the first flow */
@@ -273,6 +297,21 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
q-tail = x;
}
}
+
+   return 0;
+}
+
+static int
+sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
+{
+   struct sfq_sched_data *q = qdisc_priv(sch);
+
+   if (sfq_q_enqueue(skb, q, SFQ_TAIL)) {
+   sch-qstats.drops++;
+   return NET_XMIT_DROP;
+   }
+
+   sch-qstats.backlog += skb-len;
if (++sch-q.qlen = q-limit) {
sch-bstats.bytes += skb-len;
sch-bstats.packets++;
@@ -287,58 +326,27 @@ static int
 sfq_requeue(struct sk_buff *skb, struct Qdisc* sch)
 {
struct sfq_sched_data *q = qdisc_priv(sch);
-   unsigned hash = sfq_hash(q, skb);
-   sfq_index x;
+   unsigned int drop_len;
 
-   x = q-ht[hash];
-   if (x == SFQ_DEPTH) {
-   q-ht[hash] = x = q-dep[SFQ_DEPTH].next;
-   q-hash[x] = hash;
-   }
sch-qstats.backlog += skb-len;
-   __skb_queue_head(q-qs[x], skb);
-   /* If selected queue has length q-limit+1, this means that
-* all another queues are empty and we do simple tail drop.
-* This packet is still requeued at head of queue, tail packet
-* is dropped.
-*/
-   if (q-qs[x].qlen  q-limit) {
-   skb = q-qs[x].prev;
-   __skb_unlink(skb, q-qs[x]);
+   if ((drop_len = sfq_q_enqueue(skb, q, SFQ_HEAD))) {
+   sch-qstats.backlog -= drop_len;
sch-qstats.drops++;
-   sch-qstats.backlog -= skb-len;
-   kfree_skb(skb);
return NET_XMIT_CN;
}
-   sfq_inc(q, x);
-   if (q-qs[x].qlen == 1) {   /* The flow is new */
-   if (q-tail == SFQ_DEPTH) { /* It is the first flow */
-   q-tail = x;
-   q-next[x] = x;
-   

[iproute2] SFQ: backport some features from ESFQ (try 5)

2007-10-29 Thread Corey Hickey

These patches follow the ESFQ--SFQ kernel patches. See the kernel
patch summary for general information.

Thanks,
Corey


 include/linux/pkt_sched.h |   23 ++-
 tc/q_sfq.c|   42 +-
 2 files changed, 51 insertions(+), 14 deletions(-)


[PATCH 1/3] SFQ: Support changing depth and divisor.
[PATCH 2/3] Change perturb_period to unsigned.
[PATCH 3/3] Use nested compat attributes for passing parameters to the kernel.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] Change perturb_period to unsigned.

2007-10-29 Thread Corey Hickey
This corresponds to the kernel patch doing the same.

Here, too, this will technically break binary compatibility with older
kernels, but that shouldn't be a problem because negative perturb_period
values aren't usable anyway.
---
 include/linux/pkt_sched.h |2 +-
 tc/q_sfq.c|4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 9d41f63..fb04a89 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -142,7 +142,7 @@ enum
 struct tc_sfq_qopt
 {
unsignedquantum;/* Bytes per round allocated to flow */
-   int perturb_period; /* Period of hash perturbation */
+   unsignedperturb_period; /* Period of hash perturbation */
__u32   limit;  /* Maximal packets in queue */
unsigneddivisor;/* Hash divisor  */
unsignedflows;  /* Maximal number of flows  */
diff --git a/tc/q_sfq.c b/tc/q_sfq.c
index 19e76ba..83c8a54 100644
--- a/tc/q_sfq.c
+++ b/tc/q_sfq.c
@@ -47,7 +47,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
ok++;
} else if (strcmp(*argv, perturb) == 0) {
NEXT_ARG();
-   if (get_integer(opt.perturb_period, *argv, 0)) {
+   if (get_u32(opt.perturb_period, *argv, 0)) {
fprintf(stderr, Illegal \perturb\\n);
return -1;
}
@@ -114,7 +114,7 @@ static int sfq_print_opt(struct qdisc_util *qu, FILE *f, 
struct rtattr *opt)
fprintf(f, flows %u/%u , qopt-flows, qopt-divisor);
}
if (qopt-perturb_period)
-   fprintf(f, perturb %dsec , qopt-perturb_period);
+   fprintf(f, perturb %usec , qopt-perturb_period);
return 0;
 }
 
-- 
1.5.3.4

-
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] SFQ: Support changing depth and divisor.

2007-10-29 Thread Corey Hickey
This can safely be applied either before or after the kernel
patches because the tc_sfq_qopt struct is unchanged:

- old kernels will ignore the new parameters from new iproute2
- new kernels will use the same defaults for the new parameters
---
 include/linux/pkt_sched.h |9 -
 tc/q_sfq.c|   20 +++-
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index 268c515..9d41f63 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -148,15 +148,6 @@ struct tc_sfq_qopt
unsignedflows;  /* Maximal number of flows  */
 };
 
-/*
- *  NOTE: limit, divisor and flows are hardwired to code at the moment.
- *
- * limit=flows=128, divisor=1024;
- *
- * The only reason for this is efficiency, it is possible
- * to change these parameters in compile time.
- */
-
 /* RED section */
 
 enum
diff --git a/tc/q_sfq.c b/tc/q_sfq.c
index 05385cf..19e76ba 100644
--- a/tc/q_sfq.c
+++ b/tc/q_sfq.c
@@ -25,7 +25,7 @@
 
 static void explain(void)
 {
-   fprintf(stderr, Usage: ... sfq [ limit NUMBER ] [ perturb SECS ] [ 
quantum BYTES ]\n);
+   fprintf(stderr, Usage: ... sfq [ limit NUMBER ] [ depth FLOWS ] [ 
divisor HASHBITS ] [ perturb SECS ] [ quantum BYTES ]\n);
 }
 
 #define usage() return(-1)
@@ -63,6 +63,24 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
return -1;
}
ok++;
+   } else if (strcmp(*argv, depth) == 0) {
+   NEXT_ARG();
+   if (get_unsigned(opt.flows, *argv, 0)) {
+   fprintf(stderr, Illegal \depth\\n);
+   return -1;
+   }
+   ok++;
+   } else if (strcmp(*argv, divisor) == 0) {
+   NEXT_ARG();
+   if (get_unsigned(opt.divisor, *argv, 0)) {
+   fprintf(stderr, Illegal \divisor\\n);
+   return -1;
+   }
+   if (opt.divisor = 15) {
+   fprintf(stderr, Illegal \divisor\, must be  
15\n);
+   return -1;
+   }
+   ok++;
} else if (strcmp(*argv, help) == 0) {
explain();
return -1;
-- 
1.5.3.4

-
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] Use nested compat attributes for passing parameters to the kernel.

2007-10-29 Thread Corey Hickey
Note that I have left sfq_print_opt() alone. At this point, there
can be no difference between the data in the nested rtattrs and the
data in the compat rtattr, and I didn't want to add clutter that
isn't useful. Let me know if I should do differently.

Signed-off-by: Corey Hickey [EMAIL PROTECTED]
---
 include/linux/pkt_sched.h |   14 ++
 tc/q_sfq.c|   18 --
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h
index fb04a89..aad04eb 100644
--- a/include/linux/pkt_sched.h
+++ b/include/linux/pkt_sched.h
@@ -148,6 +148,20 @@ struct tc_sfq_qopt
unsignedflows;  /* Maximal number of flows  */
 };
 
+enum
+{
+   TCA_SFQ_UNSPEC,
+   TCA_SFQ_COMPAT,
+   TCA_SFQ_QUANTUM,
+   TCA_SFQ_PERTURB,
+   TCA_SFQ_LIMIT,
+   TCA_SFQ_DIVISOR,
+   TCA_SFQ_FLOWS,
+   __TCA_SFQ_MAX,
+};
+
+#define TCA_SFQ_MAX (__TCA_SFQ_MAX - 1)
+
 /* RED section */
 
 enum
diff --git a/tc/q_sfq.c b/tc/q_sfq.c
index 83c8a54..69f17c8 100644
--- a/tc/q_sfq.c
+++ b/tc/q_sfq.c
@@ -34,9 +34,13 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
 {
int ok=0;
struct tc_sfq_qopt opt;
+   struct rtattr *nest;
 
memset(opt, 0, sizeof(opt));
 
+   /* put blank data in rtattr so there is a hole to fill later */
+   nest = addattr_nest_compat(n, 1024, TCA_OPTIONS, opt, sizeof(opt));
+
while (argc  0) {
if (strcmp(*argv, quantum) == 0) {
NEXT_ARG();
@@ -44,6 +48,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
fprintf(stderr, Illegal \limit\\n);
return -1;
}
+   addattr32(n, 1024, TCA_SFQ_QUANTUM, opt.quantum);
ok++;
} else if (strcmp(*argv, perturb) == 0) {
NEXT_ARG();
@@ -51,6 +56,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
fprintf(stderr, Illegal \perturb\\n);
return -1;
}
+   addattr32(n, 1024, TCA_SFQ_PERTURB, opt.perturb_period);
ok++;
} else if (strcmp(*argv, limit) == 0) {
NEXT_ARG();
@@ -62,6 +68,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
fprintf(stderr, Illegal \limit\, must be  
1\n);
return -1;
}
+   addattr32(n, 1024, TCA_SFQ_LIMIT, opt.limit);
ok++;
} else if (strcmp(*argv, depth) == 0) {
NEXT_ARG();
@@ -69,6 +76,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
fprintf(stderr, Illegal \depth\\n);
return -1;
}
+   addattr32(n, 1024, TCA_SFQ_FLOWS, opt.flows);
ok++;
} else if (strcmp(*argv, divisor) == 0) {
NEXT_ARG();
@@ -80,6 +88,7 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
fprintf(stderr, Illegal \divisor\, must be  
15\n);
return -1;
}
+   addattr32(n, 1024, TCA_SFQ_DIVISOR, opt.divisor);
ok++;
} else if (strcmp(*argv, help) == 0) {
explain();
@@ -92,8 +101,13 @@ static int sfq_parse_opt(struct qdisc_util *qu, int argc, 
char **argv, struct nl
argc--; argv++;
}
 
-   if (ok)
-   addattr_l(n, 1024, TCA_OPTIONS, opt, sizeof(opt));
+   if (ok) {
+   /* fill the hole we left earlier with real compat data */
+   memcpy(RTA_DATA(nest), opt, sizeof(opt));
+   addattr_nest_compat_end(n, nest);
+   }
+   else
+   nest-rta_len = 0;
return 0;
 }
 
-- 
1.5.3.4

-
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: last git: BUG: unable to handle kernel paging request at virtual address 92184900

2007-10-29 Thread Andrew Morton
On Tue, 23 Oct 2007 21:04:20 +0200 Giacomo Catenazzi [EMAIL PROTECTED] wrote:

 Hello people,
 
 I've still some kernel bug
 
 ciao
   cate
 
 Oct 23 20:20:05 catee kernel: BUG: unable to handle kernel paging request at 
 virtual address 92184900
 Oct 23 20:20:05 catee kernel: printing eip: c017b9c2 *pde = 
 Oct 23 20:20:05 catee kernel: Oops: 0002 [#1] SMP
 Oct 23 20:20:05 catee kernel: Modules linked in: fuse tuner tea5767 tda8290 
 tuner_simple mt20xx floppy bttv ir_common videobuf_dma_sg btcx_risc tveeprom
 Oct 23 20:20:05 catee kernel:
 Oct 23 20:20:05 catee kernel: Pid: 2191, comm: dirmngr Not tainted 
 (2.6.23-g0b776eb5 #16)
 Oct 23 20:20:05 catee kernel: EIP: 0060:[c017b9c2] EFLAGS: 00010203 CPU: 2
 Oct 23 20:20:05 catee kernel: EIP is at generic_drop_inode+0x5d/0x147
 Oct 23 20:20:05 catee kernel: EAX: c478b238 EBX: c478b228 ECX: c2491600 EDX: 
 c4d170b8
 Oct 23 20:20:05 catee kernel: ESI: c2405f40 EDI: c478b228 EBP: c4933940 ESP: 
 c3798e90
 Oct 23 20:20:05 catee kernel: DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
 Oct 23 20:20:05 catee kernel: Process dirmngr (pid: 2191, ti=c3798000 
 task=c2c99ab0 task.ti=c3798000)
 Oct 23 20:20:05 catee kernel: Stack: c478b228 c017b00d c5046314 c01791bf 
 c5046314 c2405f40 c017a0d7 0008
 Oct 23 20:20:05 catee kernel: c016b622 0010  c5046314 c478b228 
 c037f600 c478b200 c2832200
 Oct 23 20:20:05 catee kernel:  c02f9a4d  c20107b4 c2469ae0 
  0001 
 Oct 23 20:20:05 catee kernel: Call Trace:
 Oct 23 20:20:05 catee kernel: [c017b00d] iput+0x5c/0x62
 Oct 23 20:20:05 catee kernel: [c01791bf] d_kill+0x2b/0x44
 Oct 23 20:20:05 catee kernel: [c017a0d7] dput+0x6d/0xf3
 Oct 23 20:20:05 catee kernel: [c016b622] __fput+0x124/0x169
 Oct 23 20:20:05 catee kernel: [c02f9a4d] sys_accept+0x17b/0x1d8
 Oct 23 20:20:05 catee kernel: [c013527f] autoremove_wake_function+0x0/0x35
 Oct 23 20:20:05 catee kernel: [c013d617] tick_program_event+0x38/0x58
 Oct 23 20:20:05 catee kernel: [c02f9cb2] sys_socketcall+0x208/0x273
 Oct 23 20:20:05 catee kernel: [c0103fde] sysenter_past_esp+0x5f/0x85
 Oct 23 20:20:05 catee kernel: ===
 Oct 23 20:20:05 catee kernel: Code: 8b 43 14 89 42 04 89 10 8d 43 10 89 43 10 
 89 43 14 83 8b 44 01 00 00 20 83 2d 40 e8 49 c0 01 08 05 e4 27 41 c0 01 8b 83 
 e0 00 00 00 85 c0 0f 85 cd 00 00 00 89 d8 e8 e3 fd ff ff 89 d8 e8 b0 f5

Is this still happening in the latest Linus tree?

If so, please send some more oops traces so we can see if it's always happening
in the same place.

Please only send the first oops trace after a bootup: the one with [#1] in
the Oops: line.  All the others could be a consequence of the first.

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 8/8] Use nested compat attributes to pass parameters.

2007-10-29 Thread Corey Hickey
Corey Hickey wrote:
 +/* SFQ parameters exist as individual rtattr attributes, with a nested
 + * struct tc_sfq_qopt for compatibility with older userspace tools. If an
 + * individual attribute is set, we want to use it; otherwise, fall back to 
 the
 + * nested struct.
 + * There is one caveat: if a member of the nested struct is 0, we cannot
 + * determine if that parameter is supposed to be 0 or if it is merely unset.
 + * So, only set a parameter if the corresponding struct member (u32 compat) 
 is
 + * nonzero. When setting a parameter to 0, it is necessary to use the
 + * individual attribute. */
 +static inline int
 +sfq_get_parameter(u32 *dst, struct rtattr *tb[TCA_SFQ_MAX], int attr,
 +   u32 compat)
 +{
 + struct rtattr *rta = tb[(attr - 1)];
 + if (rta)
 + *dst = RTA_GET_U32(rta);
 + else if (compat)
 + *dst = compat;
 +
 + rtattr_failure:
 + return -EINVAL;
 +}
 + 
  static int
  sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
  {
 @@ -465,21 +488,24 @@ sfq_q_init(struct sfq_sched_data *q, struct rtattr *opt)
* the previous values (sfq_change). So, overwrite the parameters as
* specified. */
   if (opt) {
 - struct tc_sfq_qopt *ctl = RTA_DATA(opt);
 -
 - if (opt-rta_len  RTA_LENGTH(sizeof(*ctl)))
 - return -EINVAL;
 -
 - if (ctl-quantum)
 - q-quantum = ctl-quantum;
 - if (ctl-perturb_period)
 - q-perturb_period = ctl-perturb_period;
 - if (ctl-divisor)
 - q-hash_divisor = ctl-divisor;
 - if (ctl-flows)
 - q-depth = ctl-flows;
 - if (ctl-limit)
 - q-limit = ctl-limit;
 + struct tc_sfq_qopt *ctl;
 + struct rtattr *tb[TCA_SFQ_MAX];
 +
 + if (rtattr_parse_nested_compat(tb, TCA_SFQ_MAX, opt, ctl,
 + sizeof(*ctl)))
 + goto rtattr_failure;
 +
 + if (sfq_get_parameter((q-quantum),tb, TCA_SFQ_QUANTUM,
 + ctl-quantum)||
 + sfq_get_parameter((q-perturb_period), tb, TCA_SFQ_PERTURB,
 + ctl-perturb_period) ||
 + sfq_get_parameter((q-hash_divisor),   tb, TCA_SFQ_DIVISOR,
 + ctl-divisor)||
 + sfq_get_parameter((q-depth),  tb, TCA_SFQ_FLOWS,
 + ctl-flows)  ||
 + sfq_get_parameter((q-limit),  tb, TCA_SFQ_LIMIT,
 + ctl-limit))
 + goto rtattr_failure;
  

You may note that this part ended up being rather ugly, and I wouldn't
blame anyone for wanting it to be improved. I don't see any good
solutions; the alternatives I can provide are:

1. Use a macro, as I had originally written for this patch:
http://marc.info/?l=linux-netdevm=119102007907626w=2
(search for GET_PARAM)
The macro itself doesn't look pretty, but the usage is fairly clean.

2. Use neither macro nor function.
There would be five repetitions of very similar code, with five lines
per repetition: not very nice, but the formatting would still look better.

3. Only use a separate rtattr for perturb, since the other parameters
work fine already. From the start, I had wanted to keep parameter
parsing consistent, but it may not be worth it. This would definitely be
the cleanest approach for readability, and the most simple.


Sorry to bother you with such a superficial problem, but I really don't
know what would be preferable.

Thanks,
Corey
-
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: IPVS: use proper timeout instead of fixed value

2007-10-29 Thread David Miller
From: Simon Horman [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 16:05:55 +0900 (JST)

 From: Andy Gospodarek [EMAIL PROTECTED]
 
 Instead of using the default timeout of 3 minutes, this uses the timeout
 specific to the protocol used for the connection. The 3 minute timeout
 seems somewhat arbitrary (though I know it is used other places in the
 ipvs code) and when failing over it would be much nicer to use one of
 the configured timeout values.
 
 Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
 Acked-by: Simon Horman [EMAIL PROTECTED]

I would apply this but it does not apply to current 2.6.x,
please resubmit.

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.6.24-rc] [IPV6] NDISC: Fix setting base_reachable_time_ms variable.

2007-10-29 Thread David Miller
From: YOSHIFUJI Hideaki / 吉藤英明 [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 11:49:54 +0900 (JST)

 This bug was introduced by the commit
 d12af679bcf8995a237560bdf7a4d734f8df5dbb.
 
 Signed-off-by: YOSHIFUJI Hideaki [EMAIL PROTECTED]

Patch applied, thank you!
-
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: IPVS: use proper timeout instead of fixed value

2007-10-29 Thread Simon Horman
On Mon, Oct 29, 2007 at 01:35:15AM -0700, David Miller wrote:
 From: Simon Horman [EMAIL PROTECTED]
 Date: Mon, 29 Oct 2007 16:05:55 +0900 (JST)
 
  From: Andy Gospodarek [EMAIL PROTECTED]
  
  Instead of using the default timeout of 3 minutes, this uses the timeout
  specific to the protocol used for the connection. The 3 minute timeout
  seems somewhat arbitrary (though I know it is used other places in the
  ipvs code) and when failing over it would be much nicer to use one of
  the configured timeout values.
  
  Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
  Acked-by: Simon Horman [EMAIL PROTECTED]
 
 I would apply this but it does not apply to current 2.6.x,
 please resubmit.

I tried against net-2.6 and it seemed to work.
Was I mistaken or should I be using a different tree?

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

-
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: Oops in 2.6.21-rc4, 2.6.23

2007-10-29 Thread Jarek Poplawski
On 15-10-2007 17:39, Darko K. wrote:
 Hello,
 
 after recent upgrade to kernel 2.6.23 (from 2.6.20) I have started
 seeing kernel oops-es in networking code. The problem is 100%
 reproducible in my environment. I've seen two slightly different
 backtraces but both seem to be caused by the same commit. Please
 put me on Cc: on replies.
 
 I've performed the git bisect and tracked down the problem to the
 commit:
 
 53cdcc04c1e85d4e423b2822b66149b6f2e52c2c [TCP]: Fix tcp_mem[]
 initialization
 
 Once I reverse this commit in 2.6.23 the problem goes away (this
 is true also for the kernel version generated by git bisect,
 2.6.21-rc4).
 
 Description of my machine: Athlon XP1700, VIA KT-333 chipset, 512MB
 RAM, VIA rhine on-board NIC. The problem appears when approximately
 70% of RAM is in use and I start a large file transfer (via FTP)
 from another machine on the LAN. Sample output from free command:
total   used free   shared buffers cached
 Mem:  516508 510600 590801004 154084
 -/+ buffers/cache: 355512 160996
 Swap: 899600  25240 874360
 
 Backtrace #1:
 page allocation failure. order:1, mode:0x20
  [c0131581] __alloc_pages+0x2e1/0x300   
  [c0144bee] cache_alloc_refill+0x29e/0x4b0
  [c0144e6e] __kmalloc+0x6e/0x80
  [c0227103] __alloc_skb+0x53/0x110
  [c024de5c] tcp_collapse+0x1ac/0x370

Hi,

I hope you've found this by yourself by now, but:

1. These are warnings only - not oopses.
2. It seems this patch you've found to be responsible for this all
slightly changes some limits, which is not necessarily wrong; the
lucky thing is you can change these limits with sysctl or some
echos to /proc/sys/net/ipv4/tcp_mem, I presume. (Or more safely by
adding some memory.)

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


Re: [RFC][BNX2X] .h files rewrite

2007-10-29 Thread David Miller
From: Eliezer Tamir [EMAIL PROTECTED]
Date: Sun, 28 Oct 2007 22:21:14 +0200

Overall things look significantly better, thanks a lot!

However, there is still one set of magic constants in here
which I hope you can clear up:

 +static const struct raw_op init_ops[] = {
 +#define PRS_COMMON_START0
 + {OP_WR, PRS_REG_INC_VALUE, 0xf},
 + {OP_WR, PRS_REG_EVENT_ID_1, 0x45},
 + {OP_WR, PRS_REG_EVENT_ID_2, 0x84},
 + {OP_WR, PRS_REG_EVENT_ID_3, 0x6},
 + {OP_WR, PRS_REG_NO_MATCH_EVENT_ID, 0x4},
 + {OP_WR, PRS_REG_CM_HDR_TYPE_0, 0x0},
 + {OP_WR, PRS_REG_CM_HDR_TYPE_1, 0x1217},
 + {OP_WR, PRS_REG_CM_HDR_TYPE_2, 0x2217},
 + {OP_WR, PRS_REG_CM_HDR_TYPE_3, 0x3217},
 + {OP_ZR, PRS_REG_CM_HDR_TYPE_4, 0x5},
 + {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_1, 0x1215},
 + {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_2, 0x2215},
 + {OP_WR, PRS_REG_CM_HDR_LOOPBACK_TYPE_3, 0x3215},
 + {OP_ZR, PRS_REG_CM_HDR_LOOPBACK_TYPE_4, 0x4},
 etc. etc.

Take care.
-
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: Oops in 2.6.21-rc4, 2.6.23

2007-10-29 Thread David Miller
From: Jarek Poplawski [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 09:42:32 +0100

 I hope you've found this by yourself by now, but:
 
 1. These are warnings only - not oopses.
 2. It seems this patch you've found to be responsible for this all
 slightly changes some limits, which is not necessarily wrong; the
 lucky thing is you can change these limits with sysctl or some
 echos to /proc/sys/net/ipv4/tcp_mem, I presume. (Or more safely by
 adding some memory.)

Actually, this was caused by a real bug in the SKB_WITH_OVERHEAD macro
definition, which Herbert Xu quickly spotted and fixed.

Which I hope you've found this by yourself by now.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] r8169: don't call napi_disable if not doing NAPI

2007-10-29 Thread Romano Giannetti

On Fri, 2007-10-26 at 11:33 -0700, Stephen Hemminger wrote:
 Don't call napi_disable if not configured.
 And make sure that any misuse of napi_xxx in future fails
 with a compile error.
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
 

This fix the problem for me (at least, after 8 suspend/resume cycles). 
Thanks.

Tested-by: Romano Giannetti [EMAIL PROTECTED]

-- 
Sorry for the disclaimer --- ¡I cannot stop it!



--
La presente comunicación tiene carácter confidencial y es para el exclusivo uso 
del destinatario indicado en la misma. Si Ud. no es el destinatario indicado, 
le informamos que cualquier forma de distribución, reproducción o uso de esta 
comunicación y/o de la información contenida en la misma están estrictamente 
prohibidos por la ley. Si Ud. ha recibido esta comunicación por error, por 
favor, notifíquelo inmediatamente al remitente contestando a este mensaje y 
proceda a continuación a destruirlo. Gracias por su colaboración.

This communication contains confidential information. It is for the exclusive 
use of the intended addressee. If you are not the intended addressee, please 
note that any form of distribution, copying or use of this communication or the 
information in it is strictly prohibited by law. If you have received this 
communication in error, please immediately notify the sender by reply e-mail 
and destroy this message. Thank you for your cooperation. 
-
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: Please pull 'fixes-jgarzik' branch of wireless-2.6

2007-10-29 Thread Jeff Garzik

John W. Linville wrote:

Jeff,

A few fixes for 2.6.24...

Thanks,

John

---

Individual patches available here:


http://www.kernel.org/pub/linux/kernel/people/linville/wireless-2.6/fixes-jgarzik

---

The following changes since commit c9927c2bf4f45bb85e8b502ab3fb79ad6483c244:
  Linus Torvalds (1):
Linux 2.6.24-rc1

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git 
fixes-jgarzik

Anton Blanchard (3):
  ipw2100/ipw2200: jiffies_round - jiffies_round_relative
  rt2x00: jiffies_round - jiffies_round_relative
  b43/b43legacy: jiffies_round - jiffies_round_relative

Michael Wu (1):
  rtl8187: Allow multicast frames

Mohamed Abbas (3):
  iwl4965: fix scan problem
  iwl3945: cancel scan on rxon command
  iwl3945: fix direct scan problem

Tomas Winkler (1):
  iwlwifi: fix sending probe request in iwl 4965

mabbas (1):
  iwl4965: fix driver hang related to hardware scan

 drivers/net/wireless/b43/main.c |2 +-
 drivers/net/wireless/b43legacy/main.c   |2 +-
 drivers/net/wireless/ipw2100.c  |   11 +++--
 drivers/net/wireless/ipw2200.c  |6 +-
 drivers/net/wireless/iwlwifi/iwl-4965.c |6 +--
 drivers/net/wireless/iwlwifi/iwl3945-base.c |   56 +++
 drivers/net/wireless/iwlwifi/iwl4965-base.c |   56 +++
 drivers/net/wireless/rt2x00/rt2x00lib.h |2 +-
 drivers/net/wireless/rtl8187_dev.c  |   20 +
 9 files changed, 121 insertions(+), 40 deletions(-)


pulled


-
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] ehea: add kexec support

2007-10-29 Thread Jeff Garzik

Jan-Bernd Themann wrote:

eHEA resources that are allocated via H_CALLs have a unique identifier each.
These identifiers are necessary to free the resources. A reboot notifier
is used to free all eHEA resources before the indentifiers get lost, i.e
before kexec starts a new kernel.

Signed-off-by: Jan-Bernd Themann [EMAIL PROTECTED]


applied to #upstream-fixes


-
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 00/04] pull request for 'upstream-jeff' branch

2007-10-29 Thread Jeff Garzik

Francois Romieu wrote:

Please pull from branch 'upstream-jeff' in repository

git://git.kernel.org/pub/scm/linux/kernel/git/romieu/netdev-2.6.git 
upstream-jeff

to get the changes below.

Distance from 'master' (96fd4cd3e40e240f0c385af87f58e74da8b7099a)
-

d1417862d7355f0b395d83f2884afd614b086695
bbd82f956e0db6190b16a8a00d3ed5d979f488e8
93dd79e87bbc98ef02610d54fe72d4a1931ee15e
7fab06c0ca89d99442a4baeddf417add585e2672

Diffstat


 drivers/net/Kconfig |   13 +++--
 drivers/net/r8169.c |   12 ++--
 2 files changed, 13 insertions(+), 12 deletions(-)

Shortlog


Francois Romieu (2):
  ipg: missing Kconfig dependency
  ipg: Kconfig whitepaces/tab damages

Stephen Hemminger (2):
  r8169: napi config
  r8169: remove poll_locked logic


pulled


-
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] Fix ethernet multicast for ucc_geth.

2007-10-29 Thread Jeff Garzik

Joakim Tjernlund wrote:

From 5761a9e5924b34615c748fba2dcb977ed04c1243 Mon Sep 17 00:00:00 2001

From: Joakim Tjernlund [EMAIL PROTECTED]
Date: Wed, 17 Oct 2007 11:01:44 +0200
Subject: [PATCH] Fix ethernet multicast for ucc_geth.
 hw_add_addr_in_hash() already swaps byte
 order, don't do it in ucc_geth_set_multi() too.


Signed-off-by: Joakim Tjernlund [EMAIL PROTECTED]
---
 drivers/net/ucc_geth.c |   15 ++-
 1 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 61f5cce..f649b1e 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -2214,9 +2214,7 @@ static void ucc_geth_set_multi(struct net_device *dev)
struct dev_mc_list *dmi;
struct ucc_fast *uf_regs;
struct ucc_geth_82xx_address_filtering_pram *p_82xx_addr_filt;
-   u8 tempaddr[6];
-   u8 *mcptr, *tdptr;
-   int i, j;
+   int i;
 
 	ugeth = netdev_priv(dev);
 
@@ -2255,19 +2253,10 @@ static void ucc_geth_set_multi(struct net_device *dev)

if (!(dmi-dmi_addr[0]  1))
continue;
 
-/* The address in dmi_addr is LSB first,

-* and taddr is MSB first.  We have to
-* copy bytes MSB first from dmi_addr.
-*/
-   mcptr = (u8 *) dmi-dmi_addr + 5;
-   tdptr = (u8 *) tempaddr;
-   for (j = 0; j  6; j++)
-   *tdptr++ = *mcptr--;
-
/* Ask CPM to run CRC and set bit in
 * filter mask.
 */
-   hw_add_addr_in_hash(ugeth, tempaddr);
+   hw_add_addr_in_hash(ugeth, dmi-dmi_addr);


did the maintainer ever ACK this?


-
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] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ

2007-10-29 Thread Jeff Garzik

Auke Kok wrote:

Trivial replacement - use INT_MAX instead here.

Signed-off-by: Auke Kok [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
---

 drivers/net/sk98lin/skethtool.c |4 ++--
 drivers/net/skge.c  |8 
 drivers/net/sky2.c  |8 
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/net/sk98lin/skethtool.c b/drivers/net/sk98lin/skethtool.c
index 5a6da89..4549b97 100644
--- a/drivers/net/sk98lin/skethtool.c
+++ b/drivers/net/sk98lin/skethtool.c
@@ -430,8 +430,8 @@ static int locateDevice(struct net_device *dev, u32 data)
DEV_NET *pNet = netdev_priv(dev);
SK_AC *pAC = pNet-pAC;
 
-	if(!data || data  (u32)(MAX_SCHEDULE_TIMEOUT / HZ))

-   data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
+   if (!data)
+   data = INT_MAX;
 
 	/* start blinking */

pAC-LedsOn = 0;
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b9961dc..696a79e 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -783,10 +783,10 @@ static int skge_phys_id(struct net_device *dev, u32 data)
unsigned long ms;
enum led_mode mode = LED_MODE_TST;
 
-	if (!data || data  (u32)(MAX_SCHEDULE_TIMEOUT / HZ))

-   ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000;
-   else
-   ms = data * 1000;
+   if (!data)
+   data = INT_MAX;
+
+   ms = data * HZ;
 
 	while (ms  0) {

skge_led(skge, mode);
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index c27c7d6..1381d04 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -3336,10 +3336,10 @@ static int sky2_phys_id(struct net_device *dev, u32 
data)
int interrupted;
int onoff = 1;
 
-	if (!data || data  (u32) (MAX_SCHEDULE_TIMEOUT / HZ))

-   ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT);
-   else
-   ms = data * 1000;
+   if (!data)
+   data = INT_MAX:
+
+   ms = data * HZ;


ditto comments in previous email...

-
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 v4.3] FEC - fast ethernet controller for mpc52xx

2007-10-29 Thread Jeff Garzik

Domen Puncer wrote:

On 26/10/07 07:18 -0700, Dale Farnsworth wrote:

On Fri, Oct 26, 2007 at 01:59:09PM +0200, Domen Puncer wrote:

+static irqreturn_t mpc52xx_fec_tx_interrupt(int irq, void *dev_id)
+{
+   struct net_device *dev = dev_id;
+   struct mpc52xx_fec_priv *priv = netdev_priv(dev);
+
+   spin_lock(priv-lock);
+
+   while (bcom_buffer_done(priv-tx_dmatsk)) {
+   struct sk_buff *skb;
+   struct bcom_fec_bd *bd;
+   skb = bcom_retrieve_buffer(priv-tx_dmatsk, NULL,
+   (struct bcom_bd **)bd);
+   /* Here (and in rx routines) would be a good place for
+* dma_unmap_single(), but bcom doesn't return bcom_bd of the
+* finished transfer, and _unmap is empty on this platfrom.
+*/

Oops, you forgot to remove the above comment.  :)


Argh!

Repost w/o the comment.
Sorry for receiving all this almost-spam.



Otherwise,
Acked-by: Dale Farnsworth [EMAIL PROTECTED]

Domen, thanks for all your work on this.  It's good to see it finally go in.

-Dale


--- again, use your scisors here ;-) ---


Driver for ethernet on mpc5200/mpc5200b SoCs (FEC).


Signed-off-by: Domen Puncer [EMAIL PROTECTED]
Acked-by: Dale Farnsworth [EMAIL PROTECTED]

---
 drivers/net/Kconfig   |   24 
 drivers/net/Makefile  |4 
 drivers/net/fec_mpc52xx.c | 1112 ++

 drivers/net/fec_mpc52xx.h |  313 +++
 drivers/net/fec_mpc52xx_phy.c |  198 +++
 5 files changed, 1651 insertions(+)


applied to #upstream-fixes

it's not strictly a fix, but I did not want to hold this back until 
2.6.25 either



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


Re: [PATCH 2.6.24 1/1]S2io: Fixed memory leak by freeing MSI-X local entry memories when vector allocation fails

2007-10-29 Thread Jeff Garzik

Sivakumar Subramani wrote:

- Fixed memory leak by freeing MSI-X local entry memories when vector allocation
fails in s2io_add_isr.
- Added two utility functions do_rem_msix_isr and do_rem_inta_isr to eliminate
code duplication.

Signed-off-by: Veena Parat [EMAIL PROTECTED]
Signed-off-by: Ramkrishna Vepa [EMAIL PROTECTED]
Signed-off-by: Santosh Rastapur [EMAIL PROTECTED]


Comments:

1) stats-mem_freed is redundant to general kernel debugging facilities

2) synchronize_irq() is redundant, free_irq() does same

3) rem isn't very clear.  few if any other kernel drivers use this to 
indicate remove


4) do_ prefix is redundant

5) scripts/checkpatch.pl fails on this patch.  please clean up problems.

The main issue for this patch is #2, though presumably the other stuff 
can be cleaned on the next resubmit



-
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] pcnet: fix sparse triviality

2007-10-29 Thread Jeff Garzik

Auke Kok wrote:

Since data can never exceed u32, it can't even be larger than LONG_MAX/HZ.

Signed-off-by: Auke Kok [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
---

 drivers/net/pcnet32.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index ff92aca..3573e77 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -1101,9 +1101,8 @@ static int pcnet32_phys_id(struct net_device *dev, u32 
data)
mod_timer(lp-blink_timer, jiffies);
set_current_state(TASK_INTERRUPTIBLE);
 
-	/* AV: the limit here makes no sense whatsoever */

-   if ((!data) || (data  (u32) (MAX_SCHEDULE_TIMEOUT / HZ)))
-   data = (u32) (MAX_SCHEDULE_TIMEOUT / HZ);
+   if (!data)
+   data = INT_MAX;
 
 	msleep_interruptible(data * 1000);

del_timer_sync(lp-blink_timer);


Two comments:

1) I would prefer to pick a sane limit, like 1 day.  The unit of 
'data' is seconds, so IMO we should not allow stupid timeouts, much less 
INT_MAX ones :)  But hey, then again, maybe we should permit root to 
hang themselves with own rope...


2) [tangent] someone really should add the obvious ssleep_interruptible()

-
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] Fix ethernet multicast for ucc_geth.

2007-10-29 Thread Li Yang-r58472

  @@ -2255,19 +2253,10 @@ static void 
 ucc_geth_set_multi(struct net_device *dev)
  if (!(dmi-dmi_addr[0]  1))
  continue;
   
  -   /* The address in dmi_addr is LSB first,
  -* and taddr is MSB first.  We have to
  -* copy bytes MSB first from dmi_addr.
  -*/
  -   mcptr = (u8 *) dmi-dmi_addr + 5;
  -   tdptr = (u8 *) tempaddr;
  -   for (j = 0; j  6; j++)
  -   *tdptr++ = *mcptr--;
  -
  /* Ask CPM to run CRC and set bit in
   * filter mask.
   */
  -   hw_add_addr_in_hash(ugeth, tempaddr);
  +   hw_add_addr_in_hash(ugeth, 
 dmi-dmi_addr);
 
 did the maintainer ever ACK this?

Yes, I did.  :)

- Leo
-
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] Fix ethernet multicast for ucc_geth.

2007-10-29 Thread Jeff Garzik

Joakim Tjernlund wrote:

From 5761a9e5924b34615c748fba2dcb977ed04c1243 Mon Sep 17 00:00:00 2001

From: Joakim Tjernlund [EMAIL PROTECTED]
Date: Wed, 17 Oct 2007 11:01:44 +0200
Subject: [PATCH] Fix ethernet multicast for ucc_geth.
 hw_add_addr_in_hash() already swaps byte
 order, don't do it in ucc_geth_set_multi() too.


Signed-off-by: Joakim Tjernlund [EMAIL PROTECTED]
---
 drivers/net/ucc_geth.c |   15 ++-
 1 files changed, 2 insertions(+), 13 deletions(-)


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: [PATCH 2.6.24 1/1]S2io: Support for add/delete/store/restore ethernet addresses

2007-10-29 Thread Sreenivasa Honnur
Jeff,
Is this patch reviewed/applied?

-srini 

-Original Message-
From: Sreenivasa Honnur [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 19, 2007 11:23 AM
To: [EMAIL PROTECTED]; netdev@vger.kernel.org
Cc: support
Subject: [PATCH 2.6.24 1/1]S2io: Support for add/delete/store/restore
ethernet addresses

- Support to add/delete/store/restore 64 and 128 Ethernet addresses for
Xframe I and Xframe II respectively.

Signed-off-by: Sreenivasa Honnur [EMAIL PROTECTED]
---
diff -urpN org/drivers/net/s2io.c patch_1/drivers/net/s2io.c
--- org/drivers/net/s2io.c  2007-09-26 00:01:14.0 +0530
+++ patch_1/drivers/net/s2io.c  2007-09-26 22:42:11.0 +0530
@@ -84,7 +84,7 @@
 #include s2io.h
 #include s2io-regs.h
 
-#define DRV_VERSION 2.0.26.5
+#define DRV_VERSION 2.0.26.6
 
 /* S2io Driver name  version. */
 static char s2io_driver_name[] = Neterion; @@ -3363,6 +3363,9 @@
static void s2io_reset(struct s2io_nic *
/* Set swapper to enable I/O register access */
s2io_set_swapper(sp);
 
+   /* restore mac address entries */
+   do_s2io_restore_unicast_mc(sp);
+
/* Restore the MSIX table entries from local variables */
restore_xmsi_data(sp);
 
@@ -3421,9 +3424,6 @@ static void s2io_reset(struct s2io_nic *
writeq(val64, bar0-pcc_err_reg);
}
 
-   /* restore the previously assigned mac address */
-   do_s2io_prog_unicast(sp-dev, (u8
*)sp-def_mac_addr[0].mac_addr);
-
sp-device_enabled_once = FALSE;
 }
 
@@ -3896,8 +3896,17 @@ hw_init_failed:
 static int s2io_close(struct net_device *dev)  {
struct s2io_nic *sp = dev-priv;
+   struct config_param *config = sp-config;
+   u64 tmp64;
+   int off;
 
netif_stop_queue(dev);
+   /* delete all populated mac entries */
+   for(off =1; off  config-max_mc_addr; off++) {
+   tmp64 = do_s2io_read_unicast_mc(sp,off);
+   if(tmp64 != S2IO_DISABLE_MAC_ENTRY)
+   do_s2io_delete_unicast_mc(sp, tmp64);
+   }
napi_disable(sp-napi);
/* Reset card, kill tasklet and free Tx and Rx buffers. */
s2io_card_down(sp);
@@ -4699,8 +4708,9 @@ static void s2io_set_multicast(struct ne
struct XENA_dev_config __iomem *bar0 = sp-bar0;
u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
0xfeffULL;
-   u64 dis_addr = 0xULL, mac_addr = 0;
+   u64 dis_addr = S2IO_DISABLE_MAC_ENTRY, mac_addr = 0;
void __iomem *add;
+   struct config_param *config = sp-config;
 
if ((dev-flags  IFF_ALLMULTI)  (!sp-m_cast_flg)) {
/*  Enable all Multicast addresses */ @@ -4710,7 +4720,7
@@ static void s2io_set_multicast(struct ne
   bar0-rmac_addr_data1_mem);
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
-   RMAC_ADDR_CMD_MEM_OFFSET(MAC_MC_ALL_MC_ADDR_OFFSET);
+   RMAC_ADDR_CMD_MEM_OFFSET(config-max_mc_addr -
1);
writeq(val64, bar0-rmac_addr_cmd_mem);
/* Wait till command completes */
wait_for_cmd_complete(bar0-rmac_addr_cmd_mem,
@@ -4718,7 +4728,7 @@ static void s2io_set_multicast(struct ne
S2IO_BIT_RESET);
 
sp-m_cast_flg = 1;
-   sp-all_multi_pos = MAC_MC_ALL_MC_ADDR_OFFSET;
+   sp-all_multi_pos = config-max_mc_addr - 1;
} else if ((dev-flags  IFF_ALLMULTI)  (sp-m_cast_flg)) {
/*  Disable all Multicast addresses */
writeq(RMAC_ADDR_DATA0_MEM_ADDR(dis_addr),
@@ -4787,7 +4797,7 @@ static void s2io_set_multicast(struct ne
/*  Update individual M_CAST address list */
if ((!sp-m_cast_flg)  dev-mc_count) {
if (dev-mc_count 
-   (MAX_ADDRS_SUPPORTED - MAC_MC_ADDR_START_OFFSET -
1)) {
+   (config-max_mc_addr - config-max_mac_addr)) {
DBG_PRINT(ERR_DBG, %s: No more Rx filters ,
  dev-name);
DBG_PRINT(ERR_DBG, can be added, please enable
); @@ -4807,7 +4817,7 @@ static void s2io_set_multicast(struct ne
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
RMAC_ADDR_CMD_MEM_OFFSET
-   (MAC_MC_ADDR_START_OFFSET + i);
+   (config-mc_start_offset + i);
writeq(val64, bar0-rmac_addr_cmd_mem);
 
/* Wait for command completes */
@@ -4839,7 +4849,7 @@ static void s2io_set_multicast(struct ne
val64 = RMAC_ADDR_CMD_MEM_WE |
RMAC_ADDR_CMD_MEM_STROBE_NEW_CMD |
RMAC_ADDR_CMD_MEM_OFFSET
-   (i + MAC_MC_ADDR_START_OFFSET);
+  

Re: HFSC dangerous behaviour (not a bug)

2007-10-29 Thread Patrick McHardy

Denys wrote:

Hi All

During testing i found very strange thing. 
After applying even example shaper:

http://linux-ip.net/tc/hfsc.en/
-
[...]
---
I had all traffic on eth0 stopped. Tried on br0 - same result. Even ARP 
becoming non-functional.


After specifying correct default class everything worked fine.

In HTB if you dont specify default class, traffic just pass without 
shaping. 



HFSC drops unclassified packets. If you don't classify ARP properly,
things will break,


Is it possible to keep same behaviour on both disciplines?
Probably just dropping all traffic not good idea, cause if user working on 
remote box by forgetting specifying default class or by mistake using 
incorrect class number he will loose access to the box, if same interface is 
used for tests on shaping and access.
In same time it is good, and can show accurate results on shaping, without 
bypassing some forgotten traffic.

But at least it must be same, IMHO, on HTB and HFSC.



This came up a couple of times already. I don't like HTB's behaviour
since you don't notice when your classifiers are incomplete. So I'm
against changing HFSC to behave similar. HTB OTOH can't be changed
since users probably rely on that, not classifying ARP is a common
mistake.

-
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: HFSC dangerous behaviour (not a bug)

2007-10-29 Thread Patrick McHardy

Denys wrote:
Additionally, it doesn't show rate in stats (so it is difficult to measure, 
how much is really using each class).


qdisc hfsc 1: root default 200
 Sent 1392761062 bytes 965768 pkt (dropped 52, overlimits 1620539 requeues 0)
 rate 0bit 0pps backlog 0b 0p requeues 0



Thats what rate estimators are for. Add something like estimator 1 4
to your qdisc and class creation commands to measure the rate.


-
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] ucc_geth: add support for netpoll

2007-10-29 Thread Anton Vorontsov
On Mon, Oct 29, 2007 at 02:12:07PM +0800, Li Yang-r58472 wrote:
[...]
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send 
+skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void ucc_netpoll(struct net_device *dev) {
+   struct ucc_geth_private *ugeth = netdev_priv(dev);
+
+   disable_irq(ugeth-ug_info-uf_info.irq);
+   ucc_geth_irq_handler(ugeth-ug_info-uf_info.irq, dev);
+   enable_irq(ugeth-ug_info-uf_info.irq);
   
   Why not make it less complex (for a reader and gcc too :-) ?
  
  Yup, I'm agree here but it's too late. Again. ;-)
  
  This patch already accepted into the -mm (a week or so after 
  the silence), so.. now I'd rather not bother Andrew with such 
  really cosmetic changes. But if Jeff would directly apply 
  modfied patch, I'll send it. ;-)
 
 Oops.  The original patch happened to hit the Junk mail box. :(

That one as well? http://lkml.org/lkml/2007/10/11/128

 I think
 the patch is good to merge after the cosmetic change.  I can do it in
 next pull request to Jeff.

Ok, great. Thanks.

Here it is:

- - - -
From: Anton Vorontsov [EMAIL PROTECTED]
Subject: [PATCH] ucc_geth: add support for netpoll

This patch adds netpoll support for the QE UCC Gigabit Ethernet
driver. Tested using netconsole and KGDBoE.

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 drivers/net/ucc_geth.c |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index bec413b..94e78d8 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3678,6 +3678,23 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void 
*info)
return IRQ_HANDLED;
 }
 
+#ifdef CONFIG_NET_POLL_CONTROLLER
+/*
+ * Polling 'interrupt' - used by things like netconsole to send skbs
+ * without having to re-enable interrupts. It's not called while
+ * the interrupt routine is executing.
+ */
+static void ucc_netpoll(struct net_device *dev)
+{
+   struct ucc_geth_private *ugeth = netdev_priv(dev);
+   int irq = ugeth-ug_info-uf_info.irq;
+
+   disable_irq(irq);
+   ucc_geth_irq_handler(irq, dev);
+   enable_irq(irq);
+}
+#endif /* CONFIG_NET_POLL_CONTROLLER */
+
 /* Called when something needs to use the ethernet device */
 /* Returns 0 for success. */
 static int ucc_geth_open(struct net_device *dev)
@@ -3963,6 +3980,9 @@ static int ucc_geth_probe(struct of_device* ofdev, const 
struct of_device_id *ma
 #ifdef CONFIG_UGETH_NAPI
netif_napi_add(dev, ugeth-napi, ucc_geth_poll, UCC_GETH_DEV_WEIGHT);
 #endif /* CONFIG_UGETH_NAPI */
+#ifdef CONFIG_NET_POLL_CONTROLLER
+   dev-poll_controller = ucc_netpoll;
+#endif
dev-stop = ucc_geth_close;
 //dev-change_mtu = ucc_geth_change_mtu;
dev-mtu = 1500;
-- 
1.5.2.2

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


Re: HFSC dangerous behaviour (not a bug)

2007-10-29 Thread Denys
After thinking about that, i can say only thanks.
I like your idea, and it is better to avoid mistakes and missed traffic, then 
have a lot of complaints from users why my shaper not working well. And 
seems i will try to switch to HFSC.

Thanks for explanation.

On Mon, 29 Oct 2007 11:55:31 +0100, Patrick McHardy wrote
 Denys wrote:
  Hi All
  
  During testing i found very strange thing. 
  After applying even example shaper:
  http://linux-ip.net/tc/hfsc.en/
  -
  [...]
  ---
  I had all traffic on eth0 stopped. Tried on br0 - same result. Even ARP 
  becoming non-functional.
  
  After specifying correct default class everything worked fine.
  
  In HTB if you dont specify default class, traffic just pass without 
  shaping.
 
 HFSC drops unclassified packets. If you don't classify ARP properly,
 things will break,
 
  Is it possible to keep same behaviour on both disciplines?
  Probably just dropping all traffic not good idea, cause if user working 
on 
  remote box by forgetting specifying default class or by mistake using 
  incorrect class number he will loose access to the box, if same interface 
is 
  used for tests on shaping and access.
  In same time it is good, and can show accurate results on shaping, 
without 
  bypassing some forgotten traffic.
  But at least it must be same, IMHO, on HTB and HFSC.
 
 This came up a couple of times already. I don't like HTB's behaviour
 since you don't notice when your classifiers are incomplete. So I'm
 against changing HFSC to behave similar. HTB OTOH can't be changed
 since users probably rely on that, not classifying ARP is a common
 mistake.
 
 -
 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


--
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: IPVS: use proper timeout instead of fixed value

2007-10-29 Thread Andy Gospodarek
On Mon, Oct 29, 2007 at 04:05:55PM +0900, Simon Horman wrote:
 From: Andy Gospodarek [EMAIL PROTECTED]
 
 Instead of using the default timeout of 3 minutes, this uses the timeout
 specific to the protocol used for the connection. The 3 minute timeout
 seems somewhat arbitrary (though I know it is used other places in the
 ipvs code) and when failing over it would be much nicer to use one of
 the configured timeout values.
 
 Signed-off-by: Andy Gospodarek [EMAIL PROTECTED]
 Acked-by: Simon Horman [EMAIL PROTECTED]
 

Thanks for re-visiting this, Simon!  It's too bad that the other work
never got done, but I'm glad to see this will get included.

-
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: [UDP6]: Restore sk_filter optimisation

2007-10-29 Thread Herbert Xu
On Mon, Oct 29, 2007 at 03:33:20PM +0900, Mitsuru Chinen wrote:
 Hello Herbert,
 
 Let me ask a question about this patch.
 After this patch was applied, 2 of the protocol stack behaviors were
 changed when it receives a UDP datagram with broken checksum:
 
  1. udp6InDatagrams is incremented instead of udpInErrors
  2. In userland, recvfrom() replies an error with EAGAIN.
 recvfrom() wasn't aware of such a packet before.
 
 Are these changes intentional?

It wasn't my intention if that's what you mean :)

However, this would've happened with the old code anyway if
someone had a filter attached so this isn't new.

If it's a problem then we should just get it fixed.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] proc_fs.h redux

2007-10-29 Thread Arnaldo Carvalho de Melo
Em Sun, Oct 28, 2007 at 09:44:41AM +0100, Sam Ravnborg escreveu:
  
  As a general rule, I think it better to use includes
  than use naked forward declarations.
 
 Quite the opposite - at least in the kernel source.
 The general rule is that a .h file shall include the
 .h files which contain declarations used by said .h files.
 But naked declarations as above is preferred over including
 a full header file.

yup
 
 We see the full header dependency thing to blow off when
 inline function are used - which is more and more the case.
 In several cases we have converted inline functions to macros
 just to simplify the nightmare of header dependencies we have.
 
 Arnaldo have a nice script that generate a .ps file
 showing all the dependencies.
 He lately posted this URL: http://oops.ghostprotocols.net:81/acme/tcp.h.ps

Well, not lately, it has been quite a while. But lets celebrate the
fact that there is somebody trying to fight this battle one more time
and update this tcp.h dependency tree... /me looks for hviz... and if
graphviz is installed, ok:

http://www.kernel.org/pub/linux/kernel/people/acme/hviz

hviz include/linux/tcp.h 10 | dot -Tpdf  /tmp/tcp.h.2007_11.pdf

http://oops.ghostprotocols.net:81/acme/tcp.h.2007_11.pdf

We still get to sched.h, but before it was:

linux/tcp.h - linux/skbuff.h - linux/mm.h - linux/sched.h

Nowadays its:

linux/tcp.h - linux/sock.h - linux/netdevice.h - linux/interrupt.h - 
linux/sched.h

And I just removed #include linux/sched.h from linux/interrupt.h,
because as far as I checked it is completely unnecessary, and the
kernel builds just fine :-)

- Arnaldo
-
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: Oops in 2.6.21-rc4, 2.6.23

2007-10-29 Thread Jarek Poplawski
On Mon, Oct 29, 2007 at 01:41:47AM -0700, David Miller wrote:
 From: Jarek Poplawski [EMAIL PROTECTED]
 Date: Mon, 29 Oct 2007 09:42:32 +0100
 
  I hope you've found this by yourself by now, but:
  
  1. These are warnings only - not oopses.
  2. It seems this patch you've found to be responsible for this all
  slightly changes some limits, which is not necessarily wrong; the
  lucky thing is you can change these limits with sysctl or some
  echos to /proc/sys/net/ipv4/tcp_mem, I presume. (Or more safely by
  adding some memory.)
 
 Actually, this was caused by a real bug in the SKB_WITH_OVERHEAD macro
 definition, which Herbert Xu quickly spotted and fixed.

But, since Darko has found this other patch matters for him too, maybe
there could be more than one cause to 'blame' for such differences
from 2.6.20 (maybe it's not all yet) - especially if it's all around
some limits.

 
 Which I hope you've found this by yourself by now.
 

I think it's unfair! Darko got 2 weeks for thinking about this all...

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


e1000 and ICH9 hardware

2007-10-29 Thread Daniel Drake

Hi,

Are there any plans to add ICH9 support to the e1000 driver (I note 
there is a patch floating around), or is the intention that ICH9 users 
all move to e1000e?


Just wondering which approach to take in terms of getting this hardware 
supported in Gentoo's 2.6.23 kernels.


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: e1000 and ICH9 hardware

2007-10-29 Thread Jeff Garzik

Daniel Drake wrote:
Are there any plans to add ICH9 support to the e1000 driver (I note 
there is a patch floating around), or is the intention that ICH9 users 
all move to e1000e?


They all should use e1000e.

Further, in 2.6.25 or so, some e1000 PCI IDs will be moved to e1000e, 
and support removed in e1000.


e1000 is being frozen in time as pre-PCI Express e1000's.

Jeff



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


Re: [2.6 patch] remove Documentation/networking/net-modules.txt

2007-10-29 Thread Pekka Pietikainen
On Wed, Oct 24, 2007 at 06:25:03PM +0200, Adrian Bunk wrote:
 According to git, the only one who touched this file during the last
 5 years was me when removing drivers...

That's not the only obsolete thing there:
  ncsa-telnet
   - notes on how NCSA telnet (DOS) breaks with MTU discovery enabled.
And probably others too. Then again, the information there isn't wrong, it's
just totally useless these days :P

-- 
Pekka Pietikainen
-
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] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ

2007-10-29 Thread Stephen Hemminger
On Mon, 29 Oct 2007 06:05:14 -0400
Jeff Garzik [EMAIL PROTECTED] wrote:

 Auke Kok wrote:
  Trivial replacement - use INT_MAX instead here.
  
  Signed-off-by: Auke Kok [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  ---
  
   drivers/net/sk98lin/skethtool.c |4 ++--
   drivers/net/skge.c  |8 
   drivers/net/sky2.c  |8 
   3 files changed, 10 insertions(+), 10 deletions(-)
  
  diff --git a/drivers/net/sk98lin/skethtool.c 
  b/drivers/net/sk98lin/skethtool.c
  index 5a6da89..4549b97 100644
  --- a/drivers/net/sk98lin/skethtool.c
  +++ b/drivers/net/sk98lin/skethtool.c
  @@ -430,8 +430,8 @@ static int locateDevice(struct net_device *dev, u32 
  data)
  DEV_NET *pNet = netdev_priv(dev);
  SK_AC *pAC = pNet-pAC;
   
  -   if(!data || data  (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
  -   data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
  +   if (!data)
  +   data = INT_MAX;
   
  /* start blinking */
  pAC-LedsOn = 0;
  diff --git a/drivers/net/skge.c b/drivers/net/skge.c
  index b9961dc..696a79e 100644
  --- a/drivers/net/skge.c
  +++ b/drivers/net/skge.c
  @@ -783,10 +783,10 @@ static int skge_phys_id(struct net_device *dev, u32 
  data)
  unsigned long ms;
  enum led_mode mode = LED_MODE_TST;
   
  -   if (!data || data  (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
  -   ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000;
  -   else
  -   ms = data * 1000;
  +   if (!data)
  +   data = INT_MAX;
  +
  +   ms = data * HZ;
   
  while (ms  0) {
  skge_led(skge, mode);
  diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
  index c27c7d6..1381d04 100644
  --- a/drivers/net/sky2.c
  +++ b/drivers/net/sky2.c
  @@ -3336,10 +3336,10 @@ static int sky2_phys_id(struct net_device *dev, u32 
  data)
  int interrupted;
  int onoff = 1;
   
  -   if (!data || data  (u32) (MAX_SCHEDULE_TIMEOUT / HZ))
  -   ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT);
  -   else
  -   ms = data * 1000;
  +   if (!data)
  +   data = INT_MAX:
  +
  +   ms = data * HZ;
 
 ditto comments in previous email...

Since these all use ethtool, shouldn't the checks be put into ethtool_phys_id
rather than having the driver check?


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


Re: [PATCH v4.3] FEC - fast ethernet controller for mpc52xx

2007-10-29 Thread Grant Likely
On 10/29/07, Jeff Garzik [EMAIL PROTECTED] wrote:
 Domen Puncer wrote:
   drivers/net/Kconfig   |   24
   drivers/net/Makefile  |4
   drivers/net/fec_mpc52xx.c | 1112 
  ++
   drivers/net/fec_mpc52xx.h |  313 +++
   drivers/net/fec_mpc52xx_phy.c |  198 +++
   5 files changed, 1651 insertions(+)

 applied to #upstream-fixes

 it's not strictly a fix, but I did not want to hold this back until
 2.6.25 either

Fantastic!  Thanks Jeff.

g.


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
-
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] skye/skge: sparse fix - data can't ever be bigger than LONG_MAX / HZ

2007-10-29 Thread Jeff Garzik

Stephen Hemminger wrote:

Since these all use ethtool, shouldn't the checks be put into ethtool_phys_id
rather than having the driver check?


Seems quite reasonable to me.

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: [E1000-devel] e1000 and ICH9 hardware

2007-10-29 Thread David A. Ranch



e1000 is being frozen in time as pre-PCI Express e1000's.
  
Asking the question a different way, will the current e1000 driver 
continue to get new features, performance / power / optimization tweaks, 
etc. or is most of the primary development be moving only on the e1000e kit?


--David

-
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: [E1000-devel] e1000 and ICH9 hardware

2007-10-29 Thread Kok, Auke
David A. Ranch wrote:
 e1000 is being frozen in time as pre-PCI Express e1000's.
   
 Asking the question a different way, will the current e1000 driver 
 continue to get new features, performance / power / optimization tweaks, 
 etc. or is most of the primary development be moving only on the e1000e kit?

the ultimate goal is to move all the pci-express hardware support over to 
e1000e.

since the pci/pci-x generation e1000 chipsets do not have nearly the amount of
features that the pci-e silicon has, you can expect the e1000 driver to be
significantly stripped down.

We do however want to keep any feature that is supported for the pci/pci-x
hardware in e1000 active. we will not disable TSO for instance. As for other
features we will decide whatever makes best sense for the hardware. (e.g. none 
of
the 8254x chipsets support multiple queues).

All of the primary development of features will focus on e1000e.

Auke
-
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/4] e1000: sparse warnings fixes

2007-10-29 Thread Auke Kok
From: Stephen Hemminger [EMAIL PROTECTED]

Fix sparse warnings and problems from e1000 driver.

Added a sparse fix for the module param array index
-- Auke

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

 drivers/net/e1000/e1000.h |8 
 drivers/net/e1000/e1000_ethtool.c |   29 -
 drivers/net/e1000/e1000_hw.c  |4 ++--
 drivers/net/e1000/e1000_main.c|7 ++-
 drivers/net/e1000/e1000_param.c   |   23 ---
 5 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
index 781ed99..3b84028 100644
--- a/drivers/net/e1000/e1000.h
+++ b/drivers/net/e1000/e1000.h
@@ -351,4 +351,12 @@ enum e1000_state_t {
__E1000_DOWN
 };
 
+extern char e1000_driver_name[];
+extern const char e1000_driver_version[];
+
+extern void e1000_power_up_phy(struct e1000_adapter *);
+extern void e1000_set_ethtool_ops(struct net_device *netdev);
+extern void e1000_check_options(struct e1000_adapter *adapter);
+
+
 #endif /* _E1000_H_ */
diff --git a/drivers/net/e1000/e1000_ethtool.c 
b/drivers/net/e1000/e1000_ethtool.c
index 6c9a643..667f18b 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -32,9 +32,6 @@
 
 #include asm/uaccess.h
 
-extern char e1000_driver_name[];
-extern char e1000_driver_version[];
-
 extern int e1000_up(struct e1000_adapter *adapter);
 extern void e1000_down(struct e1000_adapter *adapter);
 extern void e1000_reinit_locked(struct e1000_adapter *adapter);
@@ -733,16 +730,16 @@ err_setup:
 
 #define REG_PATTERN_TEST(R, M, W)  
\
 {  
\
-   uint32_t pat, value;   \
-   uint32_t test[] =  \
+   uint32_t pat, val; \
+   const uint32_t test[] =\
{0x5A5A5A5A, 0xA5A5A5A5, 0x, 0x};  \
-   for (pat = 0; pat  ARRAY_SIZE(test); pat++) {  \
+   for (pat = 0; pat  ARRAY_SIZE(test); pat++) { \
E1000_WRITE_REG(adapter-hw, R, (test[pat]  W)); \
-   value = E1000_READ_REG(adapter-hw, R);   \
-   if (value != (test[pat]  W  M)) { 
\
+   val = E1000_READ_REG(adapter-hw, R); \
+   if (val != (test[pat]  W  M)) {  \
DPRINTK(DRV, ERR, pattern test reg %04X failed: got  \
0x%08X expected 0x%08X\n,\
-   E1000_##R, value, (test[pat]  W  M));\
+   E1000_##R, val, (test[pat]  W  M));  \
*data = (adapter-hw.mac_type  e1000_82543) ? \
E1000_82542_##R : E1000_##R;   \
return 1;  \
@@ -752,12 +749,12 @@ err_setup:
 
 #define REG_SET_AND_CHECK(R, M, W) 
\
 {  
\
-   uint32_t value;\
+   uint32_t val;  \
E1000_WRITE_REG(adapter-hw, R, W  M);   \
-   value = E1000_READ_REG(adapter-hw, R);   \
-   if ((W  M) != (value  M)) {  \
+   val = E1000_READ_REG(adapter-hw, R); \
+   if ((W  M) != (val  M)) {\
DPRINTK(DRV, ERR, set/check reg %04X test failed: got 0x%08X \
-   expected 0x%08X\n, E1000_##R, (value  M), (W  M)); \
+   expected 0x%08X\n, E1000_##R, (val  M), (W  M));   \
*data = (adapter-hw.mac_type  e1000_82543) ? \
E1000_82542_##R : E1000_##R;   \
return 1;  \
@@ -1621,8 +1618,6 @@ e1000_get_sset_count(struct net_device *netdev, int sset)
}
 }
 
-extern void e1000_power_up_phy(struct e1000_adapter *);
-
 static void
 e1000_diag_test(struct net_device *netdev,
   struct ethtool_test *eth_test, uint64_t *data)
@@ -1859,8 +1854,8 @@ e1000_phys_id(struct net_device *netdev, uint32_t data)
 {
struct e1000_adapter *adapter = netdev_priv(netdev);
 
-   if (!data || data  

[PATCH 2/4] ixgb: fix sparse warnings

2007-10-29 Thread Auke Kok
From: Stephen Hemminger [EMAIL PROTECTED]

Fix sparse warnings in ixgb driver for net-2.6.24.

Added a sparse fix for invalid declaration using non-constant value
in ixgb_set_multi. Added a fix for the module param array index
and allows int params in the array. --Auke

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

 drivers/net/ixgb/ixgb.h |7 ++
 drivers/net/ixgb/ixgb_ethtool.c |7 ++
 drivers/net/ixgb/ixgb_hw.c  |4 ++--
 drivers/net/ixgb/ixgb_main.c|   11 --
 drivers/net/ixgb/ixgb_param.c   |   43 ---
 5 files changed, 37 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index 1eee889..3d2e721 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -196,4 +196,11 @@ struct ixgb_adapter {
uint32_t alloc_rx_buff_failed;
boolean_t have_msi;
 };
+
+/* Exported from other modules */
+extern void ixgb_check_options(struct ixgb_adapter *adapter);
+extern void ixgb_set_ethtool_ops(struct net_device *netdev);
+extern char ixgb_driver_name[];
+extern const char ixgb_driver_version[];
+
 #endif /* _IXGB_H_ */
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index fddd584..a267dd8 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -32,9 +32,6 @@
 
 #include asm/uaccess.h
 
-extern char ixgb_driver_name[];
-extern char ixgb_driver_version[];
-
 extern int ixgb_up(struct ixgb_adapter *adapter);
 extern void ixgb_down(struct ixgb_adapter *adapter, boolean_t kill_watchdog);
 extern void ixgb_reset(struct ixgb_adapter *adapter);
@@ -639,8 +636,8 @@ ixgb_phys_id(struct net_device *netdev, uint32_t data)
 {
struct ixgb_adapter *adapter = netdev_priv(netdev);
 
-   if(!data || data  (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ))
-   data = (uint32_t)(MAX_SCHEDULE_TIMEOUT / HZ);
+   if (!data)
+   data = INT_MAX;
 
if(!adapter-blink_timer.function) {
init_timer(adapter-blink_timer);
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index ecbf458..2c6367a 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -1174,7 +1174,7 @@ mac_addr_valid(uint8_t *mac_addr)
  *
  * hw - Struct containing variables accessed by shared code
  */
-boolean_t
+static boolean_t
 ixgb_link_reset(struct ixgb_hw *hw)
 {
boolean_t link_status = FALSE;
@@ -1205,7 +1205,7 @@ ixgb_link_reset(struct ixgb_hw *hw)
  *
  * hw - Struct containing variables accessed by shared code
  */
-void
+static void
 ixgb_optics_reset(struct ixgb_hw *hw)
 {
if (hw-phy_type == ixgb_phy_type_txn17401) {
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index d444de5..e564335 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -37,8 +37,8 @@ static char ixgb_driver_string[] = Intel(R) PRO/10GbE 
Network Driver;
 #define DRIVERNAPI -NAPI
 #endif
 #define DRV_VERSION1.0.126-k2DRIVERNAPI
-char ixgb_driver_version[] = DRV_VERSION;
-static char ixgb_copyright[] = Copyright (c) 1999-2006 Intel Corporation.;
+const char ixgb_driver_version[] = DRV_VERSION;
+static const char ixgb_copyright[] = Copyright (c) 1999-2006 Intel 
Corporation.;
 
 /* ixgb_pci_tbl - PCI Device ID Table
  *
@@ -104,7 +104,6 @@ static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter 
*adapter,
 static boolean_t ixgb_clean_rx_irq(struct ixgb_adapter *adapter);
 #endif
 static void ixgb_alloc_rx_buffers(struct ixgb_adapter *adapter);
-void ixgb_set_ethtool_ops(struct net_device *netdev);
 static void ixgb_tx_timeout(struct net_device *dev);
 static void ixgb_tx_timeout_task(struct work_struct *work);
 static void ixgb_vlan_rx_register(struct net_device *netdev,
@@ -123,9 +122,6 @@ static pci_ers_result_t ixgb_io_error_detected (struct 
pci_dev *pdev,
 static pci_ers_result_t ixgb_io_slot_reset (struct pci_dev *pdev);
 static void ixgb_io_resume (struct pci_dev *pdev);
 
-/* Exported from other modules */
-extern void ixgb_check_options(struct ixgb_adapter *adapter);
-
 static struct pci_error_handlers ixgb_err_handler = {
.error_detected = ixgb_io_error_detected,
.slot_reset = ixgb_io_slot_reset,
@@ -1085,7 +1081,8 @@ ixgb_set_multi(struct net_device *netdev)
rctl |= IXGB_RCTL_MPE;
IXGB_WRITE_REG(hw, RCTL, rctl);
} else {
-   uint8_t mta[netdev-mc_count * IXGB_ETH_LENGTH_OF_ADDRESS];
+   uint8_t mta[IXGB_MAX_NUM_MULTICAST_ADDRESSES *
+   IXGB_ETH_LENGTH_OF_ADDRESS];
 
IXGB_WRITE_REG(hw, RCTL, rctl);
 
diff --git a/drivers/net/ixgb/ixgb_param.c b/drivers/net/ixgb/ixgb_param.c
index 5d5ddab..865d14d 100644

Re: last git: BUG: unable to handle kernel paging request at virtual address 92184900

2007-10-29 Thread Giacomo Catenazzi
Andrew Morton wrote:
 On Tue, 23 Oct 2007 21:04:20 +0200 Giacomo Catenazzi [EMAIL PROTECTED] 
 wrote:
 
 Oct 23 20:20:05 catee kernel: BUG: unable to handle kernel paging request at 
 virtual address 92184900
 
 Is this still happening in the latest Linus tree?
 
 If so, please send some more oops traces so we can see if it's always 
 happening
 in the same place.

No, since few days I didn't have kernel crashes, so I think the
bug was solved.

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


Configuring the same IP on multiple addresses

2007-10-29 Thread Vlad Yasevich
Hi All

Does anyone have a reason why Linux allows one to configure
the same IP or IPv6 address on multiple interfaces?

For IPv4, since linux implements a weak host model, assigning
duplicate addresses doesn't make any sense, since the addresses
really belong to the host and not the interface.

For IPv6, I can see allowing duplicate link-locals since that's
perfectly valid from the protocol perspective.  However, duplicate
globals are shouldn't be allows from the perspective of the address
architecture.

So, I am looking for technical reasons why this is permitted.

Thanks
-vlad
-
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] e1000e: Fix typo !

2007-10-29 Thread Auke Kok
From: Roel Kluin [EMAIL PROTECTED]

Signed-off-by: Roel Kluin [EMAIL PROTECTED]
Signed-off-by: Auke Kok [EMAIL PROTECTED]
---

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

diff --git a/drivers/net/e1000e/82571.c b/drivers/net/e1000e/82571.c
index cf70522..14141a5 100644
--- a/drivers/net/e1000e/82571.c
+++ b/drivers/net/e1000e/82571.c
@@ -283,7 +283,7 @@ static s32 e1000_get_invariants_82571(struct e1000_adapter 
*adapter)
adapter-flags = ~FLAG_HAS_WOL;
/* quad ports only support WoL on port A */
if (adapter-flags  FLAG_IS_QUAD_PORT 
-   (!adapter-flags  FLAG_IS_QUAD_PORT_A))
+   (!(adapter-flags  FLAG_IS_QUAD_PORT_A)))
adapter-flags = ~FLAG_HAS_WOL;
break;
 
-
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] ixgbe: minor sparse fixes

2007-10-29 Thread Auke Kok
From: Stephen Hemminger [EMAIL PROTECTED]

Make strings const if possible, and fix includes so forward definitions
are seen.

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

 drivers/net/ixgbe/ixgbe.h   |2 +-
 drivers/net/ixgbe/ixgbe_82598.c |3 +--
 drivers/net/ixgbe/ixgbe_main.c  |9 +
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h
index c160a7d..bc51432 100644
--- a/drivers/net/ixgbe/ixgbe.h
+++ b/drivers/net/ixgbe/ixgbe.h
@@ -244,7 +244,7 @@ extern struct ixgbe_info ixgbe_82598EB_info;
 extern struct ixgbe_info ixgbe_82598AT_info;
 
 extern char ixgbe_driver_name[];
-extern char ixgbe_driver_version[];
+extern const char ixgbe_driver_version[];
 
 extern int ixgbe_up(struct ixgbe_adapter *adapter);
 extern void ixgbe_down(struct ixgbe_adapter *adapter);
diff --git a/drivers/net/ixgbe/ixgbe_82598.c b/drivers/net/ixgbe/ixgbe_82598.c
index 00ee201..4d64673 100644
--- a/drivers/net/ixgbe/ixgbe_82598.c
+++ b/drivers/net/ixgbe/ixgbe_82598.c
@@ -30,8 +30,7 @@
 #include linux/delay.h
 #include linux/sched.h
 
-#include ixgbe_type.h
-#include ixgbe_common.h
+#include ixgbe.h
 #include ixgbe_phy.h
 
 #define IXGBE_82598_MAX_TX_QUEUES 32
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index b75f1c6..00bc525 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -45,12 +45,13 @@
 #include ixgbe_common.h
 
 char ixgbe_driver_name[] = ixgbe;
-static char ixgbe_driver_string[] =
-   Intel(R) 10 Gigabit PCI Express Network Driver;
+static const char ixgbe_driver_string[] =
+   Intel(R) 10 Gigabit PCI Express Network Driver;
 
 #define DRV_VERSION 1.1.18
-char ixgbe_driver_version[] = DRV_VERSION;
-static char ixgbe_copyright[] = Copyright (c) 1999-2007 Intel Corporation.;
+const char ixgbe_driver_version[] = DRV_VERSION;
+static const char ixgbe_copyright[] =
+Copyright (c) 1999-2007 Intel Corporation.;
 
 static const struct ixgbe_info *ixgbe_info_tbl[] = {
[board_82598AF] = ixgbe_82598AF_info,
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


kernel panic removing devices from a teql queuing discipline

2007-10-29 Thread Chuck Ebbert
https://bugzilla.redhat.com/show_bug.cgi?id=219488

Still happening in 2.6.22.9:

BUG: unable to handle kernel paging request at virtual address 66696674
 printing eip:
d098d4de
*pde = 
Oops:  [#1]
SMP 
last sysfs file: /class/net/lo/ifindex
Modules linked in: sch_teql netconsole autofs4 hidp rfcomm l2cap bluetooth 
sunrpc ipv6 dm_multipath video sbs i2c_ec button battery asus_acpi ac 
parport_pc lp parport floppy i2c_piix4 pcspkr i2c_core pcnet32 mii serio_raw 
ide_cd cdrom dm_snapshot dm_zero dm_mirror dm_mod ext3 jbd ehci_hcd ohci_hcd 
uhci_hcd
CPU:0
EIP:0060:[d098d4de]Not tainted VLI
EFLAGS: 00010202   (2.6.18-1.2849.fc6 #1) 
EIP is at teql_master_xmit+0xdc/0x3aa [sch_teql]
eax: c06a82c0   ebx: cde25c80   ecx:    edx: c06ad680
esi: c12f8e00   edi: cfc73800   ebp: 66696670   esp: ca6c8bb8
ds: 007b   es: 007b   ss: 0068
Process ping (pid: 2275, ti=ca6c8000 task=cc7bd400 task.ti=ca6c8000)
Stack: cde25174  04cc ca6f0800 c12f8e00 04cc cc7f5280 ca6f0c00 
   cc7f5280 cc7f5280    c06a82c0  ca6f0800 
   c12f8e00 c12f8e00 c0823e08 c05b9606 ca6c8c20  c12f8e00 ca6f0800 
Call Trace:
 [c05b9606] dev_hard_start_xmit+0x1b9/0x218
 [c05c72e1] __qdisc_run+0xde/0x19b
 [c05baeea] dev_queue_xmit+0x147/0x265
 [c05d8a0c] ip_output+0x1df/0x20b
 [c05d63bd] ip_push_pending_frames+0x301/0x3c3
 [c05ef0a6] raw_sendmsg+0x62e/0x6f0
 [c05f5913] inet_sendmsg+0x3b/0x45
 [c05af6a6] sock_sendmsg+0xd0/0xeb
 [c05afec9] sys_sendmsg+0x192/0x1f7
 [c05b1427] sys_socketcall+0x240/0x261
 [c0404013] syscall_call+0x7/0xb

The panic is in __teql_resolve (which has been inlined into teql_master_xmit) in
net/sched/sch_teql.c at this line:

if (n  n-tbl == mn-tbl 

Specifically the dereference of n-tbl is faulting as n is not valid.

And the address looks like part of an ASCCI string...  figt
-
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] pcnet: fix sparse triviality

2007-10-29 Thread Kok, Auke
Jeff Garzik wrote:
 Auke Kok wrote:
 Since data can never exceed u32, it can't even be larger than
 LONG_MAX/HZ.

 Signed-off-by: Auke Kok [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 ---

 Two comments:
 
 1) I would prefer to pick a sane limit, like 1 day.  The unit of
 'data' is seconds, so IMO we should not allow stupid timeouts, much less
 INT_MAX ones :)  But hey, then again, maybe we should permit root to
 hang themselves with own rope...

well, in this case it's only used for the blink interval for the LED on the back
of the adapter. This is completely interruptable by the user with ^C when 
running
ethtool, so it's not going to hang anything (traffic should continue nicely).

yes INT_MAX is insanely long. moving all of this checking to the ethtool generic
code makes much more sense indeed.

 2) [tangent] someone really should add the obvious ssleep_interruptible()

*pass* :)

Auke
-
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/4] e1000e: fix sparse warnings

2007-10-29 Thread Auke Kok
From: Stephen Hemminger [EMAIL PROTECTED]

Fix sparse warnings from e1000e driver in net-2.6.24.

Added a sparse fix for module param arrays which can have int values
but only the array index needs to be unsigned. --Auke

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

 drivers/net/e1000e/ethtool.c |4 ++--
 drivers/net/e1000e/param.c   |   35 ++-
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index 0666e62..6a39784 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -1680,8 +1680,8 @@ static int e1000_phys_id(struct net_device *netdev, u32 
data)
 {
struct e1000_adapter *adapter = netdev_priv(netdev);
 
-   if (!data || data  (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
-   data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
+   if (!data)
+   data = INT_MAX;
 
if (adapter-hw.phy.type == e1000_phy_ife) {
if (!adapter-blink_timer.function) {
diff --git a/drivers/net/e1000e/param.c b/drivers/net/e1000e/param.c
index e4e655e..3327892 100644
--- a/drivers/net/e1000e/param.c
+++ b/drivers/net/e1000e/param.c
@@ -52,10 +52,11 @@ MODULE_PARM_DESC(copybreak,
  */
 
 #define E1000_PARAM_INIT { [0 ... E1000_MAX_NIC] = OPTION_UNSET }
-#define E1000_PARAM(X, desc) \
-   static int __devinitdata X[E1000_MAX_NIC+1] = E1000_PARAM_INIT; \
-   static int num_##X; \
-   module_param_array_named(X, X, int, num_##X, 0); \
+#define E1000_PARAM(X, desc)   \
+   static int __devinitdata X[E1000_MAX_NIC+1] \
+   = E1000_PARAM_INIT; \
+   static unsigned int num_##X;\
+   module_param_array_named(X, X, int, num_##X, 0);   \
MODULE_PARM_DESC(X, desc);
 
 
@@ -124,9 +125,9 @@ E1000_PARAM(KumeranLockLoss, Enable Kumeran lock loss 
workaround);
 
 struct e1000_option {
enum { enable_option, range_option, list_option } type;
-   char *name;
-   char *err;
-   int  def;
+   const char *name;
+   const char *err;
+   int def;
union {
struct { /* range_option info */
int min;
@@ -139,8 +140,8 @@ struct e1000_option {
} arg;
 };
 
-static int __devinit e1000_validate_option(int *value,
-  struct e1000_option *opt,
+static int __devinit e1000_validate_option(unsigned int *value,
+  const struct e1000_option *opt,
   struct e1000_adapter *adapter)
 {
if (*value == OPTION_UNSET) {
@@ -213,7 +214,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
}
 
{ /* Transmit Interrupt Delay */
-   struct e1000_option opt = {
+   const struct e1000_option opt = {
.type = range_option,
.name = Transmit Interrupt Delay,
.err  = using default of 
@@ -232,7 +233,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
}
}
{ /* Transmit Absolute Interrupt Delay */
-   struct e1000_option opt = {
+   const struct e1000_option opt = {
.type = range_option,
.name = Transmit Absolute Interrupt Delay,
.err  = using default of 
@@ -277,7 +278,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
}
}
{ /* Receive Absolute Interrupt Delay */
-   struct e1000_option opt = {
+   const struct e1000_option opt = {
.type = range_option,
.name = Receive Absolute Interrupt Delay,
.err  = using default of 
@@ -296,7 +297,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
}
}
{ /* Interrupt Throttling Rate */
-   struct e1000_option opt = {
+   const struct e1000_option opt = {
.type = range_option,
.name = Interrupt Throttling Rate (ints/sec),
.err  = using default of 
@@ -344,7 +345,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
}
}
{ /* Smart Power Down */
-   struct e1000_option opt = {
+   const struct e1000_option opt = {
.type = enable_option,
.name = PHY Smart Power Down,
.err  = defaulting to Disabled,
@@ -352,7 +353,7 @@ void __devinit e1000e_check_options(struct e1000_adapter 
*adapter)
};
 
if (num_SmartPowerDownEnable  bd) {
- 

Re: [Bugme-new] [Bug 9260] New: tipc_config.h is not installed when doing make headers_install

2007-10-29 Thread Andrew Morton
On Mon, 29 Oct 2007 09:10:26 -0700 (PDT)
[EMAIL PROTECTED] wrote:

 http://bugzilla.kernel.org/show_bug.cgi?id=9260
 
Summary: tipc_config.h is not installed when doing make
 headers_install
Product: Other
Version: 2.5
  KernelVersion: 2.6.23.1
   Platform: All
 OS/Version: Linux
   Tree: Mainline
 Status: NEW
   Severity: normal
   Priority: P1
  Component: Configuration
 AssignedTo: [EMAIL PROTECTED]
 ReportedBy: [EMAIL PROTECTED]
 
 
 Most recent kernel where this bug did not occur: 2.6.15.7
 Distribution: all
 Hardware Environment: all
 Software Environment: all
 
 Problem Description:
 When doing make headers_install the file tipc_config.h is not installed. It
 describes the interface to configure the TIPC module and it is needed when
 building the config utility (tipc-config). 
 Adding the following line to include/linux/Kbuild solves this:
 header-y += tipc_config.h
 
 Steps to reproduce: make headers_install
 
-
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] NFS: handle IPv6 addresses in nfs ctl

2007-10-29 Thread Brian Haley

Hi Aurelien,

This is a combination of your two patches into one, cleaned-up with all 
my complaints.  I also added an ipv6_addr_set_v4mapped() inline after 
someone else here convinced me it gets rid of a lot of cruft from the 
code.  The DCCP, etc. code can be cleaned-up later if this gets accepted.


I have only compile-tested this, hoping you can test the functionality.

-Brian


Add IPv6 support to NFS server ip_map caching code and knfsd syscall 
interface - write_getfs() and write_getfd() will now accept IPv6 addresses.


Signed-off-by: Brian Haley [EMAIL PROTECTED]
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 66d0aeb..c47ba77 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -35,6 +35,7 @@
 #include linux/lockd/bind.h
 #include linux/sunrpc/msg_prot.h
 #include linux/sunrpc/gss_api.h
+#include net/ipv6.h
 
 #define NFSDDBG_FACILITY	NFSDDBG_EXPORT
 
@@ -1556,6 +1557,7 @@ exp_addclient(struct nfsctl_client *ncp)
 {
 	struct auth_domain	*dom;
 	int			i, err;
+	struct in6_addr		in6;
 
 	/* First, consistency check. */
 	err = -EINVAL;
@@ -1574,9 +1576,10 @@ exp_addclient(struct nfsctl_client *ncp)
 		goto out_unlock;
 
 	/* Insert client into hashtable. */
-	for (i = 0; i  ncp-cl_naddr; i++)
-		auth_unix_add_addr(ncp-cl_addrlist[i], dom);
-
+	for (i = 0; i  ncp-cl_naddr; i++) {
+		ipv6_addr_set_v4mapped(ncp-cl_addrlist[i].s_addr, in6);
+		auth_unix_add_addr(in6, dom);
+	}
 	auth_unix_forget_old(dom);
 	auth_domain_put(dom);
 
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 77dc989..5cb5f0d 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -37,6 +37,7 @@
 #include linux/nfsd/syscall.h
 
 #include asm/uaccess.h
+#include net/ipv6.h
 
 /*
  *	We have a single directory with 9 nodes in it.
@@ -219,24 +220,37 @@ static ssize_t write_getfs(struct file *file, char *buf, size_t size)
 {
 	struct nfsctl_fsparm *data;
 	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin6;
 	struct auth_domain *clp;
 	int err = 0;
 	struct knfsd_fh *res;
+	struct in6_addr in6;
 
 	if (size  sizeof(*data))
 		return -EINVAL;
 	data = (struct nfsctl_fsparm*)buf;
 	err = -EPROTONOSUPPORT;
-	if (data-gd_addr.sa_family != AF_INET)
+	switch (data-gd_addr.sa_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)data-gd_addr;
+		ipv6_addr_set_v4mapped(sin-sin_addr.s_addr, in6);
+		break;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)data-gd_addr;
+		ipv6_addr_copy(in6, sin6-sin6_addr); 
+		break;
+	default:
 		goto out;
-	sin = (struct sockaddr_in *)data-gd_addr;
+	}
+
 	if (data-gd_maxlen  NFS3_FHSIZE)
 		data-gd_maxlen = NFS3_FHSIZE;
 
 	res = (struct knfsd_fh*)buf;
 
 	exp_readlock();
-	if (!(clp = auth_unix_lookup(sin-sin_addr)))
+
+	if (!(clp = auth_unix_lookup(in6)))
 		err = -EPERM;
 	else {
 		err = exp_rootfh(clp, data-gd_path, res, data-gd_maxlen);
@@ -253,25 +267,41 @@ static ssize_t write_getfd(struct file *file, char *buf, size_t size)
 {
 	struct nfsctl_fdparm *data;
 	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin6;
 	struct auth_domain *clp;
 	int err = 0;
 	struct knfsd_fh fh;
 	char *res;
+	struct in6_addr in6;
 
 	if (size  sizeof(*data))
 		return -EINVAL;
 	data = (struct nfsctl_fdparm*)buf;
 	err = -EPROTONOSUPPORT;
-	if (data-gd_addr.sa_family != AF_INET)
+	if (data-gd_addr.sa_family != AF_INET 
+	data-gd_addr.sa_family != AF_INET6)
 		goto out;
 	err = -EINVAL;
 	if (data-gd_version  2 || data-gd_version  NFSSVC_MAXVERS)
 		goto out;
 
 	res = buf;
-	sin = (struct sockaddr_in *)data-gd_addr;
 	exp_readlock();
-	if (!(clp = auth_unix_lookup(sin-sin_addr)))
+
+	switch (data-gd_addr.sa_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)data-gd_addr;
+		ipv6_addr_set_v4mapped(sin-sin_addr.s_addr, in6);
+		break;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)data-gd_addr;
+		ipv6_addr_copy(in6, sin6-sin6_addr);
+		break;
+	default:
+		goto out;
+	}
+
+	if (!(clp = auth_unix_lookup(in6)))
 		err = -EPERM;
 	else {
 		err = exp_rootfh(clp, data-gd_path, fh, NFS_FHSIZE);
diff --git a/include/linux/sunrpc/svcauth.h b/include/linux/sunrpc/svcauth.h
index 22e1ef8..64ecb93 100644
--- a/include/linux/sunrpc/svcauth.h
+++ b/include/linux/sunrpc/svcauth.h
@@ -15,6 +15,7 @@
 #include linux/sunrpc/msg_prot.h
 #include linux/sunrpc/cache.h
 #include linux/hash.h
+#include net/ipv6.h
 
 #define SVC_CRED_NGROUPS	32
 struct svc_cred {
@@ -120,10 +121,10 @@ extern void	svc_auth_unregister(rpc_authflavor_t flavor);
 
 extern struct auth_domain *unix_domain_find(char *name);
 extern void auth_domain_put(struct auth_domain *item);
-extern int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom);
+extern int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom);
 extern struct auth_domain *auth_domain_lookup(char *name, struct auth_domain *new);
 extern struct auth_domain *auth_domain_find(char *name);
-extern struct auth_domain *auth_unix_lookup(struct in_addr addr);
+extern struct auth_domain *auth_unix_lookup(struct in6_addr *addr);
 extern int 

Re: [PATCH 2/2] netdrvr/ibmlana: move away from legacy MCA API

2007-10-29 Thread Jan Engelhardt

On Oct 29 2007 15:33, Jeff Garzik wrote:
 
+#if 0 /* info available elsewhere, but this is kept for reference */

It is available in the git history, yes, is it still needed for reference?

+static short ibmlana_adapter_ids[] __initdata = {
+  IBM_LANA_ID,
+  0x
+};
+
+static char *ibmlana_adapter_names[] __initdata = {
+  IBM LAN Adapter/A,
+  NULL
+};

Can this be const?

-
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] netdrvr/ibmlana: move away from legacy MCA API

2007-10-29 Thread Jeff Garzik

Jan Engelhardt wrote:

On Oct 29 2007 15:33, Jeff Garzik wrote:

+#if 0 /* info available elsewhere, but this is kept for reference */


It is available in the git history, yes, is it still needed for reference?


it's there to see if anyone complains at its removal :)



+static short ibmlana_adapter_ids[] __initdata = {
+   IBM_LANA_ID,
+   0x
+};
+
+static char *ibmlana_adapter_names[] __initdata = {
+   IBM LAN Adapter/A,
+   NULL
+};


Can this be const?


Not with the initdata marker, no.

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: Configuring the same IP on multiple addresses

2007-10-29 Thread David Stevens
[EMAIL PROTECTED] wrote on 10/29/2007 11:03:37 AM:

 So, I am looking for technical reasons why this is permitted.

Vlad,
Is there a technical reason to disallow it? Rather than
anticipate all the possible uses for a machine, it's, of course,
generally better to restrict only the things you know can't
work, and allow everything else.

+-DLS

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


[PATCH 1/2] netdrvr/ibmlana: modularization cleanup

2007-10-29 Thread Jeff Garzik
* move alloc_netdev() call, register_netdev() call, and associated failure
  cleanup into ibmlana_probe()

* move per-net_device cleanup into ibmlana_remove_one()

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/net/ibmlana.c |  109 +
 1 files changed, 64 insertions(+), 45 deletions(-)

diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 91d83ac..006d0d7 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -890,11 +890,14 @@ static void ibmlana_set_multicast_list(struct net_device 
*dev)
  * hardware check
  *  */
 
+static int ibmlana_irq;
+static int ibmlana_io;
 static int startslot;  /* counts through slots when probing multiple 
devices */
 
-static int ibmlana_probe(struct net_device *dev)
+static int ibmlana_probe(struct net_device **dev_out)
 {
-   int slot, z;
+   struct net_device *dev;
+   int slot, z, rc;
int base = 0, irq = 0, iobase = 0, memlen = 0;
ibmlana_priv *priv;
ibmlana_medium medium;
@@ -904,6 +907,13 @@ static int ibmlana_probe(struct net_device *dev)
if (MCA_bus == 0)
return -ENODEV;
 
+   dev = alloc_etherdev(sizeof(ibmlana_priv));
+   if (!dev)
+   return -ENOMEM;
+
+   dev-irq = ibmlana_irq;
+   dev-base_addr = ibmlana_io;
+
base = dev-mem_start;
irq = dev-irq;
 
@@ -924,8 +934,10 @@ static int ibmlana_probe(struct net_device *dev)
}
 
/* nothing found ? */
-   if (slot == -1)
-   return (base != 0 || irq != 0) ? -ENXIO : -ENODEV;
+   if (slot == -1) {
+   rc = (base != 0 || irq != 0) ? -ENXIO : -ENODEV;
+   goto err_out;
+   }
 
/* announce success */
printk(KERN_INFO %s: IBM LAN Adapter/A found in slot %d\n, dev-name, 
slot + 1);
@@ -934,7 +946,8 @@ static int ibmlana_probe(struct net_device *dev)
if (!request_region(iobase, IBM_LANA_IORANGE, DRV_NAME)) {
printk(KERN_ERR %s: cannot allocate I/O range at %#x!\n, 
DRV_NAME, iobase);
startslot = slot + 1;
-   return -EBUSY;
+   rc = -EBUSY;
+   goto err_out;
}
 
priv = netdev_priv(dev);
@@ -955,8 +968,8 @@ static int ibmlana_probe(struct net_device *dev)
if (!priv-base) {
printk(KERN_ERR %s: cannot remap memory!\n, DRV_NAME);
startslot = slot + 1;
-   release_region(iobase, IBM_LANA_IORANGE);
-   return -EBUSY;
+   rc = -EBUSY;
+   goto err_out_reg;
}
 
/* make procfs entries */
@@ -996,73 +1009,79 @@ static int ibmlana_probe(struct net_device *dev)
 
startslot = slot + 1;
 
+   rc = register_netdev(dev);
+   if (rc)
+   goto err_out_claimed;
+
+   *dev_out = dev;
return 0;
+
+err_out_claimed:
+   mca_mark_as_unused(priv-slot);
+   mca_set_adapter_name(priv-slot, );
+   mca_set_adapter_procfn(priv-slot, NULL, NULL);
+   iounmap(priv-base);
+err_out_reg:
+   release_region(iobase, IBM_LANA_IORANGE);
+err_out:
+   free_netdev(dev);
+   return rc;
+}
+
+static void ibmlana_remove_one(struct net_device *_dev)
+{
+   struct net_device *dev = _dev;
+   ibmlana_priv *priv = netdev_priv(dev);
+
+   unregister_netdev(dev);
+   /*DeinitBoard(dev); */
+   release_region(dev-base_addr, IBM_LANA_IORANGE);
+   mca_mark_as_unused(priv-slot);
+   mca_set_adapter_name(priv-slot, );
+   mca_set_adapter_procfn(priv-slot, NULL, NULL);
+   iounmap(priv-base);
+   free_netdev(dev);
 }
 
 /* 
  * modularization support
  *  */
 
-#ifdef MODULE
-
 #define DEVMAX 5
 
 static struct net_device *moddevs[DEVMAX];
-static int irq;
-static int io;
 
-module_param(irq, int, 0);
-module_param(io, int, 0);
+module_param_named(irq, ibmlana_irq, int, 0);
+module_param_named(io, ibmlana_io, int, 0);
 MODULE_PARM_DESC(irq, IBM LAN/A IRQ number);
 MODULE_PARM_DESC(io, IBM LAN/A I/O base address);
 MODULE_LICENSE(GPL);
 
-int init_module(void)
+static int __init ibmlana_init_module(void)
 {
int z;
 
startslot = 0;
for (z = 0; z  DEVMAX; z++) {
-   struct net_device *dev = alloc_etherdev(sizeof(ibmlana_priv));
-   if (!dev)
-   break;
-   dev-irq = irq;
-   dev-base_addr = io;
-   if (ibmlana_probe(dev)) {
-   free_netdev(dev);
-   break;
-   }
-   if (register_netdev(dev)) {
-   ibmlana_priv *priv = netdev_priv(dev);
-   release_region(dev-base_addr, IBM_LANA_IORANGE);
-  

[PATCH 2/2] netdrvr/ibmlana: move away from legacy MCA API

2007-10-29 Thread Jeff Garzik
Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/net/ibmlana.c |  119 +
 1 files changed, 51 insertions(+), 68 deletions(-)

diff --git a/drivers/net/ibmlana.c b/drivers/net/ibmlana.c
index 006d0d7..188c0a9 100644
--- a/drivers/net/ibmlana.c
+++ b/drivers/net/ibmlana.c
@@ -83,7 +83,7 @@ History:
 #include linux/interrupt.h
 #include linux/delay.h
 #include linux/time.h
-#include linux/mca-legacy.h
+#include linux/mca.h
 #include linux/module.h
 #include linux/netdevice.h
 #include linux/etherdevice.h
@@ -161,13 +161,13 @@ static void PrTime(void)
 
 /* deduce resources out of POS registers */
 
-static void getaddrs(int slot, int *base, int *memlen, int *iobase,
-int *irq, ibmlana_medium * medium)
+static void getaddrs(struct mca_device *mdev, int *base, int *memlen,
+int *iobase, int *irq, ibmlana_medium *medium)
 {
u_char pos0, pos1;
 
-   pos0 = mca_read_stored_pos(slot, 2);
-   pos1 = mca_read_stored_pos(slot, 3);
+   pos0 = mca_device_read_stored_pos(mdev, 2);
+   pos1 = mca_device_read_stored_pos(mdev, 3);
 
*base = 0xc + ((pos1  0xf0)  9);
*memlen = (pos1  0x01) ? 0x8000 : 0x4000;
@@ -744,6 +744,7 @@ static irqreturn_t irq_handler(int irq, void *device)
 
 /* MCA info */
 
+#if 0 /* info available elsewhere, but this is kept for reference */
 static int ibmlana_getinfo(char *buf, int slot, void *d)
 {
int len = 0, i;
@@ -771,6 +772,7 @@ static int ibmlana_getinfo(char *buf, int slot, void *d)
 
return len;
 }
+#endif
 
 /* open driver.  Means also initialization and start of LANCE */
 
@@ -894,19 +896,26 @@ static int ibmlana_irq;
 static int ibmlana_io;
 static int startslot;  /* counts through slots when probing multiple 
devices */
 
-static int ibmlana_probe(struct net_device **dev_out)
+static short ibmlana_adapter_ids[] __initdata = {
+   IBM_LANA_ID,
+   0x
+};
+
+static char *ibmlana_adapter_names[] __initdata = {
+   IBM LAN Adapter/A,
+   NULL
+};
+
+static int ibmlana_init_one(struct device *kdev)
 {
+   struct mca_device *mdev = to_mca_device(kdev);
struct net_device *dev;
-   int slot, z, rc;
+   int slot = mdev-slot, z, rc;
int base = 0, irq = 0, iobase = 0, memlen = 0;
ibmlana_priv *priv;
ibmlana_medium medium;
DECLARE_MAC_BUF(mac);
 
-   /* can't work without an MCA bus ;-) */
-   if (MCA_bus == 0)
-   return -ENODEV;
-
dev = alloc_etherdev(sizeof(ibmlana_priv));
if (!dev)
return -ENOMEM;
@@ -917,25 +926,16 @@ static int ibmlana_probe(struct net_device **dev_out)
base = dev-mem_start;
irq = dev-irq;
 
-   for (slot = startslot; (slot = mca_find_adapter(IBM_LANA_ID, slot)) != 
-1; slot++) {
-   /* deduce card addresses */
-   getaddrs(slot, base, memlen, iobase, irq, medium);
-
-   /* slot already in use ? */
-   if (mca_is_adapter_used(slot))
-   continue;
-   /* were we looking for something different ? */
-   if (dev-irq  dev-irq != irq)
-   continue;
-   if (dev-mem_start  dev-mem_start != base)
-   continue;
-   /* found something that matches */
-   break;
-   }
+   /* deduce card addresses */
+   getaddrs(mdev, base, memlen, iobase, irq, medium);
 
-   /* nothing found ? */
-   if (slot == -1) {
-   rc = (base != 0 || irq != 0) ? -ENXIO : -ENODEV;
+   /* were we looking for something different ? */
+   if (dev-irq  dev-irq != irq) {
+   rc = -ENODEV;
+   goto err_out;
+   }
+   if (dev-mem_start  dev-mem_start != base) {
+   rc = -ENODEV;
goto err_out;
}
 
@@ -952,11 +952,10 @@ static int ibmlana_probe(struct net_device **dev_out)
 
priv = netdev_priv(dev);
priv-slot = slot;
-   priv-realirq = irq;
+   priv-realirq = mca_device_transform_irq(mdev, irq);
priv-medium = medium;
spin_lock_init(priv-lock);
 
-
/* set base + irq for this device (irq not allocated so far) */
 
dev-irq = 0;
@@ -972,18 +971,14 @@ static int ibmlana_probe(struct net_device **dev_out)
goto err_out_reg;
}
 
-   /* make procfs entries */
-   mca_set_adapter_name(slot, IBM LAN Adapter/A);
-   mca_set_adapter_procfn(slot, (MCA_ProcFn) ibmlana_getinfo, dev);
-
-   mca_mark_as_used(slot);
+   mca_device_set_name(mdev, ibmlana_adapter_names[mdev-index]);
+   mca_device_set_claim(mdev, 1);
 
/* set methods */
 
dev-open = ibmlana_open;
dev-stop = ibmlana_close;
dev-hard_start_xmit = ibmlana_tx;
-   dev-do_ioctl = NULL;
dev-set_multicast_list = ibmlana_set_multicast_list;
dev-flags |= 

Re: Configuring the same IP on multiple addresses

2007-10-29 Thread David Stevens
 For v6, there are plenty of operational reasons to not allow this.  You 
really
 turn unicast into anycast when you do this and there are special rules 
to
 be followed.

I don't see it that way. The only problem I can think of offhand
is that you can't use a multi-interface address to identify an interface
(for example, for multicasting) and get predictable results (it'll pick
the first one it finds with that address, in no particular order). But
you can still use interface indexes, which are unique.
Anycast is used for multiple distinct hosts, which isn't an issue
on the same host. It's already true, as you pointed out, that you can
receive a packet for any local address on any interface, so allowing
multiple instances means you still match it as local. Which interface
you match it on usually isn't relevant, and when it is are exactly the
cases where using duplicates might be appropriate.
I can see where it might be useful if you have policy
restrictions on some interfaces and want the particular address
to be both in and out of a set. But, I agree, it's generally more
trouble (for an administrator), but then administrators don't have
to assign the same address to multiple interfaces. 

+-DLS

-
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/2] [CRYPTO] tcrypt: Move sg_init_table out of timing loops

2007-10-29 Thread Jens Axboe
On Fri, Oct 26 2007, Herbert Xu wrote:
 [CRYPTO] tcrypt: Move sg_init_table out of timing loops
 
 This patch moves the sg_init_table out of the timing loops for hash
 algorithms so that it doesn't impact on the speed test results.

Wouldn't it be better to just make sg_init_one() call sg_init_table?

diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 4571231..ccc55a6 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -202,28 +202,6 @@ static inline void __sg_mark_end(struct scatterlist *sg)
 }
 
 /**
- * sg_init_one - Initialize a single entry sg list
- * @sg: SG entry
- * @buf:Virtual address for IO
- * @buflen: IO length
- *
- * Notes:
- *   This should not be used on a single entry that is part of a larger
- *   table. Use sg_init_table() for that.
- *
- **/
-static inline void sg_init_one(struct scatterlist *sg, const void *buf,
-  unsigned int buflen)
-{
-   memset(sg, 0, sizeof(*sg));
-#ifdef CONFIG_DEBUG_SG
-   sg-sg_magic = SG_MAGIC;
-#endif
-   sg_mark_end(sg, 1);
-   sg_set_buf(sg, buf, buflen);
-}
-
-/**
  * sg_init_table - Initialize SG table
  * @sgl:  The SG table
  * @nents:Number of entries in table
@@ -247,6 +225,24 @@ static inline void sg_init_table(struct scatterlist *sgl, 
unsigned int nents)
 }
 
 /**
+ * sg_init_one - Initialize a single entry sg list
+ * @sg: SG entry
+ * @buf:Virtual address for IO
+ * @buflen: IO length
+ *
+ * Notes:
+ *   This should not be used on a single entry that is part of a larger
+ *   table. Use sg_init_table() for that.
+ *
+ **/
+static inline void sg_init_one(struct scatterlist *sg, const void *buf,
+  unsigned int buflen)
+{
+   sg_init_table(sg, 1);
+   sg_set_buf(sg, buf, buflen);
+}
+
+/**
  * sg_phys - Return physical address of an sg entry
  * @sg: SG entry
  *

-- 
Jens Axboe

-
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


[bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread Ingo Molnar

hm, this seems to have popped up in the last few days, never had it 
before:

  sysfs: duplicate filename 'eth0' can not be created
  WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

  Call Trace:
   [802de00a] sysfs_add_one+0x54/0xbd
   [802dee61] sysfs_create_link+0xc6/0x11d
   [8047c491] device_rename+0x175/0x1d6
   [806180a6] dev_change_name+0x118/0x211
   [8061893c] dev_ioctl+0x4fa/0x5f8
   [8062eb11] netlink_insert+0x13c/0x14b
   [806a877f] do_page_fault+0x3eb/0x73f
   [8060b909] sock_ioctl+0x1f2/0x200
   [802a5a5d] do_ioctl+0x21/0x6b
   [802a5cea] vfs_ioctl+0x243/0x25c
   [802a5d54] sys_ioctl+0x51/0x71
   [8020c02e] system_call+0x7e/0x83

   net eth0: device_rename: sysfs_create_symlink failed (-17)

32-bit bzImage kernel - config attached. (The 64-bit kernel even lost 
connectivity due to this and ifcfg-eth0 got renamed to ifcfg-eth0.bak by 
kudzu.)

detected order of the interfaces is:

  forcedeth :00:0a.0: ifname eth0, PHY OUI 0x5043 @1
  eth1: RealTek RTL8139 at 0xc21f2000

and that's the ordering in /etc/sysconfig/network-scripts as well.

Ingo
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.24-rc1
# Mon Oct 29 22:02:23 2007
#
CONFIG_X86_64=y
CONFIG_64BIT=y
CONFIG_X86=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CMOS_UPDATE=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_ZONE_DMA32=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_MMU=y
CONFIG_ZONE_DMA=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_CMPXCHG=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_ARCH_POPULATES_NODE_MAP=y
CONFIG_DMI=y
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
# CONFIG_BOOTPARAM_SUPPORT is not set
CONFIG_DEFCONFIG_LIST=/lib/modules/$UNAME_RELEASE/.config

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION=
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
# CONFIG_TASK_XACCT is not set
# CONFIG_USER_NS is not set
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_TREE=y
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=20
# CONFIG_CGROUPS is not set
# CONFIG_FAIR_GROUP_SCHED is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
CONFIG_RT_MUTEXES=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_KMOD=y
CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
CONFIG_BLK_DEV_IO_TRACE=y
# CONFIG_BLK_DEV_BSG is not set
CONFIG_BLOCK_COMPAT=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
# CONFIG_DEFAULT_AS is not set
# CONFIG_DEFAULT_DEADLINE is not set
CONFIG_DEFAULT_CFQ=y
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED=cfq

#
# Processor type and features
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_X86_PC=y
# CONFIG_X86_VSMP is not set
# CONFIG_MK8 is not set
# CONFIG_MPSC is not set
# CONFIG_MCORE2 is not set
CONFIG_GENERIC_CPU=y
CONFIG_X86_L1_CACHE_BYTES=128
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_X86_INTERNODE_CACHE_BYTES=128
CONFIG_X86_TSC=y
CONFIG_X86_GOOD_APIC=y
CONFIG_MICROCODE=m
CONFIG_MICROCODE_OLD_INTERFACE=y
CONFIG_X86_MSR=y
CONFIG_X86_CPUID=y
CONFIG_X86_HT=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_MTRR=y
CONFIG_SMP=y
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_BKL=y
CONFIG_NUMA=y
CONFIG_K8_NUMA=y
CONFIG_NODES_SHIFT=6
CONFIG_X86_64_ACPI_NUMA=y
# CONFIG_NUMA_EMU is not set
CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
CONFIG_ARCH_SPARSEMEM_ENABLE=y
CONFIG_SELECT_MEMORY_MODEL=y
# CONFIG_FLATMEM_MANUAL is not set
# CONFIG_DISCONTIGMEM_MANUAL is not set
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_NEED_MULTIPLE_NODES=y
CONFIG_HAVE_MEMORY_PRESENT=y
# CONFIG_SPARSEMEM_STATIC 

dn_route.c momentarily exiting RCU read-side critical section

2007-10-29 Thread Paul E. McKenney
Hello!

net/decnet/dn_route.c in dn_rt_cache_get_next() is as follows:

static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct 
dn_route *rt)
{
struct dn_rt_cache_iter_state *s = rcu_dereference(seq-private);

rt = rt-u.dst.dn_next;
while(!rt) {
rcu_read_unlock_bh();
if (--s-bucket  0)
break;

...  But what happens if seq-private is freed up right here?
...  Or what prevents this from happening?

rcu_read_lock_bh();
rt = dn_rt_hash_table[s-bucket].chain;
}
return rt;
}

Similar code is in rt_cache_get_next().

So, what am I missing here?

Thanx, Paul
-
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


Fw: [PATCH] [IPv4] SNMP: Refer correct memory location to display ICMP out-going statistics

2007-10-29 Thread David Stevens
Dave,
I didn't see a response for this one... in case it fell through 
the
cracks. Just want to make sure my bone-headed error doesn't hang
around too long. :-)

+-DLS

- Forwarded by David Stevens/Beaverton/IBM on 10/29/2007 01:51 PM 
-

Mitsuru Chinen [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
10/25/2007 06:59 PM

To
netdev@vger.kernel.org
cc
David Stevens/Beaverton/[EMAIL PROTECTED]
Subject
[PATCH] [IPv4] SNMP: Refer correct memory location to display ICMP 
out-going statistics






While displaying ICMP out-going statistics as Outname counters in
/proc/net/snmp, the memory location for ICMP in-coming statistics
was referred by mistake.

Acked-by: David L Stevens [EMAIL PROTECTED] 
Signed-off-by: Mitsuru Chinen [EMAIL PROTECTED]
---
 net/ipv4/proc.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index fd16cb8..b7f7f8a 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -312,7 +312,7 @@ static void icmp_put(struct seq_file *seq)
 for (i=0; icmpmibmap[i].name != NULL; i++)
 seq_printf(seq,  %lu,
 snmp_fold_field((void **) 
icmpmsg_statistics,
- icmpmibmap[i].index));
+ icmpmibmap[i].index | 0x100));
 }
 
 /*
-- 
1.5.3.4

-
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


[PATCH 0/5] UDP memory accounting and limitation (take 6)

2007-10-29 Thread Hideo AOKI

Hello,

This is the latest patch set of UDP memory accounting and limitation.

The number of pages for socket buffer is limited up to
/proc/sys/net/ipv4/udp_mem. I removed the minimal limit number
to use the feature from the former patch set (take5). And udp_init()
is introduced to calculate default value.

In addition, I added /proc/sys/net/ipv4/udp_rmem and
/proc/sys/net/ipv4/udp_wmem to be able to allocate minimum buffer to
each socket.

As a result, UDP packet is drooped when the number of pages for
socket buffer is beyond the limit and the socket already consumes
minimum buffer.

Detailed change log is below.

Changelog take 5 - take 6:

 * removed minimal limit of /proc/sys/net/udp_mem
 * added udp_init() for default value calculation of parameters
 * added /proc/sys/net/udp_rmem and /proc/sys/net/udp_rmem
 * added limitation code to ip_ufo_append_data()
 * improved accounting for receiving packet
 * fixed typos
 * rebased to 2.6.24-rc1


Changelog take 4 - take 5:

 * removing unnessesary EXPORT_SYMBOLs
 * adding minimal limit of /proc/sys/net/udp_mem
 * bugfix of UDP limit affecting protocol other than UDP
 * introducing __ip_check_max_skb_pages()
 * using CTL_UNNUMBERED
 * adding udp_mem usage to Documentation/networking/ip_sysctl.txt


Best regards,
Hideo Aoki

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


[PATCH 1/5] fix send buffer check

2007-10-29 Thread Hideo AOKI

This patch introduces sndbuf size check before memory allocation for
send buffer.

--
Hideo Aoki
Hitachi Computer Products (America) Inc.

Signed-off-by: Satoshi Oshima [EMAIL PROTECTED]
Signed-off-by: Hideo Aoki [EMAIL PROTECTED]

 ip_output.c |5 +
 1 file changed, 5 insertions(+)

diff -pruN linux-2.6.24-rc1/net/ipv4/ip_output.c linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/ip_output.c
--- linux-2.6.24-rc1/net/ipv4/ip_output.c	2007-10-24 11:34:34.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/ip_output.c	2007-10-24 11:46:43.0 -0400
@@ -1004,6 +1004,11 @@ alloc_new_skb:
 	frag = skb_shinfo(skb)-frags[i];
 }
 			} else if (i  MAX_SKB_FRAGS) {
+if (atomic_read(sk-sk_wmem_alloc) + PAGE_SIZE
+ 2 * sk-sk_sndbuf) {
+	err = -ENOBUFS;
+	goto error;
+}
 if (copy  PAGE_SIZE)
 	copy = PAGE_SIZE;
 page = alloc_pages(sk-sk_allocation, 0);


[PATCH] pegasos_eth.c: Fix compile error over MV643XX_ defines

2007-10-29 Thread Luis R. Rodriguez
This commit made an incorrect assumption:
--
Author: Lennert Buytenhek [EMAIL PROTECTED]
 Date:   Fri Oct 19 04:10:10 2007 +0200

mv643xx_eth: Move ethernet register definitions into private header

Move the mv643xx's ethernet-related register definitions from
include/linux/mv643xx.h into drivers/net/mv643xx_eth.h, since
they aren't of any use outside the ethernet driver.

Signed-off-by: Lennert Buytenhek [EMAIL PROTECTED]
Acked-by: Tzachi Perelstein [EMAIL PROTECTED]
Signed-off-by: Dale Farnsworth [EMAIL PROTECTED]
--

arch/powerpc/platforms/chrp/pegasos_eth.c made use of a 3 defines there.

[EMAIL PROTECTED]:~/devel/wireless-2.6$ git-describe 

v2.6.24-rc1-138-g0119130

This patch fixes this by internalizing 3 defines onto pegasos which are
simply no longer available elsewhere. Without this your compile will fail
whenever you enable 'Common Hardware Reference Platform (CHRP) based machines',
(CONFIG_PPC_CHRP) as the Makefile for chrp adds it always:

obj-y   += setup.o time.o pegasos_eth.o pci.o

If these defines are platform specific then they should later just be added 
back to include/linux/mv643xx.h.

Compile error:

  CC  arch/powerpc/platforms/chrp/pegasos_eth.o
arch/powerpc/platforms/chrp/pegasos_eth.c: In function 'Enable_SRAM':
arch/powerpc/platforms/chrp/pegasos_eth.c:150: error: 'MV643XX_ETH_BAR_4' 
undeclared (first use in this function)
arch/powerpc/platforms/chrp/pegasos_eth.c:150: error: (Each undeclared 
identifier is reported only once
arch/powerpc/platforms/chrp/pegasos_eth.c:150: error: for each function it 
appears in.)
arch/powerpc/platforms/chrp/pegasos_eth.c:152: error: 
'MV643XX_ETH_SIZE_REG_4' undeclared (first use in this function)
arch/powerpc/platforms/chrp/pegasos_eth.c:154: error: 
'MV643XX_ETH_BASE_ADDR_ENABLE_REG' undeclared (first use in this function)
make[2]: *** [arch/powerpc/platforms/chrp/pegasos_eth.o] Error 1
make[1]: *** [arch/powerpc/platforms/chrp] Error 2
make: *** [arch/powerpc/platforms] Error 2

Signed-off-by: Luis R. Rodriguez [EMAIL PROTECTED]
---

 arch/powerpc/platforms/chrp/pegasos_eth.c |   11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c 
b/arch/powerpc/platforms/chrp/pegasos_eth.c
index 5bcc58d..1fc9e8c 100644
--- a/arch/powerpc/platforms/chrp/pegasos_eth.c
+++ b/arch/powerpc/platforms/chrp/pegasos_eth.c
@@ -24,6 +24,9 @@
 #define PEGASOS2_SRAM_BASE_ETH0(PEGASOS2_SRAM_BASE)
 #define PEGASOS2_SRAM_BASE_ETH1
(PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
 
+#define PEGASOS2_ETH_BAR_4 0x2220
+#define PEGASOS2_ETH_SIZE_REG_40x2224
+#define PEGASOS2_ETH_BASE_ADDR_ENABLE_REG  0x2290
 
 #define PEGASOS2_SRAM_RXRING_SIZE  (PEGASOS2_SRAM_SIZE/4)
 #define PEGASOS2_SRAM_TXRING_SIZE  (PEGASOS2_SRAM_SIZE/4)
@@ -147,13 +150,13 @@ static int Enable_SRAM(void)
 
ALong = 0x02;
ALong |= PEGASOS2_SRAM_BASE  0x;
-   MV_WRITE(MV643XX_ETH_BAR_4, ALong);
+   MV_WRITE(PEGASOS2_ETH_BAR_4, ALong);
 
-   MV_WRITE(MV643XX_ETH_SIZE_REG_4, (PEGASOS2_SRAM_SIZE-1)  0x);
+   MV_WRITE(PEGASOS2_ETH_SIZE_REG_4, (PEGASOS2_SRAM_SIZE-1)  0x);
 
-   MV_READ(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
+   MV_READ(PEGASOS2_ETH_BASE_ADDR_ENABLE_REG, ALong);
ALong = ~(1  4);
-   MV_WRITE(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
+   MV_WRITE(PEGASOS2_ETH_BASE_ADDR_ENABLE_REG, ALong);
 
 #ifdef BE_VERBOSE
printk(Pegasos II/Marvell MV64361: register unmapped\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


[PATCH 2/5] accounting unit and variable

2007-10-29 Thread Hideo AOKI

This patch introduces global variable for UDP memory accounting.
The unit is page.

--
Hideo Aoki
Hitachi Computer Products (America) Inc.

Signed-off-by: Satoshi Oshima [EMAIL PROTECTED]
Signed-off-by: Hideo Aoki [EMAIL PROTECTED]

 include/net/sock.h |7 +++
 include/net/udp.h  |2 ++
 net/ipv4/proc.c|3 ++-
 net/ipv4/udp.c |2 ++
 4 files changed, 13 insertions(+), 1 deletion(-)

diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p1/include/net/sock.h linux-2.6.24-rc1-mem003-ipv4-dev-p2/include/net/sock.h
--- linux-2.6.24-rc1-mem003-ipv4-dev-p1/include/net/sock.h	2007-10-24 11:34:32.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p2/include/net/sock.h	2007-10-24 11:47:51.0 -0400
@@ -727,6 +727,13 @@ static inline int sk_stream_wmem_schedul
 	   sk_stream_mem_schedule(sk, size, 0);
 }
 
+#define SK_DATAGRAM_MEM_QUANTUM ((int)PAGE_SIZE)
+
+static inline int sk_datagram_pages(int amt)
+{
+	return DIV_ROUND_UP(amt, SK_DATAGRAM_MEM_QUANTUM);
+}
+
 /* Used by processes to lock a socket state, so that
  * interrupts and bottom half handlers won't change it
  * from under us. It essentially blocks any incoming
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p1/include/net/udp.h linux-2.6.24-rc1-mem003-ipv4-dev-p2/include/net/udp.h
--- linux-2.6.24-rc1-mem003-ipv4-dev-p1/include/net/udp.h	2007-10-10 11:49:42.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p2/include/net/udp.h	2007-10-24 11:47:51.0 -0400
@@ -65,6 +65,8 @@ extern rwlock_t udp_hash_lock;
 
 extern struct proto udp_prot;
 
+extern atomic_t udp_memory_allocated;
+
 struct sk_buff;
 
 /*
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/proc.c linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/proc.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/proc.c	2007-10-24 11:34:34.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/proc.c	2007-10-24 11:47:51.0 -0400
@@ -67,7 +67,8 @@ static int sockstat_seq_show(struct seq_
 		   fold_prot_inuse(tcp_prot), atomic_read(tcp_orphan_count),
 		   tcp_death_row.tw_count, atomic_read(tcp_sockets_allocated),
 		   atomic_read(tcp_memory_allocated));
-	seq_printf(seq, UDP: inuse %d\n, fold_prot_inuse(udp_prot));
+	seq_printf(seq, UDP: inuse %d mem %d\n, fold_prot_inuse(udp_prot),
+		   atomic_read(udp_memory_allocated));
 	seq_printf(seq, UDPLITE: inuse %d\n, fold_prot_inuse(udplite_prot));
 	seq_printf(seq, RAW: inuse %d\n, fold_prot_inuse(raw_prot));
 	seq_printf(seq,  FRAG: inuse %d memory %d\n,
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/udp.c linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/udp.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p1/net/ipv4/udp.c	2007-10-24 11:34:35.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/udp.c	2007-10-24 12:27:37.0 -0400
@@ -114,6 +114,8 @@ DEFINE_SNMP_STAT(struct udp_mib, udp_sta
 struct hlist_head udp_hash[UDP_HTABLE_SIZE];
 DEFINE_RWLOCK(udp_hash_lock);
 
+atomic_t udp_memory_allocated;
+
 static inline int __udp_lib_lport_inuse(__u16 num,
 	const struct hlist_head udptable[])
 {


[PATCH 4/5] memory limitation by using udp_mem

2007-10-29 Thread Hideo AOKI

This patch introduces memory limitation for UDP.

--
Hideo Aoki
Hitachi Computer Products (America) Inc.

Signed-off-by: Satoshi Oshima [EMAIL PROTECTED]
Signed-off-by: Hideo Aoki [EMAIL PROTECTED]

 Documentation/networking/ip-sysctl.txt |6 
 include/net/udp.h  |3 ++
 net/ipv4/af_inet.c |3 ++
 net/ipv4/ip_output.c   |   47 ++---
 net/ipv4/sysctl_net_ipv4.c |   11 +++
 net/ipv4/udp.c |   24 
 6 files changed, 91 insertions(+), 3 deletions(-)

diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p3/Documentation/networking/ip-sysctl.txt linux-2.6.24-rc1-mem003-ipv4-dev-p4/Documentation/networking/ip-sysctl.txt
--- linux-2.6.24-rc1-mem003-ipv4-dev-p3/Documentation/networking/ip-sysctl.txt	2007-10-24 11:33:58.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p4/Documentation/networking/ip-sysctl.txt	2007-10-26 20:35:52.0 -0400
@@ -446,6 +446,12 @@ tcp_dma_copybreak - INTEGER
 	and CONFIG_NET_DMA is enabled.
 	Default: 4096
 
+UDP variables:
+
+udp_mem - INTEGER
+	Number of pages allowed for queueing by all UDP sockets.
+	Default is calculated at boot time from amount of available memory.
+
 CIPSOv4 Variables:
 
 cipso_cache_enable - BOOLEAN
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p3/include/net/udp.h linux-2.6.24-rc1-mem003-ipv4-dev-p4/include/net/udp.h
--- linux-2.6.24-rc1-mem003-ipv4-dev-p3/include/net/udp.h	2007-10-24 11:47:51.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p4/include/net/udp.h	2007-10-26 20:35:52.0 -0400
@@ -66,6 +66,7 @@ extern rwlock_t udp_hash_lock;
 extern struct proto udp_prot;
 
 extern atomic_t udp_memory_allocated;
+extern int sysctl_udp_mem;
 
 struct sk_buff;
 
@@ -175,4 +176,6 @@ extern void udp_proc_unregister(struct u
 extern int  udp4_proc_init(void);
 extern void udp4_proc_exit(void);
 #endif
+
+extern void udp_init(void);
 #endif	/* _UDP_H */
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/af_inet.c linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/af_inet.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/af_inet.c	2007-10-24 19:10:27.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/af_inet.c	2007-10-26 20:35:52.0 -0400
@@ -1446,6 +1446,9 @@ static int __init inet_init(void)
 	/* Setup TCP slab cache for open requests. */
 	tcp_init();
 
+	/* Setup UDP memory threshold */
+	udp_init();
+
 	/* Add UDP-Lite (RFC 3828) */
 	udplite4_register();
 
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/ip_output.c linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/ip_output.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/ip_output.c	2007-10-24 12:31:47.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/ip_output.c	2007-10-29 09:36:32.0 -0400
@@ -75,6 +75,7 @@
 #include net/icmp.h
 #include net/checksum.h
 #include net/inetpeer.h
+#include net/udp.h
 #include linux/igmp.h
 #include linux/netfilter_ipv4.h
 #include linux/netfilter_bridge.h
@@ -699,6 +700,20 @@ csum_page(struct page *page, int offset,
 	return csum;
 }
 
+static inline int __ip_check_max_skb_pages(struct sock *sk, int size)
+{
+	switch(sk-sk_protocol) {
+	case IPPROTO_UDP:
+		if (atomic_read(sk-sk_prot-memory_allocated) + size
+		 sk-sk_prot-sysctl_mem[0])
+			return -ENOBUFS;
+		/* Fall through */	
+	default:
+		break;
+	}
+	return 0;
+}
+
 static inline int ip_ufo_append_data(struct sock *sk,
 			int getfrag(void *from, char *to, int offset, int len,
 			   int odd, struct sk_buff *skb),
@@ -707,16 +722,20 @@ static inline int ip_ufo_append_data(str
 {
 	struct sk_buff *skb;
 	int err;
+	int size = 0;
 
 	/* There is support for UDP fragmentation offload by network
 	 * device, so create one single skb packet containing complete
 	 * udp datagram
 	 */
 	if ((skb = skb_peek_tail(sk-sk_write_queue)) == NULL) {
-		skb = sock_alloc_send_skb(sk,
-			hh_len + fragheaderlen + transhdrlen + 20,
-			(flags  MSG_DONTWAIT), err);
+		size = hh_len + fragheaderlen + transhdrlen + 20;
+		err = __ip_check_max_skb_pages(sk, sk_datagram_pages(size));
+		if (err)
+			return err;
 
+		skb = sock_alloc_send_skb(sk, size, (flags  MSG_DONTWAIT),
+	  err);
 		if (skb == NULL)
 			return err;
 
@@ -737,6 +756,10 @@ static inline int ip_ufo_append_data(str
 		sk-sk_sndmsg_off = 0;
 	}
 
+	err = __ip_check_max_skb_pages(sk, sk_datagram_pages(size + length - 
+			 transhdrlen));
+	if (err)
+		goto fail;
 	err = skb_append_datato_frags(sk,skb, getfrag, from,
 			   (length - transhdrlen));
 	if (!err) {
@@ -752,6 +775,7 @@ static inline int ip_ufo_append_data(str
 	/* There is not enough support do UFO ,
 	 * so follow normal path
 	 */
+fail:
 	kfree_skb(skb);
 	return err;
 }
@@ -910,6 +934,12 @@ alloc_new_skb:
 			if (datalen == length + fraggap)
 alloclen += rt-u.dst.trailer_len;
 
+			err = __ip_check_max_skb_pages(sk,
+sk_datagram_pages(SKB_DATA_ALIGN(alloclen + hh_len + 15)
+

[PATCH 5/5] introduce udp_rmem and udp_wmem

2007-10-29 Thread Hideo AOKI

This patch added /proc/sys/net/udp_rmem and /proc/sys/net/udp_rmem.
Each UDP packet is drooped when the number of pages for socket buffer
is beyond the limit and the socket already consumes minimum buffer.

--
Hideo Aoki
Hitachi Computer Products (America) Inc.

Cc: Satoshi Oshima [EMAIL PROTECTED]
Signed-off-by: Hideo Aoki [EMAIL PROTECTED]

 Documentation/networking/ip-sysctl.txt |   12 
 include/net/udp.h  |4 
 net/ipv4/ip_output.c   |4 +++-
 net/ipv4/sysctl_net_ipv4.c |   20 
 net/ipv4/udp.c |   13 +++--
 5 files changed, 50 insertions(+), 3 deletions(-)

diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p4/Documentation/networking/ip-sysctl.txt linux-2.6.24-rc1-mem003-ipv4-dev-p5/Documentation/networking/ip-sysctl.txt
--- linux-2.6.24-rc1-mem003-ipv4-dev-p4/Documentation/networking/ip-sysctl.txt	2007-10-26 20:35:52.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p5/Documentation/networking/ip-sysctl.txt	2007-10-29 09:44:05.0 -0400
@@ -452,6 +452,18 @@ udp_mem - INTEGER
 	Number of pages allowed for queueing by all UDP sockets.
 	Default is calculated at boot time from amount of available memory.
 
+udp_rmem - INTEGER
+	Minimal size of receive buffer used by UDP sockets. Each UDP socket
+	is able to use the size for receiving data, even if total pages of UDP
+	sockets exceed udp_mem. The unit is byte.
+	Default: 4096
+
+udp_wmem - INTEGER
+	Minimal size of send buffer used by UDP sockets. Each UDP socket is
+	able to use the size for sending data, even if total pages of UDP
+	sockets exceed udp_mem. The unit is byte.
+	Default: 4096
+
 CIPSOv4 Variables:
 
 cipso_cache_enable - BOOLEAN
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p4/include/net/udp.h linux-2.6.24-rc1-mem003-ipv4-dev-p5/include/net/udp.h
--- linux-2.6.24-rc1-mem003-ipv4-dev-p4/include/net/udp.h	2007-10-26 20:35:52.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p5/include/net/udp.h	2007-10-29 09:44:05.0 -0400
@@ -66,7 +66,11 @@ extern rwlock_t udp_hash_lock;
 extern struct proto udp_prot;
 
 extern atomic_t udp_memory_allocated;
+
+/* sysctl variables for udp */
 extern int sysctl_udp_mem;
+extern int sysctl_udp_rmem;
+extern int sysctl_udp_wmem;
 
 struct sk_buff;
 
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/ip_output.c linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/ip_output.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/ip_output.c	2007-10-29 09:36:32.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/ip_output.c	2007-10-29 09:44:05.0 -0400
@@ -705,7 +705,9 @@ static inline int __ip_check_max_skb_pag
 	switch(sk-sk_protocol) {
 	case IPPROTO_UDP:
 		if (atomic_read(sk-sk_prot-memory_allocated) + size
-		 sk-sk_prot-sysctl_mem[0])
+		 sk-sk_prot-sysctl_mem[0] 
+		atomic_read(sk-sk_wmem_alloc) + size
+		 sk-sk_prot-sysctl_wmem[0])
 			return -ENOBUFS;
 		/* Fall through */	
 	default:
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/sysctl_net_ipv4.c linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/sysctl_net_ipv4.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/sysctl_net_ipv4.c	2007-10-26 20:35:52.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/sysctl_net_ipv4.c	2007-10-29 09:44:05.0 -0400
@@ -896,6 +896,26 @@ ctl_table ipv4_table[] = {
 		.strategy	= sysctl_intvec,
 		.extra1		= zero
 	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= udp_rmem,
+		.data		= sysctl_udp_rmem,
+		.maxlen		= sizeof(sysctl_udp_rmem),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.strategy	= sysctl_intvec,
+		.extra1		= zero
+	},
+	{
+		.ctl_name	= CTL_UNNUMBERED,
+		.procname	= udp_wmem,
+		.data		= sysctl_udp_wmem,
+		.maxlen		= sizeof(sysctl_udp_wmem),
+		.mode		= 0644,
+		.proc_handler	= proc_dointvec_minmax,
+		.strategy	= sysctl_intvec,
+		.extra1		= zero
+	},
 	{ .ctl_name = 0 }
 };
 
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/udp.c linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/udp.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p4/net/ipv4/udp.c	2007-10-26 20:35:52.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p5/net/ipv4/udp.c	2007-10-29 09:44:05.0 -0400
@@ -117,6 +117,8 @@ DEFINE_RWLOCK(udp_hash_lock);
 
 atomic_t udp_memory_allocated;
 int sysctl_udp_mem __read_mostly;
+int sysctl_udp_rmem __read_mostly;
+int sysctl_udp_wmem __read_mostly;
 
 static inline int __udp_lib_lport_inuse(__u16 num,
 	const struct hlist_head udptable[])
@@ -1026,8 +1028,10 @@ int udp_queue_rcv_skb(struct sock * sk, 
 	}
 
 	if ((atomic_read(sk-sk_prot-memory_allocated)
-		   + sk_datagram_pages(skb-truesize))
-		 sk-sk_prot-sysctl_mem[0]) {
+	 + sk_datagram_pages(skb-truesize))
+	 sk-sk_prot-sysctl_mem[0] 
+	atomic_read(sk-sk_rmem_alloc) + skb-truesize 
+	 sk-sk_prot-sysctl_rmem[0]) {
 		UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS, up-pcflag);
 		goto drop;
 	}
@@ -1468,6 +1472,8 @@ struct 

Re: [PATCH] inet: race in wait for connect.

2007-10-29 Thread Arnaldo Carvalho de Melo
Em Mon, Oct 29, 2007 at 01:52:22PM -0700, Stephen Hemminger escreveu:
 Fix possible race while waiting for connections in accept. I don't
 know of a test case that could reproduce this directly.
 
 The state of the socket should be checked before checking the queue.
 If the socket has left the TCP_LISTEN state, then the accept queue
 is no longer valid.

Well if it left from LISTEN to CLOSED inet_csk_listen_stop must have
been called, and that calls reqsk_queue_yank_acceptq, that sets it to
NULL, reqsk_queue_empty(icsk-icsk_accept_queue) returns true and we
get to if (sk-sk_state != TCP_LISTEN), returning -EINVAL as with your
patch.  So I can't see a race, just one branch less in one case :-)

- Arnaldo
 
 Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]
 
 --- a/net/ipv4/inet_connection_sock.c 2007-10-26 11:54:41.0 -0700
 +++ b/net/ipv4/inet_connection_sock.c 2007-10-29 08:34:03.0 -0700
 @@ -203,12 +203,12 @@ static int inet_csk_wait_for_connect(str
   if (reqsk_queue_empty(icsk-icsk_accept_queue))
   timeo = schedule_timeout(timeo);
   lock_sock(sk);
 - err = 0;
 - if (!reqsk_queue_empty(icsk-icsk_accept_queue))
 - break;
   err = -EINVAL;
   if (sk-sk_state != TCP_LISTEN)
   break;
 + err = 0;
 + if (!reqsk_queue_empty(icsk-icsk_accept_queue))
 + break;
   err = sock_intr_errno(timeo);
   if (signal_pending(current))
   break;
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/5] memory accounting

2007-10-29 Thread Hideo AOKI

This patch adds UDP memory usage accounting in IPv4.

--
Hideo Aoki
Hitachi Computer Products (America) Inc.

Signed-off-by: Satoshi Oshima [EMAIL PROTECTED]
Signed-off-by: Hideo Aoki [EMAIL PROTECTED]

 af_inet.c   |   30 +-
 ip_output.c |   25 ++---
 udp.c   |9 +
 3 files changed, 60 insertions(+), 4 deletions(-)

diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/af_inet.c linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/af_inet.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/af_inet.c	2007-10-24 11:34:34.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/af_inet.c	2007-10-24 19:10:27.0 -0400
@@ -126,13 +126,41 @@ extern void ip_mc_drop_socket(struct soc
 static struct list_head inetsw[SOCK_MAX];
 static DEFINE_SPINLOCK(inetsw_lock);
 
+/**
+ *	__skb_queue_purge_and_sub_memory_allocated
+ *		- empty a list and subtruct memory allocation counter
+ *	@sk:   sk
+ *	@list: list to empty
+ *	Delete all buffers on an sk_buff list and subtruct the
+ *	truesize of the sk_buff for memory accounting. Each buffer
+ *	is removed from the list and one reference dropped. This
+ *	function does not take the list lock and the caller must
+ *	hold the relevant locks to use it.
+ */
+static inline void __skb_queue_purge_and_sub_memory_allocated(struct sock *sk,
+	struct sk_buff_head *list)
+{
+	struct sk_buff *skb;
+	int purged_skb_size = 0;
+	while ((skb = __skb_dequeue(list)) != NULL) {
+		purged_skb_size += sk_datagram_pages(skb-truesize);
+		kfree_skb(skb);
+	}
+	atomic_sub(purged_skb_size, sk-sk_prot-memory_allocated);
+}
+
 /* New destruction routine */
 
 void inet_sock_destruct(struct sock *sk)
 {
 	struct inet_sock *inet = inet_sk(sk);
 
-	__skb_queue_purge(sk-sk_receive_queue);
+	if (sk-sk_prot-memory_allocated  sk-sk_type != SOCK_STREAM)
+		__skb_queue_purge_and_sub_memory_allocated(sk,
+sk-sk_receive_queue);
+	else
+		__skb_queue_purge(sk-sk_receive_queue);
+
 	__skb_queue_purge(sk-sk_error_queue);
 
 	if (sk-sk_type == SOCK_STREAM  sk-sk_state != TCP_CLOSE) {
diff -pruN linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/ip_output.c linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/ip_output.c
--- linux-2.6.24-rc1-mem003-ipv4-dev-p2/net/ipv4/ip_output.c	2007-10-24 11:46:43.0 -0400
+++ linux-2.6.24-rc1-mem003-ipv4-dev-p3/net/ipv4/ip_output.c	2007-10-24 12:31:47.0 -0400
@@ -743,6 +743,8 @@ static inline int ip_ufo_append_data(str
 		/* specify the length of each IP datagram fragment*/
 		skb_shinfo(skb)-gso_size = mtu - fragheaderlen;
 		skb_shinfo(skb)-gso_type = SKB_GSO_UDP;
+		atomic_add(sk_datagram_pages(skb-truesize),
+			   sk-sk_prot-memory_allocated);
 		__skb_queue_tail(sk-sk_write_queue, skb);
 
 		return 0;
@@ -924,6 +926,9 @@ alloc_new_skb:
 			}
 			if (skb == NULL)
 goto error;
+			if (sk-sk_prot-memory_allocated)
+atomic_add(sk_datagram_pages(skb-truesize),
+	   sk-sk_prot-memory_allocated);
 
 			/*
 			 *	Fill in the control structures
@@ -1023,6 +1028,8 @@ alloc_new_skb:
 frag = skb_shinfo(skb)-frags[i];
 skb-truesize += PAGE_SIZE;
 atomic_add(PAGE_SIZE, sk-sk_wmem_alloc);
+if (sk-sk_prot-memory_allocated)
+	atomic_inc(sk-sk_prot-memory_allocated);
 			} else {
 err = -EMSGSIZE;
 goto error;
@@ -1123,7 +1130,9 @@ ssize_t	ip_append_page(struct sock *sk, 
 			if (unlikely(!skb)) {
 err = -ENOBUFS;
 goto error;
-			}
+			} else if (sk-sk_prot-memory_allocated)
+atomic_add(sk_datagram_pages(skb-truesize),
+	   sk-sk_prot-memory_allocated);
 
 			/*
 			 *	Fill in the control structures
@@ -1202,13 +1211,14 @@ int ip_push_pending_frames(struct sock *
 	struct iphdr *iph;
 	__be16 df = 0;
 	__u8 ttl;
-	int err = 0;
+	int err = 0, send_page_size;
 
 	if ((skb = __skb_dequeue(sk-sk_write_queue)) == NULL)
 		goto out;
 	tail_skb = (skb_shinfo(skb)-frag_list);
 
 	/* move skb-data to ip header from ext header */
+	send_page_size = sk_datagram_pages(skb-truesize);
 	if (skb-data  skb_network_header(skb))
 		__skb_pull(skb, skb_network_offset(skb));
 	while ((tmp_skb = __skb_dequeue(sk-sk_write_queue)) != NULL) {
@@ -1218,6 +1228,7 @@ int ip_push_pending_frames(struct sock *
 		skb-len += tmp_skb-len;
 		skb-data_len += tmp_skb-len;
 		skb-truesize += tmp_skb-truesize;
+		send_page_size += sk_datagram_pages(tmp_skb-truesize);
 		__sock_put(tmp_skb-sk);
 		tmp_skb-destructor = NULL;
 		tmp_skb-sk = NULL;
@@ -1273,6 +1284,8 @@ int ip_push_pending_frames(struct sock *
 	/* Netfilter gets whole the not fragmented skb. */
 	err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL,
 		  skb-dst-dev, dst_output);
+	if (sk-sk_prot-memory_allocated)
+		atomic_sub(send_page_size, sk-sk_prot-memory_allocated);
 	if (err) {
 		if (err  0)
 			err = inet-recverr ? net_xmit_errno(err) : 0;
@@ -1302,9 +1315,15 @@ void ip_flush_pending_frames(struct sock
 {
 	struct inet_sock *inet = inet_sk(sk);
 	struct sk_buff *skb;
+	int num_flush_mem = 0;
 
-	while ((skb = 

Re: [bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread Jeff Garzik

Ingo Molnar wrote:
hm, this seems to have popped up in the last few days, never had it 
before:


  sysfs: duplicate filename 'eth0' can not be created
  WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

  Call Trace:
   [802de00a] sysfs_add_one+0x54/0xbd
   [802dee61] sysfs_create_link+0xc6/0x11d
   [8047c491] device_rename+0x175/0x1d6
   [806180a6] dev_change_name+0x118/0x211
   [8061893c] dev_ioctl+0x4fa/0x5f8
   [8062eb11] netlink_insert+0x13c/0x14b
   [806a877f] do_page_fault+0x3eb/0x73f
   [8060b909] sock_ioctl+0x1f2/0x200
   [802a5a5d] do_ioctl+0x21/0x6b
   [802a5cea] vfs_ioctl+0x243/0x25c
   [802a5d54] sys_ioctl+0x51/0x71
   [8020c02e] system_call+0x7e/0x83

   net eth0: device_rename: sysfs_create_symlink failed (-17)

32-bit bzImage kernel - config attached. (The 64-bit kernel even lost 
connectivity due to this and ifcfg-eth0 got renamed to ifcfg-eth0.bak by 
kudzu.)


detected order of the interfaces is:

  forcedeth :00:0a.0: ifname eth0, PHY OUI 0x5043 @1
  eth1: RealTek RTL8139 at 0xc21f2000

and that's the ordering in /etc/sysconfig/network-scripts as well.


Does your setup do anything like try to rename the interfaces?

I cannot think of anything that changed recently in this area in net, 
off the top of my head.


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] inet: race in wait for connect.

2007-10-29 Thread Stephen Hemminger
On Mon, 29 Oct 2007 19:29:06 -0200
Arnaldo Carvalho de Melo [EMAIL PROTECTED] wrote:

 Em Mon, Oct 29, 2007 at 01:52:22PM -0700, Stephen Hemminger escreveu:
  Fix possible race while waiting for connections in accept. I don't
  know of a test case that could reproduce this directly.
  
  The state of the socket should be checked before checking the queue.
  If the socket has left the TCP_LISTEN state, then the accept queue
  is no longer valid.
 
 Well if it left from LISTEN to CLOSED inet_csk_listen_stop must have
 been called, and that calls reqsk_queue_yank_acceptq, that sets it to
 NULL, reqsk_queue_empty(icsk-icsk_accept_queue) returns true and we
 get to if (sk-sk_state != TCP_LISTEN), returning -EINVAL as with your
 patch.  So I can't see a race, just one branch less in one case :-)
 
 - Arnaldo

Yeah, your right. The listen queue is garbage at this point but the
accept queue is always empty.


-- 
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: [bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread Stephen Hemminger
On Mon, 29 Oct 2007 22:17:46 +0100
Ingo Molnar [EMAIL PROTECTED] wrote:

 
 hm, this seems to have popped up in the last few days, never had it 
 before:
 
   sysfs: duplicate filename 'eth0' can not be created
   WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
 
   Call Trace:
[802de00a] sysfs_add_one+0x54/0xbd
[802dee61] sysfs_create_link+0xc6/0x11d
[8047c491] device_rename+0x175/0x1d6
[806180a6] dev_change_name+0x118/0x211
[8061893c] dev_ioctl+0x4fa/0x5f8
[8062eb11] netlink_insert+0x13c/0x14b
[806a877f] do_page_fault+0x3eb/0x73f
[8060b909] sock_ioctl+0x1f2/0x200
[802a5a5d] do_ioctl+0x21/0x6b
[802a5cea] vfs_ioctl+0x243/0x25c
[802a5d54] sys_ioctl+0x51/0x71
[8020c02e] system_call+0x7e/0x83
 
net eth0: device_rename: sysfs_create_symlink failed (-17)
 
 32-bit bzImage kernel - config attached. (The 64-bit kernel even lost 
 connectivity due to this and ifcfg-eth0 got renamed to ifcfg-eth0.bak by 
 kudzu.)
 
 detected order of the interfaces is:
 
   forcedeth :00:0a.0: ifname eth0, PHY OUI 0x5043 @1
   eth1: RealTek RTL8139 at 0xc21f2000
 
 and that's the ordering in /etc/sysconfig/network-scripts as well.
 
   Ingo


Already fixed post 2.6.24-rc1

commit c8d90dca3211966ba5189e0f3d4bccd558d9ae08
Author: Stephen Hemminger [EMAIL PROTECTED]
Date:   Fri Oct 26 03:53:42 2007 -0700

[NET] dev_change_name: ignore changes to same name

Prevent error/backtrace from dev_rename() when changing
name of network device to the same name. This is a common
situation with udev and other scripts that bind addr to device.

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

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


[PATCH] inet: race in wait for connect.

2007-10-29 Thread Stephen Hemminger
Fix possible race while waiting for connections in accept. I don't
know of a test case that could reproduce this directly.

The state of the socket should be checked before checking the queue.
If the socket has left the TCP_LISTEN state, then the accept queue
is no longer valid.

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

--- a/net/ipv4/inet_connection_sock.c   2007-10-26 11:54:41.0 -0700
+++ b/net/ipv4/inet_connection_sock.c   2007-10-29 08:34:03.0 -0700
@@ -203,12 +203,12 @@ static int inet_csk_wait_for_connect(str
if (reqsk_queue_empty(icsk-icsk_accept_queue))
timeo = schedule_timeout(timeo);
lock_sock(sk);
-   err = 0;
-   if (!reqsk_queue_empty(icsk-icsk_accept_queue))
-   break;
err = -EINVAL;
if (sk-sk_state != TCP_LISTEN)
break;
+   err = 0;
+   if (!reqsk_queue_empty(icsk-icsk_accept_queue))
+   break;
err = sock_intr_errno(timeo);
if (signal_pending(current))
break;
-
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] nf_nat_h323.c unneeded rcu_dereference() calls

2007-10-29 Thread Paul E. McKenney
Hello!

While reviewing rcu_dereference() uses, I came across a number of cases
where I couldn't see how the rcu_dereference() helped.  One class of
cases is where the variable is never subsequently dereferenced, so that
patches like the following one would be appropriate.

So, what am I missing here?

Signed-off-by: Paul E. McKenney [EMAIL PROTECTED]
---

 nf_nat_h323.c |   18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff -urpNa -X dontdiff linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c 
linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c
--- linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c   2007-10-09 
13:31:38.0 -0700
+++ linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c2007-10-29 
14:00:13.0 -0700
@@ -546,15 +546,15 @@ static int nat_callforwarding(struct sk_
 //
 static int __init init(void)
 {
-   BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL);
-   BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL);
-   BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL);
-   BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL);
-   BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL);
-   BUG_ON(rcu_dereference(nat_t120_hook) != NULL);
-   BUG_ON(rcu_dereference(nat_h245_hook) != NULL);
-   BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL);
-   BUG_ON(rcu_dereference(nat_q931_hook) != NULL);
+   BUG_ON(set_h245_addr_hook != NULL);
+   BUG_ON(set_h225_addr_hook != NULL);
+   BUG_ON(set_sig_addr_hook != NULL);
+   BUG_ON(set_ras_addr_hook != NULL);
+   BUG_ON(nat_rtp_rtcp_hook != NULL);
+   BUG_ON(nat_t120_hook != NULL);
+   BUG_ON(nat_h245_hook != NULL);
+   BUG_ON(nat_callforwarding_hook != NULL);
+   BUG_ON(nat_q931_hook != NULL);
 
rcu_assign_pointer(set_h245_addr_hook, set_h245_addr);
rcu_assign_pointer(set_h225_addr_hook, set_h225_addr);
-
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: [bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread Rick Jones

Jeff Garzik wrote:

Ingo Molnar wrote:

hm, this seems to have popped up in the last few days, never had it 
before:


  sysfs: duplicate filename 'eth0' can not be created
  WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

  Call Trace:
   [802de00a] sysfs_add_one+0x54/0xbd
   [802dee61] sysfs_create_link+0xc6/0x11d
   [8047c491] device_rename+0x175/0x1d6
   [806180a6] dev_change_name+0x118/0x211
   [8061893c] dev_ioctl+0x4fa/0x5f8
   [8062eb11] netlink_insert+0x13c/0x14b
   [806a877f] do_page_fault+0x3eb/0x73f
   [8060b909] sock_ioctl+0x1f2/0x200
   [802a5a5d] do_ioctl+0x21/0x6b
   [802a5cea] vfs_ioctl+0x243/0x25c
   [802a5d54] sys_ioctl+0x51/0x71
   [8020c02e] system_call+0x7e/0x83

   net eth0: device_rename: sysfs_create_symlink failed (-17)

32-bit bzImage kernel - config attached. (The 64-bit kernel even lost 
connectivity due to this and ifcfg-eth0 got renamed to ifcfg-eth0.bak 
by kudzu.)


detected order of the interfaces is:

  forcedeth :00:0a.0: ifname eth0, PHY OUI 0x5043 @1
  eth1: RealTek RTL8139 at 0xc21f2000

and that's the ordering in /etc/sysconfig/network-scripts as well.



Does your setup do anything like try to rename the interfaces?

I cannot think of anything that changed recently in this area in net, 
off the top of my head.


Ingo -

You are not alone.  I see very similar stuff when I boot a system with a large 
number of interfaces.  At first it was almost every interface generating the 
messages or ones like them, but now with a patch applied (might have come via Jeff?)


hpcpc103:~/linux-2.6.24-rc1# more dev_change_name.patch
--- a/net/core/dev.c2007-10-24 06:01:31.0 -0700
+++ b/net/core/dev.c2007-10-24 06:41:18.0 -0700
@@ -885,6 +885,9 @@ int dev_change_name(struct net_device *d
if (!dev_valid_name(newname))
return -EINVAL;

+   if (strncmp(newname, dev-name, IFNAMSIZ) == 0)
+   return 0;
+
memcpy(oldname, dev-name, IFNAMSIZ);

if (strchr(newname, '%')) {

I see far fewer of them:

GSI 60 (level, low) - CPU 6 (0x0c00) vector 70
sysfs: duplicate filename 'eth6_rename' can not be created
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()
Call Trace:
 [a001000137c0] show_stack+0x40/0xa0
sp=e00159abfb90 bsp=e00159ab8f48
 [a00100013850] dump_stack+0x30/0x60
sp=e00159abfd60 bsp=e00159ab8f30
 [a00100206d10] sysfs_add_one+0xb0/0x240
sp=e00159abfd60 bsp=e00159ab8f00
 [a001002092c0] sysfs_create_link+0x200/0x300
sp=e00159abfd60 bsp=e00159ab8ed0
 [a00100396bb0] device_rename+0x2d0/0x380
sp=e00159abfd80 bsp=e00159ab8e78
 [a0010040b690] dev_change_name+0x2b0/0x4a0
sp=e00159abfd80 bsp=e00159ab8e30
 [a0010040bd80] dev_ifsioc+0x500/0x6c0
sp=e00159abfd90 bsp=e00159ab8e00
 [a0010040cda0] dev_ioctl+0xe60/0x1160
sp=e00159abfda0 bsp=e00159ab8da0
 [a001003ea7f0] sock_ioctl+0x610/0x660
sp=e00159abfe10 bsp=e00159ab8d68
 [a00100170650] do_ioctl+0x90/0x180
sp=e00159abfe10 bsp=e00159ab8d28
 [a00100170fa0] vfs_ioctl+0x860/0x8c0
sp=e00159abfe10 bsp=e00159ab8ce0
 [a001001710a0] sys_ioctl+0xa0/0x120
sp=e00159abfe20 bsp=e00159ab8c60
 [a001af20] ia64_ret_from_syscall+0x0/0x20
sp=e00159abfe30 bsp=e00159ab8c60
 [a0010620] __start_ivt_text+0x00010620/0x400
sp=e00159ac bsp=e00159ab8c60
:
net eth6_rename: device_rename: sysfs_create_symlink failed (-17)
sysfs: duplicate filename 'eth6' can not be created
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

...
net eth6: device_rename: sysfs_create_symlink failed (-17)
udev: renamed network interface eth7 to eth6
sysfs: duplicate filename 'eth7' can not be created
WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

...

sp=e00159ac bsp=e00159ab8c60
net eth7: device_rename: sysfs_create_symlink failed (-17)
udev: renamed network interface eth6_rename to eth7
ACPI: PCI Interrupt :14:01.0[A] - GSI 60 (level, low) - IRQ 70


Interestingly (?) when I look at my eth7 interface via ethtool I see:

hpcpc103:~/linux-2.6.24-rc1# ethtool -i eth7
driver: Neterion
version: 2.0.26.5
firmware-version:
bus-info: :0f:01.0

but if I look for it in /proc/interrupts I don't see it:

hpcpc103:~/linux-2.6.24-rc1# cat /proc/interrupts | grep eth7
hpcpc103:~/linux-2.6.24-rc1#

and if I look at all of /proc/interrupts:

hpcpc103:~# cat 

Re: [bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread Ingo Molnar

* Stephen Hemminger [EMAIL PROTECTED] wrote:

 Already fixed post 2.6.24-rc1
 
 commit c8d90dca3211966ba5189e0f3d4bccd558d9ae08
 Author: Stephen Hemminger [EMAIL PROTECTED]
 Date:   Fri Oct 26 03:53:42 2007 -0700
 
 [NET] dev_change_name: ignore changes to same name

ah, nice - that explains it. I just booted with very latest -git and the 
warning is gone.

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: Configuring the same IP on multiple addresses

2007-10-29 Thread Vlad Yasevich
David Stevens wrote:
 [EMAIL PROTECTED] wrote on 10/29/2007 11:03:37 AM:
 
 So, I am looking for technical reasons why this is permitted.
 
 Vlad,
 Is there a technical reason to disallow it? Rather than
 anticipate all the possible uses for a machine, it's, of course,
 generally better to restrict only the things you know can't
 work, and allow everything else.
 
 +-DLS

For v4, not really, but it really confuses some people (and thus causes
me headaches ;-)

For v6, there are plenty of operational reasons to not allow this.  You really
turn unicast into anycast when you do this and there are special rules to
be followed.

-vlad
-
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: [bug, 2.6.24-rc1] sysfs: duplicate filename 'eth0' can not be created

2007-10-29 Thread David Miller
From: Ingo Molnar [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 22:17:46 +0100

 
 hm, this seems to have popped up in the last few days, never had it 
 before:
 
   sysfs: duplicate filename 'eth0' can not be created
   WARNING: at fs/sysfs/dir.c:424 sysfs_add_one()

I checked in a change from Stephen Hemminger last week which
should keep this case from emitting warning messages.

commit c8d90dca3211966ba5189e0f3d4bccd558d9ae08
Author: Stephen Hemminger [EMAIL PROTECTED]
Date:   Fri Oct 26 03:53:42 2007 -0700

[NET] dev_change_name: ignore changes to same name

Prevent error/backtrace from dev_rename() when changing
name of network device to the same name. This is a common
situation with udev and other scripts that bind addr to device.

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

diff --git a/net/core/dev.c b/net/core/dev.c
index f1647d7..ddfef3b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -883,6 +883,9 @@ int dev_change_name(struct net_device *dev, char *newname)
if (!dev_valid_name(newname))
return -EINVAL;
 
+   if (strncmp(newname, dev-name, IFNAMSIZ) == 0)
+   return 0;
+
memcpy(oldname, dev-name, IFNAMSIZ);
 
if (strchr(newname, '%')) {
-
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] inet: race in wait for connect.

2007-10-29 Thread David Miller
From: Stephen Hemminger [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 14:37:14 -0700

 On Mon, 29 Oct 2007 19:29:06 -0200
 Arnaldo Carvalho de Melo [EMAIL PROTECTED] wrote:
 
  Em Mon, Oct 29, 2007 at 01:52:22PM -0700, Stephen Hemminger escreveu:
   Fix possible race while waiting for connections in accept. I don't
   know of a test case that could reproduce this directly.
   
   The state of the socket should be checked before checking the queue.
   If the socket has left the TCP_LISTEN state, then the accept queue
   is no longer valid.
  
  Well if it left from LISTEN to CLOSED inet_csk_listen_stop must have
  been called, and that calls reqsk_queue_yank_acceptq, that sets it to
  NULL, reqsk_queue_empty(icsk-icsk_accept_queue) returns true and we
  get to if (sk-sk_state != TCP_LISTEN), returning -EINVAL as with your
  patch.  So I can't see a race, just one branch less in one case :-)
  
  - Arnaldo
 
 Yeah, your right. The listen queue is garbage at this point but the
 accept queue is always empty.

Is there some failing test case you are aware of which led
you to this piece of code or did you happen to notice it
while scanning around?
-
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] pegasos_eth.c: Fix compile error over MV643XX_ defines

2007-10-29 Thread Dale Farnsworth
On Mon, Oct 29, 2007 at 05:27:29PM -0400, Luis R. Rodriguez wrote:
 This commit made an incorrect assumption:
 --
 Author: Lennert Buytenhek [EMAIL PROTECTED]
  Date:   Fri Oct 19 04:10:10 2007 +0200
 
 mv643xx_eth: Move ethernet register definitions into private header
 
 Move the mv643xx's ethernet-related register definitions from
 include/linux/mv643xx.h into drivers/net/mv643xx_eth.h, since
 they aren't of any use outside the ethernet driver.
 
 Signed-off-by: Lennert Buytenhek [EMAIL PROTECTED]
 Acked-by: Tzachi Perelstein [EMAIL PROTECTED]
 Signed-off-by: Dale Farnsworth [EMAIL PROTECTED]
 --
 
 arch/powerpc/platforms/chrp/pegasos_eth.c made use of a 3 defines there.
 
 [EMAIL PROTECTED]:~/devel/wireless-2.6$ git-describe 
 
 v2.6.24-rc1-138-g0119130
 
 This patch fixes this by internalizing 3 defines onto pegasos which are
 simply no longer available elsewhere. Without this your compile will fail

That compile failure was fixed in commit
30e69bf4cce16d4c2dcfd629a60fcd8e1aba9fee by Al Viro.

However, as I examine that commit, I see that it defines offsets from
the eth block in the chip, rather than the full chip registeri block
as the Pegasos 2 code expects.  So, I think it fixes the compile
failure, but leaves the Pegasos 2 broken.

Luis, do you have Pegasos 2 hardware?  Can you (or anyone) verify that
the following patch is needed for the Pegasos 2?

Thanks,
-Dale

-

mv643xx_eth: Fix MV643XX_ETH offsets used by Pegasos 2

In the mv643xx_eth driver, we now use offsets from the ethernet
register block within the chip, but the pegasos 2 platform still
needs offsets from the full chip's register base address.

Signed-off-by: Dale Farnsworth [EMAIL PROTECTED]
---
 include/linux/mv643xx_eth.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index 8df230a..30e11aa 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -8,9 +8,9 @@
 #define MV643XX_ETH_NAME   mv643xx_eth
 #define MV643XX_ETH_SHARED_REGS0x2000
 #define MV643XX_ETH_SHARED_REGS_SIZE   0x2000
-#define MV643XX_ETH_BAR_4  0x220
-#define MV643XX_ETH_SIZE_REG_4 0x224
-#define MV643XX_ETH_BASE_ADDR_ENABLE_REG   0x0290
+#define MV643XX_ETH_BAR_4  0x2220
+#define MV643XX_ETH_SIZE_REG_4 0x2224
+#define MV643XX_ETH_BASE_ADDR_ENABLE_REG   0x2290
 
 struct mv643xx_eth_platform_data {
int port_number;
-
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] pegasos_eth.c: Fix compile error over MV643XX_ defines

2007-10-29 Thread Lennert Buytenhek
On Mon, Oct 29, 2007 at 05:27:29PM -0400, Luis R. Rodriguez wrote:

 This commit made an incorrect assumption:
 --
 Author: Lennert Buytenhek [EMAIL PROTECTED]
  Date:   Fri Oct 19 04:10:10 2007 +0200
 
 mv643xx_eth: Move ethernet register definitions into private header
 
 Move the mv643xx's ethernet-related register definitions from
 include/linux/mv643xx.h into drivers/net/mv643xx_eth.h, since
 they aren't of any use outside the ethernet driver.
 
 Signed-off-by: Lennert Buytenhek [EMAIL PROTECTED]
 Acked-by: Tzachi Perelstein [EMAIL PROTECTED]
 Signed-off-by: Dale Farnsworth [EMAIL PROTECTED]
 --
 
 arch/powerpc/platforms/chrp/pegasos_eth.c made use of a 3 defines there.
 
 [EMAIL PROTECTED]:~/devel/wireless-2.6$ git-describe 
 
 v2.6.24-rc1-138-g0119130
 
 This patch fixes this by internalizing 3 defines onto pegasos which are
 simply no longer available elsewhere. Without this your compile will fail
 whenever you enable 'Common Hardware Reference Platform (CHRP) based 
 machines',

 [...]
 
 diff --git a/arch/powerpc/platforms/chrp/pegasos_eth.c 
 b/arch/powerpc/platforms/chrp/pegasos_eth.c
 index 5bcc58d..1fc9e8c 100644
 --- a/arch/powerpc/platforms/chrp/pegasos_eth.c
 +++ b/arch/powerpc/platforms/chrp/pegasos_eth.c
 @@ -24,6 +24,9 @@
  #define PEGASOS2_SRAM_BASE_ETH0  (PEGASOS2_SRAM_BASE)
  #define PEGASOS2_SRAM_BASE_ETH1  
 (PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
  
 +#define PEGASOS2_ETH_BAR_4   0x2220
 +#define PEGASOS2_ETH_SIZE_REG_4  0x2224
 +#define PEGASOS2_ETH_BASE_ADDR_ENABLE_REG0x2290
  
  #define PEGASOS2_SRAM_RXRING_SIZE(PEGASOS2_SRAM_SIZE/4)
  #define PEGASOS2_SRAM_TXRING_SIZE(PEGASOS2_SRAM_SIZE/4)
 @@ -147,13 +150,13 @@ static int Enable_SRAM(void)
  
   ALong = 0x02;
   ALong |= PEGASOS2_SRAM_BASE  0x;
 - MV_WRITE(MV643XX_ETH_BAR_4, ALong);
 + MV_WRITE(PEGASOS2_ETH_BAR_4, ALong);
  
 - MV_WRITE(MV643XX_ETH_SIZE_REG_4, (PEGASOS2_SRAM_SIZE-1)  0x);
 + MV_WRITE(PEGASOS2_ETH_SIZE_REG_4, (PEGASOS2_SRAM_SIZE-1)  0x);
  
 - MV_READ(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
 + MV_READ(PEGASOS2_ETH_BASE_ADDR_ENABLE_REG, ALong);
   ALong = ~(1  4);
 - MV_WRITE(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
 + MV_WRITE(PEGASOS2_ETH_BASE_ADDR_ENABLE_REG, ALong);
  
  #ifdef BE_VERBOSE
   printk(Pegasos II/Marvell MV64361: register unmapped\n);

Al Viro sent a patch for this breakage a couple of days ago:

http://marc.info/?l=linux-kernelm=119351541706811w=2

(FWIW, I think that code outside of mv643xx_eth.c should not be poking
into the mv643xx's registers directly.  Ideally, this info should just
be passed by pegasos_eth into mv643xx_eth via platform data, and then
mv643xx_eth can write the relevant hardware registers.)
-
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][RFC] Add support for the RDC R6040 Fast Ethernet controller

2007-10-29 Thread Florian Fainelli
This patch adds support for the RDC R6040 MAC we can find in the RDC R-321x 
System-on-chips.
This driver really needs improvements especially on the NAPI part which 
probably does not
fully use the new NAPI structure.
You will need the RDC PCI identifiers if you want to test this driver which are 
the following ones :

RDC_PCI_VENDOR_ID = 0x17f3
RDC_PCI_DEVICE_ID_RDC_R6040 = 0x6040

Thank you very much in advance for your comments.

Signed-off-by: Sten Wang [EMAIL PROTECTED]
Signed-off-by: Daniel Gimpelevich [EMAIL PROTECTED]
Signed-off-by: Florian Fainelli [EMAIL PROTECTED]
---
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index ce34b53..c8a5eef 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -1643,6 +1643,24 @@ config 8139_OLD_RX_RESET
  experience problems, you can enable this option to restore the
  old RX-reset behavior.  If unsure, say N.
 
+config R6040
+   tristate RDC R6040 Fast Ethernet Adapter support (EXPERIMENTAL)
+   depends on NET_PCI  PCI  EXPERIMENTAL
+   select MII
+   help
+ This is a driver for the R6040 Fast Ethernet MACs found in the
+ the RDC R-321x System-on-chips.
+
+ To compile this driver as a module, choose M here: the module
+ will be called r6040. This is recommended.
+
+config R6040_NAPI
+   bool NAPI support for R6040
+   depends on R6040
+   default y
+   help
+ Enable the NAPI polling for the R6040 driver.
+
 config SIS900
tristate SiS 900/7016 PCI Fast Ethernet Adapter support
depends on NET_PCI  PCI
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 22f78cb..5fb95ca 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_VIA_RHINE) += via-rhine.o
 obj-$(CONFIG_VIA_VELOCITY) += via-velocity.o
 obj-$(CONFIG_ADAPTEC_STARFIRE) += starfire.o
 obj-$(CONFIG_RIONET) += rionet.o
+obj-$(CONFIG_R6040) += r6040.o
 
 #
 # end link order section
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
new file mode 100644
index 000..ada1b7f
--- /dev/null
+++ b/drivers/net/r6040.c
@@ -0,0 +1,970 @@
+/*
+ * RDC R6040 Fast Ethernet MAC support
+ *
+ * Copyright (C) 2004 Sten Wang [EMAIL PROTECTED]
+ * Copyright (C) 2007 Daniel Gimpelevich [EMAIL PROTECTED]
+ * Florian Fainelli [EMAIL PROTECTED]
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA  02110-1301, USA.
+ *
+ * Changelog :
+ * --  
+ * 10-07-2007  Clean up the driver using checkpatch
+ * 08-24-2006  Support at linux 2.6.10 above
+ * 03-24-2006  Support NAPI
+ * 03-21-2006  change spin_lock_irqsave(lp-lock, flags)
+ * to spin_lock_irqsave(lp-lock, flags)
+ * in set_multicast_list
+ * 03-15-2006  Modify the set_multicast_list ,due to when re-plug the 
ethernet,
+ * it will forget the previous setting
+ * 07-12-2005  modify the set_multicast_list
+ * 03-28-2005  modify some error mac register offset in
+ * function set_multicast_list
+ * 03-27-2005  Add the internal state machine reset
+ * If multicast address more than 4, enter PROM mode
+ * Changed rdc to r6040
+ * 12-22-2004  Sten Init MAC MBCR register=0x012A
+ * PHY_CAP = 0x01E1
+ *
+ * Need to Do LIst:
+ * 1. If multicast address more than 4, use the multicast address hash
+*/
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/version.h
+#include linux/moduleparam.h
+#include linux/string.h
+#include linux/timer.h
+#include linux/errno.h
+#include linux/ioport.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/pci.h
+#include linux/netdevice.h
+#include linux/etherdevice.h
+#include linux/skbuff.h
+#include linux/init.h
+#include linux/delay.h
+#include linux/mii.h
+#include linux/ethtool.h
+#include linux/crc32.h
+#include linux/spinlock.h
+
+#include asm/processor.h
+#include asm/bitops.h
+#include asm/io.h
+#include asm/irq.h
+#include asm/uaccess.h
+
+#define DRV_NAME   r6040
+#define DRV_VERSION0.14
+#define DRV_RELDATE29Oct2007
+
+/* PHY CHIP Address */
+#define PHY1_ADDR  1   /* 

Re: drivers/net/sunhme.c patch

2007-10-29 Thread Jan Engelhardt

On Oct 29 2007 15:10, David Miller wrote:
 On Oct 29 2007 08:54, Tom Southerland wrote:
 
  This patch provides a unique mac address for all interfaces
  for the Sun QFE card (non-sparc).  It takes the base mac from
  the first interface and increments the mac address for the
  other interfaces.
 
 Where is the difference to a SPARC QFE? PCI is PCI after all, is not it?

To answer the question, yes it is just a normal PCI device, they put 4
HME chips behind a PCI bridge.  However, the OpenFirmware on the cards
usually creates device node properties for these PCI devices for the
local ethernet addresses.  That's what he's trying to duplicate here.

The question was more like: if I put in a QFE (that was acquired together
with a SUN E250) into x86, would I get duplicate MACs? (Would be strange -
I would have supposed the OF on the card is independent.)

-
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: drivers/net/sunhme.c patch

2007-10-29 Thread David Miller
From: Jan Engelhardt [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 23:12:25 +0100 (CET)

 The question was more like: if I put in a QFE (that was acquired together
 with a SUN E250) into x86, would I get duplicate MACs? (Would be strange -
 I would have supposed the OF on the card is independent.)

You are not supposed to.  Each HME instance should get a unique
MAC.

Normally OF would propagate this information around to the independant
device nodes, and we should try to preserve this behavior for non-OF
systems.
-
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: Configuring the same IP on multiple addresses

2007-10-29 Thread David Miller
From: David Miller [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 15:25:59 -0700 (PDT)

 Can you guys please just state upfront what virtualization
 issue is made more difficult by features you want to remove?

Sorry, I mentioned virtualization because that's been the
largest majority of the cases being presented lately.

I suspect in your case it's some multicast or SCTP thing :-)
-
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] inet: race in wait for connect.

2007-10-29 Thread Stephen Hemminger
On Mon, 29 Oct 2007 15:38:42 -0700 (PDT)
David Miller [EMAIL PROTECTED] wrote:

 From: Stephen Hemminger [EMAIL PROTECTED]
 Date: Mon, 29 Oct 2007 14:37:14 -0700
 
  On Mon, 29 Oct 2007 19:29:06 -0200
  Arnaldo Carvalho de Melo [EMAIL PROTECTED] wrote:
  
   Em Mon, Oct 29, 2007 at 01:52:22PM -0700, Stephen Hemminger escreveu:
Fix possible race while waiting for connections in accept. I don't
know of a test case that could reproduce this directly.

The state of the socket should be checked before checking the queue.
If the socket has left the TCP_LISTEN state, then the accept queue
is no longer valid.
   
   Well if it left from LISTEN to CLOSED inet_csk_listen_stop must have
   been called, and that calls reqsk_queue_yank_acceptq, that sets it to
   NULL, reqsk_queue_empty(icsk-icsk_accept_queue) returns true and we
   get to if (sk-sk_state != TCP_LISTEN), returning -EINVAL as with your
   patch.  So I can't see a race, just one branch less in one case :-)
   
   - Arnaldo
  
  Yeah, your right. The listen queue is garbage at this point but the
  accept queue is always empty.
 
 Is there some failing test case you are aware of which led
 you to this piece of code or did you happen to notice it
 while scanning around?

While instrumenting the snot out of accept logic for looking at alternatives
to the MT-accept vs. close issue.

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


Re: [PATCH 1/2] [CRYPTO] tcrypt: Move sg_init_table out of timing loops

2007-10-29 Thread Herbert Xu
On Mon, Oct 29, 2007 at 09:16:27PM +0100, Jens Axboe wrote:
 On Fri, Oct 26 2007, Herbert Xu wrote:
  [CRYPTO] tcrypt: Move sg_init_table out of timing loops
  
  This patch moves the sg_init_table out of the timing loops for hash
  algorithms so that it doesn't impact on the speed test results.
 
 Wouldn't it be better to just make sg_init_one() call sg_init_table?

This looks fine to me although I think it's orthogonal to the
patch you were quoting :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmVHI~} [EMAIL PROTECTED]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Fwd: Bug with tun0 and VLAN

2007-10-29 Thread Bruno Clermont
Hi,

I previously contacted tun driver maintainer about a bug I found and
he suggested me to forward this to you.
so, look like there is a bug in the kernel when the VLAN code is
dealing with an interface like the tun interface.

see forwarded my original mail and Max reply.

thanks!

-- Forwarded message --
From: Max Krasnyansky [EMAIL PROTECTED]
Date: Oct 29, 2007 8:29 PM
Subject: Re: Bug with tun0 and VLAN
To: Bruno Clermont [EMAIL PROTECTED]

Hi Bruno,

 Hi,

 I'm writing to you, because you seem to be the maintainer of the tun driver.

 I hit a bug lately. I was testing this scenario:

 [Server1][eth0]---(Internet)--[eth0][Server2]

 I want to be able to route traffic for many VLAN into a single tunnel
 instead of invoking 1 openvpn process per VLAN. so, I tried to add VLAN
 to tun interface.

 I create an OpenVPN tunnel between Server1 and 2, this part work. the
 tun0 is going up. I use heavily openvpn and I'm sure of me on this part.
 I made sure openvpn did not set any IP on the tunnel.

 So, I added the vlan to the tun interface on both server:

 ifconfig tun0 up
 vconfig add tun0 1
 vconfig add tun1 2

 on server1:
 ifconfig tun0.1 10.0.0.1 http://10.0.0.1 netmask 255.255.255.0
 http://255.255.255.0 up
 ifconfig tun0.1 10.0.1.1 http://10.0.1.1 netmask 255.255.255.0
 http://255.255.255.0 up

 on server2:
 ifconfig tun0.1 10.0.0.2 http://10.0.0.2 netmask 255.255.255.0
 http://255.255.255.0 up
 ifconfig tun0.1 10.0.1.2 http://10.0.1.2 netmask 255.255.255.0
 http://255.255.255.0 up

 Trying to ping the other end of the tun/vlan make the kernel panic on
 the host that try to ping.
 I tried on Ubuntu Feisty and Gutsy (2.6.22) and they both crash.

 I tried it severals times on different host and it seem that combining
 VLAN and tun interface crash the kernel.
 it's easy to reproduce.

 Is it a tun driver issue? VLAN code issue? some other part of the
 kernel? I don't know.

 your my first attempt of communication for this issue... If it's not
 supported, at least the kernel should not panic!

Actually TUN is a point to point device, it does not have Ethernet MAC
headers. In other words VLANs would never work over TUN.
I agree though that it should not crash. So it's better to report this to
netdev mailing list. Basically VLAN code should outright refuse to attach
to TUN devices.

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


drivers/net/sunhme.c patch

2007-10-29 Thread Tom Southerland

This patch provides a unique mac address for all interfaces
for the Sun QFE card (non-sparc).  It takes the base mac from
the first interface and increments the mac address for the
other interfaces.

It still preserves the 'macaddr' parameter so if desired, it
can still be used.

Before patching:

eth0  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
eth1  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
eth2  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
eth3  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB

After patching:

eth0  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
eth1  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BC
eth2  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BD
eth3  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BE

Cheers,

Tom



--- linux-2.6.23.1/drivers/net/sunhme.c.orig2007-10-29 07:58:25.0 
-0600
+++ linux-2.6.23.1/drivers/net/sunhme.c 2007-10-29 08:53:03.0 -0600
@@ -3083,6 +3083,11 @@ static int __devinit happy_meal_pci_prob
}
 #else
get_hme_mac_nonsparc(pdev, dev-dev_addr[0]);
+if(macaddr[5] == 0){
+ for (i = 0; i  6; i++)
+   macaddr[i] = dev-dev_addr[i];
+ macaddr[5]++;
+}
 #endif
}


-
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: drivers/net/sunhme.c patch

2007-10-29 Thread David Miller
From: Tom Southerland [EMAIL PROTECTED]
Date: Mon, 29 Oct 2007 19:53:52 -0600

 This patch provides a unique mac address for all interfaces
 for the Sun QFE card (non-sparc).  It takes the base mac from
 the first interface and increments the mac address for the
 other interfaces.
 
 It still preserves the 'macaddr' parameter so if desired, it
 can still be used.
 
 Before patching:
 
 eth0  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
 eth1  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
 eth2  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
 eth3  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
 
 After patching:
 
 eth0  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BB
 eth1  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BC
 eth2  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BD
 eth3  Link encap:Ethernet  HWaddr 00:03:BA:17:4C:BE

Unfortunately, although I understand what you're trying to do,
this change is not correct.

We obtain properly the local-mac-address property stored in
the PCI ROM of each interface, and if you look at the code
we look the MACs up by interface index.

So we are (or should be) obtaining the per-interface MAC
address programmed into the onboard firmware.

Perhaps in get_hme_mac_nonsparc(), is_quattro_p() is evaluating
false and therefore we mistakedly always use index 0?

Could you please check this?  That's probably what the problem
is.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >