Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 0/2][net-next] gianfar: xmit - fix errata workaround and cleanup
From: David Miller @ 2013-08-05 19:29 UTC (permalink / raw)
  To: claudiu.manoil; +Cc: netdev, paul.gortmaker
In-Reply-To: <1375712410-11760-1-git-send-email-claudiu.manoil@freescale.com>

From: Claudiu Manoil <claudiu.manoil@freescale.com>
Date: Mon, 5 Aug 2013 17:20:08 +0300

> Please find these cleanup patches for the gfar_start_xmit() function,
> including a fix for an old errata workaround implementation (eTSEC76,
> for MPC8313 and MPC837x). I find this cleanup quite necessary to make
> future fixes and improvements in xmit (and Tx processing) easier.

Both applied, thanks.

^ permalink raw reply

* Re: [PATCH net] net: esp{4,6}: fix potential MTU calculation overflows
From: David Miller @ 2013-08-05 19:27 UTC (permalink / raw)
  To: dborkman; +Cc: netdev, bpoirier, steffen.klassert
In-Reply-To: <1375699775-13769-1-git-send-email-dborkman@redhat.com>

From: Daniel Borkmann <dborkman@redhat.com>
Date: Mon,  5 Aug 2013 12:49:35 +0200

> Commit 91657eafb ("xfrm: take net hdr len into account for esp payload
> size calculation") introduced a possible interger overflow in
> esp{4,6}_get_mtu() handlers in case of x->props.mode equals
> XFRM_MODE_TUNNEL. Thus, the following expression will overflow
> 
>   unsigned int net_adj;
>   ...
>   <case ipv{4,6} XFRM_MODE_TUNNEL>
>          net_adj = 0;
>   ...
>   return ((mtu - x->props.header_len - crypto_aead_authsize(esp->aead) -
>            net_adj) & ~(align - 1)) + (net_adj - 2);
> 
> where (net_adj - 2) would be evaluated as <foo> + (0 - 2) in an unsigned
> context. Fix it by simply removing brackets as those operations here
> do not need to have special precedence.
> 
> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] bonding: remove locking from bond_set_rx_mode()
From: David Miller @ 2013-08-05 19:23 UTC (permalink / raw)
  To: vfalico; +Cc: netdev, fubar, andy, nikolay
In-Reply-To: <1375707366-6762-1-git-send-email-vfalico@redhat.com>

From: Veaceslav Falico <vfalico@redhat.com>
Date: Mon,  5 Aug 2013 14:56:06 +0200

> We're already protected by RTNL lock, so nothing can happen to bond/its
> slaves, and thus the locking is useless here (both bond->lock and
> bond->curr_active_slave).
> 
> Also, add ASSERT_RTNL() both to bond_set_rx_mode() and bond_hw_addr_swap()
> to catch possible uses of it without RTNL locking.
> 
> This patch also saves us from a lockdep false-positive in
> bond_set_rx_mode() vs bond_hw_addr_swap().
> 
> CC: Jay Vosburgh <fubar@us.ibm.com>
> CC: Andy Gospodarek <andy@greyhouse.net>
> CC: Nikolay Aleksandrov <nikolay@redhat.com>
> Signed-off-by: Veaceslav Falico <vfalico@redhat.com>

Applied.

^ permalink raw reply

* Re: [net-next PATCH v2 1/1] drivers: net: cpsw: Add support for new CPSW IP version
From: David Miller @ 2013-08-05 19:22 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev, linux-omap, balbi
In-Reply-To: <1375704005-3856-1-git-send-email-mugunthanvnm@ti.com>

From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Mon, 5 Aug 2013 17:30:05 +0530

> The new IP version has a minor changes and the offsets are same as the
> previous version, so adding new IP version support in the driver.
> 
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> Reviewed-by: Felipe Balbi <balbi@ti.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] sctp: Pack dst_cookie into 1st cacheline hole for 64bit host
From: David Miller @ 2013-08-05 19:21 UTC (permalink / raw)
  To: fan.du; +Cc: vyasevich, nhorman, netdev
In-Reply-To: <1375693983-22824-1-git-send-email-fan.du@windriver.com>

From: Fan Du <fan.du@windriver.com>
Date: Mon, 5 Aug 2013 17:13:03 +0800

> As dst_cookie is used in fast path sctp_transport_dst_check.
 ...
> Signed-off-by: Fan Du <fan.du@windriver.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 0/2] bonding: cleanup arp_interval related time math
From: David Miller @ 2013-08-05 19:20 UTC (permalink / raw)
  To: vfalico; +Cc: netdev, fubar, andy
In-Reply-To: <1375494636-7947-1-git-send-email-vfalico@redhat.com>

From: Veaceslav Falico <vfalico@redhat.com>
Date: Sat,  3 Aug 2013 03:50:34 +0200

> Current implementation uses heavily time_in_range() with similar, lengthy,
> params. By moving it to a separate function we can simplify the code a lot.
> 
> First patch saves a possibly heavy slave_last_rx() function to a variable
> and uses the variable in the calculation.
> 
> Second patch introduces helper function bond_time_in_interval() to make the
> arp_interval math and uses it instead of lengthy time_in_range() calls.
> 
> Both of them don't change anything logically and in terms of speed and are
> purely cleanup patches.

Series applied, thanks.

^ permalink raw reply

* Re: [PATCH net v2 2/2] net_sched: make dev_trans_start return vlan's real dev trans_start
From: David Miller @ 2013-08-05 19:18 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, vfalico, fubar, jhs
In-Reply-To: <1375560467-1604-2-git-send-email-nikolay@redhat.com>

From: Nikolay Aleksandrov <nikolay@redhat.com>
Date: Sat,  3 Aug 2013 22:07:47 +0200

> From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
> 
> Vlan devices are LLTX and don't update their own trans_start, so if
> dev_trans_start has to be called with a vlan device then 0 or a stale
> value will be returned. Currently the bonding is the only such user, and
> it's needed for proper arp monitoring when the slaves are vlans.
> Fix this by extracting the vlan's real device trans_start.
> 
> Suggested-by: David Miller <davem@davemloft.net>
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>

Applied.

^ permalink raw reply

* Re: [PATCH net 1/2] vlan: make vlan_dev_real_dev work over stacked vlans
From: David Miller @ 2013-08-05 19:18 UTC (permalink / raw)
  To: nikolay; +Cc: netdev, vfalico, fubar, jhs
In-Reply-To: <1375560467-1604-1-git-send-email-nikolay@redhat.com>

From: Nikolay Aleksandrov <nikolay@redhat.com>
Date: Sat,  3 Aug 2013 22:07:46 +0200

> From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@redhat.com>
> 
> Sometimes we might have stacked vlans on top of each other, and we're
> interested in the first non-vlan real device on the path, so transform
> vlan_dev_real_dev to go over the stacked vlans and extract the first
> non-vlan device.
> 
> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>

Applied.

^ permalink raw reply

* Re: BUG cxgb3: Check and handle the dma mapping errors
From: Jay Fenlason @ 2013-08-05 18:41 UTC (permalink / raw)
  To: Alexey Kardashevskiy
  Cc: Santosh Rastapur, Divy Le Ray, David S. Miller, netdev,
	Linux Kernel Mailing List
In-Reply-To: <51FF14F8.7000204@ozlabs.ru>

On Mon, Aug 05, 2013 at 12:59:04PM +1000, Alexey Kardashevskiy wrote:
> Hi!
> 
> Recently I started getting multiple errors like this:
> 
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> cxgb3 0006:01:00.0: iommu_alloc failed, tbl c000000003067980 vaddr
> c000001fbdaaa882 npages 1
> ... and so on
> 
> This is all happening on a PPC64 "powernv" platform machine. To trigger the
> error state, it is enough to _flood_ ping CXGB3 card from another machine
> (which has Emulex 10Gb NIC + Cisco switch). Just do "ping -f 172.20.1.2"
> and wait 10-15 seconds.
> 
> 
> The messages are coming from arch/powerpc/kernel/iommu.c and basically
> mean that the driver requested more pages than the DMA window has which is
> normally 1GB (there could be another possible source of errors -
> ppc_md.tce_build callback - but on powernv platform it always succeeds).
> 
> 
> The patch after which it broke is:
> commit f83331bab149e29fa2c49cf102c0cd8c3f1ce9f9
> Author: Santosh Rastapur <santosh@chelsio.com>
> Date:   Tue May 21 04:21:29 2013 +0000
> cxgb3: Check and handle the dma mapping errors
> 
> Any quick ideas? Thanks!

That patch adds error checking to detect failed dma mapping requests.
Before it, the code always assumed that dma mapping requests succeded,
whether they actually do or not, so the fact that the older kernel
does not log errors only means that the failures are being ignored,
and any appearance of working is through pure luck.  The machine could
have just crashed at that point.

What is the observed behavior of the system by the machine initiating
the ping flood?  Do the older and newer kernels differ in the
percentage of pings that do not receive replies?  O the newer kernel,
when the mapping errors are detected, the packet that it is trying to
transmit is dropped, but I'm not at all sure what happens on the older
kernel after the dma mapping fails.  As I mentioned earlier, I'm
surprised it does not crash.  Perhaps the folks from Chelsio have a
better idea what happens after a dma mapping error is ignored?

		-- JF

^ permalink raw reply

* Re: [PATCH net-next] bonding: RCUify bond_set_rx_mode()
From: Veaceslav Falico @ 2013-08-05 18:31 UTC (permalink / raw)
  To: netdev; +Cc: Jay Vosburgh, Andy Gospodarek, Nikolay Aleksandrov
In-Reply-To: <1375694776-3429-1-git-send-email-vfalico@redhat.com>

On Mon, Aug 05, 2013 at 11:26:16AM +0200, Veaceslav Falico wrote:
>Currently, we might easily deadlock with bond_set_rx_mode() and
>bond_hw_addr_swap(). bond_set_rx_mode() is called via dev_set_rx_mode(),
>which already holds the netif_addr_lock_bh(bond), and inside it takes the
>bond->curr_active_slave lock, while bond_hw_addr_swap() is called with
>bond->curr_active_slave lock held and then takes netif_addr_lock_bh(bond),
>which results in deadlock.
>
>CPU0                    CPU1
>----                    ----
>lock(&bonding_netdev_addr_lock_key);
>			lock(&bond->curr_slave_lock);
>			lock(&bonding_netdev_addr_lock_key);
>lock(&bond->curr_slave_lock);
>
>Fix this by using the RCU primites in bond_set_rx_mode(). We're safe wrt
>racing of dev_?c_(un)sync() because we hold
>lock(&bonding_netdev_addr_lock_key), and thus nobody will be able to modify
>these lists before we finish.
>
>CC: Jay Vosburgh <fubar@us.ibm.com>
>CC: Andy Gospodarek <andy@greyhouse.net>
>CC: Nikolay Aleksandrov <nikolay@redhat.com>
>Signed-off-by: Veaceslav Falico <vfalico@redhat.com>

Self-NAK, for clarity. Posted a reworked patch - "[net-next] bonding: remove
locking from bond_set_rx_mode()" for the same issue.

>---
> drivers/net/bonding/bond_main.c |   10 ++++------
> 1 files changed, 4 insertions(+), 6 deletions(-)
>
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index 476df7d..fdc01c6 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -3571,24 +3571,22 @@ static void bond_set_rx_mode(struct net_device *bond_dev)
> 	struct bonding *bond = netdev_priv(bond_dev);
> 	struct slave *slave;
>
>-	read_lock(&bond->lock);
>+	rcu_read_lock();
>
> 	if (USES_PRIMARY(bond->params.mode)) {
>-		read_lock(&bond->curr_slave_lock);
>-		slave = bond->curr_active_slave;
>+		slave = rcu_dereference(bond->curr_active_slave);
> 		if (slave) {
> 			dev_uc_sync(slave->dev, bond_dev);
> 			dev_mc_sync(slave->dev, bond_dev);
> 		}
>-		read_unlock(&bond->curr_slave_lock);
> 	} else {
>-		bond_for_each_slave(bond, slave) {
>+		bond_for_each_slave_rcu(bond, slave) {
> 			dev_uc_sync_multiple(slave->dev, bond_dev);
> 			dev_mc_sync_multiple(slave->dev, bond_dev);
> 		}
> 	}
>
>-	read_unlock(&bond->lock);
>+	rcu_read_unlock();
> }
>
> static int bond_neigh_init(struct neighbour *n)
>-- 
>1.7.1
>

^ permalink raw reply

* Re: [PATCH net-next v6 1/8] vxlan: Restructure vxlan socket apis.
From: Pravin Shelar @ 2013-08-05 18:24 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev
In-Reply-To: <20130805111021.62430fc5@nehalam.linuxnetplumber.net>

On Mon, Aug 5, 2013 at 11:10 AM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Mon, 5 Aug 2013 08:49:36 -0700
> Pravin Shelar <pshelar@nicira.com> wrote:
>
>> On Sun, Aug 4, 2013 at 2:42 PM, Stephen Hemminger
>> <stephen@networkplumber.org> wrote:
>> > On Thu,  1 Aug 2013 11:44:40 -0700
>> > Pravin B Shelar <pshelar@nicira.com> wrote:
>> >
>> >> @@ -1642,59 +1651,56 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port)
>> >>                        &vxlan_addr.sin_addr, ntohs(vxlan_addr.sin_port), rc);
>> >>               sk_release_kernel(sk);
>> >>               kfree(vs);
>> >> -             return ERR_PTR(rc);
>> >> +             return;
>> >>       }
>> >> +     atomic_set(&vs->refcnt, 0);
>> >>
>> >>       /* Disable multicast loopback */
>> >>       inet_sk(sk)->mc_loop = 0;
>> >> +     spin_lock(&vn->sock_lock);
>> >> +     hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
>> >> +     spin_unlock(&vn->sock_lock);
>> >
>> > Overall I am fine with this set, except for this.
>> > The change causes a socket to be put into the hash list with a ref count
>> > of 0 and then you increment the ref count. If some other thread
>> > finds the socket and then decrements the ref count, it would go
>> > below zero and might leak, crash or delete it prematurely.
>> >
>> > This concerns me.
>>
>> There is no code path which decrements ref-cnt after lookup. Therefore
>> above case is not possible.
>> But I agree this does not look good, so I will change it so not to
>> have refcnt zero vs on hash-table.
>
> I was concerned about:
>
> CPU 0:
>    vxlan_socket_create
>      Make a vs structure with refcnt == 0
>      Add it to hlist
>
>      <preempt or other long IRQ>
>                                          CPU 1: Another vxlan being setup (batch script?)
>                                                 vxlan_init
>                                                      vxlan_find_port finds that vs
>                                                      atomic_inc(refcnt) now 1
>                                           <close or error>
>                                                 vxlan_uninit
>                                                   vxlan_sock_release
>                                                      atomic_dec_and_test (now 0)
>                                                        delete from hlist
>                                                        queue work for deletion
>
>      now decides to continue with vs
>      Either vs is already freed, or it exists
>      in limbo
>
ok, I see problem. v7 version fixes this issue.

^ permalink raw reply

* [PATCH] fib_trie: remove potential out of bound access
From: Eric Dumazet @ 2013-08-05 18:18 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Andrey Konovalov, Dmitry Vyukov

From: Eric Dumazet <edumazet@google.com>

AddressSanitizer [1] dynamic checker pointed a potential
out of bound access in leaf_walk_rcu()

We could allocate one more slot in tnode_new() to leave the prefetch()
in-place but it looks not worth the pain.

Bug added in commit 82cfbb008572b ("[IPV4] fib_trie: iterator recode")

[1] :
https://code.google.com/p/address-sanitizer/wiki/AddressSanitizerForKernel

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
---
 net/ipv4/fib_trie.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 108a1e9c..3df6d3e 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -71,7 +71,6 @@
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/slab.h>
-#include <linux/prefetch.h>
 #include <linux/export.h>
 #include <net/net_namespace.h>
 #include <net/ip.h>
@@ -1761,10 +1760,8 @@ static struct leaf *leaf_walk_rcu(struct tnode *p, struct rt_trie_node *c)
 			if (!c)
 				continue;
 
-			if (IS_LEAF(c)) {
-				prefetch(rcu_dereference_rtnl(p->child[idx]));
+			if (IS_LEAF(c))
 				return (struct leaf *) c;
-			}
 
 			/* Rescan start scanning in new node */
 			p = (struct tnode *) c;

^ permalink raw reply related

* Re: [patch] net: remove an unneeded check
From: Rustad, Mark D @ 2013-08-05 18:18 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: David S. Miller, Alexey Kuznetsov, James Morris,
	Hideaki YOSHIFUJI, Patrick McHardy,
	<netdev@vger.kernel.org>,
	<kernel-janitors@vger.kernel.org>
In-Reply-To: <20130729191519.GA11874@elgon.mountain>

On Jul 29, 2013, at 12:15 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> "ifa->ifa_label" is an array inside the in_ifaddr struct.  It can never
> be NULL so we can remove this check.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
> index 8d48c39..1b7f7ae 100644
> --- a/net/ipv4/devinet.c
> +++ b/net/ipv4/devinet.c
> @@ -1124,10 +1124,7 @@ static int inet_gifconf(struct net_device *dev, char __user *buf, int len)
> 		if (len < (int) sizeof(ifr))
> 			break;
> 		memset(&ifr, 0, sizeof(struct ifreq));
> -		if (ifa->ifa_label)

Is there any possibility that this was meant to check ifa->ifa_label[0]?

> -			strcpy(ifr.ifr_name, ifa->ifa_label);
> -		else
> -			strcpy(ifr.ifr_name, dev->name);
> +		strcpy(ifr.ifr_name, ifa->ifa_label);
> 
> 		(*(struct sockaddr_in *)&ifr.ifr_addr).sin_family = AF_INET;
> 		(*(struct sockaddr_in *)&ifr.ifr_addr).sin_addr.s_addr =

-- 
Mark Rustad, Networking Division, Intel Corporation

^ permalink raw reply

* Re: [PATCH] net/ipv4: fix the conditions of entering TCP_CA_Disorder state
From: Eric Dumazet @ 2013-08-05 18:16 UTC (permalink / raw)
  To: Dong Fang; +Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel
In-Reply-To: <1375749951-11230-1-git-send-email-yp.fangdong@gmail.com>

On Mon, 2013-08-05 at 20:45 -0400, Dong Fang wrote:
> if have some packets loss by network, the kernel can't reach here, we can see
> the tcp_time_to_recover() function:
> 
> static bool tcp_time_to_recover(struct sock *sk, int flag)
> {
> 	struct tcp_sock *tp = tcp_sk(sk);
> 	__u32 packets_out;
> 
> 	/* Trick#1: The loss is proven. */
> 	if (tp->lost_out)
> 		return true;
> 	//...
> }
> 
> when it return true, the following condition will be failed:
> 
> //...
> if (!tcp_time_to_recover(sk, flag)) {
> 	tcp_try_to_open(sk, flag, prior_unsacked);
> 	return;
> }
> //...
> 

I honestly do not understand this changelog, and how it is related to
the patch.

Also its not 'net/ipv4:' issue but 'tcp:' one


Could you please explain the issue again ?

Thanks !

^ permalink raw reply

* Re: [PATCH 4/4] net: mlx4: Staticize local functions
From: David Miller @ 2013-08-05 18:10 UTC (permalink / raw)
  To: jg1.han; +Cc: netdev, yevgenyp, eugenia
In-Reply-To: <002401ce91ba$d8025860$88070920$@samsung.com>

From: Jingoo Han <jg1.han@samsung.com>
Date: Mon, 05 Aug 2013 18:04:51 +0900

> These local functions are used only in this file.
> Fix the following sparse warnings:
 ...
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v6 1/8] vxlan: Restructure vxlan socket apis.
From: Stephen Hemminger @ 2013-08-05 18:10 UTC (permalink / raw)
  To: Pravin Shelar; +Cc: netdev
In-Reply-To: <CALnjE+oZkX6FkVaaJeYz2C9SgY0hcRi6xKjxsSh+5Q=PoH7qFQ@mail.gmail.com>

On Mon, 5 Aug 2013 08:49:36 -0700
Pravin Shelar <pshelar@nicira.com> wrote:

> On Sun, Aug 4, 2013 at 2:42 PM, Stephen Hemminger
> <stephen@networkplumber.org> wrote:
> > On Thu,  1 Aug 2013 11:44:40 -0700
> > Pravin B Shelar <pshelar@nicira.com> wrote:
> >
> >> @@ -1642,59 +1651,56 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, __be16 port)
> >>                        &vxlan_addr.sin_addr, ntohs(vxlan_addr.sin_port), rc);
> >>               sk_release_kernel(sk);
> >>               kfree(vs);
> >> -             return ERR_PTR(rc);
> >> +             return;
> >>       }
> >> +     atomic_set(&vs->refcnt, 0);
> >>
> >>       /* Disable multicast loopback */
> >>       inet_sk(sk)->mc_loop = 0;
> >> +     spin_lock(&vn->sock_lock);
> >> +     hlist_add_head_rcu(&vs->hlist, vs_head(net, port));
> >> +     spin_unlock(&vn->sock_lock);
> >
> > Overall I am fine with this set, except for this.
> > The change causes a socket to be put into the hash list with a ref count
> > of 0 and then you increment the ref count. If some other thread
> > finds the socket and then decrements the ref count, it would go
> > below zero and might leak, crash or delete it prematurely.
> >
> > This concerns me.
> 
> There is no code path which decrements ref-cnt after lookup. Therefore
> above case is not possible.
> But I agree this does not look good, so I will change it so not to
> have refcnt zero vs on hash-table.

I was concerned about:

CPU 0:
   vxlan_socket_create
     Make a vs structure with refcnt == 0
     Add it to hlist

     <preempt or other long IRQ>
                                         CPU 1: Another vxlan being setup (batch script?)
                                                vxlan_init
                                                     vxlan_find_port finds that vs
                                                     atomic_inc(refcnt) now 1
                                          <close or error>
                                                vxlan_uninit
                                                  vxlan_sock_release
                                                     atomic_dec_and_test (now 0)
                                                       delete from hlist
                                                       queue work for deletion

     now decides to continue with vs
     Either vs is already freed, or it exists
     in limbo

                                                       

^ permalink raw reply

* Re: [PATCH 3/4] net: micrel: Staticize local functions
From: David Miller @ 2013-08-05 18:10 UTC (permalink / raw)
  To: jg1.han; +Cc: netdev
In-Reply-To: <002301ce91ba$9605cc30$c2116490$@samsung.com>

From: Jingoo Han <jg1.han@samsung.com>
Date: Mon, 05 Aug 2013 18:03:00 +0900

> These local functions are used only in this file.
> Fix the following sparse warnings:
 ...
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/4] be2net: Staticize local functions
From: David Miller @ 2013-08-05 18:10 UTC (permalink / raw)
  To: jg1.han; +Cc: netdev, sathya.perla, subbu.seetharaman, ajit.khaparde
In-Reply-To: <002201ce91ba$7335bfd0$59a13f70$@samsung.com>

From: Jingoo Han <jg1.han@samsung.com>
Date: Mon, 05 Aug 2013 18:02:02 +0900

> These local functions are used only in this file.
> Fix the following sparse warnings:
 ...
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Applied.

^ permalink raw reply

* Re: [PATCH 1/4] bna: Staticize local functions
From: David Miller @ 2013-08-05 18:10 UTC (permalink / raw)
  To: jg1.han; +Cc: netdev, rmody
In-Reply-To: <002001ce91ba$2d4b7eb0$87e27c10$@samsung.com>

From: Jingoo Han <jg1.han@samsung.com>
Date: Mon, 05 Aug 2013 18:00:04 +0900

> bna_rx_sm_stop_wait_entry(), bna_rx_sm_rxf_stop_wait_entry(),
> bna_rx_sm_started_entry(), bna_rx_sm_cleanup_wait_entry(),
> and bna_rx_sm_cleanup_wait() are used only in this file.
> Fix the following sparse warnings:
 ...
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

Applied.

^ permalink raw reply

* Re: [PATCH -next] tile: fix missing unlock on error in tile_net_open()
From: David Miller @ 2013-08-05 18:09 UTC (permalink / raw)
  To: cmetcalf; +Cc: weiyj.lk, yongjun_wei, netdev
In-Reply-To: <51FFC065.3090108@tilera.com>

From: Chris Metcalf <cmetcalf@tilera.com>
Date: Mon, 5 Aug 2013 11:10:29 -0400

> On 8/5/2013 12:42 AM, Wei Yongjun wrote:
>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> Add the missing unlock before return from function tile_net_open()
>> in the error handling case.
>>
>> Introduced by commit f3286a3af89d6db7a488f3e8f02b98d67d50f00c.
>> (tile: support multiple mPIPE shims in tilegx network driver)
>>
>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> ---
>>  drivers/net/ethernet/tile/tilegx.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> Thanks!
> 
> Acked-by: Chris Metcalf <cmetcalf@tilera.com>

Applied.

^ permalink raw reply

* Re: [PATCH] net/vmw_vsock/af_vsock.c: drop unneeded semicolon
From: David Miller @ 2013-08-05 18:08 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, netdev, linux-kernel
In-Reply-To: <1375714059-29567-4-git-send-email-Julia.Lawall@lip6.fr>

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Mon,  5 Aug 2013 16:47:38 +0200

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Drop the semicolon at the end of the list_for_each_entry loop header.
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
> Not tested, but I can't imagine how the current code could work, since vsk
> should end up pointing to a dummy value.

This bug has been there since the code was first checked in, and indeed
it's going to work on garbage since it's going to pass in the list
head transformed into a vsock structure.

Applied, thanks Julia.

^ permalink raw reply

* Re: [PATCH] mlx5: remove health handler plugin
From: David Miller @ 2013-08-05 18:04 UTC (permalink / raw)
  To: eli; +Cc: dborkman, netdev, ogerlitz
In-Reply-To: <20130805130532.GA26634@mtldesk30>

From: Eli Cohen <eli@dev.mellanox.co.il>
Date: Mon, 5 Aug 2013 16:05:32 +0300

> Remove this code, per Dave Miller's request, since it is not being used
> anywhere in the kernel.
> 
> Signed-off-by: Eli Cohen <eli@mellanox.com>

Applied, thank you.

^ permalink raw reply

* Re: [PATCH v3] macvlan: validate flags
From: David Miller @ 2013-08-05 18:03 UTC (permalink / raw)
  To: mst; +Cc: linux-kernel, john.r.fastabend, kaber, netdev
In-Reply-To: <20130805152554.GA3592@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>
Date: Mon, 5 Aug 2013 18:25:54 +0300

> commit df8ef8f3aaa6692970a436204c4429210addb23a
>     macvlan: add FDB bridge ops and macvlan flags
> added a flags field to macvlan, which can be
> controlled from userspace.
> The idea is to make the interface future-proof
> so we can add flags and not new fields.
> 
> However, flags value isn't validated, as a result,
> userspace can't detect which flags are supported.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: John Fastabend <john.r.fastabend@intel.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply

* [PATCH net-next v7 8/8] openvswitch: Add vxlan tunneling support.
From: Pravin B Shelar @ 2013-08-05 17:47 UTC (permalink / raw)
  To: netdev; +Cc: stephen, Pravin B Shelar, Jesse Gross

Following patch adds vxlan vport type for openvswitch using
vxlan api. So now there is vxlan dependency for openvswitch.

CC: Jesse Gross <jesse@nicira.com>
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
v2-v3:
 - Moved CONFIG_OPENVSWITCH_VXLAN check to makefile.
v1-v2:
 - removed NULL check in vxlan-rcv.
 - change vxlan-port create to look good.
 - Added Cisco copyright.
---
 include/uapi/linux/openvswitch.h |   11 ++
 net/openvswitch/Kconfig          |   13 +++
 net/openvswitch/Makefile         |    4 +
 net/openvswitch/vport-vxlan.c    |  204 ++++++++++++++++++++++++++++++++++++++
 net/openvswitch/vport.c          |    3 +
 net/openvswitch/vport.h          |    1 +
 6 files changed, 236 insertions(+), 0 deletions(-)
 create mode 100644 net/openvswitch/vport-vxlan.c

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index c55efaa..52490b0 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -165,6 +165,7 @@ enum ovs_vport_type {
 	OVS_VPORT_TYPE_NETDEV,   /* network device */
 	OVS_VPORT_TYPE_INTERNAL, /* network device implemented by datapath */
 	OVS_VPORT_TYPE_GRE,      /* GRE tunnel. */
+	OVS_VPORT_TYPE_VXLAN,	 /* VXLAN tunnel. */
 	__OVS_VPORT_TYPE_MAX
 };
 
@@ -211,6 +212,16 @@ enum ovs_vport_attr {
 
 #define OVS_VPORT_ATTR_MAX (__OVS_VPORT_ATTR_MAX - 1)
 
+/* OVS_VPORT_ATTR_OPTIONS attributes for tunnels.
+ */
+enum {
+	OVS_TUNNEL_ATTR_UNSPEC,
+	OVS_TUNNEL_ATTR_DST_PORT, /* 16-bit UDP port, used by L4 tunnels. */
+	__OVS_TUNNEL_ATTR_MAX
+};
+
+#define OVS_TUNNEL_ATTR_MAX (__OVS_TUNNEL_ATTR_MAX - 1)
+
 /* Flows. */
 
 #define OVS_FLOW_FAMILY  "ovs_flow"
diff --git a/net/openvswitch/Kconfig b/net/openvswitch/Kconfig
index 27ee56b..bed30e6 100644
--- a/net/openvswitch/Kconfig
+++ b/net/openvswitch/Kconfig
@@ -40,3 +40,16 @@ config OPENVSWITCH_GRE
 	  Say N to exclude this support and reduce the binary size.
 
 	  If unsure, say Y.
+
+config OPENVSWITCH_VXLAN
+	bool "Open vSwitch VXLAN tunneling support"
+	depends on INET
+	depends on OPENVSWITCH
+	depends on VXLAN && !(OPENVSWITCH=y && VXLAN=m)
+	default y
+	---help---
+	  If you say Y here, then the Open vSwitch will be able create vxlan vport.
+
+	  Say N to exclude this support and reduce the binary size.
+
+	  If unsure, say Y.
diff --git a/net/openvswitch/Makefile b/net/openvswitch/Makefile
index 01bddb2..82e4ee5 100644
--- a/net/openvswitch/Makefile
+++ b/net/openvswitch/Makefile
@@ -13,3 +13,7 @@ openvswitch-y := \
 	vport-gre.o \
 	vport-internal_dev.o \
 	vport-netdev.o
+
+ifneq ($(CONFIG_OPENVSWITCH_VXLAN),)
+openvswitch-y += vport-vxlan.o
+endif
diff --git a/net/openvswitch/vport-vxlan.c b/net/openvswitch/vport-vxlan.c
new file mode 100644
index 0000000..36848bd
--- /dev/null
+++ b/net/openvswitch/vport-vxlan.c
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2013 Nicira, Inc.
+ * Copyright (c) 2013 Cisco Systems, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/in.h>
+#include <linux/ip.h>
+#include <linux/net.h>
+#include <linux/rculist.h>
+#include <linux/udp.h>
+
+#include <net/icmp.h>
+#include <net/ip.h>
+#include <net/udp.h>
+#include <net/ip_tunnels.h>
+#include <net/udp.h>
+#include <net/rtnetlink.h>
+#include <net/route.h>
+#include <net/dsfield.h>
+#include <net/inet_ecn.h>
+#include <net/net_namespace.h>
+#include <net/netns/generic.h>
+#include <net/vxlan.h>
+
+#include "datapath.h"
+#include "vport.h"
+
+/**
+ * struct vxlan_port - Keeps track of open UDP ports
+ * @vs: vxlan_sock created for the port.
+ * @name: vport name.
+ */
+struct vxlan_port {
+	struct vxlan_sock *vs;
+	char name[IFNAMSIZ];
+};
+
+static inline struct vxlan_port *vxlan_vport(const struct vport *vport)
+{
+	return vport_priv(vport);
+}
+
+/* Called with rcu_read_lock and BH disabled. */
+static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, __be32 vx_vni)
+{
+	struct ovs_key_ipv4_tunnel tun_key;
+	struct vport *vport = vs->data;
+	struct iphdr *iph;
+	__be64 key;
+
+	/* Save outer tunnel values */
+	iph = ip_hdr(skb);
+	key = cpu_to_be64(ntohl(vx_vni) >> 8);
+	ovs_flow_tun_key_init(&tun_key, iph, key, TUNNEL_KEY);
+
+	ovs_vport_receive(vport, skb, &tun_key);
+}
+
+static int vxlan_get_options(const struct vport *vport, struct sk_buff *skb)
+{
+	struct vxlan_port *vxlan_port = vxlan_vport(vport);
+	__be16 dst_port = inet_sk(vxlan_port->vs->sock->sk)->inet_sport;
+
+	if (nla_put_u16(skb, OVS_TUNNEL_ATTR_DST_PORT, ntohs(dst_port)))
+		return -EMSGSIZE;
+	return 0;
+}
+
+static void vxlan_tnl_destroy(struct vport *vport)
+{
+	struct vxlan_port *vxlan_port = vxlan_vport(vport);
+
+	vxlan_sock_release(vxlan_port->vs);
+
+	ovs_vport_deferred_free(vport);
+}
+
+static struct vport *vxlan_tnl_create(const struct vport_parms *parms)
+{
+	struct net *net = ovs_dp_get_net(parms->dp);
+	struct nlattr *options = parms->options;
+	struct vxlan_port *vxlan_port;
+	struct vxlan_sock *vs;
+	struct vport *vport;
+	struct nlattr *a;
+	u16 dst_port;
+	int err;
+
+	if (!options) {
+		err = -EINVAL;
+		goto error;
+	}
+	a = nla_find_nested(options, OVS_TUNNEL_ATTR_DST_PORT);
+	if (a && nla_len(a) == sizeof(u16)) {
+		dst_port = nla_get_u16(a);
+	} else {
+		/* Require destination port from userspace. */
+		err = -EINVAL;
+		goto error;
+	}
+
+	vport = ovs_vport_alloc(sizeof(struct vxlan_port),
+				&ovs_vxlan_vport_ops, parms);
+	if (IS_ERR(vport))
+		return vport;
+
+	vxlan_port = vxlan_vport(vport);
+	strncpy(vxlan_port->name, parms->name, IFNAMSIZ);
+
+	vs = vxlan_sock_add(net, htons(dst_port), vxlan_rcv, vport, true);
+	if (IS_ERR(vs)) {
+		ovs_vport_free(vport);
+		return (void *)vs;
+	}
+	vxlan_port->vs = vs;
+
+	return vport;
+
+error:
+	return ERR_PTR(err);
+}
+
+static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb)
+{
+	struct net *net = ovs_dp_get_net(vport->dp);
+	struct vxlan_port *vxlan_port = vxlan_vport(vport);
+	__be16 dst_port = inet_sk(vxlan_port->vs->sock->sk)->inet_sport;
+	struct rtable *rt;
+	struct flowi4 fl;
+	__be16 src_port;
+	int port_min;
+	int port_max;
+	__be16 df;
+	int err;
+
+	if (unlikely(!OVS_CB(skb)->tun_key)) {
+		err = -EINVAL;
+		goto error;
+	}
+
+	/* Route lookup */
+	memset(&fl, 0, sizeof(fl));
+	fl.daddr = OVS_CB(skb)->tun_key->ipv4_dst;
+	fl.saddr = OVS_CB(skb)->tun_key->ipv4_src;
+	fl.flowi4_tos = RT_TOS(OVS_CB(skb)->tun_key->ipv4_tos);
+	fl.flowi4_mark = skb->mark;
+	fl.flowi4_proto = IPPROTO_UDP;
+
+	rt = ip_route_output_key(net, &fl);
+	if (IS_ERR(rt)) {
+		err = PTR_ERR(rt);
+		goto error;
+	}
+
+	df = OVS_CB(skb)->tun_key->tun_flags & TUNNEL_DONT_FRAGMENT ?
+		htons(IP_DF) : 0;
+
+	skb->local_df = 1;
+
+	inet_get_local_port_range(&port_min, &port_max);
+	src_port = vxlan_src_port(port_min, port_max, skb);
+
+	err = vxlan_xmit_skb(net, vxlan_port->vs, rt, skb,
+			     fl.saddr, OVS_CB(skb)->tun_key->ipv4_dst,
+			     OVS_CB(skb)->tun_key->ipv4_tos,
+			     OVS_CB(skb)->tun_key->ipv4_ttl, df,
+			     src_port, dst_port,
+			     htonl(be64_to_cpu(OVS_CB(skb)->tun_key->tun_id) << 8));
+	if (err < 0)
+		ip_rt_put(rt);
+error:
+	return err;
+}
+
+static const char *vxlan_get_name(const struct vport *vport)
+{
+	struct vxlan_port *vxlan_port = vxlan_vport(vport);
+	return vxlan_port->name;
+}
+
+const struct vport_ops ovs_vxlan_vport_ops = {
+	.type		= OVS_VPORT_TYPE_VXLAN,
+	.create		= vxlan_tnl_create,
+	.destroy	= vxlan_tnl_destroy,
+	.get_name	= vxlan_get_name,
+	.get_options	= vxlan_get_options,
+	.send		= vxlan_tnl_send,
+};
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index d4c7fa0..d69e0c0 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -42,6 +42,9 @@ static const struct vport_ops *vport_ops_list[] = {
 #ifdef CONFIG_OPENVSWITCH_GRE
 	&ovs_gre_vport_ops,
 #endif
+#ifdef CONFIG_OPENVSWITCH_VXLAN
+	&ovs_vxlan_vport_ops,
+#endif
 };
 
 /* Protected by RCU read lock for reading, ovs_mutex for writing. */
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 376045c..1a9fbce 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -199,6 +199,7 @@ void ovs_vport_record_error(struct vport *, enum vport_err_type err_type);
 extern const struct vport_ops ovs_netdev_vport_ops;
 extern const struct vport_ops ovs_internal_vport_ops;
 extern const struct vport_ops ovs_gre_vport_ops;
+extern const struct vport_ops ovs_vxlan_vport_ops;
 
 static inline void ovs_skb_postpush_rcsum(struct sk_buff *skb,
 				      const void *start, unsigned int len)
-- 
1.7.1

^ permalink raw reply related

* [PATCH net-next v7 2/8] vxlan: Restructure vxlan receive.
From: Pravin B Shelar @ 2013-08-05 17:47 UTC (permalink / raw)
  To: netdev; +Cc: stephen, Pravin B Shelar

Use iptunnel_pull_header() for better code sharing.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
v5-v6:
split from second patch from v5 series.
---
 drivers/net/vxlan.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 9c3d4f0..1cb55bf 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -57,6 +57,7 @@
 #define VXLAN_VID_MASK	(VXLAN_N_VID - 1)
 /* IP header + UDP + VXLAN + Ethernet header */
 #define VXLAN_HEADROOM (20 + 8 + 8 + 14)
+#define VXLAN_HLEN (sizeof(struct udphdr) + sizeof(struct vxlanhdr))
 
 #define VXLAN_FLAGS 0x08000000	/* struct vxlanhdr.vx_flags required value. */
 
@@ -868,15 +869,12 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 	__u32 vni;
 	int err;
 
-	/* pop off outer UDP header */
-	__skb_pull(skb, sizeof(struct udphdr));
-
 	/* Need Vxlan and inner Ethernet header to be present */
-	if (!pskb_may_pull(skb, sizeof(struct vxlanhdr)))
+	if (!pskb_may_pull(skb, VXLAN_HLEN))
 		goto error;
 
-	/* Drop packets with reserved bits set */
-	vxh = (struct vxlanhdr *) skb->data;
+	/* Return packets with reserved bits set */
+	vxh = (struct vxlanhdr *)(udp_hdr(skb) + 1);
 	if (vxh->vx_flags != htonl(VXLAN_FLAGS) ||
 	    (vxh->vx_vni & htonl(0xff))) {
 		netdev_dbg(skb->dev, "invalid vxlan flags=%#x vni=%#x\n",
@@ -884,8 +882,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 		goto error;
 	}
 
-	__skb_pull(skb, sizeof(struct vxlanhdr));
-
 	/* Is this VNI defined? */
 	vni = ntohl(vxh->vx_vni) >> 8;
 	port = inet_sk(sk)->inet_sport;
@@ -896,7 +892,7 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	}
 
-	if (!pskb_may_pull(skb, ETH_HLEN)) {
+	if (iptunnel_pull_header(skb, VXLAN_HLEN, htons(ETH_P_TEB))) {
 		vxlan->dev->stats.rx_length_errors++;
 		vxlan->dev->stats.rx_errors++;
 		goto drop;
@@ -904,8 +900,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 
 	skb_reset_mac_header(skb);
 
-	/* Re-examine inner Ethernet packet */
-	oip = ip_hdr(skb);
 	skb->protocol = eth_type_trans(skb, vxlan->dev);
 
 	/* Ignore packet loops (and multicast echo) */
@@ -913,11 +907,12 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 			       vxlan->dev->dev_addr) == 0)
 		goto drop;
 
+	/* Re-examine inner Ethernet packet */
+	oip = ip_hdr(skb);
 	if ((vxlan->flags & VXLAN_F_LEARN) &&
 	    vxlan_snoop(skb->dev, oip->saddr, eth_hdr(skb)->h_source))
 		goto drop;
 
-	__skb_tunnel_rx(skb, vxlan->dev);
 	skb_reset_network_header(skb);
 
 	/* If the NIC driver gave us an encapsulated packet with
@@ -953,9 +948,6 @@ static int vxlan_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
 
 	return 0;
 error:
-	/* Put UDP header back */
-	__skb_push(skb, sizeof(struct udphdr));
-
 	return 1;
 drop:
 	/* Consume bad packet */
-- 
1.7.1

^ 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