1. 29 1月, 2018 3 次提交
    • T
      net: Allow hubports to connect to other netdevs · 18d65d22
      Thomas Huth 提交于
      QEMU can emulate hubs to connect NICs and netdevs. This is currently
      primarily used for the mis-named 'vlan' feature of the networking
      subsystem. Now the 'vlan' feature has been marked as deprecated, since
      its name is rather confusing and the users often rather mis-configure
      their network when trying to use it. But while the 'vlan' parameter
      should be removed at one point in time, the basic idea of emulating
      a hub in QEMU is still good: It's useful for bundling up the output of
      multiple NICs into one single l2tp netdev for example.
      
      Now to be able to use the hubport feature without 'vlan's, there is one
      missing piece: The possibility to connect a hubport to a netdev, too.
      This patch adds this possibility by introducing a new "netdev=..."
      parameter to the hubports.
      
      To bundle up the output of multiple NICs into one socket netdev, you can
      now run QEMU with these parameters for example:
      
      qemu-system-ppc64 ... -netdev socket,id=s1,connect=:11122 \
          -netdev hubport,hubid=1,id=h1,netdev=s1 \
          -netdev hubport,hubid=1,id=h2 -device e1000,netdev=h2 \
          -netdev hubport,hubid=1,id=h3 -device virtio-net-pci,netdev=h3
      
      For using the socket netdev, you have got to start another QEMU as the
      receiving side first, for example with network dumping enabled:
      
      qemu-system-x86_64 -M isapc -netdev socket,id=s0,listen=:11122 \
          -device ne2k_isa,netdev=s0 \
          -object filter-dump,id=f1,netdev=s0,file=/tmp/dump.dat
      
      After the ppc64 guest tried to boot from both NICs, you can see in the
      dump file (using Wireshark, for example), that the output of both NICs
      (the e1000 and the virtio-net-pci) has been successfully transfered
      via the socket netdev in this case.
      Suggested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NThomas Huth <thuth@redhat.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      18d65d22
    • M
      colo: compare the packet based on the tcp sequence number · f449c9e5
      Mao Zhongyi 提交于
      Packet size some time different or when network is busy.
      Based on same payload size, but TCP protocol can not
      guarantee send the same one packet in the same way,
      
      like that:
      We send this payload:
      ------------------------------
      | header |1|2|3|4|5|6|7|8|9|0|
      ------------------------------
      
      primary:
      ppkt1:
      ----------------
      | header |1|2|3|
      ----------------
      ppkt2:
      ------------------------
      | header |4|5|6|7|8|9|0|
      ------------------------
      
      secondary:
      spkt1:
      ------------------------------
      | header |1|2|3|4|5|6|7|8|9|0|
      ------------------------------
      
      In the original method, ppkt1 and ppkt2 are different in size and
      spkt1, so they can't compare and trigger the checkpoint.
      
      I have tested FTP get 200M and 1G file many times, I found that
      the performance was less than 1% of the native.
      
      Now I reconstructed the comparison of TCP packets based on the
      TCP sequence number. first of all, ppkt1 and spkt1 have the same
      starting sequence number, so they can compare, even though their
      length is different. And then ppkt1 with a smaller payload length
      is used as the comparison length, if the payload is same, send
      out the ppkt1 and record the offset(the length of ppkt1 payload)
      in spkt1. The next comparison, ppkt2 and spkt1 can be compared
      from the recorded position of spkt1.
      
      like that:
      ----------------
      | header |1|2|3| ppkt1
      ---------|-----|
               |     |
      ---------v-----v--------------
      | header |1|2|3|4|5|6|7|8|9|0| spkt1
      ---------------|\------------|
                     | \offset     |
            ---------v-------------v
            | header |4|5|6|7|8|9|0| ppkt2
            ------------------------
      
      In this way, the performance can reach native 20% in my multiple
      tests.
      
      Cc: Zhang Chen <zhangckid@gmail.com>
      Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: NMao Zhongyi <maozy.fnst@cn.fujitsu.com>
      Signed-off-by: NLi Zhijian <lizhijian@cn.fujitsu.com>
      Signed-off-by: NZhang Chen <zhangckid@gmail.com>
      Reviewed-by: NZhang Chen <zhangckid@gmail.com>
      Tested-by: NZhang Chen <zhangckid@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      f449c9e5
    • M
      colo: modified the payload compare function · 9394133f
      Mao Zhongyi 提交于
      Modified the function colo_packet_compare_common to prepare for the
      tcp packet comparison in the next patch.
      
      Cc: Zhang Chen <zhangckid@gmail.com>
      Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: NMao Zhongyi <maozy.fnst@cn.fujitsu.com>
      Signed-off-by: NLi Zhijian <lizhijian@cn.fujitsu.com>
      Signed-off-by: NZhang Chen <zhangckid@gmail.com>
      Reviewed-by: NZhang Chen <zhangckid@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      9394133f
  2. 26 1月, 2018 22 次提交
  3. 25 1月, 2018 15 次提交