Re: 2.6.23-mm1

2007-10-12 Thread Andrew Morton
On Fri, 12 Oct 2007 07:46:58 +0100 Al Viro <[EMAIL PROTECTED]> wrote:

> On Thu, Oct 11, 2007 at 11:42:02PM -0700, Andrew Morton wrote:
> > On Fri, 12 Oct 2007 14:03:28 +0900 KAMEZAWA Hiroyuki <[EMAIL PROTECTED]> 
> > wrote:
> > 
> > > On Thu, 11 Oct 2007 21:31:26 -0700
> > > Andrew Morton <[EMAIL PROTECTED]> wrote:
> > > 
> > > > 
> > > > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23/2.6.23-mm1/
> > > > 
> > > > - I've been largely avoiding applying anything since rc8-mm2 in an 
> > > > attempt
> > > >   to stabilise things for the 2.6.23 merge.
> > > > 
> > > On RHEL5/x86_64 environment,
> > > 
> > > ==
> > > [EMAIL PROTECTED] ref-2.6.23-mm1]$ make menuconfig
> > > Makefile:456: /home/kamezawa/ref-2.6.23-mm1/arch//Makefile: No such file 
> > > or directory
> > > make: *** No rule to make target 
> > > `/home/kamezawa/ref-2.6.23-mm1/arch//Makefile'.  Stop.
> > > ==
> > > 
> > > $(ARCH) cannot be detected automatically...
> > 
> > So you need to set $ARCH by hand?  I always do that so I didn't notice this.
> > 
> > > What information is useful for fixing this ?
> > 
> > Sam's email address ;)
> 
> More serious breakage happened to UML - include/asm-um/arch went straight
> to hell; I'll look into fixing that tomorrow...

I always forget to test uml.  But a quick test build seems to work until
it hits this:

arch/um/drivers/slip_kern.c: In function 'slip_init':
arch/um/drivers/slip_kern.c:34: error: 'struct net_device' has no member named 
'header_cache_update'
arch/um/drivers/slip_kern.c:35: error: 'struct net_device' has no member named 
'hard_header_cache'
arch/um/drivers/slip_kern.c:36: error: 'struct net_device' has no member named 
'hard_header'


-
To unsubscribe from this list: send 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] IPROUTE2: Support IPv4/IPv6 Tunnel

2007-10-12 Thread YOSHIFUJI Hideaki / 吉藤英明
Based on patch from Yasuyuki KOZAKAI <[EMAIL PROTECTED]>.

Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

--- 
diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c
index 6468d99..cbbdf9d 100644
--- a/ip/ip6tunnel.c
+++ b/ip/ip6tunnel.c
@@ -52,6 +52,7 @@ static void usage(void) __attribute__((noreturn));
 static void usage(void)
 {
fprintf(stderr, "Usage: ip -f inet6 tunnel { add | change | del | show 
} [ NAME ]\n");
+   fprintf(stderr, "  [ mode { ip6ip6 | ipip6 | any } ]\n");
fprintf(stderr, "  [ remote ADDR local ADDR ] [ dev PHYS_DEV 
]\n");
fprintf(stderr, "  [ encaplimit ELIM ]\n");
fprintf(stderr ,"  [ hoplimit HLIM ] [ tc TC ] [ fl FL ]\n");
@@ -116,7 +117,24 @@ static int parse_args(int argc, char **argv, struct 
ip6_tnl_parm *p)
memset(medium, 0, sizeof(medium));
 
while (argc > 0) {
-   if (strcmp(*argv, "remote") == 0) {
+   if (strcmp(*argv, "mode") == 0) {
+   NEXT_ARG();
+   if (strcmp(*argv, "ipv6/ipv6") == 0 ||
+   strcmp(*argv, "ip6ip6") == 0)
+   p->proto = IPPROTO_IPV6;
+   else if (strcmp(*argv, "ip/ipv6") == 0 ||
+strcmp(*argv, "ipv4/ipv6") == 0 ||
+strcmp(*argv, "ipip6") == 0 ||
+strcmp(*argv, "ip4ip6") == 0)
+   p->proto = IPPROTO_IPIP;
+   else if (strcmp(*argv, "any/ipv6") == 0 ||
+strcmp(*argv, "any") == 0)
+   p->proto = 0;
+   else {
+fprintf(stderr,"Cannot guess tunnel mode.\n");
+exit(-1);
+}
+} else if (strcmp(*argv, "remote") == 0) {
inet_prefix raddr;
NEXT_ARG();
get_prefix(&raddr, *argv, preferred_family);
diff --git a/ip/tunnel.c b/ip/tunnel.c
index 5fede2c..104340d 100644
--- a/ip/tunnel.c
+++ b/ip/tunnel.c
@@ -51,6 +51,9 @@ const char *tnl_strproto(__u8 proto)
case IPPROTO_IPV6:
strcpy(buf, "ipv6");
break;
+   case 0:
+   strcpy(buf, "any");
+   break;
default:
strcpy(buf, "unknown");
break;

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[EMAIL PROTECTED]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Regression in net-2.6.24?

2007-10-12 Thread Michael Chan
On Thu, 2007-10-11 at 19:40 -0700, David Miller wrote:
> From: "Michael Chan" <[EMAIL PROTECTED]>
> Date: Thu, 11 Oct 2007 20:17:16 -0700
>
> > > +   if (likely(!tg3_has_work(tp))) {
> > > +   struct tg3_hw_status *sblk = tp->hw_status;
> > > +
> > 
> > --> new status block DMA
> > 
> > > +   if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) {
> > > +   tp->last_tag = sblk->status_tag;
> > > +   rmb();
> > > +   } else
> > > +   sblk->status &= ~SD_STATUS_UPDATED;
> > 
> > We need to read the sblk->status_tag before calling tg3_has_work().  If
> > a new status block DMA happens in between (shown above), tp->last_tag
> > will get the new tag and we will end up acknowledging work that we
> > haven't processed.
> 
> Hmmm, the old code didn't do that and seemingly has the same
> problem.  Also, if you look at the before-patch code and think
> about what it does if we ->poll() multiple times for a single
> interrupt the side-effects are essentially the same.
> 

No, the old code before tonight's patch did this:

if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) {
tp->last_tag = sblk->status_tag;
rmb();
}

before checking for more work.  The rmb() is there to make sure that the
status tag is read and stored before we check for more work.

> What's the crucial difference?
> 

This sequence only matters when we eventually terminate and tell the
hardware the last tag we've processed and turn on the interrupt.  If
there's a status block race condition, the hw will know when the tag
written back does not match the latest one and it will generate an
interrupt right away.  The sequence guarantees that the hw will see the
proper tag corresponding to the work processed by the driver.

[TG3]: Refine napi poll loop.

Need to read and store sblk->status_tag before checking for more work.
The status tag is later written back to the hardware when enabling
interrupts to acknowledge how much work has been processed.  If the
order is reversed, we can end up acknowledging work we haven't
processed.

When we detect tx error, it is more correct to return the rx
work_done so far instead of 0.

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

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 417641a..055cc68 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3576,7 +3576,7 @@ static int tg3_poll_work(struct tg3 *tp, int work_done, 
int budget)
if (sblk->idx[0].tx_consumer != tp->tx_cons) {
tg3_tx(tp);
if (unlikely(tp->tg3_flags & TG3_FLAG_TX_RECOVERY_PENDING))
-   return 0;
+   return work_done;
}
 
/* run RX thread, within the bounds set by NAPI.
@@ -3593,6 +3593,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
 {
struct tg3 *tp = container_of(napi, struct tg3, napi);
int work_done = 0;
+   struct tg3_hw_status *sblk = tp->hw_status;
 
while (1) {
work_done = tg3_poll_work(tp, work_done, budget);
@@ -3603,15 +3604,17 @@ static int tg3_poll(struct napi_struct *napi, int 
budget)
if (unlikely(work_done >= budget))
break;
 
-   if (likely(!tg3_has_work(tp))) {
-   struct tg3_hw_status *sblk = tp->hw_status;
-
-   if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) {
-   tp->last_tag = sblk->status_tag;
-   rmb();
-   } else
-   sblk->status &= ~SD_STATUS_UPDATED;
+   if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) {
+   /* tp->last_tag is used in tg3_restart_ints() below
+* to tell the hw how much work has been processed,
+* so we must read it before checking for more work.
+*/
+   tp->last_tag = sblk->status_tag;
+   rmb();
+   } else
+   sblk->status &= ~SD_STATUS_UPDATED;
 
+   if (likely(!tg3_has_work(tp))) {
netif_rx_complete(tp->dev, napi);
tg3_restart_ints(tp);
break;
@@ -3621,9 +3624,10 @@ static int tg3_poll(struct napi_struct *napi, int budget)
return work_done;
 
 tx_recovery:
+   /* work_done is guaranteed to be less than budget. */
netif_rx_complete(tp->dev, napi);
schedule_work(&tp->reset_task);
-   return 0;
+   return work_done;
 }
 
 static void tg3_irq_quiesce(struct tg3 *tp)




-
To unsubscribe from this list: send 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: iproute2: resend of patches from Debian.

2007-10-12 Thread David Miller
From: Alexander Wirt <[EMAIL PROTECTED]>
Date: Fri, 12 Oct 2007 07:50:54 +0200

> I took over the iproute package when it was in a pretty bad shape, most of
> the patches submitted were still applied at that time. I ever planed a
> carefull review of the patches and to submit them later, but due to real life
> reasons I never got so far. Thanks to Andreas (who will be on of the new
> maintainers of the package) for doing that for me. 
> 
> Some of the patches also need some reworking before applying them outside of
> a distribution. But you are right, it was my fault not to send in the patches
> and I promise to give more patches back in the future (moving package
> development to git in the near future will help with that too).

Thanks for explaining the situation, hopefully we'll starighten
this all out.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Regression in net-2.6.24?

2007-10-12 Thread David Miller
From: "Michael Chan" <[EMAIL PROTECTED]>
Date: Fri, 12 Oct 2007 01:54:13 -0700

> On Thu, 2007-10-11 at 19:40 -0700, David Miller wrote:
> > Hmmm, the old code didn't do that and seemingly has the same
> > problem.  Also, if you look at the before-patch code and think
> > about what it does if we ->poll() multiple times for a single
> > interrupt the side-effects are essentially the same.
> > 
> 
> No, the old code before tonight's patch did this:
> 
> if (tp->tg3_flags & TG3_FLAG_TAGGED_STATUS) {
>   tp->last_tag = sblk->status_tag;
>   rmb();
> }
> 
> before checking for more work.  The rmb() is there to make sure that the
> status tag is read and stored before we check for more work.

No I understand, thanks!

> [TG3]: Refine napi poll loop.
> 
> Need to read and store sblk->status_tag before checking for more work.
> The status tag is later written back to the hardware when enabling
> interrupts to acknowledge how much work has been processed.  If the
> order is reversed, we can end up acknowledging work we haven't
> processed.
> 
> When we detect tx error, it is more correct to return the rx
> work_done so far instead of 0.
> 
> Signed-off-by: Michael Chan <[EMAIL PROTECTED]>

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


[TC]: Add NAT action

2007-10-12 Thread Herbert Xu
Hi Stephen:

Here's a patch to add support for the nat action which is now
in the kernel.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/tc/Makefile b/tc/Makefile
index 22cd437..cd5a69e 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -26,6 +26,7 @@ TCMODULES += q_htb.o
 TCMODULES += m_gact.o
 TCMODULES += m_mirred.o
 TCMODULES += m_ipt.o
+TCMODULES += m_nat.o
 TCMODULES += m_pedit.o
 TCMODULES += p_ip.o
 TCMODULES += p_icmp.o
diff --git a/tc/m_nat.c b/tc/m_nat.c
new file mode 100644
index 000..6e7fd05
--- /dev/null
+++ b/tc/m_nat.c
@@ -0,0 +1,213 @@
+/*
+ * m_nat.c NAT module
+ *
+ * This program is free software; you can distribute 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.
+ *
+ * Authors:Herbert Xu <[EMAIL PROTECTED]>
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "utils.h"
+#include "tc_util.h"
+#include 
+
+static void
+explain(void)
+{
+   fprintf(stderr, "Usage: ... nat NAT\n"
+   "NAT := DIRECTION OLD NEW\n"
+   "DIRECTION := { ingress | egress }\n"
+   "OLD := PREFIX\n"
+   "NEW := ADDRESS\n");
+}
+
+static void
+usage(void)
+{
+   explain();
+   exit(-1);
+}
+
+static int
+parse_nat_args(int *argc_p, char ***argv_p,struct tc_nat *sel)
+{
+   int argc = *argc_p;
+   char **argv = *argv_p;
+   inet_prefix addr;
+
+   if (argc <= 0)
+   return -1;
+
+   if (matches(*argv, "egress") == 0)
+   sel->flags |= TCA_NAT_FLAG_EGRESS;
+   else if (matches(*argv, "ingress") != 0)
+   goto bad_val;
+
+   NEXT_ARG();
+
+   if (get_prefix_1(&addr, *argv, AF_INET))
+   goto bad_val;
+
+   sel->old_addr = addr.data[0];
+   sel->mask = htonl(~0u << (32 - addr.bitlen));
+
+   NEXT_ARG();
+
+   if (get_prefix_1(&addr, *argv, AF_INET))
+   goto bad_val;
+
+   sel->new_addr = addr.data[0];
+
+   argc--;
+   argv++;
+
+   *argc_p = argc;
+   *argv_p = argv;
+   return 0;
+
+bad_val:
+   return -1;
+}
+
+static int
+parse_nat(struct action_util *a, int *argc_p, char ***argv_p, int tca_id, 
struct nlmsghdr *n)
+{
+   struct tc_nat sel;
+
+   int argc = *argc_p;
+   char **argv = *argv_p;
+   int ok = 0;
+   struct rtattr *tail;
+
+   memset(&sel, 0, sizeof(sel));
+
+   while (argc > 0) {
+   if (matches(*argv, "nat") == 0) {
+   NEXT_ARG();
+   if (parse_nat_args(&argc, &argv, &sel)) {
+   fprintf(stderr, "Illegal nat construct (%s) \n",
+   *argv);
+   explain();
+   return -1;
+   }
+   ok++;
+   continue;
+   } else if (matches(*argv, "help") == 0) {
+   usage();
+   } else {
+   break;
+   }
+
+   }
+
+   if (!ok) {
+   explain();
+   return -1;
+   }
+
+   if (argc) {
+   if (matches(*argv, "reclassify") == 0) {
+   sel.action = TC_ACT_RECLASSIFY;
+   argc--;
+   argv++;
+   } else if (matches(*argv, "pipe") == 0) {
+   sel.action = TC_ACT_PIPE;
+   argc--;
+   argv++;
+   } else if (matches(*argv, "drop") == 0 ||
+   matches(*argv, "shot") == 0) {
+   sel.action = TC_ACT_SHOT;
+   argc--;
+   argv++;
+   } else if (matches(*argv, "continue") == 0) {
+   sel.action = TC_ACT_UNSPEC;
+   argc--;
+   argv++;
+   } else if (matches(*argv, "pass") == 0) {
+   sel.action = TC_ACT_OK;
+   argc--;
+   argv++;
+   }
+   }
+
+   if (argc) {
+   if (matches(*argv, "index") == 0) {
+   NEXT_ARG();
+   if (get_u32(&sel.index, *argv, 10)) {
+   fprintf(stderr, "Pedit: Illegal \"index\"\n");
+   return -1;
+   }
+   argc--;
+   argv++;
+   }
+   }
+
+   tail = NLMSG_TAIL(n);
+   adda

[PATCH 11/12] Fix overflow in time2tick / tick2time.

2007-10-12 Thread Andreas Henriksson
The helper functions gets passed an unsigned int, which gets cast to long
and overflows. See http://bugs.debian.org/175462

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 tc/tc_core.c |4 ++--
 tc/tc_core.h |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tc/tc_core.c b/tc/tc_core.c
index 58155fb..fb89876 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -35,12 +35,12 @@ int tc_core_time2big(long time)
 }
 
 
-long tc_core_time2tick(long time)
+unsigned tc_core_time2tick(unsigned time)
 {
return time*tick_in_usec;
 }
 
-long tc_core_tick2time(long tick)
+unsigned tc_core_tick2time(unsigned tick)
 {
return tick/tick_in_usec;
 }
diff --git a/tc/tc_core.h b/tc/tc_core.h
index a139da6..b2a16bc 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -7,8 +7,8 @@
 #define TIME_UNITS_PER_SEC 100
 
 int  tc_core_time2big(long time);
-long tc_core_time2tick(long time);
-long tc_core_tick2time(long tick);
+unsigned tc_core_time2tick(unsigned time);
+unsigned tc_core_tick2time(unsigned tick);
 long tc_core_time2ktime(long time);
 long tc_core_ktime2time(long ktime);
 unsigned tc_calc_xmittime(unsigned rate, unsigned size);
-- 
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 2/2] NFS: handle IPv6 addresses in nfs ctl

2007-10-12 Thread Aurélien Charbon
Here is a second missing part of the IPv6 support in NFS server code 
concerning knfd syscall interface.

It updates write_getfd and write_getfd to accept IPv6 addresses.

Applies on a kernel including ip_map cache modifications

Tests: tested with only IPv4 network and basic nfs ops (mount, file creation and modification) 



Signed-off-by: Aurelien Charbon <[EMAIL PROTECTED]>
---

nfsctl.c |   41 ++---
1 file changed, 30 insertions(+), 11 deletions(-)

diff -p -u -r -N linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c 
linux-2.6.23-nfsctl/fs/nfsd/nfsctl.c
--- linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c2007-10-11 
15:23:07.0 +0200
+++ linux-2.6.23-nfsctl/fs/nfsd/nfsctl.c2007-10-12 
10:49:31.0 +0200

@@ -219,7 +219,7 @@ static ssize_t write_unexport(struct fil
static ssize_t write_getfs(struct file *file, char *buf, size_t size)
{
struct nfsctl_fsparm *data;
-struct sockaddr_in *sin;
+struct sockaddr_in6 *sin, sin6_storage;
struct auth_domain *clp;
int err = 0;
struct knfsd_fh *res;
@@ -228,9 +228,20 @@ static ssize_t write_getfs(struct file *
return -EINVAL;
data = (struct nfsctl_fsparm*)buf;
err = -EPROTONOSUPPORT;
-if (data->gd_addr.sa_family != AF_INET)
+sin = &sin6_storage;
+switch (data->gd_addr.sa_family) {
+case AF_INET6:
+sin = (struct sockaddr_in6 *)&data->gd_addr;
+in6 = sin->sin6_addr;
+break;
+case AF_INET:
+/* Map v4 address into v6 structure */
+ipv6_addr_v4map(((struct sockaddr_in 
*)&data->gd_addr)->sin_addr, in6);

+break;
+default:
goto out;
-sin = (struct sockaddr_in *)&data->gd_addr;
+}
+
if (data->gd_maxlen > NFS3_FHSIZE)
data->gd_maxlen = NFS3_FHSIZE;

@@ -238,9 +249,6 @@ static ssize_t write_getfs(struct file *

exp_readlock();

-/* IPv6 address mapping */
-ipv6_addr_v4map(sin->sin_addr, in6);
-
if (!(clp = auth_unix_lookup(in6)))
err = -EPERM;
else {
@@ -257,7 +265,7 @@ static ssize_t write_getfs(struct file *
static ssize_t write_getfd(struct file *file, char *buf, size_t size)
{
struct nfsctl_fdparm *data;
-struct sockaddr_in *sin;
+struct sockaddr_in6 *sin, sin6_storage;
struct in6_addr in6;
struct auth_domain *clp;
int err = 0;
@@ -268,18 +276,29 @@ static ssize_t write_getfd(struct file *
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;
+sin = &sin6_storage;
exp_readlock();

-/* IPv6 address mapping */
-ipv6_addr_v4map(sin->sin_addr, in6);
+switch (data->gd_addr.sa_family) {
+case AF_INET:
+/* IPv6 address mapping */
+ipv6_addr_v4map(((struct sockaddr_in 
*)&data->gd_addr)->sin_addr, in6);

+break;
+case AF_INET6:
+sin = (struct sockaddr_in6 *)&data->gd_addr;
+in6 = sin->sin6_addr;
+break;
+default:
+BUG();
+}

if (!(clp = auth_unix_lookup(in6)))
err = -EPERM;
diff -p -u -r -N linux-2.6.23-ipmap-cache/net/sunrpc/svcauth_unix.c 
linux-2.6.23-nfsctl/net/sunrpc/svcauth_unix.c
--- linux-2.6.23-ipmap-cache/net/sunrpc/svcauth_unix.c2007-10-12 
10:47:27.0 +0200
+++ linux-2.6.23-nfsctl/net/sunrpc/svcauth_unix.c2007-10-12 
10:03:56.0 +0200

@@ -677,7 +677,7 @@ svcauth_unix_set_client(struct svc_rqst
case AF_INET:
sin = svc_addr_in(rqstp);
sin6 = &sin6_storage;
-ipv6_addr_set(&sin6->sin6_addr, 0, 0,
+ipv6_addr_set(&sin6->sin6_addr, 0, 0,
htonl(0x), sin->sin_addr.s_addr);
break;
case AF_INET6:

--


  Aurelien Charbon
  Bull SAS
Echirolles - France
http://www.bullopensource.org/


diff -p -u -r -N linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c linux-2.6.23-nfsctl/fs/nfsd/nfsctl.c
--- linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c	2007-10-11 15:23:07.0 +0200
+++ linux-2.6.23-nfsctl/fs/nfsd/nfsctl.c	2007-10-12 10:49:31.0 +0200
@@ -219,7 +219,7 @@ static ssize_t write_unexport(struct fil
 static ssize_t write_getfs(struct file *file, char *buf, size_t size)
 {
 	struct nfsctl_fsparm *data;
-	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin, sin6_storage;
 	struct auth_domain *clp;
 	int err = 0;
 	struct knfsd_fh *res;
@@ -228,9 +228,20 @@ static ssize_t write_getfs(struct file *
 		return -EINVAL;
 	data = (struct nfsctl_fsparm*)buf;
 	err = -EPROTONOSUPPORT;
-	if (data->gd_addr.sa_family != AF_INET)
+	sin = &sin6_storage;
+	switch (data->gd_addr.sa_family) {
+	case AF_INET6:
+		sin = (struct sockaddr_in6 *)&

[PATCH 1/2] NFS: change the ip_map cache code to handle IPv6 addresses

2007-10-12 Thread Aurélien Charbon

Here is a patch for the ip_map caching code part in nfs server.
I have updated the code to use Brian 
Haley's ipv6_addr_v4mapped function, and corrected pointed out mistakes.
So the first patch in attachment must be applied on a vanilla kernel 
before to include IPv4 mapping functions that are used.


In case of bad formatting due to my mailer, you can also find the patch 
in attachment.


Tests: tested with only IPv4 network and basic nfs ops (mount, file creation and modification) 



Signed-off-by: Aurelien Charbon <[EMAIL PROTECTED]>
---

fs/nfsd/export.c   |   10 ++-
fs/nfsd/nfsctl.c   |   16 -
include/linux/sunrpc/svcauth.h |4 -
include/net/ipv6.h |   17 +
net/sunrpc/svcauth_unix.c  |  117 
-

5 files changed, 118 insertions(+), 46 deletions(-)

diff -p -u -r -N linux-2.6.23-haley/fs/nfsd/export.c 
linux-2.6.23-ipmap-cache/fs/nfsd/export.c
--- linux-2.6.23-haley/fs/nfsd/export.c2007-10-11 15:15:03.0 
+0200
+++ linux-2.6.23-ipmap-cache/fs/nfsd/export.c2007-10-11 
15:23:07.0 +0200

@@ -35,6 +35,7 @@
#include 
#include 
#include 
+#include 

#define NFSDDBG_FACILITYNFSDDBG_EXPORT

@@ -1559,6 +1560,7 @@ exp_addclient(struct nfsctl_client *ncp)
{
struct auth_domain*dom;
inti, err;
+struct in6_addr addr6;

/* First, consistency check. */
err = -EINVAL;
@@ -1577,9 +1579,11 @@ 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++) {
+/* Mapping address */
+ipv6_addr_v4map(ncp->cl_addrlist[i], addr6);
+auth_unix_add_addr(addr6, dom);
+}
auth_unix_forget_old(dom);
auth_domain_put(dom);

diff -p -u -r -N linux-2.6.23-haley/fs/nfsd/nfsctl.c 
linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c
--- linux-2.6.23-haley/fs/nfsd/nfsctl.c2007-10-11 15:15:03.0 
+0200
+++ linux-2.6.23-ipmap-cache/fs/nfsd/nfsctl.c2007-10-11 
15:23:07.0 +0200

@@ -38,6 +38,7 @@

#include 

+#include 
/*
 *We have a single directory with 9 nodes in it.
 */
@@ -222,7 +223,7 @@ static ssize_t write_getfs(struct file *
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;
@@ -236,7 +237,11 @@ static ssize_t write_getfs(struct file *
res = (struct knfsd_fh*)buf;

exp_readlock();
-if (!(clp = auth_unix_lookup(sin->sin_addr)))
+
+/* IPv6 address mapping */
+ipv6_addr_v4map(sin->sin_addr, in6);
+
+if (!(clp = auth_unix_lookup(in6)))
err = -EPERM;
else {
err = exp_rootfh(clp, data->gd_path, res, data->gd_maxlen);
@@ -253,6 +258,7 @@ static ssize_t write_getfd(struct file *
{
struct nfsctl_fdparm *data;
struct sockaddr_in *sin;
+struct in6_addr in6;
struct auth_domain *clp;
int err = 0;
struct knfsd_fh fh;
@@ -271,7 +277,11 @@ static ssize_t write_getfd(struct file *
res = buf;
sin = (struct sockaddr_in *)&data->gd_addr;
exp_readlock();
-if (!(clp = auth_unix_lookup(sin->sin_addr)))
+
+/* IPv6 address mapping */
+ipv6_addr_v4map(sin->sin_addr, in6);
+
+if (!(clp = auth_unix_lookup(in6)))
err = -EPERM;
else {
err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
diff -p -u -r -N linux-2.6.23-haley/include/linux/sunrpc/svcauth.h 
linux-2.6.23-ipmap-cache/include/linux/sunrpc/svcauth.h
--- linux-2.6.23-haley/include/linux/sunrpc/svcauth.h2007-10-11 
15:15:00.0 +0200
+++ linux-2.6.23-ipmap-cache/include/linux/sunrpc/svcauth.h
2007-10-11 15:23:07.0 +0200

@@ -120,10 +120,10 @@ extern voidsvc_auth_unregister(rpc_auth

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 auth_unix_forget_old(struct auth_domain *dom);
extern void svcauth_unix_purge(void);
extern void svcauth_unix_info_release(void *);
diff -p -u -r -N linux-2.6.23-haley/include/net/ipv6.h 
linux-2.6.23-ipmap-cache/include/net/ipv6.h
--- linux-2.6.23-haley/include/net/ipv6.h2007-10-11 
15:21:23.0 +0200
+++ linux-2.6.23-ipmap-cache/include/net/ipv6.h2007-10-12 
10:46:09.0 +0200

@@ -21,6 +21,7 @@
#include 
#include 
#include 
+#include 

#define SIN6_LEN_RFC213324

@@ -167,6 +168,12 @@ DECLARE_S

[PATCH 12/12] Drop bogus reference to tc-filters and add lartc.org link to manpage.

2007-10-12 Thread Andreas Henriksson
From: Alexander Wirt <[EMAIL PROTECTED]>


Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 man/man8/ip.8 |2 ++
 man/man8/tc.8 |3 ++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 153123a..8fd6d52 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -1830,6 +1830,8 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2.
 .RB "IP Command reference " ip-cref.ps
 .br
 .RB "IP tunnels " ip-cref.ps
+.br
+.RB "User documentation at " http://lartc.org/ ", but please direct bugreports 
and patches to: " 
 
 .SH AUTHOR
 Original Manpage  by Michail Litvak <[EMAIL PROTECTED]>
diff --git a/man/man8/tc.8 b/man/man8/tc.8
index 6acd572..53a866f 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -339,7 +339,8 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2.
 .BR tc-pfifo (8),
 .BR tc-bfifo (8),
 .BR tc-pfifo_fast (8),
-.BR tc-filters (8)
+.br
+.RB "User documentation at " http://lartc.org/ ", but please direct bugreports 
and patches to: " 
 
 .SH AUTHOR
 Manpage maintained by bert hubert ([EMAIL PROTECTED])
-- 
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 01/12] Fix various typos and nitpicks

2007-10-12 Thread Andreas Henriksson
From: Alexander Wirt <[EMAIL PROTECTED]>

Fix typo in ss manpage.
Make the backslash visible in ip manpage (http://bugs.debian.org/285507).
Strict syntax for ip addr advice in error message.
Fix typo in libnetlink(3) manpage (writen -> written).
Fix typos in tc-prio(8) manpage.
Fix typo in tc-htb(8) manpage (mininum -> minimum).
Fix typo in tc-cbq-details(8) manpage (occured -> occurred).

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 ip/ipaddress.c|2 +-
 man/man3/libnetlink.3 |2 +-
 man/man8/ip.8 |2 +-
 man/man8/ss.8 |2 +-
 man/man8/tc-cbq-details.8 |2 +-
 man/man8/tc-htb.8 |2 +-
 man/man8/tc-prio.8|8 
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/ip/ipaddress.c b/ip/ipaddress.c
index 518d8cd..d1c6620 100644
--- a/ip/ipaddress.c
+++ b/ip/ipaddress.c
@@ -1019,7 +1019,7 @@ int do_ipaddr(int argc, char **argv)
return ipaddr_list_or_flush(argc-1, argv+1, 1);
if (matches(*argv, "help") == 0)
usage();
-   fprintf(stderr, "Command \"%s\" is unknown, try \"ip address 
help\".\n", *argv);
+   fprintf(stderr, "Command \"%s\" is unknown, try \"ip addr help\".\n", 
*argv);
exit(-1);
 }
 
diff --git a/man/man3/libnetlink.3 b/man/man3/libnetlink.3
index 145f38d..15a478a 100644
--- a/man/man3/libnetlink.3
+++ b/man/man3/libnetlink.3
@@ -187,7 +187,7 @@ The functions sometimes use fprintf and exit when a fatal 
error occurs.
 This library should be named librtnetlink.
 
 .SH AUTHORS
-netlink/rtnetlink was designed and writen by Alexey Kuznetsov.
+netlink/rtnetlink was designed and written by Alexey Kuznetsov.
 Andi Kleen wrote the man page.
 
 .SH SEE ALSO
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 7181054..153123a 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -379,7 +379,7 @@ shortcut for
 .BR "\-o" , " \-oneline"
 output each record on a single line, replacing line feeds
 with the
-.B '\'
+.B '\e\'
 character. This is convenient when you want to count records 
 with
 .BR wc (1)
diff --git a/man/man8/ss.8 b/man/man8/ss.8
index f732319..19f341e 100644
--- a/man/man8/ss.8
+++ b/man/man8/ss.8
@@ -9,7 +9,7 @@ ss \- another utility to investigate sockets
 is used to dump socket statistics. It allows showing information similar
 to
 .IR netstat .
-It can display more TCP information than state than other tools.
+It can display more TCP and state informations than other tools.
 
 .SH OPTIONS
 These programs follow the usual GNU command line syntax, with long
diff --git a/man/man8/tc-cbq-details.8 b/man/man8/tc-cbq-details.8
index e47da62..09badb9 100644
--- a/man/man8/tc-cbq-details.8
+++ b/man/man8/tc-cbq-details.8
@@ -210,7 +210,7 @@ Consult the map for a class for the
 priority. If found, choose it, and terminate.
 .TP
 (iii)
-Choose the class at which break out to the fallback algorithm occured. 
Terminate.
+Choose the class at which break out to the fallback algorithm occurred. 
Terminate.
 .P
 The packet is enqueued to the class which was chosen when either algorithm 
 terminated. It is therefore possible for a packet to be enqueued *not* at a
diff --git a/man/man8/tc-htb.8 b/man/man8/tc-htb.8
index f61b818..d196ecd 100644
--- a/man/man8/tc-htb.8
+++ b/man/man8/tc-htb.8
@@ -137,7 +137,7 @@ packet. Should be at least as high as the highest cburst of 
all children.
 .SH NOTES
 Due to Unix timing constraints, the maximum ceil rate is not infinite and may 
in fact be quite low. On Intel, 
 there are 100 timer events per second, the maximum rate is that rate at which 
'burst' bytes are sent each timer tick.
-From this, the mininum burst size for a specified rate can be calculated. For 
i386, a 10mbit rate requires a 12 kilobyte 
+From this, the minimum burst size for a specified rate can be calculated. For 
i386, a 10mbit rate requires a 12 kilobyte 
 burst as 100*12kb*8 equals 10mbit.
 
 .SH SEE ALSO
diff --git a/man/man8/tc-prio.8 b/man/man8/tc-prio.8
index e942e62..780bcd5 100644
--- a/man/man8/tc-prio.8
+++ b/man/man8/tc-prio.8
@@ -30,7 +30,7 @@ traffic.
 On creation with 'tc qdisc add', a fixed number of bands is created. Each
 band is a class, although is not possible to add classes with 'tc qdisc
 add', the number of bands to be created must instead be specified on the
-commandline attaching PRIO to its root.
+command line attaching PRIO to its root.
 
 When dequeueing, band 0 is tried first and only if it did not deliver a
 packet does PRIO try band 1, and so onwards. Maximum reliability packets
@@ -88,7 +88,7 @@ this:
 The four TOS bits (the 'TOS field') are defined as:
 
 .nf
-Binary Decimcal  Meaning
+Binary Decimal  Meaning
 -
 1000   8 Minimize delay (md)
 0100   4 Maximize throughput (mt)
@@ -125,13 +125,13 @@ TOS Bits  MeansLinux Priority
Band
 
 The second column contains the value of the relevant
 four TOS bits, followed by their translate

[PATCH 02/12] Add parameters to usage help text.

2007-10-12 Thread Andreas Henriksson
From: Alexander Wirt <[EMAIL PROTECTED]>

Add src option to route help text (http://bugs.debian.org/226142).
Add prio option to rule prio help text (http://bugs.debian.org/213673).

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 ip/iproute.c |2 +-
 ip/iprule.c  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index 77bdf83..d3a3243 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -74,7 +74,7 @@ static void usage(void)
fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n");
fprintf(stderr, "   [ rtt TIME ] [ rttvar TIME ]\n");
fprintf(stderr, "   [ window NUMBER] [ cwnd NUMBER ] [ initcwnd 
NUMBER ]\n");
-   fprintf(stderr, "   [ ssthresh NUMBER ] [ realms REALM ]\n");
+   fprintf(stderr, "   [ ssthresh NUMBER ] [ realms REALM ] [ src 
ADDRESS ]\n");
fprintf(stderr, "   [ rto_min TIME ]\n");
fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | 
throw |\n");
fprintf(stderr, "  unreachable | prohibit | blackhole | nat 
]\n");
diff --git a/ip/iprule.c b/ip/iprule.c
index e1a943a..0f7c223 100644
--- a/ip/iprule.c
+++ b/ip/iprule.c
@@ -38,7 +38,7 @@ static void usage(void)
 {
fprintf(stderr, "Usage: ip rule [ list | add | del | flush ] SELECTOR 
ACTION\n");
fprintf(stderr, "SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ 
tos TOS ] [ fwmark FWMARK[/MASK] ]\n");
-   fprintf(stderr, "[ dev STRING ] [ pref NUMBER ]\n");
+   fprintf(stderr, "[ dev STRING ] [ pref NUMBER ] [ prio 
NUMBER ]\n");
fprintf(stderr, "ACTION := [ table TABLE_ID ]\n");
fprintf(stderr, "  [ prohibit | reject | unreachable ]\n");
fprintf(stderr, "  [ realms [SRCREALM/]DSTREALM ]\n");
-- 
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 05/12] Fix typo in tunnel code (o_key vs. i_key).

2007-10-12 Thread Andreas Henriksson
From: Herbert Xu <[EMAIL PROTECTED]>

If a dotted quad ikey is specified for GRE tunnels, it gets set as the
okey instead.  This patch fixes it. (http://bugs.debian.org/200714)

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 ip/iptunnel.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index 828d80a..aee526b 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -113,7 +113,7 @@ static int parse_args(int argc, char **argv, int cmd, 
struct ip_tunnel_parm *p)
NEXT_ARG();
p->i_flags |= GRE_KEY;
if (strchr(*argv, '.'))
-   p->o_key = get_addr32(*argv);
+   p->i_key = get_addr32(*argv);
else {
if (get_unsigned(&uval, *argv, 0)<0) {
fprintf(stderr, "invalid value of 
\"ikey\"\n");
-- 
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 10/12] Fix off-by-one in print of wrandom algo.

2007-10-12 Thread Andreas Henriksson
From: Norbert Buchmuller <[EMAIL PROTECTED]>

The 'wrandom' multipath algo is recognised when adding the route, but
not resolved when it is printed (prints 'unknown'):

ianus:~# ip ro add 1.2.3.4 mpath wrandom nexthop dev ppp0 weight 1 nexthop dev 
ppp1 weight 2
ianus:~# ip ro get to 1.2.3.4
1.2.3.4 mpath unknown dev ppp0  src 62.77.192.67
cache  mtu 1492 advmss 1452 hoplimit 64
ianus:~# ip ro del 1.2.3.4 mpath wrandom nexthop dev ppp0 weight 1 nexthop dev 
ppp1 weight 2

See http://bugs.debian.org/428440 for more information.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 ip/iproute.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ip/iproute.c b/ip/iproute.c
index d3a3243..3b5c4b1 100644
--- a/ip/iproute.c
+++ b/ip/iproute.c
@@ -365,7 +365,7 @@ int print_route(const struct sockaddr_nl *who, struct 
nlmsghdr *n, void *arg)
__u32 mp_alg = *(__u32*) RTA_DATA(tb[RTA_MP_ALGO]);
if (mp_alg > IP_MP_ALG_NONE) {
fprintf(fp, "mpath %s ",
-   mp_alg < IP_MP_ALG_MAX ? mp_alg_names[mp_alg] : 
"unknown");
+   mp_alg <= IP_MP_ALG_MAX ? mp_alg_names[mp_alg] : 
"unknown");
}
}
 
-- 
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 07/12] Fix corruption when using batch files with comments and broken lines.

2007-10-12 Thread Andreas Henriksson
I could only reproduce on some old pentium machine, don't know why.
Anyway, the patch fixes a problem resulting in a double free
that occurs when using batch files that contains a special combination
of broken up lines and comments as reported in:
http://bugs.debian.org/398912

Thanks to Michal Pokrywka <[EMAIL PROTECTED]> for testcase and information
on which conditions problem could be reproduced under.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 include/utils.h |2 +-
 lib/utils.c |8 +---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/utils.h b/include/utils.h
index 7da2b29..9ee55fd 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -144,7 +144,7 @@ int print_timestamp(FILE *fp);
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 extern int cmdlineno;
-extern size_t getcmdline(char **line, size_t *len, FILE *in);
+extern ssize_t getcmdline(char **line, size_t *len, FILE *in);
 extern int makeargs(char *line, char *argv[], int maxargs);
 
 #endif /* __UTILS_H__ */
diff --git a/lib/utils.c b/lib/utils.c
index 4c42dfd..ffef6fe 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -642,9 +642,9 @@ int print_timestamp(FILE *fp)
 int cmdlineno;
 
 /* Like glibc getline but handle continuation lines and comments */
-size_t getcmdline(char **linep, size_t *lenp, FILE *in)
+ssize_t getcmdline(char **linep, size_t *lenp, FILE *in)
 {
-   size_t cc;
+   ssize_t cc;
char *cp;
 
if ((cc = getline(linep, lenp, in)) < 0)
@@ -672,9 +672,11 @@ size_t getcmdline(char **linep, size_t *lenp, FILE *in)
if (cp)
*cp = '\0';
 
-   *linep = realloc(*linep, strlen(*linep) + strlen(line1) + 1);
+   *lenp = strlen(*linep) + strlen(line1) + 1;
+   *linep = realloc(*linep, *lenp);
if (!*linep) {
fprintf(stderr, "Out of memory\n");
+   *lenp = 0;
return -1;
}
cc += cc1 - 2;
-- 
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 06/12] Remove bogus reference to tc-filters(8) from tc(8) manpage.

2007-10-12 Thread Andreas Henriksson
From: Andreas Barth <[EMAIL PROTECTED]>

Spotted by Aleš Kozumplík <[EMAIL PROTECTED]>
(http://bugs.debian.org/289225)

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 man/man8/tc.8 |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/man/man8/tc.8 b/man/man8/tc.8
index b9b8039..6acd572 100644
--- a/man/man8/tc.8
+++ b/man/man8/tc.8
@@ -202,8 +202,7 @@ qdiscs will use all three:
 tc filters
 If tc filters are attached to a class, they are consulted first 
 for relevant instructions. Filters can match on all fields of a packet header, 
-as well as on the firewall mark applied by ipchains or iptables. See 
-.BR tc-filters (8).
+as well as on the firewall mark applied by ipchains or iptables. 
 .TP
 Type of Service
 Some qdiscs have built in rules for classifying packets based on the TOS field.
@@ -242,8 +241,7 @@ qdiscs applies.
 .TP 
 FILTERS
 Filters have a three part ID, which is only needed when using a hashed
-filter hierarchy, for which see
-.BR tc-filters (8).
+filter hierarchy.
 .SH UNITS
 All parameters accept a floating point number, possibly followed by a unit.
 .P
-- 
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 09/12] Add new rtacct/nstat manpages and additional symlinks.

2007-10-12 Thread Andreas Henriksson
Symlink rtstat(8) and ctstat(8) to lnstat(8).
Add rtacct/nstat manpage based on doc/nstat.sgml as rtacct(8).
Symlink nstat(8) to rtacct(8).
Add arpd(8) symlink based on doc/arpd.sgml.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 Makefile  |3 ++
 man/man8/arpd.8   |   66 +
 man/man8/rtacct.8 |   48 ++
 3 files changed, 117 insertions(+), 0 deletions(-)
 create mode 100644 man/man8/arpd.8
 create mode 100644 man/man8/rtacct.8

diff --git a/Makefile b/Makefile
index af0d5e4..6c976dd 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,9 @@ install: all
install -m 0755 -d $(DESTDIR)$(MANDIR)/man8
install -m 0644 $(shell find man/man8 -maxdepth 1 -type f) 
$(DESTDIR)$(MANDIR)/man8
ln -sf tc-bfifo.8  $(DESTDIR)$(MANDIR)/man8/tc-pfifo.8
+   ln -sf lnstat.8  $(DESTDIR)$(MANDIR)/man8/rtstat.8
+   ln -sf lnstat.8  $(DESTDIR)$(MANDIR)/man8/ctstat.8
+   ln -sf rtacct.8  $(DESTDIR)$(MANDIR)/man8/nstat.8
install -m 0755 -d $(DESTDIR)$(MANDIR)/man3
install -m 0644 $(shell find man/man3 -maxdepth 1 -type f) 
$(DESTDIR)$(MANDIR)/man3
 
diff --git a/man/man8/arpd.8 b/man/man8/arpd.8
new file mode 100644
index 000..d172600
--- /dev/null
+++ b/man/man8/arpd.8
@@ -0,0 +1,66 @@
+.TH ARPD 8 "28 June, 2007"
+
+.SH NAME
+arpd \- userspace arp daemon.
+
+.SH SYNOPSIS
+Usage: arpd [ -lk ] [ -a N ] [ -b dbase ] [ -f file ] [ interfaces ]
+
+.SH DESCRIPTION
+The
+.B arpd
+daemon collects gratuitous ARP information, saving it on local disk and 
feeding it to kernel on demand to avoid redundant broadcasting due to limited 
size of kernel ARP cache.
+
+.SH OPTIONS
+.TP
+-h -?
+Print help
+.TP
+-l
+Dump arpd database to stdout and exit. Output consists of three columns: 
interface index, IP address and MAC address. Negative entries for dead hosts 
are also shown, in this case MAC address is replaced by word FAILED followed by 
colon and time when the fact that host is dead was proven the last time.
+.TP
+-f 
+Read and load arpd database from FILE in text format similar dumped by option 
-l. Exit after load, probably listing resulting database, if option -l is also 
given. If FILE is -, stdin is read to get ARP table.
+.TP
+-b 
+location of database file. Default location is /var/lib/arpd/arpd.db
+.TP
+-a 
+arpd not only passively listens ARP on wire, but also send brodcast queries 
itself. NUMBER is number of such queries to make before destination is 
considered as dead. When arpd is started as kernel helper (i.e. with 
app_solicit enabled in sysctl or even with option -k) without this option and 
still did not learn enough information, you can observe 1 second gaps in 
service. Not fatal, but not good.
+.TP
+-k
+Suppress sending broadcast queries by kernel. It takes sense together with 
option -a.
+.TP
+-n 
+Timeout of negative cache. When resolution fails arpd suppresses further 
attempts to resolve for this period. It makes sense only together with option 
-k This timeout should not be too much longer than boot time of a typical host 
not supporting gratuitous ARP. Default value is 60 seconds.
+.TP
+-r 
+Maximal steady rate of broadcasts sent by arpd in packets per second. Default 
value is 1.
+.TP
+-B 
+Number of broadcasts sent by  is the name of networking interface to watch. If no interfaces 
given, arpd monitors all the interfaces. In this case arpd does not adjust 
sysctl parameters, it is supposed user does this himself after arpd is started.
+.P
+Signals
+.br
+arpd exits gracefully syncing database and restoring adjusted sysctl 
parameters, when receives SIGINT or SIGTERM. SIGHUP syncs database to disk. 
SIGUSR1 sends some statistics to syslog. Effect of another signals is 
undefined, they may corrupt database and leave sysctl praameters in an 
unpredictable state.
+.P
+Note
+.br
+In order for arpd to be able to serve as ARP resolver, kernel must be compiled 
with the option CONFIG_ARPD and, in the case when interface list in not given 
on command line, variable app_solicit on interfaces of interest should be in 
/proc/sys/net/ipv4/neigh/*. If this is not made arpd still collects gratuitous 
ARP information in its database.
+.SH EXAMPLES
+.TP
+arpd -b /var/tmp/arpd.db
+Start arpd to collect gratuitous ARP, but not messing with kernel 
functionality.
+.TP
+killall arpd ; arpd -l -b /var/tmp/arpd.db
+Look at result after some time.
+.TP
+arpd -b /var/tmp/arpd.db -a 1 eth0 eth1
+Enable kernel helper, leaving leading role to kernel.
+.TP
+arpd -b /var/tmp/arpd.db -a 3 -k eth0 eth1
+Completely replace kernel resolution on interfaces eth0 and eth1. In this case 
kernel still does unicast probing to validate entries, but all the broadcast 
activity is suppressed and made under authority of arpd.
+.PP
+This is mode which arpd is supposed to work normally. It is not default just 
to prevent occasional enabling of too aggressive mode occasionally.
diff --git a/man/man8/rt

[PATCH]race between open and disconnect in irda-usb

2007-10-12 Thread Oliver Neukum
Hi,

it seems to me that irda_usb_net_open() must set self->netopen
under spinlock or disconnect() may fail to kill all URBs, if it is called
while an interface is opened.

Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>

Regards
Oliver



--- a/drivers/net/irda/irda-usb.c   2007-10-11 17:24:35.0 +0200
+++ b/drivers/net/irda/irda-usb.c   2007-10-11 17:30:30.0 +0200
@@ -1168,6 +1168,7 @@ static int stir421x_patch_device(struct 
 static int irda_usb_net_open(struct net_device *netdev)
 {
struct irda_usb_cb *self;
+   unsigned long flags;
charhwname[16];
int i;

@@ -1177,13 +1178,16 @@ static int irda_usb_net_open(struct net_
self = (struct irda_usb_cb *) netdev->priv;
IRDA_ASSERT(self != NULL, return -1;);
 
+   spin_lock_irqsave(&self->lock, flags);
/* Can only open the device if it's there */
if(!self->present) {
+   spin_unlock_irqrestore(&self->lock, flags);
IRDA_WARNING("%s(), device not present!\n", __FUNCTION__);
return -1;
}
 
if(self->needspatch) {
+   spin_unlock_irqrestore(&self->lock, flags);
IRDA_WARNING("%s(), device needs patch\n", __FUNCTION__) ;
return -EIO ;
}
@@ -1198,6 +1202,7 @@ static int irda_usb_net_open(struct net_
/* To do *before* submitting Rx urbs and starting net Tx queue
 * Jean II */
self->netopen = 1;
+   spin_unlock_irqrestore(&self->lock, flags);
 
/* 
 * Now that everything should be initialized properly,

-
To unsubscribe from this list: send 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 03/12] Prevent renaming interfaces to empty string.

2007-10-12 Thread Andreas Henriksson
From: Alexander Wirt <[EMAIL PROTECTED]>


Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 ip/iplink.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index 4060845..da1f64e 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
}
 
if (newname && strcmp(dev, newname)) {
+   if (strlen(newname) == 0) {
+   printf("\"\" is not valid device identifier\n");
+   return -1;
+   }
if (do_changename(dev, newname) < 0)
return -1;
dev = newname;
-- 
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 04/12] Fix up various problems in netbug script.

2007-10-12 Thread Andreas Henriksson
From: Javier Fernández-Sanguino Peña <[EMAIL PROTECTED]>

Fix race conditions and temporary file symlink attacks.
See http://bugs.debian.org/289541

Additional improvements by Allard Hoeve <[EMAIL PROTECTED]> and others.
See http://bugs.debian.org/313540, http://bugs.debian.org/313541,
and http://bugs.debian.org/313544.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 misc/netbug |   24 
 1 files changed, 8 insertions(+), 16 deletions(-)

diff --git a/misc/netbug b/misc/netbug
index 6d13c8e..7b6ecea 100644
--- a/misc/netbug
+++ b/misc/netbug
@@ -1,23 +1,16 @@
 #! /bin/bash
 
+set -e
+
 echo -n "Send network configuration summary to [ENTER means [EMAIL PROTECTED] "
 IFS="" read mail || exit 1
 [ -z "$mail" ] && [EMAIL PROTECTED]
 
+netbug=`mktemp -d -t netbug.XX` || (echo "$0: Cannot create temporary 
directory" >&2; exit 1; )
+netbugtar=`tempfile -d $netbug --suffix=tar.gz` || (echo "$0: Cannot create 
temporary file" >&2; exit 1; )
+tmppath=$netbug
+trap "/bin/rm -rf $netbug $netbugtar" 0 1 2 3 13 15
 
-netbug=""
-while [ "$netbug" = "" ]; do
-   netbug=`echo netbug.$$.$RANDOM`
-   if [ -e /tmp/$netbug ]; then
-   netbug=""
-   fi
-done
-
-tmppath=/tmp/$netbug
-
-trap "rm -rf $tmppath $tmppath.tar.gz" 0 SIGINT
-
-mkdir $tmppath
 mkdir $tmppath/net
 
 cat /proc/slabinfo > $tmppath/slabinfo
@@ -44,9 +37,8 @@ if [ -e /proc/net/tcp6 ]; then
 fi
 
 cd /tmp
-tar c $netbug | gzip -9c > $netbug.tar.gz
-
-uuencode $netbug.tar.gz $netbug.tar.gz | mail -s $netbug "$mail"
+tar c $tmppath | gzip -9c > $netbugtar
+uuencode $netbugtar $netbugtar | mail -s $netbug "$mail"
 
 echo "Sending to <$mail>; subject is $netbug"
 
-- 
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 08/12] Fix ematch cmp and nbyte syntax help text.

2007-10-12 Thread Andreas Henriksson
From: Lionel Elie Mamane <[EMAIL PROTECTED]>

The help/usage screen of ematch cmp and nbyte say recognised symbolic
values for "layer FOO" are link, header and next-header, but the code
does _not_ implement that: it will recognise "next-header" as what is
supposed to be "header" and will not recognise "header". The right
symbolic values seem to be link, network, transport. Here is a patch
that changes the help/usage screen to match the code.
(http://bugs.debian.org/438653)

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 tc/em_cmp.c   |4 ++--
 tc/em_nbyte.c |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tc/em_cmp.c b/tc/em_cmp.c
index b8f9b46..ce72a42 100644
--- a/tc/em_cmp.c
+++ b/tc/em_cmp.c
@@ -1,5 +1,5 @@
 /*
- * em_cmp.cSimle coparison Ematch
+ * em_cmp.cSimple comparison Ematch
  *
  * This program is free software; you can distribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -32,7 +32,7 @@ static void cmp_print_usage(FILE *fd)
"Usage: cmp(ALIGN at OFFSET [ ATTRS ] { eq | lt | gt } VALUE)\n" \
"where: ALIGN  := { u8 | u16 | u32 }\n" \
"   ATTRS  := [ layer LAYER ] [ mask MASK ] [ trans ]\n" \
-   "   LAYER  := { link | header | next-header | 0..%d }\n" \
+   "   LAYER  := { link | network | transport | 0..%d }\n" \
"\n" \
"Example: cmp(u16 at 3 layer 2 mask 0xff00 gt 20)\n",
TCF_LAYER_MAX);
diff --git a/tc/em_nbyte.c b/tc/em_nbyte.c
index 98f9883..242c361 100644
--- a/tc/em_nbyte.c
+++ b/tc/em_nbyte.c
@@ -32,7 +32,7 @@ static void nbyte_print_usage(FILE *fd)
"Usage: nbyte(NEEDLE at OFFSET [layer LAYER])\n" \
"where: NEEDLE := { string | \"c-escape-sequence\" }\n" \
"   OFFSET := int\n" \
-   "   LAYER  := { link | header | next-header | 0..%d }\n" \
+   "   LAYER  := { link | network | transport | 0..%d }\n" \
"\n" \
"Example: nbyte(\"ababa\" at 12 layer 1)\n",
TCF_LAYER_MAX);
-- 
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] Also do tc_core_time2big argument (long->unsigned).

2007-10-12 Thread Andreas Henriksson
tc_core_time2big only used in tc/q_netem.c where it gets passed an unsigned.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 tc/tc_core.c |2 +-
 tc/tc_core.h |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tc/tc_core.c b/tc/tc_core.c
index 8c3a2ac..1365e08 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -26,7 +26,7 @@
 static double tick_in_usec = 1;
 static double clock_factor = 1;
 
-int tc_core_time2big(long time)
+int tc_core_time2big(unsigned time)
 {
__u64 t = time;
 
diff --git a/tc/tc_core.h b/tc/tc_core.h
index b1ede1e..3a0ed7c 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -6,7 +6,7 @@
 
 #define TIME_UNITS_PER_SEC 100
 
-int  tc_core_time2big(long time);
+int  tc_core_time2big(unsigned time);
 unsigned tc_core_time2tick(unsigned time);
 unsigned tc_core_tick2time(unsigned tick);
 unsigned tc_core_time2ktime(unsigned time);
-- 
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


Kernel panic (network stack)

2007-10-12 Thread xeb

--  Пересланное сообщение  --

Тема: Kernel panic (network stack)
Дата: 12 октября 2007
Отправитель: [EMAIL PROTECTED]
получатель:  [EMAIL PROTECTED]

Hello!
I develop network driver.
It works fine while less then 100 network interfaces exists.
Then i give kernel panic. What could cause it ?

general protection fault:  [1] PREEMPT SMP
CPU 1
Modules linked in: ppp_deflate zlib_deflate zlib_inflate pptp pppox 
ppp_generic slhc rtc 8139too 
Pid: 0, comm: swapper Noy tainted 2.6.22-gentoo-r8 #5
RIP: 0010:[] [] put_page+0x1b/0x110
RSP: 0018:81000171fda0 EFLAGS: 00010286
RAX: 81000ec31080 RBX: a2e9690005e3 RCX: 
RDX:  RSI: 005a RDI: a2e9690005e3
RBP: 81000ec31080 R08: 81000ec31046 R09: 0001
R10:  R11: 80467910 R12: 81001a912800
R13: 0008 R14: 805f7440 R15: 81001a912800
FS:  2ad3cba47ae0() GS: 81001be7df40() knlGS: f7e3b6b0
CS:  0010 DS: 0018 ES: 0018 CR0: 08005003b
CR2: 00413ae0 CR3: 011ef000 CR4: 06e0
Process swapper (pid:0, threadinfo 810001718000, task 81001be6e730
Stack:  0001 81000f16f0c0 81001a912800
 0008 fff80463ab7 8100129d1e42 81000f16f0c0
 81000f16f0c0 fff80463859 806081b0 80489fb5
Call Trace:
 [] skb_release_data+0x77/0xd0
[] kfree_skbmem+0x9/0x80
[] ip_rcv+0xc5/0x6a0
[] netif_receive_skb+0x3f5/0x400
[] netif_receive_skb+0x298/0x400
[] process_backlog+0x9b/0x130
[] net_rx_action+0x88/0x1d0
[] :8139too:rtl8139_interrupt+0x142/0x550
[] __do_softirq+0x6b/0xf0
[] call_softirq+0x1c/0x30
[] do_softirq+0x4a/0xb0
[] do_IRQ+0x80/0x100
[] default_idle+0x0/0x50
[] ret_from_intr+0x0/0xa
 ] default_idle+0x29/0x50
[] cpu_idle+0x90/0xa0


Code: 8b 07 f6 c4 40 0f 85 cc 00 00 00 f0 ff 4f 08 0f 94 c0 84 c0
RIP [] put_page+0x1b/0x110
 RSP: 0018:81000171fda0
Kernel panic - not syncing: Aiee, killing interrupt handler!




---
-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Patrick McHardy
Al Boldi wrote:
>>>The problem is that people think they are safe with the filter table,
>>>when in fact they need the prerouting chain to seal things.  Right now
>>>this is only possible in the mangle table.
>>
>>Why do they need PREROUTING?
> 
> 
> Well, for example to stop any transient packets being forwarded.  You could 
> probably hack around this using mark's, but you can't stop the implied route 
> lookup, unless you stop it in prerouting.


This also works fine in FORWARD with a little extra overhead.
If you really have to save resources, you should use PREROUTING/raw
to also avoid the creation of a connection tracking entry.

-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Al Boldi
Patrick McHardy wrote:
> Al Boldi wrote:
> > Patrick McHardy wrote:
> >>Please send mails discussing netfilter to netfilter-devel.
> >
> > Ok.  I just found out this changed to vger.  But
> > [EMAIL PROTECTED] is bouncing me.
>
> Seems to work, I got your mail on netfilter-devel.

Looks like it works sometimes.  Added lkml as a backup...

> >>Al Boldi wrote:
> >>>With the existence of the mangle table, how useful is the filter table?
> >>>
> >>>Other than requiring the REJECT target to be ported to the mangle
> >>> table, is the filter table faster than the mangle table?
> >>
> >>There are some minor differences in ordering (mangle comes before
> >>DNAT, filter afterwards), but for most rulesets thats completely
> >>irrelevant. The only difference that really matters is that mangle
> >>performs rerouting in LOCAL_OUT for packets that had their routing
> >>key changed, so its really a superset of the filter table. If you
> >>want to use REJECT in the mangle table, you just need to remove the
> >>restriction to filter, it works fine. I would prefer to also remove
> >>the restriction of MARK, CONNMARK etc. to mangle, they're used for
> >>more than just routing today so that restriction also doesn't make
> >>much sense. Patches for this are welcome.
> >
> > Something like this (untested):
> >
> > --- ipt_REJECT.bak.c2007-10-12 08:25:17.0 +0300
> > +++ ipt_REJECT.c2007-10-12 08:31:44.0 +0300
> > @@ -165,6 +165,7 @@ static void send_reset(struct sk_buff *o
> >
> >  static inline void send_unreach(struct sk_buff *skb_in, int code)
> >  {
> > +   if (!skb_in->dst) ip_route_me_harder(&skb_in, RTN_UNSPEC);
> > icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
> >  }
> >
> > @@ -245,9 +246,6 @@ static struct xt_target ipt_reject_reg =
> > .family = AF_INET,
> > .target = reject,
> > .targetsize = sizeof(struct ipt_reject_info),
> > -   .table  = "filter",
> > -   .hooks  = (1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) |
> > - (1 << NF_IP_LOCAL_OUT),
> > .checkentry = check,
> > .me = THIS_MODULE,
> >  };
>
> That includes an unrelated change, I meant to simply remove the filter
> table restriction.
>
> >>>If not, then shouldn't the filter table be obsoleted to avoid
> >>> confusion?
> >>
> >>That would probably confuse people. Just don't use it if you don't
> >>need to.
> >
> > The problem is that people think they are safe with the filter table,
> > when in fact they need the prerouting chain to seal things.  Right now
> > this is only possible in the mangle table.
>
> Why do they need PREROUTING?

Well, for example to stop any transient packets being forwarded.  You could 
probably hack around this using mark's, but you can't stop the implied route 
lookup, unless you stop it in prerouting.


Thanks!

--
Al

-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Patrick McHardy
Jan Engelhardt wrote:
> On Oct 12 2007 16:30, Al Boldi wrote:

With the existence of the mangle table, how useful is the filter table?
>>>
>>>A similar discussion was back in March 2007.
>>>http://marc.info/?l=netfilter-devel&m=117394977210823&w=2
>>>http://marc.info/?l=netfilter-devel&m=117400063907706&w=2
>>>
>>>in the end, my proposal was something like
>>>http://jengelh.hopto.org/GFX0/nf_proposal2.svg
>>
>>Any chance you could publish this as something readable like text/html?
> 
> 
> Like, image/png?
> http://jengelh.hopto.org/GFX0/nf_proposal2.png


The netlink based iptables successor I'm currently working on allows to
dynamically create tables with user-specified priorities and "built-in"
chains. The only built-in tables will be those that need extra
processing (mangle/nat). So it should be possible to set up tables
basically any way you desire.



-
To unsubscribe from this list: send 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] gianfar: Cleanup compile warning caused by 0795af57

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
 drivers/net/gianfar.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 6d1456a..c15fb1f 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -168,7 +168,6 @@ static int gfar_probe(struct platform_device *pdev)
struct gfar_private *priv = NULL;
struct gianfar_platform_data *einfo;
struct resource *r;
-   int idx;
int err = 0;
DECLARE_MAC_BUF(mac);
 
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send 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 9/9] Consolidate the xxx_put

2007-10-12 Thread Pavel Emelyanov
These ones use the generic data types too, so move
them in one place.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index cf583cf..911c2cd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -51,4 +51,10 @@ void inet_frag_destroy(struct inet_frag_queue *q,
struct inet_frags *f, int *work);
 int inet_frag_evictor(struct inet_frags *f);
 
+static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags 
*f)
+{
+   if (atomic_dec_and_test(&q->refcnt))
+   inet_frag_destroy(q, f, NULL);
+}
+
 #endif
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 4ea7948..4470a50 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -154,8 +154,7 @@ static __inline__ struct ipq *frag_alloc_queue(void)
 
 static __inline__ void ipq_put(struct ipq *ipq)
 {
-   if (atomic_dec_and_test(&ipq->q.refcnt))
-   inet_frag_destroy(&ipq->q, &ip4_frags, NULL);
+   inet_frag_put(&ipq->q, &ip4_frags);
 }
 
 /* Kill ipq entry. It is not destroyed immediately,
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c 
b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 862d089..bf6f2f0 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -149,8 +149,7 @@ static inline struct nf_ct_frag6_queue 
*frag_alloc_queue(void)
 
 static __inline__ void fq_put(struct nf_ct_frag6_queue *fq)
 {
-   if (atomic_dec_and_test(&fq->q.refcnt))
-   inet_frag_destroy(&fq->q, &nf_frags, NULL);
+   inet_frag_put(&fq->q, &nf_frags);
 }
 
 /* Kill fq entry. It is not destroyed immediately,
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 454db16..a50fbea 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -167,8 +167,7 @@ static inline struct frag_queue *frag_alloc_queue(void)
 
 static __inline__ void fq_put(struct frag_queue *fq)
 {
-   if (atomic_dec_and_test(&fq->q.refcnt))
-   inet_frag_destroy(&fq->q, &ip6_frags, NULL);
+   inet_frag_put(&fq->q, &ip6_frags);
 }
 
 /* Kill fq entry. It is not destroyed immediately,
-- 
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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Patrick McHardy
Al Boldi wrote:
> Patrick McHardy wrote:
> 
>>Al Boldi wrote:
>>
>>>Well, for example to stop any transient packets being forwarded.  You
>>>could probably hack around this using mark's, but you can't stop the
>>>implied route lookup, unless you stop it in prerouting.
>>
>>This also works fine in FORWARD with a little extra overhead.
>>If you really have to save resources, you should use PREROUTING/raw
>>to also avoid the creation of a connection tracking entry.
> 
> 
> Yes sure, if you use nat.

Conntrack.

> But can you see how forcing people into splitting 
> their rules across tables adds complexity.  And without ipt_REJECT patch, 
> they can't even use REJECT in prerouting, which forces them to do some 
> strange hacks.
> 
> IMHO, we should make things as easily configurable as possible, and as things 
> stand right now, the filter-table is completely useless for 99% of 
> use-cases.


Sure, as I said, patches to remove the arbitary restrictions to
tables are welcome, but please do this for all targets and
matches which allow this, not only REJECT. And if you include a
seperate (tested) patch for the IPv4 and IPv6 REJECT targets
I'll consider it as well.
-
To unsubscribe from this list: send 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/9] Consolidate the xxx_frag_destroy

2007-10-12 Thread Pavel Emelyanov
To make in possible we need to know the exact frag queue
size for inet_frags->mem management and two callbacks:

 * to destoy the skb (optional, used in conntracks only)
 * to free the queue itself (mandatory, but later I plan to 
   move the allocation and the destruction of frag_queues 
   into the common place, so this callback will most likely
   be optional too).

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index e374412..2dd1cd4 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -33,16 +33,21 @@ struct inet_frags {
rwlock_tlock;
u32 rnd;
int nqueues;
+   int qsize;
atomic_tmem;
struct timer_list   secret_timer;
struct inet_frags_ctl   *ctl;
 
unsigned int(*hashfn)(struct inet_frag_queue *);
+   void(*destructor)(struct inet_frag_queue *);
+   void(*skb_free)(struct sk_buff *);
 };
 
 void inet_frags_init(struct inet_frags *);
 void inet_frags_fini(struct inet_frags *);
 
 void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
+void inet_frag_destroy(struct inet_frag_queue *q,
+   struct inet_frags *f, int *work);
 
 #endif
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index ec10e05..15fb2c4 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -17,6 +17,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -100,3 +102,41 @@ void inet_frag_kill(struct inet_frag_queue *fq, struct 
inet_frags *f)
 }
 
 EXPORT_SYMBOL(inet_frag_kill);
+
+static inline void frag_kfree_skb(struct inet_frags *f, struct sk_buff *skb,
+   int *work)
+{
+   if (work)
+   *work -= skb->truesize;
+
+   atomic_sub(skb->truesize, &f->mem);
+   if (f->skb_free)
+   f->skb_free(skb);
+   kfree_skb(skb);
+}
+
+void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f,
+   int *work)
+{
+   struct sk_buff *fp;
+
+   BUG_TRAP(q->last_in & COMPLETE);
+   BUG_TRAP(del_timer(&q->timer) == 0);
+
+   /* Release all fragment data. */
+   fp = q->fragments;
+   while (fp) {
+   struct sk_buff *xp = fp->next;
+
+   frag_kfree_skb(f, fp, work);
+   fp = xp;
+   }
+
+   if (work)
+   *work -= f->qsize;
+   atomic_sub(f->qsize, &f->mem);
+
+   f->destructor(q);
+
+}
+EXPORT_SYMBOL(inet_frag_destroy);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 7aee137..a59ac39 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -129,11 +129,13 @@ static __inline__ void frag_kfree_skb(struct sk_buff 
*skb, int *work)
kfree_skb(skb);
 }
 
-static __inline__ void frag_free_queue(struct ipq *qp, int *work)
+static __inline__ void ip4_frag_free(struct inet_frag_queue *q)
 {
-   if (work)
-   *work -= sizeof(struct ipq);
-   atomic_sub(sizeof(struct ipq), &ip4_frags.mem);
+   struct ipq *qp;
+
+   qp = container_of(q, struct ipq, q);
+   if (qp->peer)
+   inet_putpeer(qp->peer);
kfree(qp);
 }
 
@@ -150,34 +152,10 @@ static __inline__ struct ipq *frag_alloc_queue(void)
 
 /* Destruction primitives. */
 
-/* Complete destruction of ipq. */
-static void ip_frag_destroy(struct ipq *qp, int *work)
-{
-   struct sk_buff *fp;
-
-   BUG_TRAP(qp->q.last_in&COMPLETE);
-   BUG_TRAP(del_timer(&qp->q.timer) == 0);
-
-   if (qp->peer)
-   inet_putpeer(qp->peer);
-
-   /* Release all fragment data. */
-   fp = qp->q.fragments;
-   while (fp) {
-   struct sk_buff *xp = fp->next;
-
-   frag_kfree_skb(fp, work);
-   fp = xp;
-   }
-
-   /* Finally, release the queue descriptor itself. */
-   frag_free_queue(qp, work);
-}
-
 static __inline__ void ipq_put(struct ipq *ipq, int *work)
 {
if (atomic_dec_and_test(&ipq->q.refcnt))
-   ip_frag_destroy(ipq, work);
+   inet_frag_destroy(&ipq->q, &ip4_frags, work);
 }
 
 /* Kill ipq entry. It is not destroyed immediately,
@@ -687,6 +665,9 @@ void __init ipfrag_init(void)
 {
ip4_frags.ctl = &ip4_frags_ctl;
ip4_frags.hashfn = ip4_hashfn;
+   ip4_frags.destructor = ip4_frag_free;
+   ip4_frags.skb_free = NULL;
+   ip4_frags.qsize = sizeof(struct ipq);
inet_frags_init(&ip4_frags);
 }
 
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c 
b/net/ipv6/netfilter/nf_conntrack_reasm.c
index a3aef38..785f5cd 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -114,25 +114,25 @@ static unsigned int nf_hashfn(struct inet_frag_queue *q)

[PATCH 5/9] Consolidate xxx_the secret_rebuild

2007-10-12 Thread Pavel Emelyanov
This code works with the generic data types as well, so
move this into inet_fragment.c

This move makes it possible to hide the secret_timer
management and the secret_rebuild routine completely in
the inet_fragment.c

Introduce the ->hashfn() callback in inet_frags() to get
the hashfun for a given inet_frag_queue() object.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 9902363..e374412 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -36,6 +36,8 @@ struct inet_frags {
atomic_tmem;
struct timer_list   secret_timer;
struct inet_frags_ctl   *ctl;
+
+   unsigned int(*hashfn)(struct inet_frag_queue *);
 };
 
 void inet_frags_init(struct inet_frags *);
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 534eaa8..ec10e05 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -16,9 +16,38 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
+static void inet_frag_secret_rebuild(unsigned long dummy)
+{
+   struct inet_frags *f = (struct inet_frags *)dummy;
+   unsigned long now = jiffies;
+   int i;
+
+   write_lock(&f->lock);
+   get_random_bytes(&f->rnd, sizeof(u32));
+   for (i = 0; i < INETFRAGS_HASHSZ; i++) {
+   struct inet_frag_queue *q;
+   struct hlist_node *p, *n;
+
+   hlist_for_each_entry_safe(q, p, n, &f->hash[i], list) {
+   unsigned int hval = f->hashfn(q);
+
+   if (hval != i) {
+   hlist_del(&q->list);
+
+   /* Relink to new hash chain. */
+   hlist_add_head(&q->list, &f->hash[hval]);
+   }
+   }
+   }
+   write_unlock(&f->lock);
+
+   mod_timer(&f->secret_timer, now + f->ctl->secret_interval);
+}
+
 void inet_frags_init(struct inet_frags *f)
 {
int i;
@@ -35,11 +64,17 @@ void inet_frags_init(struct inet_frags *f)
f->nqueues = 0;
atomic_set(&f->mem, 0);
 
+   init_timer(&f->secret_timer);
+   f->secret_timer.function = inet_frag_secret_rebuild;
+   f->secret_timer.data = (unsigned long)f;
+   f->secret_timer.expires = jiffies + f->ctl->secret_interval;
+   add_timer(&f->secret_timer);
 }
 EXPORT_SYMBOL(inet_frags_init);
 
 void inet_frags_fini(struct inet_frags *f)
 {
+   del_timer(&f->secret_timer);
 }
 EXPORT_SYMBOL(inet_frags_fini);
 
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 5b376c4..7aee137 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -112,32 +112,12 @@ static unsigned int ipqhashfn(__be16 id, __be32 saddr, 
__be32 daddr, u8 prot)
ip4_frags.rnd) & (INETFRAGS_HASHSZ - 1);
 }
 
-static void ipfrag_secret_rebuild(unsigned long dummy)
+static unsigned int ip4_hashfn(struct inet_frag_queue *q)
 {
-   unsigned long now = jiffies;
-   int i;
+   struct ipq *ipq;
 
-   write_lock(&ip4_frags.lock);
-   get_random_bytes(&ip4_frags.rnd, sizeof(u32));
-   for (i = 0; i < INETFRAGS_HASHSZ; i++) {
-   struct ipq *q;
-   struct hlist_node *p, *n;
-
-   hlist_for_each_entry_safe(q, p, n, &ip4_frags.hash[i], q.list) {
-   unsigned int hval = ipqhashfn(q->id, q->saddr,
- q->daddr, q->protocol);
-
-   if (hval != i) {
-   hlist_del(&q->q.list);
-
-   /* Relink to new hash chain. */
-   hlist_add_head(&q->q.list, 
&ip4_frags.hash[hval]);
-   }
-   }
-   }
-   write_unlock(&ip4_frags.lock);
-
-   mod_timer(&ip4_frags.secret_timer, now + ip4_frags_ctl.secret_interval);
+   ipq = container_of(q, struct ipq, q);
+   return ipqhashfn(ipq->id, ipq->saddr, ipq->daddr, ipq->protocol);
 }
 
 /* Memory Tracking Functions. */
@@ -705,12 +685,8 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
 
 void __init ipfrag_init(void)
 {
-   init_timer(&ip4_frags.secret_timer);
-   ip4_frags.secret_timer.function = ipfrag_secret_rebuild;
-   ip4_frags.secret_timer.expires = jiffies + 
ip4_frags_ctl.secret_interval;
-   add_timer(&ip4_frags.secret_timer);
-
ip4_frags.ctl = &ip4_frags_ctl;
+   ip4_frags.hashfn = ip4_hashfn;
inet_frags_init(&ip4_frags);
 }
 
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c 
b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 2ebe515..a3aef38 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -106,32 +106,12 @@ static unsigned int ip6qhashfn(__be32 id, struct in6_addr 
*saddr,
return c & (INETFRAGS_HASHSZ - 1);
 }
 
-static void nf_ct_frag6_secret_rebuild(unsigned long du

Re: Non-linear SKBs

2007-10-12 Thread kristrev

> If the underlying device can do scatter-gather and checksumming,
> the TCP code builds outgoing packets by copying user date into
> full system pages, and then attaching those pages into the SKB.
> The protocol headers sit under the skb->data linear area, and
> the user data mostly sits in the user pages under
> skb_shinfo(skb)->frags[]
>
> This increases the density of data packed into the memory allocated
> compared to using skb->data for it.  It also enormously simplifies
> the logic necessary to support TSO.

Thank you very much, I think I am starting to get it now and coming to
think of it this will make my patch much more elegant. I have spent the
day reading more code, and am wondering if something along the likes of
this piece of code will do what I want ("copy" the data from the next skb
in the retransmission queue into this skb):

//Do preliminary checks to see if the "new" packet will be within mss,
that this_skb->nr_frags + next_skb->nr_frags < MAX_SKB_FRAGS and so on

int i;
int this_frags = this_skb->nr_frags;

for(i=0; inr_frags; i++)
//Does the "copy"
this_skb->frags[this_frags + i] = next_skb->frags[i];

this_skb->data_len += next_skb->data_len;
this_skb->truesize += next_skb->data_len;
this_skb->nr_frags += next_skb->nr_frags;

//Update TSO?

By the way, am I correct in my assumption that one SKB's frags is stored
linearly in the frags-array? Or have I made a horrible misunderstanding?
:)

One of the things that I have yet to understand is the frag_list in the
skb_shared_info-struct. Does this contain all skb's that "use" this frag
and works as a sort of referance counter (frag won't be removed until the
variable is NULL and I have to append this_skb to the list), or is it
something else?

Thanks again for all help.

-Kristian

-
To unsubscribe from this list: send 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/9] Collect frag queues management objects together

2007-10-12 Thread Pavel Emelyanov
There are some objects that are common in all the places
which are used to keep track of frag queues, they are:

 * hash table
 * LRU list
 * rw lock
 * rnd number for hash function
 * the number of queues
 * the amount of memory occupied by queues
 * secret timer

Move all this stuff into one structure (struct inet_frags)
to make it possible use them uniformly in the future. Like
with the previous patch this mostly consists of hunks like

-write_lock(&ipfrag_lock);
+write_lock(&ip4_frags.lock);

To address the issue with exporting the number of queues and 
the amount of memory occupied by queues outside the .c file
they are declared in, I introduce a couple of helpers.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 74e9cb9..d51f238 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -18,4 +18,19 @@ struct inet_frag_queue {
 #define LAST_IN1
 };
 
+#define INETFRAGS_HASHSZ   64
+
+struct inet_frags {
+   struct list_headlru_list;
+   struct hlist_head   hash[INETFRAGS_HASHSZ];
+   rwlock_tlock;
+   u32 rnd;
+   int nqueues;
+   atomic_tmem;
+   struct timer_list   secret_timer;
+};
+
+void inet_frags_init(struct inet_frags *);
+void inet_frags_fini(struct inet_frags *);
+
 #endif
diff --git a/include/net/ip.h b/include/net/ip.h
index 3af3ed9..a18dcec 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -333,8 +333,8 @@ enum ip_defrag_users
 };
 
 struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user);
-extern int ip_frag_nqueues;
-extern atomic_t ip_frag_mem;
+int ip_frag_mem(void);
+int ip_frag_nqueues(void);
 
 /*
  * Functions provided by ip_forward.c
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 31b3f1b..77cdab3 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -252,8 +252,8 @@ struct ipv6_txoptions *ipv6_fixup_options(struct 
ipv6_txoptions *opt_space,
 
 extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb);
 
-extern int ip6_frag_nqueues;
-extern atomic_t ip6_frag_mem;
+int ip6_frag_nqueues(void);
+int ip6_frag_mem(void);
 
 #define IPV6_FRAG_TIMEOUT  (60*HZ) /* 60 seconds */
 
diff --git a/net/ipv4/Makefile b/net/ipv4/Makefile
index a02c36d..93fe396 100644
--- a/net/ipv4/Makefile
+++ b/net/ipv4/Makefile
@@ -10,7 +10,8 @@ obj-y := route.o inetpeer.o protocol.o \
 tcp_minisocks.o tcp_cong.o \
 datagram.o raw.o udp.o udplite.o \
 arp.o icmp.o devinet.o af_inet.o  igmp.o \
-sysctl_net_ipv4.o fib_frontend.o fib_semantics.o
+sysctl_net_ipv4.o fib_frontend.o fib_semantics.o \
+inet_fragment.o
 
 obj-$(CONFIG_IP_FIB_HASH) += fib_hash.o
 obj-$(CONFIG_IP_FIB_TRIE) += fib_trie.o
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
new file mode 100644
index 000..69623ff
--- /dev/null
+++ b/net/ipv4/inet_fragment.c
@@ -0,0 +1,44 @@
+/*
+ * inet fragments management
+ *
+ * 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.
+ *
+ * Authors:Pavel Emelyanov <[EMAIL PROTECTED]>
+ * Started as consolidation of ipv4/ip_fragment.c,
+ * ipv6/reassembly. and ipv6 nf conntrack 
reassembly
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+void inet_frags_init(struct inet_frags *f)
+{
+   int i;
+
+   for (i = 0; i < INETFRAGS_HASHSZ; i++)
+   INIT_HLIST_HEAD(&f->hash[i]);
+
+   INIT_LIST_HEAD(&f->lru_list);
+   rwlock_init(&f->lock);
+
+   f->rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^
+  (jiffies ^ (jiffies >> 6)));
+
+   f->nqueues = 0;
+   atomic_set(&f->mem, 0);
+
+}
+EXPORT_SYMBOL(inet_frags_init);
+
+void inet_frags_fini(struct inet_frags *f)
+{
+}
+EXPORT_SYMBOL(inet_frags_fini);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 3eb1b6d..5e1667e 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -87,39 +87,39 @@ struct ipq {
struct inet_peer *peer;
 };
 
-/* Hash table. */
+static struct inet_frags ip4_frags;
 
-#define IPQ_HASHSZ 64
+int ip_frag_nqueues(void)
+{
+   return ip4_frags.nqueues;
+}
 
-/* Per-bucket lock is easy to add now. */
-static struct hlist_head ipq_hash[IPQ_HASHSZ];
-static DEFINE_RWLOCK(ipfrag_lock);
-static u32 ipfrag_hash_rnd;
-static LIST_HEAD(ipq_lru_list);
-int ip_frag_nqueues = 0;
+int ip_frag_mem(void)
+{
+   return atomic_read(&ip4_frags.mem);
+}
 
 static __inline__ void __ipq_unlink(struct ipq *qp)
 {

Re: [Bugme-new] [Bug 9149] New: accept() doesn't wake with error when socket descriptor closed

2007-10-12 Thread Andrew Morton
On Fri, 12 Oct 2007 07:42:06 -0700 (PDT) [EMAIL PROTECTED] wrote:

> http://bugzilla.kernel.org/show_bug.cgi?id=9149
> 
>Summary: accept() doesn't wake with error when socket descriptor
> closed
>Product: Networking
>Version: 2.5
>  KernelVersion: 2.6.18
>   Platform: All
> OS/Version: Linux
>   Tree: Mainline
> Status: NEW
>   Severity: normal
>   Priority: P1
>  Component: IPV4
> AssignedTo: [EMAIL PROTECTED]
> ReportedBy: [EMAIL PROTECTED]
> 
> 
> Most recent kernel where this bug did not occur: no idea
> Distribution: no idea - remote server
> Hardware Environment: i686
> Software Environment: no idea - probably pure console server
> 
> Problem Description:
> In multithreaded process, one thread launches accept() on a valid-so-far
> listening socket file descriptor sockfd and waits on it. After this second
> thread launches close( sockfd ). First thread further waits on accept() even
> though the descriptor is now invalid. accept() should wake up and return with
> -1 and errno EBADF.
> 

I have a feeling this is an FAQ, but I forget what the answer is?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/12] Prevent renaming interfaces to empty string.

2007-10-12 Thread Andreas Henriksson

On fre, 2007-10-12 at 10:07 -0700, Stephen Hemminger wrote:

> > if (newname && strcmp(dev, newname)) {
> > +   if (strlen(newname) == 0) {
> > +   printf("\"\" is not valid device identifier\n");
> > +   return -1;
> > +   }
> > if (do_changename(dev, newname) < 0)
> > return -1;
> > dev = newname;
> 
> The kernel should already be preventing this?

Looks like something prevents the interface to end up with no name, but
there's no error message...

./ip/ip is the "vanilla" and /sbin/ip is debians version.

$ sudo ./ip/ip link set skif name ""
$ echo $?
0
$ sudo /sbin/ip link set skif name ""
"" is not valid device identifier
$ echo $?
255

Reporting the error is probably the preferred behaviour (and return code
set to error is most likely helpful for scripts).


-- 
Regards,
Andreas Henriksson

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


Re: Kernel panic (network stack)

2007-10-12 Thread Stephen Hemminger
On Fri, 12 Oct 2007 16:35:40 +0400
[EMAIL PROTECTED] wrote:

> 
> --  Пересланное сообщение  --
> 
> Тема: Kernel panic (network stack)
> Дата: 12 октября 2007
> Отправитель: [EMAIL PROTECTED]
> получатель:  [EMAIL PROTECTED]
> 
> Hello!
> I develop network driver.
> It works fine while less then 100 network interfaces exists.
> Then i give kernel panic. What could cause it ?
> 

Since it probably in your code. Please code (or place to download)
the driver code.

-- 
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: "ping6 -M do" fragments packets

2007-10-12 Thread Patrick McHardy
Chuck Anderson wrote:
> On Fri, Oct 12, 2007 at 06:00:12PM +0200, Patrick McHardy wrote:
> 
ping6 -M do -s 65527 www.kame.net
>>>
>>>Sure enough, wireshark reports fragments:
>>>
>>>No. TimeSourceDestination   Protocol Info
>>>  1 0.002001:468:616:8c9:213:72ff:fe74:da15 
>>> 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 
>>> (0x3a) off=0 id=0x79)
>>>  2 0.072001:468:616:8c9:213:72ff:fe74:da15 
>>> 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 
>>> (0x3a) off=1448 id=0x79)
>>
>>Are you using nf_conntrack_ipv6?
> 
> 
> No:
> 
> [...]


Works for me:

$ ping6 -M do -s 65527 www.kame.net -n -c 1
PING www.kame.net(2001:200:0:8002:203:47ff:fea5:3085) 65527 data bytes
>From 2001:6f8:974:0:21b:21ff:fe02:6fad icmp_seq=1 Packet too big: mtu=1500

--- www.kame.net ping statistics ---
0 packets transmitted, 0 received, +1 errors

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


Re: [ofa-general] Re: [PATCH 2/3][NET_BATCH] net core use batching

2007-10-12 Thread Stephen Hemminger
On Fri, 12 Oct 2007 09:08:58 -0700
"Brandeburg, Jesse" <[EMAIL PROTECTED]> wrote:

> Andi Kleen wrote:
> >> When the hw TX queue gains space, the driver self-batches packets
> >> from the sw queue to the hw queue.
> > 
> > I don't really see the advantage over the qdisc in that scheme.
> > It's certainly not simpler and probably more code and would likely
> > also not require less locks (e.g. a currently lockless driver
> > would need a new lock for its sw queue). Also it is unclear to me
> > it would be really any faster.
> 
> related to this comment, does Linux have a lockless (using atomics)
> singly linked list element?  That would be very useful in a driver hot
> path.

Use RCU? or write a generic version and get it reviewed.  You really
want someone with knowledge of all the possible barrier impacts to
review it.

-- 
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 03/12] Prevent renaming interfaces to empty string.

2007-10-12 Thread Stephen Hemminger
On Fri, 12 Oct 2007 10:56:38 +0200
Andreas Henriksson <[EMAIL PROTECTED]> wrote:

> From: Alexander Wirt <[EMAIL PROTECTED]>
> 
> 
> Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
> ---
>  ip/iplink.c |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 4060845..da1f64e 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
>   }
>  
>   if (newname && strcmp(dev, newname)) {
> + if (strlen(newname) == 0) {
> + printf("\"\" is not valid device identifier\n");
> + return -1;
> + }
>   if (do_changename(dev, newname) < 0)
>   return -1;
>   dev = newname;

The kernel should already be preventing this?

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


[TG3]: Fix performance regression on 5705.

2007-10-12 Thread Michael Chan
[TG3]: Fix performance regression on 5705.

A performance regression was introduced by the following commit:

commit ee6a99b539a50b4e9398938a0a6d37f8bf911550
Author: Michael Chan <[EMAIL PROTECTED]>
Date:   Wed Jul 18 21:49:10 2007 -0700

[TG3]: Fix msi issue with kexec/kdump.

In making that change, the PCI latency timer and cache line size
registers were not restored after chip reset.  On the 5705, the
latency timer gets reset to 0 during chip reset and this causes
very poor performance.

Update version to 3.84.

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

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 30b1cca..b9e1dc6 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME"tg3"
 #define PFX DRV_MODULE_NAME": "
-#define DRV_MODULE_VERSION "3.83"
-#define DRV_MODULE_RELDATE "October 10, 2007"
+#define DRV_MODULE_VERSION "3.84"
+#define DRV_MODULE_RELDATE "October 12, 2007"
 
 #define TG3_DEF_MAC_MODE   0
 #define TG3_DEF_RX_MODE0
@@ -5056,6 +5056,12 @@ static void tg3_restore_pci_state(struct tg3 *tp)
 
pci_write_config_dword(tp->pdev, TG3PCI_COMMAND, tp->pci_cmd);
 
+   if (!(tp->tg3_flags2 & TG3_FLG2_PCI_EXPRESS)) {
+   pci_write_config_byte(tp->pdev, PCI_CACHE_LINE_SIZE,
+ tp->pci_cacheline_sz);
+   pci_write_config_byte(tp->pdev, PCI_LATENCY_TIMER,
+ tp->pci_lat_timer);
+   }
/* Make sure PCI-X relaxed ordering bit is clear. */
if (tp->pcix_cap) {
u16 pcix_cmd;


-
To unsubscribe from this list: send 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] gianfar: Fix compile regression caused by 09f75cd7

2007-10-12 Thread Kumar Gala


On Oct 12, 2007, at 8:53 AM, Li Yang wrote:


Signed-off-by: Li Yang <[EMAIL PROTECTED]>


Acked-by: Kumar Gala <[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] gianfar: Fix compile regression caused by bea3348e

2007-10-12 Thread Kumar Gala


On Oct 12, 2007, at 8:53 AM, Li Yang wrote:


Signed-off-by: Li Yang <[EMAIL PROTECTED]>


Acked-by: Kumar Gala <[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 net-2.6] uml: hard_header fix

2007-10-12 Thread Stephen Hemminger
Fix hard_header for net-2.6 (2.6.23-mm1).

Please test this patch, unfortunately the tree it came from won't
build UML, so it isn't possible to give it a proper check.

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

--- a/arch/um/drivers/slip_kern.c   2007-10-11 13:16:07.0 -0700
+++ b/arch/um/drivers/slip_kern.c   2007-10-12 11:06:00.0 -0700
@@ -30,9 +30,7 @@ void slip_init(struct net_device *dev, v
slip_proto_init(&spri->slip);
 
dev->init = NULL;
-   dev->header_cache_update = NULL;
-   dev->hard_header_cache = NULL;
-   dev->hard_header = NULL;
+   dev->hard_header_ops = NULL;
dev->hard_header_len = 0;
dev->addr_len = 0;
dev->type = ARPHRD_SLIP;
--- a/arch/um/drivers/slirp_kern.c  2007-10-11 13:16:07.0 -0700
+++ b/arch/um/drivers/slirp_kern.c  2007-10-12 11:05:52.0 -0700
@@ -31,9 +31,7 @@ void slirp_init(struct net_device *dev, 
 
dev->init = NULL;
dev->hard_header_len = 0;
-   dev->header_cache_update = NULL;
-   dev->hard_header_cache = NULL;
-   dev->hard_header = NULL;
+   dev->hard_header_ops = NULL;
dev->addr_len = 0;
dev->type = ARPHRD_SLIP;
dev->tx_queue_len = 256;
-
To unsubscribe from this list: send 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 04/12] Fix up various problems in netbug script.

2007-10-12 Thread Andreas Henriksson

On fre, 2007-10-12 at 10:14 -0700, Stephen Hemminger wrote:
> Does anyone ever use this script? Maybe it should just be pulled?

Looks like something more closely related to reporting bugs directly to
you upstream guys rather then any distribution would use, so if you
don't have a need for it then feel free to remove it.

-- 
Regards,
Andreas Henriksson

-
To unsubscribe from this list: send 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 04/12] Fix up various problems in netbug script.

2007-10-12 Thread Stephen Hemminger
On Fri, 12 Oct 2007 10:56:39 +0200
Andreas Henriksson <[EMAIL PROTECTED]> wrote:

> From: Javier Fernández-Sanguino Peña <[EMAIL PROTECTED]>
> 
> Fix race conditions and temporary file symlink attacks.
> See http://bugs.debian.org/289541
> 
> Additional improvements by Allard Hoeve <[EMAIL PROTECTED]> and others.
> See http://bugs.debian.org/313540, http://bugs.debian.org/313541,
> and http://bugs.debian.org/313544.
> 
> Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>


Does anyone ever use this script? Maybe it should just be 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: [ofa-general] Re: [PATCH 2/3][NET_BATCH] net core use batching

2007-10-12 Thread Andi Kleen
> Use RCU? or write a generic version and get it reviewed.  You really
> want someone with knowledge of all the possible barrier impacts to
> review it.

I guess he was thinking of using cmpxchg; but we don't support this
in portable code.

RCU is not really suitable for this because it assume
writing is relatively rare which is definitely not the case for a qdisc.
Also general list management with RCU is quite expensive anyways --
it would require a full copy (that is the 'C' in RCU which Linux
generally doesn't use at all) 

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


Re: [PATCH] tg3: add PCI error recovery support

2007-10-12 Thread Michael Chan
On Fri, 2007-10-12 at 11:38 -0500, [EMAIL PROTECTED] wrote:
> Hi,
> 
> On Thu, Aug 02, 2007 at 05:13:39PM -0700, Michael Chan wrote:
> > On Thu, 2007-08-02 at 18:12 -0500, [EMAIL PROTECTED] wrote:
> > > On Thu, Jul 26, 2007 at 06:12:00PM -0700, Michael Chan wrote:
> > > > On Thu, 2007-07-26 at 17:57 -0500, [EMAIL PROTECTED] wrote:
> > > > > [... PCI error recovery patches for tg3 ...]
> > > > 
> > > > Thanks.  We will review and submit probably in 2.6.24.
> > > 
> > > OK, thanks. Not to nag, but it helps to get these into susbsystem 
> > > maintainer trees well before then, as otherwise the 2.6.24 window 
> > > will get missed (seeing how I just missed 2.6.23 ..)
> > 
> > Yes, I know.  David Miller hasn't opened up a 2.6.24 tree yet.  We'll
> > probably have a number of patches to be submitted for 2.6.24, and we'll
> > add this one to the set.  Thanks.
> 
> Did the patch make it in?  Now seems to be the time ...
>
> --linas
> 
> p.s. I'll send a generic MSI patch to the PCI mailing list; it appears 
> the MSI issue is generic, affecting lots of adapters.
> 

We'll rediff the patch against the latest net-2.6 tree once you post the
MSI patch.  We'll also need IBM to do some testing on it.

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] tg3: add PCI error recovery support

2007-10-12 Thread Linas Vepstas
Hi,

On Thu, Aug 02, 2007 at 05:13:39PM -0700, Michael Chan wrote:
> On Thu, 2007-08-02 at 18:12 -0500, [EMAIL PROTECTED] wrote:
> > On Thu, Jul 26, 2007 at 06:12:00PM -0700, Michael Chan wrote:
> > > On Thu, 2007-07-26 at 17:57 -0500, [EMAIL PROTECTED] wrote:
> > > > [... PCI error recovery patches for tg3 ...]
> > > 
> > > Thanks.  We will review and submit probably in 2.6.24.
> > 
> > OK, thanks. Not to nag, but it helps to get these into susbsystem 
> > maintainer trees well before then, as otherwise the 2.6.24 window 
> > will get missed (seeing how I just missed 2.6.23 ..)
> 
> Yes, I know.  David Miller hasn't opened up a 2.6.24 tree yet.  We'll
> probably have a number of patches to be submitted for 2.6.24, and we'll
> add this one to the set.  Thanks.

Did the patch make it in?  Now seems to be the time ...

--linas

p.s. I'll send a generic MSI patch to the PCI mailing list; it appears 
the MSI issue is generic, affecting lots of adapters.

-
To unsubscribe from this list: send 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-12 Thread Brian Haley

Hi Aurelien,

Comments in-line.

Aurélien Charbon wrote:
Here is a second missing part of the IPv6 support in NFS server code 
concerning knfd syscall interface.



-struct sockaddr_in *sin;
+struct sockaddr_in6 *sin, sin6_storage;


Nit, should call this sin6 now.


@@ -228,9 +228,20 @@ static ssize_t write_getfs(struct file *
return -EINVAL;
data = (struct nfsctl_fsparm*)buf;
err = -EPROTONOSUPPORT;
-if (data->gd_addr.sa_family != AF_INET)
+sin = &sin6_storage;


This should be moved in the AF_INET case.


+switch (data->gd_addr.sa_family) {
+case AF_INET6:
+sin = (struct sockaddr_in6 *)&data->gd_addr;
+in6 = sin->sin6_addr;


in6 is a structure, not a pointer.  If you want it do this you have to 
use ipv6_addr_copy().



+case AF_INET:
+/* Map v4 address into v6 structure */
+ipv6_addr_v4map(((struct sockaddr_in 
*)&data->gd_addr)->sin_addr, in6);


ipv6_addr_set(...)


@@ -257,7 +265,7 @@ static ssize_t write_getfs(struct file *
static ssize_t write_getfd(struct file *file, char *buf, size_t size)
{
struct nfsctl_fdparm *data;
-struct sockaddr_in *sin;
+struct sockaddr_in6 *sin, sin6_storage;


Nit, sin -> sin6.


@@ -268,18 +276,29 @@ static ssize_t write_getfd(struct file *
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;
+sin = &sin6_storage;


Move in AF_INET case.


-/* IPv6 address mapping */
-ipv6_addr_v4map(sin->sin_addr, in6);
+switch (data->gd_addr.sa_family) {
+case AF_INET:
+/* IPv6 address mapping */
+ipv6_addr_v4map(((struct sockaddr_in 
*)&data->gd_addr)->sin_addr, in6);


Use ipv6_set_addr(...)


+break;
+case AF_INET6:
+sin = (struct sockaddr_in6 *)&data->gd_addr;
+in6 = sin->sin6_addr;


Must use ipv6_addr_copy() here too.

-Brian
-
To unsubscribe from this list: send 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] NFS: change the ip_map cache code to handle IPv6 addresses

2007-10-12 Thread Brian Haley

Hi Aurelien,

There were some of my comments you haven't addressed yet, comments in-line.

Aurélien Charbon wrote:

Here is a patch for the ip_map caching code part in nfs server.



+for (i = 0; i < ncp->cl_naddr; i++) {
+/* Mapping address */
+ipv6_addr_v4map(ncp->cl_addrlist[i], addr6);


ipv6_addr_set(&addr6, 0, 0, htonl(0x), ncp->cl_addrlist[i]);


+/* IPv6 address mapping */
+ipv6_addr_v4map(sin->sin_addr, in6);


ipv6_addr_set(&in6, 0, 0, htonl(0x), sin->sin_addr);


+/* IPv6 address mapping */
+ipv6_addr_v4map(sin->sin_addr, in6);


ipv6_addr_set(&in6, 0, 0, htonl(0x), sin->sin_addr);


+#define IS_ADDR_MAPPED(a) \
+(((uint32_t *) (a))[0] == 0\
+&& ((uint32_t *) (a))[1] == 0\
+&& (((uint32_t *) (a))[2] == 0\
+|| ((uint32_t *) (a))[2] == htonl(0x)))


This is unused, can go away.

+static inline void ipv6_addr_v4map(const struct in_addr a1, struct 
in6_addr a2)

+{
+a2.s6_addr32[0] = 0;
+a2.s6_addr32[1] = 0;
+a2.s6_addr32[2] = htonl(0x);
+a2.s6_addr32[3] = (uint32_t)a1.s_addr;
+}


If you use ipv6_addr_set() everywhere you don't need this.


static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
{
return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 &&
- a->s6_addr32[2] == htonl(0x));
+a->s6_addr32[2] == htonl(0x));
}


Guessing you changed a tab to a space, unnecessary.


-static struct ip_map *ip_map_lookup(char *class, struct in_addr addr);
+static struct ip_map *ip_map_lookup(char *class, struct in6_addr addr);


I still think you should pass a pointer here.


-int auth_unix_add_addr(struct in_addr addr, struct auth_domain *dom)
+int auth_unix_add_addr(struct in6_addr addr, struct auth_domain *dom)


And here.


-struct auth_domain *auth_unix_lookup(struct in_addr addr)
+struct auth_domain *auth_unix_lookup(struct in6_addr addr)


And here.

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


Re: [NET] MIPSsim: General cleanup

2007-10-12 Thread Ilpo Järvinen
On Fri, 12 Oct 2007, Ralf Baechle wrote:

> General cleanups mostly as suggested by checkpatch plus getting rid of
> homebrew version of offsetof().
> 
> Signed-off-by: Ralf Baechle <[EMAIL PROTECTED]>
> ---
> 
>  drivers/net/mipsnet.c |   63 ++---
>  drivers/net/mipsnet.h |   83 
> ++
>  2 files changed, 75 insertions(+), 71 deletions(-)
> 
> diff --git a/drivers/net/mipsnet.h b/drivers/net/mipsnet.h
> index 026c732..0132c67 100644
> --- a/drivers/net/mipsnet.h
> +++ b/drivers/net/mipsnet.h
>  
>  #define MIPSNET_IO_EXTENT 0x40   /* being generous */
>  
> -#define field_offset(field) ((int)&((MIPS_T_NetControl*)(0))->field)
> +#define field_offset(field) (offsetof(struct net_control_block, field))

Is there any value in keeping this macro... why don't you just remote it?
There's seems to be just one user of it anyway:

drivers/net/mipsnet.c:#define mipsnet_reg_address(dev, field) (dev->base_addr + 
field_offset(field))


-- 
 i.
-
To unsubscribe from this list: send 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: "ping6 -M do" fragments packets

2007-10-12 Thread Patrick McHardy
Chuck Anderson wrote:
> I'm not subscribed, so please Cc: me on any responses.  Thanks.
> 
> According to the man page, ping6 should support the "-M do" option so 
> never fragment packets, which I'd like to use for testing the MTU of a 
> path.  This option works fine for IPv4 ping, but doesn't work with 
> IPv6 ping6.  I can guarantee that I don't have an MTU of 63356 :-)
> 
> 
>>ping6 -M do -s 65527 www.kame.net
> 
> Sure enough, wireshark reports fragments:
> 
> No. TimeSourceDestination   Protocol Info
>   1 0.002001:468:616:8c9:213:72ff:fe74:da15 
> 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
> off=0 id=0x79)
>   2 0.072001:468:616:8c9:213:72ff:fe74:da15 
> 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
> off=1448 id=0x79)


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


"ping6 -M do" fragments packets

2007-10-12 Thread Chuck Anderson
I'm not subscribed, so please Cc: me on any responses.  Thanks.

According to the man page, ping6 should support the "-M do" option so 
never fragment packets, which I'd like to use for testing the MTU of a 
path.  This option works fine for IPv4 ping, but doesn't work with 
IPv6 ping6.  I can guarantee that I don't have an MTU of 63356 :-)

>ping6 -M do -s 65527 www.kame.net
PING www.kame.net(orange.kame.net) 65527 data bytes
65535 bytes from orange.kame.net: icmp_seq=1 ttl=49 time=224 ms
65535 bytes from orange.kame.net: icmp_seq=2 ttl=49 time=226 ms
65535 bytes from orange.kame.net: icmp_seq=3 ttl=49 time=224 ms

--- www.kame.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 224.118/225.270/226.909/1.251 ms

Sure enough, wireshark reports fragments:

No. TimeSourceDestination   Protocol Info
  1 0.002001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=0 id=0x79)
  2 0.072001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=1448 id=0x79)
  3 0.102001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=2896 id=0x79)
  4 0.132001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=4344 id=0x79)
  5 0.152001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=5792 id=0x79)
  6 0.182001:468:616:8c9:213:72ff:fe74:da15 
2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 (0x3a) 
off=7240 id=0x79)


Is this a known issue, or some issue with the Fedora build I'm using?

iputils-20070202-3.fc7

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: e100 problems in .23rc8 ?

2007-10-12 Thread David Mack
If I understand the message Dave Jones sent yesterday, the patch you
mention *was* applied to the e100 driver in 2.6.23-6.fc8?

Dave 

> -Original Message-
> From: Herbert Xu [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 12, 2007 8:36 AM
> To: David Mack
> Cc: Dave Jones; Kok, Auke; netdev@vger.kernel.org; [EMAIL PROTECTED]
> Subject: Re: e100 problems in .23rc8 ?
> 
> On Fri, Oct 12, 2007 at 07:54:33AM -0700, David Mack wrote:
> > Still no joy here. See attached capture. What's really 
> weird is that it
> > shows *two* kernel panics, one in  e100_poll and one in _list_add.
> 
> Yes that's the symptom one would expect from that bug.  We really
> need to apply the same fix that was done for e1000.
> 
> Cheers,
> -- 
> Visit Openswan at http://www.openswan.org/
> Email: Herbert Xu ~{PmV>HI~} <[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


[PATCH] gianfar: Fix compile regression caused by bea3348e

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
 drivers/net/gianfar.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 0db5e6f..2b758fa 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -261,7 +261,9 @@ static int gfar_probe(struct platform_device *pdev)
dev->hard_start_xmit = gfar_start_xmit;
dev->tx_timeout = gfar_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
+#ifdef CONFIG_GFAR_NAPI
netif_napi_add(dev, &priv->napi, gfar_poll, GFAR_DEV_WEIGHT);
+#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = gfar_netpoll;
 #endif
@@ -931,6 +933,7 @@ tx_skb_fail:
 /* Returns 0 for success. */
 static int gfar_enet_open(struct net_device *dev)
 {
+   struct gfar_private *priv = netdev_priv(dev);
int err;
 
napi_enable(&priv->napi);
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send 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] NEW EMAC Fix RGMII build error: use of_device_is_compatible

2007-10-12 Thread Valentine Barshak
Fix build RGMII error: use of_device_is_compatible()
insteadof now deprecated device_is_compatible() function.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 drivers/net/ibm_newemac/rgmii.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/rgmii.c 
linux-2.6/drivers/net/ibm_newemac/rgmii.c
--- linux-2.6.orig/drivers/net/ibm_newemac/rgmii.c  2007-10-12 
16:02:41.0 +0400
+++ linux-2.6/drivers/net/ibm_newemac/rgmii.c   2007-10-12 16:49:07.0 
+0400
@@ -251,7 +251,7 @@ static int __devinit rgmii_probe(struct 
}
 
/* Check for RGMII type */
-   if (device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
+   if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
dev->type = RGMII_AXON;
else
dev->type = RGMII_STANDARD;
-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Jan Engelhardt

On Oct 12 2007 16:30, Al Boldi wrote:
>Jan Engelhardt wrote:
>> On Oct 12 2007 00:31, Al Boldi wrote:
>> >With the existence of the mangle table, how useful is the filter table?
>>
>> A similar discussion was back in March 2007.
>> http://marc.info/?l=netfilter-devel&m=117394977210823&w=2
>> http://marc.info/?l=netfilter-devel&m=117400063907706&w=2
>>
>> in the end, my proposal was something like
>> http://jengelh.hopto.org/GFX0/nf_proposal2.svg
>
>Any chance you could publish this as something readable like text/html?

Like, image/png?
http://jengelh.hopto.org/GFX0/nf_proposal2.png
-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Al Boldi
Jan Engelhardt wrote:
> On Oct 12 2007 00:31, Al Boldi wrote:
> >With the existence of the mangle table, how useful is the filter table?
>
> A similar discussion was back in March 2007.
> http://marc.info/?l=netfilter-devel&m=117394977210823&w=2
> http://marc.info/?l=netfilter-devel&m=117400063907706&w=2
>
> in the end, my proposal was something like
> http://jengelh.hopto.org/GFX0/nf_proposal2.svg

Any chance you could publish this as something readable like text/html?


Thanks!

--
Al
-
To unsubscribe from this list: send 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/9] Small cleanup for xxx_put after evictor consolidation

2007-10-12 Thread Pavel Emelyanov
After the evictor code is consolidated there is no need in 
passing the extra pointer to the xxx_put() functions.

The only place when it made sense was the evictor code itself.

Maybe this change must got with the previous (or with the 
next) patch, but I try to make them shorter as much as 
possible to simplify the review (but they are still large 
anyway), so this change goes in a separate patch.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index a59ac39..4ea7948 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -152,10 +152,10 @@ static __inline__ struct ipq *frag_alloc_queue(void)
 
 /* Destruction primitives. */
 
-static __inline__ void ipq_put(struct ipq *ipq, int *work)
+static __inline__ void ipq_put(struct ipq *ipq)
 {
if (atomic_dec_and_test(&ipq->q.refcnt))
-   inet_frag_destroy(&ipq->q, &ip4_frags, work);
+   inet_frag_destroy(&ipq->q, &ip4_frags, NULL);
 }
 
 /* Kill ipq entry. It is not destroyed immediately,
@@ -227,7 +205,7 @@ static void ip_expire(unsigned long arg)
}
 out:
spin_unlock(&qp->q.lock);
-   ipq_put(qp, NULL);
+   ipq_put(qp);
 }
 
 /* Creation primitives. */
@@ -257,7 +235,7 @@ static struct ipq *ip_frag_intern(struct ipq *qp_in)
atomic_inc(&qp->q.refcnt);
write_unlock(&ip4_frags.lock);
qp_in->q.last_in |= COMPLETE;
-   ipq_put(qp_in, NULL);
+   ipq_put(qp_in);
return qp;
}
}
@@ -652,7 +630,7 @@ struct sk_buff *ip_defrag(struct sk_buff *skb, u32 user)
ret = ip_frag_reasm(qp, dev);
 
spin_unlock(&qp->q.lock);
-   ipq_put(qp, NULL);
+   ipq_put(qp);
return ret;
}
 
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c 
b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 785f5cd..862d089 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -147,10 +147,10 @@ static inline struct nf_ct_frag6_queue 
*frag_alloc_queue(void)
 
 /* Destruction primitives. */
 
-static __inline__ void fq_put(struct nf_ct_frag6_queue *fq, unsigned int *work)
+static __inline__ void fq_put(struct nf_ct_frag6_queue *fq)
 {
if (atomic_dec_and_test(&fq->q.refcnt))
-   inet_frag_destroy(&fq->q, &nf_frags, work);
+   inet_frag_destroy(&fq->q, &nf_frags, NULL);
 }
 
 /* Kill fq entry. It is not destroyed immediately,
@@ -206,7 +179,7 @@ static void nf_ct_frag6_expire(unsigned long data)
 
 out:
spin_unlock(&fq->q.lock);
-   fq_put(fq, NULL);
+   fq_put(fq);
 }
 
 /* Creation primitives. */
@@ -228,7 +201,7 @@ static struct nf_ct_frag6_queue 
*nf_ct_frag6_intern(unsigned int hash,
atomic_inc(&fq->q.refcnt);
write_unlock(&nf_frags.lock);
fq_in->q.last_in |= COMPLETE;
-   fq_put(fq_in, NULL);
+   fq_put(fq_in);
return fq;
}
}
@@ -719,7 +692,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) {
spin_unlock(&fq->q.lock);
pr_debug("Can't insert skb to queue\n");
-   fq_put(fq, NULL);
+   fq_put(fq);
goto ret_orig;
}
 
@@ -730,7 +703,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
}
spin_unlock(&fq->q.lock);
 
-   fq_put(fq, NULL);
+   fq_put(fq);
return ret_skb;
 
 ret_orig:
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 74b2113..454db16 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -165,10 +165,10 @@ static inline struct frag_queue *frag_alloc_queue(void)
 
 /* Destruction primitives. */
 
-static __inline__ void fq_put(struct frag_queue *fq, int *work)
+static __inline__ void fq_put(struct frag_queue *fq)
 {
if (atomic_dec_and_test(&fq->q.refcnt))
-   inet_frag_destroy(&fq->q, &ip6_frags, work);
+   inet_frag_destroy(&fq->q, &ip6_frags, NULL);
 }
 
 /* Kill fq entry. It is not destroyed immediately,
@@ -246,7 +224,7 @@ out:
if (dev)
dev_put(dev);
spin_unlock(&fq->q.lock);
-   fq_put(fq, NULL);
+   fq_put(fq);
 }
 
 /* Creation primitives. */
@@ -270,7 +248,7 @@ static struct frag_queue *ip6_frag_intern(struct frag_queue 
*fq_in)
atomic_inc(&fq->q.refcnt);
write_unlock(&ip6_frags.lock);
fq_in->q.last_in |= COMPLETE;
-   fq_put(fq_in, NULL);
+   fq_put(fq_in);
return fq;
}
}
@@ -676,7 +654,7 @@ static int ipv6_frag_rcv(struc

Re: 2.6.23-rc8-mm2 BUG: register_netdevice() issue as (ab)used by ISDN

2007-10-12 Thread Karsten Keil
Hi Dave,

a follow up to the previous patch for net-2.6.24.

On Mon, Oct 08, 2007 at 08:37:33PM -0700, David Miller wrote:
> > 
> > You could try following patch with 2.6.23-rc8-mm2, it change I4L to use
> > alloc_netdev().
> > 
> > Signed-off-by: Karsten Keil <[EMAIL PROTECTED]>
> 
> I've added this patch to net-2.6.24, thanks Karsten!

This is a followup to the previous ISDN alloc_netdev() patch.
It removes the local copy of the device name to make sure
that device renames work.

Signed-off-by: Karsten Keil <[EMAIL PROTECTED]>

diff -urNp linux-2.6.23.old/drivers/isdn/i4l/isdn_net.c 
linux-2.6.23/drivers/isdn/i4l/isdn_net.c
--- linux-2.6.23.old/drivers/isdn/i4l/isdn_net.c2007-10-08 
17:31:43.0 +0200
+++ linux-2.6.23/drivers/isdn/i4l/isdn_net.c2007-10-12 13:43:50.0 
+0200
@@ -328,7 +328,7 @@ isdn_net_autohup(void)
l->cps = (l->transcount * HZ) / (jiffies - 
last_jiffies);
l->transcount = 0;
if (dev->net_verbose > 3)
-   printk(KERN_DEBUG "%s: %d bogocps\n", l->name, l->cps);
+   printk(KERN_DEBUG "%s: %d bogocps\n", p->dev->name, 
l->cps);
if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) {
anymore = 1;
l->huptimer++;
@@ -350,12 +350,12 @@ isdn_net_autohup(void)
if (l->hupflags & ISDN_CHARGEHUP) {
if (l->hupflags & 
ISDN_WAITCHARGE) {
printk(KERN_DEBUG 
"isdn_net: Hupflags of %s are %X\n",
-  l->name, 
l->hupflags);
+  p->dev->name, 
l->hupflags);
isdn_net_hangup(p->dev);
} else if (time_after(jiffies, 
l->chargetime + l->chargeint)) {
printk(KERN_DEBUG
   "isdn_net: %s: 
chtime = %lu, chint = %d\n",
-  l->name, 
l->chargetime, l->chargeint);
+  p->dev->name, 
l->chargetime, l->chargeint);
isdn_net_hangup(p->dev);
}
} else
@@ -442,8 +442,8 @@ isdn_net_stat_callback(int idx, isdn_ctr
 #endif
isdn_net_lp_disconnected(lp);
isdn_all_eaz(lp->isdn_device, 
lp->isdn_channel);
-   printk(KERN_INFO "%s: remote hangup\n", 
lp->name);
-   printk(KERN_INFO "%s: Chargesum is 
%d\n", lp->name,
+   printk(KERN_INFO "%s: remote hangup\n", 
p->dev->name);
+   printk(KERN_INFO "%s: Chargesum is 
%d\n", p->dev->name,
   lp->charge);
isdn_net_unbind_channel(lp);
return 1;
@@ -487,7 +487,7 @@ isdn_net_stat_callback(int idx, isdn_ctr

isdn_net_add_to_bundle(nd, lp);
}
}
-   printk(KERN_INFO "isdn_net: %s 
connected\n", lp->name);
+   printk(KERN_INFO "isdn_net: %s 
connected\n", p->dev->name);
/* If first Chargeinfo comes 
before B-Channel connect,
 * we correct the timestamp 
here.
 */
@@ -534,7 +534,7 @@ isdn_net_stat_callback(int idx, isdn_ctr
lp->hupflags |= ISDN_HAVECHARGE;
lp->chargetime = jiffies;
printk(KERN_DEBUG "isdn_net: Got CINF 
chargetime of %s now %lu\n",
-  lp->name, lp->chargetime);
+  p->dev->name, lp->chargetime);
return 1;
}
}
@@ -565,7 +565,7 @@ isdn_net_dial(void)
 
 #ifdef ISDN_DEBUG_NET_DIAL
if (lp->dialstate)
-   printk(KERN_DEBUG "%s: dialstate=%d\n", lp->name, 
lp->dialstate);
+   printk(KERN_DEBUG "%s: dialstate=%d\n", p->dev->name, 
lp->dialstate);
 #endif
switch (lp->dialstate) {
case 0:
@@ -578,7 +578,7 @@ isdn_net_d

Re: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Al Boldi
Patrick McHardy wrote:
> Al Boldi wrote:
> >>>The problem is that people think they are safe with the filter table,
> >>>when in fact they need the prerouting chain to seal things.  Right now
> >>>this is only possible in the mangle table.
> >>
> >>Why do they need PREROUTING?
> >
> > Well, for example to stop any transient packets being forwarded.  You
> > could probably hack around this using mark's, but you can't stop the
> > implied route lookup, unless you stop it in prerouting.
>
> This also works fine in FORWARD with a little extra overhead.
> If you really have to save resources, you should use PREROUTING/raw
> to also avoid the creation of a connection tracking entry.

Yes sure, if you use nat.  But can you see how forcing people into splitting 
their rules across tables adds complexity.  And without ipt_REJECT patch, 
they can't even use REJECT in prerouting, which forces them to do some 
strange hacks.

IMHO, we should make things as easily configurable as possible, and as things 
stand right now, the filter-table is completely useless for 99% of 
use-cases.


Thanks!

--
Al

-
To unsubscribe from this list: send 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/9] Collect common sysctl variables together

2007-10-12 Thread Pavel Emelyanov
Some sysctl variables are used to tune the frag queues
management and it will be useful to work with them in
a common way in the future, so move them into one
structure, moreover they are the same for all the frag
management codes.

I don't place them in the existing inet_frags object,
introduced in the previous patch for two reasons:

 1. to keep them in the __read_mostly section;
 2. not to export the whole inet_frags objects outside.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index d51f238..ada03ba 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -20,6 +20,13 @@ struct inet_frag_queue {
 
 #define INETFRAGS_HASHSZ   64
 
+struct inet_frags_ctl {
+   int high_thresh;
+   int low_thresh;
+   int timeout;
+   int secret_interval;
+};
+
 struct inet_frags {
struct list_headlru_list;
struct hlist_head   hash[INETFRAGS_HASHSZ];
@@ -28,6 +35,7 @@ struct inet_frags {
int nqueues;
atomic_tmem;
struct timer_list   secret_timer;
+   struct inet_frags_ctl   *ctl;
 };
 
 void inet_frags_init(struct inet_frags *);
diff --git a/include/net/ip.h b/include/net/ip.h
index a18dcec..e7b0feb 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -177,10 +177,8 @@ extern int sysctl_ip_default_ttl;
 extern int sysctl_ip_nonlocal_bind;
 
 /* From ip_fragment.c */
-extern int sysctl_ipfrag_high_thresh; 
-extern int sysctl_ipfrag_low_thresh;
-extern int sysctl_ipfrag_time;
-extern int sysctl_ipfrag_secret_interval;
+struct inet_frags_ctl;
+extern struct inet_frags_ctl ip4_frags_ctl;
 extern int sysctl_ipfrag_max_dist;
 
 /* From inetpeer.c */
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index 77cdab3..b29d76c 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -565,10 +565,8 @@ extern int inet6_hash_connect(struct 
inet_timewait_death_row *death_row,
 /*
  * reassembly.c
  */
-extern int sysctl_ip6frag_high_thresh;
-extern int sysctl_ip6frag_low_thresh;
-extern int sysctl_ip6frag_time;
-extern int sysctl_ip6frag_secret_interval;
+struct inet_frags_ctl;
+extern struct inet_frags_ctl ip6_frags_ctl;
 
 extern const struct proto_ops inet6_stream_ops;
 extern const struct proto_ops inet6_dgram_ops;
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h 
b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
index 070d12c..f703533 100644
--- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
@@ -15,8 +15,7 @@ extern void nf_ct_frag6_output(unsigned int hooknum, struct 
sk_buff *skb,
   struct net_device *out,
   int (*okfn)(struct sk_buff *));
 
-extern unsigned int nf_ct_frag6_timeout;
-extern unsigned int nf_ct_frag6_low_thresh;
-extern unsigned int nf_ct_frag6_high_thresh;
+struct inet_frags_ctl;
+extern struct inet_frags_ctl nf_frags_ctl;
 
 #endif /* _NF_CONNTRACK_IPV6_H*/
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 5e1667e..61035a8 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -50,21 +50,8 @@
  * as well. Or notify me, at least. --ANK
  */
 
-/* Fragment cache limits. We will commit 256K at one time. Should we
- * cross that limit we will prune down to 192K. This should cope with
- * even the most extreme cases without allowing an attacker to measurably
- * harm machine performance.
- */
-int sysctl_ipfrag_high_thresh __read_mostly = 256*1024;
-int sysctl_ipfrag_low_thresh __read_mostly = 192*1024;
-
 int sysctl_ipfrag_max_dist __read_mostly = 64;
 
-/* Important NOTE! Fragment queue must be destroyed before MSL expires.
- * RFC791 is wrong proposing to prolongate timer each fragment arrival by TTL.
- */
-int sysctl_ipfrag_time __read_mostly = IP_FRAG_TIME;
-
 struct ipfrag_skb_cb
 {
struct inet_skb_parmh;
@@ -87,6 +74,25 @@ struct ipq {
struct inet_peer *peer;
 };
 
+struct inet_frags_ctl ip4_frags_ctl __read_mostly = {
+   /*
+* Fragment cache limits. We will commit 256K at one time. Should we
+* cross that limit we will prune down to 192K. This should cope with
+* even the most extreme cases without allowing an attacker to
+* measurably harm machine performance.
+*/
+   .high_thresh = 256 * 1024,
+   .low_thresh  = 192 * 1024,
+
+   /*
+* Important NOTE! Fragment queue must be destroyed before MSL expires.
+* RFC791 is wrong proposing to prolongate timer each fragment arrival
+* by TTL.
+*/
+   .timeout = IP_FRAG_TIME,
+   .secret_interval = 10 * 60 * HZ,
+};
+
 static struct inet_frags ip4_frags;
 
 int ip_frag_nqueues(void)
@@ -120,8 +126,6 @@ static unsigned int ipqhashfn(__be16 id, __be32 saddr, 
__be32 daddr, u8 prot)
ip4_frags.rnd) & (INETFRAGS_HASHSZ - 1);
 }
 
-int sysctl_ipfra

Re: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Jan Engelhardt

On Oct 12 2007 15:48, Patrick McHardy wrote:
>
>The netlink based iptables successor I'm currently working on allows to
>dynamically create tables with user-specified priorities and "built-in"
>chains. The only built-in tables will be those that need extra
>processing (mangle/nat). So it should be possible to set up tables
>basically any way you desire.

Will ebtables move a bit closer to iptables?

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


tc_verd vs. skb_clone

2007-10-12 Thread Herbert Xu
Hi Jamal:

I was wondering why we're not copying tc_verd as is in skb_clone.
In particular, this makes pskb_copy behave differently compared
to skb_clone and I can't find a justificatino for it.

Any ideas?

Also we don't seem to copy iif in copy_skb_header.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[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


[NET] MIPSsim: General cleanup

2007-10-12 Thread Ralf Baechle
General cleanups mostly as suggested by checkpatch plus getting rid of
homebrew version of offsetof().

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

 drivers/net/mipsnet.c |   63 ++---
 drivers/net/mipsnet.h |   83 ++
 2 files changed, 75 insertions(+), 71 deletions(-)

diff --git a/drivers/net/mipsnet.c b/drivers/net/mipsnet.c
index d593175..37707a0 100644
--- a/drivers/net/mipsnet.c
+++ b/drivers/net/mipsnet.c
@@ -7,12 +7,12 @@
 #define DEBUG
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "mipsnet.h"   /* actual device IO mapping */
@@ -33,9 +33,8 @@ static int ioiocpy_frommipsnet(struct net_device *dev, 
unsigned char *kdata,
if (available_len < len)
return -EFAULT;
 
-   for (; len > 0; len--, kdata++) {
+   for (; len > 0; len--, kdata++)
*kdata = inb(mipsnet_reg_address(dev, rxDataBuffer));
-   }
 
return inl(mipsnet_reg_address(dev, rxDataCount));
 }
@@ -47,16 +46,15 @@ static inline ssize_t mipsnet_put_todevice(struct 
net_device *dev,
char *buf_ptr = skb->data;
 
pr_debug("%s: %s(): telling MIPSNET txDataCount(%d)\n",
-dev->name, __FUNCTION__, skb->len);
+dev->name, __FUNCTION__, skb->len);
 
outl(skb->len, mipsnet_reg_address(dev, txDataCount));
 
pr_debug("%s: %s(): sending data to MIPSNET txDataBuffer(%d)\n",
-dev->name, __FUNCTION__, skb->len);
+dev->name, __FUNCTION__, skb->len);
 
-   for (; count_to_go; buf_ptr++, count_to_go--) {
+   for (; count_to_go; buf_ptr++, count_to_go--)
outb(*buf_ptr, mipsnet_reg_address(dev, txDataBuffer));
-   }
 
dev->stats.tx_packets++;
dev->stats.tx_bytes += skb->len;
@@ -67,7 +65,7 @@ static inline ssize_t mipsnet_put_todevice(struct net_device 
*dev,
 static int mipsnet_xmit(struct sk_buff *skb, struct net_device *dev)
 {
pr_debug("%s:%s(): transmitting %d bytes\n",
-dev->name, __FUNCTION__, skb->len);
+dev->name, __FUNCTION__, skb->len);
 
/* Only one packet at a time. Once TXDONE interrupt is serviced, the
 * queue will be restarted.
@@ -83,7 +81,8 @@ static inline ssize_t mipsnet_get_fromdev(struct net_device 
*dev, size_t count)
struct sk_buff *skb;
size_t len = count;
 
-   if (!(skb = alloc_skb(len + 2, GFP_KERNEL))) {
+   skb = alloc_skb(len + 2, GFP_KERNEL);
+   if (!skb) {
dev->stats.rx_dropped++;
return -ENOMEM;
}
@@ -96,7 +95,7 @@ static inline ssize_t mipsnet_get_fromdev(struct net_device 
*dev, size_t count)
skb->ip_summed = CHECKSUM_UNNECESSARY;
 
pr_debug("%s:%s(): pushing RXed data to kernel\n",
-dev->name, __FUNCTION__);
+dev->name, __FUNCTION__);
netif_rx(skb);
 
dev->stats.rx_packets++;
@@ -114,42 +113,44 @@ static irqreturn_t mipsnet_interrupt(int irq, void 
*dev_id)
 
if (irq == dev->irq) {
pr_debug("%s:%s(): irq %d for device\n",
-dev->name, __FUNCTION__, irq);
+dev->name, __FUNCTION__, irq);
 
retval = IRQ_HANDLED;
 
interruptFlags =
inl(mipsnet_reg_address(dev, interruptControl));
pr_debug("%s:%s(): intCtl=0x%016llx\n", dev->name,
-__FUNCTION__, interruptFlags);
+__FUNCTION__, interruptFlags);
 
if (interruptFlags & MIPSNET_INTCTL_TXDONE) {
pr_debug("%s:%s(): got TXDone\n",
-dev->name, __FUNCTION__);
+dev->name, __FUNCTION__);
outl(MIPSNET_INTCTL_TXDONE,
 mipsnet_reg_address(dev, interruptControl));
-   // only one packet at a time, we are done.
+   /* only one packet at a time, we are done. */
netif_wake_queue(dev);
} else if (interruptFlags & MIPSNET_INTCTL_RXDONE) {
pr_debug("%s:%s(): got RX data\n",
-dev->name, __FUNCTION__);
+dev->name, __FUNCTION__);
mipsnet_get_fromdev(dev,
-   inl(mipsnet_reg_address(dev, rxDataCount)));
+   inl(mipsnet_reg_address(dev, rxDataCount)));
pr_debug("%s:%s(): clearing RX int\n",
-dev->name, __FUNCTION__);
+dev->name, __FUNCTION__);
outl(MIPSNET_INTCTL_RXDONE,
 mipsnet_reg_address(dev, interruptControl));
 
} else if 

[PATCH 1/9] Move common fields from frag_queues in one place

2007-10-12 Thread Pavel Emelyanov
Introduce the struct inet_frag_queue in include/net/inet_frag.h
file and place there all the common fields from three structs:

 * struct ipq in ipv4/ip_fragment.c
 * struct nf_ct_frag6_queue in nf_conntrack_reasm.c
 * struct frag_queue in ipv6/reassembly.c

After this, replace these fields on appropriate structures with
this structure instance and fix the users to use correct names
i.e. hunks like

-atomic_dec(&fq->refcnt);
+atomic_dec(&fq->q.refcnt);

(these occupy most of the patch)

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
new file mode 100644
index 000..74e9cb9
--- /dev/null
+++ b/include/net/inet_frag.h
@@ -0,0 +1,21 @@
+#ifndef __NET_FRAG_H__
+#define __NET_FRAG_H__
+
+struct inet_frag_queue {
+   struct hlist_node   list;
+   struct list_headlru_list;   /* lru list member */
+   spinlock_t  lock;
+   atomic_trefcnt;
+   struct timer_list   timer;  /* when will this queue expire? */
+   struct sk_buff  *fragments; /* list of received fragments */
+   ktime_t stamp;
+   int len;/* total length of orig datagram */
+   int meat;
+   __u8last_in;/* first/last segment arrived? */
+
+#define COMPLETE   4
+#define FIRST_IN   2
+#define LAST_IN1
+};
+
+#endif
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index fabb86d..3eb1b6d 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -39,6 +39,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -74,25 +75,13 @@ struct ipfrag_skb_cb
 
 /* Describe an entry in the "incomplete datagrams" queue. */
 struct ipq {
-   struct hlist_node list;
-   struct list_head lru_list;  /* lru list member  
*/
+   struct inet_frag_queue q;
+
u32 user;
__be32  saddr;
__be32  daddr;
__be16  id;
u8  protocol;
-   u8  last_in;
-#define COMPLETE   4
-#define FIRST_IN   2
-#define LAST_IN1
-
-   struct sk_buff  *fragments; /* linked list of received fragments
*/
-   int len;/* total length of original datagram
*/
-   int meat;
-   spinlock_t  lock;
-   atomic_trefcnt;
-   struct timer_list timer;/* when will this queue expire? 
*/
-   ktime_t stamp;
int iif;
unsigned intrid;
struct inet_peer *peer;
@@ -111,8 +100,8 @@ int ip_frag_nqueues = 0;
 
 static __inline__ void __ipq_unlink(struct ipq *qp)
 {
-   hlist_del(&qp->list);
-   list_del(&qp->lru_list);
+   hlist_del(&qp->q.list);
+   list_del(&qp->q.lru_list);
ip_frag_nqueues--;
 }
 
@@ -144,15 +133,15 @@ static void ipfrag_secret_rebuild(unsigned long dummy)
struct ipq *q;
struct hlist_node *p, *n;
 
-   hlist_for_each_entry_safe(q, p, n, &ipq_hash[i], list) {
+   hlist_for_each_entry_safe(q, p, n, &ipq_hash[i], q.list) {
unsigned int hval = ipqhashfn(q->id, q->saddr,
  q->daddr, q->protocol);
 
if (hval != i) {
-   hlist_del(&q->list);
+   hlist_del(&q->q.list);
 
/* Relink to new hash chain. */
-   hlist_add_head(&q->list, &ipq_hash[hval]);
+   hlist_add_head(&q->q.list, &ipq_hash[hval]);
}
}
}
@@ -198,14 +187,14 @@ static void ip_frag_destroy(struct ipq *qp, int *work)
 {
struct sk_buff *fp;
 
-   BUG_TRAP(qp->last_in&COMPLETE);
-   BUG_TRAP(del_timer(&qp->timer) == 0);
+   BUG_TRAP(qp->q.last_in&COMPLETE);
+   BUG_TRAP(del_timer(&qp->q.timer) == 0);
 
if (qp->peer)
inet_putpeer(qp->peer);
 
/* Release all fragment data. */
-   fp = qp->fragments;
+   fp = qp->q.fragments;
while (fp) {
struct sk_buff *xp = fp->next;
 
@@ -219,7 +208,7 @@ static void ip_frag_destroy(struct ipq *qp, int *work)
 
 static __inline__ void ipq_put(struct ipq *ipq, int *work)
 {
-   if (atomic_dec_and_test(&ipq->refcnt))
+   if (atomic_dec_and_test(&ipq->q.refcnt))
ip_frag_destroy(ipq, work);
 }
 
@@ -228,13 +217,13 @@ static __inline__ void ipq_put(struct ipq *ipq, int *work)
  */
 static void ipq_kill(struct ipq *ipq)
 {
-   if (del_timer(&ipq->timer))
-   atomic_dec(&ipq->refcnt);
+   if (del_timer(&ipq->q.timer))
+   atomic_dec(&ipq->

Re: [PATCH] gianfar: Cleanup compile warning caused by 0795af57

2007-10-12 Thread Kumar Gala


On Oct 12, 2007, at 8:53 AM, Li Yang wrote:


Signed-off-by: Li Yang <[EMAIL PROTECTED]>


Acked-by: Kumar Gala <[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: e100 problems in .23rc8 ?

2007-10-12 Thread Kok, Auke
Herbert Xu wrote:
> On Fri, Oct 12, 2007 at 07:54:33AM -0700, David Mack wrote:
>> Still no joy here. See attached capture. What's really weird is that it
>> shows *two* kernel panics, one in  e100_poll and one in _list_add.
> 
> Yes that's the symptom one would expect from that bug.  We really
> need to apply the same fix that was done for e1000.

I feared that. its not the same as that commit that floated around in this 
thread
and involves some reorganization in the init/probe code, so it's a bit more
involved than just a few lines. I'll need a little bit of time to generate this 
fix.

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 0/9] Consolidate IP fragment management

2007-10-12 Thread Pavel Emelyanov
Patrick recently pointed out, that there are three places that 
perform IP fragments management. In ipv4, ipv6 and in ip6 
conntracks. Looks like these places can be a bit consolidated.

The proposal is to create a common structure inet_frag_queue to 
put common fields like list heads, refcounts etc in, and include
it into the specific fragment queues. Then such objects like 
hash tables, lists, locks etc are moved to common place (struct 
inet_frags). At the end common code is moved to the 
net/ipv4/inet_fragment.c.

The inet_ prefix in file names, data structures and functions, and
the code place (net/ipv4) was proposed by Alexey, but the exact
names were selectd by me, so maybe there can be a better ones.

Signed-off-by: Pavel Emelyanov <[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 3/4] UDP memory accounting and limitation(take 5): memory accounting

2007-10-12 Thread Satoshi OSHIMA
This patch introduces memory usage accounting for UDP.


signed-off-by: Satoshi Oshima <[EMAIL PROTECTED]>
signed-off-by: Hideo Aoki <[EMAIL PROTECTED]>

Index: 2.6.23-udp_limit/net/ipv4/ip_output.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/ip_output.c
+++ 2.6.23-udp_limit/net/ipv4/ip_output.c
@@ -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;
@@ -1269,6 +1280,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;
@@ -1298,9 +1311,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 = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL)
+   while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) {
+   num_flush_mem += sk_datagram_pages(skb->truesize);
kfree_skb(skb);
+   }
+
+   if (sk->sk_prot->memory_allocated)
+   atomic_sub(num_flush_mem, sk->sk_prot->memory_allocated);
 
inet->cork.flags &= ~IPCORK_OPT;
kfree(inet->cork.opt);
Index: 2.6.23-udp_limit/net/ipv4/udp.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/udp.c
+++ 2.6.23-udp_limit/net/ipv4/udp.c
@@ -885,6 +885,9 @@ try_again:
err = ulen;
 
 out_free:
+   atomic_sub(sk_datagram_pages(skb->truesize),
+  sk->sk_prot->memory_allocated);
+
skb_free_datagram(sk, skb);
 out:
return err;
@@ -892,6 +895,9 @@ out:
 csum_copy_err:
UDP_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite);
 
+   atomic_sub(sk_datagram_pages

[PATCH 2/4] UDP memory accounting and limitation(take 5): accounting unit and variable

2007-10-12 Thread Satoshi OSHIMA
This patch introduces global variable for UDP memory accounting.
The unit is page.


signed-off-by: Satoshi Oshima <[EMAIL PROTECTED]>
signed-off-by: Hideo Aoki <[EMAIL PROTECTED]>

Index: 2.6.23-udp_limit/include/net/sock.h
===
--- 2.6.23-udp_limit.orig/include/net/sock.h
+++ 2.6.23-udp_limit/include/net/sock.h
@@ -723,6 +723,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
Index: 2.6.23-udp_limit/include/net/udp.h
===
--- 2.6.23-udp_limit.orig/include/net/udp.h
+++ 2.6.23-udp_limit/include/net/udp.h
@@ -65,6 +65,8 @@ extern rwlock_t udp_hash_lock;
 
 extern struct proto udp_prot;
 
+extern atomic_t udp_memory_allocated;
+
 struct sk_buff;
 
 /*
Index: 2.6.23-udp_limit/net/ipv4/proc.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/proc.c
+++ 2.6.23-udp_limit/net/ipv4/proc.c
@@ -66,7 +66,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", ip_frag_nqueues,
Index: 2.6.23-udp_limit/net/ipv4/udp.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/udp.c
+++ 2.6.23-udp_limit/net/ipv4/udp.c
@@ -113,6 +113,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 int udp_port_rover;
 
 static inline int __udp_lib_lport_inuse(__u16 num, struct hlist_head 
udptable[])

-
To unsubscribe from this list: send 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/4]UDP memory accounting and limitation(take 5)

2007-10-12 Thread Satoshi OSHIMA
Hi,

I revised a patch set of UDP memory accounting and
limitation.

This patch set is for kernel 2.6.23. The differences
from take 4 are

* 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

How to use UDP memory limitation:

This patch set add

/proc/sys/net/ipv4/udp_mem

as a tuning parameter. 

When you give the number that is greater than 4096,
UDP memory limitation will work. The number of pages
for socket buffer is limited up to udp_mem[pages].

Currently this function drops the packet when
it is sent or received and the number of pages for
socket buffer is beyond the limit. It won't collect
the buffer that is already allocated.

On the other hand, udp_mem is specified as 4096,
UDP memory limitaion will not work.
The deafult number of udp_mem is 4096. 

Comment, review and test are welcome.

Thanks,

Satoshi Oshima
-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Patrick McHardy
Al Boldi wrote:
> Patrick McHardy wrote:
> 
>>Please send mails discussing netfilter to netfilter-devel.
> 
> 
> Ok.  I just found out this changed to vger.  But 
> [EMAIL PROTECTED] is bouncing me.

Seems to work, I got your mail on netfilter-devel.

>>Al Boldi wrote:
>>
>>>With the existence of the mangle table, how useful is the filter table?
>>>
>>>Other than requiring the REJECT target to be ported to the mangle table,
>>>is the filter table faster than the mangle table?
>>
>>There are some minor differences in ordering (mangle comes before
>>DNAT, filter afterwards), but for most rulesets thats completely
>>irrelevant. The only difference that really matters is that mangle
>>performs rerouting in LOCAL_OUT for packets that had their routing
>>key changed, so its really a superset of the filter table. If you
>>want to use REJECT in the mangle table, you just need to remove the
>>restriction to filter, it works fine. I would prefer to also remove
>>the restriction of MARK, CONNMARK etc. to mangle, they're used for
>>more than just routing today so that restriction also doesn't make
>>much sense. Patches for this are welcome.
> 
> 
> Something like this (untested):
> 
> --- ipt_REJECT.bak.c2007-10-12 08:25:17.0 +0300
> +++ ipt_REJECT.c2007-10-12 08:31:44.0 +0300
> @@ -165,6 +165,7 @@ static void send_reset(struct sk_buff *o
>  
>  static inline void send_unreach(struct sk_buff *skb_in, int code)
>  {
> +   if (!skb_in->dst) ip_route_me_harder(&skb_in, RTN_UNSPEC);
> icmp_send(skb_in, ICMP_DEST_UNREACH, code, 0);
>  }
>  
> @@ -245,9 +246,6 @@ static struct xt_target ipt_reject_reg =
> .family = AF_INET,
> .target = reject,
> .targetsize = sizeof(struct ipt_reject_info),
> -   .table  = "filter",
> -   .hooks  = (1 << NF_IP_LOCAL_IN) | (1 << NF_IP_FORWARD) |
> - (1 << NF_IP_LOCAL_OUT),
> .checkentry = check,
> .me = THIS_MODULE,
>  };


That includes an unrelated change, I meant to simply remove the filter
table restriction.

>>>If not, then shouldn't the filter table be obsoleted to avoid confusion?
>>
>>That would probably confuse people. Just don't use it if you don't
>>need to.
> 
> 
> The problem is that people think they are safe with the filter table, when in 
> fact they need the prerouting chain to seal things.  Right now this is only 
> possible in the mangle table.


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


Re: Regression in net-2.6.24?

2007-10-12 Thread David Miller
From: TAKANO Ryousei <[EMAIL PROTECTED]>
Date: Fri, 12 Oct 2007 19:22:00 +0900 (JST)

> I am sorry for late reply.
> I confirmed this patch fixes the kernel panic that I reported.
> Thanks David and others.

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


Re: Regression in net-2.6.24?

2007-10-12 Thread TAKANO Ryousei
From: David Miller <[EMAIL PROTECTED]>
Subject: Re: Regression in net-2.6.24?
Date: Thu, 11 Oct 2007 18:14:49 -0700 (PDT)

> 
> Here is what I'm checking into net-2.6 for now:
> 
> commit 6f535763165331bb91277d7519b507fed22034e5
> Author: David S. Miller <[EMAIL PROTECTED]>
> Date:   Thu Oct 11 18:08:29 2007 -0700
> 
> [NET]: Fix NAPI completion handling in some drivers.
> 
> In order for the list handling in net_rx_action() to be
> correct, drivers must follow certain rules as stated by
> this comment in net_rx_action():
> 
>   /* Drivers must not modify the NAPI state if they
>* consume the entire weight.  In such cases this code
>* still "owns" the NAPI instance and therefore can
>* move the instance around on the list at-will.
>*/
> 
> A few drivers do not do this because they mix the budget checks
> with reading hardware state, resulting in crashes like the one
> reported by [EMAIL PROTECTED]
> 
> BNX2 and TG3 are taken care of here, SKY2 fix is from Stephen
> Hemminger.
> 
> Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
> 
I am sorry for late reply.
I confirmed this patch fixes the kernel panic that I reported.
Thanks David and others.

Ryousei Takano
-
To unsubscribe from this list: send 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: "ping6 -M do" fragments packets

2007-10-12 Thread Chuck Anderson
On Fri, Oct 12, 2007 at 06:00:12PM +0200, Patrick McHardy wrote:
> >>ping6 -M do -s 65527 www.kame.net
> > 
> > Sure enough, wireshark reports fragments:
> > 
> > No. TimeSourceDestination   Protocol 
> > Info
> >   1 0.002001:468:616:8c9:213:72ff:fe74:da15 
> > 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 
> > (0x3a) off=0 id=0x79)
> >   2 0.072001:468:616:8c9:213:72ff:fe74:da15 
> > 2001:200:0:8002:203:47ff:fea5:3085 IPv6 IPv6 fragment (nxt=ICMPv6 
> > (0x3a) off=1448 id=0x79)
> 
> Are you using nf_conntrack_ipv6?

No:

nf_conntrack_tftp   9813  0 
nf_conntrack_netbios_ns 7105  0 
ipt_LOG10305  1 
nf_conntrack_ipv4  15049  6 
xt_state6593  6 
nf_conntrack   61001  4 
nf_conntrack_tftp,nf_conntrack_netbios_ns,nf_conntrack_ipv4,xt_state
nfnetlink  10841  2 nf_conntrack_ipv4,nf_conntrack
ipt_REJECT  8641  4 
iptable_filter  6977  1 
ip_tables  16389  1 iptable_filter
ip6t_LOG   10945  1 
ip6t_REJECT 9537  2 
ip6table_filter 6849  1 
ip6_tables 17541  2 ip6t_LOG,ip6table_filter
x_tables   18757  8 
ipt_LOG,xt_state,ipt_REJECT,ip_tables,ip6t_LOG,ip6t_REJECT,ip6_tables,xt_tcpudp
ipv6  276673  51 ip6t_REJECT
-
To unsubscribe from this list: send 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: authenc compile warnings in current net-2.6.24

2007-10-12 Thread Herbert Xu
On Fri, Oct 12, 2007 at 08:15:01AM +0200, Oliver Hartkopp wrote:
> Hi Dave,
> 
> this compile fix seems not to be applied (maybe my compiler is the only 
> one who complains ;-)

That's because the patch is in my cryptodev-2.6 tree :)

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[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: [ofa-general] Re: [PATCH 2/3][NET_BATCH] net core use batching

2007-10-12 Thread Brandeburg, Jesse
Andi Kleen wrote:
>> When the hw TX queue gains space, the driver self-batches packets
>> from the sw queue to the hw queue.
> 
> I don't really see the advantage over the qdisc in that scheme.
> It's certainly not simpler and probably more code and would likely
> also not require less locks (e.g. a currently lockless driver
> would need a new lock for its sw queue). Also it is unclear to me
> it would be really any faster.

related to this comment, does Linux have a lockless (using atomics)
singly linked list element?  That would be very useful in a driver hot
path.
-
To unsubscribe from this list: send 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.23-mm1

2007-10-12 Thread Al Viro
On Fri, Oct 12, 2007 at 12:13:25AM -0700, Andrew Morton wrote:
> I always forget to test uml.  But a quick test build seems to work until
> it hits this:
> 
> arch/um/drivers/slip_kern.c: In function 'slip_init':
> arch/um/drivers/slip_kern.c:34: error: 'struct net_device' has no member 
> named 'header_cache_update'
> arch/um/drivers/slip_kern.c:35: error: 'struct net_device' has no member 
> named 'hard_header_cache'
> arch/um/drivers/slip_kern.c:36: error: 'struct net_device' has no member 
> named 'hard_header'

Umm...  Dies much faster here:
include/asm-um/arch:
@echo '  SYMLINK $@'
ifneq ($(KBUILD_SRC),)
$(Q)mkdir -p $(objtree)/include/asm-um
$(Q)ln -fsn $(srctree)/include/asm-$(SUBARCH) include/asm-um/arch
else
$(Q)cd $(TOPDIR)/include/asm-um && ln -sf ../asm-$(SUBARCH) arch
endif
gives a symlink from include/asm-um/arch to include/asm-i386 or
include/asm-x86_64, so e.g.
#ifndef __UM_POSIX_TYPES_H
#define __UM_POSIX_TYPES_H

#include "asm/arch/posix_types.h"

#endif
in asm-um/posix_types.h blows instantly.  Try to build on a tree without
stale symlinks...
-
To unsubscribe from this list: send 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] Switch helpers tc_core_{time2ktime,ktime2time} from long to unsigned as well.

2007-10-12 Thread Andreas Henriksson
Follow up patch to "Fix overflow in time2tick / tick2time." which switches
the remaining two helper functions from long to unsigned as well.
These functions are only used in "tc/q_hfsc.c" where both the passed argument
and the place the return value is stored are unsigned/u32 variables, so this
change should be safe to make but hasn't been tested as extensively as the
time2tick patch.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 tc/tc_core.c |4 ++--
 tc/tc_core.h |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tc/tc_core.c b/tc/tc_core.c
index fb89876..8c3a2ac 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -45,12 +45,12 @@ unsigned tc_core_tick2time(unsigned tick)
return tick/tick_in_usec;
 }
 
-long tc_core_time2ktime(long time)
+unsigned tc_core_time2ktime(unsigned time)
 {
return time * clock_factor;
 }
 
-long tc_core_ktime2time(long ktime)
+unsigned tc_core_ktime2time(unsigned ktime)
 {
return ktime / clock_factor;
 }
diff --git a/tc/tc_core.h b/tc/tc_core.h
index b2a16bc..b1ede1e 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -9,8 +9,8 @@
 int  tc_core_time2big(long time);
 unsigned tc_core_time2tick(unsigned time);
 unsigned tc_core_tick2time(unsigned tick);
-long tc_core_time2ktime(long time);
-long tc_core_ktime2time(long ktime);
+unsigned tc_core_time2ktime(unsigned time);
+unsigned tc_core_ktime2time(unsigned ktime);
 unsigned tc_calc_xmittime(unsigned rate, unsigned size);
 unsigned tc_calc_xmitsize(unsigned rate, unsigned ticks);
 int tc_calc_rtable(unsigned bps, __u32 *rtab, int cell_log, unsigned mtu, 
unsigned mpu);
-- 
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] Also do tc_core_time2big argument (long->unsigned).

2007-10-12 Thread Andreas Henriksson
tc_core_time2big only used in tc/q_netem.c where it gets passed an unsigned.

Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
---
 tc/tc_core.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tc/tc_core.c b/tc/tc_core.c
index 8c3a2ac..1365e08 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -26,7 +26,7 @@
 static double tick_in_usec = 1;
 static double clock_factor = 1;
 
-int tc_core_time2big(long time)
+int tc_core_time2big(unsigned time)
 {
__u64 t = time;
 
-- 
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: [RFC/PATCH 4/4] UDP memory usage accounting (take 4): memory limitation

2007-10-12 Thread Satoshi OSHIMA
Hi Stephen,

> On Thu, 11 Oct 2007 21:51:14 +0900
> Satoshi OSHIMA <[EMAIL PROTECTED]> wrote:
> 
>> Hi Stephen,
>>
>> Thank you for your comment.
>>
{
 +  .ctl_name   = NET_UDP_MEM,
 +  .procname   = "udp_mem",
 +  .data   = &sysctl_udp_mem,
 +  .maxlen = sizeof(sysctl_udp_mem),
 +  .mode   = 0644,
 +  .proc_handler   = &proc_dointvec
 +  },
 +  {
.ctl_name   = NET_TCP_APP_WIN,
.procname   = "tcp_app_win",
.data   = &sysctl_tcp_app_win,
>>> if you use &proc_dointvec_minmax, then you could inforce min/max
>>> values for udp_mem for the sysctl
> 
> One other comment. Sysctl value indexes are deprecated at this point
> so all new values should use CTL_UNNUMBERED.  Therefore unless NET_UDP_MEM
> already exists, please don't add it.

Thank you for letting me know. I will fix it.

Satoshi Oshima

-
To unsubscribe from this list: send 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][BNX2X] round three

2007-10-12 Thread Andi Kleen
"Eliezer Tamir" <[EMAIL PROTECTED]> writes:


> * For now depend on x86 or x86_64, will add more architectures ASAP.

Why is that? Linux drivers normally should not be architecture specific.

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


Re: [PATCH] NEW EMAC Fix RGMII build error: use of_device_is_compatible

2007-10-12 Thread Josh Boyer
On Fri, 2007-10-12 at 17:04 +0400, Valentine Barshak wrote:
> Fix build RGMII error: use of_device_is_compatible()
> insteadof now deprecated device_is_compatible() function.
> 
> Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>

Acked-by: Josh Boyer <[EMAIL PROTECTED]>

Jeff, this should go into 2.6.24 please.

josh
> ---
>  drivers/net/ibm_newemac/rgmii.c |2 +-
>  1 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/rgmii.c 
> linux-2.6/drivers/net/ibm_newemac/rgmii.c
> --- linux-2.6.orig/drivers/net/ibm_newemac/rgmii.c2007-10-12 
> 16:02:41.0 +0400
> +++ linux-2.6/drivers/net/ibm_newemac/rgmii.c 2007-10-12 16:49:07.0 
> +0400
> @@ -251,7 +251,7 @@ static int __devinit rgmii_probe(struct 
>   }
> 
>   /* Check for RGMII type */
> - if (device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
> + if (of_device_is_compatible(ofdev->node, "ibm,rgmii-axon"))
>   dev->type = RGMII_AXON;
>   else
>   dev->type = RGMII_STANDARD;
> ___
> Linuxppc-dev mailing list
> [EMAIL PROTECTED]
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

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


Re: [PATCH 03/12] Prevent renaming interfaces to empty string.

2007-10-12 Thread Patrick McHardy
Andreas Henriksson wrote:
> From: Alexander Wirt <[EMAIL PROTECTED]>
> 
> 
> Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
> ---
>  ip/iplink.c |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 4060845..da1f64e 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -670,6 +670,10 @@ static int do_set(int argc, char **argv)
>   }
>  
>   if (newname && strcmp(dev, newname)) {
> + if (strlen(newname) == 0) {
> + printf("\"\" is not valid device identifier\n");
> + return -1;
> + }


Indentation fixed, same change for the non-ioctl case, use invarg.
While I'm at it I also fixed the error message for "name too long",
*argv is NULL at this point.

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

diff --git a/ip/iplink.c b/ip/iplink.c
index 4060845..8e0ed2a 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -336,8 +336,10 @@ static int iplink_modify(int cmd, unsigned int flags, int 
argc, char **argv)
 
if (name) {
len = strlen(name) + 1;
+   if (len == 1)
+   invarg("\"\" is not a valid device identifier\n", 
"name");
if (len > IFNAMSIZ)
-   invarg("\"name\" too long\n", *argv);
+   invarg("\"name\" too long\n", name);
addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, len);
}
 
@@ -670,6 +672,8 @@ static int do_set(int argc, char **argv)
}
 
if (newname && strcmp(dev, newname)) {
+   if (strlen(newname) == 0)
+   invarg("\"\" is not a valid device identifier\n", 
"name");
if (do_changename(dev, newname) < 0)
return -1;
dev = newname;


[PATCH 1/4] UDP memory accounting and limitation(take 5): fix send buffer check

2007-10-12 Thread Satoshi OSHIMA
This patch introduces sndbuf size check before
memory allcation for send buffer.


signed-off-by: Satoshi Oshima <[EMAIL PROTECTED]>
signed-off-by: Hideo Aoki <[EMAIL PROTECTED]>

Index: 2.6.23-rc7-udp_limit/net/ipv4/ip_output.c
===
--- 2.6.23-rc7-udp_limit.orig/net/ipv4/ip_output.c
+++ 2.6.23-rc7-udp_limit/net/ipv4/ip_output.c
@@ -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);

-
To unsubscribe from this list: send 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] Also do tc_core_time2big argument (long->unsigned).

2007-10-12 Thread Patrick McHardy
Andreas Henriksson wrote:
> tc_core_time2big only used in tc/q_netem.c where it gets passed an unsigned.
> 
> Signed-off-by: Andreas Henriksson <[EMAIL PROTECTED]>
> ---
>  tc/tc_core.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)


Seems to be missing a tc_core.h update.
-
To unsubscribe from this list: send 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] UDP memory accounting and limitation(take 5): memory limitation

2007-10-12 Thread Satoshi OSHIMA
This patch introduces memory limitation for UDP.


signed-off-by: Satoshi Oshima <[EMAIL PROTECTED]>
signed-off-by: Hideo Aoki <[EMAIL PROTECTED]>

Index: 2.6.23-udp_limit/include/net/udp.h
===
--- 2.6.23-udp_limit.orig/include/net/udp.h
+++ 2.6.23-udp_limit/include/net/udp.h
@@ -65,7 +65,10 @@ extern rwlock_t udp_hash_lock;
 
 extern struct proto udp_prot;
 
+/* Used by memory accounting and capping */
+#define UDP_MIN_SKB_PAGES  4096
 extern atomic_t udp_memory_allocated;
+extern int sysctl_udp_mem;
 
 struct sk_buff;
 
Index: 2.6.23-udp_limit/net/ipv4/udp.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/udp.c
+++ 2.6.23-udp_limit/net/ipv4/udp.c
@@ -114,6 +114,7 @@ struct hlist_head udp_hash[UDP_HTABLE_SI
 DEFINE_RWLOCK(udp_hash_lock);
 
 atomic_t udp_memory_allocated;
+int sysctl_udp_mem = UDP_MIN_SKB_PAGES;
 
 static int udp_port_rover;
 
@@ -1016,6 +1017,16 @@ int udp_queue_rcv_skb(struct sock * sk, 
goto drop;
}
 
+   if (sk->sk_prot->sysctl_mem[0] > UDP_MIN_SKB_PAGES) {
+   if ((atomic_read(sk->sk_prot->memory_allocated)
+  + sk_datagram_pages(skb->truesize))
+   >= sk->sk_prot->sysctl_mem[0]) {
+   UDP_INC_STATS_BH(UDP_MIB_RCVBUFERRORS,
+   up->pcflag);
+   goto drop;
+   }
+   }
+
if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
/* Note that an ENOMEM error is charged twice */
if (rc == -ENOMEM)
@@ -1451,6 +1462,7 @@ struct proto udp_prot = {
.unhash= udp_lib_unhash,
.get_port  = udp_v4_get_port,
.memory_allocated  = &udp_memory_allocated,
+   .sysctl_mem= &sysctl_udp_mem,
.obj_size  = sizeof(struct udp_sock),
 #ifdef CONFIG_COMPAT
.compat_setsockopt = compat_udp_setsockopt,
Index: 2.6.23-udp_limit/net/ipv4/sysctl_net_ipv4.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/sysctl_net_ipv4.c
+++ 2.6.23-udp_limit/net/ipv4/sysctl_net_ipv4.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 /* From af_inet.c */
@@ -25,6 +26,7 @@ extern int sysctl_ip_nonlocal_bind;
 #ifdef CONFIG_SYSCTL
 static int zero;
 static int tcp_retr1_max = 255;
+static int udp_mem_min = UDP_MIN_SKB_PAGES;
 static int ip_local_port_range_min[] = { 1, 1 };
 static int ip_local_port_range_max[] = { 65535, 65535 };
 #endif
@@ -599,6 +601,16 @@ ctl_table ipv4_table[] = {
.proc_handler   = &proc_dointvec
},
{
+   .ctl_name   = CTL_UNNUMBERED,
+   .procname   = "udp_mem",
+   .data   = &sysctl_udp_mem,
+   .maxlen = sizeof(sysctl_udp_mem),
+   .mode   = 0644,
+   .proc_handler   = &proc_dointvec_minmax,
+   .strategy   = &sysctl_intvec,
+   .extra1 = &udp_mem_min
+   },
+   {
.ctl_name   = NET_TCP_APP_WIN,
.procname   = "tcp_app_win",
.data   = &sysctl_tcp_app_win,
Index: 2.6.23-udp_limit/net/ipv4/ip_output.c
===
--- 2.6.23-udp_limit.orig/net/ipv4/ip_output.c
+++ 2.6.23-udp_limit/net/ipv4/ip_output.c
@@ -75,6 +75,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -699,6 +700,21 @@ 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 (sk->sk_prot->sysctl_mem[0] > UDP_MIN_SKB_PAGES)
+   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),
@@ -910,6 +926,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)
+   + sizeof(struct sk_buff)));
+   if (err)
+   goto error;
+
if (transhdrlen) {
skb = sock_alloc_send_skb(sk,
   

[PATCH] gianfar: Fix compile regression caused by 09f75cd7

2007-10-12 Thread Li Yang
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
 drivers/net/gianfar.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index 2b758fa..6d1456a 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -1228,8 +1228,6 @@ static int gfar_change_mtu(struct net_device *dev, int 
new_mtu)
  * starting over will fix the problem. */
 static void gfar_timeout(struct net_device *dev)
 {
-   struct gfar_private *priv = netdev_priv(dev);
-
dev->stats.tx_errors++;
 
if (dev->flags & IFF_UP) {
@@ -1335,8 +1333,9 @@ struct sk_buff * gfar_new_skb(struct net_device *dev, 
struct rxbd8 *bdp)
return skb;
 }
 
-static inline void count_errors(unsigned short status, struct gfar_private 
*priv)
+static inline void count_errors(unsigned short status, struct net_device *dev)
 {
+   struct gfar_private *priv = netdev_priv(dev);
struct net_device_stats *stats = &dev->stats;
struct gfar_extra_stats *estats = &priv->extra_stats;
 
@@ -1530,7 +1529,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int 
rx_work_limit)
 
dev->stats.rx_bytes += pkt_len;
} else {
-   count_errors(bdp->status, priv);
+   count_errors(bdp->status, dev);
 
if (skb)
dev_kfree_skb_any(skb);
-- 
1.5.3.2.104.g41ef

-
To unsubscribe from this list: send 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: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Patrick McHardy
Jan Engelhardt wrote:
> On Oct 12 2007 15:48, Patrick McHardy wrote:
> 
>>The netlink based iptables successor I'm currently working on allows to
>>dynamically create tables with user-specified priorities and "built-in"
>>chains. The only built-in tables will be those that need extra
>>processing (mangle/nat). So it should be possible to set up tables
>>basically any way you desire.
> 
> 
> Will ebtables move a bit closer to iptables?


I didn't get to that part yet, but yes, thats one of the goals.
-
To unsubscribe from this list: send 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] [TCP]: high_seq parameter removed (all callers use tp->high_seq)

2007-10-12 Thread Ilpo Järvinen

Signed-off-by: Ilpo Järvinen <[EMAIL PROTECTED]>
---

Compile tested with 2.6.23 as current Linus' tree provides an
hilarious building failure to our net-2.6 sandbox... :-)

 net/ipv4/tcp_input.c |   11 +--
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 0a42e93..0f00966 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1995,8 +1995,7 @@ static void tcp_verify_retransmit_hint(struct tcp_sock 
*tp,
 }
 
 /* Mark head of queue up as lost. */
-static void tcp_mark_head_lost(struct sock *sk,
-  int packets, u32 high_seq)
+static void tcp_mark_head_lost(struct sock *sk, int packets)
 {
struct tcp_sock *tp = tcp_sk(sk);
struct sk_buff *skb;
@@ -2019,7 +2018,7 @@ static void tcp_mark_head_lost(struct sock *sk,
tp->lost_skb_hint = skb;
tp->lost_cnt_hint = cnt;
cnt += tcp_skb_pcount(skb);
-   if (cnt > packets || after(TCP_SKB_CB(skb)->end_seq, high_seq))
+   if (cnt > packets || after(TCP_SKB_CB(skb)->end_seq, 
tp->high_seq))
break;
if (!(TCP_SKB_CB(skb)->sacked & 
(TCPCB_SACKED_ACKED|TCPCB_LOST))) {
TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
@@ -2040,9 +2039,9 @@ static void tcp_update_scoreboard(struct sock *sk)
int lost = tp->fackets_out - tp->reordering;
if (lost <= 0)
lost = 1;
-   tcp_mark_head_lost(sk, lost, tp->high_seq);
+   tcp_mark_head_lost(sk, lost);
} else {
-   tcp_mark_head_lost(sk, 1, tp->high_seq);
+   tcp_mark_head_lost(sk, 1);
}
 
/* New heuristics: it is possible only after we switched
@@ -2381,7 +2380,7 @@ tcp_fastretrans_alert(struct sock *sk, int pkts_acked, 
int flag)
before(tp->snd_una, tp->high_seq) &&
icsk->icsk_ca_state != TCP_CA_Open &&
tp->fackets_out > tp->reordering) {
-   tcp_mark_head_lost(sk, tp->fackets_out-tp->reordering, 
tp->high_seq);
+   tcp_mark_head_lost(sk, tp->fackets_out - tp->reordering);
NET_INC_STATS_BH(LINUX_MIB_TCPLOSS);
}
 
-- 
1.5.0.6


Re: [RFD] iptables: mangle table obsoletes filter table

2007-10-12 Thread Jan Engelhardt

On Oct 12 2007 00:31, Al Boldi wrote:
>
>With the existence of the mangle table, how useful is the filter table?

A similar discussion was back in March 2007.
http://marc.info/?l=netfilter-devel&m=117394977210823&w=2
http://marc.info/?l=netfilter-devel&m=117400063907706&w=2

in the end, my proposal was something like
http://jengelh.hopto.org/GFX0/nf_proposal2.svg
-
To unsubscribe from this list: send 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/9] Consolidate the xxx_frag_kill

2007-10-12 Thread Pavel Emelyanov
Since now all the xxx_frag_kill functions now work
with the generic inet_frag_queue data type, this can
be moved into a common place.

The xxx_unlink() code is moved as well.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index ada03ba..9902363 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -41,4 +41,6 @@ struct inet_frags {
 void inet_frags_init(struct inet_frags *);
 void inet_frags_fini(struct inet_frags *);
 
+void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
+
 #endif
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 69623ff..534eaa8 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -42,3 +42,26 @@ void inet_frags_fini(struct inet_frags *f)
 {
 }
 EXPORT_SYMBOL(inet_frags_fini);
+
+static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f)
+{
+   write_lock(&f->lock);
+   hlist_del(&fq->list);
+   list_del(&fq->lru_list);
+   f->nqueues--;
+   write_unlock(&f->lock);
+}
+
+void inet_frag_kill(struct inet_frag_queue *fq, struct inet_frags *f)
+{
+   if (del_timer(&fq->timer))
+   atomic_dec(&fq->refcnt);
+
+   if (!(fq->last_in & COMPLETE)) {
+   fq_unlink(fq, f);
+   atomic_dec(&fq->refcnt);
+   fq->last_in |= COMPLETE;
+   }
+}
+
+EXPORT_SYMBOL(inet_frag_kill);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 61035a8..5b376c4 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -105,20 +105,6 @@ int ip_frag_mem(void)
return atomic_read(&ip4_frags.mem);
 }
 
-static __inline__ void __ipq_unlink(struct ipq *qp)
-{
-   hlist_del(&qp->q.list);
-   list_del(&qp->q.lru_list);
-   ip4_frags.nqueues--;
-}
-
-static __inline__ void ipq_unlink(struct ipq *ipq)
-{
-   write_lock(&ip4_frags.lock);
-   __ipq_unlink(ipq);
-   write_unlock(&ip4_frags.lock);
-}
-
 static unsigned int ipqhashfn(__be16 id, __be32 saddr, __be32 daddr, u8 prot)
 {
return jhash_3words((__force u32)id << 16 | prot,
@@ -219,14 +205,7 @@ static __inline__ void ipq_put(struct ipq *ipq, int *work)
  */
 static void ipq_kill(struct ipq *ipq)
 {
-   if (del_timer(&ipq->q.timer))
-   atomic_dec(&ipq->q.refcnt);
-
-   if (!(ipq->q.last_in & COMPLETE)) {
-   ipq_unlink(ipq);
-   atomic_dec(&ipq->q.refcnt);
-   ipq->q.last_in |= COMPLETE;
-   }
+   inet_frag_kill(&ipq->q, &ip4_frags);
 }
 
 /* Memory limiting on fragments.  Evictor trashes the oldest
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c 
b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 966a888..2ebe515 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -79,20 +79,6 @@ struct inet_frags_ctl nf_frags_ctl __read_mostly = {
 
 static struct inet_frags nf_frags;
 
-static __inline__ void __fq_unlink(struct nf_ct_frag6_queue *fq)
-{
-   hlist_del(&fq->q.list);
-   list_del(&fq->q.lru_list);
-   nf_frags.nqueues--;
-}
-
-static __inline__ void fq_unlink(struct nf_ct_frag6_queue *fq)
-{
-   write_lock(&nf_frags.lock);
-   __fq_unlink(fq);
-   write_unlock(&nf_frags.lock);
-}
-
 static unsigned int ip6qhashfn(__be32 id, struct in6_addr *saddr,
   struct in6_addr *daddr)
 {
@@ -213,14 +199,7 @@ static __inline__ void fq_put(struct nf_ct_frag6_queue 
*fq, unsigned int *work)
  */
 static __inline__ void fq_kill(struct nf_ct_frag6_queue *fq)
 {
-   if (del_timer(&fq->q.timer))
-   atomic_dec(&fq->q.refcnt);
-
-   if (!(fq->q.last_in & COMPLETE)) {
-   fq_unlink(fq);
-   atomic_dec(&fq->q.refcnt);
-   fq->q.last_in |= COMPLETE;
-   }
+   inet_frag_kill(&fq->q, &nf_frags);
 }
 
 static void nf_ct_frag6_evictor(void)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index f0e22be..57e32f4 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -100,20 +100,6 @@ int ip6_frag_mem(void)
return atomic_read(&ip6_frags.mem);
 }
 
-static __inline__ void __fq_unlink(struct frag_queue *fq)
-{
-   hlist_del(&fq->q.list);
-   list_del(&fq->q.lru_list);
-   ip6_frags.nqueues--;
-}
-
-static __inline__ void fq_unlink(struct frag_queue *fq)
-{
-   write_lock(&ip6_frags.lock);
-   __fq_unlink(fq);
-   write_unlock(&ip6_frags.lock);
-}
-
 /*
  * callers should be careful not to use the hash value outside the ipfrag_lock
  * as doing so could race with ipfrag_hash_rnd being recalculated.
@@ -236,14 +222,7 @@ static __inline__ void fq_put(struct frag_queue *fq, int 
*work)
  */
 static __inline__ void fq_kill(struct frag_queue *fq)
 {
-   if (del_timer(&fq->q.timer))
-   atomic_dec(&fq->q.refcnt);
-
-   if (!(fq->q.last_in & COMPLETE)) {
-   fq_unlink(fq);
-   atomic_d

[PATCH 7/9] Consolidate the xxx_evictor

2007-10-12 Thread Pavel Emelyanov
The evictors collect some statistics for ipv4 and ipv6, 
so make it return the number of evicted queues and account
them all at once in the caller.

The XXX_ADD_STATS_BH() macros are just for this case, 
but maybe there are places in code, that can make use of 
them as well.

Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>

---

diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 2dd1cd4..cf583cf 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -49,5 +49,6 @@ void inet_frags_fini(struct inet_frags *);
 void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f);
 void inet_frag_destroy(struct inet_frag_queue *q,
struct inet_frags *f, int *work);
+int inet_frag_evictor(struct inet_frags *f);
 
 #endif
diff --git a/include/net/ip.h b/include/net/ip.h
index e7b0feb..00ed4f3 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -160,6 +160,7 @@ DECLARE_SNMP_STAT(struct ipstats_mib, ip_statistics);
 #define IP_INC_STATS(field)SNMP_INC_STATS(ip_statistics, field)
 #define IP_INC_STATS_BH(field) SNMP_INC_STATS_BH(ip_statistics, field)
 #define IP_INC_STATS_USER(field)   SNMP_INC_STATS_USER(ip_statistics, 
field)
+#define IP_ADD_STATS_BH(field, val)SNMP_ADD_STATS_BH(ip_statistics, field, 
val)
 DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
 #define NET_INC_STATS(field)   SNMP_INC_STATS(net_statistics, field)
 #define NET_INC_STATS_BH(field)
SNMP_INC_STATS_BH(net_statistics, field)
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index b29d76c..a0f1042 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -120,12 +120,21 @@ extern int sysctl_mld_max_msf;
SNMP_INC_STATS##modifier(statname##_statistics, (field));   \
 })
 
+#define _DEVADD(statname, modifier, idev, field, val)  \
+({ \
+   struct inet6_dev *_idev = (idev);   \
+   if (likely(_idev != NULL))  \
+   SNMP_ADD_STATS##modifier((_idev)->stats.statname, (field), 
(val)); \
+   SNMP_ADD_STATS##modifier(statname##_statistics, (field), (val));\
+})
+
 /* MIBs */
 DECLARE_SNMP_STAT(struct ipstats_mib, ipv6_statistics);
 
 #define IP6_INC_STATS(idev,field)  _DEVINC(ipv6, , idev, field)
 #define IP6_INC_STATS_BH(idev,field)   _DEVINC(ipv6, _BH, idev, field)
 #define IP6_INC_STATS_USER(idev,field) _DEVINC(ipv6, _USER, idev, field)
+#define IP6_ADD_STATS_BH(idev,field,val) _DEVADD(ipv6, _BH, idev, field, val)
 
 DECLARE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics);
 DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics);
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 15fb2c4..484cf51 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -140,3 +140,35 @@ void inet_frag_destroy(struct inet_frag_queue *q, struct 
inet_frags *f,
 
 }
 EXPORT_SYMBOL(inet_frag_destroy);
+
+int inet_frag_evictor(struct inet_frags *f)
+{
+   struct inet_frag_queue *q;
+   int work, evicted = 0;
+
+   work = atomic_read(&f->mem) - f->ctl->low_thresh;
+   while (work > 0) {
+   read_lock(&f->lock);
+   if (list_empty(&f->lru_list)) {
+   read_unlock(&f->lock);
+   break;
+   }
+
+   q = list_first_entry(&f->lru_list,
+   struct inet_frag_queue, lru_list);
+   atomic_inc(&q->refcnt);
+   read_unlock(&f->lock);
+
+   spin_lock(&q->lock);
+   if (!(q->last_in & COMPLETE))
+   inet_frag_kill(q, f);
+   spin_unlock(&q->lock);
+
+   if (atomic_dec_and_test(&q->refcnt))
+   inet_frag_destroy(q, f, &work);
+   evicted++;
+   }
+
+   return evicted;
+}
+EXPORT_SYMBOL(inet_frag_evictor);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index a59ac39..4ea7948 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -171,33 +171,11 @@ static void ipq_kill(struct ipq *ipq)
  */
 static void ip_evictor(void)
 {
-   struct ipq *qp;
-   struct list_head *tmp;
-   int work;
-
-   work = atomic_read(&ip4_frags.mem) - ip4_frags_ctl.low_thresh;
-   if (work <= 0)
-   return;
-
-   while (work > 0) {
-   read_lock(&ip4_frags.lock);
-   if (list_empty(&ip4_frags.lru_list)) {
-   read_unlock(&ip4_frags.lock);
-   return;
-   }
-   tmp = ip4_frags.lru_list.next;
-   qp = list_entry(tmp, struct ipq, q.lru_list);
-   atomic_inc(&qp->q.refcnt);
-   read_unlock(&ip4_frags.lock);
+   int evicted;
 
-   spin_lock(&qp->q.lock);
-   if (!(qp->q.last_in&COMPLETE))
-  

Re: e100 problems in .23rc8 ?

2007-10-12 Thread Herbert Xu
On Fri, Oct 12, 2007 at 07:54:33AM -0700, David Mack wrote:
> Still no joy here. See attached capture. What's really weird is that it
> shows *two* kernel panics, one in  e100_poll and one in _list_add.

Yes that's the symptom one would expect from that bug.  We really
need to apply the same fix that was done for e1000.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[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: e100 problems in .23rc8 ?

2007-10-12 Thread David Mack
Still no joy here. See attached capture. What's really weird is that it
shows *two* kernel panics, one in  e100_poll and one in _list_add.

Dave

> -Original Message-
> From: Dave Jones [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, October 11, 2007 10:26 AM
> To: Kok, Auke
> Cc: Herbert Xu; netdev@vger.kernel.org; [EMAIL PROTECTED]; 
> David Mack
> Subject: Re: e100 problems in .23rc8 ?
> 
> On Thu, Oct 11, 2007 at 09:10:34AM -0700, Kok, Auke wrote:
>  > Herbert Xu wrote:
>  > > On Wed, Oct 10, 2007 at 08:36:38PM -0400, Dave Jones wrote:
>  > >> The e1000 changes you reference above, is this the 
> changeset you mean?
>  > >>
>  > >> commit 416b5d10afdc797c21c457ade3714e8f2f75edd9
>  > >> Author: Auke Kok <[EMAIL PROTECTED]>
>  > >> Date:   Fri Jun 1 10:22:39 2007 -0700
>  > >>
>  > >> e1000: disable polling before registering netdevice
>  > > 
>  > > Yep.
>  > 
>  > this patch actually called napi_disable() in the probe 
> routine which was wrong,
>  > but e100 does not do that. Nonetheless e100 doesn't call 
> netif_carrier_off() and
>  > netif_stop_queue(), so to make e100 the same as e1000 we 
> should probably do this,
>  > see below.
>  > 
>  > Dave, can you see if this resolves the issue for you? If 
> so then we might want to
>  > push this to -stable.
>  
> Will do, thanks Auke.
> 
> Eric/David, the Fedora 8 RPM version 2.6.23-6.fc8 will have 
> this if you
> want to give it a shot too.  It'll be at
> http://people.redhat.com/davej/kernels/Fedora/f7.92/ when it's done
> building in an hour or so.
> 
>   Dave
> 
> -- 
> http://www.codemonkey.org.uk
> 
Linux version 2.6.23-6.fc8 (kojibuilder@) (gcc version 4.1.2 20070925 (Red Hat 
4.1.2-31)) #1 SMP Thu Oct 11 14:54:16 EDT 2007
BIOS-provided physical RAM map:
 BIOS-e820:  - 0009fc00 (usable)
 BIOS-e820: 0009fc00 - 000a (reserved)
 BIOS-e820: 000ec000 - 0010 (reserved)
 BIOS-e820: 0010 - 3fff (usable)
 BIOS-e820: 3fff - 3fff8000 (ACPI data)
 BIOS-e820: 3fff8000 - 4000 (ACPI NVS)
 BIOS-e820:  - 0001 (reserved)
127MB HIGHMEM available.
896MB LOWMEM available.
Using x86 segment limits to approximate NX protection
Zone PFN ranges:
  DMA 0 -> 4096
  Normal   4096 ->   229376
  HighMem229376 ->   262128
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0:0 ->   262128
DMI 2.3 present.
Using APIC driver default
ACPI: RSDP 000FA8D0, 0014 (r0 AMI   )
ACPI: RSDT 3FFF, 0028 (r1 AMIINT10 MSFT   97)
ACPI: FACP 3FFF0030, 0074 (r1 AMIINT10 MSFT   97)
ACPI: DSDT 3FFF00B0, 2AE4 (r1VIA   VT8371 1000 MSFT  10B)
ACPI: FACS 3FFF8000, 0040
ACPI: PM-Timer IO Port: 0x808
Allocating PCI resources starting at 5000 (gap: 4000:bfff)
swsusp: Registered nosave memory region: 0009f000 - 000a
swsusp: Registered nosave memory region: 000a - 000ec000
swsusp: Registered nosave memory region: 000ec000 - 0010
Built 1 zonelists in Zone order.  Total pages: 258545
Kernel command line: ro root=LABEL=/1 console=ttyS0,9600n8
Local APIC disabled by BIOS -- you can enable it with "lapic"
Enabling fast FPU save and restore... done.
Initializing CPU#0
CPU 0 irqstacks, hard=c0814000 soft=c07f4000
PID hash table entries: 4096 (order: 12, 16384 bytes)
Detected 952.200 MHz processor.
Console: colour VGA+ 80x25
console [ttyS0] enabled
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES:8
... MAX_LOCK_DEPTH:  30
... MAX_LOCKDEP_KEYS:2048
... CLASSHASH_SIZE:   1024
... MAX_LOCKDEP_ENTRIES: 8192
... MAX_LOCKDEP_CHAINS:  16384
... CHAINHASH_SIZE:  8192
 memory used by lock dependency info: 1024 kB
 per task-struct memory footprint: 1680 bytes
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1022396k/1048512k available (2271k kernel code, 25372k reserved, 1174k 
data, 568k init, 131008k highmem)
virtual kernel memory layout:
fixmap  : 0xffc53000 - 0xf000   (3760 kB)
pkmap   : 0xff80 - 0xffc0   (4096 kB)
vmalloc : 0xf880 - 0xff7fe000   ( 111 MB)
lowmem  : 0xc000 - 0xf800   ( 896 MB)
  .init : 0xc0763000 - 0xc07f1000   ( 568 kB)
  .data : 0xc0637e5f - 0xc075da44   (1174 kB)
  .text : 0xc040 - 0xc0637e5f   (2271 kB)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
SLUB: Genslabs=22, HWalign=32, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
Calibrating delay using timer specific routine.. 1907.59 BogoMIPS (lpj=953797)
Security Framework v1.0.0 initialized
SELinux:  Initializing.
selinux_register_security:  Registering secondary module capability
Capability LSM initialized as secondary
Mount-cache hash tabl

Re: [ofa-general] Re: [PATCH 2/3][NET_BATCH] net core use batching

2007-10-12 Thread Andi Kleen
> related to this comment, does Linux have a lockless (using atomics)
> singly linked list element?  That would be very useful in a driver hot
> path.

No; it doesn't. At least not a portable one.
Besides they tend to be not faster anyways because e.g. cmpxchg tends
to be as slow as an explicit spinlock.

-Andi

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


Re: [PATCH] IPROUTE2: Support IPv4/IPv6 Tunnel

2007-10-12 Thread Stephen Hemminger
On Fri, 12 Oct 2007 16:51:22 +0900 (JST)
YOSHIFUJI Hideaki / 吉藤英明  <[EMAIL PROTECTED]> wrote:

> Based on patch from Yasuyuki KOZAKAI <[EMAIL PROTECTED]>.
> 
> Signed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>
> 

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


Re: 2.6.23-mm1 thread exit_group issue

2007-10-12 Thread Andrew Morton
On Fri, 12 Oct 2007 15:47:59 -0400
Mathieu Desnoyers <[EMAIL PROTECTED]> wrote:

> I noticed a regression between 2.6.23-rc8-mm2 and 2.6.23-mm1 (with your
> hotfixes). User space threads seems to receive a ERESTART_RESTARTBLOCK
> as soon as a thread does a pthread_join on them. The previous behavior
> was to wait for them to exit by taking a futex.
> 
> I provide a toy program that shows the problem. On 2.6.23-rc8-mm2, it
> loops forever (as it should). On 2.6.23-mm1, it exits after 10 seconds.
> 
> Any idea on what may cause this problem ?
> 
> (I also provide complete ptrace -f of a correct and buggy run and my
> kernel config. Tests were done on i386.)

No idea.  But I can reproduce it here so I'll bisect it now.  Thanks
for the test case!
-
To unsubscribe from this list: send 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: IPUtils and uClibc

2007-10-12 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Mon, 30 Jul 2007 00:50:39 +0200), Rafał 
Bilski <[EMAIL PROTECTED]> says:

> Today I was trying to update my router based on Gentoo and uClibc. 
> Unfortunatly build fails because of b* functions. Linker can't 
> find them later. At first gcc is complaining that b* functions 
> are impilicity declared. Acording to man pages these functions 
> are deprecated anyway.
> Patch is for Gentoo's iputils-20070202.
:

Applied, thanks.

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


  1   2   >