Netdev List
 help / color / mirror / Atom feed
* Kernel panic with bridge networking
From: Massimo Cetra @ 2012-04-12 12:30 UTC (permalink / raw)
  To: netdev

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


Hello,

i am experiencing a panic whose logs are attached (grabbed with netconsole).

They look quite similar to what has been described here
    http://www.spinics.net/lists/linux-net/msg17689.html

The patch proposed as the solution (commit 
6b1e960fdbd75dcd9bcc3ba5ff8898ff1ad30b6e) seems to be applied (even with 
small differences) but the problem persists.

The kernel is a debian linux-image-3.2.0-2-amd64 version 3.2.12-1

Any hint ?
I have checked the changelog of 3.2.13 and 3.2.14 and it doesn't seems 
to be any commit regarding such problems.

Massimo Cetra

P.S.1: Please CC me as i'm not subscribed.
P.S.2: this bug has been submitted to debian as well
   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=668511


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

Apr 12 12:10:08 lamu [71020.539961] BUG: unable to handle kernel 
Apr 12 12:10:08 NULL pointer dereference
Apr 12 12:10:08 lamu  at 0000000000000018
Apr 12 12:10:08 lamu [71020.555654] IP:
Apr 12 12:10:08 lamu  [<ffffffffa02e9336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 12:10:08 lamu [71020.569755] PGD 0 
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.573785] Oops: 0000 [#1] 
Apr 12 12:10:08 SMP  
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.580257] CPU 0 
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.583912] Modules linked in:
Apr 12 12:10:08 lamu  ipt_MASQUERADE
Apr 12 12:10:08 lamu  iptable_nat
Apr 12 12:10:08 lamu  nf_nat
Apr 12 12:10:08 lamu  nf_conntrack_ipv4
Apr 12 12:10:08 lamu  nf_defrag_ipv4
Apr 12 12:10:08 lamu  ip_vs_rr
Apr 12 12:10:08 lamu  ip_vs
Apr 12 12:10:08 lamu  nf_conntrack
Apr 12 12:10:08 lamu  libcrc32c
Apr 12 12:10:08 lamu  ip6table_filter
Apr 12 12:10:08 lamu  ip6_tables
Apr 12 12:10:08 lamu  iptable_filter
Apr 12 12:10:08 lamu  ip_tables
Apr 12 12:10:08 lamu  ebtable_nat
Apr 12 12:10:08 lamu  ebtables
Apr 12 12:10:08 lamu  x_tables
Apr 12 12:10:08 lamu  crc32c
Apr 12 12:10:08 lamu  drbd
Apr 12 12:10:08 lamu  lru_cache
Apr 12 12:10:08 lamu  cn
Apr 12 12:10:08 lamu  sit
Apr 12 12:10:08 lamu  tunnel4
Apr 12 12:10:08 lamu  tun
Apr 12 12:10:08 lamu  bridge
Apr 12 12:10:08 lamu  stp
Apr 12 12:10:08 lamu  virtio_net
Apr 12 12:10:08 lamu  virtio_blk
Apr 12 12:10:08 lamu  virtio_rng
Apr 12 12:10:08 lamu  rng_core
Apr 12 12:10:08 lamu  virtio_pci
Apr 12 12:10:08 lamu  virtio_ring
Apr 12 12:10:08 lamu  virtio
Apr 12 12:10:08 lamu  kvm_intel
Apr 12 12:10:08 lamu  kvm
Apr 12 12:10:08 lamu  ipmi_devintf
Apr 12 12:10:08 lamu  ipmi_poweroff
Apr 12 12:10:08 lamu  ipmi_si
Apr 12 12:10:08 lamu  ipmi_watchdog
Apr 12 12:10:08 lamu  ipmi_msghandler
Apr 12 12:10:08 lamu  netconsole
Apr 12 12:10:08 lamu  configfs
Apr 12 12:10:08 lamu  loop
Apr 12 12:10:08 lamu  option
Apr 12 12:10:08 lamu  usb_wwan
Apr 12 12:10:08 lamu  usbserial
Apr 12 12:10:08 lamu  uas
Apr 12 12:10:08 lamu  snd_pcm
Apr 12 12:10:08 lamu  snd_page_alloc
Apr 12 12:10:08 lamu  snd_timer
Apr 12 12:10:08 lamu  snd
Apr 12 12:10:08 lamu  iTCO_wdt
Apr 12 12:10:08 lamu  iTCO_vendor_support
Apr 12 12:10:08 lamu  psmouse
Apr 12 12:10:08 lamu  i7core_edac
Apr 12 12:10:08 lamu  edac_core
Apr 12 12:10:08 lamu  processor
Apr 12 12:10:08 lamu  button
Apr 12 12:10:08 lamu  soundcore
Apr 12 12:10:08 lamu  joydev
Apr 12 12:10:08 lamu  serio_raw
Apr 12 12:10:08 lamu  pcspkr
Apr 12 12:10:08 lamu  evdev
Apr 12 12:10:08 lamu  dcdbas
Apr 12 12:10:08 lamu  thermal_sys
Apr 12 12:10:08 lamu  ext3
Apr 12 12:10:08 lamu  mbcache
Apr 12 12:10:08 lamu  jbd
Apr 12 12:10:08 lamu  dm_mod
Apr 12 12:10:08 lamu  sr_mod
Apr 12 12:10:08 lamu  cdrom
Apr 12 12:10:08 lamu  ses
Apr 12 12:10:08 lamu  sd_mod
Apr 12 12:10:08 lamu  usbhid
Apr 12 12:10:08 lamu  hid
Apr 12 12:10:08 lamu  crc_t10dif
Apr 12 12:10:08 lamu  enclosure
Apr 12 12:10:08 lamu  ata_generic
Apr 12 12:10:08 lamu  uhci_hcd
Apr 12 12:10:08 lamu  ata_piix
Apr 12 12:10:08 lamu  ehci_hcd
Apr 12 12:10:08 lamu  libata
Apr 12 12:10:08 lamu  usbcore
Apr 12 12:10:08 lamu  megaraid_sas
Apr 12 12:10:08 lamu  scsi_mod
Apr 12 12:10:08 lamu  usb_common
Apr 12 12:10:08 lamu  bnx2
Apr 12 12:10:08 lamu  [last unloaded: usb_storage]
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.733498] 
Apr 12 12:10:08 lamu [71020.736475] Pid: 6997, comm: kvm Not tainted 3.2.0-2-amd64 #1
Apr 12 12:10:08 lamu  Dell Inc. PowerEdge R410
Apr 12 12:10:08 lamu /0N051F 
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.753554] RIP: 0010:[<ffffffffa02e9336>] 
Apr 12 12:10:08 lamu  [<ffffffffa02e9336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 12:10:08 lamu [71020.772519] RSP: 0018:ffff88042fc03b18  EFLAGS: 00010293
Apr 12 12:10:08 lamu [71020.783126] RAX: 0000000000000000 RBX: ffff8802c3f911c0 RCX: 00000001010dee01
Apr 12 12:10:08 lamu [71020.797376] RDX: ffffffffa02e9308 RSI: 0000000000000282 RDI: ffff8802c3f911c0
Apr 12 12:10:08 lamu [71020.811629] RBP: ffff8802269c0000 R08: 0000000000000000 R09: ffff88042fc03ad0
Apr 12 12:10:08 lamu [71020.825878] R10: ffffffff8165aac0 R11: ffffffff8165aac0 R12: 0000000000000000
Apr 12 12:10:08 lamu [71020.840127] R13: ffff880424a40002 R14: ffff8802ca545c00 R15: ffff880424a40000
Apr 12 12:10:08 lamu [71020.854379] FS:  00007f7e7613d900(0000) GS:ffff88042fc00000(0000) knlGS:0000000000000000
Apr 12 12:10:08 lamu [71020.870553] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Apr 12 12:10:08 lamu [71020.882027] CR2: 0000000000000018 CR3: 00000003e0369000 CR4: 00000000000026e0
Apr 12 12:10:08 lamu [71020.896276] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Apr 12 12:10:08 lamu [71020.910527] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Apr 12 12:10:08 lamu [71020.924778] Process kvm (pid: 6997, threadinfo ffff8803d1f1e000, task ffff88042707c040)
Apr 12 12:10:08 lamu [71020.940776] Stack:
Apr 12 12:10:08 lamu [71020.944796]  ffffffff80000000
Apr 12 12:10:08 lamu  ffffffffa02e96db
Apr 12 12:10:08 lamu  ffff8802c3f911c0
Apr 12 12:10:08 lamu  ffff8802269c0000
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.959629]  ffff88022799c000
Apr 12 12:10:08 lamu  ffffffffa02e9a67
Apr 12 12:10:08 lamu  ffff880480000000
Apr 12 12:10:08 lamu  0000000280000000
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.974464]  ffff8802c3f911c0
Apr 12 12:10:08 lamu  ffffffffa02efcd0
Apr 12 12:10:08 lamu  ffffffff81691190
Apr 12 12:10:08 lamu  0000000000000002
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.989299] Call Trace:
Apr 12 12:10:08 lamu [71020.994185]  <IRQ> 
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71020.998394]  [<ffffffffa02e96db>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 12 12:10:08 lamu [71021.012302]  [<ffffffffa02e9a67>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 12 12:10:08 lamu [71021.025863]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:08 lamu [71021.036474]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:08 lamu [71021.048994]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:08 lamu [71021.061510]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:08 lamu [71021.072643]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:08 lamu [71021.085162]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.098894]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:08 lamu [71021.111413]  [<ffffffffa02e485e>] ? NF_HOOK.constprop.8+0x3c/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.125144]  [<ffffffffa02e49f2>] ? br_forward+0x16/0x5a [bridge]
Apr 12 12:10:08 lamu [71021.137318]  [<ffffffffa02e551b>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 12 12:10:08 lamu [71021.151934]  [<ffffffffa02e95ff>] ? br_nf_pre_routing_finish+0x1d0/0x1dd [bridge]
Apr 12 12:10:08 lamu [71021.166896]  [<ffffffffa02e8ff0>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 12 12:10:08 lamu [71021.179764]  [<ffffffffa02e9f58>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 12 12:10:08 lamu [71021.193495]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:08 lamu [71021.204106]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.217837]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:08 lamu [71021.228967]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.242700]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.256433]  [<ffffffffa02e5360>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 12 12:10:08 lamu [71021.270165]  [<ffffffff810135ad>] ? paravirt_read_tsc+0x5/0x8
Apr 12 12:10:08 lamu [71021.281642]  [<ffffffff81013622>] ? read_tsc+0x5/0x14
Apr 12 12:10:08 lamu [71021.291733]  [<ffffffffa02e573c>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 12 12:10:08 lamu [71021.305120]  [<ffffffffa02e5589>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 12 12:10:08 lamu [71021.319736]  [<ffffffff812890cd>] ? __netif_receive_skb+0x324/0x41f
Apr 12 12:10:08 lamu [71021.332251]  [<ffffffff81289234>] ? process_backlog+0x6c/0x123
Apr 12 12:10:08 lamu [71021.343901]  [<ffffffff8128b11a>] ? net_rx_action+0xa1/0x1af
Apr 12 12:10:08 lamu [71021.355206]  [<ffffffff81037013>] ? test_tsk_need_resched+0xa/0x13
Apr 12 12:10:08 lamu [71021.367552]  [<ffffffff8104be98>] ? __do_softirq+0xb9/0x177
Apr 12 12:10:08 lamu [71021.378685]  [<ffffffff8135026c>] ? call_softirq+0x1c/0x30
Apr 12 12:10:08 lamu [71021.389640]  <EOI> 
Apr 12 12:10:08 lamu  
Apr 12 12:10:08 lamu [71021.393845]  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 12 12:10:08 lamu [71021.404454]  [<ffffffff8128b40a>] ? netif_rx_ni+0x1e/0x27
Apr 12 12:10:08 lamu [71021.415239]  [<ffffffffa02f6721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 12 12:10:09 lamu [71021.427583]  [<ffffffffa02f6a66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 12 12:10:09 lamu [71021.439579]  [<ffffffffa02f6ac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 12 12:10:09 lamu [71021.452445]  [<ffffffff810f95d4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 12 12:10:09 lamu [71021.464788]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:09 lamu [71021.475917]  [<ffffffff810f8c56>] ? do_sync_read+0xab/0xe3
Apr 12 12:10:09 lamu [71021.486875]  [<ffffffff81061a94>] ? enqueue_hrtimer+0x43/0x6a
Apr 12 12:10:09 lamu [71021.498350]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:09 lamu [71021.509483]  [<ffffffff81162569>] ? security_file_permission+0x16/0x2d
Apr 12 12:10:09 lamu [71021.522520]  [<ffffffff810f9838>] ? do_readv_writev+0xaf/0x11c
Apr 12 12:10:09 lamu [71021.534173]  [<ffffffff8112abb6>] ? eventfd_ctx_read+0x162/0x174
Apr 12 12:10:09 lamu [71021.546174]  [<ffffffff8103f467>] ? try_to_wake_up+0x197/0x197
Apr 12 12:10:09 lamu [71021.557825]  [<ffffffff810f9a0d>] ? sys_writev+0x45/0x90
Apr 12 12:10:09 lamu [71021.568437]  [<ffffffff8134e012>] ? system_call_fastpath+0x16/0x1b
Apr 12 12:10:09 lamu [71021.580778] Code: 
Apr 12 12:10:09 53  
Apr 12 12:10:09 48  
Apr 12 12:10:09 89  
Apr 12 12:10:09 fb  
Apr 12 12:10:09 48  
Apr 12 12:10:09 83  
Apr 12 12:10:09 ec  
Apr 12 12:10:09 10  
Apr 12 12:10:09 66  
Apr 12 12:10:09 81  
Apr 12 12:10:09 7f  
Apr 12 12:10:09 7e  
Apr 12 12:10:09 08  
Apr 12 12:10:09 06  
Apr 12 12:10:09 4c  
Apr 12 12:10:09 8b  
Apr 12 12:10:09 a7  
Apr 12 12:10:09 98  
Apr 12 12:10:09 00  
Apr 12 12:10:09 00  
Apr 12 12:10:09 00  
Apr 12 12:10:09 74  
Apr 12 12:10:09 3d  
Apr 12 12:10:09 e8  
Apr 12 12:10:09 07  
Apr 12 12:10:09 fe  
Apr 12 12:10:09 ff  
Apr 12 12:10:09 ff  
Apr 12 12:10:09 66  
Apr 12 12:10:09 3d  
Apr 12 12:10:09 08  
Apr 12 12:10:09 06  
Apr 12 12:10:09 75  
Apr 12 12:10:09 09  
Apr 12 12:10:09 83  
Apr 12 12:10:09 3d  
Apr 12 12:10:09 98  
Apr 12 12:10:09 6a  
Apr 12 12:10:09 00  
Apr 12 12:10:09 00  
Apr 12 12:10:09 00  
Apr 12 12:10:09 75  
Apr 12 12:10:09 29  
Apr 12 12:10:09 lamu  
Apr 12 12:10:09 f6  
Apr 12 12:10:09 44  
Apr 12 12:10:09 24  
Apr 12 12:10:09 18  
Apr 12 12:10:09 lamu  
Apr 12 12:10:09 lamu [71021.610392] ------------[ cut here ]------------
Apr 12 12:10:09 lamu [71021.610395] WARNING: at /build/buildd-linux-2.6_3.2.12-1-amd64-FiPNYf/linux-2.6-3.2.12/debian/build/source_amd64_none/kernel/softirq.c:159 _local_bh_enable_ip.isra.11+0x3d/0x88()
Apr 12 12:10:09 lamu [71021.610398] Hardware name: PowerEdge R410
Apr 12 12:10:09 lamu [71021.610399] Modules linked in: 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 option usb_wwan usbserial uas snd_pcm snd_page_alloc snd_timer snd iTCO_wdt iTCO_vendor_support psmouse i7core_edac edac_core processor button soundcore joydev serio_raw pcspkr evdev dcdbas thermal_sys ext3 mbcache jbd dm_mod sr_mod cdrom ses sd_mod usbhid hid crc_t10dif enclosure ata_generic uhci_hcd ata_piix ehci_hcd libata usbcore megaraid_sas scsi_mod usb_common bnx2 [last unloaded: usb_storage]
Apr 12 12:10:09 lamu [71021.610438] Pid: 6997, comm: kvm Not tainted 3.2.0-2-amd64 #1
Apr 12 12:10:09 lamu [71021.610439] Call Trace:
Apr 12 12:10:09 lamu [71021.610440]  <IRQ>  [<ffffffff81046879>] ? warn_slowpath_common+0x78/0x8c
Apr 12 12:10:09 lamu [71021.610447]  [<ffffffff8104bd8a>] ? _local_bh_enable_ip.isra.11+0x3d/0x88
Apr 12 12:10:09 lamu [71021.610454]  [<ffffffffa003d748>] ? bnx2_reg_rd_ind+0x31/0x38 [bnx2]
Apr 12 12:10:09 lamu [71021.610460]  [<ffffffffa00467d7>] ? bnx2_poll+0x1b7/0x1c4 [bnx2]
Apr 12 12:10:09 lamu [71021.610466]  [<ffffffff8129af69>] ? netpoll_poll_dev.part.16+0x9b/0x499
Apr 12 12:10:09 lamu [71021.610475]  [<ffffffffa02e331a>] ? br_dev_xmit+0x12e/0x142 [bridge]
Apr 12 12:10:09 lamu [71021.610478]  [<ffffffff8129b432>] ? netpoll_send_skb_on_dev+0xcb/0x201
Apr 12 12:10:09 lamu [71021.610483]  [<ffffffffa021325c>] ? write_msg+0x98/0xf3 [netconsole]
Apr 12 12:10:09 lamu [71021.610487]  [<ffffffff810469c2>] ? __call_console_drivers+0x72/0x83
Apr 12 12:10:09 lamu [71021.610490]  [<ffffffff8104708e>] ? console_unlock+0x144/0x1e8
Apr 12 12:10:09 lamu [71021.610493]  [<ffffffff810475b1>] ? vprintk+0x396/0x3d9
Apr 12 12:10:09 lamu [71021.610499]  [<ffffffffa02e933b>] ? br_nf_forward_finish+0x33/0x95 [bridge]
Apr 12 12:10:09 lamu [71021.610504]  [<ffffffffa02e930b>] ? br_nf_forward_finish+0x3/0x95 [bridge]
Apr 12 12:10:09 lamu [71021.610510]  [<ffffffff81342a83>] ? printk+0x43/0x48
Apr 12 12:10:09 lamu [71021.610513]  [<ffffffff8100fe6a>] ? show_registers+0x1de/0x20a
Apr 12 12:10:09 lamu [71021.610517]  [<ffffffff81349f1e>] ? __die+0x8b/0xc8
Apr 12 12:10:09 lamu [71021.610520]  [<ffffffff81342253>] ? no_context+0x1d6/0x20e
Apr 12 12:10:09 lamu [71021.610523]  [<ffffffff810522ca>] ? __mod_timer+0x139/0x14b
Apr 12 12:10:09 lamu [71021.610526]  [<ffffffff8134be99>] ? do_page_fault+0x1a8/0x337
Apr 12 12:10:09 lamu [71021.610531]  [<ffffffffa03bef06>] ? ip_vs_conn_put+0x28/0x32 [ip_vs]
Apr 12 12:10:09 lamu [71021.610536]  [<ffffffffa03c10e0>] ? ip_vs_out+0x2bd/0x432 [ip_vs]
Apr 12 12:10:09 lamu [71021.610539]  [<ffffffff8128beef>] ? dev_hard_start_xmit+0x3fc/0x543
Apr 12 12:10:09 lamu [71021.610542]  [<ffffffff813495f5>] ? page_fault+0x25/0x30
Apr 12 12:10:09 lamu [71021.610548]  [<ffffffffa02e9308>] ? nf_bridge_update_protocol+0x20/0x20 [bridge]
Apr 12 12:10:09 lamu [71021.610554]  [<ffffffffa02e9336>] ? br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 12:10:09 lamu [71021.610559]  [<ffffffffa02e9327>] ? br_nf_forward_finish+0x1f/0x95 [bridge]
Apr 12 12:10:09 lamu [71021.610565]  [<ffffffffa02e96db>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 12 12:10:09 lamu [71021.610570]  [<ffffffffa02e9a67>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 12 12:10:09 lamu [71021.610573]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:09 lamu [71021.610578]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:09 lamu [71021.610582]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:09 lamu [71021.610585]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:09 lamu [71021.610590]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:09 lamu [71021.610595]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:09 lamu [71021.610599]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:09 lamu [71021.610604]  [<ffffffffa02e485e>] ? NF_HOOK.constprop.8+0x3c/0x56 [bridge]
Apr 12 12:10:09 lamu [71021.610608]  [<ffffffffa02e49f2>] ? br_forward+0x16/0x5a [bridge]
Apr 12 12:10:09 lamu [71021.610613]  [<ffffffffa02e551b>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 12 12:10:09 lamu [71021.610619]  [<ffffffffa02e95ff>] ? br_nf_pre_routing_finish+0x1d0/0x1dd [bridge]
Apr 12 12:10:09 lamu [71021.610624]  [<ffffffffa02e8ff0>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 12 12:10:09 lamu [71021.610630]  [<ffffffffa02e9f58>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 12 12:10:09 lamu [71021.610633]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:09 lamu [71021.610638]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:09 lamu [71021.610641]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:09 lamu [71021.610646]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:09 lamu [71021.610651]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:09 lamu [71021.610656]  [<ffffffffa02e5360>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 12 12:10:10 lamu [71021.610659]  [<ffffffff810135ad>] ? paravirt_read_tsc+0x5/0x8
Apr 12 12:10:10 lamu [71021.610661]  [<ffffffff81013622>] ? read_tsc+0x5/0x14
Apr 12 12:10:10 lamu [71021.610666]  [<ffffffffa02e573c>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 12 12:10:10 lamu [71021.610671]  [<ffffffffa02e5589>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 12 12:10:10 lamu [71021.610674]  [<ffffffff812890cd>] ? __netif_receive_skb+0x324/0x41f
Apr 12 12:10:10 lamu [71021.610677]  [<ffffffff81289234>] ? process_backlog+0x6c/0x123
Apr 12 12:10:10 lamu [71021.610681]  [<ffffffff8128b11a>] ? net_rx_action+0xa1/0x1af
Apr 12 12:10:10 lamu [71021.610683]  [<ffffffff81037013>] ? test_tsk_need_resched+0xa/0x13
Apr 12 12:10:10 lamu [71021.610686]  [<ffffffff8104be98>] ? __do_softirq+0xb9/0x177
Apr 12 12:10:10 lamu [71021.610689]  [<ffffffff8135026c>] ? call_softirq+0x1c/0x30
Apr 12 12:10:10 lamu [71021.610691]  <EOI>  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 12 12:10:10 lamu [71021.610696]  [<ffffffff8128b40a>] ? netif_rx_ni+0x1e/0x27
Apr 12 12:10:10 lamu [71021.610699]  [<ffffffffa02f6721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 12 12:10:10 lamu [71021.610703]  [<ffffffffa02f6a66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 12 12:10:10 lamu [71021.610707]  [<ffffffffa02f6ac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 12 12:10:10 lamu [71021.610710]  [<ffffffff810f95d4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 12 12:10:10 lamu [71021.610712]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:10 lamu [71021.610715]  [<ffffffff810f8c56>] ? do_sync_read+0xab/0xe3
Apr 12 12:10:10 lamu [71021.610718]  [<ffffffff81061a94>] ? enqueue_hrtimer+0x43/0x6a
Apr 12 12:10:10 lamu [71021.610720]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:10 lamu [71021.610723]  [<ffffffff81162569>] ? security_file_permission+0x16/0x2d
Apr 12 12:10:10 lamu [71021.610726]  [<ffffffff810f9838>] ? do_readv_writev+0xaf/0x11c
Apr 12 12:10:10 lamu [71021.610729]  [<ffffffff8112abb6>] ? eventfd_ctx_read+0x162/0x174
Apr 12 12:10:10 lamu [71021.610732]  [<ffffffff8103f467>] ? try_to_wake_up+0x197/0x197
Apr 12 12:10:10 lamu [71021.610735]  [<ffffffff810f9a0d>] ? sys_writev+0x45/0x90
Apr 12 12:10:10 lamu [71021.610738]  [<ffffffff8134e012>] ? system_call_fastpath+0x16/0x1b
Apr 12 12:10:10 lamu [71021.610740] ---[ end trace 8375ccada030e5cf ]---
Apr 12 12:10:10 lamu [71022.752807] 01 
Apr 12 12:10:10 49  
Apr 12 12:10:10 8b  
Apr 12 12:10:10 6c  
Apr 12 12:10:10 24  
Apr 12 12:10:10 08  
Apr 12 12:10:10 74  
Apr 12 12:10:10 12  
Apr 12 12:10:10 8a  
Apr 12 12:10:10 43  
Apr 12 12:10:10 7d  
Apr 12 12:10:10 83  
Apr 12 12:10:10 e0  
Apr 12 12:10:10 f8  
Apr 12 12:10:10 83  
Apr 12 12:10:10 c8  
Apr 12 12:10:10 lamu  
Apr 12 12:10:10 lamu [71022.764300] RIP 
Apr 12 12:10:10 lamu  [<ffffffffa02e9336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 12:10:10 lamu [71022.778567]  RSP <ffff88042fc03b18>
Apr 12 12:10:10 lamu [71022.785531] CR2: 0000000000000018
Apr 12 12:10:10 lamu [71022.792904] ---[ end trace 8375ccada030e5d0 ]---
Apr 12 12:10:10 lamu [71022.802344] Kernel panic - not syncing: Fatal exception in interrupt
Apr 12 12:10:10 lamu [71022.815396] Pid: 6997, comm: kvm Tainted: G      D W    3.2.0-2-amd64 #1
Apr 12 12:10:10 lamu [71022.829110] Call Trace:
Apr 12 12:10:10 lamu [71022.834258]  <IRQ> 
Apr 12 12:10:10 lamu  [<ffffffff81342930>] ? panic+0x95/0x1a5
Apr 12 12:10:10 lamu [71022.845768]  [<ffffffff81349e86>] ? oops_end+0xa9/0xb6
Apr 12 12:10:10 lamu [71022.856213]  [<ffffffff8134227c>] ? no_context+0x1ff/0x20e
Apr 12 12:10:10 lamu [71022.867373]  [<ffffffff810522ca>] ? __mod_timer+0x139/0x14b
Apr 12 12:10:10 lamu [71022.878693]  [<ffffffff8134be99>] ? do_page_fault+0x1a8/0x337
Apr 12 12:10:10 lamu [71022.890360]  [<ffffffffa03bef06>] ? ip_vs_conn_put+0x28/0x32 [ip_vs]
Apr 12 12:10:10 lamu [71022.903203]  [<ffffffffa03c10e0>] ? ip_vs_out+0x2bd/0x432 [ip_vs]
Apr 12 12:10:10 lamu [71022.915544]  [<ffffffff8128beef>] ? dev_hard_start_xmit+0x3fc/0x543
Apr 12 12:10:10 lamu [71022.928295]  [<ffffffff813495f5>] ? page_fault+0x25/0x30
Apr 12 12:10:10 lamu [71022.939318]  [<ffffffffa02e9308>] ? nf_bridge_update_protocol+0x20/0x20 [bridge]
Apr 12 12:10:10 lamu [71022.954340]  [<ffffffffa02e9336>] ? br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 12:10:10 lamu [71022.968527]  [<ffffffffa02e9327>] ? br_nf_forward_finish+0x1f/0x95 [bridge]
Apr 12 12:10:10 lamu [71022.982717]  [<ffffffffa02e96db>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 12 12:10:10 lamu [71022.996993]  [<ffffffffa02e9a67>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 12 12:10:10 lamu [71023.010841]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:10 lamu [71023.021812]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:10 lamu [71023.034570]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:10 lamu [71023.047401]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:10 lamu [71023.058757]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:10 lamu [71023.071501]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.085667]  [<ffffffffa02e4918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 12:10:10 lamu [71023.098483]  [<ffffffffa02e485e>] ? NF_HOOK.constprop.8+0x3c/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.112500]  [<ffffffffa02e49f2>] ? br_forward+0x16/0x5a [bridge]
Apr 12 12:10:10 lamu [71023.124825]  [<ffffffffa02e551b>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 12 12:10:10 lamu [71023.139763]  [<ffffffffa02e95ff>] ? br_nf_pre_routing_finish+0x1d0/0x1dd [bridge]
Apr 12 12:10:10 lamu [71023.154965]  [<ffffffffa02e8ff0>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 12 12:10:10 lamu [71023.168151]  [<ffffffffa02e9f58>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 12 12:10:10 lamu [71023.182191]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 12:10:10 lamu [71023.193200]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.207169]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 12:10:10 lamu [71023.218614]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.232581]  [<ffffffffa02e537a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.246548]  [<ffffffffa02e5360>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 12 12:10:10 lamu [71023.260552]  [<ffffffff810135ad>] ? paravirt_read_tsc+0x5/0x8
Apr 12 12:10:10 lamu [71023.272274]  [<ffffffff81013622>] ? read_tsc+0x5/0x14
Apr 12 12:10:10 lamu [71023.282710]  [<ffffffffa02e573c>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 12 12:10:10 lamu [71023.296308]  [<ffffffffa02e5589>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 12 12:10:10 lamu [71023.296338] block drbd4: PingAck did not arrive in time.
Apr 12 12:10:10 lamu [71023.296347] block drbd4: peer( Secondary -> Unknown ) conn( Connected -> NetworkFailure ) pdsk( UpToDate -> DUnknown ) 
Apr 12 12:10:10 lamu [71023.343474]  [<ffffffff812890cd>] ? __netif_receive_skb+0x324/0x41f
Apr 12 12:10:10 lamu [71023.356221]  [<ffffffff81289234>] ? process_backlog+0x6c/0x123
Apr 12 12:10:10 lamu [71023.368057]  [<ffffffff8128b11a>] ? net_rx_action+0xa1/0x1af
Apr 12 12:10:10 lamu [71023.379483]  [<ffffffff81037013>] ? test_tsk_need_resched+0xa/0x13
Apr 12 12:10:10 lamu [71023.391998]  [<ffffffff8104be98>] ? __do_softirq+0xb9/0x177
Apr 12 12:10:10 lamu [71023.403332]  [<ffffffff8135026c>] ? call_softirq+0x1c/0x30
Apr 12 12:10:10 lamu [71023.414444]  <EOI> 
Apr 12 12:10:10 lamu  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 12 12:10:11 lamu [71023.426647]  [<ffffffff8128b40a>] ? netif_rx_ni+0x1e/0x27
Apr 12 12:10:11 lamu [71023.437640]  [<ffffffffa02f6721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 12 12:10:11 lamu [71023.450264]  [<ffffffffa02f6a66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 12 12:10:11 lamu [71023.462501]  [<ffffffffa02f6ac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 12 12:10:11 lamu [71023.475526]  [<ffffffff810f95d4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 12 12:10:11 lamu [71023.488074]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:11 lamu [71023.499357]  [<ffffffff810f8c56>] ? do_sync_read+0xab/0xe3
Apr 12 12:10:11 lamu [71023.510429]  [<ffffffff81061a94>] ? enqueue_hrtimer+0x43/0x6a
Apr 12 12:10:11 lamu [71023.522066]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 12:10:11 lamu [71023.533310]  [<ffffffff81162569>] ? security_file_permission+0x16/0x2d
Apr 12 12:10:11 lamu [71023.546463]  [<ffffffff810f9838>] ? do_readv_writev+0xaf/0x11c
Apr 12 12:10:11 lamu [71023.558352]  [<ffffffff8112abb6>] ? eventfd_ctx_read+0x162/0x174
Apr 12 12:10:11 lamu [71023.570467]  [<ffffffff8103f467>] ? try_to_wake_up+0x197/0x197
Apr 12 12:10:11 lamu [71023.582316]  [<ffffffff810f9a0d>] ? sys_writev+0x45/0x90
Apr 12 12:10:11 lamu [71023.593177]  [<ffffffff8134e012>] ? system_call_fastpath+0x16/0x1b

[-- Attachment #3: BUG2.txt --]
[-- Type: text/plain, Size: 17365 bytes --]

Apr 12 13:22:05 lamu [ 4116.902924] BUG: unable to handle kernel 
Apr 12 13:22:05 NULL pointer dereference
Apr 12 13:22:05 lamu  at 0000000000000018
Apr 12 13:22:05 lamu [ 4116.918581] IP:
Apr 12 13:22:05 lamu  [<ffffffffa02d2336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 13:22:05 lamu [ 4116.932666] PGD 0 
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4116.936681] Oops: 0000 [#1] 
Apr 12 13:22:05 SMP  
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4116.943136] CPU 0 
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4116.946792] Modules linked in:
Apr 12 13:22:05 lamu  option
Apr 12 13:22:05 lamu  usb_wwan
Apr 12 13:22:05 lamu  usbserial
Apr 12 13:22:05 lamu  usb_storage
Apr 12 13:22:05 lamu  uas
Apr 12 13:22:05 lamu  ipt_MASQUERADE
Apr 12 13:22:05 lamu  iptable_nat
Apr 12 13:22:05 lamu  nf_nat
Apr 12 13:22:05 lamu  nf_conntrack_ipv4
Apr 12 13:22:05 lamu  nf_defrag_ipv4
Apr 12 13:22:05 lamu  ip_vs_rr
Apr 12 13:22:05 lamu  ip_vs
Apr 12 13:22:05 lamu  nf_conntrack
Apr 12 13:22:05 lamu  libcrc32c
Apr 12 13:22:05 lamu  ip6table_filter
Apr 12 13:22:05 lamu  ip6_tables
Apr 12 13:22:05 lamu  iptable_filter
Apr 12 13:22:05 lamu  ip_tables
Apr 12 13:22:05 lamu  ebtable_nat
Apr 12 13:22:05 lamu  ebtables
Apr 12 13:22:05 lamu  x_tables
Apr 12 13:22:05 lamu  crc32c
Apr 12 13:22:05 lamu  drbd
Apr 12 13:22:05 lamu  lru_cache
Apr 12 13:22:05 lamu  cn
Apr 12 13:22:05 lamu  sit
Apr 12 13:22:05 lamu  tunnel4
Apr 12 13:22:05 lamu  tun
Apr 12 13:22:05 lamu  bridge
Apr 12 13:22:05 lamu  stp
Apr 12 13:22:05 lamu  virtio_net
Apr 12 13:22:05 lamu  virtio_blk
Apr 12 13:22:05 lamu  virtio_rng
Apr 12 13:22:05 lamu  rng_core
Apr 12 13:22:05 lamu  virtio_pci
Apr 12 13:22:05 lamu  virtio_ring
Apr 12 13:22:05 lamu  virtio
Apr 12 13:22:05 lamu  kvm_intel
Apr 12 13:22:05 lamu  kvm
Apr 12 13:22:05 lamu  ipmi_devintf
Apr 12 13:22:05 lamu  ipmi_poweroff
Apr 12 13:22:05 lamu  ipmi_si
Apr 12 13:22:05 lamu  ipmi_watchdog
Apr 12 13:22:05 lamu  ipmi_msghandler
Apr 12 13:22:05 lamu  netconsole
Apr 12 13:22:05 lamu  configfs
Apr 12 13:22:05 lamu  loop
Apr 12 13:22:05 lamu  snd_pcm
Apr 12 13:22:05 lamu  snd_page_alloc
Apr 12 13:22:05 lamu  iTCO_wdt
Apr 12 13:22:05 lamu  snd_timer
Apr 12 13:22:05 lamu  snd
Apr 12 13:22:05 lamu  processor
Apr 12 13:22:05 lamu  button
Apr 12 13:22:05 lamu  iTCO_vendor_support
Apr 12 13:22:05 lamu  joydev
Apr 12 13:22:05 lamu  i7core_edac
Apr 12 13:22:05 lamu  edac_core
Apr 12 13:22:05 lamu  soundcore
Apr 12 13:22:05 lamu  pcspkr
Apr 12 13:22:05 lamu  psmouse
Apr 12 13:22:05 lamu  serio_raw
Apr 12 13:22:05 lamu  evdev
Apr 12 13:22:05 lamu  thermal_sys
Apr 12 13:22:05 lamu  dcdbas
Apr 12 13:22:05 lamu  ext3
Apr 12 13:22:05 lamu  mbcache
Apr 12 13:22:05 lamu  jbd
Apr 12 13:22:05 lamu  dm_mod
Apr 12 13:22:05 lamu  sr_mod
Apr 12 13:22:05 lamu  cdrom
Apr 12 13:22:05 lamu  sd_mod
Apr 12 13:22:05 lamu  ses
Apr 12 13:22:05 lamu  usbhid
Apr 12 13:22:05 lamu  hid
Apr 12 13:22:05 lamu  enclosure
Apr 12 13:22:05 lamu  crc_t10dif
Apr 12 13:22:05 lamu  ata_generic
Apr 12 13:22:05 lamu  ata_piix
Apr 12 13:22:05 lamu  uhci_hcd
Apr 12 13:22:05 lamu  libata
Apr 12 13:22:05 lamu  ehci_hcd
Apr 12 13:22:05 lamu  megaraid_sas
Apr 12 13:22:05 lamu  usbcore
Apr 12 13:22:05 lamu  scsi_mod
Apr 12 13:22:05 lamu  usb_common
Apr 12 13:22:05 lamu  bnx2
Apr 12 13:22:05 lamu  [last unloaded: scsi_wait_scan]
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.098774] 
Apr 12 13:22:05 lamu [ 4117.101737] Pid: 5417, comm: kvm Not tainted 3.2.0-2-amd64 #1
Apr 12 13:22:05 lamu  Dell Inc. PowerEdge R410
Apr 12 13:22:05 lamu /0N051F 
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.118781] RIP: 0010:[<ffffffffa02d2336>] 
Apr 12 13:22:05 lamu  [<ffffffffa02d2336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 13:22:05 lamu [ 4117.137734] RSP: 0018:ffff88042fc03b18  EFLAGS: 00010293
Apr 12 13:22:05 lamu [ 4117.148342] RAX: 0000000000000000 RBX: ffff88041a59cc80 RCX: 0000000000000006
Apr 12 13:22:05 lamu [ 4117.162591] RDX: ffffffffa02d2308 RSI: 00000001000ecc40 RDI: ffff88041a59cc80
Apr 12 13:22:05 lamu [ 4117.176840] RBP: ffff880424574000 R08: 0000000000000000 R09: ffff88042fc03ad0
Apr 12 13:22:05 lamu [ 4117.191088] R10: ffffffff8165aac0 R11: ffffffff8165aac0 R12: 0000000000000000
Apr 12 13:22:05 lamu [ 4117.205338] R13: ffff880225b90002 R14: ffff88042543c8c0 R15: ffff880225b90000
Apr 12 13:22:05 lamu [ 4117.219589] FS:  00007f673f979900(0000) GS:ffff88042fc00000(0000) knlGS:0000000000000000
Apr 12 13:22:05 lamu [ 4117.235765] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
Apr 12 13:22:05 lamu [ 4117.247239] CR2: 0000000000000018 CR3: 00000001be517000 CR4: 00000000000026e0
Apr 12 13:22:05 lamu [ 4117.261488] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Apr 12 13:22:05 lamu [ 4117.275738] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Apr 12 13:22:05 lamu [ 4117.289988] Process kvm (pid: 5417, threadinfo ffff8801be51e000, task ffff880226aea240)
Apr 12 13:22:05 lamu [ 4117.305985] Stack:
Apr 12 13:22:05 lamu [ 4117.310002]  ffffffff80000000
Apr 12 13:22:05 lamu  ffffffffa02d26db
Apr 12 13:22:05 lamu  ffff88041a59cc80
Apr 12 13:22:05 lamu  ffff880424574000
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.324838]  ffff880424411000
Apr 12 13:22:05 lamu  ffffffffa02d2a67
Apr 12 13:22:05 lamu  ffff880480000000
Apr 12 13:22:05 lamu  0000000200000000
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.339670]  ffff88041a59cc80
Apr 12 13:22:05 lamu  ffffffffa02d8cd0
Apr 12 13:22:05 lamu  ffffffff81691190
Apr 12 13:22:05 lamu  0000000000000002
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.354501] Call Trace:
Apr 12 13:22:05 lamu [ 4117.359386]  <IRQ> 
Apr 12 13:22:05 lamu  
Apr 12 13:22:05 lamu [ 4117.363594]  [<ffffffffa02d26db>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 12 13:22:05 lamu [ 4117.377501]  [<ffffffffa02d2a67>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 12 13:22:05 lamu [ 4117.391063]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 13:22:05 lamu [ 4117.401673]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:05 lamu [ 4117.414191]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:05 lamu [ 4117.426708]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 13:22:05 lamu [ 4117.437839]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:05 lamu [ 4117.450358]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.464092]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:05 lamu [ 4117.476612]  [<ffffffffa02cd85e>] ? NF_HOOK.constprop.8+0x3c/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.490345]  [<ffffffffa02cd9f2>] ? br_forward+0x16/0x5a [bridge]
Apr 12 13:22:05 lamu [ 4117.502517]  [<ffffffffa02ce51b>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 12 13:22:05 lamu [ 4117.517132]  [<ffffffffa02d25ff>] ? br_nf_pre_routing_finish+0x1d0/0x1dd [bridge]
Apr 12 13:22:05 lamu [ 4117.532096]  [<ffffffffa02d1ff0>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 12 13:22:05 lamu [ 4117.544963]  [<ffffffffa02d2f58>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 12 13:22:05 lamu [ 4117.558695]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 13:22:05 lamu [ 4117.569309]  [<ffffffff8128affc>] ? napi_gro_receive+0x1d/0x2b
Apr 12 13:22:05 lamu [ 4117.580957]  [<ffffffff8128aba6>] ? napi_skb_finish+0x1c/0x31
Apr 12 13:22:05 lamu [ 4117.592436]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.606167]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 13:22:05 lamu [ 4117.617298]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.631033]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.644766]  [<ffffffffa02ce360>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 12 13:22:05 lamu [ 4117.658498]  [<ffffffff8128b06a>] ? napi_complete+0x28/0x37
Apr 12 13:22:05 lamu [ 4117.669629]  [<ffffffffa02ce73c>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 12 13:22:05 lamu [ 4117.683016]  [<ffffffffa02ce589>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 12 13:22:05 lamu [ 4117.697630]  [<ffffffff812890cd>] ? __netif_receive_skb+0x324/0x41f
Apr 12 13:22:05 lamu [ 4117.710146]  [<ffffffff81289234>] ? process_backlog+0x6c/0x123
Apr 12 13:22:06 lamu [ 4117.721797]  [<ffffffff8128b11a>] ? net_rx_action+0xa1/0x1af
Apr 12 13:22:06 lamu [ 4117.733102]  [<ffffffff81037013>] ? test_tsk_need_resched+0xa/0x13
Apr 12 13:22:06 lamu [ 4117.745446]  [<ffffffff8104be98>] ? __do_softirq+0xb9/0x177
Apr 12 13:22:06 lamu [ 4117.756579]  [<ffffffff8135026c>] ? call_softirq+0x1c/0x30
Apr 12 13:22:06 lamu [ 4117.767535]  <EOI> 
Apr 12 13:22:06 lamu  
Apr 12 13:22:06 lamu [ 4117.771741]  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 12 13:22:06 lamu [ 4117.782350]  [<ffffffff8128b40a>] ? netif_rx_ni+0x1e/0x27
Apr 12 13:22:06 lamu [ 4117.793134]  [<ffffffffa025b721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 12 13:22:06 lamu [ 4117.805477]  [<ffffffffa025ba66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 12 13:22:06 lamu [ 4117.817475]  [<ffffffffa025bac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 12 13:22:06 lamu [ 4117.830342]  [<ffffffff810f95d4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 12 13:22:06 lamu [ 4117.842686]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 13:22:06 lamu [ 4117.853817]  [<ffffffff810f8c56>] ? do_sync_read+0xab/0xe3
Apr 12 13:22:06 lamu [ 4117.864772]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 13:22:06 lamu [ 4117.875906]  [<ffffffff81162569>] ? security_file_permission+0x16/0x2d
Apr 12 13:22:06 lamu [ 4117.888942]  [<ffffffff810f9838>] ? do_readv_writev+0xaf/0x11c
Apr 12 13:22:06 lamu [ 4117.900596]  [<ffffffff8112abb6>] ? eventfd_ctx_read+0x162/0x174
Apr 12 13:22:06 lamu [ 4117.912597]  [<ffffffff8103f467>] ? try_to_wake_up+0x197/0x197
Apr 12 13:22:06 lamu [ 4117.924248]  [<ffffffff810f9a0d>] ? sys_writev+0x45/0x90
Apr 12 13:22:06 lamu [ 4117.934859]  [<ffffffff8134e012>] ? system_call_fastpath+0x16/0x1b
Apr 12 13:22:06 lamu [ 4117.947201] Code: 
Apr 12 13:22:06 53  
Apr 12 13:22:06 48  
Apr 12 13:22:06 89  
Apr 12 13:22:06 fb  
Apr 12 13:22:06 48  
Apr 12 13:22:06 83  
Apr 12 13:22:06 ec  
Apr 12 13:22:06 10  
Apr 12 13:22:06 66  
Apr 12 13:22:06 81  
Apr 12 13:22:06 7f  
Apr 12 13:22:06 7e  
Apr 12 13:22:06 08  
Apr 12 13:22:06 06  
Apr 12 13:22:06 4c  
Apr 12 13:22:06 8b  
Apr 12 13:22:06 a7  
Apr 12 13:22:06 98  
Apr 12 13:22:06 00  
Apr 12 13:22:06 00  
Apr 12 13:22:06 00  
Apr 12 13:22:06 74  
Apr 12 13:22:06 3d  
Apr 12 13:22:06 e8  
Apr 12 13:22:06 07  
Apr 12 13:22:06 fe  
Apr 12 13:22:06 ff  
Apr 12 13:22:06 ff  
Apr 12 13:22:06 66  
Apr 12 13:22:06 3d  
Apr 12 13:22:06 08  
Apr 12 13:22:06 06  
Apr 12 13:22:06 75  
Apr 12 13:22:06 09  
Apr 12 13:22:06 83  
Apr 12 13:22:06 3d  
Apr 12 13:22:06 98  
Apr 12 13:22:06 6a  
Apr 12 13:22:06 00  
Apr 12 13:22:06 00  
Apr 12 13:22:06 00  
Apr 12 13:22:06 75  
Apr 12 13:22:06 29  
Apr 12 13:22:06 lamu  
Apr 12 13:22:06 f6  
Apr 12 13:22:06 44  
Apr 12 13:22:06 24  
Apr 12 13:22:06 18  
Apr 12 13:22:06 01  
Apr 12 13:22:06 49  
Apr 12 13:22:06 8b  
Apr 12 13:22:06 6c  
Apr 12 13:22:06 24  
Apr 12 13:22:06 08  
Apr 12 13:22:06 74  
Apr 12 13:22:06 12  
Apr 12 13:22:06 8a  
Apr 12 13:22:06 43  
Apr 12 13:22:06 7d  
Apr 12 13:22:06 83  
Apr 12 13:22:06 e0  
Apr 12 13:22:06 f8  
Apr 12 13:22:06 83  
Apr 12 13:22:06 c8  
Apr 12 13:22:06 lamu  
Apr 12 13:22:06 lamu [ 4117.985837] RIP 
Apr 12 13:22:06 lamu  [<ffffffffa02d2336>] br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 13:22:06 lamu [ 4118.000102]  RSP <ffff88042fc03b18>
Apr 12 13:22:06 lamu [ 4118.007067] CR2: 0000000000000018
Apr 12 13:22:06 lamu [ 4118.014273] ---[ end trace c19a5656967502d9 ]---
Apr 12 13:22:06 lamu [ 4118.023651] Kernel panic - not syncing: Fatal exception in interrupt
Apr 12 13:22:06 lamu [ 4118.036551] Pid: 5417, comm: kvm Tainted: G      D      3.2.0-2-amd64 #1
Apr 12 13:22:06 lamu [ 4118.050125] Call Trace:
Apr 12 13:22:06 lamu [ 4118.055141]  <IRQ> 
Apr 12 13:22:06 lamu  [<ffffffff81342930>] ? panic+0x95/0x1a5
Apr 12 13:22:06 lamu [ 4118.066812]  [<ffffffff81349e86>] ? oops_end+0xa9/0xb6
Apr 12 13:22:06 lamu [ 4118.077374]  [<ffffffff8134227c>] ? no_context+0x1ff/0x20e
Apr 12 13:22:06 lamu [ 4118.088585]  [<ffffffff810e9cd8>] ? virt_to_slab+0x6/0x16
Apr 12 13:22:06 lamu [ 4118.099505]  [<ffffffff8134be99>] ? do_page_fault+0x1a8/0x337
Apr 12 13:22:06 lamu [ 4118.111234]  [<ffffffffa03b4f06>] ? ip_vs_conn_put+0x28/0x32 [ip_vs]
Apr 12 13:22:06 lamu [ 4118.124097]  [<ffffffffa03b70e0>] ? ip_vs_out+0x2bd/0x432 [ip_vs]
Apr 12 13:22:06 lamu [ 4118.136534]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 13:22:06 lamu [ 4118.147846]  [<ffffffff813495f5>] ? page_fault+0x25/0x30
Apr 12 13:22:06 lamu [ 4118.158871]  [<ffffffffa02d2308>] ? nf_bridge_update_protocol+0x20/0x20 [bridge]
Apr 12 13:22:06 lamu [ 4118.173852]  [<ffffffffa02d2336>] ? br_nf_forward_finish+0x2e/0x95 [bridge]
Apr 12 13:22:06 lamu [ 4118.187919]  [<ffffffffa02d2327>] ? br_nf_forward_finish+0x1f/0x95 [bridge]
Apr 12 13:22:06 lamu [ 4118.202024]  [<ffffffffa02d26db>] ? br_parse_ip_options+0x3d/0x19a [bridge]
Apr 12 13:22:06 lamu [ 4118.216187]  [<ffffffffa02d2a67>] ? br_nf_forward_ip+0x1c0/0x1d4 [bridge]
Apr 12 13:22:06 lamu [ 4118.230137]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 13:22:06 lamu [ 4118.241005]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:06 lamu [ 4118.253701]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:06 lamu [ 4118.266471]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 13:22:06 lamu [ 4118.277931]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:06 lamu [ 4118.290618]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.304695]  [<ffffffffa02cd918>] ? __br_deliver+0xa0/0xa0 [bridge]
Apr 12 13:22:06 lamu [ 4118.317523]  [<ffffffffa02cd85e>] ? NF_HOOK.constprop.8+0x3c/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.331508]  [<ffffffffa02cd9f2>] ? br_forward+0x16/0x5a [bridge]
Apr 12 13:22:06 lamu [ 4118.343911]  [<ffffffffa02ce51b>] ? br_handle_frame_finish+0x1a1/0x20f [bridge]
Apr 12 13:22:06 lamu [ 4118.358880]  [<ffffffffa02d25ff>] ? br_nf_pre_routing_finish+0x1d0/0x1dd [bridge]
Apr 12 13:22:06 lamu [ 4118.374318]  [<ffffffffa02d1ff0>] ? NF_HOOK_THRESH+0x3b/0x55 [bridge]
Apr 12 13:22:06 lamu [ 4118.387534]  [<ffffffffa02d2f58>] ? br_nf_pre_routing+0x3e8/0x3f5 [bridge]
Apr 12 13:22:06 lamu [ 4118.401597]  [<ffffffff812abe4d>] ? nf_iterate+0x41/0x77
Apr 12 13:22:06 lamu [ 4118.412543]  [<ffffffff8128affc>] ? napi_gro_receive+0x1d/0x2b
Apr 12 13:22:06 lamu [ 4118.424529]  [<ffffffff8128aba6>] ? napi_skb_finish+0x1c/0x31
Apr 12 13:22:06 lamu [ 4118.436261]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.450326]  [<ffffffff812abeeb>] ? nf_hook_slow+0x68/0x101
Apr 12 13:22:06 lamu [ 4118.461719]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.475801]  [<ffffffffa02ce37a>] ? NF_HOOK.constprop.4+0x56/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.489866]  [<ffffffffa02ce360>] ? NF_HOOK.constprop.4+0x3c/0x56 [bridge]
Apr 12 13:22:06 lamu [ 4118.503947]  [<ffffffff8128b06a>] ? napi_complete+0x28/0x37
Apr 12 13:22:06 lamu [ 4118.515485]  [<ffffffffa02ce73c>] ? br_handle_frame+0x1b3/0x1cb [bridge]
Apr 12 13:22:06 lamu [ 4118.529269]  [<ffffffffa02ce589>] ? br_handle_frame_finish+0x20f/0x20f [bridge]
Apr 12 13:22:06 lamu [ 4118.544220]  [<ffffffff812890cd>] ? __netif_receive_skb+0x324/0x41f
Apr 12 13:22:06 lamu [ 4118.557192]  [<ffffffff81289234>] ? process_backlog+0x6c/0x123
Apr 12 13:22:06 lamu [ 4118.569098]  [<ffffffff8128b11a>] ? net_rx_action+0xa1/0x1af
Apr 12 13:22:06 lamu [ 4118.580632]  [<ffffffff81037013>] ? test_tsk_need_resched+0xa/0x13
Apr 12 13:22:06 lamu [ 4118.593292]  [<ffffffff8104be98>] ? __do_softirq+0xb9/0x177
Apr 12 13:22:06 lamu [ 4118.604759]  [<ffffffff8135026c>] ? call_softirq+0x1c/0x30
Apr 12 13:22:06 lamu [ 4118.616040]  <EOI> 
Apr 12 13:22:06 lamu  [<ffffffff8100f8e5>] ? do_softirq+0x3c/0x7b
Apr 12 13:22:06 lamu [ 4118.628382]  [<ffffffff8128b40a>] ? netif_rx_ni+0x1e/0x27
Apr 12 13:22:06 lamu [ 4118.639571]  [<ffffffffa025b721>] ? tun_get_user+0x39a/0x3c2 [tun]
Apr 12 13:22:06 lamu [ 4118.652220]  [<ffffffffa025ba66>] ? tun_chr_poll+0xcd/0xcd [tun]
Apr 12 13:22:06 lamu [ 4118.664445]  [<ffffffffa025bac4>] ? tun_chr_aio_write+0x5e/0x79 [tun]
Apr 12 13:22:06 lamu [ 4118.677553]  [<ffffffff810f95d4>] ? do_sync_readv_writev+0x9a/0xd7
Apr 12 13:22:06 lamu [ 4118.690220]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 13:22:06 lamu [ 4118.701591]  [<ffffffff810f8c56>] ? do_sync_read+0xab/0xe3
Apr 12 13:22:06 lamu [ 4118.712765]  [<ffffffff8103642f>] ? should_resched+0x5/0x23
Apr 12 13:22:07 lamu [ 4118.724209]  [<ffffffff81162569>] ? security_file_permission+0x16/0x2d
Apr 12 13:22:07 lamu [ 4118.737632]  [<ffffffff810f9838>] ? do_readv_writev+0xaf/0x11c
Apr 12 13:22:07 lamu [ 4118.749500]  [<ffffffff8112abb6>] ? eventfd_ctx_read+0x162/0x174
Apr 12 13:22:07 lamu [ 4118.761817]  [<ffffffff8103f467>] ? try_to_wake_up+0x197/0x197
Apr 12 13:22:07 lamu [ 4118.773669]  [<ffffffff810f9a0d>] ? sys_writev+0x45/0x90
Apr 12 13:22:07 lamu [ 4118.784671]  [<ffffffff8134e012>] ? system_call_fastpath+0x16/0x1b

^ permalink raw reply

* [PATCH] drivers/net/ethernet/xilinx/axi ethernet: Correct Copyright
From: Michal Simek @ 2012-04-12 11:11 UTC (permalink / raw)
  To: davem; +Cc: netdev, John.Linn, danborkmann, anirudh, Michal Simek

Also fix MAINTAINERS file to reflect autorship.

Daniel and Ariane changed coding style but not any functional changes in the driver
itself.

Signed-off-by: Michal Simek <monstr@monstr.eu>
---
 MAINTAINERS                                       |    4 ++--
 drivers/net/ethernet/xilinx/xilinx_axienet.h      |    4 +---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c |    6 +++---
 drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c |    6 +++---
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a127097..5d15fa6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7573,8 +7573,8 @@ F:	Documentation/filesystems/xfs.txt
 F:	fs/xfs/
 
 XILINX AXI ETHERNET DRIVER
-M:	Ariane Keller <ariane.keller@tik.ee.ethz.ch>
-M:	Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
+M:	Anirudha Sarangi <anirudh@xilinx.com>
+M:	John Linn <John.Linn@xilinx.com>
 S:	Maintained
 F:	drivers/net/ethernet/xilinx/xilinx_axienet*
 
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h
index cc83af0..44b8d2b 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet.h
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h
@@ -2,9 +2,7 @@
  * Definitions for Xilinx Axi Ethernet device driver.
  *
  * Copyright (c) 2009 Secret Lab Technologies, Ltd.
- * Copyright (c) 2010 Xilinx, Inc. All rights reserved.
- * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch>
- * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch>
+ * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
  */
 
 #ifndef XILINX_AXIENET_H
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 2fcbeba..9c365e1 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -4,9 +4,9 @@
  * Copyright (c) 2008 Nissin Systems Co., Ltd.,  Yoshio Kashiwagi
  * Copyright (c) 2005-2008 DLA Systems,  David H. Lynch Jr. <dhlii@dlasys.net>
  * Copyright (c) 2008-2009 Secret Lab Technologies Ltd.
- * Copyright (c) 2010 Xilinx, Inc. All rights reserved.
- * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch>
- * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch>
+ * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu>
+ * Copyright (c) 2010 - 2011 PetaLogix
+ * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
  *
  * This is a driver for the Xilinx Axi Ethernet which is used in the Virtex6
  * and Spartan6.
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
index d70b6e7..e90e1f4 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c
@@ -2,9 +2,9 @@
  * MDIO bus driver for the Xilinx Axi Ethernet device
  *
  * Copyright (c) 2009 Secret Lab Technologies, Ltd.
- * Copyright (c) 2010 Xilinx, Inc. All rights reserved.
- * Copyright (c) 2012 Daniel Borkmann, <daniel.borkmann@tik.ee.ethz.ch>
- * Copyright (c) 2012 Ariane Keller, <ariane.keller@tik.ee.ethz.ch>
+ * Copyright (c) 2010 - 2011 Michal Simek <monstr@monstr.eu>
+ * Copyright (c) 2010 - 2011 PetaLogix
+ * Copyright (c) 2010 - 2012 Xilinx, Inc. All rights reserved.
  */
 
 #include <linux/of_address.h>
-- 
1.7.10.rc3.1.gb306

^ permalink raw reply related

* Re: [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets
From: Eric Dumazet @ 2012-04-12  9:20 UTC (permalink / raw)
  To: Will Deacon; +Cc: netdev, Steve Glendinning
In-Reply-To: <1334221644-16056-1-git-send-email-will.deacon@arm.com>

On Thu, 2012-04-12 at 10:07 +0100, Will Deacon wrote:
> The SMSC911x ethernet controller provides a mechanism for quickly
> skipping to the start of the next frame in the receive FIFO, however
> the current code passes the number of words to a function that expects
> the number of bytes. This can corrupt the FIFO head in the case that
> the fastforward mechanism is not used.
> 
> This patch fixes the callers of smsc911x_rx_fastforward to pass the
> correct data size.
> 
> Cc: Steve Glendinning <steve.glendinning@smsc.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  drivers/net/ethernet/smsc/smsc911x.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index 4a69710..b5599bc 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -1228,7 +1228,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
>  				  "Discarding packet with error bit set");
>  			/* Packet has an error, discard it and continue with
>  			 * the next */
> -			smsc911x_rx_fastforward(pdata, pktwords);
> +			smsc911x_rx_fastforward(pdata, pktlength);
>  			dev->stats.rx_dropped++;
>  			continue;
>  		}
> @@ -1238,7 +1238,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
>  			SMSC_WARN(pdata, rx_err,
>  				  "Unable to allocate skb for rx packet");
>  			/* Drop the packet and stop this polling iteration */
> -			smsc911x_rx_fastforward(pdata, pktwords);
> +			smsc911x_rx_fastforward(pdata, pktlength);
>  			dev->stats.rx_dropped++;
>  			break;
>  		}

Hum, looking at this driver, I see wrong code in lines 1246/1247

skb->data = skb->head;
skb_reset_tail_pointer(skb);

I suspect its hiding a buffer overflow bug or something.

netdev_alloc_skb() reserved NET_SKB_PAD bytes. A driver should not
un-reserve this headroom, or some networking setups can be very slow.

So 

pdata->ops->rx_readfifo(pdata,
	(unsigned int *)skb->head, pktwords);

also should be fixed to use skb->data instead.

^ permalink raw reply

* Re: [RFC PATCH 2/2] net: ethtool: Add capability to retrieve plug-in module EEPROM
From: Stuart Hodgson @ 2012-04-12  9:20 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev, davem, linux-kernel
In-Reply-To: <1334169119.2552.17.camel@bwh-desktop.uk.solarflarecom.com>

On 11/04/12 19:31, Ben Hutchings wrote:
> On Wed, 2012-04-11 at 18:41 +0100, Stuart Hodgson wrote:
>> On 02/04/12 19:18, Ben Hutchings wrote:
>>> On Tue, 2012-03-27 at 18:51 +0100, Stuart Hodgson wrote:
> [...]
>>>> --- a/drivers/net/ethernet/sfc/ethtool.c
>>>> +++ b/drivers/net/ethernet/sfc/ethtool.c
> [...]
>>>> +        payload_len = MCDI_DWORD(outbuf,
>>>> +                     GET_PHY_MEDIA_INFO_OUT_DATALEN);
>>>> +
>>>> +        to_copy = (space_remaining<   payload_len) ?
>>>> +                space_remaining : payload_len;
>>>> +
>>>> +        to_copy -= page_off;
>>>
>>> page_off is the number of bytes we need to discard from payload_len, but
>>> we don't want do discard that from space_remaining.  I think the last
>>> two statements should be changed to:
>>>
>>> 	payload_len -= page_off;
>>> 	to_copy = (space_remaining<   payload_len) ?
>>> 		space_remaining : payload_len;
>>>
>>
>> I am pretty sure that these two pieces of code are the same
>
> Suppose we start with ee->offset = 64, ee->len = 32.  After the MCDI
> request returns and we assign payload_len from that, I believe we will
> have page_off = 64, payload_len = 128, space_remaining = 32.
>
> Work through the calculations from there and you'll see the problem.
>
> [...]

Yep, I go negative if len is shorter than offset.

>>>> +    phy_cfg = efx->phy_data;
>>>> +    modinfo->eeprom_len = mcdi_to_module_eeprom_len(phy_cfg->media);
>>>> +    modinfo->type = SFF_8079;
>>> [...]
>>>
>>> I don't think this makes sense.  If we're fixing the type as SFF_8079
>>> then why are we calling a function to get the length?
>>>
>>> Ben.
>>>
>>
>> What about adding an mcdi_to_module_eeprom_type in the same manner
>> as mcdi_to_module_eeprom_len and the other mapping functions?
>
> Could do, but I don't see the point of breaking this out into separate
> functions that are only used once.  It's actually going to increase code
> duplication because you'll have to put the same PHY type checks in both
> of them.
>
> Ben.
>

I simply followed the precedent of mcdi_to_ethtool_media. I could 
combine these functions into the module_info function such as
	

	...
         struct efx_mcdi_phy_data *phy_cfg;

         phy_cfg = efx->phy_data;
         modinfo->eeprom_len = 0;
         modinfo->type = 0;

         switch (phy_cfg->media) {
         case MC_CMD_MEDIA_SFP_PLUS:
                 modinfo->type = ETH_MODULE_SFF_8079;
                 modinfo->eeprom_len = ETH_MODULE_SFF_8079_LEN;
                 break;
         default:
                 break;
         }
	...

Stu

^ permalink raw reply

* Re: [RFC PATCH 1/2] net: ethtool: Add capability to retrieve plug-in module EEPROM
From: Stuart Hodgson @ 2012-04-12  9:18 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: netdev, bruce.w.allan, mirq-linux, decot, amit.salecha,
	alexander.h.duyck, davem, linux-kernel
In-Reply-To: <1334187728.2552.7.camel@bwh-desktop.uk.solarflarecom.com>

On 12/04/12 00:42, Ben Hutchings wrote:
> On Wed, 2012-04-11 at 19:16 +0100, Ben Hutchings wrote:
>> On Wed, 2012-04-11 at 17:50 +0100, Stuart Hodgson wrote:
>>> On 02/04/12 18:52, Ben Hutchings wrote:
>> [...]
>>>>> --- a/net/core/ethtool.c
>>>>> +++ b/net/core/ethtool.c
>> [...]
>>>>> +    if (eeprom.offset + eeprom.len>   modinfo.eeprom_len)
>>>>> +        return -EINVAL;
>>>>> +
>>>>> +    data = kmalloc(PAGE_SIZE, GFP_USER);
>>>>> +    if (!data)
>>>>> +        return -ENOMEM;
>>>>
>>>> What if some device has a larger EEPROM?  Surely this length should be
>>>> eeprom.len.
>>>>
>>>
>>> Do you mean what if the eeprom length in te device is larger than
>>> PAGE_SIZE?
>>
>> Yes.
>>
>>> If so then it should really use modinfo.eeprom_len since
>>> this the size of the data. eeprom.len could be arbitary.
>>
>> No, eeprom.len is the size of the data and we've already validated it at
>> this point.
>
> Maybe we should start by refactoring ethtool_get_eeprom() so we can
> reuse most of its code in ethtool_get_module_eeprom(), rather than
> having to worry about what the maximum size of a module EEPROM might be
> and whether we need a loop:
>
> Subject: ethtool: Split ethtool_get_eeprom() to allow for additional EEPROM accessors
>
> We want to support reading module (SFP+, XFP, ...) EEPROMs as well as
> NIC EEPROMs.  They will need a different command number and driver
> operation, but the structure and arguments will be the same and so we
> can share most of the code here.
>
> Signed-off-by: Ben Hutchings<bhutchings@solarflare.com>
> ---
>   net/core/ethtool.c |   24 +++++++++++++++++-------
>   1 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/net/core/ethtool.c b/net/core/ethtool.c
> index beacdd9..ca7698f 100644
> --- a/net/core/ethtool.c
> +++ b/net/core/ethtool.c
> @@ -751,18 +751,17 @@ static int ethtool_get_link(struct net_device *dev, char __user *useraddr)
>   	return 0;
>   }
>
> -static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
> +static int ethtool_get_any_eeprom(struct net_device *dev, void __user *useraddr,
> +				  int (*getter)(struct net_device *,
> +						struct ethtool_eeprom *, u8 *),
> +				  u32 total_len)
>   {
>   	struct ethtool_eeprom eeprom;
> -	const struct ethtool_ops *ops = dev->ethtool_ops;
>   	void __user *userbuf = useraddr + sizeof(eeprom);
>   	u32 bytes_remaining;
>   	u8 *data;
>   	int ret = 0;
>
> -	if (!ops->get_eeprom || !ops->get_eeprom_len)
> -		return -EOPNOTSUPP;
> -
>   	if (copy_from_user(&eeprom, useraddr, sizeof(eeprom)))
>   		return -EFAULT;
>
> @@ -771,7 +770,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
>   		return -EINVAL;
>
>   	/* Check for exceeding total eeprom len */
> -	if (eeprom.offset + eeprom.len>  ops->get_eeprom_len(dev))
> +	if (eeprom.offset + eeprom.len>  total_len)
>   		return -EINVAL;
>
>   	data = kmalloc(PAGE_SIZE, GFP_USER);

Should this not be eeprom.len?

> @@ -782,7 +781,7 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
>   	while (bytes_remaining>  0) {
>   		eeprom.len = min(bytes_remaining, (u32)PAGE_SIZE);
>
> -		ret = ops->get_eeprom(dev,&eeprom, data);
> +		ret = getter(dev,&eeprom, data);
>   		if (ret)
>   			break;
>   		if (copy_to_user(userbuf, data, eeprom.len)) {
> @@ -803,6 +802,17 @@ static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
>   	return ret;
>   }
>
> +static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
> +{
> +	const struct ethtool_ops *ops = dev->ethtool_ops;
> +
> +	if (!ops->get_eeprom || !ops->get_eeprom_len)
> +		return -EOPNOTSUPP;
> +
> +	return ethtool_get_any_eeprom(dev, useraddr, ops->get_eeprom,
> +				      ops->get_eeprom_len(dev));
> +}
> +
>   static int ethtool_set_eeprom(struct net_device *dev, void __user *useraddr)
>   {
>   	struct ethtool_eeprom eeprom;

This would reduce the code size nicely between the two eeprom fetches.

Stu

^ permalink raw reply

* Re: [PATCH net-next] udp: intoduce udp_encap_needed static_key
From: Eric Dumazet @ 2012-04-12  9:10 UTC (permalink / raw)
  To: Simon Horman
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA,
	David Miller
In-Reply-To: <1334221528.5300.6008.camel@edumazet-glaptop>

On Thu, 2012-04-12 at 11:05 +0200, Eric Dumazet wrote:

> If static_key is not yet enabled, the fast path does a single JMP .
> 
> When static_key is enabled, JMP destination is patched to reach the real
> encap_type/encap_rcv logic, possibly adding cache misses.

Small note Simon,

The jump trick is effective on x86 (and maybe some other arches) when

CONFIG_JUMP_LABEL=y

Else, its replaced by atomic_read(...) > 0, a cnditional jump but
reading a read_mostly/shared variable, instead of a per socket field.

^ permalink raw reply

* [PATCH] net: smsc911x: fix RX FIFO fastforwarding when dropping packets
From: Will Deacon @ 2012-04-12  9:07 UTC (permalink / raw)
  To: netdev; +Cc: Will Deacon, Steve Glendinning

The SMSC911x ethernet controller provides a mechanism for quickly
skipping to the start of the next frame in the receive FIFO, however
the current code passes the number of words to a function that expects
the number of bytes. This can corrupt the FIFO head in the case that
the fastforward mechanism is not used.

This patch fixes the callers of smsc911x_rx_fastforward to pass the
correct data size.

Cc: Steve Glendinning <steve.glendinning@smsc.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
---
 drivers/net/ethernet/smsc/smsc911x.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index 4a69710..b5599bc 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -1228,7 +1228,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
 				  "Discarding packet with error bit set");
 			/* Packet has an error, discard it and continue with
 			 * the next */
-			smsc911x_rx_fastforward(pdata, pktwords);
+			smsc911x_rx_fastforward(pdata, pktlength);
 			dev->stats.rx_dropped++;
 			continue;
 		}
@@ -1238,7 +1238,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
 			SMSC_WARN(pdata, rx_err,
 				  "Unable to allocate skb for rx packet");
 			/* Drop the packet and stop this polling iteration */
-			smsc911x_rx_fastforward(pdata, pktwords);
+			smsc911x_rx_fastforward(pdata, pktlength);
 			dev->stats.rx_dropped++;
 			break;
 		}
-- 
1.7.4.1

^ permalink raw reply related

* [PATCH net-next] udp: intoduce udp_encap_needed static_key
From: Eric Dumazet @ 2012-04-12  9:05 UTC (permalink / raw)
  To: Simon Horman, David Miller
  Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1334218829.5300.5903.camel@edumazet-glaptop>

Most machines dont use UDP encapsulation (L2TP)

Adds a static_key so that udp_queue_rcv_skb() doesnt have to perform a
test if L2TP never setup the encap_rcv on a socket.

Idea of this patch came after Simon Horman proposal to add a hook on TCP
as well.

If static_key is not yet enabled, the fast path does a single JMP .

When static_key is enabled, JMP destination is patched to reach the real
encap_type/encap_rcv logic, possibly adding cache misses.

Signed-off-by: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org
---
 include/net/udp.h    |    1 +
 net/ipv4/udp.c       |   12 +++++++++++-
 net/l2tp/l2tp_core.c |    1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/net/udp.h b/include/net/udp.h
index 5d606d9..9671f5f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -267,4 +267,5 @@ extern void udp_init(void);
 extern int udp4_ufo_send_check(struct sk_buff *skb);
 extern struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
 	netdev_features_t features);
+extern void udp_encap_enable(void);
 #endif	/* _UDP_H */
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index fe14105..ad1e0dd 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -107,6 +107,7 @@
 #include <net/checksum.h>
 #include <net/xfrm.h>
 #include <trace/events/udp.h>
+#include <linux/static_key.h>
 #include "udp_impl.h"
 
 struct udp_table udp_table __read_mostly;
@@ -1379,6 +1380,14 @@ static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 
 }
 
+static struct static_key udp_encap_needed __read_mostly;
+void udp_encap_enable(void)
+{
+	if (!static_key_enabled(&udp_encap_needed))
+		static_key_slow_inc(&udp_encap_needed);
+}
+EXPORT_SYMBOL(udp_encap_enable);
+
 /* returns:
  *  -1: error
  *   0: success
@@ -1400,7 +1409,7 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
 		goto drop;
 	nf_reset(skb);
 
-	if (up->encap_type) {
+	if (static_key_false(&udp_encap_needed) && up->encap_type) {
 		int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
 
 		/*
@@ -1760,6 +1769,7 @@ int udp_lib_setsockopt(struct sock *sk, int level, int optname,
 			/* FALLTHROUGH */
 		case UDP_ENCAP_L2TPINUDP:
 			up->encap_type = val;
+			udp_encap_enable();
 			break;
 		default:
 			err = -ENOPROTOOPT;
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 89ff8c6..f6732b6 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1424,6 +1424,7 @@ int l2tp_tunnel_create(struct net *net, int fd, int version, u32 tunnel_id, u32
 		/* Mark socket as an encapsulation socket. See net/ipv4/udp.c */
 		udp_sk(sk)->encap_type = UDP_ENCAP_L2TPINUDP;
 		udp_sk(sk)->encap_rcv = l2tp_udp_encap_recv;
+		udp_encap_enable();
 	}
 
 	sk->sk_user_data = tunnel;

^ permalink raw reply related

* Re: [PATCH 1/1] netfilter: xt_recent: Add optional mask option for xt_recent
From: Denys Fedoryshchenko @ 2012-04-12  9:00 UTC (permalink / raw)
  To: Pablo Neira Ayuso
  Cc: Patrick McHardy, David S. Miller, netfilter-devel, netfilter,
	coreteam, linux-kernel, netdev
In-Reply-To: <20120411231421.GA7038@1984>

Hi Pablo

On 2012-04-12 02:14, Pablo Neira Ayuso wrote:
> Hi Denys,
>
> On Tue, Mar 06, 2012 at 01:24:44PM +0200, Denys Fedoryshchenko wrote:
>> Use case for this feature:
>> 1)In some occasions if you need to allow,block,match specific 
>> subnet.
>> 2)I can use recent as a trigger when netfilter rule matches, with 
>> mask 0.0.0.0
>>
>> Example:
>>
>> If you ping 8.8.8.8, after that you can't ping 2.2.2.10
>
> Could you provide an useful example for this new feature?
>
> I also think you can make this with hashlimit, that allows you to
> set the network mask.

Yes, technically hashlimit can do a lot, but not everything. Especially 
because xt_recent can be "fine-grained" in steps, depends on timeline of 
event, and can be updated accordingly to time of reoccurred event. It is 
generally not related to mask option, but mask gives power to block 
subnets.
Why for example /24? Well, it is minimal mask for BGP announce :) It is 
very often, that requesting ip has more ip's in same subnet 
(load-balancing, or multiple ip's on dedicated server), and mask will be 
highly useful for that, to reduce number of entries and to tighten weak 
points (usually after ip blocked, they try from neighbor ip to check, if 
destination just blocked single ip). Plus rttl and hitcount another 
sweet things that are available in xt_recent, but aren't in hashlimit.

iptables -t mangle -N SIP
# If someone abuse our SIP, block him completely at least for 10 
seconds, if he try again, update and block for new 120 seconds
iptables -t mangle -A SIP -m recent --name X --update --seconds 10 
--mask 255.255.255.0 -j MARK --set-mark 0x1
# 120 - 600 seconds handle him over special relay (that will log his 
query, but wont pass him to real SIP server)
iptables -t mangle -A SIP -m recent --name X --rcheck --seconds 600 
--mask 255.255.255.0 -j MARK --set-mark 0x2

In this case i will log only invalid queries, but for example some DDoS 
or scanners that flood servers by packets will be silently ignored. 
Maybe if hitcount really bad, i will add them to ipset, and block 
permanently, by -m set --add-set.

For me personally it is useful, because i have around 140 NAS servers, 
and i give each of them /24 "gray" subnets, and in some cases i need to 
handle bad users, that are changing dynamic ip and attacking from new ip 
each time. I just block non-critical service for whole subnet then, till 
technician on duty will solve issue completely. And sure if attack are 
stopped, subnet will be unblocked "automagically".

Sure this feature not critical, or "a must", and if code are not good, 
it is up to you, if it should be added or not.


^ permalink raw reply

* Re: [RFC v3] Add TCP encap_rcv hook
From: Eric Dumazet @ 2012-04-12  8:20 UTC (permalink / raw)
  To: Simon Horman; +Cc: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20120412074159.GA10866-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

On Thu, 2012-04-12 at 16:42 +0900, Simon Horman wrote:
> This hook is based on a hook of the same name provided by UDP.  It provides
> a way for to receive packets that have a TCP header and treat them in some
> alternate way.
> 
> It is intended to be used by an implementation of the STT tunneling
> protocol within Open vSwtich's datapath. A prototype of such an
> implementation has been made.
> 
> The STT draft is available at
> http://tools.ietf.org/html/draft-davie-stt-01
> 
> My prototype STT implementation has been posted to the dev-UOEtcQmXneFl884UGnbwIQ@public.gmane.org
> The first version can be found at:
> http://www.mail-archive.com/dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org/msg08877.html
> 
> Signed-off-by: Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
> 

Hi Simon

Oh well, this is insane :(

> ---
>  include/linux/tcp.h |    3 +++
>  net/ipv4/tcp_ipv4.c |   23 ++++++++++++++++++++++-
>  2 files changed, 25 insertions(+), 1 deletion(-)
> 
> v3
> * First post to netdev
> * Replace more UDP references with TCP
> * Move socket accesses to inside socket lock
>   and release lock on return.
> 
> v2
> * Fix comment to refer to TCP rather than UDP
> * Allow skb to continue traversing the stack if
>   the encap_rcv callback returns a positive value.
>   This is the same behaviour as the UDP hook.
> 
> diff --git a/include/linux/tcp.h b/include/linux/tcp.h
> index b6c62d2..7210b23 100644
> --- a/include/linux/tcp.h
> +++ b/include/linux/tcp.h
> @@ -472,6 +472,9 @@ struct tcp_sock {
>  	 * contains related tcp_cookie_transactions fields.
>  	 */
>  	struct tcp_cookie_values  *cookie_values;
> +
> +	/* For encapsulation sockets. */
> +	int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
>  };
>  

This adds a new cache miss for all incoming tcp frames...

>  static inline struct tcp_sock *tcp_sk(const struct sock *sk)
> diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> index 3a25cf7..9898f71 100644
> --- a/net/ipv4/tcp_ipv4.c
> +++ b/net/ipv4/tcp_ipv4.c
> @@ -1666,8 +1666,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
>  	const struct iphdr *iph;
>  	const struct tcphdr *th;
>  	struct sock *sk;
> +	struct tcp_sock *tp;
>  	int ret;
>  	struct net *net = dev_net(skb->dev);
> +	int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
>  
>  	if (skb->pkt_type != PACKET_HOST)
>  		goto discard_it;
> @@ -1726,9 +1728,27 @@ process:
>  
>  	bh_lock_sock_nested(sk);
>  	ret = 0;
> +
> +	tp = tcp_sk(sk);
> +	encap_rcv = ACCESS_ONCE(tp->encap_rcv);
> +	if (encap_rcv != NULL) {

and a new conditional...

> +		/*
> +		 * This is an encapsulation socket so pass the skb to
> +		 * the socket's tcp_encap_rcv() hook. Otherwise, just
> +		 * fall through and pass this up the TCP socket.
> +		 * up->encap_rcv() returns the following value:
> +		 * <=0 if skb was successfully passed to the encap
> +		 *     handler or was discarded by it.
> +		 * >0 if skb should be passed on to TCP.
> +		 */
> +		if (encap_rcv(sk, skb) <= 0) {
> +			ret = 0;
> +			goto unlock_sock;
> +		}
> +	}
> +
>  	if (!sock_owned_by_user(sk)) {
>  #ifdef CONFIG_NET_DMA
> -		struct tcp_sock *tp = tcp_sk(sk);
>  		if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
>  			tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
>  		if (tp->ucopy.dma_chan)
> @@ -1744,6 +1764,7 @@ process:
>  		NET_INC_STATS_BH(net, LINUX_MIB_TCPBACKLOGDROP);
>  		goto discard_and_relse;
>  	}
> +unlock_sock:
>  	bh_unlock_sock(sk);
>  
>  	sock_put(sk);

I dont know, this sounds as a hack. Since you obviously spent a lot of
time on this stuff, lets be constructive.

I really suggest you take a look at <linux/static_key.h>

So that on machines without any need for this encap_rcv, we dont even
need to fetch tp->encap_rcv

if (static_key_false(&stt_active)) {
	/* stt might be used on this socket */
	encap_rcv = ACCESS_ONCE(tp->encap_rcv);
	if (encap_rcv) {
		...
	}
}

This way, if stt is not used/loaded, we have a single NOP

If stt is used, NOP is patched to a JMP stt_code


I probably implement this idea on UDP shortly so that you can have a
reference for your implementation.

^ permalink raw reply

* [PATCH] 8139cp: set intr mask after its handler is registered
From: Jason Wang @ 2012-04-12  8:10 UTC (permalink / raw)
  To: netdev, davem, linux-kernel

We set intr mask before its handler is registered, this does not work well when
8139cp is sharing irq line with other devices. As the irq could be enabled by
the device before 8139cp's hander is registered which may lead unhandled
irq. Fix this by introducing an helper cp_irq_enable() and call it after
request_irq().

Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/ethernet/realtek/8139cp.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c
index abc7907..b3287c0 100644
--- a/drivers/net/ethernet/realtek/8139cp.c
+++ b/drivers/net/ethernet/realtek/8139cp.c
@@ -958,6 +958,11 @@ static inline void cp_start_hw (struct cp_private *cp)
 	cpw8(Cmd, RxOn | TxOn);
 }
 
+static void cp_enable_irq(struct cp_private *cp)
+{
+	cpw16_f(IntrMask, cp_intr_mask);
+}
+
 static void cp_init_hw (struct cp_private *cp)
 {
 	struct net_device *dev = cp->dev;
@@ -997,8 +1002,6 @@ static void cp_init_hw (struct cp_private *cp)
 
 	cpw16(MultiIntr, 0);
 
-	cpw16_f(IntrMask, cp_intr_mask);
-
 	cpw8_f(Cfg9346, Cfg9346_Lock);
 }
 
@@ -1130,6 +1133,8 @@ static int cp_open (struct net_device *dev)
 	if (rc)
 		goto err_out_hw;
 
+	cp_enable_irq(cp);
+
 	netif_carrier_off(dev);
 	mii_check_media(&cp->mii_if, netif_msg_link(cp), true);
 	netif_start_queue(dev);
@@ -2031,6 +2036,7 @@ static int cp_resume (struct pci_dev *pdev)
 	/* FIXME: sh*t may happen if the Rx ring buffer is depleted */
 	cp_init_rings_index (cp);
 	cp_init_hw (cp);
+	cp_enable_irq(cp);
 	netif_start_queue (dev);
 
 	spin_lock_irqsave (&cp->lock, flags);

^ permalink raw reply related

* Re: [net-next PATCH v2 8/8] macvlan: add FDB bridge ops and macvlan flags
From: John Fastabend @ 2012-04-12  8:09 UTC (permalink / raw)
  To: mst, sri
  Cc: shemminger, davem, bhutchings, hadi, jeffrey.t.kirsher, netdev,
	gregory.v.rose, krkumar2
In-Reply-To: <20120412065754.3112.31357.stgit@jf-dev1-dcblab>

On 4/11/2012 11:57 PM, John Fastabend wrote:
> This adds FDB bridge ops to the macvlan device passthru mode.
> Additionally a flags field was added and a NOPROMISC bit to
> allow users to use passthru mode without the driver calling
> dev_set_promiscuity(). The flags field is a u16 placed in a
> 4 byte hole (consuming 2 bytes) of the macvlan_dev struct.
> 
> We want to do this so that the macvlan driver or stack
> above the macvlan driver does not have to process every
> packet. For the use case where we know all the MAC addresses
> of the endstations above us this works well.
> 
> This patch is a result of Roopa Prabhu's work. Follow up
> patches are needed for VEPA and VEB macvlan modes.
> 
> v2: Change from distinct nopromisc mode to a flags field to
>     configure this. This avoids the tendency to add a new
>     mode every time we need some slightly different behavior.
> 
> CC: Roopa Prabhu <roprabhu@cisco.com>
> CC: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> ---
> 

oops this introduces an error in dev_set_promiscuity and I missed
adding flags to macvlan_fill_info() and the change routine
macvlan_changelink(). As it stands the flags can only be set at
creation time and can not be queried. I'll submit a v3 with this
fixup in the morning.

I suspect the addition below should be good enough. might try
to clean up the changelink logic a bit first.

---

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index df782c0..65c6d26 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -350,7 +350,7 @@ static int macvlan_stop(struct net_device *dev)

        if (vlan->port->passthru) {
                if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC))
-                       dev_set_promiscuity(lowerdev, 1);
+                       dev_set_promiscuity(lowerdev, -1);
                goto hash_del;
        }

@@ -808,6 +808,19 @@ static int macvlan_changelink(struct net_device *dev,
        struct macvlan_dev *vlan = netdev_priv(dev);
        if (data && data[IFLA_MACVLAN_MODE])
                vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
+       if (data && data[IFLA_MACVLAN_FLAGS]) {
+               __u16 flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
+
+               flags &= MACVLAN_FLAG_NOPROMISC;
+
+               if ((flags ^ vlan->flags) && (flags & MACVLAN_FLAG_NOPROMISC))
+                       dev_set_promiscuity(vlan->lowerdev, -1);
+               else if ((flags ^ vlan->flags) &&
+                        !(flags & MACVLAN_FLAG_NOPROMISC))
+                       dev_set_promiscuity(vlan->lowerdev, 1);
+
+               vlan->flags = flags;
+       }
        return 0;
 }

@@ -823,6 +836,8 @@ static int macvlan_fill_info(struct sk_buff *skb,

        if (nla_put_u32(skb, IFLA_MACVLAN_MODE, vlan->mode))
                goto nla_put_failure;
+       if (nla_put_u16(skb, IFLA_MACVLAN_FLAGS, vlan->flags))
+               goto nla_put_failure;
        return 0;

 nla_put_failure:
[root@jf-dev1-dcblab net-n

^ permalink raw reply related

* [RFC v3] Add TCP encap_rcv hook
From: Simon Horman @ 2012-04-12  7:42 UTC (permalink / raw)
  To: dev-yBygre7rU0TnMu66kgdUjQ, netdev-u79uwXL29TY76Z2rM5mHXA

This hook is based on a hook of the same name provided by UDP.  It provides
a way for to receive packets that have a TCP header and treat them in some
alternate way.

It is intended to be used by an implementation of the STT tunneling
protocol within Open vSwtich's datapath. A prototype of such an
implementation has been made.

The STT draft is available at
http://tools.ietf.org/html/draft-davie-stt-01

My prototype STT implementation has been posted to the dev-UOEtcQmXneFl884UGnbwIQ@public.gmane.org
The first version can be found at:
http://www.mail-archive.com/dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org/msg08877.html

Signed-off-by: Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>

---
 include/linux/tcp.h |    3 +++
 net/ipv4/tcp_ipv4.c |   23 ++++++++++++++++++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

v3
* First post to netdev
* Replace more UDP references with TCP
* Move socket accesses to inside socket lock
  and release lock on return.

v2
* Fix comment to refer to TCP rather than UDP
* Allow skb to continue traversing the stack if
  the encap_rcv callback returns a positive value.
  This is the same behaviour as the UDP hook.

diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index b6c62d2..7210b23 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -472,6 +472,9 @@ struct tcp_sock {
 	 * contains related tcp_cookie_transactions fields.
 	 */
 	struct tcp_cookie_values  *cookie_values;
+
+	/* For encapsulation sockets. */
+	int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
 };
 
 static inline struct tcp_sock *tcp_sk(const struct sock *sk)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 3a25cf7..9898f71 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1666,8 +1666,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
 	const struct iphdr *iph;
 	const struct tcphdr *th;
 	struct sock *sk;
+	struct tcp_sock *tp;
 	int ret;
 	struct net *net = dev_net(skb->dev);
+	int (*encap_rcv)(struct sock *sk, struct sk_buff *skb);
 
 	if (skb->pkt_type != PACKET_HOST)
 		goto discard_it;
@@ -1726,9 +1728,27 @@ process:
 
 	bh_lock_sock_nested(sk);
 	ret = 0;
+
+	tp = tcp_sk(sk);
+	encap_rcv = ACCESS_ONCE(tp->encap_rcv);
+	if (encap_rcv != NULL) {
+		/*
+		 * This is an encapsulation socket so pass the skb to
+		 * the socket's tcp_encap_rcv() hook. Otherwise, just
+		 * fall through and pass this up the TCP socket.
+		 * up->encap_rcv() returns the following value:
+		 * <=0 if skb was successfully passed to the encap
+		 *     handler or was discarded by it.
+		 * >0 if skb should be passed on to TCP.
+		 */
+		if (encap_rcv(sk, skb) <= 0) {
+			ret = 0;
+			goto unlock_sock;
+		}
+	}
+
 	if (!sock_owned_by_user(sk)) {
 #ifdef CONFIG_NET_DMA
-		struct tcp_sock *tp = tcp_sk(sk);
 		if (!tp->ucopy.dma_chan && tp->ucopy.pinned_list)
 			tp->ucopy.dma_chan = dma_find_channel(DMA_MEMCPY);
 		if (tp->ucopy.dma_chan)
@@ -1744,6 +1764,7 @@ process:
 		NET_INC_STATS_BH(net, LINUX_MIB_TCPBACKLOGDROP);
 		goto discard_and_relse;
 	}
+unlock_sock:
 	bh_unlock_sock(sk);
 
 	sock_put(sk);
-- 
1.7.9.5

^ permalink raw reply related

* [net-next PATCH v2 8/8] macvlan: add FDB bridge ops and macvlan flags
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

This adds FDB bridge ops to the macvlan device passthru mode.
Additionally a flags field was added and a NOPROMISC bit to
allow users to use passthru mode without the driver calling
dev_set_promiscuity(). The flags field is a u16 placed in a
4 byte hole (consuming 2 bytes) of the macvlan_dev struct.

We want to do this so that the macvlan driver or stack
above the macvlan driver does not have to process every
packet. For the use case where we know all the MAC addresses
of the endstations above us this works well.

This patch is a result of Roopa Prabhu's work. Follow up
patches are needed for VEPA and VEB macvlan modes.

v2: Change from distinct nopromisc mode to a flags field to
    configure this. This avoids the tendency to add a new
    mode every time we need some slightly different behavior.

CC: Roopa Prabhu <roprabhu@cisco.com>
CC: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 drivers/net/macvlan.c      |   61 ++++++++++++++++++++++++++++++++++++++++----
 include/linux/if_link.h    |    3 ++
 include/linux/if_macvlan.h |    1 +
 3 files changed, 59 insertions(+), 6 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index b17fc90..df782c0 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -312,7 +312,8 @@ static int macvlan_open(struct net_device *dev)
 	int err;
 
 	if (vlan->port->passthru) {
-		dev_set_promiscuity(lowerdev, 1);
+		if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC))
+			dev_set_promiscuity(lowerdev, 1);
 		goto hash_add;
 	}
 
@@ -344,12 +345,15 @@ static int macvlan_stop(struct net_device *dev)
 	struct macvlan_dev *vlan = netdev_priv(dev);
 	struct net_device *lowerdev = vlan->lowerdev;
 
+	dev_uc_unsync(lowerdev, dev);
+	dev_mc_unsync(lowerdev, dev);
+
 	if (vlan->port->passthru) {
-		dev_set_promiscuity(lowerdev, -1);
+		if (!(vlan->flags & MACVLAN_FLAG_NOPROMISC))
+			dev_set_promiscuity(lowerdev, 1);
 		goto hash_del;
 	}
 
-	dev_mc_unsync(lowerdev, dev);
 	if (dev->flags & IFF_ALLMULTI)
 		dev_set_allmulti(lowerdev, -1);
 
@@ -399,10 +403,11 @@ static void macvlan_change_rx_flags(struct net_device *dev, int change)
 		dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1);
 }
 
-static void macvlan_set_multicast_list(struct net_device *dev)
+static void macvlan_set_mac_lists(struct net_device *dev)
 {
 	struct macvlan_dev *vlan = netdev_priv(dev);
 
+	dev_uc_sync(vlan->lowerdev, dev);
 	dev_mc_sync(vlan->lowerdev, dev);
 }
 
@@ -542,6 +547,43 @@ static int macvlan_vlan_rx_kill_vid(struct net_device *dev,
 	return 0;
 }
 
+static int macvlan_fdb_add(struct ndmsg *ndm,
+			   struct net_device *dev,
+			   unsigned char *addr,
+			   u16 flags)
+{
+	struct macvlan_dev *vlan = netdev_priv(dev);
+	int err = -EINVAL;
+
+	if (!vlan->port->passthru)
+		return -EOPNOTSUPP;
+
+	if (is_unicast_ether_addr(addr))
+		err = dev_uc_add_excl(dev, addr);
+	else if (is_multicast_ether_addr(addr))
+		err = dev_mc_add_excl(dev, addr);
+
+	return err;
+}
+
+static int macvlan_fdb_del(struct ndmsg *ndm,
+			   struct net_device *dev,
+			   unsigned char *addr)
+{
+	struct macvlan_dev *vlan = netdev_priv(dev);
+	int err = -EINVAL;
+
+	if (!vlan->port->passthru)
+		return -EOPNOTSUPP;
+
+	if (is_unicast_ether_addr(addr))
+		err = dev_uc_del(dev, addr);
+	else if (is_multicast_ether_addr(addr))
+		err = dev_mc_del(dev, addr);
+
+	return err;
+}
+
 static void macvlan_ethtool_get_drvinfo(struct net_device *dev,
 					struct ethtool_drvinfo *drvinfo)
 {
@@ -572,11 +614,14 @@ static const struct net_device_ops macvlan_netdev_ops = {
 	.ndo_change_mtu		= macvlan_change_mtu,
 	.ndo_change_rx_flags	= macvlan_change_rx_flags,
 	.ndo_set_mac_address	= macvlan_set_mac_address,
-	.ndo_set_rx_mode	= macvlan_set_multicast_list,
+	.ndo_set_rx_mode	= macvlan_set_mac_lists,
 	.ndo_get_stats64	= macvlan_dev_get_stats64,
 	.ndo_validate_addr	= eth_validate_addr,
 	.ndo_vlan_rx_add_vid	= macvlan_vlan_rx_add_vid,
 	.ndo_vlan_rx_kill_vid	= macvlan_vlan_rx_kill_vid,
+	.ndo_fdb_add		= macvlan_fdb_add,
+	.ndo_fdb_del		= macvlan_fdb_del,
+	.ndo_fdb_dump		= ndo_dflt_fdb_dump,
 };
 
 void macvlan_common_setup(struct net_device *dev)
@@ -711,6 +756,9 @@ int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
 	if (data && data[IFLA_MACVLAN_MODE])
 		vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
 
+	if (data && data[IFLA_MACVLAN_FLAGS])
+		vlan->flags = nla_get_u16(data[IFLA_MACVLAN_FLAGS]);
+
 	if (vlan->mode == MACVLAN_MODE_PASSTHRU) {
 		if (port->count)
 			return -EINVAL;
@@ -782,7 +830,8 @@ nla_put_failure:
 }
 
 static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
-	[IFLA_MACVLAN_MODE] = { .type = NLA_U32 },
+	[IFLA_MACVLAN_MODE]  = { .type = NLA_U32 },
+	[IFLA_MACVLAN_FLAGS] = { .type = NLA_U16 },
 };
 
 int macvlan_link_register(struct rtnl_link_ops *ops)
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 2f4fa93..f715750 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -255,6 +255,7 @@ struct ifla_vlan_qos_mapping {
 enum {
 	IFLA_MACVLAN_UNSPEC,
 	IFLA_MACVLAN_MODE,
+	IFLA_MACVLAN_FLAGS,
 	__IFLA_MACVLAN_MAX,
 };
 
@@ -267,6 +268,8 @@ enum macvlan_mode {
 	MACVLAN_MODE_PASSTHRU = 8,/* take over the underlying device */
 };
 
+#define MACVLAN_FLAG_NOPROMISC	1
+
 /* SR-IOV virtual function management section */
 
 enum {
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index d103dca..f65e8d2 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -60,6 +60,7 @@ struct macvlan_dev {
 	struct net_device	*lowerdev;
 	struct macvlan_pcpu_stats __percpu *pcpu_stats;
 	enum macvlan_mode	mode;
+	u16			flags;
 	int (*receive)(struct sk_buff *skb);
 	int (*forward)(struct net_device *dev, struct sk_buff *skb);
 	struct macvtap_queue	*taps[MAX_MACVTAP_QUEUES];

^ permalink raw reply related

* [net-next PATCH v2 7/8] ixgbe: UTA table incorrectly programmed
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

From: Greg Rose <gregory.v.rose@intel.com>

The UTA table was being set to the functional equivalent of promiscuous
mode.  This was resulting in traffic from the virtual function being
flooded onto the wire and the PF device. This resulted in additional
overhead for VF traffic sent to the network and in the case of traffic
sent to the PF or another VF resulted in unwanted packets on the wire.

This was actually not the intended behavior. Now that we can program
the embedded switch correctly we can remove this snippit of code. Users
who want to support this should configure the FDB correctly using the
FDB ops.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   29 -------------------------
 1 files changed, 0 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 25a7ed9..10606bd 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2904,33 +2904,6 @@ static void ixgbe_configure_rscctl(struct ixgbe_adapter *adapter,
 	IXGBE_WRITE_REG(hw, IXGBE_RSCCTL(reg_idx), rscctrl);
 }
 
-/**
- *  ixgbe_set_uta - Set unicast filter table address
- *  @adapter: board private structure
- *
- *  The unicast table address is a register array of 32-bit registers.
- *  The table is meant to be used in a way similar to how the MTA is used
- *  however due to certain limitations in the hardware it is necessary to
- *  set all the hash bits to 1 and use the VMOLR ROPE bit as a promiscuous
- *  enable bit to allow vlan tag stripping when promiscuous mode is enabled
- **/
-static void ixgbe_set_uta(struct ixgbe_adapter *adapter)
-{
-	struct ixgbe_hw *hw = &adapter->hw;
-	int i;
-
-	/* The UTA table only exists on 82599 hardware and newer */
-	if (hw->mac.type < ixgbe_mac_82599EB)
-		return;
-
-	/* we only need to do this if VMDq is enabled */
-	if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
-		return;
-
-	for (i = 0; i < 128; i++)
-		IXGBE_WRITE_REG(hw, IXGBE_UTA(i), ~0);
-}
-
 #define IXGBE_MAX_RX_DESC_POLL 10
 static void ixgbe_rx_desc_queue_enable(struct ixgbe_adapter *adapter,
 				       struct ixgbe_ring *ring)
@@ -3224,8 +3197,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
 	/* Program registers for the distribution of queues */
 	ixgbe_setup_mrqc(adapter);
 
-	ixgbe_set_uta(adapter);
-
 	/* set_rx_buffer_len must be called before ring initialization */
 	ixgbe_set_rx_buffer_len(adapter);
 

^ permalink raw reply related

* [net-next PATCH v2 6/8] ixgbe: allow RAR table to be updated in promisc mode
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

This allows RAR table updates while in promiscuous. With
SR-IOV enabled it is valuable to allow the RAR table to
be updated even when in promisc mode to configure forwarding

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 8b37395..25a7ed9 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3462,16 +3462,17 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
 		}
 		ixgbe_vlan_filter_enable(adapter);
 		hw->addr_ctrl.user_set_promisc = false;
-		/*
-		 * Write addresses to available RAR registers, if there is not
-		 * sufficient space to store all the addresses then enable
-		 * unicast promiscuous mode
-		 */
-		count = ixgbe_write_uc_addr_list(netdev);
-		if (count < 0) {
-			fctrl |= IXGBE_FCTRL_UPE;
-			vmolr |= IXGBE_VMOLR_ROPE;
-		}
+	}
+
+	/*
+	 * Write addresses to available RAR registers, if there is not
+	 * sufficient space to store all the addresses then enable
+	 * unicast promiscuous mode
+	 */
+	count = ixgbe_write_uc_addr_list(netdev);
+	if (count < 0) {
+		fctrl |= IXGBE_FCTRL_UPE;
+		vmolr |= IXGBE_VMOLR_ROPE;
 	}
 
 	if (adapter->num_vfs) {

^ permalink raw reply related

* [net-next PATCH v2 5/8] ixgbe: enable FDB netdevice ops
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

Enable FDB ops on ixgbe when in SR-IOV mode.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |   71 +++++++++++++++++++++++++
 1 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 3e26b1f..8b37395 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -6681,6 +6681,74 @@ static int ixgbe_set_features(struct net_device *netdev,
 	return 0;
 }
 
+static int ixgbe_ndo_fdb_add(struct ndmsg *ndm,
+			     struct net_device *dev,
+			     unsigned char *addr,
+			     u16 flags)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(dev);
+	int err = -EOPNOTSUPP;
+
+	if (ndm->ndm_state & NUD_PERMANENT) {
+		pr_info("%s: FDB only supports static addresses\n",
+			ixgbe_driver_name);
+		return -EINVAL;
+	}
+
+	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
+		if (is_unicast_ether_addr(addr))
+			err = dev_uc_add_excl(dev, addr);
+		else if (is_multicast_ether_addr(addr))
+			err = dev_mc_add_excl(dev, addr);
+		else
+			err = -EINVAL;
+	}
+
+	/* Only return duplicate errors if NLM_F_EXCL is set */
+	if (err == -EEXIST && !(flags & NLM_F_EXCL))
+		err = 0;
+
+	return err;
+}
+
+static int ixgbe_ndo_fdb_del(struct ndmsg *ndm,
+			     struct net_device *dev,
+			     unsigned char *addr)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(dev);
+	int err = -EOPNOTSUPP;
+
+	if (ndm->ndm_state & NUD_PERMANENT) {
+		pr_info("%s: FDB only supports static addresses\n",
+			ixgbe_driver_name);
+		return -EINVAL;
+	}
+
+	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED) {
+		if (is_unicast_ether_addr(addr))
+			err = dev_uc_del(dev, addr);
+		else if (is_multicast_ether_addr(addr))
+			err = dev_mc_del(dev, addr);
+		else
+			err = -EINVAL;
+	}
+
+	return err;
+}
+
+static int ixgbe_ndo_fdb_dump(struct sk_buff *skb,
+			      struct netlink_callback *cb,
+			      struct net_device *dev,
+			      int idx)
+{
+	struct ixgbe_adapter *adapter = netdev_priv(dev);
+
+	if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
+		idx = ndo_dflt_fdb_dump(skb, cb, dev, idx);
+
+	return idx;
+}
+
 static const struct net_device_ops ixgbe_netdev_ops = {
 	.ndo_open		= ixgbe_open,
 	.ndo_stop		= ixgbe_close,
@@ -6717,6 +6785,9 @@ static const struct net_device_ops ixgbe_netdev_ops = {
 #endif /* IXGBE_FCOE */
 	.ndo_set_features = ixgbe_set_features,
 	.ndo_fix_features = ixgbe_fix_features,
+	.ndo_fdb_add		= ixgbe_ndo_fdb_add,
+	.ndo_fdb_del		= ixgbe_ndo_fdb_del,
+	.ndo_fdb_dump		= ixgbe_ndo_fdb_dump,
 };
 
 static void __devinit ixgbe_probe_vf(struct ixgbe_adapter *adapter,

^ permalink raw reply related

* [net-next PATCH v2 4/8] net: rtnetlink notify events for FDB NTF_SELF adds and deletes
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

It is useful to be able to monitor for FDB events in user space.
This patch adds support to generate netlink events when a change
is made to a device supporting the FDB ops.

This brings embedded switches inline with the SW net/bridge which
triggers events on FDB updates as well.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 net/core/rtnetlink.c |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 347c420..4b7ed7b 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -2011,6 +2011,33 @@ nla_put_failure:
 	return -EMSGSIZE;
 }
 
+static inline size_t rtnl_fdb_nlmsg_size(void)
+{
+	return NLMSG_ALIGN(sizeof(struct ndmsg)) + nla_total_size(ETH_ALEN);
+}
+
+static void rtnl_fdb_notify(struct net_device *dev, u8 *addr, int type)
+{
+	struct net *net = dev_net(dev);
+	struct sk_buff *skb;
+	int err = -ENOBUFS;
+
+	skb = nlmsg_new(rtnl_fdb_nlmsg_size(), GFP_ATOMIC);
+	if (!skb)
+		goto errout;
+
+	err = nlmsg_populate_fdb_fill(skb, dev, addr, 0, 0, type, NTF_SELF);
+	if (err < 0) {
+		kfree_skb(skb);
+		goto errout;
+	}
+
+	rtnl_notify(skb, net, 0, RTNLGRP_NEIGH, NULL, GFP_ATOMIC);
+	return;
+errout:
+	rtnl_set_sk_err(net, RTNLGRP_NEIGH, err);
+}
+
 static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 {
 	struct net *net = sock_net(skb->sk);
@@ -2067,8 +2094,10 @@ static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 		err = dev->netdev_ops->ndo_fdb_add(ndm, dev, addr,
 						   nlh->nlmsg_flags);
 
-		if (!err)
+		if (!err) {
+			rtnl_fdb_notify(dev, addr, RTM_NEWNEIGH);
 			ndm->ndm_flags &= ~NTF_SELF;
+		}
 	}
 out:
 	return err;
@@ -2125,8 +2154,10 @@ static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 	if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_del) {
 		err = dev->netdev_ops->ndo_fdb_del(ndm, dev, addr);
 
-		if (!err)
+		if (!err) {
+			rtnl_fdb_notify(dev, addr, RTM_DELNEIGH);
 			ndm->ndm_flags &= ~NTF_SELF;
+		}
 	}
 out:
 	return err;

^ permalink raw reply related

* [net-next PATCH v2 3/8] net: add fdb generic dump routine
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

This adds a generic dump routine drivers can call. It
should be sufficient to handle any bridging model that
uses the unicast address list. This should be most SR-IOV
enabled NICs.

v2: return error on nlmsg_put and use -EMSGSIZE instead
    of -ENOMEM this is inline other usages

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 net/core/rtnetlink.c |   84 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 84 insertions(+), 0 deletions(-)

diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5ec09d5..347c420 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1980,6 +1980,37 @@ errout:
 		rtnl_set_sk_err(net, RTNLGRP_LINK, err);
 }
 
+static int nlmsg_populate_fdb_fill(struct sk_buff *skb,
+				   struct net_device *dev,
+				   u8 *addr, u32 pid, u32 seq,
+				   int type, unsigned int flags)
+{
+	struct nlmsghdr *nlh;
+	struct ndmsg *ndm;
+
+	nlh = nlmsg_put(skb, pid, seq, type, sizeof(*ndm), NLM_F_MULTI);
+	if (!nlh)
+		return -EMSGSIZE;
+
+	ndm = nlmsg_data(nlh);
+	ndm->ndm_family  = AF_BRIDGE;
+	ndm->ndm_pad1	 = 0;
+	ndm->ndm_pad2    = 0;
+	ndm->ndm_flags	 = flags;
+	ndm->ndm_type	 = 0;
+	ndm->ndm_ifindex = dev->ifindex;
+	ndm->ndm_state   = NUD_PERMANENT;
+
+	if (nla_put(skb, NDA_LLADDR, ETH_ALEN, addr))
+		goto nla_put_failure;
+
+	return nlmsg_end(skb, nlh);
+
+nla_put_failure:
+	nlmsg_cancel(skb, nlh);
+	return -EMSGSIZE;
+}
+
 static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 {
 	struct net *net = sock_net(skb->sk);
@@ -2101,6 +2132,59 @@ out:
 	return err;
 }
 
+static int nlmsg_populate_fdb(struct sk_buff *skb,
+			      struct netlink_callback *cb,
+			      struct net_device *dev,
+			      int *idx,
+			      struct netdev_hw_addr_list *list)
+{
+	struct netdev_hw_addr *ha;
+	int err;
+	u32 pid, seq;
+
+	pid = NETLINK_CB(cb->skb).pid;
+	seq = cb->nlh->nlmsg_seq;
+
+	list_for_each_entry(ha, &list->list, list) {
+		if (*idx < cb->args[0])
+			goto skip;
+
+		err = nlmsg_populate_fdb_fill(skb, dev, ha->addr,
+					      pid, seq, 0, NTF_SELF);
+		if (err < 0)
+			break;
+skip:
+		*idx += 1;
+	}
+	return 0;
+}
+
+/**
+ * ndo_dflt_fdb_dump: default netdevice operation to dump an FDB table.
+ * @nlh: netlink message header
+ * @dev: netdevice
+ *
+ * Default netdevice operation to dump the existing unicast address list.
+ * Returns zero on success.
+ */
+int ndo_dflt_fdb_dump(struct sk_buff *skb,
+		      struct netlink_callback *cb,
+		      struct net_device *dev,
+		      int idx)
+{
+	int err;
+
+	netif_addr_lock_bh(dev);
+	err = nlmsg_populate_fdb(skb, cb, dev, &idx, &dev->uc);
+	if (err)
+		goto out;
+	nlmsg_populate_fdb(skb, cb, dev, &idx, &dev->mc);
+out:
+	netif_addr_unlock_bh(dev);
+	return idx;
+}
+EXPORT_SYMBOL(ndo_dflt_fdb_dump);
+
 static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
 {
 	int idx = 0;

^ permalink raw reply related

* [net-next PATCH v2 2/8] net: addr_list: add exclusive dev_uc_add and dev_mc_add
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

This adds a dev_uc_add_excl() and dev_mc_add_excl() calls
similar to the original dev_{uc|mc}_add() except it sets
the global bit and returns -EEXIST for duplicat entires.

This is useful for drivers that support SR-IOV, macvlan
devices and any other devices that need to manage the
unicast and multicast lists.

v2: fix typo UNICAST should be MULTICAST in dev_mc_add_excl()

CC: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 include/linux/netdevice.h |    2 +
 net/core/dev_addr_lists.c |   97 ++++++++++++++++++++++++++++++++++++++-------
 2 files changed, 83 insertions(+), 16 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 7600c61..3f738ca 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2569,6 +2569,7 @@ extern int dev_addr_init(struct net_device *dev);
 
 /* Functions used for unicast addresses handling */
 extern int dev_uc_add(struct net_device *dev, unsigned char *addr);
+extern int dev_uc_add_excl(struct net_device *dev, unsigned char *addr);
 extern int dev_uc_del(struct net_device *dev, unsigned char *addr);
 extern int dev_uc_sync(struct net_device *to, struct net_device *from);
 extern void dev_uc_unsync(struct net_device *to, struct net_device *from);
@@ -2578,6 +2579,7 @@ extern void dev_uc_init(struct net_device *dev);
 /* Functions used for multicast addresses handling */
 extern int dev_mc_add(struct net_device *dev, unsigned char *addr);
 extern int dev_mc_add_global(struct net_device *dev, unsigned char *addr);
+extern int dev_mc_add_excl(struct net_device *dev, unsigned char *addr);
 extern int dev_mc_del(struct net_device *dev, unsigned char *addr);
 extern int dev_mc_del_global(struct net_device *dev, unsigned char *addr);
 extern int dev_mc_sync(struct net_device *to, struct net_device *from);
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
index 626698f..c4cc2bc 100644
--- a/net/core/dev_addr_lists.c
+++ b/net/core/dev_addr_lists.c
@@ -21,12 +21,35 @@
  * General list handling functions
  */
 
+static int __hw_addr_create_ex(struct netdev_hw_addr_list *list,
+			       unsigned char *addr, int addr_len,
+			       unsigned char addr_type, bool global)
+{
+	struct netdev_hw_addr *ha;
+	int alloc_size;
+
+	alloc_size = sizeof(*ha);
+	if (alloc_size < L1_CACHE_BYTES)
+		alloc_size = L1_CACHE_BYTES;
+	ha = kmalloc(alloc_size, GFP_ATOMIC);
+	if (!ha)
+		return -ENOMEM;
+	memcpy(ha->addr, addr, addr_len);
+	ha->type = addr_type;
+	ha->refcount = 1;
+	ha->global_use = global;
+	ha->synced = false;
+	list_add_tail_rcu(&ha->list, &list->list);
+	list->count++;
+
+	return 0;
+}
+
 static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
 			    unsigned char *addr, int addr_len,
 			    unsigned char addr_type, bool global)
 {
 	struct netdev_hw_addr *ha;
-	int alloc_size;
 
 	if (addr_len > MAX_ADDR_LEN)
 		return -EINVAL;
@@ -46,21 +69,7 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,
 		}
 	}
 
-
-	alloc_size = sizeof(*ha);
-	if (alloc_size < L1_CACHE_BYTES)
-		alloc_size = L1_CACHE_BYTES;
-	ha = kmalloc(alloc_size, GFP_ATOMIC);
-	if (!ha)
-		return -ENOMEM;
-	memcpy(ha->addr, addr, addr_len);
-	ha->type = addr_type;
-	ha->refcount = 1;
-	ha->global_use = global;
-	ha->synced = false;
-	list_add_tail_rcu(&ha->list, &list->list);
-	list->count++;
-	return 0;
+	return __hw_addr_create_ex(list, addr, addr_len, addr_type, global);
 }
 
 static int __hw_addr_add(struct netdev_hw_addr_list *list, unsigned char *addr,
@@ -377,6 +386,34 @@ EXPORT_SYMBOL(dev_addr_del_multiple);
  */
 
 /**
+ *	dev_uc_add_excl - Add a global secondary unicast address
+ *	@dev: device
+ *	@addr: address to add
+ */
+int dev_uc_add_excl(struct net_device *dev, unsigned char *addr)
+{
+	struct netdev_hw_addr *ha;
+	int err;
+
+	netif_addr_lock_bh(dev);
+	list_for_each_entry(ha, &dev->uc.list, list) {
+		if (!memcmp(ha->addr, addr, dev->addr_len) &&
+		    ha->type == NETDEV_HW_ADDR_T_UNICAST) {
+			err = -EEXIST;
+			goto out;
+		}
+	}
+	err = __hw_addr_create_ex(&dev->uc, addr, dev->addr_len,
+				  NETDEV_HW_ADDR_T_UNICAST, true);
+	if (!err)
+		__dev_set_rx_mode(dev);
+out:
+	netif_addr_unlock_bh(dev);
+	return err;
+}
+EXPORT_SYMBOL(dev_uc_add_excl);
+
+/**
  *	dev_uc_add - Add a secondary unicast address
  *	@dev: device
  *	@addr: address to add
@@ -501,6 +538,34 @@ EXPORT_SYMBOL(dev_uc_init);
  * Multicast list handling functions
  */
 
+/**
+ *	dev_mc_add_excl - Add a global secondary multicast address
+ *	@dev: device
+ *	@addr: address to add
+ */
+int dev_mc_add_excl(struct net_device *dev, unsigned char *addr)
+{
+	struct netdev_hw_addr *ha;
+	int err;
+
+	netif_addr_lock_bh(dev);
+	list_for_each_entry(ha, &dev->mc.list, list) {
+		if (!memcmp(ha->addr, addr, dev->addr_len) &&
+		    ha->type == NETDEV_HW_ADDR_T_MULTICAST) {
+			err = -EEXIST;
+			goto out;
+		}
+	}
+	err = __hw_addr_create_ex(&dev->mc, addr, dev->addr_len,
+				  NETDEV_HW_ADDR_T_MULTICAST, true);
+	if (!err)
+		__dev_set_rx_mode(dev);
+out:
+	netif_addr_unlock_bh(dev);
+	return err;
+}
+EXPORT_SYMBOL(dev_mc_add_excl);
+
 static int __dev_mc_add(struct net_device *dev, unsigned char *addr,
 			bool global)
 {

^ permalink raw reply related

* [net-next PATCH v2 1/8] net: add generic PF_BRIDGE:RTM_ FDB hooks
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2
In-Reply-To: <20120412064858.3112.65818.stgit@jf-dev1-dcblab>

This adds two new flags NTF_MASTER and NTF_SELF that can
now be used to specify where PF_BRIDGE netlink commands should
be sent. NTF_MASTER sends the commands to the 'dev->master'
device for parsing. Typically this will be the linux net/bridge,
or open-vswitch devices. Also without any flags set the command
will be handled by the master device as well so that current user
space tools continue to work as expected.

The NTF_SELF flag will push the PF_BRIDGE commands to the
device. In the basic example below the commands are then parsed
and programmed in the embedded bridge.

Note if both NTF_SELF and NTF_MASTER bits are set then the
command will be sent to both 'dev->master' and 'dev' this allows
user space to easily keep the embedded bridge and software bridge
in sync.

There is a slight complication in the case with both flags set
when an error occurs. To resolve this the rtnl handler clears
the NTF_ flag in the netlink ack to indicate which sets completed
successfully. The add/del handlers will abort as soon as any
error occurs.

To support this new net device ops were added to call into
the device and the existing bridging code was refactored
to use these. There should be no required changes in user space
to support the current bridge behavior.

A basic setup with a SR-IOV enabled NIC looks like this,

          veth0  veth2
            |      |
          ------------
          |  bridge0 |   <---- software bridging
          ------------
               /
               /
  ethx.y      ethx
    VF         PF
     \         \          <---- propagate FDB entries to HW
     \         \
  --------------------
  |  Embedded Bridge |    <---- hardware offloaded switching
  --------------------

In this case the embedded bridge must be managed to allow 'veth0'
to communicate with 'ethx.y' correctly. At present drivers managing
the embedded bridge either send frames onto the network which
then get dropped by the switch OR the embedded bridge will flood
these frames. With this patch we have a mechanism to manage the
embedded bridge correctly from user space. This example is specific
to SR-IOV but replacing the VF with another PF or dropping this
into the DSA framework generates similar management issues.

Examples session using the 'br'[1] tool to add, dump and then
delete a mac address with a new "embedded" option and enabled
ixgbe driver:

# br fdb add 22:35:19:ac:60:59 dev eth3
# br fdb
port    mac addr                flags
veth0   22:35:19:ac:60:58       static
veth0   9a:5f:81:f7:f6:ec       local
eth3    00:1b:21:55:23:59       local
eth3    22:35:19:ac:60:59       static
veth0   22:35:19:ac:60:57       static
#br fdb add 22:35:19:ac:60:59 embedded dev eth3
#br fdb
port    mac addr                flags
veth0   22:35:19:ac:60:58       static
veth0   9a:5f:81:f7:f6:ec       local
eth3    00:1b:21:55:23:59       local
eth3    22:35:19:ac:60:59       static
veth0   22:35:19:ac:60:57       static
eth3    22:35:19:ac:60:59       local embedded
#br fdb del 22:35:19:ac:60:59 embedded dev eth3

I added a couple lines to 'br' to set the flags correctly is all. It
is my opinion that the merit of this patch is now embedded and SW
bridges can both be modeled correctly in user space using very nearly
the same message passing.

[1] 'br' tool was published as an RFC here and will be renamed 'bridge'
    http://patchwork.ozlabs.org/patch/117664/

Thanks to Jamal Hadi Salim, Stephen Hemminger and Ben Hutchings for
valuable feedback, suggestions, and review.

v2: fixed api descriptions and error case with both NTF_SELF and
    NTF_MASTER set plus updated patch description.

Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
---

 include/linux/neighbour.h |    3 +
 include/linux/netdevice.h |   23 +++++++
 include/linux/rtnetlink.h |    4 +
 net/bridge/br_device.c    |    3 +
 net/bridge/br_fdb.c       |  128 +++++++++-----------------------------
 net/bridge/br_netlink.c   |   12 ----
 net/bridge/br_private.h   |   15 ++++
 net/core/rtnetlink.c      |  152 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 228 insertions(+), 112 deletions(-)

diff --git a/include/linux/neighbour.h b/include/linux/neighbour.h
index b188f68..275e5d6 100644
--- a/include/linux/neighbour.h
+++ b/include/linux/neighbour.h
@@ -33,6 +33,9 @@ enum {
 #define NTF_PROXY	0x08	/* == ATF_PUBL */
 #define NTF_ROUTER	0x80
 
+#define NTF_SELF	0x02
+#define NTF_MASTER	0x04
+
 /*
  *	Neighbor Cache Entry States.
  */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5cbaa20..7600c61 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
 #include <net/netprio_cgroup.h>
 
 #include <linux/netdev_features.h>
+#include <linux/neighbour.h>
 
 struct netpoll_info;
 struct device;
@@ -905,6 +906,16 @@ struct netdev_fcoe_hbainfo {
  *	feature set might be less than what was returned by ndo_fix_features()).
  *	Must return >0 or -errno if it changed dev->features itself.
  *
+ * int (*ndo_fdb_add)(struct ndmsg *ndm, struct net_device *dev,
+ *		      unsigned char *addr, u16 flags)
+ *	Adds an FDB entry to dev for addr.
+ * int (*ndo_fdb_del)(struct ndmsg *ndm, struct net_device *dev,
+ *		      unsigned char *addr)
+ *	Deletes the FDB entry from dev coresponding to addr.
+ * int (*ndo_fdb_dump)(struct sk_buff *skb, struct netlink_callback *cb,
+ *		       struct net_device *dev, int idx)
+ *	Used to add FDB entries to dump requests. Implementers should add
+ *	entries to skb and update idx with the number of entries.
  */
 struct net_device_ops {
 	int			(*ndo_init)(struct net_device *dev);
@@ -1002,6 +1013,18 @@ struct net_device_ops {
 						    netdev_features_t features);
 	int			(*ndo_neigh_construct)(struct neighbour *n);
 	void			(*ndo_neigh_destroy)(struct neighbour *n);
+
+	int			(*ndo_fdb_add)(struct ndmsg *ndm,
+					       struct net_device *dev,
+					       unsigned char *addr,
+					       u16 flags);
+	int			(*ndo_fdb_del)(struct ndmsg *ndm,
+					       struct net_device *dev,
+					       unsigned char *addr);
+	int			(*ndo_fdb_dump)(struct sk_buff *skb,
+						struct netlink_callback *cb,
+						struct net_device *dev,
+						int idx);
 };
 
 /*
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 577592e..2c1de89 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -801,6 +801,10 @@ rtattr_failure:
 	return table;
 }
 
+extern int ndo_dflt_fdb_dump(struct sk_buff *skb,
+			     struct netlink_callback *cb,
+			     struct net_device *dev,
+			     int idx);
 #endif /* __KERNEL__ */
 
 
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index ba829de..d6e5929 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -317,6 +317,9 @@ static const struct net_device_ops br_netdev_ops = {
 	.ndo_add_slave		 = br_add_slave,
 	.ndo_del_slave		 = br_del_slave,
 	.ndo_fix_features        = br_fix_features,
+	.ndo_fdb_add		 = br_fdb_add,
+	.ndo_fdb_del		 = br_fdb_delete,
+	.ndo_fdb_dump		 = br_fdb_dump,
 };
 
 static void br_dev_free(struct net_device *dev)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 80dbce4..5945c54 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -535,44 +535,38 @@ errout:
 }
 
 /* Dump information about entries, in response to GETNEIGH */
-int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
+int br_fdb_dump(struct sk_buff *skb,
+		struct netlink_callback *cb,
+		struct net_device *dev,
+		int idx)
 {
-	struct net *net = sock_net(skb->sk);
-	struct net_device *dev;
-	int idx = 0;
-
-	rcu_read_lock();
-	for_each_netdev_rcu(net, dev) {
-		struct net_bridge *br = netdev_priv(dev);
-		int i;
-
-		if (!(dev->priv_flags & IFF_EBRIDGE))
-			continue;
+	struct net_bridge *br = netdev_priv(dev);
+	int i;
 
-		for (i = 0; i < BR_HASH_SIZE; i++) {
-			struct hlist_node *h;
-			struct net_bridge_fdb_entry *f;
+	if (!(dev->priv_flags & IFF_EBRIDGE))
+		goto out;
 
-			hlist_for_each_entry_rcu(f, h, &br->hash[i], hlist) {
-				if (idx < cb->args[0])
-					goto skip;
+	for (i = 0; i < BR_HASH_SIZE; i++) {
+		struct hlist_node *h;
+		struct net_bridge_fdb_entry *f;
 
-				if (fdb_fill_info(skb, br, f,
-						  NETLINK_CB(cb->skb).pid,
-						  cb->nlh->nlmsg_seq,
-						  RTM_NEWNEIGH,
-						  NLM_F_MULTI) < 0)
-					break;
+		hlist_for_each_entry_rcu(f, h, &br->hash[i], hlist) {
+			if (idx < cb->args[0])
+				goto skip;
+
+			if (fdb_fill_info(skb, br, f,
+					  NETLINK_CB(cb->skb).pid,
+					  cb->nlh->nlmsg_seq,
+					  RTM_NEWNEIGH,
+					  NLM_F_MULTI) < 0)
+				break;
 skip:
-				++idx;
-			}
+			++idx;
 		}
 	}
-	rcu_read_unlock();
-
-	cb->args[0] = idx;
 
-	return skb->len;
+out:
+	return idx;
 }
 
 /* Update (create or replace) forwarding database entry */
@@ -614,43 +608,11 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 }
 
 /* Add new permanent fdb entry with RTM_NEWNEIGH */
-int br_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+int br_fdb_add(struct ndmsg *ndm, struct net_device *dev,
+	       unsigned char *addr, u16 nlh_flags)
 {
-	struct net *net = sock_net(skb->sk);
-	struct ndmsg *ndm;
-	struct nlattr *tb[NDA_MAX+1];
-	struct net_device *dev;
 	struct net_bridge_port *p;
-	const __u8 *addr;
-	int err;
-
-	ASSERT_RTNL();
-	err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL);
-	if (err < 0)
-		return err;
-
-	ndm = nlmsg_data(nlh);
-	if (ndm->ndm_ifindex == 0) {
-		pr_info("bridge: RTM_NEWNEIGH with invalid ifindex\n");
-		return -EINVAL;
-	}
-
-	dev = __dev_get_by_index(net, ndm->ndm_ifindex);
-	if (dev == NULL) {
-		pr_info("bridge: RTM_NEWNEIGH with unknown ifindex\n");
-		return -ENODEV;
-	}
-
-	if (!tb[NDA_LLADDR] || nla_len(tb[NDA_LLADDR]) != ETH_ALEN) {
-		pr_info("bridge: RTM_NEWNEIGH with invalid address\n");
-		return -EINVAL;
-	}
-
-	addr = nla_data(tb[NDA_LLADDR]);
-	if (!is_valid_ether_addr(addr)) {
-		pr_info("bridge: RTM_NEWNEIGH with invalid ether address\n");
-		return -EINVAL;
-	}
+	int err = 0;
 
 	if (!(ndm->ndm_state & (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE))) {
 		pr_info("bridge: RTM_NEWNEIGH with invalid state %#x\n", ndm->ndm_state);
@@ -670,14 +632,14 @@ int br_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
 		rcu_read_unlock();
 	} else {
 		spin_lock_bh(&p->br->hash_lock);
-		err = fdb_add_entry(p, addr, ndm->ndm_state, nlh->nlmsg_flags);
+		err = fdb_add_entry(p, addr, ndm->ndm_state, nlh_flags);
 		spin_unlock_bh(&p->br->hash_lock);
 	}
 
 	return err;
 }
 
-static int fdb_delete_by_addr(struct net_bridge_port *p, const u8 *addr)
+static int fdb_delete_by_addr(struct net_bridge_port *p, u8 *addr)
 {
 	struct net_bridge *br = p->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr)];
@@ -692,40 +654,12 @@ static int fdb_delete_by_addr(struct net_bridge_port *p, const u8 *addr)
 }
 
 /* Remove neighbor entry with RTM_DELNEIGH */
-int br_fdb_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+int br_fdb_delete(struct ndmsg *ndm, struct net_device *dev,
+		  unsigned char *addr)
 {
-	struct net *net = sock_net(skb->sk);
-	struct ndmsg *ndm;
 	struct net_bridge_port *p;
-	struct nlattr *llattr;
-	const __u8 *addr;
-	struct net_device *dev;
 	int err;
 
-	ASSERT_RTNL();
-	if (nlmsg_len(nlh) < sizeof(*ndm))
-		return -EINVAL;
-
-	ndm = nlmsg_data(nlh);
-	if (ndm->ndm_ifindex == 0) {
-		pr_info("bridge: RTM_DELNEIGH with invalid ifindex\n");
-		return -EINVAL;
-	}
-
-	dev = __dev_get_by_index(net, ndm->ndm_ifindex);
-	if (dev == NULL) {
-		pr_info("bridge: RTM_DELNEIGH with unknown ifindex\n");
-		return -ENODEV;
-	}
-
-	llattr = nlmsg_find_attr(nlh, sizeof(*ndm), NDA_LLADDR);
-	if (llattr == NULL || nla_len(llattr) != ETH_ALEN) {
-		pr_info("bridge: RTM_DELNEIGH with invalid address\n");
-		return -EINVAL;
-	}
-
-	addr = nla_data(llattr);
-
 	p = br_port_get_rtnl(dev);
 	if (p == NULL) {
 		pr_info("bridge: RTM_DELNEIGH %s not a bridge port\n",
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index 346b368..1fa0535 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -232,18 +232,6 @@ int __init br_netlink_init(void)
 			      br_rtm_setlink, NULL, NULL);
 	if (err)
 		goto err3;
-	err = __rtnl_register(PF_BRIDGE, RTM_NEWNEIGH,
-			      br_fdb_add, NULL, NULL);
-	if (err)
-		goto err3;
-	err = __rtnl_register(PF_BRIDGE, RTM_DELNEIGH,
-			      br_fdb_delete, NULL, NULL);
-	if (err)
-		goto err3;
-	err = __rtnl_register(PF_BRIDGE, RTM_GETNEIGH,
-			      NULL, br_fdb_dump, NULL);
-	if (err)
-		goto err3;
 
 	return 0;
 
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 0b67a63..929b9f6 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -363,9 +363,18 @@ extern int br_fdb_insert(struct net_bridge *br,
 extern void br_fdb_update(struct net_bridge *br,
 			  struct net_bridge_port *source,
 			  const unsigned char *addr);
-extern int br_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb);
-extern int br_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
-extern int br_fdb_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
+
+extern int br_fdb_delete(struct ndmsg *ndm,
+			 struct net_device *dev,
+			 unsigned char *addr);
+extern int br_fdb_add(struct ndmsg *nlh,
+		      struct net_device *dev,
+		      unsigned char *addr,
+		      u16 nlh_flags);
+extern int br_fdb_dump(struct sk_buff *skb,
+		       struct netlink_callback *cb,
+		       struct net_device *dev,
+		       int idx);
 
 /* br_forward.c */
 extern void br_deliver(const struct net_bridge_port *to,
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 545a969..5ec09d5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -35,7 +35,9 @@
 #include <linux/security.h>
 #include <linux/mutex.h>
 #include <linux/if_addr.h>
+#include <linux/if_bridge.h>
 #include <linux/pci.h>
+#include <linux/etherdevice.h>
 
 #include <asm/uaccess.h>
 
@@ -1978,6 +1980,152 @@ errout:
 		rtnl_set_sk_err(net, RTNLGRP_LINK, err);
 }
 
+static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+{
+	struct net *net = sock_net(skb->sk);
+	struct net_device *master = NULL;
+	struct ndmsg *ndm;
+	struct nlattr *tb[NDA_MAX+1];
+	struct net_device *dev;
+	u8 *addr;
+	int err;
+
+	err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL);
+	if (err < 0)
+		return err;
+
+	ndm = nlmsg_data(nlh);
+	if (ndm->ndm_ifindex == 0) {
+		pr_info("PF_BRIDGE: RTM_NEWNEIGH with invalid ifindex\n");
+		return -EINVAL;
+	}
+
+	dev = __dev_get_by_index(net, ndm->ndm_ifindex);
+	if (dev == NULL) {
+		pr_info("PF_BRIDGE: RTM_NEWNEIGH with unknown ifindex\n");
+		return -ENODEV;
+	}
+
+	if (!tb[NDA_LLADDR] || nla_len(tb[NDA_LLADDR]) != ETH_ALEN) {
+		pr_info("PF_BRIDGE: RTM_NEWNEIGH with invalid address\n");
+		return -EINVAL;
+	}
+
+	addr = nla_data(tb[NDA_LLADDR]);
+	if (!is_valid_ether_addr(addr)) {
+		pr_info("PF_BRIDGE: RTM_NEWNEIGH with invalid ether address\n");
+		return -EINVAL;
+	}
+
+	err = -EOPNOTSUPP;
+
+	/* Support fdb on master device the net/bridge default case */
+	if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
+	    (dev->priv_flags & IFF_BRIDGE_PORT)) {
+		master = dev->master;
+		err = master->netdev_ops->ndo_fdb_add(ndm, dev, addr,
+						      nlh->nlmsg_flags);
+		if (err)
+			goto out;
+		else
+			ndm->ndm_flags &= ~NTF_MASTER;
+	}
+
+	/* Embedded bridge, macvlan, and any other device support */
+	if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_add) {
+		err = dev->netdev_ops->ndo_fdb_add(ndm, dev, addr,
+						   nlh->nlmsg_flags);
+
+		if (!err)
+			ndm->ndm_flags &= ~NTF_SELF;
+	}
+out:
+	return err;
+}
+
+static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
+{
+	struct net *net = sock_net(skb->sk);
+	struct ndmsg *ndm;
+	struct nlattr *llattr;
+	struct net_device *dev;
+	int err = -EINVAL;
+	__u8 *addr;
+
+	if (nlmsg_len(nlh) < sizeof(*ndm))
+		return -EINVAL;
+
+	ndm = nlmsg_data(nlh);
+	if (ndm->ndm_ifindex == 0) {
+		pr_info("PF_BRIDGE: RTM_DELNEIGH with invalid ifindex\n");
+		return -EINVAL;
+	}
+
+	dev = __dev_get_by_index(net, ndm->ndm_ifindex);
+	if (dev == NULL) {
+		pr_info("PF_BRIDGE: RTM_DELNEIGH with unknown ifindex\n");
+		return -ENODEV;
+	}
+
+	llattr = nlmsg_find_attr(nlh, sizeof(*ndm), NDA_LLADDR);
+	if (llattr == NULL || nla_len(llattr) != ETH_ALEN) {
+		pr_info("PF_BRIGDE: RTM_DELNEIGH with invalid address\n");
+		return -EINVAL;
+	}
+
+	addr = nla_data(llattr);
+	err = -EOPNOTSUPP;
+
+	/* Support fdb on master device the net/bridge default case */
+	if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) &&
+	    (dev->priv_flags & IFF_BRIDGE_PORT)) {
+		struct net_device *master = dev->master;
+
+		if (master->netdev_ops->ndo_fdb_del)
+			err = master->netdev_ops->ndo_fdb_del(ndm, dev, addr);
+
+		if (err)
+			goto out;
+		else
+			ndm->ndm_flags &= ~NTF_MASTER;
+	}
+
+	/* Embedded bridge, macvlan, and any other device support */
+	if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_del) {
+		err = dev->netdev_ops->ndo_fdb_del(ndm, dev, addr);
+
+		if (!err)
+			ndm->ndm_flags &= ~NTF_SELF;
+	}
+out:
+	return err;
+}
+
+static int rtnl_fdb_dump(struct sk_buff *skb, struct netlink_callback *cb)
+{
+	int idx = 0;
+	struct net *net = sock_net(skb->sk);
+	struct net_device *dev;
+
+	rcu_read_lock();
+	for_each_netdev_rcu(net, dev) {
+		if (dev->priv_flags & IFF_BRIDGE_PORT) {
+			struct net_device *master = dev->master;
+			const struct net_device_ops *ops = master->netdev_ops;
+
+			if (ops->ndo_fdb_dump)
+				idx = ops->ndo_fdb_dump(skb, cb, dev, idx);
+		}
+
+		if (dev->netdev_ops->ndo_fdb_dump)
+			idx = dev->netdev_ops->ndo_fdb_dump(skb, cb, dev, idx);
+	}
+	rcu_read_unlock();
+
+	cb->args[0] = idx;
+	return skb->len;
+}
+
 /* Protected by RTNL sempahore.  */
 static struct rtattr **rta_buf;
 static int rtattr_max;
@@ -2150,5 +2298,9 @@ void __init rtnetlink_init(void)
 
 	rtnl_register(PF_UNSPEC, RTM_GETADDR, NULL, rtnl_dump_all, NULL);
 	rtnl_register(PF_UNSPEC, RTM_GETROUTE, NULL, rtnl_dump_all, NULL);
+
+	rtnl_register(PF_BRIDGE, RTM_NEWNEIGH, rtnl_fdb_add, NULL, NULL);
+	rtnl_register(PF_BRIDGE, RTM_DELNEIGH, rtnl_fdb_del, NULL, NULL);
+	rtnl_register(PF_BRIDGE, RTM_GETNEIGH, NULL, rtnl_fdb_dump, NULL);
 }
 

^ permalink raw reply related

* [net-next PATCH v2 0/8] Managing the forwarding database(FDB)
From: John Fastabend @ 2012-04-12  6:57 UTC (permalink / raw)
  To: shemminger, mst, davem, bhutchings, sri
  Cc: hadi, jeffrey.t.kirsher, netdev, gregory.v.rose, krkumar2

The following series is a submission for net-next to allow
embedded switches and other stacked devices other then the
Linux bridge to manage a forwarding database.

Previously posted and discussed here,

http://lists.openwall.net/netdev/2012/03/19/26

This version addresses feedback from Ben Hutchings to fix
a typo in the multicast dump routines and to better handle
error cases on add/del fdb. Notify hooks were added for
the NTF_SELF case as well to bring it inline with the
SW net/bridge.

Additionally this version changes the macvlan patch to use
a flag to disable promisc mode. This was decided on over
adding additional modes.

Thanks for the feedback and review. I've tested this with
the 'br' tool published by Stephen Hemminger and pktgen.

.John

---

Greg Rose (1):
      ixgbe: UTA table incorrectly programmed

John Fastabend (7):
      macvlan: add FDB bridge ops and macvlan flags
      ixgbe: allow RAR table to be updated in promisc mode
      ixgbe: enable FDB netdevice ops
      net: rtnetlink notify events for FDB NTF_SELF adds and deletes
      net: add fdb generic dump routine
      net: addr_list: add exclusive dev_uc_add and dev_mc_add
      net: add generic PF_BRIDGE:RTM_ FDB hooks


 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  121 ++++++++---
 drivers/net/macvlan.c                         |   61 +++++-
 include/linux/if_link.h                       |    3 
 include/linux/if_macvlan.h                    |    1 
 include/linux/neighbour.h                     |    3 
 include/linux/netdevice.h                     |   25 ++
 include/linux/rtnetlink.h                     |    4 
 net/bridge/br_device.c                        |    3 
 net/bridge/br_fdb.c                           |  128 +++---------
 net/bridge/br_netlink.c                       |   12 -
 net/bridge/br_private.h                       |   15 +
 net/core/dev_addr_lists.c                     |   97 ++++++++-
 net/core/rtnetlink.c                          |  267 +++++++++++++++++++++++++
 13 files changed, 567 insertions(+), 173 deletions(-)

-- 
Signature

^ permalink raw reply

* [net-next V7 PATCH] virtio-net: send gratuitous packets when needed
From: Jason Wang @ 2012-04-12  6:43 UTC (permalink / raw)
  To: netdev, rusty, virtualization, linux-kernel, mst

As hypervior does not have the knowledge of guest network configuration, it's
better to ask guest to send gratuitous packets when needed.

This patch implements VIRTIO_NET_F_GUEST_ANNOUNCE feature: hypervisor would
notice the guest when it thinks it's time for guest to announce the link
presnece. Guest tests VIRTIO_NET_S_ANNOUNCE bit during config change interrupt
and woule send gratuitous packets through netif_notify_peers() and ack the
notification through ctrl vq.

We need to make sure the atomicy of read and ack in guest otherwise we may ack
more times than being notified. This is done through handling the whole config
change interrupt in an non-reentrant workqueue.

Signed-off-by: Jason Wang <jasowang@redhat.com>

---

Changes from v6:
- move the whole event processing to system_nrt_wq
- introduce the config_enable and config_lock to synchronize with dev removing
and pm
- protect the ack with rtnl_lock

Changes from v5:
- notify the chain before acking the link annoucement
- ack the link announcement notification through control vq

Changes from v4:
- typos
- handle workqueue unconditionally
- move VIRTIO_NET_S_ANNOUNCE to bit 8 to separate rw bits from ro bits

Changes from v3:
- cancel the workqueue during freeze

Changes from v2:
- fix the race between unregister_dev() and workqueue
---
 drivers/net/virtio_net.c   |   64 +++++++++++++++++++++++++++++++++++++++++---
 include/linux/virtio_net.h |   14 ++++++++++
 2 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 4de2760..23403b6 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -66,12 +66,21 @@ struct virtnet_info {
 	/* Host will merge rx buffers for big packets (shake it! shake it!) */
 	bool mergeable_rx_bufs;
 
+	/* enable config space updates */
+	bool config_enable;
+
 	/* Active statistics */
 	struct virtnet_stats __percpu *stats;
 
 	/* Work struct for refilling if we run low on memory. */
 	struct delayed_work refill;
 
+	/* Work struct for config space updates */
+	struct work_struct config_work;
+
+	/* Lock for config space updates */
+	struct mutex config_lock;
+
 	/* Chain pages by the private ptr. */
 	struct page *pages;
 
@@ -781,6 +790,16 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
 	return status == VIRTIO_NET_OK;
 }
 
+static void virtnet_ack_link_announce(struct virtnet_info *vi)
+{
+	rtnl_lock();
+	if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_ANNOUNCE,
+				  VIRTIO_NET_CTRL_ANNOUNCE_ACK, NULL,
+				  0, 0))
+		dev_warn(&vi->dev->dev, "Failed to ack link announce.\n");
+	rtnl_unlock();
+}
+
 static int virtnet_close(struct net_device *dev)
 {
 	struct virtnet_info *vi = netdev_priv(dev);
@@ -952,20 +971,31 @@ static const struct net_device_ops virtnet_netdev = {
 #endif
 };
 
-static void virtnet_update_status(struct virtnet_info *vi)
+static void virtnet_config_changed_work(struct work_struct *work)
 {
+	struct virtnet_info *vi =
+		container_of(work, struct virtnet_info, config_work);
 	u16 v;
 
+	mutex_lock(&vi->config_lock);
+	if (!vi->config_enable)
+		goto done;
+
 	if (virtio_config_val(vi->vdev, VIRTIO_NET_F_STATUS,
 			      offsetof(struct virtio_net_config, status),
 			      &v) < 0)
-		return;
+		goto done;
+
+	if (v & VIRTIO_NET_S_ANNOUNCE) {
+		netif_notify_peers(vi->dev);
+		virtnet_ack_link_announce(vi);
+	}
 
 	/* Ignore unknown (future) status bits */
 	v &= VIRTIO_NET_S_LINK_UP;
 
 	if (vi->status == v)
-		return;
+		goto done;
 
 	vi->status = v;
 
@@ -976,13 +1006,15 @@ static void virtnet_update_status(struct virtnet_info *vi)
 		netif_carrier_off(vi->dev);
 		netif_stop_queue(vi->dev);
 	}
+done:
+	mutex_unlock(&vi->config_lock);
 }
 
 static void virtnet_config_changed(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
 
-	virtnet_update_status(vi);
+	queue_work(system_nrt_wq, &vi->config_work);
 }
 
 static int init_vqs(struct virtnet_info *vi)
@@ -1076,6 +1108,9 @@ static int virtnet_probe(struct virtio_device *vdev)
 		goto free;
 
 	INIT_DELAYED_WORK(&vi->refill, refill_work);
+	mutex_init(&vi->config_lock);
+	vi->config_enable = true;
+	INIT_WORK(&vi->config_work, virtnet_config_changed_work);
 	sg_init_table(vi->rx_sg, ARRAY_SIZE(vi->rx_sg));
 	sg_init_table(vi->tx_sg, ARRAY_SIZE(vi->tx_sg));
 
@@ -1111,7 +1146,7 @@ static int virtnet_probe(struct virtio_device *vdev)
 	   otherwise get link status from config. */
 	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
 		netif_carrier_off(dev);
-		virtnet_update_status(vi);
+		queue_work(system_nrt_wq, &vi->config_work);
 	} else {
 		vi->status = VIRTIO_NET_S_LINK_UP;
 		netif_carrier_on(dev);
@@ -1170,10 +1205,17 @@ static void __devexit virtnet_remove(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
 
+	/* Prevent config work handler from accessing the device. */
+	mutex_lock(&vi->config_lock);
+	vi->config_enable = false;
+	mutex_unlock(&vi->config_lock);
+
 	unregister_netdev(vi->dev);
 
 	remove_vq_common(vi);
 
+	flush_work(&vi->config_work);
+
 	free_percpu(vi->stats);
 	free_netdev(vi->dev);
 }
@@ -1183,6 +1225,11 @@ static int virtnet_freeze(struct virtio_device *vdev)
 {
 	struct virtnet_info *vi = vdev->priv;
 
+	/* Prevent config work handler from accessing the device */
+	mutex_lock(&vi->config_lock);
+	vi->config_enable = false;
+	mutex_unlock(&vi->config_lock);
+
 	virtqueue_disable_cb(vi->rvq);
 	virtqueue_disable_cb(vi->svq);
 	if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ))
@@ -1196,6 +1243,8 @@ static int virtnet_freeze(struct virtio_device *vdev)
 
 	remove_vq_common(vi);
 
+	flush_work(&vi->config_work);
+
 	return 0;
 }
 
@@ -1216,6 +1265,10 @@ static int virtnet_restore(struct virtio_device *vdev)
 	if (!try_fill_recv(vi, GFP_KERNEL))
 		queue_delayed_work(system_nrt_wq, &vi->refill, 0);
 
+	mutex_lock(&vi->config_lock);
+	vi->config_enable = true;
+	mutex_unlock(&vi->config_lock);
+
 	return 0;
 }
 #endif
@@ -1233,6 +1286,7 @@ static unsigned int features[] = {
 	VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO,
 	VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ,
 	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN,
+	VIRTIO_NET_F_GUEST_ANNOUNCE,
 };
 
 static struct virtio_driver virtio_net_driver = {
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index 970d5a2..2470f54 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -49,8 +49,11 @@
 #define VIRTIO_NET_F_CTRL_RX	18	/* Control channel RX mode support */
 #define VIRTIO_NET_F_CTRL_VLAN	19	/* Control channel VLAN filtering */
 #define VIRTIO_NET_F_CTRL_RX_EXTRA 20	/* Extra RX mode control support */
+#define VIRTIO_NET_F_GUEST_ANNOUNCE 21	/* Guest can announce device on the
+					 * network */
 
 #define VIRTIO_NET_S_LINK_UP	1	/* Link is up */
+#define VIRTIO_NET_S_ANNOUNCE	2	/* Announcement is needed */
 
 struct virtio_net_config {
 	/* The config defining mac address (if VIRTIO_NET_F_MAC) */
@@ -152,4 +155,15 @@ struct virtio_net_ctrl_mac {
  #define VIRTIO_NET_CTRL_VLAN_ADD             0
  #define VIRTIO_NET_CTRL_VLAN_DEL             1
 
+/*
+ * Control link announce acknowledgement
+ *
+ * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that
+ * driver has recevied the notification; device would clear the
+ * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives
+ * this command.
+ */
+#define VIRTIO_NET_CTRL_ANNOUNCE       3
+ #define VIRTIO_NET_CTRL_ANNOUNCE_ACK         0
+
 #endif /* _LINUX_VIRTIO_NET_H */

^ permalink raw reply related

* Re: [PATCH 4/4] net: Remove redundant spi driver bus initialization
From: Gabor Juhos @ 2012-04-12  6:23 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: linux-kernel, David S. Miller, Frederic Lambert, netdev
In-Reply-To: <1334091089-10138-4-git-send-email-lars@metafoo.de>

2012.04.10. 22:51 keltezéssel, Lars-Peter Clausen írta:
> In ancient times it was necessary to manually initialize the bus field of an
> spi_driver to spi_bus_type. These days this is done in spi_driver_register() so
> we can drop the manual assignment.
> 
> The patch was generated using the following coccinelle semantic patch:
> // <smpl>
> @@
> identifier _driver;
> @@
> struct spi_driver _driver = {
> 	.driver = {
> -		.bus = &spi_bus_type,
> 	},
> };
> // </smpl>
> 
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Gabor Juhos <juhosg@openwrt.org>
> Cc: Frederic Lambert <frdrc66@gmail.com>
> Cc: netdev@vger.kernel.org
> ---
>  drivers/net/phy/spi_ks8995.c |    1 -
>  1 file changed, 1 deletion(-)

Acked-by: Gabor Juhos <juhosg@openwrt.org>

^ permalink raw reply

* [PATCH] drivers/net: Remove CONFIG_WIZNET_TX_FLOW option
From: Mike Sinkovsky @ 2012-04-12  6:14 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: Mike Sinkovsky

This option was there for debugging race conditions,
just remove it, and assume TX_FLOW is always enabled.

Signed-off-by: Mike Sinkovsky <msink@permonline.ru>
---
This replaces patch from Paul Gortmaker:
"[PATCH 3/5] drivers/net: remove IS_ENABLED usage from wiznet drivers
The use of IS_ENABLED in C code (vs just in CPP #if directives)
causes us to carry the burden of a huge autoconf.h file.  It is
also misleading in that a casual inspection of the code would
leave one thinking that the if statements were evaluated at
runtime, when TX_FLOW is a Kconfig bool and hence evaluated
at configure time as an either/or."

Just remove this option instead.

 drivers/net/ethernet/wiznet/Kconfig |    8 --------
 drivers/net/ethernet/wiznet/w5100.c |    5 ++---
 drivers/net/ethernet/wiznet/w5300.c |    9 +++------
 3 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/net/ethernet/wiznet/Kconfig b/drivers/net/ethernet/wiznet/Kconfig
index c8291bf..cb18043 100644
--- a/drivers/net/ethernet/wiznet/Kconfig
+++ b/drivers/net/ethernet/wiznet/Kconfig
@@ -70,12 +70,4 @@ config WIZNET_BUS_ANY
 	  Performance may decrease compared to explicitly selected bus mode.
 endchoice
 
-config WIZNET_TX_FLOW
-	bool "Use transmit flow control"
-	depends on WIZNET_W5100 || WIZNET_W5300
-	default y
-	help
-	  This enables transmit flow control for WIZnet chips.
-	  If unsure, say Y.
-
 endif # NET_VENDOR_WIZNET
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index 157d2f0..22e2c5c 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -441,8 +441,7 @@ static int w5100_start_tx(struct sk_buff *skb, struct net_device *ndev)
 	struct w5100_priv *priv = netdev_priv(ndev);
 	u16 offset;
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW))
-		netif_stop_queue(ndev);
+	netif_stop_queue(ndev);
 
 	offset = w5100_read16(priv, W5100_S0_TX_WR);
 	w5100_writebuf(priv, offset, skb->data, skb->len);
@@ -517,7 +516,7 @@ static irqreturn_t w5100_interrupt(int irq, void *ndev_instance)
 	w5100_write(priv, W5100_S0_IR, ir);
 	mmiowb();
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW) && (ir & S0_IR_SENDOK)) {
+	if (ir & S0_IR_SENDOK) {
 		netif_dbg(priv, tx_done, ndev, "tx done\n");
 		netif_wake_queue(ndev);
 	}
diff --git a/drivers/net/ethernet/wiznet/w5300.c b/drivers/net/ethernet/wiznet/w5300.c
index 86d07bb..63cb9dd 100644
--- a/drivers/net/ethernet/wiznet/w5300.c
+++ b/drivers/net/ethernet/wiznet/w5300.c
@@ -273,9 +273,7 @@ static void w5300_hw_start(struct w5300_priv *priv)
 			  S0_MR_MACRAW : S0_MR_MACRAW_MF);
 	mmiowb();
 	w5300_command(priv, S0_CR_OPEN);
-	w5300_write(priv, W5300_S0_IMR, IS_ENABLED(CONFIG_WIZNET_TX_FLOW) ?
-					S0_IR_RECV | S0_IR_SENDOK :
-					S0_IR_RECV);
+	w5300_write(priv, W5300_S0_IMR, S0_IR_RECV | S0_IR_SENDOK);
 	w5300_write(priv, W5300_IMR, IR_S0);
 	mmiowb();
 }
@@ -371,8 +369,7 @@ static int w5300_start_tx(struct sk_buff *skb, struct net_device *ndev)
 {
 	struct w5300_priv *priv = netdev_priv(ndev);
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW))
-		netif_stop_queue(ndev);
+	netif_stop_queue(ndev);
 
 	w5300_write_frame(priv, skb->data, skb->len);
 	mmiowb();
@@ -439,7 +436,7 @@ static irqreturn_t w5300_interrupt(int irq, void *ndev_instance)
 	w5300_write(priv, W5300_S0_IR, ir);
 	mmiowb();
 
-	if (IS_ENABLED(CONFIG_WIZNET_TX_FLOW) && (ir & S0_IR_SENDOK)) {
+	if (ir & S0_IR_SENDOK) {
 		netif_dbg(priv, tx_done, ndev, "tx done\n");
 		netif_wake_queue(ndev);
 	}
-- 
1.6.3.3

^ permalink raw reply related


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