Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] [IPv4] SNMP: Refer correct memory location to display ICMP out-going statistics
From: David Miller @ 2007-10-30  5:03 UTC (permalink / raw)
  To: mitch; +Cc: netdev, dlstevens
In-Reply-To: <20071026105928.d56cd244.mitch@linux.vnet.ibm.com>

From: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Date: Fri, 26 Oct 2007 10:59:28 +0900

> While displaying ICMP out-going statistics as Out<name> counters in
> /proc/net/snmp, the memory location for ICMP in-coming statistics
> was referred by mistake.
> 
> Acked-by: David L Stevens <dlstevens@us.ibm.com> 
> Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>

Patch applied, thank you!

^ permalink raw reply

* Re: [0/11] Merge bundle creation and other misc fixes/clean-ups
From: David Miller @ 2007-10-30  5:06 UTC (permalink / raw)
  To: herbert; +Cc: yoshfuji, netdev
In-Reply-To: <20071023160217.GA32102@gondor.apana.org.au>

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Wed, 24 Oct 2007 00:02:17 +0800

> This series of patches fixes the bug where the bundle creation
> code treats IPv6 routes as IPv4 or vice versa.
> 
> I think this is suitable for 2.6.25.
> 
> They do fix bugs but I don't think any of them are serious enough
> for inclusion in 2.6.24.

I did a review of these patches and these look fine.

Please resubmit this and the 3-patch input interfamily
fix set when I open up the net-2.6.25 tree.

I'll probably open up net-2.6.25 approximately one week
from now.

^ permalink raw reply

* Re: [patch] net: avoid race between netpoll and network fast path
From: Matt Mackall @ 2007-10-30  5:08 UTC (permalink / raw)
  To: David Miller; +Cc: tina.yang, netdev
In-Reply-To: <20071029.212611.152845077.davem@davemloft.net>

On Mon, Oct 29, 2007 at 09:26:11PM -0700, David Miller wrote:
> From: Tina Yang <tina.yang@oracle.com>
> Date: Tue, 16 Oct 2007 22:46:30 -0700
> 
> > 	The precise race is
> > 	1) net_rx_action get the dev from poll_list
> > 	2) at the same time, netpoll poll_napi() get a hold of the poll lock
> > 	   and calls ->poll(), remove dev from the poll list
> > 	3) after it finishes, net_rx_action get the poll lock, and calls
> > 	   ->poll() the second time, and panic when trying to remove (again)
> > 	   the dev from the poll list.
> 
> This is trivial to fix.
> 
> I'll check the following into 2.6.14 and backport it to
> the -stable trees.
> 
> [NET]: Fix race between poll_napi() and net_rx_action()
> 
> netpoll_poll_lock() synchronizes the ->poll() invocation
> code paths, but once we have the lock we have to make
> sure that NAPI_STATE_SCHED is still set.  Otherwise we
> get:
> 
> 	cpu 0			cpu 1
> 
> 	net_rx_action()		poll_napi()
> 	netpoll_poll_lock()	... spin on ->poll_lock
> 	->poll()
> 	  netif_rx_complete
> 	netpoll_poll_unlock()	acquire ->poll_lock()
> 				->poll()
> 				 netif_rx_complete()
> 				 CRASH
> 
> Based upon a bug report from Tina Yang.
> 
> Signed-off-by: David S. Miller <davem@davemloft.net>

Thanks, Dave.

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply

* [PATCH] rpc_rdma: we need to cast u64 to unsigned long long for printing
From: Stephen Rothwell @ 2007-10-30  5:12 UTC (permalink / raw)
  To: netdev; +Cc: LKML

as some architectures have unsigned long for u64.

net/sunrpc/xprtrdma/rpc_rdma.c: In function 'rpcrdma_create_chunks':
net/sunrpc/xprtrdma/rpc_rdma.c:222: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
net/sunrpc/xprtrdma/rpc_rdma.c:234: warning: format '%llx' expects type 'long long unsigned int', but argument 5 has type 'u64'
net/sunrpc/xprtrdma/rpc_rdma.c: In function 'rpcrdma_count_chunks':
net/sunrpc/xprtrdma/rpc_rdma.c:577: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64

Noticed on PowerPC pseries_defconfig build.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 net/sunrpc/xprtrdma/rpc_rdma.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index f877b88..9e11ce7 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -221,8 +221,8 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
 					seg->mr_base);
 			dprintk("RPC:       %s: read chunk "
 				"elem %d@0x%llx:0x%x pos %d (%s)\n", __func__,
-				seg->mr_len, seg->mr_base, seg->mr_rkey, pos,
-				n < nsegs ? "more" : "last");
+				seg->mr_len, (unsigned long long)seg->mr_base,
+				seg->mr_rkey, pos, n < nsegs ? "more" : "last");
 			cur_rchunk++;
 			r_xprt->rx_stats.read_chunk_count++;
 		} else {		/* write/reply */
@@ -234,8 +234,8 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
 			dprintk("RPC:       %s: %s chunk "
 				"elem %d@0x%llx:0x%x (%s)\n", __func__,
 				(type == rpcrdma_replych) ? "reply" : "write",
-				seg->mr_len, seg->mr_base, seg->mr_rkey,
-				n < nsegs ? "more" : "last");
+				seg->mr_len, (unsigned long long)seg->mr_base,
+				seg->mr_rkey, n < nsegs ? "more" : "last");
 			cur_wchunk++;
 			if (type == rpcrdma_replych)
 				r_xprt->rx_stats.reply_chunk_count++;
@@ -577,7 +577,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, __be32 **ipt
 			dprintk("RPC:       %s: chunk %d@0x%llx:0x%x\n",
 				__func__,
 				ntohl(seg->rs_length),
-				off,
+				(unsigned long long)off,
 				ntohl(seg->rs_handle));
 		}
 		total_len += ntohl(seg->rs_length);
-- 
1.5.3.4


^ permalink raw reply related

* Re: [0/11] Merge bundle creation and other misc fixes/clean-ups
From: Herbert Xu @ 2007-10-30  5:49 UTC (permalink / raw)
  To: David Miller; +Cc: yoshfuji, netdev
In-Reply-To: <20071029.220635.262385821.davem@davemloft.net>

On Mon, Oct 29, 2007 at 10:06:35PM -0700, David Miller wrote:
>
> I did a review of these patches and these look fine.

Thanks!

> Please resubmit this and the 3-patch input interfamily
> fix set when I open up the net-2.6.25 tree.
> 
> I'll probably open up net-2.6.25 approximately one week
> from now.

Sure.  And I hope there will be a few more patches by then :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH 1/2] [CRYPTO] tcrypt: Move sg_init_table out of timing loops
From: Jens Axboe @ 2007-10-30  5:50 UTC (permalink / raw)
  To: Herbert Xu
  Cc: David S. Miller, Linux Kernel Mailing List,
	Linux Crypto Mailing List, netdev
In-Reply-To: <20071030000827.GA9037@gondor.apana.org.au>

On Tue, Oct 30 2007, Herbert Xu wrote:
> On Mon, Oct 29, 2007 at 09:16:27PM +0100, Jens Axboe wrote:
> > On Fri, Oct 26 2007, Herbert Xu wrote:
> > > [CRYPTO] tcrypt: Move sg_init_table out of timing loops
> > > 
> > > This patch moves the sg_init_table out of the timing loops for hash
> > > algorithms so that it doesn't impact on the speed test results.
> > 
> > Wouldn't it be better to just make sg_init_one() call sg_init_table?
> 
> This looks fine to me although I think it's orthogonal to the
> patch you were quoting :)

How so? The reason you changed it to sg_init_table() + sg_set_buf() is
exactly because sg_init_one() didn't properly init the entry (as they
name promised).

-- 
Jens Axboe

^ permalink raw reply

* [RFC 0/2] [IPV6] ADDRCONF: IPv6 configurable Default Address Selection support (TAKE 2)
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-10-30  5:52 UTC (permalink / raw)
  To: netdev

This is the 2nd RFC for supporting configurable IPv6 Default Address Selection
policy (RFC3484) based on 2.6.24-rc1.
This is intended for 2.6.25.

Major changes:
	- Use rtnetlink instead of ioctl/procfs.
	- Use RCU.

Git tree is available at the branch named 2.6.24-rc1-addrlabel-20071030 at
	git://git.linux-ipv6.org/gitroot/yoshfuji/linux-2.6-dev.git

iproute2 is available at the branch named addrlabel-20071030 at
	git://git.linux-ipv6.org/gitroot/yoshfuji/iproute2-dev.git

-- 
YOSHIFUJI Hideaki @ USAGI Project  <yoshfuji@linux-ipv6.org>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply

* [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-10-30  5:52 UTC (permalink / raw)
  To: netdev

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 net/ipv6/addrconf.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 348bd8d..8b408b7 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -877,7 +877,8 @@ static inline int ipv6_saddr_preferred(int type)
 }
 
 /* static matching label */
-static inline int ipv6_saddr_label(const struct in6_addr *addr, int type)
+static inline int ipv6_addr_label(const struct in6_addr *addr, int type,
+				  int ifindex)
 {
  /*
   * 	prefix (longest match)	label
@@ -912,7 +913,8 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
 	struct inet6_ifaddr *ifa_result = NULL;
 	int daddr_type = __ipv6_addr_type(daddr);
 	int daddr_scope = __ipv6_addr_src_scope(daddr_type);
-	u32 daddr_label = ipv6_saddr_label(daddr, daddr_type);
+	int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;
+	u32 daddr_label = ipv6_addr_label(daddr, daddr_type, daddr_ifindex);
 	struct net_device *dev;
 
 	memset(&hiscore, 0, sizeof(hiscore));
@@ -1085,11 +1087,15 @@ int ipv6_dev_get_saddr(struct net_device *daddr_dev,
 
 			/* Rule 6: Prefer matching label */
 			if (hiscore.rule < 6) {
-				if (ipv6_saddr_label(&ifa_result->addr, hiscore.addr_type) == daddr_label)
+				if (ipv6_addr_label(&ifa_result->addr,
+						    hiscore.addr_type,
+						    ifa_result->idev->dev->ifindex) == daddr_label)
 					hiscore.attrs |= IPV6_SADDR_SCORE_LABEL;
 				hiscore.rule++;
 			}
-			if (ipv6_saddr_label(&ifa->addr, score.addr_type) == daddr_label) {
+			if (ipv6_addr_label(&ifa->addr,
+					    score.addr_type,
+					    ifa->idev->dev->ifindex) == daddr_label) {
 				score.attrs |= IPV6_SADDR_SCORE_LABEL;
 				if (!(hiscore.attrs & IPV6_SADDR_SCORE_LABEL)) {
 					score.rule = 6;
-- 
1.4.4.4


^ permalink raw reply related

* [RFC 2/2] [IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2007-10-30  5:52 UTC (permalink / raw)
  To: netdev

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 include/linux/if_addrlabel.h |   55 ++++
 include/linux/rtnetlink.h    |    7 +
 include/net/addrconf.h       |    8 +
 net/ipv6/Makefile            |    1 +
 net/ipv6/addrconf.c          |   40 +---
 net/ipv6/addrlabel.c         |  566 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 646 insertions(+), 31 deletions(-)

diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h
new file mode 100644
index 0000000..66978a5
--- /dev/null
+++ b/include/linux/if_addrlabel.h
@@ -0,0 +1,55 @@
+/*
+ * ifaddrlabel.h - netlink interface for address labels
+ *
+ * Copyright (C)2007 USAGI/WIDE Project,  All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the project nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#ifndef __LINUX_IF_ADDRLABEL_H
+#define __LINUX_IF_ADDRLABEL_H
+
+struct ifaddrlblmsg
+{
+	__u8		ifal_family;		/* Address family */
+	__u8		__ifal_reserved;	/* Reserved */
+	__u8		ifal_prefixlen;		/* Prefix length */
+	__u8		ifal_flags;		/* Flags */
+	__u32		ifal_index;		/* Link index */
+	__u32		ifal_seq;		/* sequence number */
+};
+
+enum
+{
+	IFAL_ADDRESS = 1,
+	IFAL_LABEL = 2,
+	__IFAL_MAX
+};
+
+#define IFAL_MAX	(__IFAL_MAX - 1)
+
+#endif
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 5bf6182..9a8bf01 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -100,6 +100,13 @@ enum {
 	RTM_NEWNDUSEROPT = 68,
 #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT
 
+	RTM_NEWADDRLABEL = 72,
+#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
+	RTM_DELADDRLABEL,
+#define RTM_NEWADDRLABEL RTM_NEWADDRLABEL
+	RTM_GETADDRLABEL,
+#define RTM_GETADDRLABEL RTM_GETADDRLABEL
+
 	__RTM_MAX,
 #define RTM_MAX		(((__RTM_MAX + 3) & ~3) - 1)
 };
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 33b593e..bccc2fe 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -84,6 +84,14 @@ extern void			addrconf_leave_solict(struct inet6_dev *idev,
 					struct in6_addr *addr);
 
 /*
+ *	IPv6 Address Label subsystem (addrlabel.c)
+ */
+extern int			ipv6_addr_label_init(void);
+extern void			ipv6_addr_label_rtnl_register(void);
+extern u32			ipv6_addr_label(const struct in6_addr *addr,
+						int type, int ifindex);
+
+/*
  *	multicast prototypes (mcast.c)
  */
 extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, 
diff --git a/net/ipv6/Makefile b/net/ipv6/Makefile
index 87c23a7..5ffa980 100644
--- a/net/ipv6/Makefile
+++ b/net/ipv6/Makefile
@@ -5,6 +5,7 @@
 obj-$(CONFIG_IPV6) += ipv6.o
 
 ipv6-objs :=	af_inet6.o anycast.o ip6_output.o ip6_input.o addrconf.o \
+		addrlabel.o \
 		route.o ip6_fib.o ipv6_sockglue.o ndisc.o udp.o udplite.o \
 		raw.o protocol.o icmp.o mcast.o reassembly.o tcp_ipv6.o \
 		exthdrs.o sysctl_net_ipv6.o datagram.o \
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 8b408b7..5b6553f 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -876,36 +876,6 @@ static inline int ipv6_saddr_preferred(int type)
 	return 0;
 }
 
-/* static matching label */
-static inline int ipv6_addr_label(const struct in6_addr *addr, int type,
-				  int ifindex)
-{
- /*
-  * 	prefix (longest match)	label
-  * 	-----------------------------
-  * 	::1/128			0
-  * 	::/0			1
-  * 	2002::/16		2
-  * 	::/96			3
-  * 	::ffff:0:0/96		4
-  *	fc00::/7		5
-  * 	2001::/32		6
-  */
-	if (type & IPV6_ADDR_LOOPBACK)
-		return 0;
-	else if (type & IPV6_ADDR_COMPATv4)
-		return 3;
-	else if (type & IPV6_ADDR_MAPPED)
-		return 4;
-	else if (addr->s6_addr32[0] == htonl(0x20010000))
-		return 6;
-	else if (addr->s6_addr16[0] == htons(0x2002))
-		return 2;
-	else if ((addr->s6_addr[0] & 0xfe) == 0xfc)
-		return 5;
-	return 1;
-}
-
 int ipv6_dev_get_saddr(struct net_device *daddr_dev,
 		       struct in6_addr *daddr, struct in6_addr *saddr)
 {
@@ -4182,7 +4152,13 @@ EXPORT_SYMBOL(unregister_inet6addr_notifier);
 
 int __init addrconf_init(void)
 {
-	int err = 0;
+	int err;
+
+	if ((err = ipv6_addr_label_init()) < 0) {
+		printk(KERN_CRIT "IPv6 Addrconf: cannot initialize default policy table: %d.\n",
+			err);
+		return err;
+	}
 
 	/* The addrconf netdev notifier requires that loopback_dev
 	 * has it's ipv6 private information allocated and setup
@@ -4233,6 +4209,8 @@ int __init addrconf_init(void)
 	__rtnl_register(PF_INET6, RTM_GETMULTICAST, NULL, inet6_dump_ifmcaddr);
 	__rtnl_register(PF_INET6, RTM_GETANYCAST, NULL, inet6_dump_ifacaddr);
 
+	ipv6_addr_label_rtnl_register();
+
 #ifdef CONFIG_SYSCTL
 	addrconf_sysctl.sysctl_header =
 		register_sysctl_table(addrconf_sysctl.addrconf_root_dir);
diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
new file mode 100644
index 0000000..719e785
--- /dev/null
+++ b/net/ipv6/addrlabel.c
@@ -0,0 +1,566 @@
+/*
+ * IPv6 Address Label subsystem
+ * for the IPv6 "Default" Source Address Selection
+ *
+ * Copyright (C)2007 USAGI/WIDE Project
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+/*
+ * Author:
+ * 	YOSHIFUJI Hideaki @ USAGI/WIDE Project <yoshfuji@linux-ipv6.org>
+ */
+
+#include <linux/kernel.h>
+#include <linux/list.h>
+#include <linux/rcupdate.h>
+#include <linux/in6.h>
+#include <net/addrconf.h>
+#include <linux/if_addrlabel.h>
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
+
+#if 0
+#define ADDRLABEL(x...) printk(x)
+#else
+#define ADDRLABEL(x...) do { ; } while(0)
+#endif
+
+/*
+ * Policy Table
+ */
+struct ip6addrlbl_entry
+{
+	struct in6_addr prefix;
+	int prefixlen;
+	int ifindex;
+	int addrtype;
+	u32 label;
+	struct hlist_node list;
+	atomic_t refcnt;
+	struct rcu_head rcu;
+};
+
+static struct ip6addrlbl_table
+{
+	struct hlist_head head;
+	spinlock_t lock;
+	u32 seq;
+} ip6addrlbl_table;
+
+/*
+ * Default policy table (RFC3484 + extensions)
+ *
+ * prefix		addr_type	label
+ * -------------------------------------------------------------------------
+ * ::1/128		LOOPBACK	0
+ * ::/0			N/A		1
+ * 2002::/16		N/A		2
+ * ::/96		COMPATv4	3
+ * ::ffff:0:0/96	V4MAPPED	4
+ * fc00::/7		N/A		5		ULA (RFC 4193)
+ * 2001::/32		N/A		6		Teredo (RFC 4380)
+ *
+ * Note: 0xffffffff is used if we do not have any policies.
+ */
+
+#define IPV6_ADDR_LABEL_DEFAULT	0xffffffffUL
+
+static const __initdata struct ip6addrlbl_init_table
+{
+	const struct in6_addr *prefix;
+	int prefixlen;
+	u32 label;
+} ip6addrlbl_init_table[] = {
+	{	/* ::/0 */
+		.prefix = &in6addr_any,
+		.label = 1,
+	},{	/* fc00::/7 */
+		.prefix = &(struct in6_addr){{{ 0xfc }}},
+		.prefixlen = 7,
+		.label = 5,
+	},{	/* 2002::/16 */
+		.prefix = &(struct in6_addr){{{ 0x20, 0x02 }}},
+		.prefixlen = 16,
+		.label = 2,
+	},{	/* 2001::/32 */
+		.prefix = &(struct in6_addr){{{ 0x20, 0x01 }}},
+		.prefixlen = 32,
+		.label = 6,
+	},{	/* ::ffff:0:0 */
+		.prefix = &(struct in6_addr){{{ [10] = 0xff, [11] = 0xff }}},
+		.prefixlen = 96,
+		.label = 4,
+	},{	/* ::/96 */
+		.prefix = &in6addr_any,
+		.prefixlen = 96,
+		.label = 3,
+	},{	/* ::1/128 */
+		.prefix = &in6addr_loopback,
+		.prefixlen = 128,
+		.label = 0,
+	}
+};
+
+/* Object management */
+static inline void ip6addrlbl_free(struct ip6addrlbl_entry *p)
+{
+	kfree(p);
+}
+
+static inline int ip6addrlbl_hold(struct ip6addrlbl_entry *p)
+{
+	return atomic_inc_not_zero(&p->refcnt);
+}
+
+static inline void ip6addrlbl_put(struct ip6addrlbl_entry *p)
+{
+	if (atomic_dec_and_test(&p->refcnt))
+		ip6addrlbl_free(p);
+}
+
+static void ip6addrlbl_free_rcu(struct rcu_head *h)
+{
+	ip6addrlbl_free(container_of(h, struct ip6addrlbl_entry, rcu));
+}
+
+/* Find label */
+static int __ip6addrlbl_match(struct ip6addrlbl_entry *p,
+			      const struct in6_addr *addr,
+			      int addrtype, int ifindex)
+{
+	if (p->ifindex && p->ifindex != ifindex)
+		return 0;
+	if (p->addrtype && p->addrtype != addrtype)
+		return 0;
+	if (!ipv6_prefix_equal(addr, &p->prefix, p->prefixlen))
+		return 0;
+	return 1;
+}
+
+static struct ip6addrlbl_entry *__ipv6_addr_label(const struct in6_addr *addr,
+						  int type, int ifindex)
+{
+	struct hlist_node *pos;
+	struct ip6addrlbl_entry *p;
+	hlist_for_each_entry_rcu(p, pos, &ip6addrlbl_table.head, list) {
+		if (__ip6addrlbl_match(p, addr, type, ifindex))
+			return p;
+	}
+	return NULL;
+}
+
+u32 ipv6_addr_label(const struct in6_addr *addr, int type, int ifindex)
+{
+	u32 label;
+	struct ip6addrlbl_entry *p;
+
+	type &= IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK;
+
+	rcu_read_lock();
+	p = __ipv6_addr_label(addr, type, ifindex);
+	label = p ? p->label : IPV6_ADDR_LABEL_DEFAULT;
+	rcu_read_unlock();
+
+	ADDRLABEL(KERN_DEBUG "%s(addr=" NIP6_FMT ", type=%d, ifindex=%d) => %08x\n",
+			__FUNCTION__,
+			NIP6(*addr), type, ifindex,
+			label);
+
+	return label;
+}
+
+/* allocate one entry */
+struct ip6addrlbl_entry *ip6addrlbl_alloc(const struct in6_addr *prefix,
+					  int prefixlen, int ifindex,
+					  u32 label)
+{
+	struct ip6addrlbl_entry *newp;
+	int addrtype;
+
+	ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u)\n",
+			__FUNCTION__,
+			NIP6(*prefix), prefixlen,
+			ifindex,
+			(unsigned int)label);
+
+	addrtype = ipv6_addr_type(prefix) & (IPV6_ADDR_MAPPED | IPV6_ADDR_COMPATv4 | IPV6_ADDR_LOOPBACK);
+
+	switch (addrtype) {
+	case IPV6_ADDR_MAPPED:
+		if (prefixlen > 96)
+			return ERR_PTR(-EINVAL);
+		if (prefixlen < 96)
+			addrtype = 0;
+		break;
+	case IPV6_ADDR_COMPATv4:
+		if (prefixlen != 96)
+			addrtype = 0;
+		break;
+	case IPV6_ADDR_LOOPBACK:
+		if (prefixlen != 128)
+			addrtype = 0;
+		break;
+	}
+
+	newp = kmalloc(sizeof(*newp), GFP_KERNEL);
+	if (!newp)
+		return ERR_PTR(-ENOMEM);
+
+	ipv6_addr_prefix(&newp->prefix, prefix, prefixlen);
+	newp->prefixlen = prefixlen;
+	newp->ifindex = ifindex;
+	newp->addrtype = addrtype;
+	newp->label = label;
+	INIT_HLIST_NODE(&newp->list);
+	atomic_set(&newp->refcnt, 1);
+	return newp;
+}
+
+/* add a label */
+int __ip6addrlbl_add(struct ip6addrlbl_entry *newp, int replace)
+{
+	int ret = 0;
+
+	ADDRLABEL(KERN_DEBUG "%s(newp=%p, replace=%d)\n",
+			__FUNCTION__,
+			newp, replace);
+
+	if (hlist_empty(&ip6addrlbl_table.head)) {
+		hlist_add_head_rcu(&newp->list, &ip6addrlbl_table.head);
+	} else {
+		struct hlist_node *pos, *n;
+		struct ip6addrlbl_entry *p = NULL;
+		hlist_for_each_entry_safe(p, pos, n,
+					  &ip6addrlbl_table.head, list) {
+			if (p->prefixlen == newp->prefixlen &&
+			    p->ifindex == newp->ifindex &&
+			    ipv6_addr_equal(&p->prefix, &newp->prefix)) {
+				if (!replace) {
+					ret = -EEXIST;
+					goto out;
+				}
+				hlist_replace_rcu(&p->list, &newp->list);
+				ip6addrlbl_put(p);
+				call_rcu(&p->rcu, ip6addrlbl_free_rcu);
+				goto out;
+			} else if ((p->prefixlen == newp->prefixlen && !p->ifindex) ||
+				   (p->prefixlen < newp->prefixlen)) {
+				hlist_add_before_rcu(&newp->list, &p->list);
+				goto out;
+			}
+		}
+		hlist_add_after_rcu(&p->list, &newp->list);
+	}
+out:
+	if (!ret)
+		ip6addrlbl_table.seq++;
+	return ret;
+}
+
+/* add a label */
+int ip6addrlbl_add(const struct in6_addr *prefix, int prefixlen,
+		       int ifindex, u32 label, int replace)
+{
+	struct ip6addrlbl_entry *newp;
+	int ret = 0;
+
+	ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d, label=%u, replace=%d)\n",
+			__FUNCTION__,
+			NIP6(*prefix), prefixlen,
+			ifindex,
+			(unsigned int)label,
+			replace);
+
+	newp = ip6addrlbl_alloc(prefix, prefixlen, ifindex, label);
+	if (IS_ERR(newp))
+		return PTR_ERR(newp);
+	spin_lock(&ip6addrlbl_table.lock);
+	ret = __ip6addrlbl_add(newp, replace);
+	spin_unlock(&ip6addrlbl_table.lock);
+	if (ret)
+		ip6addrlbl_free(newp);
+	return ret;
+}
+
+/* remove a label */
+int __ip6addrlbl_del(const struct in6_addr *prefix, int prefixlen,
+			  int ifindex)
+{
+	struct ip6addrlbl_entry *p = NULL;
+	struct hlist_node *pos, *n;
+	int ret = -ESRCH;
+
+	ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n",
+			__FUNCTION__,
+			NIP6(*prefix), prefixlen,
+			ifindex);
+
+	hlist_for_each_entry_safe(p, pos, n, &ip6addrlbl_table.head, list) {
+		if (p->prefixlen == prefixlen &&
+		    p->ifindex == ifindex &&
+		    ipv6_addr_equal(&p->prefix, prefix)) {
+			hlist_del_rcu(&p->list);
+			ip6addrlbl_put(p);
+			call_rcu(&p->rcu, ip6addrlbl_free_rcu);
+			ret = 0;
+			break;
+		}
+	}
+	return ret;
+}
+
+int ip6addrlbl_del(const struct in6_addr *prefix, int prefixlen,
+		       int ifindex)
+{
+	struct in6_addr prefix_buf;
+	int ret;
+
+	ADDRLABEL(KERN_DEBUG "%s(prefix=" NIP6_FMT ", prefixlen=%d, ifindex=%d)\n",
+			__FUNCTION__,
+			NIP6(*prefix), prefixlen,
+			ifindex);
+
+	ipv6_addr_prefix(&prefix_buf, prefix, prefixlen);
+	spin_lock(&ip6addrlbl_table.lock);
+	ret = __ip6addrlbl_del(&prefix_buf, prefixlen, ifindex);
+	spin_unlock(&ip6addrlbl_table.lock);
+	return ret;
+}
+
+/* add default label */
+static __init int ip6addrlbl_init(void)
+{
+	int err = 0;
+	int i;
+
+	ADDRLABEL(KERN_DEBUG "%s()\n", __FUNCTION__);
+
+	for (i = 0; i < ARRAY_SIZE(ip6addrlbl_init_table); i++) {
+		int ret = ip6addrlbl_add(ip6addrlbl_init_table[i].prefix,
+					 ip6addrlbl_init_table[i].prefixlen,
+					 0,
+					 ip6addrlbl_init_table[i].label, 0);
+		/* XXX: should we free all rules when we catch an error? */
+		if (ret && (!err || err != -ENOMEM))
+			err = ret;
+	}
+	return err;
+}
+
+int __init ipv6_addr_label_init(void)
+{
+	spin_lock_init(&ip6addrlbl_table.lock);
+
+	return ip6addrlbl_init();
+}
+
+static const struct nla_policy ifal_policy[IFAL_MAX+1] = {
+	[IFAL_ADDRESS]		= { .len = sizeof(struct in6_addr), },
+	[IFAL_LABEL]		= { .len = sizeof(u32), },
+};
+
+static int ip6addrlbl_newdel(struct sk_buff *skb, struct nlmsghdr *nlh,
+			     void *arg)
+{
+	struct ifaddrlblmsg *ifal;
+	struct nlattr *tb[IFAL_MAX+1];
+	struct in6_addr *pfx;
+	u32 label;
+	int err = 0;
+
+	err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy);
+	if (err < 0)
+		return err;
+
+	ifal = nlmsg_data(nlh);
+
+	if (ifal->ifal_family != AF_INET6 ||
+	    ifal->ifal_prefixlen > 128)
+		return -EINVAL;
+
+	if (ifal->ifal_index &&
+	    !__dev_get_by_index(&init_net, ifal->ifal_index))
+		return -EINVAL;
+
+	if (!tb[IFAL_ADDRESS])
+		return -EINVAL;
+
+	pfx = nla_data(tb[IFAL_ADDRESS]);
+	if (!pfx)
+		return -EINVAL;
+
+	if (!tb[IFAL_LABEL])
+		return -EINVAL;
+	label = nla_get_u32(tb[IFAL_LABEL]);
+	if (label == IPV6_ADDR_LABEL_DEFAULT)
+		return -EINVAL;
+
+	switch(nlh->nlmsg_type) {
+	case RTM_NEWADDRLABEL:
+		err = ip6addrlbl_add(pfx, ifal->ifal_prefixlen,
+				     ifal->ifal_index, label,
+				     nlh->nlmsg_flags & NLM_F_REPLACE);
+		break;
+	case RTM_DELADDRLABEL:
+		err = ip6addrlbl_del(pfx, ifal->ifal_prefixlen,
+				     ifal->ifal_index);
+		break;
+	default:
+		err = -EOPNOTSUPP;
+	}
+	return err;
+}
+
+static inline void ip6addrlbl_putmsg(struct nlmsghdr *nlh,
+				     int prefixlen, int ifindex, u32 lseq)
+{
+	struct ifaddrlblmsg *ifal = nlmsg_data(nlh);
+	ifal->ifal_family = AF_INET6;
+	ifal->ifal_prefixlen = prefixlen;
+	ifal->ifal_flags = 0;
+	ifal->ifal_index = ifindex;
+	ifal->ifal_seq = lseq;
+};
+
+static int ip6addrlbl_fill(struct sk_buff *skb,
+			   struct ip6addrlbl_entry *p,
+			   u32 lseq,
+			   u32 pid, u32 seq, int event,
+			   unsigned int flags)
+{
+	struct nlmsghdr *nlh = nlmsg_put(skb, pid, seq, event,
+					 sizeof(struct ifaddrlblmsg), flags);
+	if (!nlh)
+		return -EMSGSIZE;
+
+	ip6addrlbl_putmsg(nlh, p->prefixlen, p->ifindex, lseq);
+
+	if (nla_put(skb, IFAL_ADDRESS, 16, &p->prefix) < 0 ||
+	    nla_put_u32(skb, IFAL_LABEL, p->label) < 0) {
+		nlmsg_cancel(skb, nlh);
+		return -EMSGSIZE;
+	}
+
+	return nlmsg_end(skb, nlh);
+}
+
+static int ip6addrlbl_dump(struct sk_buff *skb, struct netlink_callback *cb)
+{
+	struct ip6addrlbl_entry *p;
+	struct hlist_node *pos;
+	int idx = 0, s_idx = cb->args[0];
+	int err;
+
+	rcu_read_lock();
+	hlist_for_each_entry_rcu(p, pos, &ip6addrlbl_table.head, list) {
+		if (idx >= s_idx) {
+			if ((err = ip6addrlbl_fill(skb, p,
+						   ip6addrlbl_table.seq,
+						   NETLINK_CB(cb->skb).pid,
+						   cb->nlh->nlmsg_seq,
+						   RTM_NEWADDRLABEL,
+						   NLM_F_MULTI)) <= 0)
+				break;
+		}
+		idx++;
+	}
+	rcu_read_unlock();
+	cb->args[0] = idx;
+	return skb->len;
+}
+
+static inline int ip6addrlbl_msgsize(void)
+{
+	return (NLMSG_ALIGN(sizeof(struct ifaddrlblmsg))
+		+ nla_total_size(16)	/* IFAL_ADDRESS */
+		+ nla_total_size(4)	/* IFAL_LABEL */
+	);
+}
+
+static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh,
+			  void *arg)
+{
+	struct ifaddrlblmsg *ifal;
+	struct nlattr *tb[IFAL_MAX+1];
+	struct in6_addr *addr;
+	u32 lseq;
+	int err = 0;
+	struct ip6addrlbl_entry *p;
+	struct sk_buff *skb;
+
+	err = nlmsg_parse(nlh, sizeof(*ifal), tb, IFAL_MAX, ifal_policy);
+	if (err < 0)
+		return err;
+
+	ifal = nlmsg_data(nlh);
+
+	if (ifal->ifal_family != AF_INET6 ||
+	    ifal->ifal_prefixlen != 128)
+		return -EINVAL;
+
+	if (ifal->ifal_index &&
+	    !__dev_get_by_index(&init_net, ifal->ifal_index))
+		return -EINVAL;
+
+	if (!tb[IFAL_ADDRESS])
+		return -EINVAL;
+
+	addr = nla_data(tb[IFAL_ADDRESS]);
+	if (!addr)
+		return -EINVAL;
+
+	rcu_read_lock();
+	p = __ipv6_addr_label(addr, ipv6_addr_type(addr), ifal->ifal_index);
+	if (p && ip6addrlbl_hold(p))
+		p = NULL;
+	lseq = ip6addrlbl_table.seq;
+	rcu_read_unlock();
+
+	if (!p) {
+		err = -ESRCH;
+		goto out;
+	}
+
+	if (!(skb = nlmsg_new(ip6addrlbl_msgsize(), GFP_KERNEL))) {
+		ip6addrlbl_put(p);
+		return -ENOBUFS;
+	}
+
+	err = ip6addrlbl_fill(skb, p, lseq,
+			      NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
+			      RTM_NEWADDRLABEL, 0);
+
+	ip6addrlbl_put(p);
+
+	if (err < 0) {
+		WARN_ON(err == -EMSGSIZE);
+		kfree_skb(skb);
+		goto out;
+	}
+
+	err = rtnl_unicast(skb, NETLINK_CB(in_skb).pid);
+out:
+	return err;
+}
+
+void __init addrlabel_rtnl_register(void)
+{
+	__rtnl_register(PF_INET6, RTM_NEWADDRLABEL, ip6addrlbl_newdel, NULL);
+	__rtnl_register(PF_INET6, RTM_DELADDRLABEL, ip6addrlbl_newdel, NULL);
+	__rtnl_register(PF_INET6, RTM_GETADDRLABEL, ip6addrlbl_get, ip6addrlbl_dump);
+}
+
-- 
1.4.4.4


^ permalink raw reply related

* Re: [RFC 2/2] [IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.
From: David Miller @ 2007-10-30  7:40 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev
In-Reply-To: <20071030.145254.120595012.yoshfuji@linux-ipv6.org>

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Tue, 30 Oct 2007 14:52:54 +0900 (JST)

> diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h
> new file mode 100644
> index 0000000..66978a5
> --- /dev/null
> +++ b/include/linux/if_addrlabel.h
> @@ -0,0 +1,55 @@
> +/*
> + * ifaddrlabel.h - netlink interface for address labels
> + *
> + * Copyright (C)2007 USAGI/WIDE Project,  All Rights Reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:

Please, this is just a very primitive header file definiting a
simplistic struct and a few enumerations.  Can't you just GPL it with
just the USAGI/WIDE copyright line, instead of using this complicated
license text?

If it important for the USAGI Project to take credit for this work,
they will receive it fully in the copyright line and the changelog
entry.

Thank you.

^ permalink raw reply

* Re: [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
From: David Miller @ 2007-10-30  7:42 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev
In-Reply-To: <20071030.145237.68878443.yoshfuji@linux-ipv6.org>

From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
Date: Tue, 30 Oct 2007 14:52:37 +0900 (JST)

> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>

What is the substance of this change?  Please add a description of
this to the changelog entry as currently the description is far too
brief and vague.

Even saying simply that the change allows the interface index
to be passed into the address selection routines would be
a great improvement.

Thank you.

^ permalink raw reply

* Re: [PATCH] pegasos_eth.c: Fix compile error over MV643XX_ defines
From: Luis R. Rodriguez @ 2007-10-30  7:44 UTC (permalink / raw)
  To: Dale Farnsworth
  Cc: netdev, linuxppc-dev, Jeff Garzik, Lennert Buytenhek,
	Tzachi Perelstein
In-Reply-To: <20071029223900.GA7097@xyzzy.farnsworth.org>

On 10/29/07, Dale Farnsworth <dale@farnsworth.org> wrote:
> On Mon, Oct 29, 2007 at 05:27:29PM -0400, Luis R. Rodriguez wrote:
> > This commit made an incorrect assumption:
> > --
> > Author: Lennert Buytenhek <buytenh@wantstofly.org>
> >  Date:   Fri Oct 19 04:10:10 2007 +0200
> >
> >     mv643xx_eth: Move ethernet register definitions into private header
> >
> >     Move the mv643xx's ethernet-related register definitions from
> >     include/linux/mv643xx.h into drivers/net/mv643xx_eth.h, since
> >     they aren't of any use outside the ethernet driver.
> >
> >     Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
> >     Acked-by: Tzachi Perelstein <tzachi@marvell.com>
> >     Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > --
> >
> > arch/powerpc/platforms/chrp/pegasos_eth.c made use of a 3 defines there.
> >
> > mcgrof@pogo:~/devel/wireless-2.6$ git-describe
> >
> > v2.6.24-rc1-138-g0119130
> >
> > This patch fixes this by internalizing 3 defines onto pegasos which are
> > simply no longer available elsewhere. Without this your compile will fail
>
> That compile failure was fixed in commit
> 30e69bf4cce16d4c2dcfd629a60fcd8e1aba9fee by Al Viro.
>
> However, as I examine that commit, I see that it defines offsets from
> the eth block in the chip, rather than the full chip registeri block
> as the Pegasos 2 code expects.  So, I think it fixes the compile
> failure, but leaves the Pegasos 2 broken.
>
> Luis, do you have Pegasos 2 hardware?  Can you (or anyone) verify that
> the following patch is needed for the Pegasos 2?

Nope, sorry.

  Luis

^ permalink raw reply

* Re: [PATCH] rpc_rdma: we need to cast u64 to unsigned long long for printing
From: David Miller @ 2007-10-30  7:44 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-kernel
In-Reply-To: <20071030161240.bc81cad3.sfr@canb.auug.org.au>

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 30 Oct 2007 16:12:40 +1100

> as some architectures have unsigned long for u64.
> 
> net/sunrpc/xprtrdma/rpc_rdma.c: In function 'rpcrdma_create_chunks':
> net/sunrpc/xprtrdma/rpc_rdma.c:222: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
> net/sunrpc/xprtrdma/rpc_rdma.c:234: warning: format '%llx' expects type 'long long unsigned int', but argument 5 has type 'u64'
> net/sunrpc/xprtrdma/rpc_rdma.c: In function 'rpcrdma_count_chunks':
> net/sunrpc/xprtrdma/rpc_rdma.c:577: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64
> 
> Noticed on PowerPC pseries_defconfig build.
> 
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>

I've applied this, thanks Stephen.

^ permalink raw reply

* Re: [PATCH] net: Saner thash_entries default with much memory
From: David Miller @ 2007-10-30  7:57 UTC (permalink / raw)
  To: ak; +Cc: jdelvare, netdev
In-Reply-To: <20071026153416.GA23491@bingen.suse.de>

From: Andi Kleen <ak@suse.de>
Date: Fri, 26 Oct 2007 17:34:17 +0200

> On Fri, Oct 26, 2007 at 05:21:31PM +0200, Jean Delvare wrote:
> > I propose 2 millions of entries as the arbitrary high limit. This
> 
> It's probably still far too large.

I agree.  Perhaps a better number is something on the order of
(512 * 1024) so I think I'll check in a variant of Jean's patch
with just the limit decreased like that.

Using just some back of the envelope calculations, on UP 64-bit
systems each socket uses about 2424 bytes minimum of memory (this is
the sum of tcp_sock, inode, dentry, socket, and file on sparc64 UP).
This is an underestimate because it does not even consider things like
allocator overhead.

Next, machines that service that many sockets typically have them
mostly with full transmit queues talking to a very slow receiver at
the other end.  So let's estimate that on average each socket consumes
about 64K of retransmit queue data.

I think this is an extremely conservative estimate beause it doesn't
even consider overhead coming from struct sk_buff and related state.

So for (512 * 1024) of established sockets we consume roughly 35GB of
memory, this is '((2424 + (64 * 1024)) * (512 * 1024))'.

So to me (512 * 1024) is a very reasonable limit and (with lockdep
and spinlock debugging disabled) this makes the EHASH table consume
8MB on UP 64-bit and ~12MB on SMP 64-bit systems.

Thanks.

^ permalink raw reply

* Re: dn_route.c momentarily exiting RCU read-side critical section
From: David Miller @ 2007-10-30  8:10 UTC (permalink / raw)
  To: paulmck; +Cc: linux-kernel, netdev, SteveW, dipankar
In-Reply-To: <20071029211540.GA12893@linux.vnet.ibm.com>

From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Date: Mon, 29 Oct 2007 14:15:40 -0700

> net/decnet/dn_route.c in dn_rt_cache_get_next() is as follows:
> 
> static struct dn_route *dn_rt_cache_get_next(struct seq_file *seq, struct dn_route *rt)
> {
> 	struct dn_rt_cache_iter_state *s = rcu_dereference(seq->private);
> 
> 	rt = rt->u.dst.dn_next;
> 	while(!rt) {
> 		rcu_read_unlock_bh();
> 		if (--s->bucket < 0)
> 			break;
> 
> ...  But what happens if seq->private is freed up right here?
> ...  Or what prevents this from happening?
 ...
> Similar code is in rt_cache_get_next().
> 
> So, what am I missing here?

seq->private is allocated on file open (here via seq_open_private()),
and freed up on file close (via seq_release_private).

So it cannot be freed up in the middle of an iteration.


^ permalink raw reply

* Re: [PATCH] [IPv4] SNMP: Refer correct memory location to display ICMP out-going statistics
From: David Miller @ 2007-10-30  8:12 UTC (permalink / raw)
  To: dlstevens; +Cc: davem, netdev
In-Reply-To: <OF3783F25C.645FCABB-ON88257383.00729813-88257383.0072C869@us.ibm.com>

From: David Stevens <dlstevens@us.ibm.com>
Date: Mon, 29 Oct 2007 13:54:50 -0700

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

It's in my tree now, never fear :-)

^ permalink raw reply

* Re: [Bugme-new] [Bug 9260] New: tipc_config.h is not installed when doing "make headers_install"
From: David Miller @ 2007-10-30  8:20 UTC (permalink / raw)
  To: akpm; +Cc: netdev, bugme-daemon, linux
In-Reply-To: <20071029120716.4957ded1.akpm@linux-foundation.org>

From: Andrew Morton <akpm@linux-foundation.org>
Date: Mon, 29 Oct 2007 12:07:16 -0700

> On Mon, 29 Oct 2007 09:10:26 -0700 (PDT)
> bugme-daemon@bugzilla.kernel.org wrote:
> 
> > http://bugzilla.kernel.org/show_bug.cgi?id=9260
 ...
> > Problem Description:
> > When doing "make headers_install" the file tipc_config.h is not installed. It
> > describes the interface to configure the TIPC module and it is needed when
> > building the config utility (tipc-config). 
> > Adding the following line to include/linux/Kbuild solves this:
> > header-y += tipc_config.h
> > 

Fair enough, I'll commit the following and submit to
-stable as well.

>From 502ef38da15d817f8e67acefc12dc2212f7f8aa1 Mon Sep 17 00:00:00 2001
From: David S. Miller <davem@sunset.davemloft.net>
Date: Tue, 30 Oct 2007 01:19:19 -0700
Subject: [PATCH] [TIPC]: Add tipc_config.h to include/linux/Kbuild.

Needed, as reported in:

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

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/Kbuild |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 6a65231..bd33c22 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -149,6 +149,7 @@ header-y += ticable.h
 header-y += times.h
 header-y += tiocl.h
 header-y += tipc.h
+header-y += tipc_config.h
 header-y += toshiba.h
 header-y += ultrasound.h
 header-y += un.h
-- 
1.5.2.5


^ permalink raw reply related

* Re: [PATCH][RFC] Add support for the RDC R6040 Fast Ethernet controller
From: Ilpo Järvinen @ 2007-10-30  8:29 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: netdev
In-Reply-To: <200710292251.43257.florian.fainelli@telecomint.eu>

On Mon, 29 Oct 2007, Florian Fainelli wrote:

> +static int  mdio_read(struct net_device *dev, int phy_id, int location);
> +static void mdio_write(struct net_device *dev, int phy_id, int location, int value);
> +static int r6040_open(struct net_device *dev);
> +static int r6040_start_xmit(struct sk_buff *skb, struct net_device *dev);
> +static irqreturn_t r6040_interrupt(int irq, void *dev_id);
> +static int r6040_close(struct net_device *dev);
> +static void set_multicast_list(struct net_device *dev);
> +static struct ethtool_ops netdev_ethtool_ops;
> +static int r6040_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
> +static void r6040_down(struct net_device *dev);
> +static void r6040_up(struct net_device *dev);
> +static void r6040_tx_timeout(struct net_device *dev);
> +static void r6040_timer(unsigned long);
> +static void r6040_mac_address(struct net_device *dev);
> +
> +static int phy_mode_chk(struct net_device *dev);
> +static int phy_read(int ioaddr, int phy_adr, int reg_idx);
> +static void phy_write(int ioaddr, int phy_adr, int reg_idx, int dat);
> +static void rx_buf_alloc(struct r6040_private *lp, struct net_device *dev);
> +#ifdef CONFIG_R6040_NAPI
> +static int r6040_poll(struct napi_struct *napi, int budget);
> +#endif
> +

...Most of those forward declarations can go if the functions are ordered 
properly. One can trivially notice that the mdio_{read,write} are 
unnecessary already:

> +static int mdio_read(struct net_device *dev, int phy_id, int regnum)
> +{
> +	struct r6040_private *lp = netdev_priv(dev);
> +	long ioaddr = dev->base_addr;
> +	return  (phy_read(ioaddr, lp->phy_addr, regnum)) ;
> +}
> +
> +static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value)
> +{
> +	struct r6040_private *lp = netdev_priv(dev);
> +	long ioaddr = dev->base_addr;
> +
> +	phy_write(ioaddr, lp->phy_addr, regnum, value);
> +}


-- 
 i.

^ permalink raw reply

* Re: kernel panic removing devices from a teql queuing discipline
From: David Miller @ 2007-10-30  8:33 UTC (permalink / raw)
  To: cebbert; +Cc: netdev
In-Reply-To: <47261FA1.10300@redhat.com>

From: Chuck Ebbert <cebbert@redhat.com>
Date: Mon, 29 Oct 2007 14:00:01 -0400

> The panic is in __teql_resolve (which has been inlined into teql_master_xmit) in
> net/sched/sch_teql.c at this line:
> 
> 	if (n && n->tbl == mn->tbl &&
> 
> Specifically the dereference of n->tbl is faulting as n is not valid.
> 
> And the address looks like part of an ASCCI string...  "figt"

I studied sch_teql.c a bit and I suspect that the slave list
management in teql_destroy() and teql_qdisc_init() might be
suspect.

If someone can take a closer look at this, I'd appreciate it.

^ permalink raw reply

* Re: [PATCH] ehea: add kexec support
From: Christoph Raisch @ 2007-10-30  8:39 UTC (permalink / raw)
  To: michael
  Cc: Jan-Bernd Themann, Jeff Garzik, linux-kernel, linux-ppc,
	Marcus Eder, netdev, ossthema, Stefan Roscher, Thomas Q Klein
In-Reply-To: <1193610737.9637.1.camel@concordia>



Michael Ellerman <michael@ellerman.id.au> wrote on 28.10.2007 23:32:17:
>
>
> How do you plan to support kdump?
>

When kexec is fully supported kdump should work out of the box
as for any other ethernet card (if you load the right eth driver).
There's nothing specific to kdump you have to handle in
ethernet device drivers.
Hope I didn't miss anything here...

Gruss / Regards
Christoph R


^ permalink raw reply

* Re: [RFC 1/2] [IPV6] ADDRCONF: Preparation for configurable address selection policy with ifindex.
From: Krishna Kumar2 @ 2007-10-30  8:04 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / 吉藤英明; +Cc: netdev
In-Reply-To: <20071030.145237.68878443.yoshfuji@linux-ipv6.org>

Hi Yoshifuji,

YOSHIFUJI Hideaki wrote on 10/30/2007 11:22:37 AM:

> -static inline int ipv6_saddr_label(const struct in6_addr *addr, int
type)
> +static inline int ipv6_addr_label(const struct in6_addr *addr, int type,
> +                                                int ifindex)

This function doesn't use this new argument passed to it. Did you perhaps
intend to use it to
initializing daddr_index?

> +   int daddr_ifindex = daddr_dev ? daddr_dev->ifindex : 0;

Thanks,

- KK


^ permalink raw reply

* [PATCH 1/1] Blackfin EMAC driver: Fix Ethernet communication bug (dupliated and lost packets)
From: Bryan Wu @ 2007-10-30  9:04 UTC (permalink / raw)
  To: jeff, netdev; +Cc: linux-kernel, Michael Hennerich, Bryan Wu

From: Michael Hennerich <michael.hennerich@analog.com>

Fix Ethernet communication bug(dupliated and lost packets)
in RMII PHY mode- dont call mac_disable and mac_enable during
10/100 REFCLK changes - mac_enable screws up the DMA descriptor chain

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
 drivers/net/bfin_mac.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index 53fe7de..084acfd 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -371,7 +371,6 @@ static void bf537_adjust_link(struct net_device *dev)
 		if (phydev->speed != lp->old_speed) {
 #if defined(CONFIG_BFIN_MAC_RMII)
 			u32 opmode = bfin_read_EMAC_OPMODE();
-			bf537mac_disable();
 			switch (phydev->speed) {
 			case 10:
 				opmode |= RMII_10;
@@ -386,7 +385,6 @@ static void bf537_adjust_link(struct net_device *dev)
 				break;
 			}
 			bfin_write_EMAC_OPMODE(opmode);
-			bf537mac_enable();
 #endif
 
 			new_state = 1;
-- 
1.5.3.4

^ permalink raw reply related

* Re: [PATCH 1/2] [CRYPTO] tcrypt: Move sg_init_table out of timing loops
From: Jens Axboe @ 2007-10-30  9:32 UTC (permalink / raw)
  To: Boaz Harrosh
  Cc: Herbert Xu, David S. Miller, Linux Kernel Mailing List,
	Linux Crypto Mailing List, netdev
In-Reply-To: <4726FA01.2030002@panasas.com>

On Tue, Oct 30 2007, Boaz Harrosh wrote:
> On Mon, Oct 29 2007 at 22:16 +0200, Jens Axboe <jens.axboe@oracle.com> wrote:
> > On Fri, Oct 26 2007, Herbert Xu wrote:
> >> [CRYPTO] tcrypt: Move sg_init_table out of timing loops
> >>
> >> This patch moves the sg_init_table out of the timing loops for hash
> >> algorithms so that it doesn't impact on the speed test results.
> > 
> > Wouldn't it be better to just make sg_init_one() call sg_init_table?
> > 
> > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> > index 4571231..ccc55a6 100644
> > --- a/include/linux/scatterlist.h
> > +++ b/include/linux/scatterlist.h
> > @@ -202,28 +202,6 @@ static inline void __sg_mark_end(struct scatterlist *sg)
> >  }
> >  
> >  /**
> > - * sg_init_one - Initialize a single entry sg list
> > - * @sg:		 SG entry
> > - * @buf:	 Virtual address for IO
> > - * @buflen:	 IO length
> > - *
> > - * Notes:
> > - *   This should not be used on a single entry that is part of a larger
> > - *   table. Use sg_init_table() for that.
> > - *
> > - **/
> > -static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> > -			       unsigned int buflen)
> > -{
> > -	memset(sg, 0, sizeof(*sg));
> > -#ifdef CONFIG_DEBUG_SG
> > -	sg->sg_magic = SG_MAGIC;
> > -#endif
> > -	sg_mark_end(sg, 1);
> > -	sg_set_buf(sg, buf, buflen);
> > -}
> > -
> > -/**
> >   * sg_init_table - Initialize SG table
> >   * @sgl:	   The SG table
> >   * @nents:	   Number of entries in table
> > @@ -247,6 +225,24 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
> >  }
> >  
> >  /**
> > + * sg_init_one - Initialize a single entry sg list
> > + * @sg:		 SG entry
> > + * @buf:	 Virtual address for IO
> > + * @buflen:	 IO length
> > + *
> > + * Notes:
> > + *   This should not be used on a single entry that is part of a larger
> > + *   table. Use sg_init_table() for that.
> > + *
> > + **/
> > +static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> > +			       unsigned int buflen)
> > +{
> > +	sg_init_table(sg, 1);
> > +	sg_set_buf(sg, buf, buflen);
> > +}
> > +
> > +/**
> >   * sg_phys - Return physical address of an sg entry
> >   * @sg:	     SG entry
> >   *
> > 
> Yes please submit this patch. scsi-ml is full of sg_init_one, specially
> on the error recovery path.

Will do.

-- 
Jens Axboe

^ permalink raw reply

* Re: [PATCH 1/2] [CRYPTO] tcrypt: Move sg_init_table out of timing loops
From: Boaz Harrosh @ 2007-10-30  9:31 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Herbert Xu, David S. Miller, Linux Kernel Mailing List,
	Linux Crypto Mailing List, netdev
In-Reply-To: <20071029201627.GD7499@kernel.dk>

On Mon, Oct 29 2007 at 22:16 +0200, Jens Axboe <jens.axboe@oracle.com> wrote:
> On Fri, Oct 26 2007, Herbert Xu wrote:
>> [CRYPTO] tcrypt: Move sg_init_table out of timing loops
>>
>> This patch moves the sg_init_table out of the timing loops for hash
>> algorithms so that it doesn't impact on the speed test results.
> 
> Wouldn't it be better to just make sg_init_one() call sg_init_table?
> 
> diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
> index 4571231..ccc55a6 100644
> --- a/include/linux/scatterlist.h
> +++ b/include/linux/scatterlist.h
> @@ -202,28 +202,6 @@ static inline void __sg_mark_end(struct scatterlist *sg)
>  }
>  
>  /**
> - * sg_init_one - Initialize a single entry sg list
> - * @sg:		 SG entry
> - * @buf:	 Virtual address for IO
> - * @buflen:	 IO length
> - *
> - * Notes:
> - *   This should not be used on a single entry that is part of a larger
> - *   table. Use sg_init_table() for that.
> - *
> - **/
> -static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> -			       unsigned int buflen)
> -{
> -	memset(sg, 0, sizeof(*sg));
> -#ifdef CONFIG_DEBUG_SG
> -	sg->sg_magic = SG_MAGIC;
> -#endif
> -	sg_mark_end(sg, 1);
> -	sg_set_buf(sg, buf, buflen);
> -}
> -
> -/**
>   * sg_init_table - Initialize SG table
>   * @sgl:	   The SG table
>   * @nents:	   Number of entries in table
> @@ -247,6 +225,24 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
>  }
>  
>  /**
> + * sg_init_one - Initialize a single entry sg list
> + * @sg:		 SG entry
> + * @buf:	 Virtual address for IO
> + * @buflen:	 IO length
> + *
> + * Notes:
> + *   This should not be used on a single entry that is part of a larger
> + *   table. Use sg_init_table() for that.
> + *
> + **/
> +static inline void sg_init_one(struct scatterlist *sg, const void *buf,
> +			       unsigned int buflen)
> +{
> +	sg_init_table(sg, 1);
> +	sg_set_buf(sg, buf, buflen);
> +}
> +
> +/**
>   * sg_phys - Return physical address of an sg entry
>   * @sg:	     SG entry
>   *
> 
Yes please submit this patch. scsi-ml is full of sg_init_one, specially
on the error recovery path.

Thanks
Boaz

^ permalink raw reply

* Re: [PATCH] pegasos_eth.c: Fix compile error over MV643XX_ defines
From: Sven Luther @ 2007-10-30  9:36 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: Tzachi Perelstein, Jeff Garzik, linuxppc-dev, netdev,
	Lennert Buytenhek
In-Reply-To: <43e72e890710300044o60bfc46cv8815226e39634996@mail.gmail.com>

On Tue, Oct 30, 2007 at 03:44:59AM -0400, Luis R. Rodriguez wrote:
> On 10/29/07, Dale Farnsworth <dale@farnsworth.org> wrote:
> > On Mon, Oct 29, 2007 at 05:27:29PM -0400, Luis R. Rodriguez wrote:
> > > This commit made an incorrect assumption:
> > > --
> > > Author: Lennert Buytenhek <buytenh@wantstofly.org>
> > >  Date:   Fri Oct 19 04:10:10 2007 +0200
> > >
> > >     mv643xx_eth: Move ethernet register definitions into private header
> > >
> > >     Move the mv643xx's ethernet-related register definitions from
> > >     include/linux/mv643xx.h into drivers/net/mv643xx_eth.h, since
> > >     they aren't of any use outside the ethernet driver.
> > >
> > >     Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
> > >     Acked-by: Tzachi Perelstein <tzachi@marvell.com>
> > >     Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
> > > --
> > >
> > > arch/powerpc/platforms/chrp/pegasos_eth.c made use of a 3 defines there.
> > >
> > > mcgrof@pogo:~/devel/wireless-2.6$ git-describe
> > >
> > > v2.6.24-rc1-138-g0119130
> > >
> > > This patch fixes this by internalizing 3 defines onto pegasos which are
> > > simply no longer available elsewhere. Without this your compile will fail
> >
> > That compile failure was fixed in commit
> > 30e69bf4cce16d4c2dcfd629a60fcd8e1aba9fee by Al Viro.
> >
> > However, as I examine that commit, I see that it defines offsets from
> > the eth block in the chip, rather than the full chip registeri block
> > as the Pegasos 2 code expects.  So, I think it fixes the compile
> > failure, but leaves the Pegasos 2 broken.
> >
> > Luis, do you have Pegasos 2 hardware?  Can you (or anyone) verify that
> > the following patch is needed for the Pegasos 2?
> 
> Nope, sorry.

I am busy right now, but have various pegasos machines available for
testing. What exactly should i test ? 

Friendly,

Sven Luther

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox