1. 24 12月, 2016 1 次提交
  2. 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
  3. 13 12月, 2016 1 次提交
  4. 07 12月, 2016 1 次提交
  5. 29 11月, 2016 1 次提交
    • J
      virtio-net: enable multiqueue by default · 44900010
      Jason Wang 提交于
      We use single queue even if multiqueue is enabled and let admin to
      enable it through ethtool later. This is used to avoid possible
      regression (small packet TCP stream transmission). But looks like an
      overkill since:
      
      - single queue user can disable multiqueue when launching qemu
      - brings extra troubles for the management since it needs extra admin
        tool in guest to enable multiqueue
      - multiqueue performs much better than single queue in most of the
        cases
      
      So this patch enables multiqueue by default: if #queues is less than or
      equal to #vcpu, enable as much as queue pairs; if #queues is greater
      than #vcpu, enable #vcpu queue pairs.
      
      Cc: Hannes Frederic Sowa <hannes@redhat.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Neil Horman <nhorman@redhat.com>
      Cc: Jeremy Eder <jeder@redhat.com>
      Cc: Marko Myllynen <myllynen@redhat.com>
      Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Acked-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      44900010
  6. 17 11月, 2016 1 次提交
  7. 08 11月, 2016 1 次提交
  8. 29 10月, 2016 1 次提交
  9. 21 10月, 2016 1 次提交
    • J
      net: use core MTU range checking in virt drivers · d0c2c997
      Jarod Wilson 提交于
      hyperv_net:
      - set min/max_mtu, per Haiyang, after rndis_filter_device_add
      
      virtio_net:
      - set min/max_mtu
      - remove virtnet_change_mtu
      
      vmxnet3:
      - set min/max_mtu
      
      xen-netback:
      - min_mtu = 0, max_mtu = 65517
      
      xen-netfront:
      - min_mtu = 0, max_mtu = 65535
      
      unisys/visor:
      - clean up defines a little to not clash with network core or add
        redundat definitions
      
      CC: netdev@vger.kernel.org
      CC: virtualization@lists.linux-foundation.org
      CC: "K. Y. Srinivasan" <kys@microsoft.com>
      CC: Haiyang Zhang <haiyangz@microsoft.com>
      CC: "Michael S. Tsirkin" <mst@redhat.com>
      CC: Shrikrishna Khare <skhare@vmware.com>
      CC: "VMware, Inc." <pv-drivers@vmware.com>
      CC: Wei Liu <wei.liu2@citrix.com>
      CC: Paul Durrant <paul.durrant@citrix.com>
      CC: David Kershner <david.kershner@unisys.com>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Reviewed-by: NHaiyang Zhang <haiyangz@microsoft.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      d0c2c997
  10. 03 9月, 2016 1 次提交
  11. 20 7月, 2016 1 次提交
  12. 14 6月, 2016 1 次提交
  13. 11 6月, 2016 1 次提交
  14. 07 6月, 2016 1 次提交
  15. 01 6月, 2016 1 次提交
  16. 17 3月, 2016 1 次提交
  17. 12 2月, 2016 1 次提交
  18. 08 2月, 2016 1 次提交
    • N
      virtio_net: add ethtool support for set and get of settings · 16032be5
      Nikolay Aleksandrov 提交于
      This patch allows the user to set and retrieve speed and duplex of the
      virtio_net device via ethtool. Having this functionality is very helpful
      for simulating different environments and also enables the virtio_net
      device to participate in operations where proper speed and duplex are
      required (e.g. currently bonding lacp mode requires full duplex). Custom
      speed and duplex are not allowed, the user-supplied settings are validated
      before applying.
      
      Example:
      $ ethtool eth1
      Settings for eth1:
      ...
      	Speed: Unknown!
      	Duplex: Unknown! (255)
      $ ethtool -s eth1 speed 1000 duplex full
      $ ethtool eth1
      Settings for eth1:
      ...
      	Speed: 1000Mb/s
      	Duplex: Full
      
      Based on a patch by Roopa Prabhu.
      Signed-off-by: NNikolay Aleksandrov <nikolay@cumulusnetworks.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      16032be5
  19. 07 12月, 2015 1 次提交
  20. 19 11月, 2015 2 次提交
    • E
      net: provide generic busy polling to all NAPI drivers · 93d05d4a
      Eric Dumazet 提交于
      NAPI drivers no longer need to observe a particular protocol
      to benefit from busy polling (CONFIG_NET_RX_BUSY_POLL=y)
      
      napi_hash_add() and napi_hash_del() are automatically called
      from core networking stack, respectively from
      netif_napi_add() and netif_napi_del()
      
      This patch depends on free_netdev() and netif_napi_del() being
      called from process context, which seems to be the norm.
      
      Drivers might still prefer to call napi_hash_del() on their
      own, since they might combine all the rcu grace periods into
      a single one, knowing their NAPI structures lifetime, while
      core networking stack has no idea of a possible combining.
      
      Once this patch proves to not bring serious regressions,
      we will cleanup drivers to either remove napi_hash_del()
      or provide appropriate rcu grace periods combining.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93d05d4a
    • E
      net: move skb_mark_napi_id() into core networking stack · 93f93a44
      Eric Dumazet 提交于
      We would like to automatically provide busy polling support
      to all NAPI drivers, without them having to implement anything.
      
      skb_mark_napi_id() can be called from napi_gro_receive() and
      napi_get_frags().
      
      Few drivers are still calling skb_mark_napi_id() because
      they use netif_receive_skb(). They should eventually call
      napi_gro_receive() instead. I will leave this to drivers
      maintainers.
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      93f93a44
  21. 28 8月, 2015 1 次提交
  22. 21 8月, 2015 1 次提交
  23. 07 8月, 2015 1 次提交
  24. 04 8月, 2015 1 次提交
    • E
      virtio_net: add gro capability · 0fbd050a
      Eric Dumazet 提交于
      Straightforward patch to add GRO processing to virtio_net.
      
      napi_complete_done() usage allows more aggressive aggregation,
      opted-in by setting /sys/class/net/xxx/gro_flush_timeout
      
      Tested:
      
      Setting /sys/class/net/xxx/gro_flush_timeout to 1000 nsec,
      Rick Jones reported following results.
      
      One VM of each on a pair of OpenStack compute nodes with E5-2650Lv3 CPUs
      and Intel 82599ES-based NICs. So, two "before" and two "after" VMs.
      The OpenStack compute nodes were running OpenStack Kilo, with VxLAN
      encapsulation being used through OVS so no GRO coming-up the host
      stack.  The compute nodes themselves were running a 3.14-based kernel.
      
      Single-stream netperf, CPU utilizations and thus service demands are
      based on intra-guest reported CPU.
      
      Throughput Mbit/s, bigger is better
              Min     Median  Average Max
      4.2.0-rc3+      1364    1686    1678    1938
      4.2.0-rc3+flush1k       1824    2269    2275    2647
      
      Send Service Demand, smaller is better
              Min     Median  Average Max
      4.2.0-rc3+      0.236   0.558   0.524   0.802
      4.2.0-rc3+flush1k       0.176   0.503   0.471   0.738
      
      Receive Service Demand, smaller is better.
              Min     Median  Average Max
      4.2.0-rc3+      1.906   2.188   2.191   2.531
      4.2.0-rc3+flush1k       0.448   0.529   0.533   0.692
      Signed-off-by: NEric Dumazet <edumazet@google.com>
      Tested-by: NRick Jones <rick.jones2@hp.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      0fbd050a
  25. 21 7月, 2015 1 次提交
  26. 07 4月, 2015 1 次提交
  27. 30 3月, 2015 1 次提交
  28. 25 3月, 2015 1 次提交
  29. 13 3月, 2015 1 次提交
    • J
      virtio-net: correctly delete napi hash · ab3971b1
      Jason Wang 提交于
      We don't delete napi from hash list during module exit. This will
      cause the following panic when doing module load and unload:
      
      BUG: unable to handle kernel paging request at 0000004e00000075
      IP: [<ffffffff816bd01b>] napi_hash_add+0x6b/0xf0
      PGD 3c5d5067 PUD 0
      Oops: 0000 [#1] SMP
      ...
      Call Trace:
      [<ffffffffa0a5bfb7>] init_vqs+0x107/0x490 [virtio_net]
      [<ffffffffa0a5c9f2>] virtnet_probe+0x562/0x791815639d880be [virtio_net]
      [<ffffffff8139e667>] virtio_dev_probe+0x137/0x200
      [<ffffffff814c7f2a>] driver_probe_device+0x7a/0x250
      [<ffffffff814c81d3>] __driver_attach+0x93/0xa0
      [<ffffffff814c8140>] ? __device_attach+0x40/0x40
      [<ffffffff814c6053>] bus_for_each_dev+0x63/0xa0
      [<ffffffff814c7a79>] driver_attach+0x19/0x20
      [<ffffffff814c76f0>] bus_add_driver+0x170/0x220
      [<ffffffffa0a60000>] ? 0xffffffffa0a60000
      [<ffffffff814c894f>] driver_register+0x5f/0xf0
      [<ffffffff8139e41b>] register_virtio_driver+0x1b/0x30
      [<ffffffffa0a60010>] virtio_net_driver_init+0x10/0x12 [virtio_net]
      
      This patch fixes this by doing this in virtnet_free_queues(). And also
      don't delete napi in virtnet_freeze() since it will call
      virtnet_free_queues() which has already did this.
      
      Fixes 91815639 ("virtio-net: rx busy polling support")
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      Acked-by: NMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: NMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ab3971b1
  30. 04 2月, 2015 1 次提交
  31. 23 1月, 2015 1 次提交
  32. 21 1月, 2015 1 次提交
  33. 31 12月, 2014 1 次提交
  34. 23 12月, 2014 1 次提交
    • H
      virtio_net: Fix napi poll list corruption · 8acdf999
      Herbert Xu 提交于
      The commit d75b1ade (net: less
      interrupt masking in NAPI) breaks virtio_net in an insidious way.
      
      It is now required that if the entire budget is consumed when poll
      returns, the napi poll_list must remain empty.  However, like some
      other drivers virtio_net tries to do a last-ditch check and if
      there is more work it will call napi_schedule and then immediately
      process some of this new work.  Should the entire budget be consumed
      while processing such new work then we will violate the new caller
      contract.
      
      This patch fixes this by not touching any work when we reschedule
      in virtio_net.
      
      The worst part of this bug is that the list corruption causes other
      napi users to be moved off-list.  In my case I was chasing a stall
      in IPsec (IPsec uses netif_rx) and I only belatedly realised that it
      was virtio_net which caused the stall even though the virtio_net
      poll was still functioning perfectly after IPsec stalled.
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      Acked-by: NJason Wang <jasowang@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8acdf999
  35. 09 12月, 2014 2 次提交