Netdev List
 help / color / mirror / Atom feed
* Re: fake rtable dst patch applied but kernel keeps panicing
From: Peter Huang(Peng) @ 2012-04-19  8:22 UTC (permalink / raw)
  To: Massimo Cetra; +Cc: netdev, Eric Dumazet
In-Reply-To: <4F8E9291.9000607@navynet.it>

Hi, Massimo

can this be reproduce easily or depend on some HW or SW environment?

This patch already verified on 2.6.32.36/54,3.3.1, 3.4.rc[23] for over
6 hours, but didn't encounter this problem.

On 2012/4/18 18:08, Massimo Cetra wrote:
> Hi Eric,
> Hi Peter,
>
> I applied the 1st patch by Peter to a 3.2.14 kernel, compiled, installed
> and rebooted.
>
> I have had another panic and i'm attaching the oops as i received it
> through netcnsole.
>
> I don't think the patch is enough to prevent the OOPS.
>
> Can i be helpful in some way ?
>
> Thanks,
> Massimo

^ permalink raw reply

* Re: fake rtable dst patch applied but kernel keeps panicing
From: Eric Dumazet @ 2012-04-19  8:14 UTC (permalink / raw)
  To: Massimo Cetra; +Cc: Massimo Cetra, netdev, peter.huangpeng
In-Reply-To: <4F8FC66F.90703@navynet.it>

On Thu, 2012-04-19 at 10:01 +0200, Massimo Cetra wrote:
> On 18/04/2012 12:31, Eric Dumazet wrote:
> >
> > Seems a different issue, skb->nf_bridge seems to be NULL
> >
> 
> This is another trace of another panic.
> I hope it may be useful.
> Please notice that it is not related to adding/removing br interfaces or 
> tun/vic interfaces from a bridge set.
> It happened suddenly during a normal workload.
> 
> When were those bridge-related bugs introduced ?
> What's the latest release that seems to work ?
> I'm asking so that i can restore some servers to a proper workload.
> 
> 
> Massimo

Maybe you should try latest kernel, because we fixed some bugs lately.

^ permalink raw reply

* Re: [PATCH 1/2] workqueue: Catch more locking problems with flush_work()
From: Yong Zhang @ 2012-04-19  8:10 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: linux-kernel, Tejun Heo, netdev, Ben Dooks
In-Reply-To: <1334805958-29119-1-git-send-email-sboyd@codeaurora.org>

On Wed, Apr 18, 2012 at 08:25:57PM -0700, Stephen Boyd wrote:
> If a workqueue is flushed but the work item is not scheduled to
> run, lockdep checking will be circumvented. For example:
> 
>  static DEFINE_MUTEX(mutex);
> 
>  static void my_work(struct work_struct *w)
>  {
>          mutex_lock(&mutex);
>          mutex_unlock(&mutex);
>  }
> 
>  static DECLARE_WORK(work, my_work);
> 
>  static int __init start_test_module(void)
>  {
>          schedule_work(&work);
>          return 0;
>  }
>  module_init(start_test_module);
> 
>  static void __exit stop_test_module(void)
>  {
>          mutex_lock(&mutex);
>          flush_work(&work);
>          mutex_unlock(&mutex);
>  }
>  module_exit(stop_test_module);
> 
> would only print a warning if the work item was actively running
> when flush_work() was called. Otherwise flush_work() returns
> early. In this trivial example nothing could go wrong, but if the
> work item is schedule via an interrupt we could potentially have a
> scenario where the work item is running just at the time flush_work()

You mean flush_work() could be called in interupt? I don't it is
possible.

> is called. This could become a classic AB-BA locking problem.

I don't see how the deadlock happen, could you please be more
specific?

Thanks,
Yong


> 
> Add a lockdep hint in flush_work() in the "work not running" case
> so that we always catch this potential deadlock scenario.
> 
> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
> ---
>  kernel/workqueue.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 66ec08d..eb800df 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2513,8 +2513,11 @@ bool flush_work(struct work_struct *work)
>  		wait_for_completion(&barr.done);
>  		destroy_work_on_stack(&barr.work);
>  		return true;
> -	} else
> +	} else {
> +		lock_map_acquire(&work->lockdep_map);
> +		lock_map_release(&work->lockdep_map);
>  		return false;
> +	}
>  }
>  EXPORT_SYMBOL_GPL(flush_work);
>  
> -- 
> Sent by an employee of the Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

-- 
Only stand for myself

^ permalink raw reply

* Re: fake rtable dst patch applied but kernel keeps panicing
From: Massimo Cetra @ 2012-04-19  8:01 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Massimo Cetra, netdev, peter.huangpeng
In-Reply-To: <1334745072.2472.110.camel@edumazet-glaptop>

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

On 18/04/2012 12:31, Eric Dumazet wrote:
>
> Seems a different issue, skb->nf_bridge seems to be NULL
>

This is another trace of another panic.
I hope it may be useful.
Please notice that it is not related to adding/removing br interfaces or 
tun/vic interfaces from a bridge set.
It happened suddenly during a normal workload.

When were those bridge-related bugs introduced ?
What's the latest release that seems to work ?
I'm asking so that i can restore some servers to a proper workload.


Massimo

[-- Attachment #2: BUG4.txt --]
[-- Type: text/plain, Size: 25550 bytes --]

Apr 18 16:22:05 lamu [15868.069196] BUG: unable to handle kernel 
Apr 18 16:22:05 NULL pointer dereference
Apr 18 16:22:05 lamu  at 0000000000000018
Apr 18 16:22:05 lamu [15868.084886] IP:
Apr 18 16:22:05 lamu  [<ffffffffa02dc33d>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 18 16:22:05 lamu [15868.098984] PGD 0 
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.103014] Oops: 0000 [#1] 
Apr 18 16:22:05 SMP  
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.109487] CPU 0 
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.113142] Modules linked in:
Apr 18 16:22:05 lamu  option
Apr 18 16:22:05 lamu  usb_wwan
Apr 18 16:22:05 lamu  usbserial
Apr 18 16:22:05 lamu  uas
Apr 18 16:22:05 lamu  usb_storage
Apr 18 16:22:05 lamu  ipt_MASQUERADE
Apr 18 16:22:05 lamu  iptable_nat
Apr 18 16:22:05 lamu  nf_nat
Apr 18 16:22:05 lamu  nf_conntrack_ipv4
Apr 18 16:22:05 lamu  nf_defrag_ipv4
Apr 18 16:22:05 lamu  ip_vs_rr
Apr 18 16:22:05 lamu  ip_vs
Apr 18 16:22:05 lamu  nf_conntrack
Apr 18 16:22:05 lamu  libcrc32c
Apr 18 16:22:05 lamu  ip6table_filter
Apr 18 16:22:05 lamu  ip6_tables
Apr 18 16:22:05 lamu  iptable_filter
Apr 18 16:22:05 lamu  ip_tables
Apr 18 16:22:05 lamu  ebtable_nat
Apr 18 16:22:05 lamu  ebtables
Apr 18 16:22:05 lamu  x_tables
Apr 18 16:22:05 lamu  crc32c
Apr 18 16:22:05 lamu  drbd
Apr 18 16:22:05 lamu  lru_cache
Apr 18 16:22:05 lamu  cn
Apr 18 16:22:05 lamu  sit
Apr 18 16:22:05 lamu  tunnel4
Apr 18 16:22:05 lamu  tun
Apr 18 16:22:05 lamu  bridge
Apr 18 16:22:05 lamu  stp
Apr 18 16:22:05 lamu  virtio_net
Apr 18 16:22:05 lamu  virtio_blk
Apr 18 16:22:05 lamu  virtio_rng
Apr 18 16:22:05 lamu  rng_core
Apr 18 16:22:05 lamu  virtio_pci
Apr 18 16:22:05 lamu  virtio_ring
Apr 18 16:22:05 lamu  virtio
Apr 18 16:22:05 lamu  kvm_intel
Apr 18 16:22:05 lamu  kvm
Apr 18 16:22:05 lamu  ipmi_devintf
Apr 18 16:22:05 lamu  ipmi_poweroff
Apr 18 16:22:05 lamu  ipmi_si
Apr 18 16:22:05 lamu  ipmi_watchdog
Apr 18 16:22:05 lamu  ipmi_msghandler
Apr 18 16:22:05 lamu  netconsole
Apr 18 16:22:05 lamu  configfs
Apr 18 16:22:05 lamu  loop
Apr 18 16:22:05 lamu  snd_pcm
Apr 18 16:22:05 lamu  snd_page_alloc
Apr 18 16:22:05 lamu  snd_timer
Apr 18 16:22:05 lamu  snd
Apr 18 16:22:05 lamu  dcdbas
Apr 18 16:22:05 lamu  iTCO_wdt
Apr 18 16:22:05 lamu  soundcore
Apr 18 16:22:05 lamu  i7core_edac
Apr 18 16:22:05 lamu  edac_core
Apr 18 16:22:05 lamu  joydev
Apr 18 16:22:05 lamu  iTCO_vendor_support
Apr 18 16:22:05 lamu  psmouse
Apr 18 16:22:05 lamu  evdev
Apr 18 16:22:05 lamu  pcspkr
Apr 18 16:22:05 lamu  serio_raw
Apr 18 16:22:05 lamu  processor
Apr 18 16:22:05 lamu  button
Apr 18 16:22:05 lamu  thermal_sys
Apr 18 16:22:05 lamu  ext3
Apr 18 16:22:05 lamu  mbcache
Apr 18 16:22:05 lamu  jbd
Apr 18 16:22:05 lamu  dm_mod
Apr 18 16:22:05 lamu  usbhid
Apr 18 16:22:05 lamu  sr_mod
Apr 18 16:22:05 lamu  hid
Apr 18 16:22:05 lamu  cdrom
Apr 18 16:22:05 lamu  ses
Apr 18 16:22:05 lamu  sd_mod
Apr 18 16:22:05 lamu  enclosure
Apr 18 16:22:05 lamu  crc_t10dif
Apr 18 16:22:05 lamu  ata_generic
Apr 18 16:22:05 lamu  uhci_hcd
Apr 18 16:22:05 lamu  ata_piix
Apr 18 16:22:05 lamu  ehci_hcd
Apr 18 16:22:05 lamu  libata
Apr 18 16:22:05 lamu  megaraid_sas
Apr 18 16:22:05 lamu  scsi_mod
Apr 18 16:22:05 lamu  usbcore
Apr 18 16:22:05 lamu  usb_common
Apr 18 16:22:05 lamu  bnx2
Apr 18 16:22:05 lamu  [last unloaded: scsi_wait_scan]
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.265328] 
Apr 18 16:22:05 lamu [15868.268305] Pid: 10572, comm: kvm Not tainted 3.2.0-2-amd64 #1
Apr 18 16:22:05 lamu  Dell Inc. PowerEdge R410
Apr 18 16:22:05 lamu /0N051F 
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.285556] RIP: 0010:[<ffffffffa02dc33d>] 
Apr 18 16:22:05 lamu  [<ffffffffa02dc33d>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 18 16:22:05 lamu [15868.304520] RSP: 0018:ffff88042fc03b18  EFLAGS: 00010293
Apr 18 16:22:05 lamu [15868.315127] RAX: 0000000000000000 RBX: ffff8804251565c0 RCX: 0000000000000007
Apr 18 16:22:05 lamu [15868.329377] RDX: ffffffffa02dc30f RSI: 00000001003ba680 RDI: ffff8804251565c0
Apr 18 16:22:05 lamu [15868.343625] RBP: ffff880226b0e000 R08: 0000000000000000 R09: ffff88042fc03ad0
Apr 18 16:22:05 lamu [15868.357874] R10: ffffffff8165aac0 R11: ffffffff8165aac0 R12: 0000000000000000
Apr 18 16:22:05 lamu [15868.372122] R13: ffff880426414002 R14: ffff8803e0e02180 R15: ffff880426414000
Apr 18 16:22:05 lamu [15868.386372] FS:  00007f2d79be2900(0000) GS:ffff88042fc00000(0000) knlGS:0000000000000000
Apr 18 16:22:05 lamu [15868.402545] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Apr 18 16:22:05 lamu [15868.414019] CR2: 0000000000000018 CR3: 00000001c8133000 CR4: 00000000000026e0
Apr 18 16:22:05 lamu [15868.428268] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Apr 18 16:22:05 lamu [15868.442517] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Apr 18 16:22:05 lamu [15868.456766] Process kvm (pid: 10572, threadinfo ffff8801c8194000, task ffff880225a77120)
Apr 18 16:22:05 lamu [15868.472938] Stack:
Apr 18 16:22:05 lamu [15868.476955]  ffffffff80000000
Apr 18 16:22:05 lamu  ffffffffa02dc714
Apr 18 16:22:05 lamu  ffff8804251565c0
Apr 18 16:22:05 lamu  ffff880226b0e000
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.491788]  ffff880424e25000
Apr 18 16:22:05 lamu  ffffffffa02dcaa0
Apr 18 16:22:05 lamu  ffff880380000000
Apr 18 16:22:05 lamu  0000000200000000
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.506620]  ffff8804251565c0
Apr 18 16:22:05 lamu  ffffffffa02e2cd0
Apr 18 16:22:05 lamu  ffffffff81691190
Apr 18 16:22:05 lamu  0000000000000002
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.521450] Call Trace:
Apr 18 16:22:05 lamu [15868.526334]  <IRQ> 
Apr 18 16:22:05 lamu  
Apr 18 16:22:05 lamu [15868.530541]  [<ffffffffa02dc714>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 18 16:22:05 lamu [15868.544447]  [<ffffffffa02dcaa0>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 18 16:22:05 lamu [15868.558008]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:05 lamu [15868.568620]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:05 lamu [15868.581139]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:06 lamu [15868.593656]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:06 lamu [15868.604788]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:06 lamu [15868.617307]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.631041]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:06 lamu [15868.643559]  [<ffffffffa02d7887>] ? NF_HOOK.constprop.10+0x3c/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.657465]  [<ffffffffa02d7a1b>] ? br_forward+0x16/0x5a [bridge]
Apr 18 16:22:06 lamu [15868.669637]  [<ffffffffa02d8543>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 18 16:22:06 lamu [15868.684254]  [<ffffffffa02dc638>] ? br_nf_pre_routing_finish+0x1ee/0x1fb [bridge]
Apr 18 16:22:06 lamu [15868.699217]  [<ffffffffa02dbff7>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 18 16:22:06 lamu [15868.712088]  [<ffffffffa02dcf91>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 18 16:22:06 lamu [15868.725820]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:06 lamu [15868.736432]  [<ffffffff8128b151>] ? napi_gro_receive+0x1d/0x2b
Apr 18 16:22:06 lamu [15868.748081]  [<ffffffff8128acfb>] ? napi_skb_finish+0x1c/0x31
Apr 18 16:22:06 lamu [15868.759561]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.773292]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:06 lamu [15868.784426]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.798157]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.811891]  [<ffffffffa02d8388>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 18 16:22:06 lamu [15868.825621]  [<ffffffff8128b1bf>] ? napi_complete+0x28/0x37
Apr 18 16:22:06 lamu [15868.836751]  [<ffffffffa02d8764>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 18 16:22:06 lamu [15868.850136]  [<ffffffffa02d85b1>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 18 16:22:06 lamu [15868.864748]  [<ffffffff81289222>] ? __netif_receive_skb+0x324/0x41f
Apr 18 16:22:06 lamu [15868.877266]  [<ffffffff81289389>] ? process_backlog+0x6c/0x123
Apr 18 16:22:06 lamu [15868.888916]  [<ffffffff8128b26f>] ? net_rx_action+0xa1/0x1af
Apr 18 16:22:06 lamu [15868.900221]  [<ffffffff81036faf>] ? test_tsk_need_resched+0xa/0x13
Apr 18 16:22:06 lamu [15868.912565]  [<ffffffff8104be34>] ? __do_softirq+0xb9/0x177
Apr 18 16:22:06 lamu [15868.923698]  [<ffffffff813503ec>] ? call_softirq+0x1c/0x30
Apr 18 16:22:06 lamu [15868.934652]  <EOI> 
Apr 18 16:22:06 lamu  
Apr 18 16:22:06 lamu [15868.938860]  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 18 16:22:06 lamu [15868.949468]  [<ffffffff8128b55f>] ? netif_rx_ni+0x1e/0x27
Apr 18 16:22:06 lamu [15868.960252]  [<ffffffffa02bd721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 18 16:22:06 lamu [15868.972597]  [<ffffffffa02bda66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 18 16:22:06 lamu [15868.984596]  [<ffffffffa02bdac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 18 16:22:06 lamu [15868.997461]  [<ffffffff810f95e4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 18 16:22:06 lamu [15869.009804]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:06 lamu [15869.020932]  [<ffffffff810f8c66>] ? do_sync_read+0xab/0xe3
Apr 18 16:22:06 lamu [15869.031888]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:06 lamu [15869.043021]  [<ffffffff81162649>] ? security_file_permission+0x16/0x2d
Apr 18 16:22:06 lamu [15869.056059]  [<ffffffff810f9848>] ? do_readv_writev+0xaf/0x11c
Apr 18 16:22:06 lamu [15869.067710]  [<ffffffff8112abce>] ? eventfd_ctx_read+0x162/0x174
Apr 18 16:22:06 lamu [15869.079708]  [<ffffffff8103f403>] ? try_to_wake_up+0x197/0x197
Apr 18 16:22:06 lamu [15869.091357]  [<ffffffff810f9a1d>] ? sys_writev+0x45/0x90
Apr 18 16:22:06 lamu [15869.101967]  [<ffffffff8134e192>] ? system_call_fastpath+0x16/0x1b
Apr 18 16:22:06 lamu [15869.114309] Code: 
Apr 18 16:22:06 53  
Apr 18 16:22:06 48  
Apr 18 16:22:06 89  
Apr 18 16:22:06 fb  
Apr 18 16:22:06 48  
Apr 18 16:22:06 83  
Apr 18 16:22:06 ec  
Apr 18 16:22:06 10  
Apr 18 16:22:06 66  
Apr 18 16:22:06 81  
Apr 18 16:22:06 7f  
Apr 18 16:22:06 7e  
Apr 18 16:22:06 08  
Apr 18 16:22:06 06  
Apr 18 16:22:06 4c  
Apr 18 16:22:06 8b  
Apr 18 16:22:06 a7  
Apr 18 16:22:06 98  
Apr 18 16:22:06 00  
Apr 18 16:22:06 00  
Apr 18 16:22:06 00  
Apr 18 16:22:06 74  
Apr 18 16:22:06 3d  
Apr 18 16:22:06 e8  
Apr 18 16:22:06 07  
Apr 18 16:22:06 fe  
Apr 18 16:22:06 ff  
Apr 18 16:22:06 ff  
Apr 18 16:22:06 66  
Apr 18 16:22:06 3d  
Apr 18 16:22:06 08  
Apr 18 16:22:06 06  
Apr 18 16:22:06 75  
Apr 18 16:22:06 09  
Apr 18 16:22:06 83  
Apr 18 16:22:06 3d  
Apr 18 16:22:06 91  
Apr 18 16:22:06 6a  
Apr 18 16:22:06 00  
Apr 18 16:22:06 00  
Apr 18 16:22:06 00  
Apr 18 16:22:06 75  
Apr 18 16:22:06 29  
Apr 18 16:22:06 lamu  
Apr 18 16:22:06 f6  
Apr 18 16:22:06 44  
Apr 18 16:22:06 24  
Apr 18 16:22:06 lamu  
Apr 18 16:22:06 lamu [15869.143402] ------------[ cut here ]------------
Apr 18 16:22:06 lamu [15869.143405] WARNING: at /tmp/buildd/linux-2.6-3.2.14/debian/build/source_amd64_none/kernel/softirq.c:159 _local_bh_enable_ip.isra.11+0x3d/0x88()
Apr 18 16:22:06 lamu [15869.143408] Hardware name: PowerEdge R410
Apr 18 16:22:06 lamu [15869.143409] Modules linked in: option usb_wwan usbserial uas usb_storage ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 ip_vs_rr ip_vs nf_conntrack libcrc32c ip6table_filter ip6_tables iptable_filter ip_tables ebtable_nat ebtables x_tables crc32c drbd lru_cache cn sit tunnel4 tun bridge stp virtio_net virtio_blk virtio_rng rng_core virtio_pci virtio_ring virtio kvm_intel kvm ipmi_devintf ipmi_poweroff ipmi_si ipmi_watchdog ipmi_msghandler netconsole configfs loop snd_pcm snd_page_alloc snd_timer snd dcdbas iTCO_wdt soundcore i7core_edac edac_core joydev iTCO_vendor_support psmouse evdev pcspkr serio_raw processor button thermal_sys ext3 mbcache jbd dm_mod usbhid sr_mod hid cdrom ses sd_mod enclosure crc_t10dif ata_generic uhci_hcd ata_piix ehci_hcd libata megaraid_sas scsi_mod usbcore usb_common bnx2 [last unloaded: scsi_wait_scan]
Apr 18 16:22:06 lamu [15869.143447] Pid: 10572, comm: kvm Not tainted 3.2.0-2-amd64 #1
Apr 18 16:22:06 lamu [15869.143449] Call Trace:
Apr 18 16:22:06 lamu [15869.143450]  <IRQ>  [<ffffffff81046815>] ? warn_slowpath_common+0x78/0x8c
Apr 18 16:22:06 lamu [15869.143457]  [<ffffffff8104bd26>] ? _local_bh_enable_ip.isra.11+0x3d/0x88
Apr 18 16:22:06 lamu [15869.143463]  [<ffffffffa0000748>] ? bnx2_reg_rd_ind+0x31/0x38 [bnx2]
Apr 18 16:22:06 lamu [15869.143470]  [<ffffffffa00097d7>] ? bnx2_poll+0x1b7/0x1c4 [bnx2]
Apr 18 16:22:06 lamu [15869.143476]  [<ffffffff8129b0bd>] ? netpoll_poll_dev.part.16+0x9b/0x499
Apr 18 16:22:06 lamu [15869.143480]  [<ffffffff8129b5d5>] ? netpoll_send_skb_on_dev+0x11a/0x201
Apr 18 16:22:06 lamu [15869.143485]  [<ffffffffa02d631a>] ? br_dev_xmit+0x12e/0x142 [bridge]
Apr 18 16:22:06 lamu [15869.143489]  [<ffffffff8129b586>] ? netpoll_send_skb_on_dev+0xcb/0x201
Apr 18 16:22:06 lamu [15869.143493]  [<ffffffffa01b125c>] ? write_msg+0x98/0xf3 [netconsole]
Apr 18 16:22:06 lamu [15869.143497]  [<ffffffff8104695e>] ? __call_console_drivers+0x72/0x83
Apr 18 16:22:06 lamu [15869.143501]  [<ffffffff8104702a>] ? console_unlock+0x144/0x1e8
Apr 18 16:22:06 lamu [15869.143504]  [<ffffffff8104754d>] ? vprintk+0x396/0x3d9
Apr 18 16:22:06 lamu [15869.143509]  [<ffffffffa02dc341>] ? br_nf_forward_finish+0x32/0x95 [bridge]
Apr 18 16:22:06 lamu [15869.143515]  [<ffffffffa02dc312>] ? br_nf_forward_finish+0x3/0x95 [bridge]
Apr 18 16:22:06 lamu [15869.143521]  [<ffffffff81342bf3>] ? printk+0x43/0x48
Apr 18 16:22:06 lamu [15869.143524]  [<ffffffff8100fe6a>] ? show_registers+0x1de/0x20a
Apr 18 16:22:06 lamu [15869.143530]  [<ffffffff8134a09e>] ? __die+0x8b/0xc8
Apr 18 16:22:06 lamu [15869.143533]  [<ffffffff813423c3>] ? no_context+0x1d6/0x20e
Apr 18 16:22:06 lamu [15869.143538]  [<ffffffff810e9c80>] ? virt_to_slab+0x6/0x16
Apr 18 16:22:07 lamu [15869.143541]  [<ffffffff8134c019>] ? do_page_fault+0x1a8/0x337
Apr 18 16:22:07 lamu [15869.143546]  [<ffffffffa039df06>] ? ip_vs_conn_put+0x28/0x32 [ip_vs]
Apr 18 16:22:07 lamu [15869.143551]  [<ffffffffa03a00e0>] ? ip_vs_out+0x2bd/0x432 [ip_vs]
Apr 18 16:22:07 lamu [15869.143554]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:07 lamu [15869.143558]  [<ffffffff81349775>] ? page_fault+0x25/0x30
Apr 18 16:22:07 lamu [15869.143564]  [<ffffffffa02dc30f>] ? nf_bridge_update_protocol+0x20/0x20 [bridge]
Apr 18 16:22:07 lamu [15869.143570]  [<ffffffffa02dc33d>] ? br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 18 16:22:07 lamu [15869.143575]  [<ffffffffa02dc32e>] ? br_nf_forward_finish+0x1f/0x95 [bridge]
Apr 18 16:22:07 lamu [15869.143581]  [<ffffffffa02dc714>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 18 16:22:07 lamu [15869.143586]  [<ffffffffa02dcaa0>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 18 16:22:07 lamu [15869.143590]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:07 lamu [15869.143595]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15869.143599]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15869.143602]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:07 lamu [15869.143607]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15869.143612]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143617]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15869.143622]  [<ffffffffa02d7887>] ? NF_HOOK.constprop.10+0x3c/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143627]  [<ffffffffa02d7a1b>] ? br_forward+0x16/0x5a [bridge]
Apr 18 16:22:07 lamu [15869.143632]  [<ffffffffa02d8543>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 18 16:22:07 lamu [15869.143638]  [<ffffffffa02dc638>] ? br_nf_pre_routing_finish+0x1ee/0x1fb [bridge]
Apr 18 16:22:07 lamu [15869.143644]  [<ffffffffa02dbff7>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 18 16:22:07 lamu [15869.143649]  [<ffffffffa02dcf91>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 18 16:22:07 lamu [15869.143653]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:07 lamu [15869.143656]  [<ffffffff8128b151>] ? napi_gro_receive+0x1d/0x2b
Apr 18 16:22:07 lamu [15869.143659]  [<ffffffff8128acfb>] ? napi_skb_finish+0x1c/0x31
Apr 18 16:22:07 lamu [15869.143664]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143667]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:07 lamu [15869.143672]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143677]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143683]  [<ffffffffa02d8388>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 18 16:22:07 lamu [15869.143686]  [<ffffffff8128b1bf>] ? napi_complete+0x28/0x37
Apr 18 16:22:07 lamu [15869.143691]  [<ffffffffa02d8764>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 18 16:22:07 lamu [15869.143696]  [<ffffffffa02d85b1>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 18 16:22:07 lamu [15869.143700]  [<ffffffff81289222>] ? __netif_receive_skb+0x324/0x41f
Apr 18 16:22:07 lamu [15869.143703]  [<ffffffff81289389>] ? process_backlog+0x6c/0x123
Apr 18 16:22:07 lamu [15869.143706]  [<ffffffff8128b26f>] ? net_rx_action+0xa1/0x1af
Apr 18 16:22:07 lamu [15869.143709]  [<ffffffff81036faf>] ? test_tsk_need_resched+0xa/0x13
Apr 18 16:22:07 lamu [15869.143712]  [<ffffffff8104be34>] ? __do_softirq+0xb9/0x177
Apr 18 16:22:07 lamu [15869.143715]  [<ffffffff813503ec>] ? call_softirq+0x1c/0x30
Apr 18 16:22:07 lamu [15869.143716]  <EOI>  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 18 16:22:07 lamu [15869.143722]  [<ffffffff8128b55f>] ? netif_rx_ni+0x1e/0x27
Apr 18 16:22:07 lamu [15869.143725]  [<ffffffffa02bd721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 18 16:22:07 lamu [15869.143729]  [<ffffffffa02bda66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 18 16:22:07 lamu [15869.143733]  [<ffffffffa02bdac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 18 16:22:07 lamu [15869.143736]  [<ffffffff810f95e4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 18 16:22:07 lamu [15869.143739]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:07 lamu [15869.143742]  [<ffffffff810f8c66>] ? do_sync_read+0xab/0xe3
Apr 18 16:22:07 lamu [15869.143744]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:07 lamu [15869.143747]  [<ffffffff81162649>] ? security_file_permission+0x16/0x2d
Apr 18 16:22:07 lamu [15869.143750]  [<ffffffff810f9848>] ? do_readv_writev+0xaf/0x11c
Apr 18 16:22:07 lamu [15869.143753]  [<ffffffff8112abce>] ? eventfd_ctx_read+0x162/0x174
Apr 18 16:22:07 lamu [15869.143756]  [<ffffffff8103f403>] ? try_to_wake_up+0x197/0x197
Apr 18 16:22:07 lamu [15869.143759]  [<ffffffff810f9a1d>] ? sys_writev+0x45/0x90
Apr 18 16:22:07 lamu [15869.143762]  [<ffffffff8134e192>] ? system_call_fastpath+0x16/0x1b
Apr 18 16:22:07 lamu [15869.143765] ---[ end trace aba9f7cf33914c5d ]---
Apr 18 16:22:07 lamu [15870.282276] 18 
Apr 18 16:22:07 01  
Apr 18 16:22:07 49  
Apr 18 16:22:07 8b  
Apr 18 16:22:07 6c  
Apr 18 16:22:07 24  
Apr 18 16:22:07 08  
Apr 18 16:22:07 74  
Apr 18 16:22:07 12  
Apr 18 16:22:07 8a  
Apr 18 16:22:07 43  
Apr 18 16:22:07 7d  
Apr 18 16:22:07 83  
Apr 18 16:22:07 e0  
Apr 18 16:22:07 f8  
Apr 18 16:22:07 83  
Apr 18 16:22:07 c8  
Apr 18 16:22:07 lamu  
Apr 18 16:22:07 lamu [15870.294307] RIP 
Apr 18 16:22:07 lamu  [<ffffffffa02dc33d>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 18 16:22:07 lamu [15870.308573]  RSP <ffff88042fc03b18>
Apr 18 16:22:07 lamu [15870.315539] CR2: 0000000000000018
Apr 18 16:22:07 lamu [15870.322840] ---[ end trace aba9f7cf33914c5e ]---
Apr 18 16:22:07 lamu [15870.332281] Kernel panic - not syncing: Fatal exception in interrupt
Apr 18 16:22:07 lamu [15870.345225] Pid: 10572, comm: kvm Tainted: G      D W    3.2.0-2-amd64 #1
Apr 18 16:22:07 lamu [15870.359065] Call Trace:
Apr 18 16:22:07 lamu [15870.364320]  <IRQ> 
Apr 18 16:22:07 lamu  [<ffffffff81342aa0>] ? panic+0x95/0x1a5
Apr 18 16:22:07 lamu [15870.376264]  [<ffffffff8134a006>] ? oops_end+0xa9/0xb6
Apr 18 16:22:07 lamu [15870.386917]  [<ffffffff813423ec>] ? no_context+0x1ff/0x20e
Apr 18 16:22:07 lamu [15870.398274]  [<ffffffff810e9c80>] ? virt_to_slab+0x6/0x16
Apr 18 16:22:07 lamu [15870.409348]  [<ffffffff8134c019>] ? do_page_fault+0x1a8/0x337
Apr 18 16:22:07 lamu [15870.421135]  [<ffffffffa039df06>] ? ip_vs_conn_put+0x28/0x32 [ip_vs]
Apr 18 16:22:07 lamu [15870.434043]  [<ffffffffa03a00e0>] ? ip_vs_out+0x2bd/0x432 [ip_vs]
Apr 18 16:22:07 lamu [15870.446570]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:07 lamu [15870.457981]  [<ffffffff81349775>] ? page_fault+0x25/0x30
Apr 18 16:22:07 lamu [15870.468869]  [<ffffffffa02dc30f>] ? nf_bridge_update_protocol+0x20/0x20 [bridge]
Apr 18 16:22:07 lamu [15870.483977]  [<ffffffffa02dc33d>] ? br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 18 16:22:07 lamu [15870.498164]  [<ffffffffa02dc32e>] ? br_nf_forward_finish+0x1f/0x95 [bridge]
Apr 18 16:22:07 lamu [15870.512405]  [<ffffffffa02dc714>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 18 16:22:07 lamu [15870.526664]  [<ffffffffa02dcaa0>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 18 16:22:07 lamu [15870.540676]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:07 lamu [15870.551680]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15870.564408]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:07 lamu [15870.577207]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:08 lamu [15870.588572]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:08 lamu [15870.601300]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.615222]  [<ffffffffa02d7941>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 18 16:22:08 lamu [15870.628089]  [<ffffffffa02d7887>] ? NF_HOOK.constprop.10+0x3c/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.642400]  [<ffffffffa02d7a1b>] ? br_forward+0x16/0x5a [bridge]
Apr 18 16:22:08 lamu [15870.654796]  [<ffffffffa02d8543>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 18 16:22:08 lamu [15870.669621]  [<ffffffffa02dc638>] ? br_nf_pre_routing_finish+0x1ee/0x1fb [bridge]
Apr 18 16:22:08 lamu [15870.684772]  [<ffffffffa02dbff7>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 18 16:22:08 lamu [15870.698003]  [<ffffffffa02dcf91>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 18 16:22:08 lamu [15870.711896]  [<ffffffff812abfa1>] ? nf_iterate+0x41/0x77
Apr 18 16:22:08 lamu [15870.722763]  [<ffffffff8128b151>] ? napi_gro_receive+0x1d/0x2b
Apr 18 16:22:08 lamu [15870.734852]  [<ffffffff8128acfb>] ? napi_skb_finish+0x1c/0x31
Apr 18 16:22:08 lamu [15870.746586]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.760677]  [<ffffffff812ac03f>] ? nf_hook_slow+0x68/0x101
Apr 18 16:22:08 lamu [15870.772150]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.786239]  [<ffffffffa02d83a2>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.800153]  [<ffffffffa02d8388>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 18 16:22:08 lamu [15870.814178]  [<ffffffff8128b1bf>] ? napi_complete+0x28/0x37
Apr 18 16:22:08 lamu [15870.825710]  [<ffffffffa02d8764>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 18 16:22:08 lamu [15870.839289]  [<ffffffffa02d85b1>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 18 16:22:08 lamu [15870.854163]  [<ffffffff81289222>] ? __netif_receive_skb+0x324/0x41f
Apr 18 16:22:08 lamu [15870.866863]  [<ffffffff81289389>] ? process_backlog+0x6c/0x123
Apr 18 16:22:08 lamu [15870.878810]  [<ffffffff8128b26f>] ? net_rx_action+0xa1/0x1af
Apr 18 16:22:08 lamu [15870.890414]  [<ffffffff81036faf>] ? test_tsk_need_resched+0xa/0x13
Apr 18 16:22:08 lamu [15870.902969]  [<ffffffff8104be34>] ? __do_softirq+0xb9/0x177
Apr 18 16:22:08 lamu [15870.914361]  [<ffffffff813503ec>] ? call_softirq+0x1c/0x30
Apr 18 16:22:08 lamu [15870.925616]  <EOI> 
Apr 18 16:22:08 lamu  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 18 16:22:08 lamu [15870.938023]  [<ffffffff8128b55f>] ? netif_rx_ni+0x1e/0x27
Apr 18 16:22:08 lamu [15870.949046]  [<ffffffffa02bd721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 18 16:22:08 lamu [15870.961716]  [<ffffffffa02bda66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 18 16:22:08 lamu [15870.973982]  [<ffffffffa02bdac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 18 16:22:08 lamu [15870.987111]  [<ffffffff810f95e4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 18 16:22:08 lamu [15870.999717]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:08 lamu [15871.011058]  [<ffffffff810f8c66>] ? do_sync_read+0xab/0xe3
Apr 18 16:22:08 lamu [15871.022382]  [<ffffffff810363cb>] ? should_resched+0x5/0x23
Apr 18 16:22:08 lamu [15871.033786]  [<ffffffff81162649>] ? security_file_permission+0x16/0x2d
Apr 18 16:22:08 lamu [15871.047087]  [<ffffffff810f9848>] ? do_readv_writev+0xaf/0x11c
Apr 18 16:22:08 lamu [15871.058948]  [<ffffffff8112abce>] ? eventfd_ctx_read+0x162/0x174
Apr 18 16:22:08 lamu [15871.071307]  [<ffffffff8103f403>] ? try_to_wake_up+0x197/0x197
Apr 18 16:22:08 lamu [15871.083164]  [<ffffffff810f9a1d>] ? sys_writev+0x45/0x90
Apr 18 16:22:08 lamu [15871.094031]  [<ffffffff8134e192>] ? system_call_fastpath+0x16/0x1b

^ permalink raw reply

* Re: [PATCH] set fake_rtable's dst to NULL to avoid kernel Oops.
From: Massimo Cetra @ 2012-04-19  7:58 UTC (permalink / raw)
  To: Jonathan Nieder
  Cc: Peter Huang (Peng), shemminger, 'David S. Miller', netdev,
	eric.dumazet, linux-kernel, ctrix+debianbugs, peter.huangpeng,
	harry.majun
In-Reply-To: <20120418190450.GA30185@burratino>

On 18/04/2012 21:04, Jonathan Nieder wrote:
>
> Massimo Cetra (cc-ed) tested the patch against a 3.2.y kernel and wrote[1]:
>
>> The patch i applied yesterday to the debian kernel has been installed
>> and the kernel is not panic-ing anymore.
>>
>> I'll try to keep this bug up to date.
>
> So it seems to work.  Dave, please consider queuing this for stable@
> when the final patch is ready.

Also please consider that the bridge problems are not over and the 
kernel keeps panicing in a different way...

- http://marc.info/?t=133474395500004&r=1&w=2

Thanks,
Massimo

^ permalink raw reply

* [PATCH 11/11] atl1c: remove MDIO_REG_ADDR_MASK in atl1c_mdio_read/write
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

MDIO_REG_ADDR_MASK is already applied in function
atl1c_write_phy_reg and atl1c_read_phy_reg

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index e671367..df10637 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -575,7 +575,7 @@ static int atl1c_mdio_read(struct net_device *netdev, int phy_id, int reg_num)
 	struct atl1c_adapter *adapter = netdev_priv(netdev);
 	u16 result;
 
-	atl1c_read_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, &result);
+	atl1c_read_phy_reg(&adapter->hw, reg_num, &result);
 	return result;
 }
 
@@ -584,7 +584,7 @@ static void atl1c_mdio_write(struct net_device *netdev, int phy_id,
 {
 	struct atl1c_adapter *adapter = netdev_priv(netdev);
 
-	atl1c_write_phy_reg(&adapter->hw, reg_num & MDIO_REG_ADDR_MASK, val);
+	atl1c_write_phy_reg(&adapter->hw, reg_num, val);
 }
 
 /*
-- 
1.7.7

^ permalink raw reply related

* [PATCH 08/11] atl1c: refine/update ASPM configuration
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

some platforms(BIOS or OS) may change ASPM configuration in
PCI Express Link Control Register directly and dynamically
regardless the device driver installation.
Checking if ASPM support during the driver init phase by reading
PCI Express Link Contrl Register doesn't make sense.
This refine/update assume L0S/L1 is defalut enabled as hw->ctrl_flags
inited. atl1c_set_aspm will set real configuration based on chip
capability to hardware register.
atl1c_disable_l0s_l1 and register definition of REG_PM_CTRL are
refined as well.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   66 ++++++---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |  167 +++++++++-------------
 2 files changed, 111 insertions(+), 122 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index 9779b83..5e49ea2 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -121,30 +121,50 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 #define OTP_CTRL_CLK_EN			0x0002
 
 #define REG_PM_CTRL			0x12F8
-#define PM_CTRL_SDES_EN			0x00000001
-#define PM_CTRL_RBER_EN			0x00000002
-#define PM_CTRL_CLK_REQ_EN		0x00000004
-#define PM_CTRL_ASPM_L1_EN		0x00000008
-#define PM_CTRL_SERDES_L1_EN		0x00000010
-#define PM_CTRL_SERDES_PLL_L1_EN	0x00000020
-#define PM_CTRL_SERDES_PD_EX_L1		0x00000040
-#define PM_CTRL_SERDES_BUDS_RX_L1_EN	0x00000080
-#define PM_CTRL_L0S_ENTRY_TIMER_MASK	0xF
-#define PM_CTRL_L0S_ENTRY_TIMER_SHIFT	8
-#define PM_CTRL_ASPM_L0S_EN		0x00001000
-#define PM_CTRL_CLK_SWH_L1		0x00002000
-#define PM_CTRL_CLK_PWM_VER1_1		0x00004000
-#define PM_CTRL_RCVR_WT_TIMER		0x00008000
-#define PM_CTRL_L1_ENTRY_TIMER_MASK	0xF
-#define PM_CTRL_L1_ENTRY_TIMER_SHIFT	16
-#define PM_CTRL_PM_REQ_TIMER_MASK	0xF
-#define PM_CTRL_PM_REQ_TIMER_SHIFT	20
-#define PM_CTRL_LCKDET_TIMER_MASK	0xF
+#define PM_CTRL_HOTRST			BIT(31)
+#define PM_CTRL_MAC_ASPM_CHK		BIT(30)	/* L0s/L1 dis by MAC based on
+						 * thrghput(setting in 15A0) */
+#define PM_CTRL_SA_DLY_EN		BIT(29)
+#define PM_CTRL_L0S_BUFSRX_EN		BIT(28)
+#define PM_CTRL_LCKDET_TIMER_MASK	0xFUL
 #define PM_CTRL_LCKDET_TIMER_SHIFT	24
-#define PM_CTRL_EN_BUFS_RX_L0S		0x10000000
-#define PM_CTRL_SA_DLY_EN		0x20000000
-#define PM_CTRL_MAC_ASPM_CHK		0x40000000
-#define PM_CTRL_HOTRST			0x80000000
+#define PM_CTRL_LCKDET_TIMER_DEF	0xC
+#define PM_CTRL_PM_REQ_TIMER_MASK	0xFUL
+#define PM_CTRL_PM_REQ_TIMER_SHIFT	20	/* pm_request_l1 time > @
+						 * ->L0s not L1 */
+#define PM_CTRL_PM_REQ_TO_DEF		0xC
+#define PMCTRL_TXL1_AFTER_L0S		BIT(19)	/* l1dv2.0+ */
+#define L1D_PMCTRL_L1_ENTRY_TM_MASK	7UL	/* l1dv2.0+, 3bits */
+#define L1D_PMCTRL_L1_ENTRY_TM_SHIFT	16
+#define L1D_PMCTRL_L1_ENTRY_TM_DIS	0
+#define L1D_PMCTRL_L1_ENTRY_TM_2US	1
+#define L1D_PMCTRL_L1_ENTRY_TM_4US	2
+#define L1D_PMCTRL_L1_ENTRY_TM_8US	3
+#define L1D_PMCTRL_L1_ENTRY_TM_16US	4
+#define L1D_PMCTRL_L1_ENTRY_TM_24US	5
+#define L1D_PMCTRL_L1_ENTRY_TM_32US	6
+#define L1D_PMCTRL_L1_ENTRY_TM_63US	7
+#define PM_CTRL_L1_ENTRY_TIMER_MASK	0xFUL  /* l1C 4bits */
+#define PM_CTRL_L1_ENTRY_TIMER_SHIFT	16
+#define L2CB1_PM_CTRL_L1_ENTRY_TM	7
+#define L1C_PM_CTRL_L1_ENTRY_TM		0xF
+#define PM_CTRL_RCVR_WT_TIMER		BIT(15)	/* 1:1us, 0:2ms */
+#define PM_CTRL_CLK_PWM_VER1_1		BIT(14)	/* 0:1.0a,1:1.1 */
+#define PM_CTRL_CLK_SWH_L1		BIT(13)	/* en pcie clk sw in L1 */
+#define PM_CTRL_ASPM_L0S_EN		BIT(12)
+#define PM_CTRL_RXL1_AFTER_L0S		BIT(11)	/* l1dv2.0+ */
+#define L1D_PMCTRL_L0S_TIMER_MASK	7UL	/* l1d2.0+, 3bits*/
+#define L1D_PMCTRL_L0S_TIMER_SHIFT	8
+#define PM_CTRL_L0S_ENTRY_TIMER_MASK	0xFUL	/* l1c, 4bits */
+#define PM_CTRL_L0S_ENTRY_TIMER_SHIFT	8
+#define PM_CTRL_SERDES_BUFS_RX_L1_EN	BIT(7)
+#define PM_CTRL_SERDES_PD_EX_L1		BIT(6)	/* power down serdes rx */
+#define PM_CTRL_SERDES_PLL_L1_EN	BIT(5)
+#define PM_CTRL_SERDES_L1_EN		BIT(4)
+#define PM_CTRL_ASPM_L1_EN		BIT(3)
+#define PM_CTRL_CLK_REQ_EN		BIT(2)
+#define PM_CTRL_RBER_EN			BIT(1)
+#define PM_CTRL_SPRSDWER_EN		BIT(0)
 
 #define REG_LTSSM_ID_CTRL		0x12FC
 #define LTSSM_ID_EN_WRO			0x1000
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 9783afc..47fe6ad 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -64,7 +64,7 @@ static int atl1c_stop_mac(struct atl1c_hw *hw);
 static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw);
 static void atl1c_enable_tx_ctrl(struct atl1c_hw *hw);
 static void atl1c_disable_l0s_l1(struct atl1c_hw *hw);
-static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup);
+static void atl1c_set_aspm(struct atl1c_hw *hw, u16 link_speed);
 static void atl1c_setup_mac_ctrl(struct atl1c_adapter *adapter);
 static void atl1c_clean_rx_irq(struct atl1c_adapter *adapter,
 		   int *work_done, int work_to_do);
@@ -255,7 +255,7 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
 		if (atl1c_stop_mac(hw) != 0)
 			if (netif_msg_hw(adapter))
 				dev_warn(&pdev->dev, "stop mac failed\n");
-		atl1c_set_aspm(hw, false);
+		atl1c_set_aspm(hw, SPEED_0);
 		netif_carrier_off(netdev);
 		netif_stop_queue(netdev);
 		atl1c_phy_reset(hw);
@@ -273,7 +273,7 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
 		    adapter->link_duplex != duplex) {
 			adapter->link_speed  = speed;
 			adapter->link_duplex = duplex;
-			atl1c_set_aspm(hw, true);
+			atl1c_set_aspm(hw, speed);
 			atl1c_enable_tx_ctrl(hw);
 			atl1c_enable_rx_ctrl(hw);
 			atl1c_setup_mac_ctrl(adapter);
@@ -691,12 +691,8 @@ static int atl1c_setup_mac_funcs(struct atl1c_hw *hw)
 
 	hw->ctrl_flags = ATL1C_INTR_MODRT_ENABLE  |
 			 ATL1C_TXQ_MODE_ENHANCE;
-	if (link_ctrl_data & LINK_CTRL_L0S_EN)
-		hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT;
-	if (link_ctrl_data & LINK_CTRL_L1_EN)
-		hw->ctrl_flags |= ATL1C_ASPM_L1_SUPPORT;
-	if (link_ctrl_data & LINK_CTRL_EXT_SYNC)
-		hw->ctrl_flags |= ATL1C_LINK_EXT_SYNC;
+	hw->ctrl_flags |= ATL1C_ASPM_L0S_SUPPORT |
+			  ATL1C_ASPM_L1_SUPPORT;
 	hw->ctrl_flags |= ATL1C_ASPM_CTRL_MON;
 
 	if (hw->nic_type == athr_l1c ||
@@ -1203,112 +1199,83 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 
 static void atl1c_disable_l0s_l1(struct atl1c_hw *hw)
 {
-	u32 pm_ctrl_data;
-
-	AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
-	pm_ctrl_data &= ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
-			PM_CTRL_L1_ENTRY_TIMER_SHIFT);
-	pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
-	pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
-	pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
-	pm_ctrl_data &= ~PM_CTRL_MAC_ASPM_CHK;
-	pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
+	u16 ctrl_flags = hw->ctrl_flags;
 
-	pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
-	pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
-	pm_ctrl_data |=	PM_CTRL_SERDES_L1_EN;
-	AT_WRITE_REG(hw, REG_PM_CTRL, pm_ctrl_data);
+	hw->ctrl_flags &= ~(ATL1C_ASPM_L0S_SUPPORT | ATL1C_ASPM_L1_SUPPORT);
+	atl1c_set_aspm(hw, SPEED_0);
+	hw->ctrl_flags = ctrl_flags;
 }
 
 /*
  * Set ASPM state.
  * Enable/disable L0s/L1 depend on link state.
  */
-static void atl1c_set_aspm(struct atl1c_hw *hw, bool linkup)
+static void atl1c_set_aspm(struct atl1c_hw *hw, u16 link_speed)
 {
 	u32 pm_ctrl_data;
-	u32 link_ctrl_data;
-	u32 link_l1_timer = 0xF;
+	u32 link_l1_timer;
 
 	AT_READ_REG(hw, REG_PM_CTRL, &pm_ctrl_data);
-	AT_READ_REG(hw, REG_LINK_CTRL, &link_ctrl_data);
+	pm_ctrl_data &= ~(PM_CTRL_ASPM_L1_EN |
+			  PM_CTRL_ASPM_L0S_EN |
+			  PM_CTRL_MAC_ASPM_CHK);
+	/* L1 timer */
+	if (hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
+		pm_ctrl_data &= ~PMCTRL_TXL1_AFTER_L0S;
+		link_l1_timer =
+			link_speed == SPEED_1000 || link_speed == SPEED_100 ?
+			L1D_PMCTRL_L1_ENTRY_TM_16US : 1;
+		pm_ctrl_data = FIELD_SETX(pm_ctrl_data,
+			L1D_PMCTRL_L1_ENTRY_TM, link_l1_timer);
+	} else {
+		link_l1_timer = hw->nic_type == athr_l2c_b ?
+			L2CB1_PM_CTRL_L1_ENTRY_TM : L1C_PM_CTRL_L1_ENTRY_TM;
+		if (link_speed != SPEED_1000 && link_speed != SPEED_100)
+			link_l1_timer = 1;
+		pm_ctrl_data = FIELD_SETX(pm_ctrl_data,
+			PM_CTRL_L1_ENTRY_TIMER, link_l1_timer);
+	}
 
-	pm_ctrl_data &= ~PM_CTRL_SERDES_PD_EX_L1;
-	pm_ctrl_data &=  ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
-			PM_CTRL_L1_ENTRY_TIMER_SHIFT);
-	pm_ctrl_data &= ~(PM_CTRL_LCKDET_TIMER_MASK <<
-			PM_CTRL_LCKDET_TIMER_SHIFT);
-	pm_ctrl_data |= AT_LCKDET_TIMER	<< PM_CTRL_LCKDET_TIMER_SHIFT;
+	/* L0S/L1 enable */
+	if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
+		pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN | PM_CTRL_MAC_ASPM_CHK;
+	if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
+		pm_ctrl_data |= PM_CTRL_ASPM_L1_EN | PM_CTRL_MAC_ASPM_CHK;
 
+	/* l2cb & l1d & l2cb2 & l1d2 */
 	if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d ||
-		hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
-		link_ctrl_data &= ~LINK_CTRL_EXT_SYNC;
-		if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE)) {
-			if (hw->nic_type == athr_l2c_b && hw->revision_id == L2CB_V10)
-				link_ctrl_data |= LINK_CTRL_EXT_SYNC;
-		}
-
-		AT_WRITE_REG(hw, REG_LINK_CTRL, link_ctrl_data);
-
-		pm_ctrl_data |= PM_CTRL_RCVR_WT_TIMER;
-		pm_ctrl_data &= ~(PM_CTRL_PM_REQ_TIMER_MASK <<
-			PM_CTRL_PM_REQ_TIMER_SHIFT);
-		pm_ctrl_data |= AT_ASPM_L1_TIMER <<
-			PM_CTRL_PM_REQ_TIMER_SHIFT;
-		pm_ctrl_data &= ~PM_CTRL_SA_DLY_EN;
-		pm_ctrl_data &= ~PM_CTRL_HOTRST;
-		pm_ctrl_data |= 1 << PM_CTRL_L1_ENTRY_TIMER_SHIFT;
-		pm_ctrl_data |= PM_CTRL_SERDES_PD_EX_L1;
-	}
-	pm_ctrl_data |= PM_CTRL_MAC_ASPM_CHK;
-	if (linkup) {
-		pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
-		pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
-		if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
-			pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
-		if (hw->ctrl_flags & ATL1C_ASPM_L0S_SUPPORT)
-			pm_ctrl_data |= PM_CTRL_ASPM_L0S_EN;
-
-		if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d ||
-			hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
-			if (hw->nic_type == athr_l2c_b)
-				if (!(hw->ctrl_flags & ATL1C_APS_MODE_ENABLE))
-					pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
-			pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
-			pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
-			pm_ctrl_data &= ~PM_CTRL_SERDES_BUDS_RX_L1_EN;
-			pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
-		if (hw->adapter->link_speed == SPEED_100 ||
-				hw->adapter->link_speed == SPEED_1000) {
-				pm_ctrl_data &=  ~(PM_CTRL_L1_ENTRY_TIMER_MASK <<
-					PM_CTRL_L1_ENTRY_TIMER_SHIFT);
-				if (hw->nic_type == athr_l2c_b)
-					link_l1_timer = 7;
-				else if (hw->nic_type == athr_l2c_b2 ||
-					hw->nic_type == athr_l1d_2)
-					link_l1_timer = 4;
-				pm_ctrl_data |= link_l1_timer <<
-					PM_CTRL_L1_ENTRY_TIMER_SHIFT;
-			}
-		} else {
-			pm_ctrl_data |= PM_CTRL_SERDES_L1_EN;
-			pm_ctrl_data |= PM_CTRL_SERDES_PLL_L1_EN;
-			pm_ctrl_data |= PM_CTRL_SERDES_BUDS_RX_L1_EN;
-			pm_ctrl_data &= ~PM_CTRL_CLK_SWH_L1;
+	    hw->nic_type == athr_l2c_b2 || hw->nic_type == athr_l1d_2) {
+		pm_ctrl_data = FIELD_SETX(pm_ctrl_data,
+			PM_CTRL_PM_REQ_TIMER, PM_CTRL_PM_REQ_TO_DEF);
+		pm_ctrl_data |= PM_CTRL_RCVR_WT_TIMER |
+				PM_CTRL_SERDES_PD_EX_L1 |
+				PM_CTRL_CLK_SWH_L1;
+		pm_ctrl_data &= ~(PM_CTRL_SERDES_L1_EN |
+				  PM_CTRL_SERDES_PLL_L1_EN |
+				  PM_CTRL_SERDES_BUFS_RX_L1_EN |
+				  PM_CTRL_SA_DLY_EN |
+				  PM_CTRL_HOTRST);
+		/* disable l0s if link down or l2cb */
+		if (link_speed == SPEED_0 || hw->nic_type == athr_l2c_b)
 			pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
-			pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
-
+	} else { /* l1c */
+		pm_ctrl_data =
+			FIELD_SETX(pm_ctrl_data, PM_CTRL_L1_ENTRY_TIMER, 0);
+		if (link_speed != SPEED_0) {
+			pm_ctrl_data |= PM_CTRL_SERDES_L1_EN |
+					PM_CTRL_SERDES_PLL_L1_EN |
+					PM_CTRL_SERDES_BUFS_RX_L1_EN;
+			pm_ctrl_data &= ~(PM_CTRL_SERDES_PD_EX_L1 |
+					  PM_CTRL_CLK_SWH_L1 |
+					  PM_CTRL_ASPM_L0S_EN |
+					  PM_CTRL_ASPM_L1_EN);
+		} else { /* link down */
+			pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
+			pm_ctrl_data &= ~(PM_CTRL_SERDES_L1_EN |
+					  PM_CTRL_SERDES_PLL_L1_EN |
+					  PM_CTRL_SERDES_BUFS_RX_L1_EN |
+					  PM_CTRL_ASPM_L0S_EN);
 		}
-	} else {
-		pm_ctrl_data &= ~PM_CTRL_SERDES_L1_EN;
-		pm_ctrl_data &= ~PM_CTRL_ASPM_L0S_EN;
-		pm_ctrl_data &= ~PM_CTRL_SERDES_PLL_L1_EN;
-		pm_ctrl_data |= PM_CTRL_CLK_SWH_L1;
-
-		if (hw->ctrl_flags & ATL1C_ASPM_L1_SUPPORT)
-			pm_ctrl_data |= PM_CTRL_ASPM_L1_EN;
-		else
-			pm_ctrl_data &= ~PM_CTRL_ASPM_L1_EN;
 	}
 	AT_WRITE_REG(hw, REG_PM_CTRL, pm_ctrl_data);
 
@@ -2235,6 +2202,8 @@ static void atl1c_down(struct atl1c_adapter *adapter)
 	napi_disable(&adapter->napi);
 	atl1c_irq_disable(adapter);
 	atl1c_free_irq(adapter);
+	/* disable ASPM if device inactive */
+	atl1c_disable_l0s_l1(&adapter->hw);
 	/* reset MAC to disable all RX/TX */
 	atl1c_reset_mac(&adapter->hw);
 	msleep(1);
-- 
1.7.7

^ permalink raw reply related

* [PATCH 03/11] atl1c: update right threshold for TSO
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

atl1c_configure_tx used a wrong value of MAX_TX_OFFLOAD_THRESH(9KB)
for TSO threshold.
the right value should be 7KB
Fast Ethernet controller doesn't support Jumbo frame.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c.h      |    2 --
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |    1 +
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   11 ++++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h
index 0a4bfab..fa31551 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -74,8 +74,6 @@
 
 #define AT_RX_BUF_SIZE		(ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN)
 #define MAX_JUMBO_FRAME_SIZE	(6*1024)
-#define MAX_TSO_FRAME_SIZE      (7*1024)
-#define MAX_TX_OFFLOAD_THRESH	(9*1024)
 
 #define AT_MAX_RECEIVE_QUEUE    4
 #define AT_DEF_RECEIVE_QUEUE	1
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index c1aa3ba..c9c6782 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -500,6 +500,7 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 /* Jumbo packet Threshold for task offload */
 #define REG_TX_TSO_OFFLOAD_THRESH	0x1594 /* In 8-bytes */
 #define TX_TSO_OFFLOAD_THRESH_MASK	0x07FF
+#define MAX_TSO_FRAME_SIZE		(7*1024)
 
 #define	REG_TXF_WATER_MARK		0x1598 /* In 8-bytes */
 #define TXF_WATER_MARK_MASK		0x0FFF
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index d2f89f0..e8e9c10 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -501,11 +501,16 @@ static int atl1c_set_features(struct net_device *netdev,
 static int atl1c_change_mtu(struct net_device *netdev, int new_mtu)
 {
 	struct atl1c_adapter *adapter = netdev_priv(netdev);
+	struct atl1c_hw *hw = &adapter->hw;
 	int old_mtu   = netdev->mtu;
 	int max_frame = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
 
-	if ((max_frame < ETH_ZLEN + ETH_FCS_LEN) ||
-			(max_frame > MAX_JUMBO_FRAME_SIZE)) {
+	/* Fast Ethernet controller doesn't support jumbo packet */
+	if (((hw->nic_type == athr_l2c ||
+	      hw->nic_type == athr_l2c_b ||
+	      hw->nic_type == athr_l2c_b2) && new_mtu > ETH_DATA_LEN) ||
+	      max_frame < ETH_ZLEN + ETH_FCS_LEN ||
+	      max_frame > MAX_JUMBO_FRAME_SIZE) {
 		if (netif_msg_link(adapter))
 			dev_warn(&adapter->pdev->dev, "invalid MTU setting\n");
 		return -EINVAL;
@@ -1049,7 +1054,7 @@ static void atl1c_configure_tx(struct atl1c_adapter *adapter)
 	u16 tx_offload_thresh;
 	u32 txq_ctrl_data;
 
-	tx_offload_thresh = MAX_TX_OFFLOAD_THRESH;
+	tx_offload_thresh = MAX_TSO_FRAME_SIZE;
 	AT_WRITE_REG(hw, REG_TX_TSO_OFFLOAD_THRESH,
 		(tx_offload_thresh >> 3) & TX_TSO_OFFLOAD_THRESH_MASK);
 	max_pay_load = pcie_get_readrq(adapter->pdev) >> 8;
-- 
1.7.7

^ permalink raw reply related

* [PATCH 02/11] atl1c: add module parameter for l1c_wait_until_idle
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

l1c_wait_until_idle is called for serval modules (TXQ/RXQ/TXMAC/RXMAC).
specific moudle have specific idle/busy status in reg REG_IDLE_STATUS.
the previous code return wrongly if all modules are in idle status,
regardless the 'stop' action is applied on individual module.
Refine the reg REG_IDLE_STATUS definition as well.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   28 ++++++++++++++--------
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   11 +++++----
 2 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index a37c82f..c1aa3ba 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -227,17 +227,25 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 		GPHY_CTRL_HIB_PULSE	|\
 		GPHY_CTRL_PWDOWN_HW	|\
 		GPHY_CTRL_PHY_IDDQ)
+
 /* Block IDLE Status Register */
-#define REG_IDLE_STATUS  		0x1410
-#define IDLE_STATUS_MASK		0x00FF
-#define IDLE_STATUS_RXMAC_NO_IDLE      	0x1
-#define IDLE_STATUS_TXMAC_NO_IDLE      	0x2
-#define IDLE_STATUS_RXQ_NO_IDLE        	0x4
-#define IDLE_STATUS_TXQ_NO_IDLE        	0x8
-#define IDLE_STATUS_DMAR_NO_IDLE       	0x10
-#define IDLE_STATUS_DMAW_NO_IDLE       	0x20
-#define IDLE_STATUS_SMB_NO_IDLE        	0x40
-#define IDLE_STATUS_CMB_NO_IDLE        	0x80
+#define REG_IDLE_STATUS			0x1410
+#define IDLE_STATUS_SFORCE_MASK		0xFUL
+#define IDLE_STATUS_SFORCE_SHIFT	14
+#define IDLE_STATUS_CALIB_DONE		BIT(13)
+#define IDLE_STATUS_CALIB_RES_MASK	0x1FUL
+#define IDLE_STATUS_CALIB_RES_SHIFT	8
+#define IDLE_STATUS_CALIBERR_MASK	0xFUL
+#define IDLE_STATUS_CALIBERR_SHIFT	4
+#define IDLE_STATUS_TXQ_BUSY		BIT(3)
+#define IDLE_STATUS_RXQ_BUSY		BIT(2)
+#define IDLE_STATUS_TXMAC_BUSY		BIT(1)
+#define IDLE_STATUS_RXMAC_BUSY		BIT(0)
+#define IDLE_STATUS_MASK		(\
+	IDLE_STATUS_TXQ_BUSY		|\
+	IDLE_STATUS_RXQ_BUSY		|\
+	IDLE_STATUS_TXMAC_BUSY		|\
+	IDLE_STATUS_RXMAC_BUSY)
 
 /* MDIO Control Register */
 #define REG_MDIO_CTRL           	0x1414
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 2e1c9f3..d2f89f0 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -185,14 +185,14 @@ static inline void atl1c_irq_reset(struct atl1c_adapter *adapter)
  * atl1c_wait_until_idle - wait up to AT_HW_MAX_IDLE_DELAY reads
  * of the idle status register until the device is actually idle
  */
-static u32 atl1c_wait_until_idle(struct atl1c_hw *hw)
+static u32 atl1c_wait_until_idle(struct atl1c_hw *hw, u32 modu_ctrl)
 {
 	int timeout;
 	u32 data;
 
 	for (timeout = 0; timeout < AT_HW_MAX_IDLE_DELAY; timeout++) {
 		AT_READ_REG(hw, REG_IDLE_STATUS, &data);
-		if ((data & IDLE_STATUS_MASK) == 0)
+		if ((data & modu_ctrl) == 0)
 			return 0;
 		msleep(1);
 	}
@@ -1119,13 +1119,14 @@ static int atl1c_stop_mac(struct atl1c_hw *hw)
 	data &= ~TXQ_CTRL_EN;
 	AT_WRITE_REG(hw, REG_TXQ_CTRL, data);
 
-	atl1c_wait_until_idle(hw);
+	atl1c_wait_until_idle(hw, IDLE_STATUS_RXQ_BUSY | IDLE_STATUS_TXQ_BUSY);
 
 	AT_READ_REG(hw, REG_MAC_CTRL, &data);
 	data &= ~(MAC_CTRL_TX_EN | MAC_CTRL_RX_EN);
 	AT_WRITE_REG(hw, REG_MAC_CTRL, data);
 
-	return (int)atl1c_wait_until_idle(hw);
+	return (int)atl1c_wait_until_idle(hw,
+		IDLE_STATUS_TXMAC_BUSY | IDLE_STATUS_RXMAC_BUSY);
 }
 
 static void atl1c_enable_rx_ctrl(struct atl1c_hw *hw)
@@ -1176,7 +1177,7 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 	msleep(10);
 	/* Wait at least 10ms for All module to be Idle */
 
-	if (atl1c_wait_until_idle(hw)) {
+	if (atl1c_wait_until_idle(hw, IDLE_STATUS_MASK)) {
 		dev_err(&pdev->dev,
 			"MAC state machine can't be idle since"
 			" disabled for 10ms second\n");
-- 
1.7.7

^ permalink raw reply related

* [PATCH 00/11] atl1c: update hardware settings - v2
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong

This update contains a serial of patches, most of them are hardware
settings related. register definitions are refined (or removed if
meaningless) for each patch.

This is the second serial patches, after reviewed/applied the third
serial will be out.

The patches have addressed all sparse and checkpatch warnings.

Following NICs are tested:
AR8131/AR8132/AR8151A/AR8152A/AR8152B
Test item includes:
build/install/uninstall/dhcp/ping/iperf/wol/reboot/etc.


xiong (11):
  atl1c: threshold for ASPM is changed based on chip capability
  atl1c: add module parameter for l1c_wait_until_idle
  atl1c: update right threshold for TSO
  atl1c: remove dmar_dly_cnt and dmaw_dly_cnt
  atl1c: clear PCIE error status in atl1c_reset_pcie
  atl1c: refine reg definition of REG_MASTER_CTRL
  atl1c: clear bit MASTER_CTRL_CLK_SEL_DIS in atl1c_pcie_patch
  atl1c: refine/update ASPM configuration
  atl1c: refine atl1c_pcie_patch
  atl1c: fix WoL(magic) issue for l2cb 1.1
  atl1c: remove MDIO_REG_ADDR_MASK in atl1c_mdio_read/write

 drivers/net/ethernet/atheros/atl1c/atl1c.h      |    4 -
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |  237 ++++++++++++--------
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |  282 ++++++++++++-----------
 3 files changed, 290 insertions(+), 233 deletions(-)

-- 
1.7.7

^ permalink raw reply

* [PATCH 10/11] atl1c: fix WoL(magic) issue for l2cb 1.1
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

l2cb 1.1 hardware has a bug for magic wakeup,
the workaround is to add pattern enable.
WoL related registers are refined as well.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   71 ++++++++++++++--------
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    9 ++-
 2 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index 59051e7..cc7afa1 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -404,34 +404,53 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 
 /* Wake-On-Lan control register */
 #define REG_WOL_CTRL                	0x14a0
-#define WOL_PATTERN_EN              	0x00000001
-#define WOL_PATTERN_PME_EN              0x00000002
-#define WOL_MAGIC_EN                    0x00000004
-#define WOL_MAGIC_PME_EN                0x00000008
-#define WOL_LINK_CHG_EN                 0x00000010
-#define WOL_LINK_CHG_PME_EN             0x00000020
-#define WOL_PATTERN_ST                  0x00000100
-#define WOL_MAGIC_ST                    0x00000200
-#define WOL_LINKCHG_ST                  0x00000400
-#define WOL_CLK_SWITCH_EN               0x00008000
-#define WOL_PT0_EN                      0x00010000
-#define WOL_PT1_EN                      0x00020000
-#define WOL_PT2_EN                      0x00040000
-#define WOL_PT3_EN                      0x00080000
-#define WOL_PT4_EN                      0x00100000
-#define WOL_PT5_EN                      0x00200000
-#define WOL_PT6_EN                      0x00400000
+#define WOL_PT7_MATCH			BIT(31)
+#define WOL_PT6_MATCH			BIT(30)
+#define WOL_PT5_MATCH			BIT(29)
+#define WOL_PT4_MATCH			BIT(28)
+#define WOL_PT3_MATCH			BIT(27)
+#define WOL_PT2_MATCH			BIT(26)
+#define WOL_PT1_MATCH			BIT(25)
+#define WOL_PT0_MATCH			BIT(24)
+#define WOL_PT7_EN			BIT(23)
+#define WOL_PT6_EN			BIT(22)
+#define WOL_PT5_EN			BIT(21)
+#define WOL_PT4_EN			BIT(20)
+#define WOL_PT3_EN			BIT(19)
+#define WOL_PT2_EN			BIT(18)
+#define WOL_PT1_EN			BIT(17)
+#define WOL_PT0_EN			BIT(16)
+#define WOL_LNKCHG_ST			BIT(10)
+#define WOL_MAGIC_ST			BIT(9)
+#define WOL_PATTERN_ST			BIT(8)
+#define WOL_OOB_EN			BIT(6)
+#define WOL_LINK_CHG_PME_EN		BIT(5)
+#define WOL_LINK_CHG_EN			BIT(4)
+#define WOL_MAGIC_PME_EN		BIT(3)
+#define WOL_MAGIC_EN			BIT(2)
+#define WOL_PATTERN_PME_EN		BIT(1)
+#define WOL_PATTERN_EN			BIT(0)
 
 /* WOL Length ( 2 DWORD ) */
-#define REG_WOL_PATTERN_LEN         	0x14a4
-#define WOL_PT_LEN_MASK                 0x7f
-#define WOL_PT0_LEN_SHIFT               0
-#define WOL_PT1_LEN_SHIFT               8
-#define WOL_PT2_LEN_SHIFT               16
-#define WOL_PT3_LEN_SHIFT               24
-#define WOL_PT4_LEN_SHIFT               0
-#define WOL_PT5_LEN_SHIFT               8
-#define WOL_PT6_LEN_SHIFT               16
+#define REG_WOL_PTLEN1			0x14A4
+#define WOL_PTLEN1_3_MASK		0xFFUL
+#define WOL_PTLEN1_3_SHIFT		24
+#define WOL_PTLEN1_2_MASK		0xFFUL
+#define WOL_PTLEN1_2_SHIFT		16
+#define WOL_PTLEN1_1_MASK		0xFFUL
+#define WOL_PTLEN1_1_SHIFT		8
+#define WOL_PTLEN1_0_MASK		0xFFUL
+#define WOL_PTLEN1_0_SHIFT		0
+
+#define REG_WOL_PTLEN2			0x14A8
+#define WOL_PTLEN2_7_MASK		0xFFUL
+#define WOL_PTLEN2_7_SHIFT		24
+#define WOL_PTLEN2_6_MASK		0xFFUL
+#define WOL_PTLEN2_6_SHIFT		16
+#define WOL_PTLEN2_5_MASK		0xFFUL
+#define WOL_PTLEN2_5_SHIFT		8
+#define WOL_PTLEN2_4_MASK		0xFFUL
+#define WOL_PTLEN2_4_SHIFT		0
 
 /* Internal SRAM Partition Register */
 #define RFDX_HEAD_ADDR_MASK		0x03FF
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 17b91db..e671367 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -2354,9 +2354,14 @@ static int atl1c_suspend(struct device *dev)
 			mac_ctrl_data |= MAC_CTRL_DUPLX;
 
 		/* turn on magic packet wol */
-		if (wufc & AT_WUFC_MAG)
+		if (wufc & AT_WUFC_MAG) {
 			wol_ctrl_data |= WOL_MAGIC_EN | WOL_MAGIC_PME_EN;
-
+			if (hw->nic_type == athr_l2c_b &&
+			    hw->revision_id == L2CB_V11) {
+				wol_ctrl_data |=
+					WOL_PATTERN_EN | WOL_PATTERN_PME_EN;
+			}
+		}
 		if (wufc & AT_WUFC_LNKC) {
 			wol_ctrl_data |=  WOL_LINK_CHG_EN | WOL_LINK_CHG_PME_EN;
 			/* only link up can wake up */
-- 
1.7.7

^ permalink raw reply related

* [PATCH 09/11] atl1c: refine atl1c_pcie_patch
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

bit PCIE_PHYMISC_FORCE_RCV_DET is only for l1c&l2c to fix WoL issue,
other chips set bit5 of REG_MASTER_CTRL --- this way could save more
power than the former, and the bit should be kept all time.
l2cb 1.x has special setting for L0S/L1
l2cb 1.x & l1d 1.x should clear Vendor Message on some platforms,
otherwise it will cause the root complex hang.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   17 ++++++--
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   49 +++++++++++++++++------
 2 files changed, 48 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index 5e49ea2..59051e7 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -96,17 +96,24 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 #define PCIE_DEV_MISC_SERDES_SEL_DIN   	0x10
 
 #define REG_PCIE_PHYMISC	    	0x1000
-#define PCIE_PHYMISC_FORCE_RCV_DET	0x4
+#define PCIE_PHYMISC_FORCE_RCV_DET	BIT(2)
+#define PCIE_PHYMISC_NFTS_MASK		0xFFUL
+#define PCIE_PHYMISC_NFTS_SHIFT		16
 
 #define REG_PCIE_PHYMISC2		0x1004
-#define PCIE_PHYMISC2_SERDES_CDR_MASK	0x3
-#define PCIE_PHYMISC2_SERDES_CDR_SHIFT	16
-#define PCIE_PHYMISC2_SERDES_TH_MASK	0x3
-#define PCIE_PHYMISC2_SERDES_TH_SHIFT	18
+#define PCIE_PHYMISC2_L0S_TH_MASK	0x3UL
+#define PCIE_PHYMISC2_L0S_TH_SHIFT	18
+#define L2CB1_PCIE_PHYMISC2_L0S_TH	3
+#define PCIE_PHYMISC2_CDR_BW_MASK	0x3UL
+#define PCIE_PHYMISC2_CDR_BW_SHIFT	16
+#define L2CB1_PCIE_PHYMISC2_CDR_BW	3
 
 #define REG_TWSI_DEBUG			0x1108
 #define TWSI_DEBUG_DEV_EXIST		0x20000000
 
+#define REG_DMA_DBG			0x1114
+#define DMA_DBG_VENDOR_MSG		BIT(0)
+
 #define REG_EEPROM_CTRL			0x12C0
 #define EEPROM_CTRL_DATA_HI_MASK	0xFFFF
 #define EEPROM_CTRL_DATA_HI_SHIFT	0
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 47fe6ad..17b91db 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -87,20 +87,37 @@ static void atl1c_pcie_patch(struct atl1c_hw *hw)
 	mst_data &= ~MASTER_CTRL_CLK_SEL_DIS;
 	AT_WRITE_REG(hw, REG_MASTER_CTRL, mst_data);
 
-	AT_READ_REG(hw, REG_PCIE_PHYMISC, &data);
-	data |= PCIE_PHYMISC_FORCE_RCV_DET;
-	AT_WRITE_REG(hw, REG_PCIE_PHYMISC, data);
-
+	/* WoL/PCIE related settings */
+	if (hw->nic_type == athr_l1c || hw->nic_type == athr_l2c) {
+		AT_READ_REG(hw, REG_PCIE_PHYMISC, &data);
+		data |= PCIE_PHYMISC_FORCE_RCV_DET;
+		AT_WRITE_REG(hw, REG_PCIE_PHYMISC, data);
+	} else { /* new dev set bit5 of MASTER */
+		if (!(mst_data & MASTER_CTRL_WAKEN_25M))
+			AT_WRITE_REG(hw, REG_MASTER_CTRL,
+				mst_data | MASTER_CTRL_WAKEN_25M);
+	}
+	/* aspm/PCIE setting only for l2cb 1.0 */
 	if (hw->nic_type == athr_l2c_b && hw->revision_id == L2CB_V10) {
 		AT_READ_REG(hw, REG_PCIE_PHYMISC2, &data);
-
-		data &= ~(PCIE_PHYMISC2_SERDES_CDR_MASK <<
-			PCIE_PHYMISC2_SERDES_CDR_SHIFT);
-		data |= 3 << PCIE_PHYMISC2_SERDES_CDR_SHIFT;
-		data &= ~(PCIE_PHYMISC2_SERDES_TH_MASK <<
-			PCIE_PHYMISC2_SERDES_TH_SHIFT);
-		data |= 3 << PCIE_PHYMISC2_SERDES_TH_SHIFT;
+		data = FIELD_SETX(data, PCIE_PHYMISC2_CDR_BW,
+			L2CB1_PCIE_PHYMISC2_CDR_BW);
+		data = FIELD_SETX(data, PCIE_PHYMISC2_L0S_TH,
+			L2CB1_PCIE_PHYMISC2_L0S_TH);
 		AT_WRITE_REG(hw, REG_PCIE_PHYMISC2, data);
+		/* extend L1 sync timer */
+		AT_READ_REG(hw, REG_LINK_CTRL, &data);
+		data |= LINK_CTRL_EXT_SYNC;
+		AT_WRITE_REG(hw, REG_LINK_CTRL, data);
+	}
+	/* l2cb 1.x & l1d 1.x */
+	if (hw->nic_type == athr_l2c_b || hw->nic_type == athr_l1d) {
+		AT_READ_REG(hw, REG_PM_CTRL, &data);
+		data |= PM_CTRL_L0S_BUFSRX_EN;
+		AT_WRITE_REG(hw, REG_PM_CTRL, data);
+		/* clear vendor msg */
+		AT_READ_REG(hw, REG_DMA_DBG, &data);
+		AT_WRITE_REG(hw, REG_DMA_DBG, data & ~DMA_DBG_VENDOR_MSG);
 	}
 }
 
@@ -1181,8 +1198,8 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 	 */
 	AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
 	master_ctrl_data |= MASTER_CTRL_OOB_DIS;
-	AT_WRITE_REGW(hw, REG_MASTER_CTRL, ((master_ctrl_data | MASTER_CTRL_SOFT_RST)
-			& 0xFFFF));
+	AT_WRITE_REG(hw, REG_MASTER_CTRL,
+		master_ctrl_data | MASTER_CTRL_SOFT_RST);
 
 	AT_WRITE_FLUSH(hw);
 	msleep(10);
@@ -1194,6 +1211,8 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 			" disabled for 10ms second\n");
 		return -1;
 	}
+	AT_WRITE_REG(hw, REG_MASTER_CTRL, master_ctrl_data);
+
 	return 0;
 }
 
@@ -1338,6 +1357,10 @@ static int atl1c_configure(struct atl1c_adapter *adapter)
 	u32 intr_modrt_data;
 	u32 data;
 
+	AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
+	master_ctrl_data &= ~(MASTER_CTRL_TX_ITIMER_EN |
+			      MASTER_CTRL_RX_ITIMER_EN |
+			      MASTER_CTRL_INT_RDCLR);
 	/* clear interrupt status */
 	AT_WRITE_REG(hw, REG_ISR, 0xFFFFFFFF);
 	/*  Clear any WOL status */
-- 
1.7.7

^ permalink raw reply related

* [PATCH 07/11] atl1c: clear bit MASTER_CTRL_CLK_SEL_DIS in atl1c_pcie_patch
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

bit MASTER_CTRL_CLK_SEL_DIS could be set before enter suspend
clear it after resume to enable pclk(PCIE clock) switch to
low frequency(25M) in some circumstances to save power.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 796cc75..9783afc 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -80,7 +80,12 @@ static const u32 atl1c_default_msg = NETIF_MSG_DRV | NETIF_MSG_PROBE |
 	NETIF_MSG_LINK | NETIF_MSG_TIMER | NETIF_MSG_IFDOWN | NETIF_MSG_IFUP;
 static void atl1c_pcie_patch(struct atl1c_hw *hw)
 {
-	u32 data;
+	u32 mst_data, data;
+
+	/* pclk sel could switch to 25M */
+	AT_READ_REG(hw, REG_MASTER_CTRL, &mst_data);
+	mst_data &= ~MASTER_CTRL_CLK_SEL_DIS;
+	AT_WRITE_REG(hw, REG_MASTER_CTRL, mst_data);
 
 	AT_READ_REG(hw, REG_PCIE_PHYMISC, &data);
 	data |= PCIE_PHYMISC_FORCE_RCV_DET;
-- 
1.7.7

^ permalink raw reply related

* [PATCH 06/11] atl1c: refine reg definition of REG_MASTER_CTRL
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

refine/update register REG_MASTER_CTRL definition according with
hardware spec.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   41 +++++++++++++----------
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    2 +-
 2 files changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index 6d73ac9..9779b83 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -148,26 +148,31 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 
 #define REG_LTSSM_ID_CTRL		0x12FC
 #define LTSSM_ID_EN_WRO			0x1000
+
+
 /* Selene Master Control Register */
 #define REG_MASTER_CTRL			0x1400
-#define MASTER_CTRL_SOFT_RST            0x1
-#define MASTER_CTRL_TEST_MODE_MASK	0x3
-#define MASTER_CTRL_TEST_MODE_SHIFT	2
-#define MASTER_CTRL_BERT_START		0x10
-#define MASTER_CTRL_OOB_DIS_OFF		0x40
-#define MASTER_CTRL_SA_TIMER_EN		0x80
-#define MASTER_CTRL_MTIMER_EN           0x100
-#define MASTER_CTRL_MANUAL_INT          0x200
-#define MASTER_CTRL_TX_ITIMER_EN	0x400
-#define MASTER_CTRL_RX_ITIMER_EN	0x800
-#define MASTER_CTRL_CLK_SEL_DIS		0x1000
-#define MASTER_CTRL_CLK_SWH_MODE	0x2000
-#define MASTER_CTRL_INT_RDCLR		0x4000
-#define MASTER_CTRL_REV_NUM_SHIFT	16
-#define MASTER_CTRL_REV_NUM_MASK	0xff
-#define MASTER_CTRL_DEV_ID_SHIFT	24
-#define MASTER_CTRL_DEV_ID_MASK		0x7f
-#define MASTER_CTRL_OTP_SEL		0x80000000
+#define MASTER_CTRL_OTP_SEL		BIT(31)
+#define MASTER_DEV_NUM_MASK		0x7FUL
+#define MASTER_DEV_NUM_SHIFT		24
+#define MASTER_REV_NUM_MASK		0xFFUL
+#define MASTER_REV_NUM_SHIFT		16
+#define MASTER_CTRL_INT_RDCLR		BIT(14)
+#define MASTER_CTRL_CLK_SEL_DIS		BIT(12)	/* 1:alwys sel pclk from
+						 * serdes, not sw to 25M */
+#define MASTER_CTRL_RX_ITIMER_EN	BIT(11)	/* IRQ MODURATION FOR RX */
+#define MASTER_CTRL_TX_ITIMER_EN	BIT(10)	/* MODURATION FOR TX/RX */
+#define MASTER_CTRL_MANU_INT		BIT(9)	/* SOFT MANUAL INT */
+#define MASTER_CTRL_MANUTIMER_EN	BIT(8)
+#define MASTER_CTRL_SA_TIMER_EN		BIT(7)	/* SYS ALIVE TIMER EN */
+#define MASTER_CTRL_OOB_DIS		BIT(6)	/* OUT OF BOX DIS */
+#define MASTER_CTRL_WAKEN_25M		BIT(5)	/* WAKE WO. PCIE CLK */
+#define MASTER_CTRL_BERT_START		BIT(4)
+#define MASTER_PCIE_TSTMOD_MASK		3UL
+#define MASTER_PCIE_TSTMOD_SHIFT	2
+#define MASTER_PCIE_RST			BIT(1)
+#define MASTER_CTRL_SOFT_RST		BIT(0)	/* RST MAC & DMA */
+#define DMA_MAC_RST_TO			50
 
 /* Timer Initial Value Register */
 #define REG_MANUAL_TIMER_INIT       	0x1404
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 729381a..796cc75 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1179,7 +1179,7 @@ static int atl1c_reset_mac(struct atl1c_hw *hw)
 	 * clearing, and should clear within a microsecond.
 	 */
 	AT_READ_REG(hw, REG_MASTER_CTRL, &master_ctrl_data);
-	master_ctrl_data |= MASTER_CTRL_OOB_DIS_OFF;
+	master_ctrl_data |= MASTER_CTRL_OOB_DIS;
 	AT_WRITE_REGW(hw, REG_MASTER_CTRL, ((master_ctrl_data | MASTER_CTRL_SOFT_RST)
 			& 0xFFFF));
 
-- 
1.7.7

^ permalink raw reply related

* [PATCH 05/11] atl1c: clear PCIE error status in atl1c_reset_pcie
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

clear PCIE error status (error log is write-1-clear).
REG_PCIE_UC_SEVERITY is removed as it's a standard pcie register,
and using kernle API to access it.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_hw.h   |   13 -------------
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |   15 +++++++++++----
 2 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
index c9c6782..6d73ac9 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_hw.h
@@ -61,19 +61,6 @@ int atl1c_phy_power_saving(struct atl1c_hw *hw);
 #define LINK_CTRL_L1_EN			0x02
 #define LINK_CTRL_EXT_SYNC		0x80
 
-#define REG_PCIE_UC_SEVERITY		0x10C
-#define PCIE_UC_SERVRITY_TRN		0x00000001
-#define PCIE_UC_SERVRITY_DLP		0x00000010
-#define PCIE_UC_SERVRITY_PSN_TLP	0x00001000
-#define PCIE_UC_SERVRITY_FCP		0x00002000
-#define PCIE_UC_SERVRITY_CPL_TO		0x00004000
-#define PCIE_UC_SERVRITY_CA		0x00008000
-#define PCIE_UC_SERVRITY_UC		0x00010000
-#define PCIE_UC_SERVRITY_ROV		0x00020000
-#define PCIE_UC_SERVRITY_MLFP		0x00040000
-#define PCIE_UC_SERVRITY_ECRC		0x00080000
-#define PCIE_UC_SERVRITY_UR		0x00100000
-
 #define REG_DEV_SERIALNUM_CTRL		0x200
 #define REG_DEV_MAC_SEL_MASK		0x0 /* 0:EUI; 1:MAC */
 #define REG_DEV_MAC_SEL_SHIFT		0
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 12b4725..729381a 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -108,6 +108,7 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag)
 	u32 data;
 	u32 pci_cmd;
 	struct pci_dev *pdev = hw->adapter->pdev;
+	int pos;
 
 	AT_READ_REG(hw, PCI_COMMAND, &pci_cmd);
 	pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
@@ -124,10 +125,16 @@ static void atl1c_reset_pcie(struct atl1c_hw *hw, u32 flag)
 	/*
 	 * Mask some pcie error bits
 	 */
-	AT_READ_REG(hw, REG_PCIE_UC_SEVERITY, &data);
-	data &= ~PCIE_UC_SERVRITY_DLP;
-	data &= ~PCIE_UC_SERVRITY_FCP;
-	AT_WRITE_REG(hw, REG_PCIE_UC_SEVERITY, data);
+	pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_ERR);
+	pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, &data);
+	data &= ~(PCI_ERR_UNC_DLP | PCI_ERR_UNC_FCP);
+	pci_write_config_dword(pdev, pos + PCI_ERR_UNCOR_SEVER, data);
+	/* clear error status */
+	pci_write_config_word(pdev, pci_pcie_cap(pdev) + PCI_EXP_DEVSTA,
+			PCI_EXP_DEVSTA_NFED |
+			PCI_EXP_DEVSTA_FED |
+			PCI_EXP_DEVSTA_CED |
+			PCI_EXP_DEVSTA_URD);
 
 	AT_READ_REG(hw, REG_LTSSM_ID_CTRL, &data);
 	data &= ~LTSSM_ID_EN_WRO;
-- 
1.7.7

^ permalink raw reply related

* [PATCH 04/11] atl1c: remove dmar_dly_cnt and dmaw_dly_cnt
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

dmar_dly_cnt and dmaw_dly_cnt aren't used by hardware/driver any more.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c.h      |    2 --
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    2 --
 2 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h b/drivers/net/ethernet/atheros/atl1c/atl1c.h
index fa31551..acc2956 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -382,8 +382,6 @@ struct atl1c_hw {
 	u16 phy_id2;
 
 	u32 intr_mask;
-	u8 dmaw_dly_cnt;
-	u8 dmar_dly_cnt;
 
 	u8 preamble_len;
 	u16 max_frame_size;
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index e8e9c10..12b4725 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -745,8 +745,6 @@ static int __devinit atl1c_sw_init(struct atl1c_adapter *adapter)
 	hw->rfd_burst = 8;
 	hw->dma_order = atl1c_dma_ord_out;
 	hw->dmar_block = atl1c_dma_req_1024;
-	hw->dmar_dly_cnt = 15;
-	hw->dmaw_dly_cnt = 4;
 
 	if (atl1c_alloc_queues(adapter)) {
 		dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
-- 
1.7.7

^ permalink raw reply related

* [PATCH 01/11] atl1c: threshold for ASPM is changed based on chip capability
From: xiong @ 2012-04-19  8:01 UTC (permalink / raw)
  To: davem, netdev, linux-kernel; +Cc: qca-linux-team, nic-devel, xiong
In-Reply-To: <1334822491-30129-1-git-send-email-xiong@qca.qualcomm.com>

threshold setting to control ASPM for diff chips are different.
currently, all gigabit-capability chips have limited-ASPM under
100M throughput.

Signed-off-by: xiong <xiong@qca.qualcomm.com>
Tested-by: Liu David <dwliu@qca.qualcomm.com>
---
 drivers/net/ethernet/atheros/atl1c/atl1c_main.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
index 02754ac..2e1c9f3 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -1080,9 +1080,10 @@ static void atl1c_configure_rx(struct atl1c_adapter *adapter)
 	if (hw->ctrl_flags & ATL1C_RX_IPV6_CHKSUM)
 		rxq_ctrl_data |= IPV6_CHKSUM_CTRL_EN;
 
-	if (hw->ctrl_flags & ATL1C_ASPM_CTRL_MON)
-		rxq_ctrl_data |= (ASPM_THRUPUT_LIMIT_1M &
-			ASPM_THRUPUT_LIMIT_MASK) << ASPM_THRUPUT_LIMIT_SHIFT;
+	/* aspm for gigabit */
+	if (hw->nic_type != athr_l1d_2 && (hw->device_id & 1) != 0)
+		rxq_ctrl_data = FIELD_SETX(rxq_ctrl_data, ASPM_THRUPUT_LIMIT,
+			ASPM_THRUPUT_LIMIT_100M);
 
 	AT_WRITE_REG(hw, REG_RXQ_CTRL, rxq_ctrl_data);
 }
-- 
1.7.7

^ permalink raw reply related

* [patch] ksz884x: don't copy too much in netdev_set_mac_address()
From: Dan Carpenter @ 2012-04-19  7:00 UTC (permalink / raw)
  To: David S. Miller; +Cc: Tristram.Ha, Ben Hutchings, netdev
In-Reply-To: <1334758394.3209.156.camel@deadeye>

MAX_ADDR_LEN is 32.  ETH_ALEN is 6.  mac->sa_data is a 14 byte array, so
the memcpy() is doing a read past the end of the array.  I asked about
this on netdev and Ben Hutchings told me it's supposed to be copying
ETH_ALEN bytes (thanks Ben).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index ef723b1..eaf9ff0 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5675,7 +5675,7 @@ static int netdev_set_mac_address(struct net_device *dev, void *addr)
 		memcpy(hw->override_addr, mac->sa_data, ETH_ALEN);
 	}
 
-	memcpy(dev->dev_addr, mac->sa_data, MAX_ADDR_LEN);
+	memcpy(dev->dev_addr, mac->sa_data, ETH_ALEN);
 
 	interrupt = hw_block_intr(hw);
 

^ permalink raw reply related

* Re: [PATCH v3] set fake_rtable's dst to NULL to avoid kernel Oops.
From: Stephen Hemminger @ 2012-04-19  6:46 UTC (permalink / raw)
  To: Peter Huang(Peng)
  Cc: 'David S. Miller', netdev, ctrix+debianbugs, Eric Dumazet,
	harry.majun, linux-kernel, peter.huangpeng
In-Reply-To: <4F8F77F5.8020201@huawei.com>

On Thu, 19 Apr 2012 10:27:01 +0800
"Peter Huang(Peng)" <peter.huangpeng@huawei.com> wrote:

> When bridge is deleted before tap/vif device's delete, kernel may 
> encounter an oops because of NULL reference to fake_rtable's dst.
> Set fake_rtable's dst to NULL before sending packets out can solve this 
> problem.
> 
> v3 enrich commit header
> 
> v2 added a new flag DST_FAKE_RTABLE to dst_entry struct.
> 
> 
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> Signed-off-by: Peter Huang <peter.huangpeng@huawei.com>

I am okay with the contents of the patch but the formatting is all
botched. It adds bad indentation and whitespace, please run it
through checkpatch. 

^ permalink raw reply

* Re: linux-next: build failure after merge of the final tree (net-next tree related)
From: David Miller @ 2012-04-19  6:40 UTC (permalink / raw)
  To: sfr; +Cc: netdev, linux-next, linux-kernel, majianpeng
In-Reply-To: <20120419162859.904574e2518c5a904802efbc@canb.auug.org.au>

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 19 Apr 2012 16:28:59 +1000

> After merging the final tree, today's linux-next build (sparc64 defconfig)
> failed like this:
> 
> net/ipv4/route.c: In function 'ip_static_sysctl_init':
> net/ipv4/route.c:3517:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]
...
> net/core/sysctl_net_core.c: In function 'sysctl_core_init':
> net/core/sysctl_net_core.c:259:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]
...

I already checked in a fix for this, thanks Stephen.

^ permalink raw reply

* Re: [net-next 3/4] stmmac: verify the dma_cfg platform fields
From: Giuseppe CAVALLARO @ 2012-04-19  6:29 UTC (permalink / raw)
  To: Viresh KUMAR; +Cc: netdev@vger.kernel.org, spear-devel
In-Reply-To: <4F8FAB12.2060108@st.com>

On 4/19/2012 8:05 AM, Viresh KUMAR wrote:
> On 4/19/2012 11:18 AM, Giuseppe CAVALLARO wrote:
>> Recently the dma parameters that can be passed from the platform
>> have been moved from the plat_stmmacenet_data to the stmmac_dma_cfg.
>>
>> In case of this new structure is not well allocated the driver can
>> fails. This is an example how this field is managed in ST platforms
>>
>> static struct stmmac_dma_cfg gmac_dma_setting = {
>>         .pbl = 32,
>> };
>>
>> static struct plat_stmmacenet_data stih415_ethernet_platform_data[] = {
>> 	{
>> 		.dma_cfg = &gmac_dma_setting,
>> 		.has_gmac = 1,
>> [snip]
>>
>> This patch so verifies that the dma_cfg passed from the platform.
>> In case of it is NULL there is no reason that the driver has to fail
>> and some default values can be passed. These are ok for all the
>> Synopsys chips and could impact on performances, only.
>>
>> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
>> cc: Viresh Kumar <viresh.kumar@st.com>
> 
> I really can't review it, as i am not stmmac expert. But, i am sure
> the problem i highlighted will be resolved by this patch.
> 
> Another thing, as SPEAr is using stmmac, can you always cc spear-devel@list.st.com
> for all stmmac patches.

Yes! I have forgotten to add spear guys ;-)

Thanks for your feedbak

Peppe

> 

^ permalink raw reply

* linux-next: build failure after merge of the final tree (net-next tree related)
From: Stephen Rothwell @ 2012-04-19  6:28 UTC (permalink / raw)
  To: David Miller, netdev; +Cc: linux-next, linux-kernel, majianpeng

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

Hi all,

After merging the final tree, today's linux-next build (sparc64 defconfig)
failed like this:

net/ipv4/route.c: In function 'ip_static_sysctl_init':
net/ipv4/route.c:3517:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]

Caused by commit 7f5938810890 ("net/ipv4:Remove two memleak reports by
kmemleak_not_leak").

net/core/sysctl_net_core.c: In function 'sysctl_core_init':
net/core/sysctl_net_core.c:259:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]

Caused by commit 798ec84d4575 ("net/core:Remove memleak reports by
kmemleak_not_leak").

I added this patch for today:

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Thu, 19 Apr 2012 16:25:16 +1000
Subject: [PATCH] net: using kmemleak_not_leak requires including kmemleak.h

fixes these build errors:

net/ipv4/route.c: In function 'ip_static_sysctl_init':
net/ipv4/route.c:3517:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]
net/core/sysctl_net_core.c: In function 'sysctl_core_init':
net/core/sysctl_net_core.c:259:2: error: implicit declaration of function 'kmemleak_not_leak' [-Werror=implicit-function-declaration]

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 net/core/sysctl_net_core.c |    1 +
 net/ipv4/route.c           |    1 +
 2 files changed, 2 insertions(+)

diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index cee5991..247c69b 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -14,6 +14,7 @@
 #include <linux/vmalloc.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/kmemleak.h>
 
 #include <net/ip.h>
 #include <net/sock.h>
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bcd4744..dcb4205 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -93,6 +93,7 @@
 #include <linux/times.h>
 #include <linux/slab.h>
 #include <linux/prefetch.h>
+#include <linux/kmemleak.h>
 #include <net/dst.h>
 #include <net/net_namespace.h>
 #include <net/protocol.h>
-- 
1.7.10.rc3

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

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

^ permalink raw reply related

* Re: [net-next 3/4] stmmac: verify the dma_cfg platform fields
From: Viresh Kumar @ 2012-04-19  6:05 UTC (permalink / raw)
  To: Giuseppe CAVALLARO; +Cc: netdev@vger.kernel.org, spear-devel
In-Reply-To: <1334814502-29707-3-git-send-email-peppe.cavallaro@st.com>

On 4/19/2012 11:18 AM, Giuseppe CAVALLARO wrote:
> Recently the dma parameters that can be passed from the platform
> have been moved from the plat_stmmacenet_data to the stmmac_dma_cfg.
> 
> In case of this new structure is not well allocated the driver can
> fails. This is an example how this field is managed in ST platforms
> 
> static struct stmmac_dma_cfg gmac_dma_setting = {
>         .pbl = 32,
> };
> 
> static struct plat_stmmacenet_data stih415_ethernet_platform_data[] = {
> 	{
> 		.dma_cfg = &gmac_dma_setting,
> 		.has_gmac = 1,
> [snip]
> 
> This patch so verifies that the dma_cfg passed from the platform.
> In case of it is NULL there is no reason that the driver has to fail
> and some default values can be passed. These are ok for all the
> Synopsys chips and could impact on performances, only.
> 
> Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> cc: Viresh Kumar <viresh.kumar@st.com>

I really can't review it, as i am not stmmac expert. But, i am sure
the problem i highlighted will be resolved by this patch.

Another thing, as SPEAr is using stmmac, can you always cc spear-devel@list.st.com
for all stmmac patches.

-- 
viresh

^ permalink raw reply

* Re: [PATCH] stmmac: fix kernel crash when device probed for SPEAr with DT
From: Giuseppe CAVALLARO @ 2012-04-19  5:51 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: spear-devel, viresh.linux@gmail.com, netdev@vger.kernel.org,
	davem@davemloft.net, Deepak SIKRI
In-Reply-To: <4F8E4DD3.8030908@st.com>

Hello Viresh.

On 4/18/2012 7:14 AM, Viresh Kumar wrote:
> On 4/18/2012 10:41 AM, Giuseppe CAVALLARO wrote:
>> I hoped it was fully tested on SPEAr platforms. at any rate
> 
> I am only working for SPEAr3xx with DT support and this patch is must as
> without it we have build failures. Haven't tested on any other SPEAr SoCs, they
> may require extra pdata fields to be initialized, but that will follow with
> their DT support.
> 

I've just sent 4 patches so I kindly ask you to review the patch named:
  [net-next 3/4] stmmac: verify the dma_cfg platform fields
where I reworked the logic behind the dma_cfg conf.

Peppe

^ permalink raw reply

* Re: [PATCH 2/4] batman: don't bother flipping ->tt_crc
From: Antonio Quartulli @ 2012-04-19  5:49 UTC (permalink / raw)
  To: Al Viro
  Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
	b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	davem-fT/PcQaiUtIeIZ0/mPfg9Q
In-Reply-To: <20120419054113.GA8658-E/2OGukznS5g9hUCZPvPmw@public.gmane.org>

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

On Thu, Apr 19, 2012 at 07:41:14AM +0200, Antonio Quartulli wrote:
> On Wed, Apr 18, 2012 at 07:10:58 +0100, Al Viro wrote:
> > @@ -722,7 +721,7 @@ update_tt:
> >  		tt_update_orig(bat_priv, orig_node, tt_buff,
> >  			       batman_ogm_packet->tt_num_changes,
> >  			       batman_ogm_packet->ttvn,
> > -			       batman_ogm_packet->tt_crc);
> > +			       ntohs(batman_ogm_packet->tt_crc));
> 
> If we don't need to flip tt_crc, wy are you introducing ntohs here? Am I
> overlooking something?

Ok. I was missing the correct meaning of __be16. Now everything is clear.


Cheers,

-- 
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

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

^ 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