Netdev List
 help / color / mirror / Atom feed
* [PATCH net 2/2] ipv6: ip6_dst_check needs to check for expired dst_entries
From: Hannes Frederic Sowa @ 2013-10-24  5:48 UTC (permalink / raw)
  To: netdev; +Cc: sgunderson, valentyn, yoshfuji

On receiving a packet too big icmp error we check if our current cached
dst_entry in the socket is still valid. This validation check did not
care about the expiration of the (cached) route.

The error path I traced down:
The socket receives a packet too big mtu notification. It still has a
valid dst_entry and thus issues the ip6_rt_pmtu_update on this dst_entry,
setting RTF_EXPIRE and updates the dst.expiration value (which could
fail because of not up-to-date expiration values, see previous patch).

In some seldom cases we race with a) the ip6_fib gc or b) another routing
lookup which would result in a recreation of the cached rt6_info from its
parent non-cached rt6_info. While copying the rt6_info we reinitialize the
metrics store by copying it over from the parent thus invalidating the
just installed pmtu update (both dsts use the same key to the inetpeer
storage). The dst_entry with the just invalidated metrics data would
just get its RTF_EXPIRES flag cleared and would continue to stay valid
for the socket.

We should have not issued the pmtu update on the already expired dst_entry
in the first placed. By checking the expiration on the dst entry and
doing a relookup in case it is out of date we close the race because
we would install a new rt6_info into the fib before we issue the pmtu
update, thus closing this race.

Not reliably updating the dst.expire value was fixed by the patch "ipv6:
reset dst.expires value when clearing expire flag".

Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
Reported-by: Valentijn Sessink <valentyn@blub.net>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
I would propose this patch for -stable.

 net/ipv6/route.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index f54e3a1..04e17b3 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1087,10 +1087,13 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
 	if (rt->rt6i_genid != rt_genid_ipv6(dev_net(rt->dst.dev)))
 		return NULL;
 
-	if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
-		return dst;
+	if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
+		return NULL;
 
-	return NULL;
+	if (rt6_check_expired(rt))
+		return NULL;
+
+	return dst;
 }
 
 static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
-- 
1.8.3.1

^ permalink raw reply related

* Re: 16% regression on 10G caused by TCP small queues
From: Eric Dumazet @ 2013-10-24  6:05 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, ncardwell, dave.taht, netdev
In-Reply-To: <20131023214557.386aad1a@nehalam.linuxnetplumber.net>

On Wed, 2013-10-23 at 21:45 -0700, Stephen Hemminger wrote:
> On Wed, 23 Oct 2013 23:38:16 -0400 (EDT)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Date: Wed, 23 Oct 2013 20:09:49 -0700
> > 
> > > I will check 3.12, but what about users on 3.10 which is the LTS
> > > kernel used by most distros?
> 
> 3.12-rc6 gets line rate again (9.41 Gbit/sec)
> 
> > The fix will be backported to -stable, relax Stephen.
> 
> Sorry, thought sk_pacing_rate depended on FQ qdisc but it is other way around.
> In which case doing merge of these two was sufficient to fix the problem.
> With a minor manual fix up to tcp.h.
> 
> 
> commit 95bd09eb27507691520d39ee1044d6ad831c1168
> Author: Eric Dumazet <edumazet@google.com>
> Date:   Tue Aug 27 05:46:32 2013 -0700
> 
>     tcp: TSO packets automatic sizing
> 
> commit c9eeec26e32e087359160406f96e0949b3cc6f10
> Author: Eric Dumazet <edumazet@google.com>
> Date:   Fri Sep 27 03:28:54 2013 -0700
> 
>     tcp: TSQ can use a dynamic limit

Perfect, thanks for testing Stephen !

^ permalink raw reply

* Re: 16% regression on 10G caused by TCP small queues
From: Eric Dumazet @ 2013-10-24  6:10 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, ncardwell, dave.taht, netdev
In-Reply-To: <20131023214557.386aad1a@nehalam.linuxnetplumber.net>

On Wed, 2013-10-23 at 21:45 -0700, Stephen Hemminger wrote:
> On Wed, 23 Oct 2013 23:38:16 -0400 (EDT)
> David Miller <davem@davemloft.net> wrote:
> 
> > From: Stephen Hemminger <stephen@networkplumber.org>
> > Date: Wed, 23 Oct 2013 20:09:49 -0700
> > 
> > > I will check 3.12, but what about users on 3.10 which is the LTS
> > > kernel used by most distros?
> 
> 3.12-rc6 gets line rate again (9.41 Gbit/sec)
> 
> > The fix will be backported to -stable, relax Stephen.
> 
> Sorry, thought sk_pacing_rate depended on FQ qdisc but it is other way around.
> In which case doing merge of these two was sufficient to fix the problem.
> With a minor manual fix up to tcp.h.

Btw what is the NIC you are using ?

I also had to patch mlx4 driver because it had too big coalescing
parameters, it was before TCP Small Queue dynamic sizing, but its worth
noting that for the initial ramp up (when flow sk_pacing_rate is low
because initial cwin is 10), it might make a difference

This was 

commit ecfd2ce1a9d5e6376ff5c00b366345160abdbbb7
Author: Eric Dumazet <edumazet@google.com>
Date:   Mon Nov 5 16:20:42 2012 +0000

    mlx4: change TX coalescing defaults
    
    mlx4 currently uses a too high tx coalescing setting, deferring
    TX completion interrupts by up to 128 us.
    
    With the recent skb_orphan() removal in commit 8112ec3b872,
    performance of a single TCP flow is capped to ~4 Gbps, unless
    we increase tcp_limit_output_bytes.
    
    I suggest using 16 us instead of 128 us, allowing a finer control.
    
    Performance of a single TCP flow is restored to previous levels,
    while keeping TCP small queues fully enabled with default sysctl.
    
    This patch is also a BQL prereq.

^ permalink raw reply

* Re: [PATCH next] be2net: add support for ndo_busy_poll
From: Eric Dumazet @ 2013-10-24  6:13 UTC (permalink / raw)
  To: Sathya Perla; +Cc: netdev
In-Reply-To: <1382593638-8079-1-git-send-email-sathya.perla@emulex.com>

On Thu, 2013-10-24 at 11:17 +0530, Sathya Perla wrote:
> Includes:
> - ndo_busy_poll implementation
> - Locking between napi and busy_poll
> - Fix rx_post_starvation (replenish rx-queues in out-of-mememory scenario)
>   logic to accomodate busy_poll.

>  	if (work_done) {
> +		gfp_t gfp = (polling == BUSY_POLLING) ? GFP_KERNEL : GFP_ATOMIC;
> +
>  		be_cq_notify(adapter, rx_cq->id, true, work_done);
>  

I do not think its right.

ndo_busy_poll() is not allowed to sleep.

^ permalink raw reply

* Re: 16% regression on 10G caused by TCP small queues
From: Eric Dumazet @ 2013-10-24  6:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, ncardwell, dave.taht, netdev
In-Reply-To: <1382595011.7572.36.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, 2013-10-23 at 23:10 -0700, Eric Dumazet wrote:

> Btw what is the NIC you are using ?

Oh well I read you mail and saw ixgbe was mentioned ;)

^ permalink raw reply

* Re: Deadlock in BPF JIT functions when running upowerd?
From: Eric Dumazet @ 2013-10-24  6:25 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Eric Dumazet, David S. Miller, netdev, linux-kernel
In-Reply-To: <20131024011734.GA14083@birch.djwong.org>

On Wed, 2013-10-23 at 18:17 -0700, Darrick J. Wong wrote:
> Hi,
> 
> I've been observing a softlockup with 3.11.6 and 3.12-rc6.  It looks like
> there's a deadlock occurring on purge_lock in __purge_vmap_area_lazy().  In
> short, the BPF JIT code has been changed[1] to call set_memory_r[ow]() when
> compiling and freeing JIT bytecode memory.  It seems that it's possible for
> upowerd to be compiling some BPF program and call __purge_vmap_area_lazy, then
> the timer interrupt comes in (due to the IPI?) and a softirq calls
> bpf_jit_free, which also calls __purge_vmap_area_lazy.
> 
> I'm not really sure who's at fault here--is this a BPF bug?
> 
> [1] 314beb9bcabfd6b4542ccbced2402af2c6f6142a
>     "x86: bpf_jit_comp: secure bpf jit against spraying attacks"
> 
> --D
> 
> Here's what 3.11.6 spits out; the 3.12-rc6 message has the same traceback.
> 
> [   52.370437] BUG: soft lockup - CPU#3 stuck for 22s! [upowerd:8359]
> [   52.370440] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat_ipv4 xt_conntrack xt_CHECKSUM iptable_mangle fuse tun microcode nfsd nfs_acl exportfs auth_rpcgss nfs lockd sunrpc af_packet xt_physdev xt_hl ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT xt_sctp xt_limit xt_tcpudp xt_addrtype nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ip6table_filter ip6_tables nf_conntrack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack iptable_filter ip_tables x_tables sch_fq_codel bridge stp llc lpc_ich mfd_core loop bcache dm_crypt zlib_deflate libcrc32c firewire_ohci firewire_core usb_storage mpt2sas scsi_transport_sas raid_class
> [   52.370471] CPU: 3 PID: 8359 Comm: upowerd Not tainted 3.11.6-60-flax #1
> [   52.370472] Hardware name: OEM OEM/131-GT-E767, BIOS 6.00 PG 08/25/2011
> [   52.370474] task: ffff8806621f9700 ti: ffff88064b6a0000 task.ti: ffff88064b6a0000
> [   52.370475] RIP: 0010:[<ffffffff816b5a22>]  [<ffffffff816b5a22>] _raw_spin_lock+0x32/0x40
> [   52.370480] RSP: 0018:ffff88067fc63c10  EFLAGS: 00000297
> [   52.370481] RAX: 0000000000000061 RBX: ffff88065a318600 RCX: 0000000000000000
> [   52.370483] RDX: 0000000000000062 RSI: ffff88067fc63ce0 RDI: ffffffff81ea42bc
> [   52.370484] RBP: ffff88067fc63c10 R08: ffffffff81cdd608 R09: 0000000000000000
> [   52.370485] R10: ffff88067fc6d8e0 R11: 0000000000000000 R12: ffff88067fc63b88
> [   52.370486] R13: ffffffff816b7a47 R14: ffff88067fc63c10 R15: ffff88067fc63cd8
> [   52.370487] FS:  00007f55fff297c0(0000) GS:ffff88067fc60000(0000) knlGS:0000000000000000
> [   52.370488] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [   52.370489] CR2: 00007f55fff47000 CR3: 000000065dd10000 CR4: 00000000000007e0
> [   52.370490] Stack:
> [   52.370491]  ffff88067fc63cb0 ffffffff811955fd 0000000000000096 0000000000000347
> [   52.370494]  00000000000003c1 0000000000000001 0000000000000000 0000000000000000
> [   52.370496]  0000000000000033 ffff88067fc63c58 ffff88067fc63c58 0000000000000001
> [   52.370499] Call Trace:
> [   52.370500]  <IRQ> 
> [   52.370501]  [<ffffffff811955fd>] __purge_vmap_area_lazy+0x12d/0x4c0
> [   52.370507]  [<ffffffff8119612c>] vm_unmap_aliases+0x17c/0x190
> [   52.370512]  [<ffffffff81079814>] change_page_attr_set_clr+0xb4/0x4a0
> [   52.370516]  [<ffffffff810a927e>] ? irq_exit+0x7e/0xb0
> [   52.370519]  [<ffffffff81048e44>] ? smp_irq_work_interrupt+0x34/0x40
> [   52.370522]  [<ffffffff81079d8f>] set_memory_rw+0x2f/0x40
> [   52.370525]  [<ffffffff810a0a7c>] bpf_jit_free+0x2c/0x40
> [   52.370528]  [<ffffffff815f48aa>] sk_filter_release_rcu+0x1a/0x30
> [   52.370532]  [<ffffffff811262d2>] rcu_process_callbacks+0x1e2/0x5b0
> [   52.370535]  [<ffffffff810c9999>] ? enqueue_hrtimer+0x39/0xf0
> [   52.370537]  [<ffffffff810a8f20>] __do_softirq+0xe0/0x2f0
> [   52.370541]  [<ffffffff816b851c>] call_softirq+0x1c/0x30
> [   52.370543]  [<ffffffff81046155>] do_softirq+0x55/0x90
> [   52.370545]  [<ffffffff810a928e>] irq_exit+0x8e/0xb0
> [   52.370547]  [<ffffffff816b8b0a>] smp_apic_timer_interrupt+0x4a/0x60
> [   52.370549]  [<ffffffff816b7a47>] apic_timer_interrupt+0x67/0x70
> [   52.370550]  <EOI> 
> [   52.370552]  [<ffffffff8106eeb4>] ? default_send_IPI_mask_allbutself_phys+0xb4/0xe0
> [   52.370559]  [<ffffffff81188af7>] ? handle_pte_fault+0x567/0x920
> [   52.370561]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> [   52.370563]  [<ffffffff81072057>] physflat_send_IPI_allbutself+0x17/0x20
> [   52.370566]  [<ffffffff8106a992>] native_send_call_func_ipi+0x72/0x80
> [   52.370568]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> [   52.370570]  [<ffffffff81105834>] smp_call_function_many+0x1f4/0x290
> [   52.370572]  [<ffffffff81105a8a>] smp_call_function+0x3a/0x60
> [   52.370574]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> [   52.370576]  [<ffffffff81105b18>] on_each_cpu+0x38/0x80
> [   52.370578]  [<ffffffff8107d59d>] flush_tlb_kernel_range+0x6d/0x70
> [   52.370581]  [<ffffffff81195916>] __purge_vmap_area_lazy+0x446/0x4c0
> [   52.370584]  [<ffffffff81228e85>] ? ext4_file_open+0x75/0x1b0
> [   52.370586]  [<ffffffff8119612c>] vm_unmap_aliases+0x17c/0x190
> [   52.370590]  [<ffffffff81079814>] change_page_attr_set_clr+0xb4/0x4a0
> [   52.370592]  [<ffffffff81196ac2>] ? map_vm_area+0x32/0x50
> [   52.370595]  [<ffffffff81197761>] ? __vmalloc_node_range+0x121/0x1f0
> [   52.370597]  [<ffffffff810a08ab>] ? bpf_jit_compile+0x105b/0x1200
> [   52.370600]  [<ffffffff81079d4f>] set_memory_ro+0x2f/0x40
> [   52.370602]  [<ffffffff810744ca>] ? module_alloc+0x5a/0x60
> [   52.370604]  [<ffffffff810a081c>] bpf_jit_compile+0xfcc/0x1200
> [   52.370607]  [<ffffffff811aa75b>] ? __kmalloc+0x18b/0x1f0
> [   52.370610]  [<ffffffff811aa606>] ? __kmalloc+0x36/0x1f0
> [   52.370612]  [<ffffffff815f4b43>] ? sk_chk_filter+0x283/0x390
> [   52.370614]  [<ffffffff815f4d4b>] sk_attach_filter+0xfb/0x1b0
> [   52.370617]  [<ffffffff815d071d>] sock_setsockopt+0x4fd/0x900
> [   52.370620]  [<ffffffff811d2342>] ? fget_light+0x92/0x100
> [   52.370623]  [<ffffffff815cbdd6>] SyS_setsockopt+0xc6/0xd0
> [   52.370625]  [<ffffffff816b6dc6>] system_call_fastpath+0x1a/0x1f
> [   52.370626] Code: 89 e5 65 48 8b 04 25 f0 b8 00 00 83 80 44 e0 ff ff 01 b8 00 01 00 00 f0 66 0f c1 07 0f b6 d4 38 c2 74 0f 66 0f 1f 44 00 00 f3 90 <0f> b6 07 38 d0 75 f7 5d c3 0f 1f 44 00 00 66 66 66 66 90 55 48 

Could you try latest tree, as it includes :

commit d45ed4a4e33ae103053c0a53d280014e7101bb5c
Author: Alexei Starovoitov <ast@plumgrid.com>
Date:   Fri Oct 4 00:14:06 2013 -0700

    net: fix unsafe set_memory_rw from softirq
    


Thanks !

^ permalink raw reply

* Re: [PATCH net 1/2] ipv6: reset dst.expires value when clearing expire flag
From: Eric Dumazet @ 2013-10-24  6:36 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: netdev, sgunderson, valentyn, yoshfuji
In-Reply-To: <20131024054816.GB5973@order.stressinduktion.org>

On Thu, 2013-10-24 at 07:48 +0200, Hannes Frederic Sowa wrote:
> On receiving a packet too big icmp error we update the expire value by
> calling rt6_update_expires. This function uses dst_set_expires which is
> implemented that it can only reduce the expiration value of the dst entry.
> 
> If we insert new routing non-expiry information into the ipv6 fib where
> we already have a matching rt6_info we only clear the RTF_EXPIRES flag
> in rt6i_flags and leave the dst.expires value as is.
> 
> When new mtu information arrives for that cached dst_entry we again
> call dst_set_expires. This time it won't update the dst.expire value
> because we left the dst.expire value intact from the last update. So
> dst_set_expires won't touch dst.expires.
> 
> Fix this by resetting dst.expires when clearing the RTF_EXPIRE flag.
> dst_set_expires checks for a zero expiration and updates the
> dst.expires.
> 
> In the past this (not updating dst.expires) was necessary because
> dst.expire was placed in a union with the dst_entry *from reference. So
> an update on the value would have caused page faults. This split happend
> in ecd9883724b78cc72ed92c98bcb1a46c764fff21 ("ipv6: fix race condition
> regarding dst->expires and dst->from").
> 

Well, this patch removed the :

rt->dst.from = NULL;

from rt6_clean_expires(), right ?

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* Re: [PATCH net 2/2] ipv6: ip6_dst_check needs to check for expired dst_entries
From: Eric Dumazet @ 2013-10-24  6:40 UTC (permalink / raw)
  To: Hannes Frederic Sowa; +Cc: netdev, sgunderson, valentyn, yoshfuji
In-Reply-To: <20131024054824.GA15744@order.stressinduktion.org>

On Thu, 2013-10-24 at 07:48 +0200, Hannes Frederic Sowa wrote:
> On receiving a packet too big icmp error we check if our current cached
> dst_entry in the socket is still valid. This validation check did not
> care about the expiration of the (cached) route.
> 
> The error path I traced down:
> The socket receives a packet too big mtu notification. It still has a
> valid dst_entry and thus issues the ip6_rt_pmtu_update on this dst_entry,
> setting RTF_EXPIRE and updates the dst.expiration value (which could
> fail because of not up-to-date expiration values, see previous patch).
> 
> In some seldom cases we race with a) the ip6_fib gc or b) another routing
> lookup which would result in a recreation of the cached rt6_info from its
> parent non-cached rt6_info. While copying the rt6_info we reinitialize the
> metrics store by copying it over from the parent thus invalidating the
> just installed pmtu update (both dsts use the same key to the inetpeer
> storage). The dst_entry with the just invalidated metrics data would
> just get its RTF_EXPIRES flag cleared and would continue to stay valid
> for the socket.
> 
> We should have not issued the pmtu update on the already expired dst_entry
> in the first placed. By checking the expiration on the dst entry and
> doing a relookup in case it is out of date we close the race because
> we would install a new rt6_info into the fib before we issue the pmtu
> update, thus closing this race.
> 
> Not reliably updating the dst.expire value was fixed by the patch "ipv6:
> reset dst.expires value when clearing expire flag".
> 
> Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
> Reported-by: Valentijn Sessink <valentyn@blub.net>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> I would propose this patch for -stable.
> 
>  net/ipv6/route.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Excellent, thanks a lot !

Reviewed-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply

* Bluetooth 6LoWPAN and routing
From: Jukka Rissanen @ 2013-10-24  6:45 UTC (permalink / raw)
  To: netdev

Hi,

I have been prototyping with BT 6LoWPAN support (using this draft 
http://tools.ietf.org/html/draft-ietf-6lowpan-btle-12 as a reference). I 
sent first version yesterday to linux-bluetooth ml 
http://thread.gmane.org/gmane.linux.bluez.kernel/39394

In this current prototype, after the BT connection is created, the code 
set ups the virtual network interface, sets the IPv6 LL address for it 
and creates an IPv6 route to peer (the BT 6LoWPAN connections are 
point-to-point connections). I am using ip6_route_add() function from 
net/ipv6/route.c file to do that. Unfortunately that function is not 
exported so I GPL exported it for this prototype. Will this kind of 
export accepted in upstream or should I figure out some other way to 
create the desired route?


-- 
Cheers,
Jukka

^ permalink raw reply

* Re: Deadlock in BPF JIT functions when running upowerd?
From: Darrick J. Wong @ 2013-10-24  6:52 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Eric Dumazet, David S. Miller, netdev, linux-kernel
In-Reply-To: <1382595913.7572.40.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, Oct 23, 2013 at 11:25:13PM -0700, Eric Dumazet wrote:
> On Wed, 2013-10-23 at 18:17 -0700, Darrick J. Wong wrote:
> > Hi,
> > 
> > I've been observing a softlockup with 3.11.6 and 3.12-rc6.  It looks like
> > there's a deadlock occurring on purge_lock in __purge_vmap_area_lazy().  In
> > short, the BPF JIT code has been changed[1] to call set_memory_r[ow]() when
> > compiling and freeing JIT bytecode memory.  It seems that it's possible for
> > upowerd to be compiling some BPF program and call __purge_vmap_area_lazy, then
> > the timer interrupt comes in (due to the IPI?) and a softirq calls
> > bpf_jit_free, which also calls __purge_vmap_area_lazy.
> > 
> > I'm not really sure who's at fault here--is this a BPF bug?
> > 
> > [1] 314beb9bcabfd6b4542ccbced2402af2c6f6142a
> >     "x86: bpf_jit_comp: secure bpf jit against spraying attacks"
> > 
> > --D
> > 
> > Here's what 3.11.6 spits out; the 3.12-rc6 message has the same traceback.
> > 
> > [   52.370437] BUG: soft lockup - CPU#3 stuck for 22s! [upowerd:8359]
> > [   52.370440] Modules linked in: ipt_MASQUERADE iptable_nat nf_nat_ipv4 xt_conntrack xt_CHECKSUM iptable_mangle fuse tun microcode nfsd nfs_acl exportfs auth_rpcgss nfs lockd sunrpc af_packet xt_physdev xt_hl ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT xt_sctp xt_limit xt_tcpudp xt_addrtype nf_conntrack_ipv4 nf_defrag_ipv4 xt_state ip6table_filter ip6_tables nf_conntrack_netbios_ns nf_conntrack_broadcast nf_nat_ftp nf_nat nf_conntrack_ftp nf_conntrack iptable_filter ip_tables x_tables sch_fq_codel bridge stp llc lpc_ich mfd_core loop bcache dm_crypt zlib_deflate libcrc32c firewire_ohci firewire_core usb_storage mpt2sas scsi_transport_sas raid_class
> > [   52.370471] CPU: 3 PID: 8359 Comm: upowerd Not tainted 3.11.6-60-flax #1
> > [   52.370472] Hardware name: OEM OEM/131-GT-E767, BIOS 6.00 PG 08/25/2011
> > [   52.370474] task: ffff8806621f9700 ti: ffff88064b6a0000 task.ti: ffff88064b6a0000
> > [   52.370475] RIP: 0010:[<ffffffff816b5a22>]  [<ffffffff816b5a22>] _raw_spin_lock+0x32/0x40
> > [   52.370480] RSP: 0018:ffff88067fc63c10  EFLAGS: 00000297
> > [   52.370481] RAX: 0000000000000061 RBX: ffff88065a318600 RCX: 0000000000000000
> > [   52.370483] RDX: 0000000000000062 RSI: ffff88067fc63ce0 RDI: ffffffff81ea42bc
> > [   52.370484] RBP: ffff88067fc63c10 R08: ffffffff81cdd608 R09: 0000000000000000
> > [   52.370485] R10: ffff88067fc6d8e0 R11: 0000000000000000 R12: ffff88067fc63b88
> > [   52.370486] R13: ffffffff816b7a47 R14: ffff88067fc63c10 R15: ffff88067fc63cd8
> > [   52.370487] FS:  00007f55fff297c0(0000) GS:ffff88067fc60000(0000) knlGS:0000000000000000
> > [   52.370488] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> > [   52.370489] CR2: 00007f55fff47000 CR3: 000000065dd10000 CR4: 00000000000007e0
> > [   52.370490] Stack:
> > [   52.370491]  ffff88067fc63cb0 ffffffff811955fd 0000000000000096 0000000000000347
> > [   52.370494]  00000000000003c1 0000000000000001 0000000000000000 0000000000000000
> > [   52.370496]  0000000000000033 ffff88067fc63c58 ffff88067fc63c58 0000000000000001
> > [   52.370499] Call Trace:
> > [   52.370500]  <IRQ> 
> > [   52.370501]  [<ffffffff811955fd>] __purge_vmap_area_lazy+0x12d/0x4c0
> > [   52.370507]  [<ffffffff8119612c>] vm_unmap_aliases+0x17c/0x190
> > [   52.370512]  [<ffffffff81079814>] change_page_attr_set_clr+0xb4/0x4a0
> > [   52.370516]  [<ffffffff810a927e>] ? irq_exit+0x7e/0xb0
> > [   52.370519]  [<ffffffff81048e44>] ? smp_irq_work_interrupt+0x34/0x40
> > [   52.370522]  [<ffffffff81079d8f>] set_memory_rw+0x2f/0x40
> > [   52.370525]  [<ffffffff810a0a7c>] bpf_jit_free+0x2c/0x40
> > [   52.370528]  [<ffffffff815f48aa>] sk_filter_release_rcu+0x1a/0x30
> > [   52.370532]  [<ffffffff811262d2>] rcu_process_callbacks+0x1e2/0x5b0
> > [   52.370535]  [<ffffffff810c9999>] ? enqueue_hrtimer+0x39/0xf0
> > [   52.370537]  [<ffffffff810a8f20>] __do_softirq+0xe0/0x2f0
> > [   52.370541]  [<ffffffff816b851c>] call_softirq+0x1c/0x30
> > [   52.370543]  [<ffffffff81046155>] do_softirq+0x55/0x90
> > [   52.370545]  [<ffffffff810a928e>] irq_exit+0x8e/0xb0
> > [   52.370547]  [<ffffffff816b8b0a>] smp_apic_timer_interrupt+0x4a/0x60
> > [   52.370549]  [<ffffffff816b7a47>] apic_timer_interrupt+0x67/0x70
> > [   52.370550]  <EOI> 
> > [   52.370552]  [<ffffffff8106eeb4>] ? default_send_IPI_mask_allbutself_phys+0xb4/0xe0
> > [   52.370559]  [<ffffffff81188af7>] ? handle_pte_fault+0x567/0x920
> > [   52.370561]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> > [   52.370563]  [<ffffffff81072057>] physflat_send_IPI_allbutself+0x17/0x20
> > [   52.370566]  [<ffffffff8106a992>] native_send_call_func_ipi+0x72/0x80
> > [   52.370568]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> > [   52.370570]  [<ffffffff81105834>] smp_call_function_many+0x1f4/0x290
> > [   52.370572]  [<ffffffff81105a8a>] smp_call_function+0x3a/0x60
> > [   52.370574]  [<ffffffff8107cf30>] ? rbt_memtype_copy_nth_element+0xc0/0xc0
> > [   52.370576]  [<ffffffff81105b18>] on_each_cpu+0x38/0x80
> > [   52.370578]  [<ffffffff8107d59d>] flush_tlb_kernel_range+0x6d/0x70
> > [   52.370581]  [<ffffffff81195916>] __purge_vmap_area_lazy+0x446/0x4c0
> > [   52.370584]  [<ffffffff81228e85>] ? ext4_file_open+0x75/0x1b0
> > [   52.370586]  [<ffffffff8119612c>] vm_unmap_aliases+0x17c/0x190
> > [   52.370590]  [<ffffffff81079814>] change_page_attr_set_clr+0xb4/0x4a0
> > [   52.370592]  [<ffffffff81196ac2>] ? map_vm_area+0x32/0x50
> > [   52.370595]  [<ffffffff81197761>] ? __vmalloc_node_range+0x121/0x1f0
> > [   52.370597]  [<ffffffff810a08ab>] ? bpf_jit_compile+0x105b/0x1200
> > [   52.370600]  [<ffffffff81079d4f>] set_memory_ro+0x2f/0x40
> > [   52.370602]  [<ffffffff810744ca>] ? module_alloc+0x5a/0x60
> > [   52.370604]  [<ffffffff810a081c>] bpf_jit_compile+0xfcc/0x1200
> > [   52.370607]  [<ffffffff811aa75b>] ? __kmalloc+0x18b/0x1f0
> > [   52.370610]  [<ffffffff811aa606>] ? __kmalloc+0x36/0x1f0
> > [   52.370612]  [<ffffffff815f4b43>] ? sk_chk_filter+0x283/0x390
> > [   52.370614]  [<ffffffff815f4d4b>] sk_attach_filter+0xfb/0x1b0
> > [   52.370617]  [<ffffffff815d071d>] sock_setsockopt+0x4fd/0x900
> > [   52.370620]  [<ffffffff811d2342>] ? fget_light+0x92/0x100
> > [   52.370623]  [<ffffffff815cbdd6>] SyS_setsockopt+0xc6/0xd0
> > [   52.370625]  [<ffffffff816b6dc6>] system_call_fastpath+0x1a/0x1f
> > [   52.370626] Code: 89 e5 65 48 8b 04 25 f0 b8 00 00 83 80 44 e0 ff ff 01 b8 00 01 00 00 f0 66 0f c1 07 0f b6 d4 38 c2 74 0f 66 0f 1f 44 00 00 f3 90 <0f> b6 07 38 d0 75 f7 5d c3 0f 1f 44 00 00 66 66 66 66 90 55 48 
> 
> Could you try latest tree, as it includes :
> 
> commit d45ed4a4e33ae103053c0a53d280014e7101bb5c
> Author: Alexei Starovoitov <ast@plumgrid.com>
> Date:   Fri Oct 4 00:14:06 2013 -0700
> 
>     net: fix unsafe set_memory_rw from softirq

This seems to fix it, thank you! :D
You can add, if you like:
Tested-by: Darrick J. Wong <darrick.wong@oracle.com>

--D
>     
> 
> 
> Thanks !
> 
> 

^ permalink raw reply

* [PATCH 1/1] ax88179_178a: Remove AX_MEDIUM_ALWAYS_ONE bit in AX_MEDIUM_STATUS_MODE register to avoid TX throttling
From: freddy @ 2013-10-24  6:58 UTC (permalink / raw)
  To: davem, linux-usb, linux-kernel, netdev, allan, louis; +Cc: Freddy Xin

From: Freddy Xin <freddy@asix.com.tw>

Remove AX_MEDIUM_ALWAYS_ONE in AX_MEDIUM_STATUS_MODE register.
Setting this bit may cause TX throttling in Half-Duplex mode.

Signed-off-by: Freddy Xin <freddy@asix.com.tw>
---
 drivers/net/usb/ax88179_178a.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 846cc19..8e8d0fc 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -78,7 +78,6 @@
 #define AX_MEDIUM_STATUS_MODE			0x22
 	#define AX_MEDIUM_GIGAMODE	0x01
 	#define AX_MEDIUM_FULL_DUPLEX	0x02
-	#define AX_MEDIUM_ALWAYS_ONE	0x04
 	#define AX_MEDIUM_EN_125MHZ	0x08
 	#define AX_MEDIUM_RXFLOW_CTRLEN	0x10
 	#define AX_MEDIUM_TXFLOW_CTRLEN	0x20
@@ -1065,8 +1064,8 @@ static int ax88179_bind(struct usbnet *dev, struct usb_interface *intf)
 
 	/* Configure default medium type => giga */
 	*tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN |
-		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE |
-		 AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE;
+		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX |
+		 AX_MEDIUM_GIGAMODE;
 	ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
 			  2, 2, tmp16);
 
@@ -1225,7 +1224,7 @@ static int ax88179_link_reset(struct usbnet *dev)
 	}
 
 	mode = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN |
-	       AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE;
+	       AX_MEDIUM_RXFLOW_CTRLEN;
 
 	ax88179_read_cmd(dev, AX_ACCESS_MAC, PHYSICAL_LINK_STATUS,
 			 1, 1, &link_sts);
@@ -1339,8 +1338,8 @@ static int ax88179_reset(struct usbnet *dev)
 
 	/* Configure default medium type => giga */
 	*tmp16 = AX_MEDIUM_RECEIVE_EN | AX_MEDIUM_TXFLOW_CTRLEN |
-		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_ALWAYS_ONE |
-		 AX_MEDIUM_FULL_DUPLEX | AX_MEDIUM_GIGAMODE;
+		 AX_MEDIUM_RXFLOW_CTRLEN | AX_MEDIUM_FULL_DUPLEX |
+		 AX_MEDIUM_GIGAMODE;
 	ax88179_write_cmd(dev, AX_ACCESS_MAC, AX_MEDIUM_STATUS_MODE,
 			  2, 2, tmp16);
 
-- 
1.7.10.4

^ permalink raw reply related

* Re: 16% regression on 10G caused by TCP small queues
From: David Miller @ 2013-10-24  7:01 UTC (permalink / raw)
  To: stephen; +Cc: ncardwell, eric.dumazet, dave.taht, netdev
In-Reply-To: <20131023214557.386aad1a@nehalam.linuxnetplumber.net>

From: Stephen Hemminger <stephen@networkplumber.org>
Date: Wed, 23 Oct 2013 21:45:57 -0700

> Sorry, thought sk_pacing_rate depended on FQ qdisc but it is other way around.
> In which case doing merge of these two was sufficient to fix the problem.
> With a minor manual fix up to tcp.h.

I know, I already have a half-built tree of -stable submissions
that does exactlty this.

^ permalink raw reply

* Re: [PATCH net 1/2] ipv6: reset dst.expires value when clearing expire flag
From: Hannes Frederic Sowa @ 2013-10-24  7:52 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, sgunderson, valentyn, yoshfuji
In-Reply-To: <1382596613.7572.42.camel@edumazet-glaptop.roam.corp.google.com>

On Wed, Oct 23, 2013 at 11:36:53PM -0700, Eric Dumazet wrote:
> On Thu, 2013-10-24 at 07:48 +0200, Hannes Frederic Sowa wrote:
> > On receiving a packet too big icmp error we update the expire value by
> > calling rt6_update_expires. This function uses dst_set_expires which is
> > implemented that it can only reduce the expiration value of the dst entry.
> > 
> > If we insert new routing non-expiry information into the ipv6 fib where
> > we already have a matching rt6_info we only clear the RTF_EXPIRES flag
> > in rt6i_flags and leave the dst.expires value as is.
> > 
> > When new mtu information arrives for that cached dst_entry we again
> > call dst_set_expires. This time it won't update the dst.expire value
> > because we left the dst.expire value intact from the last update. So
> > dst_set_expires won't touch dst.expires.
> > 
> > Fix this by resetting dst.expires when clearing the RTF_EXPIRE flag.
> > dst_set_expires checks for a zero expiration and updates the
> > dst.expires.
> > 
> > In the past this (not updating dst.expires) was necessary because
> > dst.expire was placed in a union with the dst_entry *from reference. So
> > an update on the value would have caused page faults. This split happend
> > in ecd9883724b78cc72ed92c98bcb1a46c764fff21 ("ipv6: fix race condition
> > regarding dst->expires and dst->from").
> > 
> 
> Well, this patch removed the :
> 
> rt->dst.from = NULL;
> 
> from rt6_clean_expires(), right ?

Exactly.

Greetings,

  Hannes

^ permalink raw reply

* Re: [PATCH net 1/2] ipv6: reset dst.expires value when clearing expire flag
From: Valentijn Sessink @ 2013-10-24  7:47 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20131024054816.GB5973@order.stressinduktion.org>

On 24-10-13 07:48, Hannes Frederic Sowa wrote:
> On receiving a packet too big icmp error we update the expire value by
> calling rt6_update_expires. This function uses dst_set_expires which is
> implemented that it can only reduce the expiration value of the dst entry.
> 
> If we insert new routing non-expiry information into the ipv6 fib where
> we already have a matching rt6_info we only clear the RTF_EXPIRES flag
> in rt6i_flags and leave the dst.expires value as is.
> 
> When new mtu information arrives for that cached dst_entry we again
> call dst_set_expires. This time it won't update the dst.expire value
> because we left the dst.expire value intact from the last update. So
> dst_set_expires won't touch dst.expires.
> 
> Fix this by resetting dst.expires when clearing the RTF_EXPIRE flag.
> dst_set_expires checks for a zero expiration and updates the
> dst.expires.
> 
> In the past this (not updating dst.expires) was necessary because
> dst.expire was placed in a union with the dst_entry *from reference. So
> an update on the value would have caused page faults. This split happend
> in ecd9883724b78cc72ed92c98bcb1a46c764fff21 ("ipv6: fix race condition
> regarding dst->expires and dst->from").
> 
> Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
> Reported-by: Valentijn Sessink <valentyn@blub.net>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> I would propose this patch for -stable.
> 
>  include/net/ip6_fib.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
> index 48ec25a..5e661a9 100644
> --- a/include/net/ip6_fib.h
> +++ b/include/net/ip6_fib.h
> @@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
>  static inline void rt6_clean_expires(struct rt6_info *rt)
>  {
>  	rt->rt6i_flags &= ~RTF_EXPIRES;
> +	rt->dst.expires = 0;
>  }
>  
>  static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
> 

Tested-by: Valentijn Sessink <valentyn@blub.net>

^ permalink raw reply

* Re: [PATCH net 2/2] ipv6: ip6_dst_check needs to check for expired dst_entries
From: Valentijn Sessink @ 2013-10-24  7:49 UTC (permalink / raw)
  To: netdev
In-Reply-To: <20131024054824.GA15744@order.stressinduktion.org>

On 24-10-13 07:48, Hannes Frederic Sowa wrote:
> On receiving a packet too big icmp error we check if our current cached
> dst_entry in the socket is still valid. This validation check did not
> care about the expiration of the (cached) route.
> 
> The error path I traced down:
> The socket receives a packet too big mtu notification. It still has a
> valid dst_entry and thus issues the ip6_rt_pmtu_update on this dst_entry,
> setting RTF_EXPIRE and updates the dst.expiration value (which could
> fail because of not up-to-date expiration values, see previous patch).
> 
> In some seldom cases we race with a) the ip6_fib gc or b) another routing
> lookup which would result in a recreation of the cached rt6_info from its
> parent non-cached rt6_info. While copying the rt6_info we reinitialize the
> metrics store by copying it over from the parent thus invalidating the
> just installed pmtu update (both dsts use the same key to the inetpeer
> storage). The dst_entry with the just invalidated metrics data would
> just get its RTF_EXPIRES flag cleared and would continue to stay valid
> for the socket.
> 
> We should have not issued the pmtu update on the already expired dst_entry
> in the first placed. By checking the expiration on the dst entry and
> doing a relookup in case it is out of date we close the race because
> we would install a new rt6_info into the fib before we issue the pmtu
> update, thus closing this race.
> 
> Not reliably updating the dst.expire value was fixed by the patch "ipv6:
> reset dst.expires value when clearing expire flag".
> 
> Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
> Reported-by: Valentijn Sessink <valentyn@blub.net>
> Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> I would propose this patch for -stable.
> 
>  net/ipv6/route.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index f54e3a1..04e17b3 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -1087,10 +1087,13 @@ static struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie)
>  	if (rt->rt6i_genid != rt_genid_ipv6(dev_net(rt->dst.dev)))
>  		return NULL;
>  
> -	if (rt->rt6i_node && (rt->rt6i_node->fn_sernum == cookie))
> -		return dst;
> +	if (!rt->rt6i_node || (rt->rt6i_node->fn_sernum != cookie))
> +		return NULL;
>  
> -	return NULL;
> +	if (rt6_check_expired(rt))
> +		return NULL;
> +
> +	return dst;
>  }
>  
>  static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)

Tested-by: Valentijn Sessink <valentyn@blub.net>

^ permalink raw reply

* [PATCH net v2 1/2] ipv6: reset dst.expires value when clearing expire flag
From: Hannes Frederic Sowa @ 2013-10-24  8:14 UTC (permalink / raw)
  To: netdev, sgunderson, valentyn, yoshfuji, edumazet
In-Reply-To: <20131024054816.GB5973@order.stressinduktion.org>

On receiving a packet too big icmp error we update the expire value by
calling rt6_update_expires. This function uses dst_set_expires which is
implemented that it can only reduce the expiration value of the dst entry.

If we insert new routing non-expiry information into the ipv6 fib where
we already have a matching rt6_info we only clear the RTF_EXPIRES flag
in rt6i_flags and leave the dst.expires value as is.

When new mtu information arrives for that cached dst_entry we again
call dst_set_expires. This time it won't update the dst.expire value
because we left the dst.expire value intact from the last update. So
dst_set_expires won't touch dst.expires.

Fix this by resetting dst.expires when clearing the RTF_EXPIRE flag.
dst_set_expires checks for a zero expiration and updates the
dst.expires.

In the past this (not updating dst.expires) was necessary because
dst.expire was placed in a union with the dst_entry *from reference
and rt6_clean_expires did assign NULL to it. This split happend in
ecd9883724b78cc72ed92c98bcb1a46c764fff21 ("ipv6: fix race condition
regarding dst->expires and dst->from").

Reported-by: Steinar H. Gunderson <sgunderson@bigfoot.com>
Reported-by: Valentijn Sessink <valentyn@blub.net>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Tested-by: Valentijn Sessink <valentyn@blub.net>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
v2: I wrote the commit message this morning and forgot about the fact that
that the mentioned commit did actually reset the expire value before. So
just improve the commit message to clear things up. Thanks, Eric!

 include/net/ip6_fib.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 48ec25a..5e661a9 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
 static inline void rt6_clean_expires(struct rt6_info *rt)
 {
 	rt->rt6i_flags &= ~RTF_EXPIRES;
+	rt->dst.expires = 0;
 }
 
 static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
-- 
1.8.3.1

^ permalink raw reply related

* [PATCH 1/1] drivers:net:wireless  return -ENOMEM if kzalloc fails
From: Jing Wang @ 2013-10-24  8:14 UTC (permalink / raw)
  To: linux-wireless, netdev; +Cc: Jing Wang

From: Jing Wang <windsdaemon@gmail.com>

the original code used goto out if kzalloc fails,but the out include kfree,
so return -ENOMEME if kzalloc fails.

Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
 drivers/net/wireless/ti/wl1251/acx.c |  207 +++++++++++-----------------------
 1 files changed, 68 insertions(+), 139 deletions(-)

diff --git a/drivers/net/wireless/ti/wl1251/acx.c b/drivers/net/wireless/ti/wl1251/acx.c
index db6430c..bb0edc9 100644
--- a/drivers/net/wireless/ti/wl1251/acx.c
+++ b/drivers/net/wireless/ti/wl1251/acx.c
@@ -18,10 +18,8 @@ int wl1251_acx_frame_rates(struct wl1251 *wl, u8 ctrl_rate, u8 ctrl_mod,
 	wl1251_debug(DEBUG_ACX, "acx frame rates");
 
 	rates = kzalloc(sizeof(*rates), GFP_KERNEL);
-	if (!rates) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!rates)
+		return -ENOMEM;
 
 	rates->tx_ctrl_frame_rate = ctrl_rate;
 	rates->tx_ctrl_frame_mod = ctrl_mod;
@@ -49,10 +47,8 @@ int wl1251_acx_station_id(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx dot11_station_id");
 
 	mac = kzalloc(sizeof(*mac), GFP_KERNEL);
-	if (!mac) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!mac)
+		return -ENOMEM;
 
 	for (i = 0; i < ETH_ALEN; i++)
 		mac->mac[i] = wl->mac_addr[ETH_ALEN - 1 - i];
@@ -74,10 +70,8 @@ int wl1251_acx_default_key(struct wl1251 *wl, u8 key_id)
 	wl1251_debug(DEBUG_ACX, "acx dot11_default_key (%d)", key_id);
 
 	default_key = kzalloc(sizeof(*default_key), GFP_KERNEL);
-	if (!default_key) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!default_key)
+		return -ENOMEM;
 
 	default_key->id = key_id;
 
@@ -104,10 +98,8 @@ int wl1251_acx_wake_up_conditions(struct wl1251 *wl, u8 wake_up_event,
 	wl1251_debug(DEBUG_ACX, "acx wake up conditions");
 
 	wake_up = kzalloc(sizeof(*wake_up), GFP_KERNEL);
-	if (!wake_up) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!wake_up)
+		return -ENOMEM;
 
 	wake_up->wake_up_event = wake_up_event;
 	wake_up->listen_interval = listen_interval;
@@ -132,10 +124,8 @@ int wl1251_acx_sleep_auth(struct wl1251 *wl, u8 sleep_auth)
 	wl1251_debug(DEBUG_ACX, "acx sleep auth");
 
 	auth = kzalloc(sizeof(*auth), GFP_KERNEL);
-	if (!auth) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!auth)
+		return -ENOMEM;
 
 	auth->sleep_auth = sleep_auth;
 
@@ -154,10 +144,8 @@ int wl1251_acx_fw_version(struct wl1251 *wl, char *buf, size_t len)
 	wl1251_debug(DEBUG_ACX, "acx fw rev");
 
 	rev = kzalloc(sizeof(*rev), GFP_KERNEL);
-	if (!rev) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!rev)
+		return -ENOMEM;
 
 	ret = wl1251_cmd_interrogate(wl, ACX_FW_REV, rev, sizeof(*rev));
 	if (ret < 0) {
@@ -191,10 +179,8 @@ int wl1251_acx_tx_power(struct wl1251 *wl, int power)
 		return -EINVAL;
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->current_tx_power = power * 10;
 
@@ -217,10 +203,8 @@ int wl1251_acx_feature_cfg(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx feature cfg");
 
 	feature = kzalloc(sizeof(*feature), GFP_KERNEL);
-	if (!feature) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!feature)
+		return -ENOMEM;
 
 	/* DF_ENCRYPTION_DISABLE and DF_SNIFF_MODE_ENABLE are disabled */
 	feature->data_flow_options = 0;
@@ -261,10 +245,8 @@ int wl1251_acx_data_path_params(struct wl1251 *wl,
 	wl1251_debug(DEBUG_ACX, "acx data path params");
 
 	params = kzalloc(sizeof(*params), GFP_KERNEL);
-	if (!params) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!params)
+		return -ENOMEM;
 
 	params->rx_packet_ring_chunk_size = DP_RX_PACKET_RING_CHUNK_SIZE;
 	params->tx_packet_ring_chunk_size = DP_TX_PACKET_RING_CHUNK_SIZE;
@@ -309,10 +291,8 @@ int wl1251_acx_rx_msdu_life_time(struct wl1251 *wl, u32 life_time)
 	wl1251_debug(DEBUG_ACX, "acx rx msdu life time");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->lifetime = life_time;
 	ret = wl1251_cmd_configure(wl, DOT11_RX_MSDU_LIFE_TIME,
@@ -335,10 +315,8 @@ int wl1251_acx_rx_config(struct wl1251 *wl, u32 config, u32 filter)
 	wl1251_debug(DEBUG_ACX, "acx rx config");
 
 	rx_config = kzalloc(sizeof(*rx_config), GFP_KERNEL);
-	if (!rx_config) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!rx_config)
+		return -ENOMEM;
 
 	rx_config->config_options = config;
 	rx_config->filter_options = filter;
@@ -363,10 +341,8 @@ int wl1251_acx_pd_threshold(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx data pd threshold");
 
 	pd = kzalloc(sizeof(*pd), GFP_KERNEL);
-	if (!pd) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!pd)
+		return -ENOMEM;
 
 	/* FIXME: threshold value not set */
 
@@ -389,10 +365,8 @@ int wl1251_acx_slot(struct wl1251 *wl, enum acx_slot_type slot_time)
 	wl1251_debug(DEBUG_ACX, "acx slot");
 
 	slot = kzalloc(sizeof(*slot), GFP_KERNEL);
-	if (!slot) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!slot)
+		return -ENOMEM;
 
 	slot->wone_index = STATION_WONE_INDEX;
 	slot->slot_time = slot_time;
@@ -416,10 +390,8 @@ int wl1251_acx_group_address_tbl(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx group address tbl");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	/* MAC filtering */
 	acx->enabled = 0;
@@ -444,10 +416,8 @@ int wl1251_acx_service_period_timeout(struct wl1251 *wl)
 	int ret;
 
 	rx_timeout = kzalloc(sizeof(*rx_timeout), GFP_KERNEL);
-	if (!rx_timeout) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!rx_timeout)
+		return -ENOMEM;
 
 	wl1251_debug(DEBUG_ACX, "acx service period timeout");
 
@@ -475,10 +445,8 @@ int wl1251_acx_rts_threshold(struct wl1251 *wl, u16 rts_threshold)
 	wl1251_debug(DEBUG_ACX, "acx rts threshold");
 
 	rts = kzalloc(sizeof(*rts), GFP_KERNEL);
-	if (!rts) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!rts)
+		return -ENOMEM;
 
 	rts->threshold = rts_threshold;
 
@@ -501,10 +469,8 @@ int wl1251_acx_beacon_filter_opt(struct wl1251 *wl, bool enable_filter)
 	wl1251_debug(DEBUG_ACX, "acx beacon filter opt");
 
 	beacon_filter = kzalloc(sizeof(*beacon_filter), GFP_KERNEL);
-	if (!beacon_filter) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!beacon_filter)
+		return -ENOMEM;
 
 	beacon_filter->enable = enable_filter;
 	beacon_filter->max_num_beacons = 0;
@@ -530,10 +496,8 @@ int wl1251_acx_beacon_filter_table(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx beacon filter table");
 
 	ie_table = kzalloc(sizeof(*ie_table), GFP_KERNEL);
-	if (!ie_table) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!ie_table)
+		return -ENOMEM;
 
 	/* configure default beacon pass-through rules */
 	ie_table->num_ie = 1;
@@ -560,10 +524,8 @@ int wl1251_acx_conn_monit_params(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx connection monitor parameters");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->synch_fail_thold = SYNCH_FAIL_DEFAULT_THRESHOLD;
 	acx->bss_lose_timeout = NO_BEACON_DEFAULT_TIMEOUT;
@@ -589,10 +551,8 @@ int wl1251_acx_sg_enable(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx sg enable");
 
 	pta = kzalloc(sizeof(*pta), GFP_KERNEL);
-	if (!pta) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!pta)
+		return -ENOMEM;
 
 	pta->enable = SG_ENABLE;
 
@@ -615,10 +575,8 @@ int wl1251_acx_sg_cfg(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx sg cfg");
 
 	param = kzalloc(sizeof(*param), GFP_KERNEL);
-	if (!param) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!param)
+		return -ENOMEM;
 
 	/* BT-WLAN coext parameters */
 	param->min_rate = RATE_INDEX_24MBPS;
@@ -669,10 +627,8 @@ int wl1251_acx_cca_threshold(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx cca threshold");
 
 	detection = kzalloc(sizeof(*detection), GFP_KERNEL);
-	if (!detection) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!detection)
+		return -ENOMEM;
 
 	detection->rx_cca_threshold = CCA_THRSH_DISABLE_ENERGY_D;
 	detection->tx_energy_detection = 0;
@@ -695,10 +651,8 @@ int wl1251_acx_bcn_dtim_options(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx bcn dtim options");
 
 	bb = kzalloc(sizeof(*bb), GFP_KERNEL);
-	if (!bb) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!bb)
+		return -ENOMEM;
 
 	bb->beacon_rx_timeout = BCN_RX_TIMEOUT_DEF_VALUE;
 	bb->broadcast_timeout = BROADCAST_RX_TIMEOUT_DEF_VALUE;
@@ -724,10 +678,8 @@ int wl1251_acx_aid(struct wl1251 *wl, u16 aid)
 	wl1251_debug(DEBUG_ACX, "acx aid");
 
 	acx_aid = kzalloc(sizeof(*acx_aid), GFP_KERNEL);
-	if (!acx_aid) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx_aid)
+		return -ENOMEM;
 
 	acx_aid->aid = aid;
 
@@ -750,10 +702,8 @@ int wl1251_acx_event_mbox_mask(struct wl1251 *wl, u32 event_mask)
 	wl1251_debug(DEBUG_ACX, "acx event mbox mask");
 
 	mask = kzalloc(sizeof(*mask), GFP_KERNEL);
-	if (!mask) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!mask)
+		return -ENOMEM;
 
 	/* high event mask is unused */
 	mask->high_event_mask = 0xffffffff;
@@ -805,10 +755,8 @@ int wl1251_acx_set_preamble(struct wl1251 *wl, enum acx_preamble_type preamble)
 	wl1251_debug(DEBUG_ACX, "acx_set_preamble");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->preamble = preamble;
 
@@ -832,10 +780,8 @@ int wl1251_acx_cts_protect(struct wl1251 *wl,
 	wl1251_debug(DEBUG_ACX, "acx_set_ctsprotect");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->ctsprotect = ctsprotect;
 
@@ -856,10 +802,8 @@ int wl1251_acx_tsf_info(struct wl1251 *wl, u64 *mactime)
 	int ret;
 
 	tsf_info = kzalloc(sizeof(*tsf_info), GFP_KERNEL);
-	if (!tsf_info) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!tsf_info)
+		return -ENOMEM;
 
 	ret = wl1251_cmd_interrogate(wl, ACX_TSF_INFO,
 				     tsf_info, sizeof(*tsf_info));
@@ -900,11 +844,8 @@ int wl1251_acx_rate_policies(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx rate policies");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	/* configure one default (one-size-fits-all) rate class */
 	acx->rate_class_cnt = 1;
@@ -932,10 +873,8 @@ int wl1251_acx_mem_cfg(struct wl1251 *wl)
 	wl1251_debug(DEBUG_ACX, "acx mem cfg");
 
 	mem_conf = kzalloc(sizeof(*mem_conf), GFP_KERNEL);
-	if (!mem_conf) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!mem_conf)
+		return -ENOMEM;
 
 	/* memory config */
 	mem_conf->mem_config.num_stations = cpu_to_le16(DEFAULT_NUM_STATIONS);
@@ -979,10 +918,8 @@ int wl1251_acx_wr_tbtt_and_dtim(struct wl1251 *wl, u16 tbtt, u8 dtim)
 	wl1251_debug(DEBUG_ACX, "acx tbtt and dtim");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->tbtt = tbtt;
 	acx->dtim = dtim;
@@ -1008,10 +945,8 @@ int wl1251_acx_bet_enable(struct wl1251 *wl, enum wl1251_acx_bet_mode mode,
 	wl1251_debug(DEBUG_ACX, "acx bet enable");
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->enable = mode;
 	acx->max_consecutive = max_consecutive;
@@ -1037,11 +972,8 @@ int wl1251_acx_ac_cfg(struct wl1251 *wl, u8 ac, u8 cw_min, u16 cw_max,
 		     "aifs %d txop %d", ac, cw_min, cw_max, aifs, txop);
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->ac = ac;
 	acx->cw_min = cw_min;
@@ -1073,11 +1005,8 @@ int wl1251_acx_tid_cfg(struct wl1251 *wl, u8 queue,
 		     ps_scheme, ack_policy);
 
 	acx = kzalloc(sizeof(*acx), GFP_KERNEL);
-
-	if (!acx) {
-		ret = -ENOMEM;
-		goto out;
-	}
+	if (!acx)
+		return -ENOMEM;
 
 	acx->queue = queue;
 	acx->type = type;
-- 
1.7.1

^ permalink raw reply related

* Re: [PATCH net v3] be2net: Warn users of possible broken functionality on BE2 cards with very old FW versions with latest driver
From: Ivan Vecera @ 2013-10-24  8:37 UTC (permalink / raw)
  To: Somnath Kotur; +Cc: netdev, davem
In-Reply-To: <6e195c58-1709-45de-a2e6-59cd40c0e591@CMEXHTCAS2.ad.emulex.com>

Hi Som,
see my inline comment below...

Ivan
On 10/23/2013 01:29 PM, Somnath Kotur wrote:
> On very old FW versions < 4.0, the mailbox command to set interrupts
> on the card succeeds even though it is not supported and should have
> failed, leading to a scenario where interrupts do not work.
> Hence warn users to upgrade to a suitable FW version to avoid seeing
> broken functionality.
>
> Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
> ---
> v3: Incorporated comments from Ben Hutchings, Joe Perches and Ivan Vercera
>
>   drivers/net/ethernet/emulex/benet/be.h      |    9 +++++++++
>   drivers/net/ethernet/emulex/benet/be_main.c |    6 ++++++
>   2 files changed, 15 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
> index db02023..da9c04b 100644
> --- a/drivers/net/ethernet/emulex/benet/be.h
> +++ b/drivers/net/ethernet/emulex/benet/be.h
> @@ -696,6 +696,15 @@ static inline int qnq_async_evt_rcvd(struct be_adapter *adapter)
>   	return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD;
>   }
>
> +static inline u32 fw_major_num(const char *fw_ver)
> +{
> +	int fw_major = 0;
> +
> +	sscanf(fw_ver, "%d.", &fw_major);
> +
> +	return fw_major;
> +}
> +
You changed fw_major as I mentioned in our private discussion but the 
return type should be also 'int' and not 'u32'.

>   extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
>   		u16 num_popped);
>   extern void be_link_status_update(struct be_adapter *adapter, u8 link_status);
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> index 2c38cc4..53ed58b 100644
> --- a/drivers/net/ethernet/emulex/benet/be_main.c
> +++ b/drivers/net/ethernet/emulex/benet/be_main.c
> @@ -3247,6 +3247,12 @@ static int be_setup(struct be_adapter *adapter)
>
>   	be_cmd_get_fw_ver(adapter, adapter->fw_ver, adapter->fw_on_flash);
>
> +	if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) {
> +		dev_err(dev, "Firmware on card is old(%s), IRQs may not work",
> +			adapter->fw_ver);
> +		dev_err(dev, "Please upgrade firmware to version >= 4.0\n");
> +	}
> +
>   	if (adapter->vlans_added)
>   		be_vid_config(adapter);
>
>

^ permalink raw reply

* RE: [PATCHv2 net] netpoll: fix rx_hook() interface by passing the skb
From: David Laight @ 2013-10-24  8:43 UTC (permalink / raw)
  To: Antonio Quartulli, David Miller; +Cc: netdev
In-Reply-To: <1382564190-334-1-git-send-email-antonio@meshcoding.com>

> Subject: [PATCHv2 net] netpoll: fix rx_hook() interface by passing the skb
> 
> Right now skb->data is passed to rx_hook() even if the skb
> has not been linearised and without giving rx_hook() a way
> to linearise it.
> 
> Change the rx_hook() interface and make it accept the skb
> and the offset to the UDP payload as arguments. rx_hook() is
> also renamed to rx_skb_hook() to ensure that out of the tree
> users notice the API change.
> 
> In this way any rx_skb_hook() implementation can perform all
> the needed operations to properly (and safely) access the
> skb data.
...
> @@ -820,7 +823,10 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
> 
>  		len -= iph->ihl*4;
>  		uh = (struct udphdr *)(((char *)iph) + iph->ihl*4);
> +		offset = (unsigned char *)(uh + 1) - skb->data;
>  		ulen = ntohs(uh->len);
> +		data_len = skb->len - offset;
> +		source = ntohs(uh->source);
> 
>  		if (ulen != len)
>  			goto out;
> @@ -834,9 +840,7 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
>  			if (np->local_port && np->local_port != ntohs(uh->dest))
>  				continue;
> 
> -			np->rx_hook(np, ntohs(uh->source),
> -				       (char *)(uh+1),
> -				       ulen - sizeof(struct udphdr));
> +			np->rx_skb_hook(np, source, skb, offset, data_len);
>  			hits++;
>  		}
>  	} else {

>From a code optimisation point of view you probably don't want to be
calculating the source, offset and length early.
It is quite likely that the local variables will have to be written
to the stack (because of the function calls) - so it is almost
certainly more efficient to calculate them just before the call.

	David

^ permalink raw reply

* [PATCH net v4] be2net: Warn users of possible broken functionality on BE2 cards with very old FW versions with latest driver
From: Somnath Kotur @ 2013-10-24  9:07 UTC (permalink / raw)
  To: netdev; +Cc: davem, Somnath Kotur

On very old FW versions < 4.0, the mailbox command to set interrupts
on the card succeeds even though it is not supported and should have
failed, leading to a scenario where interrupts do not work.
Hence warn users to upgrade to a suitable FW version to avoid seeing
broken functionality.

Signed-off-by: Somnath Kotur <somnath.kotur@emulex.com>
---
v3: Incorporated comments from Ben Hutchings, Joe Perches and Ivan Vercera
v4: Incorporated comments from Ivan Vercera

 drivers/net/ethernet/emulex/benet/be.h      |    9 +++++++++
 drivers/net/ethernet/emulex/benet/be_main.c |    6 ++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/emulex/benet/be.h b/drivers/net/ethernet/emulex/benet/be.h
index db02023..da9c04b 100644
--- a/drivers/net/ethernet/emulex/benet/be.h
+++ b/drivers/net/ethernet/emulex/benet/be.h
@@ -696,6 +696,15 @@ static inline int qnq_async_evt_rcvd(struct be_adapter *adapter)
 	return adapter->flags & BE_FLAGS_QNQ_ASYNC_EVT_RCVD;
 }
 
+static inline int fw_major_num(const char *fw_ver)
+{
+	int fw_major = 0;
+
+	sscanf(fw_ver, "%d.", &fw_major);
+
+	return fw_major;
+}
+
 extern void be_cq_notify(struct be_adapter *adapter, u16 qid, bool arm,
 		u16 num_popped);
 extern void be_link_status_update(struct be_adapter *adapter, u8 link_status);
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 2c38cc4..53ed58b 100644
--- a/drivers/net/ethernet/emulex/benet/be_main.c
+++ b/drivers/net/ethernet/emulex/benet/be_main.c
@@ -3247,6 +3247,12 @@ static int be_setup(struct be_adapter *adapter)
 
 	be_cmd_get_fw_ver(adapter, adapter->fw_ver, adapter->fw_on_flash);
 
+	if (BE2_chip(adapter) && fw_major_num(adapter->fw_ver) < 4) {
+		dev_err(dev, "Firmware on card is old(%s), IRQs may not work.",
+			adapter->fw_ver);
+		dev_err(dev, "Please upgrade firmware to version >= 4.0\n");
+	}
+
 	if (adapter->vlans_added)
 		be_vid_config(adapter);
 
-- 
1.6.0.2

^ permalink raw reply related

* [PATCH 1/1] net:sched  fix a bug about memery leak
From: Jing Wang @ 2013-10-24  9:06 UTC (permalink / raw)
  To: netdev; +Cc: Jing Wang

From: Jing Wang <windsdaemon@gmail.com>

the code isn't properly release memory

Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
 net/sched/cls_route.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 37da567..118f8d5 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -466,11 +466,11 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
 		goto reinsert;
 	}
 
-	err = -ENOBUFS;
+	err = -ENOMEM;
 	if (head == NULL) {
 		head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
 		if (head == NULL)
-			goto errout;
+			goto errhead;
 
 		tcf_tree_lock(tp);
 		tp->root = head;
@@ -479,7 +479,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
 
 	f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
 	if (f == NULL)
-		goto errout;
+		goto errflt;
 
 	err = route4_set_parms(net, tp, base, f, handle, head, tb,
 		tca[TCA_RATE], 1);
@@ -517,6 +517,9 @@ reinsert:
 
 errout:
 	kfree(f);
+errflt:
+    kfree(head);
+errhead:
 	return err;
 }
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH 1/1] net:sched  fix a bug about memery leak
From: Jing Wang @ 2013-10-24  9:12 UTC (permalink / raw)
  To: davem, jhs, netdev; +Cc: Jing Wang

From: Jing Wang <windsdaemon@gmail.com>

the code isn't properly release memory

Signed-off-by: Jing Wang <windsdaemon@gmail.com>
---
 net/sched/cls_route.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
index 37da567..118f8d5 100644
--- a/net/sched/cls_route.c
+++ b/net/sched/cls_route.c
@@ -466,11 +466,11 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
 		goto reinsert;
 	}
 
-	err = -ENOBUFS;
+	err = -ENOMEM;
 	if (head == NULL) {
 		head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
 		if (head == NULL)
-			goto errout;
+			goto errhead;
 
 		tcf_tree_lock(tp);
 		tp->root = head;
@@ -479,7 +479,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
 
 	f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
 	if (f == NULL)
-		goto errout;
+		goto errflt;
 
 	err = route4_set_parms(net, tp, base, f, handle, head, tb,
 		tca[TCA_RATE], 1);
@@ -517,6 +517,9 @@ reinsert:
 
 errout:
 	kfree(f);
+errflt:
+    kfree(head);
+errhead:
 	return err;
 }
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH net] tcp: delete unused req in tcp_synack_rtt_meas()
From: Weiping Pan @ 2013-10-24  9:31 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

The parameter req is not used since
375fe02c9179(tcp: consolidate SYNACK RTT sampling).

Signed-off-by: Weiping Pan <panweiping3@gmail.com>
---
 net/ipv4/tcp_input.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index a16b01b..ac8781a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -2871,7 +2871,7 @@ static inline bool tcp_ack_update_rtt(struct sock *sk, const int flag,
 }
 
 /* Compute time elapsed between (last) SYNACK and the ACK completing 3WHS. */
-static void tcp_synack_rtt_meas(struct sock *sk, struct request_sock *req)
+static void tcp_synack_rtt_meas(struct sock *sk)
 {
 	struct tcp_sock *tp = tcp_sk(sk);
 	s32 seq_rtt = -1;
@@ -5694,7 +5694,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
 		tp->snd_una = TCP_SKB_CB(skb)->ack_seq;
 		tp->snd_wnd = ntohs(th->window) << tp->rx_opt.snd_wscale;
 		tcp_init_wl(tp, TCP_SKB_CB(skb)->seq);
-		tcp_synack_rtt_meas(sk, req);
+		tcp_synack_rtt_meas(sk);
 
 		if (tp->rx_opt.tstamp_ok)
 			tp->advmss -= TCPOLEN_TSTAMP_ALIGNED;
-- 
1.7.4

^ permalink raw reply related

* Re: [PATCH 1/1] net:sched  fix a bug about memery leak
From: Eric Dumazet @ 2013-10-24  9:33 UTC (permalink / raw)
  To: Jing Wang; +Cc: davem, jhs, netdev
In-Reply-To: <1382605964-2693-1-git-send-email-windsdaemon@gmail.com>

On Thu, 2013-10-24 at 17:12 +0800, Jing Wang wrote:
> From: Jing Wang <windsdaemon@gmail.com>
> 
> the code isn't properly release memory
> 
> Signed-off-by: Jing Wang <windsdaemon@gmail.com>
> ---
>  net/sched/cls_route.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
> index 37da567..118f8d5 100644
> --- a/net/sched/cls_route.c
> +++ b/net/sched/cls_route.c
> @@ -466,11 +466,11 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
>  		goto reinsert;
>  	}
>  
> -	err = -ENOBUFS;
> +	err = -ENOMEM;
>  	if (head == NULL) {
>  		head = kzalloc(sizeof(struct route4_head), GFP_KERNEL);
>  		if (head == NULL)
> -			goto errout;
> +			goto errhead;
>  
>  		tcf_tree_lock(tp);
>  		tp->root = head;
> @@ -479,7 +479,7 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,
>  
>  	f = kzalloc(sizeof(struct route4_filter), GFP_KERNEL);
>  	if (f == NULL)
> -		goto errout;
> +		goto errflt;
>  
>  	err = route4_set_parms(net, tp, base, f, handle, head, tb,
>  		tca[TCA_RATE], 1);
> @@ -517,6 +517,9 @@ reinsert:
>  
>  errout:
>  	kfree(f);
> +errflt:
> +    kfree(head);
> +errhead:
>  	return err;
>  }
>  

I don't think this patch is needed or correct.

tp->root is the head, you cannot free it like that.

It will be freed properly in route4_destroy()

Please elaborate, thanks.

^ permalink raw reply

* Re: [PATCH net-next v2 0/5] bonding: patchset for rcu use in bonding
From: Veaceslav Falico @ 2013-10-24  9:35 UTC (permalink / raw)
  To: Ding Tianhong
  Cc: Jay Vosburgh, Andy Gospodarek, David S. Miller,
	Nikolay Aleksandrov, Netdev
In-Reply-To: <52688F33.30904@huawei.com>

On Thu, Oct 24, 2013 at 11:08:35AM +0800, Ding Tianhong wrote:
>Hi:
>
>The slave list will add and del by bond_master_upper_dev_link() and bond_upper_dev_unlink(),
>which will call call_netdevice_notifiers(), even it is safe to call it in write bond lock now,
>but we can't sure that whether it is safe later, because other drivers may deal NETDEV_CHANGEUPPER
>in sleep way, so I didn't admit move the bond_upper_dev_unlink() in write bond lock.
>
>now the bond_for_each_slave only protect by rtnl_lock(), maybe use bond_for_each_slave_rcu is a good
>way to protect slave list for bond, but as a system slow path, it is no need to transform bond_for_each_slave()
>to bond_for_each_slave_rcu() in slow path, so in the patchset, I will remove the unused read bond lock
>for monitor function, maybe it is a better way, I will wait to accept any relay for it.
>
>Thanks for the Veaceslav Falico opinion.

No problem.

Nacked-by: Veaceslav Falico <vfalico@redhat.com>

Now, please, make some normal changelogs, or convince David that I'm an
idiot.

>
>v2: add and modify commit for patchset and patch, it will be the first step for the whole patchset.
>
>Ding Tianhong (5):
>  bonding: remove bond read lock for bond_mii_monitor()
>  bonding: remove bond read lock for bond_alb_monitor()
>  bonding: remove bond read lock for bond_loadbalance_arp_mon()
>  bonding: remove bond read lock for bond_activebackup_arp_mon()
>  bonding: remove bond read lock for bond_3ad_state_machine_handler()
>
> drivers/net/bonding/bond_3ad.c  |   9 ++--
> drivers/net/bonding/bond_alb.c  |  20 ++------
> drivers/net/bonding/bond_main.c | 100 +++++++++++++---------------------------
> 3 files changed, 40 insertions(+), 89 deletions(-)
>
>-- 
>1.8.2.1
>
>
>

^ 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