Netdev List
 help / color / mirror / Atom feed
* [PATCH 1/5 v2] soreuseport: infrastructure
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

Definitions and macros for implementing soreusport.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 include/linux/random.h            |    6 ++++++
 include/net/sock.h                |    5 ++++-
 include/uapi/asm-generic/socket.h |    3 +--
 net/core/sock.c                   |    7 +++++++
 4 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/include/linux/random.h b/include/linux/random.h
index d984608..347ce55 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -74,4 +74,10 @@ static inline int arch_get_random_int(unsigned int *v)
 }
 #endif
 
+/* Pseudo random number generator from numerical recipes. */
+static inline u32 next_pseudo_random32(u32 seed)
+{
+	return seed * 1664525 + 1013904223;
+}
+
 #endif /* _LINUX_RANDOM_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index 5a34e2f..581dc6b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -140,6 +140,7 @@ typedef __u64 __bitwise __addrpair;
  *	@skc_family: network address family
  *	@skc_state: Connection state
  *	@skc_reuse: %SO_REUSEADDR setting
+ *	@skc_reuseport: %SO_REUSEPORT setting
  *	@skc_bound_dev_if: bound device index if != 0
  *	@skc_bind_node: bind hash linkage for various protocol lookup tables
  *	@skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
@@ -179,7 +180,8 @@ struct sock_common {
 
 	unsigned short		skc_family;
 	volatile unsigned char	skc_state;
-	unsigned char		skc_reuse;
+	unsigned char		skc_reuse:4;
+	unsigned char		skc_reuseport:4;
 	int			skc_bound_dev_if;
 	union {
 		struct hlist_node	skc_bind_node;
@@ -297,6 +299,7 @@ struct sock {
 #define sk_family		__sk_common.skc_family
 #define sk_state		__sk_common.skc_state
 #define sk_reuse		__sk_common.skc_reuse
+#define sk_reuseport		__sk_common.skc_reuseport
 #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
 #define sk_bind_node		__sk_common.skc_bind_node
 #define sk_prot			__sk_common.skc_prot
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 3f6a992..4ef3acb 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -22,8 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
-
+#define SO_REUSEPORT	15
 #ifndef SO_PASSCRED /* powerpc only differs in these */
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
diff --git a/net/core/sock.c b/net/core/sock.c
index 8258fb7..235fb89 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -665,6 +665,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
 	case SO_REUSEADDR:
 		sk->sk_reuse = (valbool ? SK_CAN_REUSE : SK_NO_REUSE);
 		break;
+	case SO_REUSEPORT:
+		sk->sk_reuseport = valbool;
+		break;
 	case SO_TYPE:
 	case SO_PROTOCOL:
 	case SO_DOMAIN:
@@ -972,6 +975,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		v.val = sk->sk_reuse;
 		break;
 
+	case SO_REUSEPORT:
+		v.val = sk->sk_reuseport;
+		break;
+
 	case SO_KEEPALIVE:
 		v.val = sock_flag(sk, SOCK_KEEPOPEN);
 		break;
-- 
1.7.7.3

^ permalink raw reply related

* Re: IPsec AH use of ahash
From: Borislav Petkov @ 2013-01-21  0:34 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Tom St Denis, David Dillow, linux-kernel, netdev
In-Reply-To: <20130120225407.GB5434@home.goodmis.org>

On Sun, Jan 20, 2013 at 05:54:07PM -0500, Steven Rostedt wrote:
> My God, you sound like a 2 year old.
> 
> Suck it up, and do the fixes. It's not the time you are worried about,
> as you most definitely spent more time bitching to everyone than it
> would have taken you to clean up your work.

It's like you're reading my mind... :-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply

* [PATCH 0/5 v2]: soreuseport: Bind multiple sockets to the same port
From: Tom Herbert @ 2013-01-21  0:07 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2693 bytes --]

Changes from previous version for fixing uid handling,
build breakage with TF_PROXY, and indentation.
----
This patch implements so_reuseport (SO_REUSEPORT socket option) for
TCP and UDP.  For TCP, so_reuseport allows multiple listener sockets
to be bound to the same port.  In the case of UDP, so_reuseport allows
multiple sockets to bind to the same port.  To prevent port hijacking
all sockets bound to the same port using so_reuseport must have the
same uid.  Received packets are distributed to multiple sockets bound
to the same port using a 4-tuple hash.

The motivating case for so_resuseport in TCP would be something like
a web server binding to port 80 running with multiple threads, where
each thread might have it's own listener socket.  This could be done
as an alternative to other models: 1) have one listener thread which
dispatches completed connections to workers. 2) accept on a single
listener socket from multiple threads.  In case #1 the listener thread
can easily become the bottleneck with high connection turn-over rate.
In case #2, the proportion of connections accepted per thread tends
to be uneven under high connection load (assuming simple event loop:
while (1) { accept(); process() }, wakeup does not promote fairness
among the sockets.  We have seen the  disproportion to be as high
as 3:1 ratio between thread accepting most connections and the one
accepting the fewest.  With so_reusport the distribution is
uniform.

The TCP implementation has a problem in that the request sockets for a
listener are attached to a listener socket.  If a SYN is received, a
listener socket is chosen and request structure is created (SYN-RECV
state).  If the subsequent ack in 3WHS does not match the same port
by so_reusport, the connection state is not found (reset) and the
request structure is orphaned.  This scenario would occur when the
number of listener sockets bound to a port changes (new ones are
added, or old ones closed).  We are looking for a solution to this,
maybe allow multiple sockets to share the same request table...

The motivating case for so_reuseport in UDP would be something like a
DNS server.  An alternative would be to recv on the same socket from
multiple threads.  As in the case of TCP, the load across these threads
tends to be disproportionate and we also see a lot of contection on
the socket lock.  Note that SO_REUSEADDR already allows multiple UDP
sockets to bind to the same port, however there is no provision to
prevent hijacking and nothing to distribute packets across all the
sockets sharing the same bound port.  This patch does not change the
semantics of SO_REUSEADDR, but provides usable functionality of it
for unicast.

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Tom St Denis @ 2013-01-21  0:40 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: David Dillow, linux-kernel, netdev, Steven Rostedt
In-Reply-To: <20130121003441.GA19447@pd.tnic>



----- Original Message -----
> From: "Borislav Petkov" <bp@alien8.de>
> To: "Steven Rostedt" <rostedt@goodmis.org>
> Cc: "Tom St Denis" <tstdenis@elliptictech.com>, "David Dillow" <dave@thedillows.org>, linux-kernel@vger.kernel.org,
> netdev@vger.kernel.org
> Sent: Sunday, 20 January, 2013 7:34:41 PM
> Subject: Re: IPsec AH use of ahash
> 
> On Sun, Jan 20, 2013 at 05:54:07PM -0500, Steven Rostedt wrote:
> > My God, you sound like a 2 year old.
> > 
> > Suck it up, and do the fixes. It's not the time you are worried
> > about,
> > as you most definitely spent more time bitching to everyone than it
> > would have taken you to clean up your work.
> 
> It's like you're reading my mind... :-)

The problem is for me to add the ()'s is a no brainer.

For me to re-write complete statements for coding style reasons means I have to actually go out and test it again.  In a proper IPsec lab that can take a couple of hours to make sure it's been run through its paces.  That's [among other things] the problem I have.  Re-writing perfectly good code because it doesn't meet coding "standards" that nobody else seems to match.

If you guys can't appreciate that I should just bow out of the discussion.  I didn't come here looking for a fight I came here to seek reason.

Tom

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Tom St Denis @ 2013-01-21  0:46 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, netdev, David Dillow
In-Reply-To: <8b7b5c2c-1e9f-4390-8492-a21cf8566d55@email.android.com>



----- Original Message -----
> From: "Alan Cox" <alan@lxorguk.ukuu.org.uk>
> To: "Tom St Denis" <tstdenis@elliptictech.com>, "David Dillow" <dave@thedillows.org>
> Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
> Sent: Sunday, 20 January, 2013 3:30:49 PM
> Subject: Re: IPsec AH use of ahash
> 
> Look at it from the kernel end. What happens if your change shows up
> bugs on another architecture or has a flaw. It works for you now but
> you plan to dump and run. That's not a viable long term development
> model for upstream.

Alan, I'm really not trying to be rude but if you look at the depth of the patch I was submitting ... it's not architecture specific, it's 90% copied from another source file that is currently in the tree, I have actually tested it on x86_32/arm already as it is, etc.  I agree that more core pieces of architecture specific code would require tighter scrutiny but this is hardly the case here. 

> The licence allows you to do it, and other parties who care more to
> pick it up and run with it. Unless someone does however it's just a
> burden. If nobody wants it upstream enough better it stays out
> perhaps - if the call is wrong eventually other people will care
> enoug to share the work. If not you get to pick between doing the
> extra or re-porting your code to new releases

Realistically, the CryptoAPI maintainers should have added CMAC long ago.  I mean they sought fit to add non-standard modes like VMAC or Serpent [or Twofish or ...] but not a NIST standard like CMAC which is used in RFCs for IPsec [among other things]?  Are they writing crypto for Kernel users or is this their pet project where they get to hack together random bits of ciphering what not for their own amusement?

Sure few people are clamouring to use CMAC over say HMAC for MAC generation but it is a standard and it's prevalent enough that supporting it is a good idea.

Forcing me to go through a new testing cycle just because you'd prefer

if (expr)
   foo;

Instead of 

if (expr) {
   foo;
}

or 

err = expr;
if (err) ...

instead of 

if ((err = expr)) ...

is not a good use of anyones time.  And it's hypocritical given that I sourced that coding style from code that is already in the kernel.

Tom

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Tom St Denis @ 2013-01-21  0:47 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Borislav Petkov, Eric Dumazet, Waskiewicz Jr, Peter P,
	David Miller, steffen klassert, herbert, linux-kernel, netdev,
	Michal Kubecek, Mike Galbraith
In-Reply-To: <20130120220721.GA5434@home.goodmis.org>



----- Original Message -----
> From: "Steven Rostedt" <rostedt@goodmis.org>
> To: "Tom St Denis" <tstdenis@elliptictech.com>
> Cc: "Borislav Petkov" <bp@alien8.de>, "Eric Dumazet" <erdnetdev@gmail.com>, "Waskiewicz Jr, Peter P"
> <peter.p.waskiewicz.jr@intel.com>, "David Miller" <davem@davemloft.net>, "steffen klassert"
> <steffen.klassert@secunet.com>, herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
> "Michal Kubecek" <mkubecek@suse.cz>, "Mike Galbraith" <bitbucket@online.de>
> Sent: Sunday, 20 January, 2013 5:07:22 PM
> Subject: Re: IPsec AH use of ahash
> 
> On Sun, Jan 20, 2013 at 07:56:27AM -0500, Tom St Denis wrote:
> > 
> > You should really try running checkpatch.pl over code that's
> > already in the kernel before you call out new contributors on it.
> > 
> > How is this supposed to not be adversarial when I can't even use
> > the Kernel source itself as a reference?
> 
> So there's a lot of crap code in the kernel (that we are trying to
> clean
> up when we have the time... see Kernel Janitors). But that's still no
> excuse to allow more crap code to enter. That means adding more crap
> to
> clean up.

Nowhere in the coding guidelines I've seen thus far says that you have to comment or document your code.

I wouldn't consider fixing "crap" code to mean to change indentation style [unless the original is horrible].  It's pointless busy work at best.

If you want to improve the quality of the code I'd start with /* and end with */ once in a while.

Tom

^ permalink raw reply

* Re: Redefinition of struct in6_addr in <netinet/in.h> and <linux/in6.h>
From: Mike Frysinger @ 2013-01-21  0:54 UTC (permalink / raw)
  To: Pedro Alves
  Cc: YOSHIFUJI Hideaki, Carlos O'Donell, David Miller, libc-alpha,
	bhutchings, amwang, tmb, eblake, netdev, linux-kernel,
	libvirt-list, tgraf, schwab
In-Reply-To: <50F95DF3.7080602@redhat.com>

[-- Attachment #1: Type: Text/Plain, Size: 1580 bytes --]

On Friday 18 January 2013 09:36:35 Pedro Alves wrote:
> On 01/18/2013 02:24 PM, YOSHIFUJI Hideaki wrote:
> >>>> It's simple enough to move all of the __GLIBC__ uses into
> >>>> libc-compat.h, then you control userspace libc coordination from one
> >>>> file.
> >>> 
> >>> How about just deciding on a single macro/symbol both the
> >>> kernel and libc (any libc that needs this) define?  Something
> >>> like both the kernel and userland doing:
> >>> 
> >>> #ifndef __IPV6_BITS_DEFINED
> >>> #define __IPV6_BITS_DEFINED
> >>> ...
> >>> define in6_addr, sockaddr_in6, ipv6_mreq, whatnot
> >>> #endif
> > 
> > Hmm, how should we handle future structs/enums then?
> > For example, if I want to have in6_flowlabel_req{} defined in
> > glibc, what should we do?
> 
> Include the glibc header first?  Or is this some other
> use case?
> 
> The point wasn't that you'd have only one macro for all
> structs/enums (you could split into __IPV6_IN6_ADDR_DEFINED,
> __IPV6_SOCKADDR_IN6_DEFINED, etc.) but to have the kernel
> and libc agree on guard macros, instead of having the kernel
> do #ifdef __GLIBC__ and glibc doing #ifdef _NETINET_IN_H.
> 
> But as Carlos says, the devil is in the details, and
> I sure am not qualified on the details here.

i shipped some kernel header versions in Gentoo where the linux network 
headers would include the C library's header (as defined by POSIX) so the 
structs that were the same would only come from glibc.  the only reported 
breakage was due to defines that the kernel provided but glibc did not.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply

* Re: IPsec AH use of ahash
From: Borislav Petkov @ 2013-01-21  1:08 UTC (permalink / raw)
  To: Tom St Denis; +Cc: David Dillow, linux-kernel, netdev, Steven Rostedt
In-Reply-To: <861997288.94032.1358728848956.JavaMail.root@elliptictech.com>

On Sun, Jan 20, 2013 at 07:40:49PM -0500, Tom St Denis wrote:
> If you guys can't appreciate that I should just bow out of the
> discussion. I didn't come here looking for a fight I came here to seek
> reason.

Ok, I'm going to pretty much repeat what Steve said but I'm going to
repeat it only once and if you don't want to understand it then, don't
even bother replying.

If you want to get your code in the kernel, simply do what the
maintainer asks you and stop debating. He's not asking you to swallow
knifes or walk on embers or some other crazy shit - he asks you
reasonable stuff and he *knows* that code needs testing and that it
takes a while but this is a price we all pay. Accept it.

You're not the only one being asked to retest stuff and you're not going
to be the last one so stop wasting your time and get something done
instead.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply

* Re: [PATCH RESEND 01/10] netfilter: move nf_conntrack initialize out of pernet operations
From: Pablo Neira Ayuso @ 2013-01-21  1:08 UTC (permalink / raw)
  To: Gao feng; +Cc: netfilter-devel, netdev, kaber, ebiederm, canqunzhang
In-Reply-To: <1358504190-6094-1-git-send-email-gaofeng@cn.fujitsu.com>

Hi Gao,

On Fri, Jan 18, 2013 at 06:16:21PM +0800, Gao feng wrote:
> Right now,the netfilter initialize and cleanup codes are
> in pernet operations function.
> This job should be done in module_init/exit.We can't use
> init_net to identify if it's the right time to initialize
> or cleanup.

nf-next$ patch -p1 < /tmp/RESEND-01-10-netfilter-move-nf_conntrack-initialize-out-of-pernet-operations.patch
patching file include/net/netfilter/nf_conntrack_core.h
patching file net/netfilter/nf_conntrack_core.c
Hunk #1 succeeded at 1334 (offset 3 lines).
Hunk #2 succeeded at 1350 (offset 3 lines).
Hunk #3 FAILED at 1368.
Hunk #4 succeeded at 1383 (offset 4 lines).
Hunk #5 succeeded at 1473 (offset 4 lines).
Hunk #6 succeeded at 1521 (offset 4 lines).
Hunk #7 succeeded at 1538 (offset 4 lines).
Hunk #8 FAILED at 1588.
Hunk #9 succeeded at 1627 (offset 12 lines).
2 out of 9 hunks FAILED -- saving rejects to file
net/netfilter/nf_conntrack_core.c.rej
patching file net/netfilter/nf_conntrack_standalone.c

What tree have you used to rebase your patches? Please, use nf-next as
base.

^ permalink raw reply

* Re: [PATCH RESEND 01/10] netfilter: move nf_conntrack initialize out of pernet operations
From: Gao feng @ 2013-01-21  1:27 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel, netdev, kaber, ebiederm, canqunzhang
In-Reply-To: <20130121010839.GA26149@1984>

Hi pablo,

On 2013/01/21 09:08, Pablo Neira Ayuso wrote:
> Hi Gao,
> 
> On Fri, Jan 18, 2013 at 06:16:21PM +0800, Gao feng wrote:
>> Right now,the netfilter initialize and cleanup codes are
>> in pernet operations function.
>> This job should be done in module_init/exit.We can't use
>> init_net to identify if it's the right time to initialize
>> or cleanup.
> 
> nf-next$ patch -p1 < /tmp/RESEND-01-10-netfilter-move-nf_conntrack-initialize-out-of-pernet-operations.patch
> patching file include/net/netfilter/nf_conntrack_core.h
> patching file net/netfilter/nf_conntrack_core.c
> Hunk #1 succeeded at 1334 (offset 3 lines).
> Hunk #2 succeeded at 1350 (offset 3 lines).
> Hunk #3 FAILED at 1368.
> Hunk #4 succeeded at 1383 (offset 4 lines).
> Hunk #5 succeeded at 1473 (offset 4 lines).
> Hunk #6 succeeded at 1521 (offset 4 lines).
> Hunk #7 succeeded at 1538 (offset 4 lines).
> Hunk #8 FAILED at 1588.
> Hunk #9 succeeded at 1627 (offset 12 lines).
> 2 out of 9 hunks FAILED -- saving rejects to file
> net/netfilter/nf_conntrack_core.c.rej
> patching file net/netfilter/nf_conntrack_standalone.c
> 
> What tree have you used to rebase your patches? Please, use nf-next as
> base.

I used the last net-next tree.
Get it,I will rebase this patchset base on nf-next.

Thanks.

^ permalink raw reply

* Re: [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure
From: Vlad Yasevich @ 2013-01-21  1:50 UTC (permalink / raw)
  To: Stephen Hemminger
  Cc: Michał Mirosław, netdev, bridge, davem, shemminger, mst,
	shmulik.ladkani
In-Reply-To: <20130120113825.759b4a58@nehalam.linuxnetplumber.net>

On 01/20/2013 02:38 PM, Stephen Hemminger wrote:
> On Sun, 20 Jan 2013 12:59:22 -0500
> Vlad Yasevich <vyasevic@redhat.com> wrote:
>
>> On 01/17/2013 08:57 PM, Michał Mirosław wrote:
>>> 2013/1/16 Vlad Yasevich <vyasevic@redhat.com>:
>>> [...]
>>>> --- /dev/null
>>>> +++ b/net/bridge/br_vlan.c
>>> [...]
>>>> +struct net_port_vlan *nbp_vlan_find(const struct net_port_vlans *v, u16 vid)
>>>> +{
>>>> +       struct net_port_vlan *pve;
>>>> +
>>>> +       /* Must be done either in rcu critical section or with RTNL held */
>>>> +       WARN_ON_ONCE(!rcu_read_lock_held() && !rtnl_is_locked());
>>>> +
>>>> +       list_for_each_entry_rcu(pve, &v->vlan_list, list) {
>>>> +               if (pve->vid == vid)
>>>> +                       return pve;
>>>> +       }
>>>> +
>>>> +       return NULL;
>>>> +}
>>>
>>> This looks expensive - it's O(n) with n = number of configured VLANs on a port.
>>> And this is called for every packet. The bridge already has a hash of VLAN
>>> structures found by br_vlan_find(). You could add a second bitmap there
>>> (eg. ingres_ports[]) and check port's bit instead of walking the list.
>>> You would use a bit more memory (64 bytes minus the removed list-head)
>>> per configured VLAN but save some cycles in hot path.
>>>
>>
>> Technically wouldn't even need another bitmap as an existing membership
>> bitmap would cover this case.  I did some profiling and the list is
>> faster for 3 vlans per port.  Hash is faster for more then 3 vlans.
>>
>> I can easily switch to hash if that is what others think.
>>
>> -vlad
>
> Let's assume the people that really want this feature are using a lot
> of vlan's. i.e n = 1000 or so. A bitmap is O(1). Any hash list would
> incur a just a big memory penalty for the list head. In other words
> a full bitmap is 4096 bits = 512 bytes.  If you use hash list,
> then the equivalent memory size would be only 64 list heads, therefore
> a bitmap is a better choice than a hlist.
>
>

This was the approach taken in the RFC v1 of this series.  What I found 
was that while it worked very well as far as speed goes, it was a bit 
cumbersome to extend it to support pvids and it would completely fall
on its face for egress policy that Shmulik is suggesting.  So any kinds 
of extensions to it were tough to do.

This is why I went with the list.  Interestingly enough, VLAN 
implementation in the kernel is a list and noone is complaining that it 
is really slow on the fast path.

-vlad

^ permalink raw reply

* Re: [PATCH net-next V6 02/14] bridge: Add vlan filtering infrastructure
From: Vlad Yasevich @ 2013-01-21  1:56 UTC (permalink / raw)
  To: Shmulik Ladkani; +Cc: netdev, bridge, davem, shemminger, mst
In-Reply-To: <20130120233851.3f589fa4.shmulik.ladkani@gmail.com>

On 01/20/2013 04:38 PM, Shmulik Ladkani wrote:
> Hi Vlad,
>
> On Wed, 16 Jan 2013 13:17:57 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
>> @@ -156,6 +183,7 @@ struct net_bridge_port
>>   #ifdef CONFIG_NET_POLL_CONTROLLER
>>   	struct netpoll			*np;
>>   #endif
>> +	struct net_port_vlans		vlan_info;
>
> (here and at 'struct net_bridge' as well)
>
> Not sure what the policy is; Isn't it preferred to enclose the new
> fields under CONFIG_BRIDGE_VLAN_FILTERING?

Good catch.  Missed this one.

>
>> +static inline struct net_bridge *vlans_to_bridge(struct net_port_vlans *vlans)
>> +{
>> +	struct net_bridge *br;
>> +
>> +	if (!vlans->port_idx)
>> +		br = container_of((vlans), struct net_bridge, vlan_info);
>> +	else
>> +		br = vlans_to_port(vlans)->br;
>> +
>> +	return br;
>> +}
>
> Guess it would simplify things if the bridge "master port" had an 'nbp'
> representation of its own ;-)

Yes that would simplify things for this case, but it will also add a lot 
of state that's not necessary. I considered doing this, but the master 
device doesn't really act as  port in on things, just some.

>
>> +extern struct net_bridge_vlan *br_vlan_find(struct net_bridge *br, u16 vid);
>
> Seems 'br_vlan_find' can be declared static within br_vlan.c.

Will check.

>
>> +extern void br_vlan_flush(struct net_bridge *br);
>
> According to your preference, consider s/br_vlan_flush/br_vlans_flush/
> since it better suggest acting on all bridge's vlans.
>
>> +extern void nbp_vlan_flush(struct net_port_vlans *vlans);
>
> According to your preference, consider s/nbp_vlan_flush/nbp_vlans_flush/
> since it better suggest acting on all port's vlans.
>
>> +void br_vlan_flush(struct net_bridge *br)
>> +{
>> +	struct net_bridge_vlan *vlan;
>> +	struct hlist_node *node;
>> +	struct hlist_node *tmp;
>> +	int i;
>> +
>> +	nbp_vlan_flush(&br->vlan_info);
>> +
>> +	/* Make sure that there are no vlans left in the bridge after
>> +	* all the ports have been removed.
>> +	*/
>
> Improper indent.

will fix

>
>> +	for (i = 0; i < BR_VID_HASH_SIZE; i++) {
>> +		hlist_for_each_entry_safe(vlan, node, tmp,
>> +					  &br->vlan_hlist[i], hlist) {
>> +			br_vlan_del(vlan);
>
> Can there be any vlans left at that point? Shouldn't del_nbp() on all
> ports take care of that?

I think this function might have been a leftover from prior series when
bridge didn't have its vlan list.  With the new series, I don't this it 
is needed.  I'll double-check.

Thanks
-vlad

> Also, if there _were_ any vlans left (whose bitmap isn't cleared),
> 'br_vlan_del' won't do a thing.
> Am I missing something?
>
> Regards,
> Shmulik
>

^ permalink raw reply

* Re: [PATCH net-next V6 03/14] bridge: Validate that vlan is permitted on ingress
From: Vlad Yasevich @ 2013-01-21  1:58 UTC (permalink / raw)
  To: Shmulik Ladkani; +Cc: netdev, bridge, davem, shemminger, mst
In-Reply-To: <20130121002710.5189a959.shmulik.ladkani@gmail.com>

On 01/20/2013 05:27 PM, Shmulik Ladkani wrote:
> Hi Vlad,
>
> On Wed, 16 Jan 2013 13:17:58 -0500 Vlad Yasevich <vyasevic@redhat.com> wrote:
>> @@ -45,6 +45,9 @@ netdev_tx_t br_dev_xmit(struct sk_buff *skb, struct net_device *dev)
>>   	brstats->tx_bytes += skb->len;
>>   	u64_stats_update_end(&brstats->syncp);
>>
>> +	if (!br_allowed_ingress(&br->vlan_info, skb))
>> +		goto out;
>> +
>
> Shouldn't you consume the 'skb' in case "not allowed"? the 'out' label
> doesn't take care of that.
>
>> +bool br_allowed_ingress(struct net_port_vlans *v, struct sk_buff *skb)
>> +{
>> +	struct net_port_vlan *pve;
>> +	u16 vid;
>> +
>> +	/* If there are no vlan in the permitted list, all packets are
>> +	 * permitted.
>> +	 */
>> +	if (list_empty(&v->vlan_list))
>> +		return true;
>
> Rethinking this, after discussed at [1].
> The above means the port having no vlans is actually a member of every
> possible vlan.
> IMO it might not be what users expect, and may complicate things.
>
> Maybe we should adapt a simpler approach:
> If the bridge is a vlan enabled bridge, and the port is not a member of
> the given vid, drop.
> If the bridge is "vlan disabled", then all packets are permitted.
>

this is hybrid configuration where some ports have vlan filtering 
enabled while others do not.

Currently the default is to act as a non-vlan bridge when there is no 
configuration.  I'll consider adding a configuration nob to switch the 
behavior so that strict filtering can be enforced.

-vlad

> Regards,
> Shmulik
>
> [1]
> http://marc.info/?l=linux-netdev&m=135602065425514&w=2
>

^ permalink raw reply

* Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform
From: Wei Shuai @ 2013-01-21  2:20 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: dcbw, davem, peter, oneukum, gregkh, alexey.orishko, bjorn,
	linux-usb, netdev
In-Reply-To: <50FC25B7.70708@mvista.com>

The main problem is that these devices don't support ethernet.  They
support IP (v4 and _maybe_ v6) with an ethernet header.  Many of them
will do ARP (and IPv6 ND) as well to complete the picture, but some of
them don't and that's what these drivers try to deal with.

Note that most of the devices will run a DHCP server, so there is some
sort of IP broadcast support.  Whether that qualifies as proper ethernet
broadcast support is another question...

These devices are attempting to bridge an IP-only point-to-point
interface and an ethernet over USB interface, with the intention to make
the point-to-point interface look like ethernet to applications and
users. This is of course always going to be imperfect.  But I believe
that we should aim to help the firmware achive this goal when writing
drivers instead of working against it.  Setting IFF_NOARP and not
IFF_POINTTOPOINT is one way to do that. ---- by  Bjorn Mork <bjorn@mork.no>

2013/1/21, Sergei Shtylyov <sshtylyov@mvista.com>:
> Hello.
>
> On 20-01-2013 10:12, Wei Shuai wrote:
>
>> Infineon(now Intel) HSPA Modem platform NCM cannot support ARP. we can
>> define a new common structure wwan_noarp_info.
>
>     Wrap your lines at 76-80 columns maximum please.
>
>> Then more similiar NO ARP devices can be handled easily
>
>
>> Signed-off-by: Wei Shuai <cpuwolf@gmail.com>
>> ---
>>   drivers/net/usb/cdc_ncm.c |   21 +++++++++++++++++++++
>>   1 files changed, 21 insertions(+), 0 deletions(-)
>
>> diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
>> index 71b6e92..2d699b6 100644
>> --- a/drivers/net/usb/cdc_ncm.c
>> +++ b/drivers/net/usb/cdc_ncm.c
>> @@ -1155,6 +1155,20 @@ static const struct driver_info wwan_info = {
>>   	.tx_fixup = cdc_ncm_tx_fixup,
>>   };
>>
>> +/* Same as wwan_info, but with IFF_NOARP  */
>
>     FLAG_NOARP, you mean?
>
>> +static const struct driver_info wwan_noarp_info = {
>> +	.description = "Mobile Broadband Network Device (NO ARP)",
>> +	.flags = FLAG_POINTTOPOINT | FLAG_NO_SETINT | FLAG_MULTI_PACKET
>> +			| FLAG_WWAN | FLAG_NOARP,
>
> WBR, Sergei
>
>

^ permalink raw reply

* Re: [RFC:] struct net_device_ops: Add function pointer to fill device specific ndisc information
From: YOSHIFUJI Hideaki @ 2013-01-21  2:29 UTC (permalink / raw)
  To: stephan.gatzka; +Cc: linux1394-devel, netdev, David Miller
In-Reply-To: <50FC6068.3020302@gmail.com>

Stephan Gatzka wrote:
> On 01/20/2013 07:47 PM, YOSHIFUJI Hideaki wrote:
> 
>> My current position is to change "mac address" to
>>
>> struct fwnet_hwaddr {
>>     u8    guid[8];
>>     u8    max_rec;
>>     u8    sspd;
>>     u8    fifo[6];
>> };
>>
> 
> That is something I'm not really convinced of. As Stefan Richter pointed out clearly, the fifo address might be different between IPv4 and IPv6 communication.

We could have multiple "net_device"s per single physical
interface at the same time, then.

Multicast is a big issue.  Because IPv6 is fan of
multicast, and it uses link-local multicast as its
core infrastructure.  Without infrastructure to
support it, I'm not going to agree.

And, firewire driver does not seem to support zerocopy
(fragmented skb) support.  It help performance.

--yoshfuji

^ permalink raw reply

* Re: [PATCH 2/5 v2] soreuseport: TCP/IPv4 implementation
From: YOSHIFUJI Hideaki @ 2013-01-21  2:30 UTC (permalink / raw)
  To: Tom Herbert; +Cc: netdev, davem, netdev, eric.dumazet
In-Reply-To: <alpine.DEB.2.00.1301201542510.834@pokey.mtv.corp.google.com>

Tom Herbert wrote:

> +		} else if (score == hiscore && reuseport) {
> +			matches++;
> +			if (((u64)phash * matches) >> 32 == 0)
> +				result = sk;
> +			phash = next_pseudo_random32(phash);
>  		}
>  	}
>  	/*

Well, honestly, this seems the most difficult part to understand
at a glance.  Plus, there seems multiple ways to do this.
Maybe, inline?

static inline sock_true_1_in_n(u32 r, unsigned int n)
{
	/* return (r < ~0U / n); */
	/* return (r % n == 0); */
	return ((u64)r * n >> 32) == 0;
}

^ permalink raw reply

* Re: [PATCH net-next 0/5] ADDRCONF/NDISC improvements
From: David Miller @ 2013-01-21  3:30 UTC (permalink / raw)
  To: yoshfuji; +Cc: netdev
In-Reply-To: <50FC2B97.7020601@linux-ipv6.org>

From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Date: Mon, 21 Jan 2013 02:38:31 +0900

> These are for address comparison improvements and boolean conversion.
> 
> YOSHIFUJI Hideaki (5):
>   ipv6: Make ipv6_addr_is_XXX() return boolean.
>   ipv6: Introduce ipv6_addr_is_solict_mult() to check Solicited Node
>     Multicast Addresses.
>   ipv6: Optimize ipv6_addr_is_solict_mult().
>   ipv6: Optimize ipv6_addr_is_ll_all_{nodes,routers}().
>   ndisc: Make several arguments for ndisc_send_na() boolean.

All applied, thanks.

^ permalink raw reply

* Re: [PATCH 5/5] drivers: atm: checkpatch.pl fixed coding style issues in eni.c
From: David Miller @ 2013-01-21  4:04 UTC (permalink / raw)
  To: patrik.karlin; +Cc: chas, linux-atm-general, netdev, linux-kernel
In-Reply-To: <1358723575-8345-5-git-send-email-patrik.karlin@gmail.com>

From: Patrik Karlin <patrik.karlin@gmail.com>
Date: Mon, 21 Jan 2013 00:12:55 +0100

> This patch fixes statement placement around if/else/for statments
> as suggested by checkpatch.pl
> 
> Signed-off-by: Patrik Kårlin <patrik.karlin@gmail.com>

This patch set is a good example of why nobody should
fix up coding style in such a robotic way in response
to codingstyle.pl complaints.

> -		    ATM_MAX_AAL5_PDU) eff = (length+3) >> 2;
> +		    ATM_MAX_AAL5_PDU) 

I bet you didn't even notice that in this change you are adding
trailing whitespace, the exact problem you fixed up for this file in a
previous patch of the series.

I really would encourage you to work on something else entirely.

Thanks.

^ permalink raw reply

* Re: [PATCH 1/5 v2] soreuseport: infrastructure
From: David Miller @ 2013-01-21  4:06 UTC (permalink / raw)
  To: therbert; +Cc: netdev, netdev, eric.dumazet
In-Reply-To: <alpine.DEB.2.00.1301201542520.924@pokey.mtv.corp.google.com>

From: Tom Herbert <therbert@google.com>
Date: Sun, 20 Jan 2013 16:07:22 -0800 (PST)

> diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
> index 3f6a992..4ef3acb 100644
> --- a/include/uapi/asm-generic/socket.h
> +++ b/include/uapi/asm-generic/socket.h
> @@ -22,8 +22,7 @@
>  #define SO_PRIORITY	12
>  #define SO_LINGER	13
>  #define SO_BSDCOMPAT	14
> -/* To add :#define SO_REUSEPORT 15 */
> -
> +#define SO_REUSEPORT	15
>  #ifndef SO_PASSCRED /* powerpc only differs in these */
>  #define SO_PASSCRED	16
>  #define SO_PEERCRED	17

A new value needs to be added for every architecture, rather than just
the ones that happen to use this asm-generic/socket.h file.

^ permalink raw reply

* [PATCH 1/5 v3] soreuseport: infrastructure
From: Tom Herbert @ 2013-01-21  4:08 UTC (permalink / raw)
  To: netdev, davem; +Cc: netdev, eric.dumazet

Definitions and macros for implementing soreusport.
Includes defining SO_REUSEPORT in arch headers.

Signed-off-by: Tom Herbert <therbert@google.com>
---
 arch/alpha/include/uapi/asm/socket.h   |    2 +-
 arch/avr32/include/uapi/asm/socket.h   |    2 +-
 arch/cris/include/uapi/asm/socket.h    |    2 +-
 arch/frv/include/uapi/asm/socket.h     |    2 +-
 arch/h8300/include/uapi/asm/socket.h   |    2 +-
 arch/ia64/include/uapi/asm/socket.h    |    2 +-
 arch/m32r/include/uapi/asm/socket.h    |    2 +-
 arch/mips/include/uapi/asm/socket.h    |    3 +--
 arch/mn10300/include/uapi/asm/socket.h |    2 +-
 arch/parisc/include/uapi/asm/socket.h  |    2 +-
 arch/powerpc/include/uapi/asm/socket.h |    2 +-
 arch/s390/include/uapi/asm/socket.h    |    2 +-
 arch/sparc/include/uapi/asm/socket.h   |    2 +-
 arch/xtensa/include/uapi/asm/socket.h  |    2 +-
 include/linux/random.h                 |    6 ++++++
 include/net/sock.h                     |    5 ++++-
 include/uapi/asm-generic/socket.h      |    3 +--
 net/core/sock.c                        |    7 +++++++
 18 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/arch/alpha/include/uapi/asm/socket.h b/arch/alpha/include/uapi/asm/socket.h
index 755702e..c519552 100644
--- a/arch/alpha/include/uapi/asm/socket.h
+++ b/arch/alpha/include/uapi/asm/socket.h
@@ -19,7 +19,7 @@
 #define SO_BROADCAST	0x0020
 #define SO_LINGER	0x0080
 #define SO_OOBINLINE	0x0100
-/* To add :#define SO_REUSEPORT 0x0200 */
+#define SO_REUSEPORT	0x0200
 
 #define SO_TYPE		0x1008
 #define SO_ERROR	0x1007
diff --git a/arch/avr32/include/uapi/asm/socket.h b/arch/avr32/include/uapi/asm/socket.h
index f3f38a0..51c6401 100644
--- a/arch/avr32/include/uapi/asm/socket.h
+++ b/arch/avr32/include/uapi/asm/socket.h
@@ -22,7 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/cris/include/uapi/asm/socket.h b/arch/cris/include/uapi/asm/socket.h
index 406b583..50692b7 100644
--- a/arch/cris/include/uapi/asm/socket.h
+++ b/arch/cris/include/uapi/asm/socket.h
@@ -24,7 +24,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h
index d8e1132..595391f 100644
--- a/arch/frv/include/uapi/asm/socket.h
+++ b/arch/frv/include/uapi/asm/socket.h
@@ -22,7 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/h8300/include/uapi/asm/socket.h b/arch/h8300/include/uapi/asm/socket.h
index c8b87a8..43e3262 100644
--- a/arch/h8300/include/uapi/asm/socket.h
+++ b/arch/h8300/include/uapi/asm/socket.h
@@ -22,7 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/ia64/include/uapi/asm/socket.h b/arch/ia64/include/uapi/asm/socket.h
index f390896..c567adc 100644
--- a/arch/ia64/include/uapi/asm/socket.h
+++ b/arch/ia64/include/uapi/asm/socket.h
@@ -31,7 +31,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h
index 6a89515..519afa2 100644
--- a/arch/m32r/include/uapi/asm/socket.h
+++ b/arch/m32r/include/uapi/asm/socket.h
@@ -22,7 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/mips/include/uapi/asm/socket.h b/arch/mips/include/uapi/asm/socket.h
index 9d11a77..7e27236 100644
--- a/arch/mips/include/uapi/asm/socket.h
+++ b/arch/mips/include/uapi/asm/socket.h
@@ -28,8 +28,7 @@
 #define SO_LINGER	0x0080	/* Block on close of a reliable
 				   socket to transmit pending data.  */
 #define SO_OOBINLINE 0x0100	/* Receive out-of-band data in-band.  */
-#if 0
-To add: #define SO_REUSEPORT 0x0200	/* Allow local address and port reuse.  */
+#define SO_REUSEPORT 0x0200	/* Allow local address and port reuse.  */
 #endif
 
 #define SO_TYPE		0x1008	/* Compatible name for SO_STYLE.  */
diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h
index ab702c4..5c7c7c9 100644
--- a/arch/mn10300/include/uapi/asm/socket.h
+++ b/arch/mn10300/include/uapi/asm/socket.h
@@ -22,7 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/parisc/include/uapi/asm/socket.h b/arch/parisc/include/uapi/asm/socket.h
index da2c8d3..526e4b9 100644
--- a/arch/parisc/include/uapi/asm/socket.h
+++ b/arch/parisc/include/uapi/asm/socket.h
@@ -13,7 +13,7 @@
 #define SO_BROADCAST	0x0020
 #define SO_LINGER	0x0080
 #define SO_OOBINLINE	0x0100
-/* To add :#define SO_REUSEPORT 0x0200 */
+#define SO_REUSEPORT	0x0200
 #define SO_SNDBUF	0x1001
 #define SO_RCVBUF	0x1002
 #define SO_SNDBUFFORCE	0x100a
diff --git a/arch/powerpc/include/uapi/asm/socket.h b/arch/powerpc/include/uapi/asm/socket.h
index e6ca318..a26dcae 100644
--- a/arch/powerpc/include/uapi/asm/socket.h
+++ b/arch/powerpc/include/uapi/asm/socket.h
@@ -29,7 +29,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_RCVLOWAT	16
 #define SO_SNDLOWAT	17
 #define SO_RCVTIMEO	18
diff --git a/arch/s390/include/uapi/asm/socket.h b/arch/s390/include/uapi/asm/socket.h
index 9ce60b6..f99eea7 100644
--- a/arch/s390/include/uapi/asm/socket.h
+++ b/arch/s390/include/uapi/asm/socket.h
@@ -28,7 +28,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/arch/sparc/include/uapi/asm/socket.h b/arch/sparc/include/uapi/asm/socket.h
index fbbba57..cbbad74 100644
--- a/arch/sparc/include/uapi/asm/socket.h
+++ b/arch/sparc/include/uapi/asm/socket.h
@@ -15,7 +15,7 @@
 #define SO_PEERCRED	0x0040
 #define SO_LINGER	0x0080
 #define SO_OOBINLINE	0x0100
-/* To add :#define SO_REUSEPORT 0x0200 */
+#define SO_REUSEPORT	0x0200
 #define SO_BSDCOMPAT    0x0400
 #define SO_RCVLOWAT     0x0800
 #define SO_SNDLOWAT     0x1000
diff --git a/arch/xtensa/include/uapi/asm/socket.h b/arch/xtensa/include/uapi/asm/socket.h
index dbf3164..35905cb 100644
--- a/arch/xtensa/include/uapi/asm/socket.h
+++ b/arch/xtensa/include/uapi/asm/socket.h
@@ -32,7 +32,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
+#define SO_REUSEPORT	15
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
 #define SO_RCVLOWAT	18
diff --git a/include/linux/random.h b/include/linux/random.h
index d984608..347ce55 100644
--- a/include/linux/random.h
+++ b/include/linux/random.h
@@ -74,4 +74,10 @@ static inline int arch_get_random_int(unsigned int *v)
 }
 #endif
 
+/* Pseudo random number generator from numerical recipes. */
+static inline u32 next_pseudo_random32(u32 seed)
+{
+	return seed * 1664525 + 1013904223;
+}
+
 #endif /* _LINUX_RANDOM_H */
diff --git a/include/net/sock.h b/include/net/sock.h
index 5a34e2f..581dc6b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -140,6 +140,7 @@ typedef __u64 __bitwise __addrpair;
  *	@skc_family: network address family
  *	@skc_state: Connection state
  *	@skc_reuse: %SO_REUSEADDR setting
+ *	@skc_reuseport: %SO_REUSEPORT setting
  *	@skc_bound_dev_if: bound device index if != 0
  *	@skc_bind_node: bind hash linkage for various protocol lookup tables
  *	@skc_portaddr_node: second hash linkage for UDP/UDP-Lite protocol
@@ -179,7 +180,8 @@ struct sock_common {
 
 	unsigned short		skc_family;
 	volatile unsigned char	skc_state;
-	unsigned char		skc_reuse;
+	unsigned char		skc_reuse:4;
+	unsigned char		skc_reuseport:4;
 	int			skc_bound_dev_if;
 	union {
 		struct hlist_node	skc_bind_node;
@@ -297,6 +299,7 @@ struct sock {
 #define sk_family		__sk_common.skc_family
 #define sk_state		__sk_common.skc_state
 #define sk_reuse		__sk_common.skc_reuse
+#define sk_reuseport		__sk_common.skc_reuseport
 #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
 #define sk_bind_node		__sk_common.skc_bind_node
 #define sk_prot			__sk_common.skc_prot
diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h
index 3f6a992..4ef3acb 100644
--- a/include/uapi/asm-generic/socket.h
+++ b/include/uapi/asm-generic/socket.h
@@ -22,8 +22,7 @@
 #define SO_PRIORITY	12
 #define SO_LINGER	13
 #define SO_BSDCOMPAT	14
-/* To add :#define SO_REUSEPORT 15 */
-
+#define SO_REUSEPORT	15
 #ifndef SO_PASSCRED /* powerpc only differs in these */
 #define SO_PASSCRED	16
 #define SO_PEERCRED	17
diff --git a/net/core/sock.c b/net/core/sock.c
index 8258fb7..235fb89 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -665,6 +665,9 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
 	case SO_REUSEADDR:
 		sk->sk_reuse = (valbool ? SK_CAN_REUSE : SK_NO_REUSE);
 		break;
+	case SO_REUSEPORT:
+		sk->sk_reuseport = valbool;
+		break;
 	case SO_TYPE:
 	case SO_PROTOCOL:
 	case SO_DOMAIN:
@@ -972,6 +975,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
 		v.val = sk->sk_reuse;
 		break;
 
+	case SO_REUSEPORT:
+		v.val = sk->sk_reuseport;
+		break;
+
 	case SO_KEEPALIVE:
 		v.val = sock_flag(sk, SOCK_KEEPOPEN);
 		break;
-- 
1.7.7.3

^ permalink raw reply related

* Re: [PATCH 2/2] CDC_NCM: adding support FLAG_NOARP for Infineon modem platform
From: David Miller @ 2013-01-21  4:09 UTC (permalink / raw)
  To: cpuwolf-Re5JQEeQqe8AvxtiuMwx3w
  Cc: sshtylyov-Igf4POYTYCDQT0dZR+AlfA, dcbw-H+wXaHxf7aLQT0dZR+AlfA,
	peter-Y+HMSxxDrH8, oneukum-l3A5Bk7waGM,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	alexey.orishko-0IS4wlFg1OjSUeElwK9/Pw, bjorn-yOkvZcmFvRU,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <CACa7zynymtYN4OtTjVNTNdB23eNU4D-G+JqaTxjaPFekRHkRAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

From: Wei Shuai <cpuwolf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Date: Mon, 21 Jan 2013 10:20:22 +0800

> The main problem is that these devices don't support ethernet.

He's saying your comment is referring to the wrong thing,
rather than saying anything against what your change is
doing.

Read his feedback carefully:

>>> +/* Same as wwan_info, but with IFF_NOARP  */
>>
>>     FLAG_NOARP, you mean?

He's saying your commnet is talking about FLAG_NOARP rather
than what the core code does with this flag, which is
translate into setting IFF_NOARP on the net device.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" 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 1/5 v3] soreuseport: infrastructure
From: David Miller @ 2013-01-21  4:10 UTC (permalink / raw)
  To: therbert; +Cc: netdev, netdev, eric.dumazet
In-Reply-To: <alpine.DEB.2.00.1301202005010.25512@pokey.mtv.corp.google.com>


Nope Tom, you must resubmit the entire series after incorporating
feedback, rather than just the ones you feel like reposting.

^ permalink raw reply

* Re: [PATCH net-next] net/mlx4_en: remove redundant code
From: David Miller @ 2013-01-21  4:11 UTC (permalink / raw)
  To: amirv; +Cc: eric.dumazet, netdev, ogerlitz, yevgenyp, eugenia
In-Reply-To: <50FC03BA.8020200@mellanox.com>

From: Amir Vadai <amirv@mellanox.com>
Date: Sun, 20 Jan 2013 16:48:26 +0200

> On 17/01/2013 17:26, Eric Dumazet wrote:
>> From: Eric Dumazet <edumazet@google.com>
>>
>> remove redundant code from build_inline_wqe()
>>
>> Signed-off-by: Eric Dumazet <edumazet@google.com>
...
> Acked-By: Amir Vadai <amirv@mellanox.com>

Applied, thanks everyone.

^ permalink raw reply

* Re: [PATCH] usbnet: pegasus: set wakeup enable in set_wol
From: David Miller @ 2013-01-21  4:12 UTC (permalink / raw)
  To: ming.lei; +Cc: gregkh, oneukum, netdev, linux-usb, sarah.a.sharp, petkan
In-Reply-To: <1358595121-14373-1-git-send-email-ming.lei@canonical.com>

From: Ming Lei <ming.lei@canonical.com>
Date: Sat, 19 Jan 2013 19:32:01 +0800

> This patch calls device_set_wakeup_enable() inside set_wol
> callback, so that turning on WOL from user mode utility
> can make the 'wakeup' of pegasus device to be enabled, then
> remote wakeup may be enabled before putting into sleep.
> 
> Cc: Sarah Sharp <sarah.a.sharp@linux.intel.com>
> Cc: Petko Manolov <petkan@users.sourceforge.net>
> Signed-off-by: Ming Lei <ming.lei@canonical.com>

Applied to net-next, thanks Ming.

^ permalink raw reply

* Re: [PATCH v4 2/3] net: split eth_mac_addr for better error handling
From: David Miller @ 2013-01-21  4:14 UTC (permalink / raw)
  To: akong; +Cc: mst, rusty, qemu-devel, kvm, virtualization, netdev
In-Reply-To: <1358649789-2338-3-git-send-email-akong@redhat.com>

From: akong@redhat.com
Date: Sun, 20 Jan 2013 10:43:08 +0800

> From: Stefan Hajnoczi <stefanha@gmail.com>
> 
> When we set mac address, software mac address in system and hardware mac
> address all need to be updated. Current eth_mac_addr() doesn't allow
> callers to implement error handling nicely.
> 
> This patch split eth_mac_addr() to prepare part and real commit part,
> then we can prepare first, and try to change hardware address, then do
> the real commit if hardware address is set successfully.
> 
> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
> Signed-off-by: Amos Kong <akong@redhat.com>

This patch doesn't apply to net-next.

^ 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