qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 646c54: record/replay: add network support


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 646c54: record/replay: add network support
Date: Fri, 06 Jan 2017 07:30:03 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 646c5478c04297485e3e045cd8969d2ae7642004
      
https://github.com/qemu/qemu/commit/646c5478c04297485e3e045cd8969d2ae7642004
  Author: Pavel Dovgalyuk <address@hidden>
  Date:   2017-01-06 (Fri, 06 Jan 2017)

  Changed paths:
    M docs/replay.txt
    M include/sysemu/replay.h
    M net/Makefile.objs
    A net/filter-replay.c
    M replay/Makefile.objs
    M replay/replay-events.c
    M replay/replay-internal.h
    A replay/replay-net.c
    M replay/replay.c
    M vl.c

  Log Message:
  -----------
  record/replay: add network support

This patch adds support of recording and replaying network packets in
irount rr mode.

Record and replay for network interactions is performed with the network filter.
Each backend must have its own instance of the replay filter as follows:
 -netdev user,id=net1 -device rtl8139,netdev=net1
 -object filter-replay,id=replay,netdev=net1

Replay network filter is used to record and replay network packets. While
recording the virtual machine this filter puts all packets coming from
the outer world into the log. In replay mode packets from the log are
injected into the network device. All interactions with network backend
in replay mode are disabled.

v5 changes:
 - using iov_to_buf function instead of loop

Signed-off-by: Pavel Dovgalyuk <address@hidden>
Signed-off-by: Jason Wang <address@hidden>


  Commit: 30a3e70167d0b8db9ea057f270cf18d93c153ed1
      
https://github.com/qemu/qemu/commit/30a3e70167d0b8db9ea057f270cf18d93c153ed1
  Author: Hervé Poussineau <address@hidden>
  Date:   2017-01-06 (Fri, 06 Jan 2017)

  Changed paths:
    M hw/net/rtl8139.c

  Log Message:
  -----------
  rtl8139: correctly handle PHY reset

According to datasheet:
"[Bit 15 of Basic Mode Control Register] sets the status and control registers
of the PHY (register 0062-0074) in a default state. This bit is self-clearing.
1 = software reset; 0 = normal operation."

This fixes the netcard detection failure in Minoca OS.

Signed-off-by: Hervé Poussineau <address@hidden>
Signed-off-by: Jason Wang <address@hidden>


  Commit: 7e354ed4df9787ff95cdb189374739e476be4f9a
      
https://github.com/qemu/qemu/commit/7e354ed4df9787ff95cdb189374739e476be4f9a
  Author: Andrey Smirnov <address@hidden>
  Date:   2017-01-06 (Fri, 06 Jan 2017)

  Changed paths:
    M hw/net/fsl_etsec/rings.c

  Log Message:
  -----------
  fsl_etsec: Fix Tx BD ring wrapping handling

Current code that handles Tx buffer desciprtor ring scanning employs the
following algorithm:

        1. Restore current buffer descriptor pointer from TBPTRn

        2. Process current descriptor

        3. If current descriptor has BD_WRAP flag set set current
           descriptor pointer to start of the descriptor ring

        4. If current descriptor points to start of the ring exit the
           loop, otherwise increment current descriptor pointer and go
           to #2

        5. Store current descriptor in TBPTRn

The way the code is implemented results in buffer descriptor ring being
scanned starting at offset/descriptor #0. While covering 99% of the
cases, this algorithm becomes problematic for a number of edge cases.

Consider the following scenario: guest OS driver initializes descriptor
ring to N individual descriptors and starts sending data out. Depending
on the volume of traffic and probably guest OS driver implementation it
is possible that an edge case where a packet, spread across 2
descriptors is placed in descriptors N - 1 and 0 in that order(it is
easy to imagine similar examples involving more than 2 descriptors).

What happens then is aforementioned algorithm starts at descriptor 0,
sees a descriptor marked as BD_LAST, which it happily sends out as a
separate packet(very much malformed at this point) then the iteration
continues and the first part of the original packet is tacked to the
next transmission which ends up being bogus as well.

This behvaiour can be pretty reliably observed when scp'ing data from a
guest OS via TAP interface for files larger than 160K (every time for
700K+).

This patch changes the scanning algorithm to do the following:

        1. Restore "current" buffer descriptor pointer from
           TBPTRn

        2. If "current" descriptor does not have BD_TX_READY set, goto #6

        3. Process current descriptor

        4. If "current" descriptor has BD_WRAP flag set "current"
           descriptor pointer to start of the descriptor ring otherwise
           set increment "current" by the size of one descriptor

        5. Goto #1

        6. Save "current" buffer descriptor in TBPTRn

This way we preserve the information about which descriptor was
processed last and always start where we left off avoiding the original
problem. On top of that, judging by the following excerpt from
MPC8548ERM (p. 14-48):

"... When the end of the TxBD ring is reached, eTSEC initializes TBPTRn
to the value in the corresponding TBASEn. The TBPTR register is
internally written by the eTSEC’s DMA controller during
transmission. The pointer increments by eight (bytes) each time a
descriptor is closed successfully by the eTSEC..."

revised algorithm might also a more correct way of emulating this aspect
of eTSEC peripheral.

Cc: Alexander Graf <address@hidden>
Cc: Scott Wood <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: address@hidden
Signed-off-by: Andrey Smirnov <address@hidden>
Signed-off-by: Jason Wang <address@hidden>


  Commit: a01b1e9a005d523ec6452ec7137885d11f8a30df
      
https://github.com/qemu/qemu/commit/a01b1e9a005d523ec6452ec7137885d11f8a30df
  Author: Peter Maydell <address@hidden>
  Date:   2017-01-06 (Fri, 06 Jan 2017)

  Changed paths:
    M docs/replay.txt
    M hw/net/fsl_etsec/rings.c
    M hw/net/rtl8139.c
    M include/sysemu/replay.h
    M net/Makefile.objs
    A net/filter-replay.c
    M replay/Makefile.objs
    M replay/replay-events.c
    M replay/replay-internal.h
    A replay/replay-net.c
    M replay/replay.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into 
staging

# gpg: Signature made Fri 06 Jan 2017 02:55:49 GMT
# gpg:                using RSA key 0xEF04965B398D6211
# gpg: Good signature from "Jason Wang (Jason Wang on RedHat) <address@hidden>"
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 215D 46F4 8246 689E C77F  3562 EF04 965B 398D 6211

* remotes/jasowang/tags/net-pull-request:
  fsl_etsec: Fix Tx BD ring wrapping handling
  rtl8139: correctly handle PHY reset
  record/replay: add network support

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/e92fbc753df4...a01b1e9a005d

reply via email to

[Prev in Thread] Current Thread [Next in Thread]