1. 09 5月, 2017 2 次提交
  2. 03 5月, 2017 1 次提交
  3. 07 4月, 2017 2 次提交
  4. 02 3月, 2017 1 次提交
  5. 28 2月, 2017 1 次提交
  6. 22 2月, 2017 1 次提交
  7. 21 2月, 2017 1 次提交
    • J
      virito-net: set queues after reset during xdp_set · 017b29c3
      Jason Wang 提交于
      We set queues before reset which will cause a crash[1]. This is
      because is_xdp_raw_buffer_queue() depends on the old xdp queue pairs
      number to do the correct detection. So fix this by
      
      - passing xdp queue pairs and current queue pairs to virtnet_reset()
      - change vi->xdp_qp after reset but before refill, to make sure both
        free_unused_bufs() and refill can make correct detection of XDP.
      - remove the duplicated queue pairs setting before virtnet_reset()
        since we will do it inside virtnet_reset()
      
      [1]
      
      [   74.328168] general protection fault: 0000 [#1] SMP
      [   74.328625] Modules linked in: nfsd xfs libcrc32c virtio_net virtio_pci
      [   74.329117] CPU: 0 PID: 2849 Comm: xdp2 Not tainted 4.10.0-rc7+ #499
      [   74.329577] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.10.1-0-g8891697-prebuilt.qemu-project.org 04/01/2014
      [   74.330424] task: ffff88007a894000 task.stack: ffffc90004388000
      [   74.330844] RIP: 0010:skb_release_head_state+0x28/0x80
      [   74.331298] RSP: 0018:ffffc9000438b8d0 EFLAGS: 00010206
      [   74.331676] RAX: 0000000000000000 RBX: ffff88007ad96300 RCX: 0000000000000000
      [   74.332217] RDX: ffff88007fc137a8 RSI: ffff88007fc0db28 RDI: 0001bf00000001be
      [   74.332758] RBP: ffffc9000438b8d8 R08: 000000000005008f R09: 00000000000005f9
      [   74.333274] R10: ffff88007d001700 R11: ffffffff820a8a4d R12: ffff88007ad96300
      [   74.333787] R13: 0000000000000002 R14: ffff880036604000 R15: 000077ff80000000
      [   74.334308] FS:  00007fc70d8a7b40(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
      [   74.334891] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [   74.335314] CR2: 00007fff4144a710 CR3: 000000007ab56000 CR4: 00000000003406f0
      [   74.335830] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [   74.336373] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [   74.336895] Call Trace:
      [   74.337086]  skb_release_all+0xd/0x30
      [   74.337356]  consume_skb+0x2c/0x90
      [   74.337607]  free_unused_bufs+0x1ff/0x270 [virtio_net]
      [   74.337988]  ? vp_synchronize_vectors+0x3b/0x60 [virtio_pci]
      [   74.338398]  virtnet_xdp+0x21e/0x440 [virtio_net]
      [   74.338741]  dev_change_xdp_fd+0x101/0x140
      [   74.339048]  do_setlink+0xcf4/0xd20
      [   74.339304]  ? symcmp+0xf/0x20
      [   74.339529]  ? mls_level_isvalid+0x52/0x60
      [   74.339828]  ? mls_range_isvalid+0x43/0x50
      [   74.340135]  ? nla_parse+0xa0/0x100
      [   74.340400]  rtnl_setlink+0xd4/0x120
      [   74.340664]  ? cpumask_next_and+0x30/0x50
      [   74.340966]  rtnetlink_rcv_msg+0x7f/0x1f0
      [   74.341259]  ? sock_has_perm+0x59/0x60
      [   74.341586]  ? napi_consume_skb+0xe2/0x100
      [   74.342010]  ? rtnl_newlink+0x890/0x890
      [   74.342435]  netlink_rcv_skb+0x92/0xb0
      [   74.342846]  rtnetlink_rcv+0x23/0x30
      [   74.343277]  netlink_unicast+0x162/0x210
      [   74.343677]  netlink_sendmsg+0x2db/0x390
      [   74.343968]  sock_sendmsg+0x33/0x40
      [   74.344233]  SYSC_sendto+0xee/0x160
      [   74.344482]  ? SYSC_bind+0xb0/0xe0
      [   74.344806]  ? sock_alloc_file+0x92/0x110
      [   74.345106]  ? fd_install+0x20/0x30
      [   74.345360]  ? sock_map_fd+0x3f/0x60
      [   74.345586]  SyS_sendto+0x9/0x10
      [   74.345790]  entry_SYSCALL_64_fastpath+0x1a/0xa9
      [   74.346086] RIP: 0033:0x7fc70d1b8f6d
      [   74.346312] RSP: 002b:00007fff4144a708 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      [   74.346785] RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007fc70d1b8f6d
      [   74.347244] RDX: 000000000000002c RSI: 00007fff4144a720 RDI: 0000000000000003
      [   74.347683] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000
      [   74.348544] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff4144bd90
      [   74.349082] R13: 0000000000000002 R14: 0000000000000002 R15: 00007fff4144cda0
      [   74.349607] Code: 00 00 00 55 48 89 e5 53 48 89 fb 48 8b 7f 58 48 85 ff 74 0e 40 f6 c7 01 74 3d 48 c7 43 58 00 00 00 00 48 8b 7b 68 48 85 ff 74 05 <f0> ff 0f 74 20 48 8b 43 60 48 85 c0 74 14 65 8b 15 f3 ab 8d 7e
      [   74.351008] RIP: skb_release_head_state+0x28/0x80 RSP: ffffc9000438b8d0
      [   74.351625] ---[ end trace fe6e19fd11cfc80b ]---
      
      Fixes: 2de2f7f4 ("virtio_net: XDP support for adjust_head")
      Cc: John Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      017b29c3
  8. 20 2月, 2017 1 次提交
  9. 07 2月, 2017 5 次提交
  10. 05 2月, 2017 1 次提交
  11. 04 2月, 2017 1 次提交
  12. 26 1月, 2017 3 次提交
  13. 25 1月, 2017 1 次提交
  14. 21 1月, 2017 1 次提交
  15. 09 1月, 2017 1 次提交
  16. 30 12月, 2016 1 次提交
  17. 25 12月, 2016 1 次提交
  18. 24 12月, 2016 9 次提交
  19. 18 12月, 2016 4 次提交
    • J
      virtio_net: xdp, add slowpath case for non contiguous buffers · 72979a6c
      John Fastabend 提交于
      virtio_net XDP support expects receive buffers to be contiguous.
      If this is not the case we enable a slowpath to allow connectivity
      to continue but at a significan performance overhead associated with
      linearizing data. To make it painfully aware to users that XDP is
      running in a degraded mode we throw an xdp buffer error.
      
      To linearize packets we allocate a page and copy the segments of
      the data, including the header, into it. After this the page can be
      handled by XDP code flow as normal.
      
      Then depending on the return code the page is either freed or sent
      to the XDP xmit path. There is no attempt to optimize this path.
      
      This case is being handled simple as a precaution in case some
      unknown backend were to generate packets in this form. To test this
      I had to hack qemu and force it to generate these packets. I do not
      expect this case to be generated by "real" backends.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      72979a6c
    • J
      virtio_net: add XDP_TX support · 56434a01
      John Fastabend 提交于
      This adds support for the XDP_TX action to virtio_net. When an XDP
      program is run and returns the XDP_TX action the virtio_net XDP
      implementation will transmit the packet on a TX queue that aligns
      with the current CPU that the XDP packet was processed on.
      
      Before sending the packet the header is zeroed.  Also XDP is expected
      to handle checksum correctly so no checksum offload  support is
      provided.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      56434a01
    • J
      virtio_net: add dedicated XDP transmit queues · 672aafd5
      John Fastabend 提交于
      XDP requires using isolated transmit queues to avoid interference
      with normal networking stack (BQL, NETDEV_TX_BUSY, etc). This patch
      adds a XDP queue per cpu when a XDP program is loaded and does not
      expose the queues to the OS via the normal API call to
      netif_set_real_num_tx_queues(). This way the stack will never push
      an skb to these queues.
      
      However virtio/vhost/qemu implementation only allows for creating
      TX/RX queue pairs at this time so creating only TX queues was not
      possible. And because the associated RX queues are being created I
      went ahead and exposed these to the stack and let the backend use
      them. This creates more RX queues visible to the network stack than
      TX queues which is worth mentioning but does not cause any issues as
      far as I can tell.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      672aafd5
    • J
      virtio_net: Add XDP support · f600b690
      John Fastabend 提交于
      This adds XDP support to virtio_net. Some requirements must be
      met for XDP to be enabled depending on the mode. First it will
      only be supported with LRO disabled so that data is not pushed
      across multiple buffers. Second the MTU must be less than a page
      size to avoid having to handle XDP across multiple pages.
      
      If mergeable receive is enabled this patch only supports the case
      where header and data are in the same buf which we can check when
      a packet is received by looking at num_buf. If the num_buf is
      greater than 1 and a XDP program is loaded the packet is dropped
      and a warning is thrown. When any_header_sg is set this does not
      happen and both header and data is put in a single buffer as expected
      so we check this when XDP programs are loaded.  Subsequent patches
      will process the packet in a degraded mode to ensure connectivity
      and correctness is not lost even if backend pushes packets into
      multiple buffers.
      
      If big packets mode is enabled and MTU/LRO conditions above are
      met then XDP is allowed.
      
      This patch was tested with qemu with vhost=on and vhost=off where
      mergeable and big_packet modes were forced via hard coding feature
      negotiation. Multiple buffers per packet was forced via a small
      test patch to vhost.c in the vhost=on qemu mode.
      Suggested-by: NShrijeet Mukherjee <shrijeet@gmail.com>
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f600b690
  20. 13 12月, 2016 1 次提交
  21. 07 12月, 2016 1 次提交