Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH] netback: fix typo in comment
From: Ian Campbell @ 2011-12-06 13:40 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel@lists.xensource.com, netdev@vger.kernel.org
In-Reply-To: <1323173090-7867-1-git-send-email-wei.liu2@citrix.com>

On Tue, 2011-12-06 at 12:04 +0000, Wei Liu wrote:
> "variables a used" should be "variables are used".
> 
> Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  drivers/net/xen-netback/netback.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
> index 3ecb5aa..639cf8a 100644
> --- a/drivers/net/xen-netback/netback.c
> +++ b/drivers/net/xen-netback/netback.c
> @@ -395,7 +395,7 @@ static void netbk_gop_frag_copy(struct xenvif *vif, struct sk_buff *skb,
>  	struct gnttab_copy *copy_gop;
>  	struct netbk_rx_meta *meta;
>  	/*
> -	 * These variables a used iff get_page_ext returns true,
> +	 * These variables are used iff get_page_ext returns true,
>  	 * in which case they are guaranteed to be initialized.
>  	 */
>  	unsigned int uninitialized_var(group), uninitialized_var(idx);

^ permalink raw reply

* [PATCH 0/2] SUNRPC: make /proc helpers network-namespace-aware
From: Stanislav Kinsbursky @ 2011-12-06 13:42 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel

This is one more precursor patch set. Both patches in the series will be used
later for creating /proc entries for NFS and NFSd statistics per network
namespace context.

The following series consists of:

---

Stanislav Kinsbursky (2):
      SUNRPC: register RPC stats /proc entries in passed network namespace context
      SUNRPC: register service stats /proc entries in passed network namespace context


 fs/nfs/inode.c               |    6 +++---
 fs/nfsd/stats.c              |    5 +++--
 include/linux/sunrpc/stats.h |   16 ++++++++--------
 net/sunrpc/stats.c           |   21 +++++++++++----------
 4 files changed, 25 insertions(+), 23 deletions(-)

^ permalink raw reply

* [PATCH 1/2] SUNRPC: register RPC stats /proc entries in passed network namespace context
From: Stanislav Kinsbursky @ 2011-12-06 13:42 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111206123748.15702.93290.stgit@localhost6.localdomain6>

This patch makes it possible to create NFS program entry ("/proc/net/rpc/nfs")
in passed network namespace context instead of hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfs/inode.c               |    6 +++---
 include/linux/sunrpc/stats.h |    8 ++++----
 net/sunrpc/stats.c           |   15 ++++++++-------
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 98b2508..5cad6c5 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1623,14 +1623,14 @@ static int __init init_nfs_fs(void)
 		goto out0;
 
 #ifdef CONFIG_PROC_FS
-	rpc_proc_register(&nfs_rpcstat);
+	rpc_proc_register(&init_net, &nfs_rpcstat);
 #endif
 	if ((err = register_nfs_fs()) != 0)
 		goto out;
 	return 0;
 out:
 #ifdef CONFIG_PROC_FS
-	rpc_proc_unregister("nfs");
+	rpc_proc_unregister(&init_net, "nfs");
 #endif
 	nfs_destroy_directcache();
 out0:
@@ -1669,7 +1669,7 @@ static void __exit exit_nfs_fs(void)
 	nfs_dns_resolver_destroy();
 	nfs_idmap_quit();
 #ifdef CONFIG_PROC_FS
-	rpc_proc_unregister("nfs");
+	rpc_proc_unregister(&init_net, "nfs");
 #endif
 	nfs_cleanup_cb_ident_idr();
 	unregister_nfs_fs();
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index 680471d..f625b57 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -58,8 +58,8 @@ void			rpc_modcount(struct inode *, int);
 #endif
 
 #ifdef CONFIG_PROC_FS
-struct proc_dir_entry *	rpc_proc_register(struct rpc_stat *);
-void			rpc_proc_unregister(const char *);
+struct proc_dir_entry *	rpc_proc_register(struct net *,struct rpc_stat *);
+void			rpc_proc_unregister(struct net *,const char *);
 void			rpc_proc_zero(struct rpc_program *);
 struct proc_dir_entry *	svc_proc_register(struct svc_stat *,
 					  const struct file_operations *);
@@ -69,8 +69,8 @@ void			svc_seq_show(struct seq_file *,
 				     const struct svc_stat *);
 #else
 
-static inline struct proc_dir_entry *rpc_proc_register(struct rpc_stat *s) { return NULL; }
-static inline void rpc_proc_unregister(const char *p) {}
+static inline struct proc_dir_entry *rpc_proc_register(struct net *, struct rpc_stat *s) { return NULL; }
+static inline void rpc_proc_unregisterstruct net *, (const char *p) {}
 static inline void rpc_proc_zero(struct rpc_program *p) {}
 
 static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 80df89d..f0f6e7c 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -213,28 +213,29 @@ EXPORT_SYMBOL_GPL(rpc_print_iostats);
  * Register/unregister RPC proc files
  */
 static inline struct proc_dir_entry *
-do_register(const char *name, void *data, const struct file_operations *fops)
+do_register(struct net *net, const char *name, void *data,
+	    const struct file_operations *fops)
 {
 	struct sunrpc_net *sn;
 
 	dprintk("RPC:       registering /proc/net/rpc/%s\n", name);
-	sn = net_generic(&init_net, sunrpc_net_id);
+	sn = net_generic(net, sunrpc_net_id);
 	return proc_create_data(name, 0, sn->proc_net_rpc, fops, data);
 }
 
 struct proc_dir_entry *
-rpc_proc_register(struct rpc_stat *statp)
+rpc_proc_register(struct net *net, struct rpc_stat *statp)
 {
-	return do_register(statp->program->name, statp, &rpc_proc_fops);
+	return do_register(net, statp->program->name, statp, &rpc_proc_fops);
 }
 EXPORT_SYMBOL_GPL(rpc_proc_register);
 
 void
-rpc_proc_unregister(const char *name)
+rpc_proc_unregister(struct net *net, const char *name)
 {
 	struct sunrpc_net *sn;
 
-	sn = net_generic(&init_net, sunrpc_net_id);
+	sn = net_generic(net, sunrpc_net_id);
 	remove_proc_entry(name, sn->proc_net_rpc);
 }
 EXPORT_SYMBOL_GPL(rpc_proc_unregister);
@@ -242,7 +243,7 @@ EXPORT_SYMBOL_GPL(rpc_proc_unregister);
 struct proc_dir_entry *
 svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
 {
-	return do_register(statp->program->pg_name, statp, fops);
+	return do_register(&init_net, statp->program->pg_name, statp, fops);
 }
 EXPORT_SYMBOL_GPL(svc_proc_register);
 

^ permalink raw reply related

* [PATCH 2/2] SUNRPC: register service stats /proc entries in passed network namespace context
From: Stanislav Kinsbursky @ 2011-12-06 13:42 UTC (permalink / raw)
  To: Trond.Myklebust
  Cc: linux-nfs, xemul, neilb, netdev, linux-kernel, jbottomley,
	bfields, davem, devel
In-Reply-To: <20111206123748.15702.93290.stgit@localhost6.localdomain6>

This patch makes it possible to create NFSd program entry ("/proc/net/rpc/nfsd")
in passed network namespace context instead of hard-coded "init_net".

Signed-off-by: Stanislav Kinsbursky <skinsbursky@parallels.com>

---
 fs/nfsd/stats.c              |    5 +++--
 include/linux/sunrpc/stats.h |    8 ++++----
 net/sunrpc/stats.c           |    8 ++++----
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/fs/nfsd/stats.c b/fs/nfsd/stats.c
index a2e2402..6d4521f 100644
--- a/fs/nfsd/stats.c
+++ b/fs/nfsd/stats.c
@@ -25,6 +25,7 @@
 #include <linux/module.h>
 #include <linux/sunrpc/stats.h>
 #include <linux/nfsd/stats.h>
+#include <net/net_namespace.h>
 
 #include "nfsd.h"
 
@@ -94,11 +95,11 @@ static const struct file_operations nfsd_proc_fops = {
 void
 nfsd_stat_init(void)
 {
-	svc_proc_register(&nfsd_svcstats, &nfsd_proc_fops);
+	svc_proc_register(&init_net, &nfsd_svcstats, &nfsd_proc_fops);
 }
 
 void
 nfsd_stat_shutdown(void)
 {
-	svc_proc_unregister("nfsd");
+	svc_proc_unregister(&init_net, "nfsd");
 }
diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h
index f625b57..4720b12 100644
--- a/include/linux/sunrpc/stats.h
+++ b/include/linux/sunrpc/stats.h
@@ -61,9 +61,9 @@ void			rpc_modcount(struct inode *, int);
 struct proc_dir_entry *	rpc_proc_register(struct net *,struct rpc_stat *);
 void			rpc_proc_unregister(struct net *,const char *);
 void			rpc_proc_zero(struct rpc_program *);
-struct proc_dir_entry *	svc_proc_register(struct svc_stat *,
+struct proc_dir_entry *	svc_proc_register(struct net *, struct svc_stat *,
 					  const struct file_operations *);
-void			svc_proc_unregister(const char *);
+void			svc_proc_unregister(struct net *, const char *);
 
 void			svc_seq_show(struct seq_file *,
 				     const struct svc_stat *);
@@ -73,9 +73,9 @@ static inline struct proc_dir_entry *rpc_proc_register(struct net *, struct rpc_
 static inline void rpc_proc_unregisterstruct net *, (const char *p) {}
 static inline void rpc_proc_zero(struct rpc_program *p) {}
 
-static inline struct proc_dir_entry *svc_proc_register(struct svc_stat *s,
+static inline struct proc_dir_entry *svc_proc_register(struct net *net, struct svc_stat *s,
 						       const struct file_operations *f) { return NULL; }
-static inline void svc_proc_unregister(const char *p) {}
+static inline void svc_proc_unregister(struct net *net, const char *p) {}
 
 static inline void svc_seq_show(struct seq_file *seq,
 				const struct svc_stat *st) {}
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index f0f6e7c..3c4f688 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -241,18 +241,18 @@ rpc_proc_unregister(struct net *net, const char *name)
 EXPORT_SYMBOL_GPL(rpc_proc_unregister);
 
 struct proc_dir_entry *
-svc_proc_register(struct svc_stat *statp, const struct file_operations *fops)
+svc_proc_register(struct net *net, struct svc_stat *statp, const struct file_operations *fops)
 {
-	return do_register(&init_net, statp->program->pg_name, statp, fops);
+	return do_register(net, statp->program->pg_name, statp, fops);
 }
 EXPORT_SYMBOL_GPL(svc_proc_register);
 
 void
-svc_proc_unregister(const char *name)
+svc_proc_unregister(struct net *net, const char *name)
 {
 	struct sunrpc_net *sn;
 
-	sn = net_generic(&init_net, sunrpc_net_id);
+	sn = net_generic(net, sunrpc_net_id);
 	remove_proc_entry(name, sn->proc_net_rpc);
 }
 EXPORT_SYMBOL_GPL(svc_proc_unregister);

^ permalink raw reply related

* Re: [PATCH][NET] several cleanups and bugfixes for fec.c: don't munge MAC address from platform data
From: Lothar Waßmann @ 2011-12-06 13:44 UTC (permalink / raw)
  To: Baruch Siach; +Cc: netdev, Shawn Guo, linux-kernel, linux-arm-kernel
In-Reply-To: <20111206124857.GB14048@sapphire.tkos.co.il>

Hi,

Baruch Siach writes:
> Hi Lothar,
> 
> On Tue, Dec 06, 2011 at 11:27:13AM +0100, Lothar Waßmann wrote:
> > When the MAC address is supplied via platform_data it should be OK as
> > it is and should not be modified in case of a dual FEC setup.
> > Also copying the MAC from platform_data to the single 'macaddr'
> > variable will overwrite the MAC for the first interface in case of a
> > dual FEC setup.
> > 
> > Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
> > ---
> >  drivers/net/ethernet/freescale/fec.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/freescale/fec.c b/drivers/net/ethernet/freescale/fec.c
> > index e2b5ce6..11534b9 100644
> > --- a/drivers/net/ethernet/freescale/fec.c
> > +++ b/drivers/net/ethernet/freescale/fec.c
> > @@ -818,7 +818,7 @@ static void __inline__ fec_get_mac(struct net_device *ndev)
> >  			iap = (unsigned char *)FEC_FLASHMAC;
> >  #else
> >  		if (pdata)
> > -			memcpy(iap, pdata->mac, ETH_ALEN);
> > +			iap = (unsigned char *)&pdata->mac;
> 
> Since pdata might point to __initdata struct, you must hold a copy of its 
> content.
> 
No. platform_data must be present during the life time of a driver
using it and thus must never be __initdata!


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________

^ permalink raw reply

* Re: `ip addr show' shows maximum of 56 addresses?
From: Eric Dumazet @ 2011-12-06 13:47 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Ben Jencks, netdev
In-Reply-To: <1323143336.7454.225.camel@deadeye>

Le mardi 06 décembre 2011 à 03:48 +0000, Ben Hutchings a écrit :

> Seems like a candidate for 2.6.32.y.  I don't think it depends on any of
> your other changes for 2.6.33, does it?

Yes, this is a candidate for 2.6.32.y, I see no dependencies.

^ permalink raw reply

* Re: [PATCH V2 net] ipv4:correct description for tcp_max_syn_backlog
From: Neil Horman @ 2011-12-06 14:07 UTC (permalink / raw)
  To: Weiping Pan
  Cc: shanwei88, Randy Dunlap, David S. Miller, Eric Dumazet, Shan Wei,
	Max Matveev, open list:DOCUMENTATION, open list,
	open list:NETWORKING [GENERAL]
In-Reply-To: <ed04712f4f61e291ac784a8a77e2831981cfb9c1.1323156956.git.panweiping3@gmail.com>

On Tue, Dec 06, 2011 at 03:39:41PM +0800, Weiping Pan wrote:
> Since commit c5ed63d66f24(tcp: fix three tcp sysctls tuning),
> sysctl_max_syn_backlog is determined by tcp_hashinfo->ehash_mask,
> and the minimal value is 128, and it will increase in proportion to the
> memory of machine.
> The original description for tcp_max_syn_backlog and sysctl_max_syn_backlog
> are out of date.
> 
> Changelog:
> V2: update description for sysctl_max_syn_backlog
> 
> Signed-off-by: Weiping Pan <panweiping3@gmail.com>
> ---
>  Documentation/networking/ip-sysctl.txt |   10 +++++-----
>  net/core/request_sock.c                |    7 ++++---
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
> index f049a1c..589f2da 100644
> --- a/Documentation/networking/ip-sysctl.txt
> +++ b/Documentation/networking/ip-sysctl.txt
> @@ -282,11 +282,11 @@ tcp_max_ssthresh - INTEGER
>  	Default: 0 (off)
>  
>  tcp_max_syn_backlog - INTEGER
> -	Maximal number of remembered connection requests, which are
> -	still did not receive an acknowledgment from connecting client.
> -	Default value is 1024 for systems with more than 128Mb of memory,
> -	and 128 for low memory machines. If server suffers of overload,
> -	try to increase this number.
> +	Maximal number of remembered connection requests, which have not
> +	received an acknowledgment from connecting client.
> +	The minimal value is 128 for low memory machines, and it will
> +	increase in proportion to the memory of machine.
> +	If server suffers from overload, try increasing this number.
>  
>  tcp_max_tw_buckets - INTEGER
>  	Maximal number of timewait sockets held by system simultaneously.
> diff --git a/net/core/request_sock.c b/net/core/request_sock.c
> index 182236b..9b570a6 100644
> --- a/net/core/request_sock.c
> +++ b/net/core/request_sock.c
> @@ -26,10 +26,11 @@
>   * but then some measure against one socket starving all other sockets
>   * would be needed.
>   *
> - * It was 128 by default. Experiments with real servers show, that
> + * The minimum value of it is 128. Experiments with real servers show that
>   * it is absolutely not enough even at 100conn/sec. 256 cures most
> - * of problems. This value is adjusted to 128 for very small machines
> - * (<=32Mb of memory) and to 1024 on normal or better ones (>=256Mb).
> + * of problems.
> + * This value is adjusted to 128 for low memory machines,
> + * and it will increase in proportion to the memory of machine.
>   * Note : Dont forget somaxconn that may limit backlog too.
>   */
>  int sysctl_max_syn_backlog = 256;
> -- 
> 1.7.4.4
> 
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply

* Re: v6: faster tree-based sysctl implementation
From: Anca Emanuel @ 2011-12-06 14:11 UTC (permalink / raw)
  To: Lucian Adrian Grijincu
  Cc: Eric W . Biederman, linux-kernel, netdev, Octavian Purdila,
	David S . Miller, Alexey Dobriyan, Damien Millescamps
In-Reply-To: <CAPLs8y9omncDbLE_KNoKOLLbfwHjWYUJX_i7cC4bLiJsyPbtZQ@mail.gmail.com>

time modprobe dummy numdummies=1000FATAL: Error inserting dummy
(/lib/modules/3.2.0-3-generic/kernel/drivers/net/dummy.ko): Operation
not permitted
real	0m0.192suser	0m0.000ssys	0m0.012s
That was on an Ubuntu system.
What are the practical problems you solve with this ?
Name one or more.

You add more code. This is not good. If you reduce the code, then it
will be interesting.

^ permalink raw reply

* Re: v6: faster tree-based sysctl implementation
From: Lucian Adrian Grijincu @ 2011-12-06 14:33 UTC (permalink / raw)
  To: Anca Emanuel
  Cc: Eric W . Biederman, linux-kernel, netdev, Octavian Purdila,
	David S . Miller, Alexey Dobriyan, Damien Millescamps
In-Reply-To: <CAJL_dMtgP+BqFn3aGVBbGDJ+kMyGiEC_NmDURzh4mU=Jo=qZVA@mail.gmail.com>

On Tue, Dec 6, 2011 at 4:11 PM, Anca Emanuel <anca.emanuel@gmail.com> wrote:
> time modprobe dummy numdummies=1000FATAL: Error inserting dummy
> (/lib/modules/3.2.0-3-generic/kernel/drivers/net/dummy.ko): Operation
> not permitted

Generally when you get "Operation not permitted" you should try with sudo.
This is the man-page: http://xkcd.com/149/ :)


> What are the practical problems you solve with this ?
> Name one or more.


Sysctl uses a slow algorithm: O(N^2) for insertions, O(N) for lookup,
with a relatively big constant.
The performance is acceptable when N is small, but sometimes it can
grow to bigger values.
One case where N can grow to very large values is when you add network
interfaces.

Some companies (like IXIACOM which sponsored this work at the
beginning of this year) have use-cases in which they need 10^3..10^6
network interfaces. The current sysctl implementation is unacceptable
for them.

@Damien Millescamps might have some input on where he needs better
sysctl performance as he prompted me to re-send this patch series.

This algorithm is O(N * logN) for insert and O(logN) for lookup.


> You add more code. This is not good. If you reduce the code, then it
> will be interesting.

Thank you. I know that, but it's easier said than done. I'd welcome
some feedback in what could be simplified in my patches :)

-- 
 .
..: Lucian

^ permalink raw reply

* Re: [PATCH][NET] several cleanups and bugfixes for fec.c: prevent dobule restart of interface on FDX/HDX change
From: Ben Hutchings @ 2011-12-06 15:24 UTC (permalink / raw)
  To: Lothar Waßmann; +Cc: netdev, linux-kernel, Shawn Guo, linux-arm-kernel
In-Reply-To: <0b92136d69e509a6ce49b526e1834f0ec90b04a4.1323163127.git.LW@KARO-electronics.de>

You shouldn't repeat the subject of the whole series in the subject of
each patch.  Just put the name of the component you're changing (in this
case, 'fec: prevent dobule restart of interface on FDX/HDX change').

(Nitpick: typo in 'double'.)

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [net-next RFC PATCH 5/5] virtio-net: flow director support
From: Sridhar Samudrala @ 2011-12-06 15:42 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: Jason Wang, krkumar2, kvm, mst, netdev, rusty, virtualization,
	levinsasha928, bhutchings
In-Reply-To: <CAJSP0QXsLwvH5xYj6h0E_V4VLg6DuUc-GKXu9esEYzL2MFcFGw@mail.gmail.com>

On 12/6/2011 5:15 AM, Stefan Hajnoczi wrote:
> On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang<jasowang@redhat.com>  wrote:
>> On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote:
>>> On Tue, Dec 6, 2011 at 6:33 AM, Jason Wang<jasowang@redhat.com>    wrote:
>>>> On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote:
>>>>> On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang<jasowang@redhat.com>
>>>>>   wrote:
>>> The vcpus are just threads and may not be bound to physical CPUs, so
>>> what is the big picture here?  Is the guest even in the position to
>>> set the best queue mappings today?
>>
>> Not sure it could publish the best mapping but the idea is to make sure the
>> packets of a flow were handled by the same guest vcpu and may be the same
>> vhost thread in order to eliminate the packet reordering and lock
>> contention. But this assumption does not take the bouncing of vhost or vcpu
>> threads which would also affect the result.
> Okay, this is why I'd like to know what the big picture here is.  What
> solution are you proposing?  How are we going to have everything from
> guest application, guest kernel, host threads, and host NIC driver
> play along so we get the right steering up the entire stack.  I think
> there needs to be an answer to that before changing virtio-net to add
> any steering mechanism.
>
>
Yes. Also the current model of  a vhost thread per VM's interface 
doesn't help with packet steering
all the way from the guest to the host physical NIC.

I think we need to have vhost thread(s) per-CPU that can handle packets 
to/from physical NIC's
TX/RX queues. Currently we have a single vhost thread for a VM's i/f 
that handles all the packets from
various flows coming from a multi-queue physical NIC.

Thanks
Sridhar


^ permalink raw reply

* Re: sky2 tx watchdog timeout with 1Gb speed
From: Stephen Hemminger @ 2011-12-06 15:57 UTC (permalink / raw)
  To: Milan Kocian; +Cc: netdev
In-Reply-To: <20111206095919.GA6726@ntm.wq.cz>

On Tue, 6 Dec 2011 10:59:19 +0100
Milan Kocian <milon@wq.cz> wrote:

> On Mon, Dec 05, 2011 at 08:16:11AM -0800, Stephen Hemminger wrote:
> > On Mon, 5 Dec 2011 13:47:25 +0100
> > Milan Kocian <milon@wq.cz> wrote:
> > 
> > > On Sat, Nov 26, 2011 at 05:03:31PM -0800, Stephen Hemminger wrote:
> > > > 
> > > > I think the problem might be that the board doesn't really have all the DMA pins
> > > > wired. You might try enabling iommu, or limiting to <4G of memory.
> > > 
> > > hello stephen,
> > > 
> > > you are probably right. I found that with this mb (Gigabyte GA-965GM-S2) was
> > > more problems with linux. So I replaced this old crap with new one :-).
> > > Many thanks for your time.
> > > 
> > > Best regards,
> > 
> > There was a similar glitch with some skge users.
> > 
> > I have a patch to limit driver to 32bit only. If you send the DMI information,
> > it can be made automatic.
> > 
> 
> ok, I can connect old mb again. Is the output of dmidecode enough ?
> 

Yes. The quirk will be based off board_vendor and board_name.

^ permalink raw reply

* Re: [net-next RFC PATCH 5/5] virtio-net: flow director support
From: Michael S. Tsirkin @ 2011-12-06 16:14 UTC (permalink / raw)
  To: Sridhar Samudrala
  Cc: krkumar2, kvm, virtualization, levinsasha928, netdev, bhutchings
In-Reply-To: <4EDE37FE.5090409@us.ibm.com>

On Tue, Dec 06, 2011 at 07:42:54AM -0800, Sridhar Samudrala wrote:
> On 12/6/2011 5:15 AM, Stefan Hajnoczi wrote:
> >On Tue, Dec 6, 2011 at 10:21 AM, Jason Wang<jasowang@redhat.com>  wrote:
> >>On 12/06/2011 05:18 PM, Stefan Hajnoczi wrote:
> >>>On Tue, Dec 6, 2011 at 6:33 AM, Jason Wang<jasowang@redhat.com>    wrote:
> >>>>On 12/05/2011 06:55 PM, Stefan Hajnoczi wrote:
> >>>>>On Mon, Dec 5, 2011 at 8:59 AM, Jason Wang<jasowang@redhat.com>
> >>>>>  wrote:
> >>>The vcpus are just threads and may not be bound to physical CPUs, so
> >>>what is the big picture here?  Is the guest even in the position to
> >>>set the best queue mappings today?
> >>
> >>Not sure it could publish the best mapping but the idea is to make sure the
> >>packets of a flow were handled by the same guest vcpu and may be the same
> >>vhost thread in order to eliminate the packet reordering and lock
> >>contention. But this assumption does not take the bouncing of vhost or vcpu
> >>threads which would also affect the result.
> >Okay, this is why I'd like to know what the big picture here is.  What
> >solution are you proposing?  How are we going to have everything from
> >guest application, guest kernel, host threads, and host NIC driver
> >play along so we get the right steering up the entire stack.  I think
> >there needs to be an answer to that before changing virtio-net to add
> >any steering mechanism.
> >
> >
> Yes. Also the current model of  a vhost thread per VM's interface
> doesn't help with packet steering
> all the way from the guest to the host physical NIC.
> 
> I think we need to have vhost thread(s) per-CPU that can handle
> packets to/from physical NIC's
> TX/RX queues.
> Currently we have a single vhost thread for a VM's i/f
> that handles all the packets from
> various flows coming from a multi-queue physical NIC.
> 
> Thanks
> Sridhar

It's not hard to try that:
1. revert c23f3445e68e1db0e74099f264bc5ff5d55ebdeb
   this will convert our thread to a workqueue
2. convert the workqueue to a per-cpu one

It didn't work that well in the past, but YMMV

On the surface I'd say a single thread makes some sense
as long as guest uses a single queue.

-- 
MST

^ permalink raw reply

* pull request: wireless-next 2011-12-06
From: John W. Linville @ 2011-12-06 16:02 UTC (permalink / raw)
  To: davem; +Cc: linux-wireless, netdev

[-- Attachment #1: Type: text/plain, Size: 16783 bytes --]

commit d39aeaf260e7d1ec6a677beed230a0406d0069a6

Dave,

This round of updates is intended for 3.3.  Highlights include ath5k
updates, ath9k updates, brcm80211 updates (particularly for brcmfmac),
some NFC logging cleanups, some mesh updates, and the "NoAck per tid"
work from Simon Wunderlich.  Also included is a pull of the wireless
tree to resolve a merge conflict.

Please let me know if there are problems!

John

---

The following changes since commit 40e4783ee62ac656a9a0fa3b512b6aee4f07d2d1:

  ipv4: arp: Cleanup in arp.c (2011-12-06 00:34:40 -0500)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next.git for-davem

Alwin Beukers (2):
      brcm80211: smac: fix channel frequency
      brcm80211: smac: added support for mac80211 filter flags

Arend van Spriel (7):
      brcm80211: fmac: cleanup receive path using proper skb_queue functions
      brcm80211: smac: remove skb next pointer usage from the driver
      brcm80211: fmac: separate receiving skb chain from other receive path
      brcm80211: fmac: remove width parameter from brcmf_sdioh_request_buffer
      brcm80211: fmac: simplify the brcmf_sdioh_request_buffer() function
      brcm80211: fmac: remove alignment check from brcmf_sdioh_request_buffer()
      brcm80211: fmac: rename wait queue name to match using function

Arik Nemtsov (2):
      mac80211: dereference RCU protected probe_resp pointer correctly
      mac80211: don't indicate probe resp change in IBSS mode

Axel Lin (2):
      net: rfkill: convert net/rfkill/* to use module_platform_driver()
      NFC: pn533: Staticise pn533_data_exchange()

Ben Greear (1):
      mac80211: Make __check_htcap_disable static.

Chun-Yeow Yeoh (1):
      {nl,cfg,mac}80211: Allow Setting Multicast Rate in Mesh

Dan Carpenter (1):
      brcm80211: fmac: small memory leak on error

Eliad Peller (1):
      mac80211: call skb_put() before copying the data (trivial)

Emmanuel Grumbach (1):
      iwlwifi: help to debug AGG SM inconsistencies

Felix Fietkau (1):
      mac80211: do not pass AP VLAN vif pointers to drivers

Franky Lin (15):
      brcm80211: fmac: change firmware/nvram name to be more generic
      brcm80211: fmac: discard packet received when net device not registered
      brcm80211: fmac: move module init/exit to sdio layer
      brcm80211: fmac: remove function brcmf_c_init
      brcm80211: fmac: remove unused parameter of brcmf_sdbrcm_probe
      brcm80211: fmac: rename structure brcmf_bus to brcmf_sdio
      brcm80211: fmac: introduce common bus interface struct brcmf_bus
      brcm80211: fmac: move busstate to struct brcmf_bus
      brcm80211: fmac: stop using brcmf_pub in brcmf_sdbrcm_bus_watchdog
      brcm80211: fmac: change function bus_rxctl parameter
      brcm80211: fmac: change function bus_txctl parameter
      brcm80211: fmac: change function bus_txdata parameter
      brcm80211: fmac: change function bus_init parameter
      brcm80211: fmac: remove function brcmf_bus_get_device
      brcm80211: fmac: change function bus_stop parameter

Helmut Schaa (1):
      rt2x00: Pass BlockAck and BlackAckReq frames to mac80211 in monitor mode

Hsu, Kenny (1):
      iwlwifi: add tm commands for indirect register access

Joe Perches (4):
      nfc: Use standard logging styles
      nfc: Convert nfc_dbg to pr_debug
      nfc: Remove unused nfc_printk and nfc_<level> macros
      nfc: Remove function tracer like entry messages

Johannes Berg (7):
      mac80211: fix TX warning
      mac80211: remove tracing config symbol
      iwlagn: remove calibration knowledge
      iwlagn: dynamically allocate & reflect calibration data
      iwlagn: allow up to uCode API 6 for 6000 devices
      mac80211: revert on-channel work optimisations
      iwlagn: fix HW crypto for TX-only keys

John W. Linville (3):
      Revert "mac80211: clear sta.drv_priv on reconfiguration"
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless
      Merge branch 'master' of git://git.kernel.org/.../linville/wireless-next into for-davem

Larry Finger (1):
      rtlwifi: Fix incorrect return of IRQ_HANDLED

Lars-Peter Clausen (1):
      wireless: Remove redundant spi driver bus initialization

Luis R. Rodriguez (7):
      cfg80211: fix race on init and driver registration
      cfg80211: amend regulatory NULL dereference fix
      cfg80211: clarify set tx power mBm documentation
      brcm80211: fix usage of set tx power
      brcm80211: avoid code duplication on set tx power
      mwifiex: fix usage of set tx power
      prism54: remove private driver ioctls

Mohammed Shafi Shajakhan (24):
      ath9k_hw: cosmetic change in calibration debug log
      mac80211: remove unused function declaration
      ath9k: Fix LED GPIO pin for AR9462
      ath9k: change the default antenna settings based on diversity
      ath9k_hw: add definitions to support MCI h/w code
      ath9k_hw: add GPIO output MUX related macros
      ath9k_hw: Add MCI h/w specific structure
      ath9k_hw: initialize MCI parameters
      ath9k_hw: Add MCI h/w code and state machine
      ath9k: Add MCI interrupt to interrupt mask
      ath9k_hw: take care of enabling MCI interrupts
      ath9k_hw: check for asynchronous MCI interrupt pending
      ath9k_hw: check for MCI interrupt in get_isr
      ath9k: add MCI specific definitions and structures
      ath9k: Add functions to allocate/free buffers for MCI
      ath9k_hw: MCI related changes in chip management
      ath9k_hw: MCI related changes in set_reset_reg
      ath9k_hw: Add support for MCI WLAN calibration
      ath9k_hw: Add MCI related changes in chip reset
      ath9k: MCI state machine based on MCI interrupt
      ath9k: fix a typo
      ath9k: minor cleanup
      ath9k_hw: Fix TX IQ calibration for AR9003
      ath9k_hw: add default chainmask for AR9462

Nick Kossifidis (12):
      ath5k: Switch from read-and-clear to write-to-clear method when handling PISR/SISR registers
      ath5k: Add TXNOFRM to INT_TX_ALL
      ath5k: Cleanups v1
      ath5k: Calibration re-work
      ath5k: Use usleep_range where possible
      ath5k: Cleanups v2 + add kerneldoc on all hw functions
      ath5k: We always do full calibration on AR5210
      ath5k: Add a module parameter to disable hw rf kill switch
      ath5k: MRR support and 2GHz radio override belong in ah_capabilities
      ath5k: ath5k_ani_period_restart only touches struct ath5k_ani_state
      ath5k: Renumber hw queue ids
      ath5k: Optimize ath5k_cw_validate

Nikolay Martynov (4):
      ath9k: improve ath_tx_aggr_stop to avoid TID stuck in cleanup state
      mac80211: timeout tx agg sessions in way similar to rx agg sessions
      mac80211: trivial: use WLAN_BACK_RECIPIENT instead of hardcoded 0
      mac80211: log reason and initiator when rx agg is stopped

Rajkumar Manoharan (1):
      ath9k_hw: Fix minimum CTL power for each runtime mode

Simon Wunderlich (5):
      mac80211: remove debugfs noack test
      wireless: Add NoAck per tid support
      mac80211: Add NoAck per tid support
      mac80211: fix duration calculation for QoS NOACK frames
      mac80211: fill rate filter for internal scan requests

Thomas Pedersen (6):
      mac80211: failed forwarded mesh frame addressing
      mac80211: fix switched HWMP frame addresses
      mac80211: fix forwarded mesh frame queue mapping
      {nl,cfg,mac}80211: implement dot11MeshHWMPperrMinInterval
      mac80211: don't initiate path discovery when forwarding frame with unknown DA
      mac80211: clean up rx_h_mesh_fwding

Veli-Pekka Peltola (1):
      hostap_cs: add ID for Canon K30225

Wey-Yi Guy (4):
      iwlwifi: show command string for REPLY_D3_CONFIG
      iwlwifi: show the configuration option
      iwlwifi: do not re-configure HT40 after associated
      iwlwifi: change the default behavior of watchdog timer

 drivers/net/wireless/ath/ath5k/ahb.c               |    4 +-
 drivers/net/wireless/ath/ath5k/ani.c               |   91 +-
 drivers/net/wireless/ath/ath5k/ani.h               |   32 +-
 drivers/net/wireless/ath/ath5k/ath5k.h             |  569 ++++++---
 drivers/net/wireless/ath/ath5k/attach.c            |   16 +-
 drivers/net/wireless/ath/ath5k/base.c              |  287 +++--
 drivers/net/wireless/ath/ath5k/caps.c              |   27 +-
 drivers/net/wireless/ath/ath5k/desc.c              |  217 +++-
 drivers/net/wireless/ath/ath5k/desc.h              |  124 ++-
 drivers/net/wireless/ath/ath5k/dma.c               |  370 +++--
 drivers/net/wireless/ath/ath5k/gpio.c              |   81 +-
 drivers/net/wireless/ath/ath5k/initvals.c          |   75 +-
 drivers/net/wireless/ath/ath5k/pci.c               |    2 +-
 drivers/net/wireless/ath/ath5k/pcu.c               |  222 ++-
 drivers/net/wireless/ath/ath5k/phy.c               |  853 +++++++++---
 drivers/net/wireless/ath/ath5k/qcu.c               |  143 ++-
 drivers/net/wireless/ath/ath5k/reg.h               |   27 +-
 drivers/net/wireless/ath/ath5k/reset.c             |  230 +++-
 drivers/net/wireless/ath/ath5k/rfbuffer.h          |   59 +-
 drivers/net/wireless/ath/ath5k/rfgain.h            |   22 +-
 drivers/net/wireless/ath/ath9k/Makefile            |    3 +-
 drivers/net/wireless/ath/ath9k/ar9003_calib.c      |   45 +-
 drivers/net/wireless/ath/ath9k/ar9003_eeprom.c     |    3 +-
 drivers/net/wireless/ath/ath9k/ar9003_mac.c        |   36 +-
 drivers/net/wireless/ath/ath9k/ar9003_mci.c        | 1464 ++++++++++++++++++++
 drivers/net/wireless/ath/ath9k/ar9003_mci.h        |  102 ++
 drivers/net/wireless/ath/ath9k/ar9003_phy.h        |    3 +
 drivers/net/wireless/ath/ath9k/ath9k.h             |    3 +-
 drivers/net/wireless/ath/ath9k/btcoex.c            |    2 +-
 drivers/net/wireless/ath/ath9k/btcoex.h            |   31 +
 drivers/net/wireless/ath/ath9k/eeprom_4k.c         |    6 +-
 drivers/net/wireless/ath/ath9k/eeprom_9287.c       |    3 +-
 drivers/net/wireless/ath/ath9k/eeprom_def.c        |    6 +-
 drivers/net/wireless/ath/ath9k/hw.c                |  178 +++-
 drivers/net/wireless/ath/ath9k/hw.h                |  182 +++
 drivers/net/wireless/ath/ath9k/init.c              |   33 +
 drivers/net/wireless/ath/ath9k/mac.c               |   17 +-
 drivers/net/wireless/ath/ath9k/main.c              |    9 +-
 drivers/net/wireless/ath/ath9k/mci.c               |  419 ++++++
 drivers/net/wireless/ath/ath9k/mci.h               |   20 +
 drivers/net/wireless/ath/ath9k/recv.c              |   24 +-
 drivers/net/wireless/ath/ath9k/reg.h               |  306 ++++-
 drivers/net/wireless/ath/ath9k/xmit.c              |   13 +-
 drivers/net/wireless/brcm80211/brcmfmac/bcmchip.h  |   25 -
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c   |  148 ++-
 .../net/wireless/brcm80211/brcmfmac/bcmsdh_sdmmc.c |  211 ++--
 drivers/net/wireless/brcm80211/brcmfmac/dhd.h      |   31 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_bus.h  |   19 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_cdc.c  |    6 +-
 .../net/wireless/brcm80211/brcmfmac/dhd_common.c   |   15 -
 .../net/wireless/brcm80211/brcmfmac/dhd_linux.c    |   85 +-
 drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c |  320 ++---
 .../net/wireless/brcm80211/brcmfmac/sdio_host.h    |   30 +-
 .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c  |    9 +-
 drivers/net/wireless/brcm80211/brcmsmac/dma.c      |   62 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   38 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   47 +-
 drivers/net/wireless/brcm80211/brcmsmac/main.h     |    6 +-
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |    2 +-
 drivers/net/wireless/hostap/hostap_cs.c            |    3 +
 drivers/net/wireless/iwlwifi/iwl-1000.c            |   10 +-
 drivers/net/wireless/iwlwifi/iwl-2000.c            |   14 -
 drivers/net/wireless/iwlwifi/iwl-5000.c            |   17 +-
 drivers/net/wireless/iwlwifi/iwl-6000.c            |   22 +-
 drivers/net/wireless/iwlwifi/iwl-agn-calib.c       |   66 +-
 drivers/net/wireless/iwlwifi/iwl-agn-calib.h       |    3 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rx.c          |    1 +
 drivers/net/wireless/iwlwifi/iwl-agn-rxon.c        |   36 +-
 drivers/net/wireless/iwlwifi/iwl-agn-sta.c         |    5 -
 drivers/net/wireless/iwlwifi/iwl-agn-ucode.c       |   48 +-
 drivers/net/wireless/iwlwifi/iwl-agn.c             |   39 +-
 drivers/net/wireless/iwlwifi/iwl-agn.h             |    2 +
 drivers/net/wireless/iwlwifi/iwl-core.c            |   22 +-
 drivers/net/wireless/iwlwifi/iwl-core.h            |    7 +-
 drivers/net/wireless/iwlwifi/iwl-dev.h             |   24 +-
 drivers/net/wireless/iwlwifi/iwl-shared.h          |    6 +-
 drivers/net/wireless/iwlwifi/iwl-sv-open.c         |   40 +-
 drivers/net/wireless/iwlwifi/iwl-testmode.h        |   20 +-
 drivers/net/wireless/iwlwifi/iwl-trans-pcie.c      |   12 +-
 drivers/net/wireless/libertas/if_spi.c             |    1 -
 drivers/net/wireless/mwifiex/cfg80211.c            |    3 +-
 drivers/net/wireless/p54/p54spi.c                  |    1 -
 drivers/net/wireless/prism54/isl_ioctl.c           |  333 -----
 drivers/net/wireless/prism54/isl_ioctl.h           |    2 -
 drivers/net/wireless/prism54/islpci_dev.c          |    1 -
 drivers/net/wireless/rt2x00/rt2800lib.c            |    6 +-
 drivers/net/wireless/rtlwifi/pci.c                 |    7 +-
 drivers/net/wireless/wl1251/spi.c                  |    1 -
 drivers/net/wireless/wl12xx/spi.c                  |    1 -
 drivers/nfc/pn533.c                                |    2 +-
 include/linux/nl80211.h                            |   15 +
 include/net/cfg80211.h                             |   12 +-
 net/mac80211/Kconfig                               |   12 -
 net/mac80211/Makefile                              |    4 +-
 net/mac80211/agg-rx.c                              |   11 +-
 net/mac80211/agg-tx.c                              |   39 +-
 net/mac80211/cfg.c                                 |   22 +-
 net/mac80211/debugfs.c                             |   35 -
 net/mac80211/debugfs_netdev.c                      |    3 +
 net/mac80211/driver-ops.h                          |   14 +
 net/mac80211/driver-trace.h                        |   11 -
 net/mac80211/ht.c                                  |    6 +-
 net/mac80211/ieee80211_i.h                         |   10 +-
 net/mac80211/iface.c                               |   17 +-
 net/mac80211/main.c                                |   47 +-
 net/mac80211/mesh.c                                |    1 +
 net/mac80211/mesh.h                                |    2 +
 net/mac80211/mesh_hwmp.c                           |  146 ++-
 net/mac80211/mesh_pathtbl.c                        |   29 +-
 net/mac80211/offchannel.c                          |    9 +-
 net/mac80211/rx.c                                  |  105 +-
 net/mac80211/scan.c                                |    4 +-
 net/mac80211/sta_info.c                            |    4 -
 net/mac80211/sta_info.h                            |    3 +-
 net/mac80211/tx.c                                  |   44 +-
 net/mac80211/util.c                                |    8 +-
 net/mac80211/wme.c                                 |   32 +-
 net/mac80211/wme.h                                 |    3 +
 net/mac80211/work.c                                |   99 +--
 net/nfc/core.c                                     |   60 +-
 net/nfc/nci/core.c                                 |   84 +-
 net/nfc/nci/data.c                                 |   30 +-
 net/nfc/nci/ntf.c                                  |   83 +-
 net/nfc/nci/rsp.c                                  |   84 +-
 net/nfc/netlink.c                                  |   32 +-
 net/nfc/nfc.h                                      |    7 -
 net/nfc/rawsock.c                                  |   28 +-
 net/rfkill/rfkill-gpio.c                           |   13 +-
 net/rfkill/rfkill-regulator.c                      |   12 +-
 net/wireless/mesh.c                                |    2 +
 net/wireless/nl80211.c                             |   39 +
 net/wireless/reg.c                                 |   49 +-
 132 files changed, 6634 insertions(+), 2804 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mci.c
 create mode 100644 drivers/net/wireless/ath/ath9k/ar9003_mci.h
 delete mode 100644 drivers/net/wireless/brcm80211/brcmfmac/bcmchip.h
-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: [RFC] socket sk_sndmsg_page waste
From: Eric Dumazet @ 2011-12-06 16:15 UTC (permalink / raw)
  To: David Miller; +Cc: netdev
In-Reply-To: <1323154416.2467.27.camel@edumazet-laptop>

Le mardi 06 décembre 2011 à 07:53 +0100, Eric Dumazet a écrit :
> TCP can steer one page of memory per socket to cook outgoing frames.
> 
> This means a machine handling long living sockets can consume a lot of
> ram.
> 
> 1.000.000 tcp sockets : up to 4GB of allocated memory, if some writes
> had been done on these sockets.
> 
> It would make sense to use a per thread page as a pool, instead of a per
> socket pool, and remove sk_sndmsg_page/off fields.
> 
> Problem with this strategy is impact outside of net tree, and a cost at
> thread creation/destruction.
> 
> [ But this could be used in fs/pipe.c or fs/splice.c code..., so that
> small writes() dont allocate a full page but try to reuse the "per
> task_struct" page ]
> 
> 

Another idea would be to use a percpu variable, to get proper NUMA
affinity as well, and no extra cost at thread create/delete time.

Only 'problem' is we can sleep (pagefault) in
skb_copy_to_page_nocache(), so special care must be taken (disabling
preemption wont prevent another thread on same cpu can use the same
page)

^ permalink raw reply

* Re: v6: faster tree-based sysctl implementation
From: Damien Millescamps @ 2011-12-06 16:47 UTC (permalink / raw)
  To: netdev
  Cc: Eric W . Biederman, linux-kernel, Octavian Purdila,
	David S . Miller, Alexey Dobriyan
In-Reply-To: <CAPLs8y8vhioqc3CPrD7ugmVkR2DjKWNm8+T5j9QQnrxi=BgvdA@mail.gmail.com>

On 12/06/2011 03:33 PM, Lucian Adrian Grijincu wrote:
> On Tue, Dec 6, 2011 at 4:11 PM, Anca Emanuel<anca.emanuel@gmail.com>  wrote:
>> time modprobe dummy numdummies=1000FATAL: Error inserting dummy
>> (/lib/modules/3.2.0-3-generic/kernel/drivers/net/dummy.ko): Operation
>> not permitted
> Generally when you get "Operation not permitted" you should try with sudo.
> This is the man-page: http://xkcd.com/149/ :)
>
>
>> What are the practical problems you solve with this ?
>> Name one or more.
>
> Sysctl uses a slow algorithm: O(N^2) for insertions, O(N) for lookup,
> with a relatively big constant.
> The performance is acceptable when N is small, but sometimes it can
> grow to bigger values.
> One case where N can grow to very large values is when you add network
> interfaces.
>
> Some companies (like IXIACOM which sponsored this work at the
> beginning of this year) have use-cases in which they need 10^3..10^6
> network interfaces. The current sysctl implementation is unacceptable
> for them.
>
> @Damien Millescamps might have some input on where he needs better
> sysctl performance as he prompted me to re-send this patch series.
>
> This algorithm is O(N * logN) for insert and O(logN) for lookup.
>
>

A use-case for wanting to be able to create several interfaces is to 
have a "tunnel" server handling several dynamic point to point connections.

The current implementation dates from the "sysctl cleanup" from Al Viro: 
commits 734550921e9b7ab924a43aa3d0bd4239dac4fbf1 to 
ae7edecc9b8810770a8e5cb9a466ea4bdcfa8401, plus some later fixes.
This implementation was suboptimal, and modifying it necessitates a lot 
of reworking of the structures used, so the diff is clearly big. Also 
Lucian took time to add lots of comment to help understanding and using 
the new implementation, which also explains the amount of modifications 
in kernel/sysctl.c

For information, the main idea is to implement sysctl, which has a 
filesystem structure, like most other file system implementation (like 
sysfs), i.e. using an rb_tree.

-- 
damien

^ permalink raw reply

* [PATCH net-next] caif-spi: Bugfix for dump upon device removal
From: Sjur Brændeland @ 2011-12-06 17:25 UTC (permalink / raw)
  To: netdev, David Miller; +Cc: Erwan Bracq, Sjur Brændeland

From: Erwan Bracq <erwan.bracq@stericsson.com>

Fix dump upon device removal, by moving deinitialization from
platform-device-remove to network-interface-uninit.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
---
 drivers/net/caif/caif_spi.c |  176 ++++++++++++++++++++++---------------------
 include/net/caif/caif_spi.h |    4 +-
 2 files changed, 92 insertions(+), 88 deletions(-)

diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 05e791f..761057b 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -226,7 +226,7 @@ static ssize_t dbgfs_frame(struct file *file, char __user *user_buf,
 			"Tx data (Len: %d):\n", cfspi->tx_cpck_len);
 
 	len += print_frame((buf + len), (DEBUGFS_BUF_SIZE - len),
-			   cfspi->xfer.va_tx,
+			   cfspi->xfer.va_tx[0],
 			   (cfspi->tx_cpck_len + SPI_CMD_SZ), 100);
 
 	len += snprintf((buf + len), (DEBUGFS_BUF_SIZE - len),
@@ -599,48 +599,11 @@ static int cfspi_close(struct net_device *dev)
 	netif_stop_queue(dev);
 	return 0;
 }
-static const struct net_device_ops cfspi_ops = {
-	.ndo_open = cfspi_open,
-	.ndo_stop = cfspi_close,
-	.ndo_start_xmit = cfspi_xmit
-};
 
-static void cfspi_setup(struct net_device *dev)
+static int cfspi_init(struct net_device *dev)
 {
+	int res = 0;
 	struct cfspi *cfspi = netdev_priv(dev);
-	dev->features = 0;
-	dev->netdev_ops = &cfspi_ops;
-	dev->type = ARPHRD_CAIF;
-	dev->flags = IFF_NOARP | IFF_POINTOPOINT;
-	dev->tx_queue_len = 0;
-	dev->mtu = SPI_MAX_PAYLOAD_SIZE;
-	dev->destructor = free_netdev;
-	skb_queue_head_init(&cfspi->qhead);
-	skb_queue_head_init(&cfspi->chead);
-	cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
-	cfspi->cfdev.use_frag = false;
-	cfspi->cfdev.use_stx = false;
-	cfspi->cfdev.use_fcs = false;
-	cfspi->ndev = dev;
-}
-
-int cfspi_spi_probe(struct platform_device *pdev)
-{
-	struct cfspi *cfspi = NULL;
-	struct net_device *ndev;
-	struct cfspi_dev *dev;
-	int res;
-	dev = (struct cfspi_dev *)pdev->dev.platform_data;
-
-	ndev = alloc_netdev(sizeof(struct cfspi),
-			"cfspi%d", cfspi_setup);
-	if (!ndev)
-		return -ENOMEM;
-
-	cfspi = netdev_priv(ndev);
-	netif_stop_queue(ndev);
-	cfspi->ndev = ndev;
-	cfspi->pdev = pdev;
 
 	/* Set flow info. */
 	cfspi->flow_off_sent = 0;
@@ -656,16 +619,11 @@ int cfspi_spi_probe(struct platform_device *pdev)
 		cfspi->slave_talked = false;
 	}
 
-	/* Assign the SPI device. */
-	cfspi->dev = dev;
-	/* Assign the device ifc to this SPI interface. */
-	dev->ifc = &cfspi->ifc;
-
 	/* Allocate DMA buffers. */
-	cfspi->xfer.va_tx = dma_alloc(&cfspi->xfer.pa_tx);
-	if (!cfspi->xfer.va_tx) {
+	cfspi->xfer.va_tx[0] = dma_alloc(&cfspi->xfer.pa_tx[0]);
+	if (!cfspi->xfer.va_tx[0]) {
 		res = -ENODEV;
-		goto err_dma_alloc_tx;
+		goto err_dma_alloc_tx_0;
 	}
 
 	cfspi->xfer.va_rx = dma_alloc(&cfspi->xfer.pa_rx);
@@ -714,6 +672,87 @@ int cfspi_spi_probe(struct platform_device *pdev)
 	/* Schedule the work queue. */
 	queue_work(cfspi->wq, &cfspi->work);
 
+	return 0;
+
+ err_create_wq:
+	dma_free(cfspi->xfer.va_rx, cfspi->xfer.pa_rx);
+ err_dma_alloc_rx:
+	dma_free(cfspi->xfer.va_tx[0], cfspi->xfer.pa_tx[0]);
+ err_dma_alloc_tx_0:
+	return res;
+}
+
+static void cfspi_uninit(struct net_device *dev)
+{
+	struct cfspi *cfspi = netdev_priv(dev);
+
+	/* Remove from list. */
+	spin_lock(&cfspi_list_lock);
+	list_del(&cfspi->list);
+	spin_unlock(&cfspi_list_lock);
+
+	cfspi->ndev = NULL;
+	/* Free DMA buffers. */
+	dma_free(cfspi->xfer.va_rx, cfspi->xfer.pa_rx);
+	dma_free(cfspi->xfer.va_tx[0], cfspi->xfer.pa_tx[0]);
+	set_bit(SPI_TERMINATE, &cfspi->state);
+	wake_up_interruptible(&cfspi->wait);
+	destroy_workqueue(cfspi->wq);
+	/* Destroy debugfs directory and files. */
+	dev_debugfs_rem(cfspi);
+	return;
+}
+
+static const struct net_device_ops cfspi_ops = {
+	.ndo_open = cfspi_open,
+	.ndo_stop = cfspi_close,
+	.ndo_init = cfspi_init,
+	.ndo_uninit = cfspi_uninit,
+	.ndo_start_xmit = cfspi_xmit
+};
+
+static void cfspi_setup(struct net_device *dev)
+{
+	struct cfspi *cfspi = netdev_priv(dev);
+	dev->features = 0;
+	dev->netdev_ops = &cfspi_ops;
+	dev->type = ARPHRD_CAIF;
+	dev->flags = IFF_NOARP | IFF_POINTOPOINT;
+	dev->tx_queue_len = 0;
+	dev->mtu = SPI_MAX_PAYLOAD_SIZE;
+	dev->destructor = free_netdev;
+	skb_queue_head_init(&cfspi->qhead);
+	skb_queue_head_init(&cfspi->chead);
+	cfspi->cfdev.link_select = CAIF_LINK_HIGH_BANDW;
+	cfspi->cfdev.use_frag = false;
+	cfspi->cfdev.use_stx = false;
+	cfspi->cfdev.use_fcs = false;
+	cfspi->ndev = dev;
+}
+
+int cfspi_spi_probe(struct platform_device *pdev)
+{
+	struct cfspi *cfspi = NULL;
+	struct net_device *ndev;
+	struct cfspi_dev *dev;
+	int res;
+	dev = (struct cfspi_dev *)pdev->dev.platform_data;
+
+	ndev = alloc_netdev(sizeof(struct cfspi),
+			"cfspi%d", cfspi_setup);
+	if (!dev)
+		return -ENODEV;
+
+	cfspi = netdev_priv(ndev);
+	netif_stop_queue(ndev);
+	cfspi->ndev = ndev;
+	cfspi->pdev = pdev;
+
+	/* Assign the SPI device. */
+	cfspi->dev = dev;
+	/* Assign the device ifc to this SPI interface. */
+	dev->ifc = &cfspi->ifc;
+
 	/* Register network device. */
 	res = register_netdev(ndev);
 	if (res) {
@@ -723,15 +762,6 @@ int cfspi_spi_probe(struct platform_device *pdev)
 	return res;
 
  err_net_reg:
-	dev_debugfs_rem(cfspi);
-	set_bit(SPI_TERMINATE, &cfspi->state);
-	wake_up_interruptible(&cfspi->wait);
-	destroy_workqueue(cfspi->wq);
- err_create_wq:
-	dma_free(cfspi->xfer.va_rx, cfspi->xfer.pa_rx);
- err_dma_alloc_rx:
-	dma_free(cfspi->xfer.va_tx, cfspi->xfer.pa_tx);
- err_dma_alloc_tx:
 	free_netdev(ndev);
 
 	return res;
@@ -739,34 +769,8 @@ int cfspi_spi_probe(struct platform_device *pdev)
 
 int cfspi_spi_remove(struct platform_device *pdev)
 {
-	struct list_head *list_node;
-	struct list_head *n;
-	struct cfspi *cfspi = NULL;
-	struct cfspi_dev *dev;
-
-	dev = (struct cfspi_dev *)pdev->dev.platform_data;
-	spin_lock(&cfspi_list_lock);
-	list_for_each_safe(list_node, n, &cfspi_list) {
-		cfspi = list_entry(list_node, struct cfspi, list);
-		/* Find the corresponding device. */
-		if (cfspi->dev == dev) {
-			/* Remove from list. */
-			list_del(list_node);
-			/* Free DMA buffers. */
-			dma_free(cfspi->xfer.va_rx, cfspi->xfer.pa_rx);
-			dma_free(cfspi->xfer.va_tx, cfspi->xfer.pa_tx);
-			set_bit(SPI_TERMINATE, &cfspi->state);
-			wake_up_interruptible(&cfspi->wait);
-			destroy_workqueue(cfspi->wq);
-			/* Destroy debugfs directory and files. */
-			dev_debugfs_rem(cfspi);
-			unregister_netdev(cfspi->ndev);
-			spin_unlock(&cfspi_list_lock);
-			return 0;
-		}
-	}
-	spin_unlock(&cfspi_list_lock);
-	return -ENODEV;
+	/* Everything is done in cfspi_uninit(). */
+	return 0;
 }
 
 static void __exit cfspi_exit_module(void)
@@ -777,7 +781,7 @@ static void __exit cfspi_exit_module(void)
 
 	list_for_each_safe(list_node, n, &cfspi_list) {
 		cfspi = list_entry(list_node, struct cfspi, list);
-		platform_device_unregister(cfspi->pdev);
+		unregister_netdev(cfspi->ndev);
 	}
 
 	/* Destroy sysfs files. */
diff --git a/include/net/caif/caif_spi.h b/include/net/caif/caif_spi.h
index 87c3d11..aa6a485 100644
--- a/include/net/caif/caif_spi.h
+++ b/include/net/caif/caif_spi.h
@@ -55,8 +55,8 @@
 struct cfspi_xfer {
 	u16 tx_dma_len;
 	u16 rx_dma_len;
-	void *va_tx;
-	dma_addr_t pa_tx;
+	void *va_tx[2];
+	dma_addr_t pa_tx[2];
 	void *va_rx;
 	dma_addr_t pa_rx;
 };
-- 
1.7.0.4

^ permalink raw reply related

* Re: [net-next RFC PATCH 2/5] tuntap: simple flow director support
From: Ben Hutchings @ 2011-12-06 17:31 UTC (permalink / raw)
  To: Jason Wang; +Cc: krkumar2, kvm, mst, netdev, virtualization, levinsasha928
In-Reply-To: <4EDDC27D.9050608@redhat.com>

On Tue, 2011-12-06 at 15:21 +0800, Jason Wang wrote:
> On 12/06/2011 04:09 AM, Ben Hutchings wrote:
> > On Mon, 2011-12-05 at 16:58 +0800, Jason Wang wrote:
> >> This patch adds a simple flow director to tun/tap device. It is just a
> >> page that contains the hash to queue mapping which could be changed by
> >> user-space. The backend (tap/macvtap) would query this table to get
> >> the desired queue of a packets when it send packets to userspace.
> > This is just flow hashing (RSS), not flow steering.
> >
> >> The page address were set through a new kind of ioctl - TUNSETFD and
> >> were pinned until device exit or another new page were specified.
> > [...]
> >
> > You should implement ethtool ETHTOOL_{G,S}RXFHINDIR instead.
> >
> > Ben.
> >
> 
> I'm not fully understanding this. The page belongs to guest, and the 
> idea is to let guest driver can easily change any entry. Looks like if 
> ethtool_set_rxfh_indir() is used, this kind of change is not easy as it 
> needs one copy and can only accept the whole table as its parameters.

Sorry, yes, I was misreading this.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [patch] openvswitch: small potential memory leak in ovs_vport_alloc()
From: Jesse Gross @ 2011-12-06 17:32 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, David S. Miller
In-Reply-To: <20111206062707.GA8433-mgFCXtclrQlZLf2FXnZxJA@public.gmane.org>

On Mon, Dec 5, 2011 at 10:27 PM, Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote:
> We're unlikely to hit this leak, but the static checkers complain if we
> don't take care of it.
>
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

Acked-by: Jesse Gross <jesse-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>

Thanks Dan.

^ permalink raw reply

* Re: [PATCH] ipip, sit: copy parms.name after register_netdevice
From: Greg KH @ 2011-12-06 17:32 UTC (permalink / raw)
  To: Ted Feng
  Cc: Jiri Pirko, David S. Miller, Josh Boyer, netdev, linux-kernel,
	stable
In-Reply-To: <CAM7b5hzt8D6hn3=XEcm9E3_BwJxj-YABpkufCpuhjiPLDxCsMQ@mail.gmail.com>

On Tue, Dec 06, 2011 at 05:25:24PM +0800, Ted Feng wrote:
> Same fix as 731abb9cb2 for ipip and sit tunnel.
> Commit 1c5cae815d removed an explicit call to dev_alloc_name in
> ipip_tunnel_locate
> and ipip6_tunnel_locate, because register_netdevice will now create a
> valid name.
> However the tunnel keeps a copy of the name in the private parms structure.
> 
> This shows up if you do a simple tunnel add, followed by a tunnel show:
> 
> $ sudo ip tunnel add mode ipip remote 10.2.20.211
> $ ip tunnel
> tunl0: ip/ip  remote any  local any  ttl inherit  nopmtudisc
> tunl%d: ip/ip  remote 10.2.20.211  local any  ttl inherit
> $ sudo ip tunnel add mode sit remote 10.2.20.212
> $ ip tunnel
> sit0: ipv6/ip  remote any  local any  ttl 64  nopmtudisc 6rd-prefix 2002::/16
> sit%d: ioctl 89f8 failed: No such device
> sit%d: ipv6/ip  remote 10.2.20.212  local any  ttl inherit
> 
> Signed-off-by: Ted Feng <artisdom@gmail.com>

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.

</formletter>

^ permalink raw reply

* Re: [net-next RFC PATCH 5/5] virtio-net: flow director support
From: Ben Hutchings @ 2011-12-06 17:36 UTC (permalink / raw)
  To: Jason Wang; +Cc: krkumar2, kvm, mst, netdev, virtualization, levinsasha928
In-Reply-To: <4EDDC35C.2070100@redhat.com>

On Tue, 2011-12-06 at 15:25 +0800, Jason Wang wrote:
> On 12/06/2011 04:42 AM, Ben Hutchings wrote:
[...]
> > This is not a proper implementation of ndo_rx_flow_steer.  If you steer
> > a flow by changing the RSS table this can easily cause packet reordering
> > in other flows.  The filtering should be more precise, ideally matching
> > exactly a single flow by e.g. VID and IP 5-tuple.
> >
> > I think you need to add a second hash table which records exactly which
> > flow is supposed to be steered.  Also, you must call
> > rps_may_expire_flow() to check whether an entry in this table may be
> > replaced; otherwise you can cause packet reordering in the flow that was
> > previously being steered.
> >
> > Finally, this function must return the table index it assigned, so that
> > rps_may_expire_flow() works.
> 
> Thanks for the explanation, how about document this briefly in scaling.txt?
[...]

I believe scaling.txt is intended for users/administrators, not
developers.

The documentation for implementers of accelerated RFS is in the comment
for struct net_device_ops and the commit message adding it.  But I
really should improve that comment.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* Re: [PATCH net-next V0 19/21] mlx4_core: Modify driver initialization flow to accommodate SRIOV for Ethernet
From: Ben Hutchings @ 2011-12-06 17:41 UTC (permalink / raw)
  To: Jack Morgenstein
  Cc: Yevgeny Petrilin, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
	netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	roland-BHEL68pLQRGGvPXPguhicg, liranl-VPRAkNaXOzVS1MOuV/RT9w
In-Reply-To: <201112061035.54093.jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

On Tue, 2011-12-06 at 10:35 +0200, Jack Morgenstein wrote:
> On Monday 05 December 2011 23:26, Ben Hutchings wrote:
> > The 'probe_vf' parameter is very odd.  Why do you think it is necessary
> > to make this a module parameter?  It should be possible to bind and
> > unbind the driver from each VF dynamically via sysfs but this parameter
> > appears to restrict that.
> > 
> The host which sees the PF will also see all the VFs once they come up.
> As each VF appears (as seen by 'lspci'), the O/S will invoke the "probe"
> method for that VF.  Without the "probe_vf" parameter, this probe would
> result in all the VFs being bound to the PF host (and thus unavailable for
> guests).

As I said, you can unbind it through sysfs.

> The small section of code which makes use of the probe_vf parameter
> (file net/ethernet/mellanox/mlx4_main.c):

Yes, I get it.

> 	/* Detect if this device is a virtual function */
> 	if (id && id->driver_data & MLX4_VF) {
> 		/* When acting as pf, we normally skip vfs unless explicitly
> 		 * requested to probe them. */
> 		if (sr_iov && extended_func_num(pdev) > probe_vf) {
> 			mlx4_warn(dev, "Skipping virtual function:%d\n",
> 						extended_func_num(pdev));
> 			err = -ENODEV;
> 			goto err_free_dev;
> 		}
> 
> If you invoke "dmesg" on the PF host, you will see a series of the
> "Skipping... " messages, one per VF.  If probe_vf > 0, the PF-host will
> reserve some VFs for its own use, and not issue the "Skipping..." message
> for those VFs.

What if you want to change that later?  You can't use those VFs in the
PF-host without reloading the driver.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] drivers/net/usb/asix:  resync from vendor's copy
From: Ben Hutchings @ 2011-12-06 17:45 UTC (permalink / raw)
  To: Mark Lord; +Cc: David Miller, netdev, linux-kernel
In-Reply-To: <4EDE0E29.9070809@teksavvy.com>

On Tue, 2011-12-06 at 07:44 -0500, Mark Lord wrote:
> On 11-12-05 10:18 AM, Ben Hutchings wrote:
> > On Mon, 2011-12-05 at 09:41 -0500, Mark Lord wrote:
> > [...]
> >> static int ax88772b_bind(struct usbnet *dev, struct usb_interface *intf)
> >> {
> >> ...
> >>         /* register support for hardware checksums */
> >>         dev->net->hw_features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
> >>
> >>         /* enable hardware checksums */
> >>         dev->net->features |= NETIF_F_HW_CSUM | NETIF_F_RXCSUM;
> >>         ax88772b_set_features(dev->net, dev->net->features);
> >> ...
> >> }
> >> -------------------------------snip-----------------------------------
> >>
> >> Does this look correct -- any improvements/fixes to suggest?
> > [...]
> > 
> > NETIF_F_HW_CSUM means the hardware implements generic IP-style
> > checksumming: the stack specifies the offset at which to start
> > checksumming and the offset at which to store the checksum, and the
> > hardware does not attempt to parse the headers.
> > 
> > If this hardware recognises specific protocols and works out the offsets
> > itself, then you must claim NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM instead.
> 
> Yeah, the hardware seems to understand quite a few protocol formats.
> Okay, so I'll claim the protocol-specific flags in net->hw_features.
> 
> But what do I use in net->features?
> The exact same protocol flags,
> or the generic NETIF_F_HW_CSUM | NETIF_F_RXCSUM ones?

You set the flags for features that are actually being implemented!

But do set NETIF_F_RXCSUM in both places.  The network stack doesn't
know or care exactly what protocols you can do RX checksum validation
for, so there is only one flag for this.  Only the TX checksum
generation features have to be distinguished.

> The set_features() function also has to test for flags
> to know what to do.  Should it test specific protocol flags,
> or just the generic two ?

Think it through.

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

^ permalink raw reply

* [PATCH 0/11] Generalize the inet_diag infrastructure
From: Pavel Emelyanov @ 2011-12-06 17:56 UTC (permalink / raw)
  To: David Miller, Linux Netdev List

This is an attempt to prepare the existing inet_diag infrastructure to work with
arbitrary address family and protocol pair, not only AF_INET(6) and TCP/DCCP.

This set adds the sock_diag infrastructure, that handles the new SOCK_DIAG_BY_FAMILY
message type by the NETLINK_INET_DIAG socket. The core API struct for this (called
sock_diag_req) contains two fields - family and type - which specify which sockets 
to dump. Additional information is considered to be family handler specific.

The existing inet_diag code is patched to register himself inside the sock_diag and
provide callbacks for dumping AF_INET/AF_INET6 IPPROTO_TCP/IPPROTO_DCCP sockets. The
existing API facilities such as state filtering and bytecode is of course preserved
and is treated by inet_diag specific data.

Binary compatibility with existing NETLINK_INET_DIAG is also kept.

No additional stuff in this set. The support for IPPROTO_UDP protocol and AF_UNIX
family will come later if this set is approved.

Applies to net-next, patch for iproute2's ss tool (proving that the new code ... pretends
to work) is at the end of the thread.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

^ permalink raw reply

* [PATCH 1/11] inet_diag: Partly rename inet_ to sock_
From: Pavel Emelyanov @ 2011-12-06 17:56 UTC (permalink / raw)
  To: David Miller, Linux Netdev List
In-Reply-To: <4EDE573A.6040607@parallels.com>

The ultimate goal is to get the sock_diag module, that works in
family+protocol terms. Currently this is suitable to do on the
inet_diag basis, so rename parts of the code. It will be moved
to sock_diag.c later.

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>

---
 include/linux/netlink.h  |    2 +-
 net/dccp/diag.c          |    2 +-
 net/ipv4/inet_diag.c     |   33 +++++++++++++++++++--------------
 net/ipv4/tcp_diag.c      |    2 +-
 security/selinux/hooks.c |    2 +-
 5 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/include/linux/netlink.h b/include/linux/netlink.h
index 8374d29..9827ebf 100644
--- a/include/linux/netlink.h
+++ b/include/linux/netlink.h
@@ -8,7 +8,7 @@
 #define NETLINK_UNUSED		1	/* Unused number				*/
 #define NETLINK_USERSOCK	2	/* Reserved for user mode socket protocols 	*/
 #define NETLINK_FIREWALL	3	/* Firewalling hook				*/
-#define NETLINK_INET_DIAG	4	/* INET socket monitoring			*/
+#define NETLINK_SOCK_DIAG	4	/* socket monitoring				*/
 #define NETLINK_NFLOG		5	/* netfilter/iptables ULOG */
 #define NETLINK_XFRM		6	/* ipsec */
 #define NETLINK_SELINUX		7	/* SELinux event notifications */
diff --git a/net/dccp/diag.c b/net/dccp/diag.c
index b21f261..d92ba7d 100644
--- a/net/dccp/diag.c
+++ b/net/dccp/diag.c
@@ -71,4 +71,4 @@ module_exit(dccp_diag_fini);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Arnaldo Carvalho de Melo <acme@mandriva.com>");
 MODULE_DESCRIPTION("DCCP inet_diag handler");
-MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, DCCPDIAG_GETSOCK);
+MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, DCCPDIAG_GETSOCK);
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 0a46c54..a5f3c40 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -45,7 +45,7 @@ struct inet_diag_entry {
 	u16 userlocks;
 };
 
-static struct sock *idiagnl;
+static struct sock *sdiagnl;
 
 #define INET_DIAG_PUT(skb, attrtype, attrlen) \
 	RTA_DATA(__RTA_PUT(skb, attrtype, attrlen))
@@ -56,7 +56,7 @@ static const struct inet_diag_handler *inet_diag_lock_handler(int type)
 {
 	if (!inet_diag_table[type])
 		request_module("net-pf-%d-proto-%d-type-%d", PF_NETLINK,
-			       NETLINK_INET_DIAG, type);
+			       NETLINK_SOCK_DIAG, type);
 
 	mutex_lock(&inet_diag_table_mutex);
 	if (!inet_diag_table[type])
@@ -312,7 +312,7 @@ static int inet_diag_get_exact(struct sk_buff *in_skb,
 		kfree_skb(rep);
 		goto out;
 	}
-	err = netlink_unicast(idiagnl, rep, NETLINK_CB(in_skb).pid,
+	err = netlink_unicast(sdiagnl, rep, NETLINK_CB(in_skb).pid,
 			      MSG_DONTWAIT);
 	if (err > 0)
 		err = 0;
@@ -870,20 +870,25 @@ static int inet_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 				return -EINVAL;
 		}
 
-		return netlink_dump_start(idiagnl, skb, nlh,
+		return netlink_dump_start(sdiagnl, skb, nlh,
 					  inet_diag_dump, NULL, 0);
 	}
 
 	return inet_diag_get_exact(skb, nlh);
 }
 
-static DEFINE_MUTEX(inet_diag_mutex);
+static int sock_diag_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
+{
+	return inet_diag_rcv_msg(skb, nlh);
+}
+
+static DEFINE_MUTEX(sock_diag_mutex);
 
-static void inet_diag_rcv(struct sk_buff *skb)
+static void sock_diag_rcv(struct sk_buff *skb)
 {
-	mutex_lock(&inet_diag_mutex);
-	netlink_rcv_skb(skb, &inet_diag_rcv_msg);
-	mutex_unlock(&inet_diag_mutex);
+	mutex_lock(&sock_diag_mutex);
+	netlink_rcv_skb(skb, &sock_diag_rcv_msg);
+	mutex_unlock(&sock_diag_mutex);
 }
 
 int inet_diag_register(const struct inet_diag_handler *h)
@@ -929,9 +934,9 @@ static int __init inet_diag_init(void)
 	if (!inet_diag_table)
 		goto out;
 
-	idiagnl = netlink_kernel_create(&init_net, NETLINK_INET_DIAG, 0,
-					inet_diag_rcv, NULL, THIS_MODULE);
-	if (idiagnl == NULL)
+	sdiagnl = netlink_kernel_create(&init_net, NETLINK_SOCK_DIAG, 0,
+					sock_diag_rcv, NULL, THIS_MODULE);
+	if (sdiagnl == NULL)
 		goto out_free_table;
 	err = 0;
 out:
@@ -943,11 +948,11 @@ out_free_table:
 
 static void __exit inet_diag_exit(void)
 {
-	netlink_kernel_release(idiagnl);
+	netlink_kernel_release(sdiagnl);
 	kfree(inet_diag_table);
 }
 
 module_init(inet_diag_init);
 module_exit(inet_diag_exit);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_INET_DIAG);
+MODULE_ALIAS_NET_PF_PROTO(PF_NETLINK, NETLINK_SOCK_DIAG);
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 939edb3..9e276b8 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -54,4 +54,4 @@ static void __exit tcp_diag_exit(void)
 module_init(tcp_diag_init);
 module_exit(tcp_diag_exit);
 MODULE_LICENSE("GPL");
-MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_INET_DIAG, TCPDIAG_GETSOCK);
+MODULE_ALIAS_NET_PF_PROTO_TYPE(PF_NETLINK, NETLINK_SOCK_DIAG, TCPDIAG_GETSOCK);
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index cca09bb..86305c2 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -1090,7 +1090,7 @@ static inline u16 socket_type_to_security_class(int family, int type, int protoc
 			return SECCLASS_NETLINK_ROUTE_SOCKET;
 		case NETLINK_FIREWALL:
 			return SECCLASS_NETLINK_FIREWALL_SOCKET;
-		case NETLINK_INET_DIAG:
+		case NETLINK_SOCK_DIAG:
 			return SECCLASS_NETLINK_TCPDIAG_SOCKET;
 		case NETLINK_NFLOG:
 			return SECCLASS_NETLINK_NFLOG_SOCKET;
-- 
1.5.5.6

^ permalink raw reply related


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