1. 10 1月, 2017 2 次提交
  2. 06 1月, 2017 2 次提交
    • A
      fsl_etsec: Fix Tx BD ring wrapping handling · 7e354ed4
      Andrey Smirnov 提交于
      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 <agraf@suse.de>
      Cc: Scott Wood <scottwood@freescale.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: qemu-devel@nongnu.org
      Signed-off-by: NAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      7e354ed4
    • H
      rtl8139: correctly handle PHY reset · 30a3e701
      Hervé Poussineau 提交于
      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: NHervé Poussineau <hpoussin@reactos.org>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      30a3e701
  3. 06 12月, 2016 1 次提交
  4. 05 12月, 2016 2 次提交
    • A
      fsl_etsec: Pad short payloads with zeros · 64f441d2
      Andrey Smirnov 提交于
      Depending on QEMU network setup it is possible for us to receive a
      complete Ethernet packet that is less 64 bytes long. One such example is
      when QEMU is configured to use a standalone TAP device (not set to be a
      part of any bridge) receives and ARP packet. In cases like that we need
      to add more than just 4-bytes of CRC padding and ensure that our payload
      is at least 60 bytes long, such that, when combined with CRC padding
      bytes the resulting size is at least 802.3 minimum MTU bytes
      long (64). Failing to do that results in code in etsec_walk_rx_ring()
      setting BD_RX_SH which, in turn, makes corresponding Linux driver of
      emulated host to reject buffer as a runt packet
      Signed-off-by: NAndrey Smirnov <andrew.smirnov@gmail.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      64f441d2
    • P
      net: mcf: check receive buffer size register value · 77d54985
      Prasad J Pandit 提交于
      ColdFire Fast Ethernet Controller uses a receive buffer size
      register(EMRBR) to hold maximum size of all receive buffers.
      It is set by a user before any operation. If it was set to be
      zero, ColdFire emulator would go into an infinite loop while
      receiving data in mcf_fec_receive. Add check to avoid it.
      Reported-by: NWjjzhang <wjjzhang@tencent.com>
      Signed-off-by: NPrasad J Pandit <pjp@fedoraproject.org>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      77d54985
  5. 15 11月, 2016 3 次提交
  6. 29 10月, 2016 5 次提交
  7. 26 10月, 2016 7 次提交
  8. 10 10月, 2016 5 次提交
  9. 04 10月, 2016 1 次提交
  10. 27 9月, 2016 12 次提交