Skip to contentSkip to conversation

Net patches

GIT PULL Applied Jason Wang 2 participants 5 messages Dec 6, 2016

lore
Share & tools
lore

Jason Wang

author
#0 lore raw

The following changes since commit bd8ef5060dd2124a54578241da9a572faf7658dd:

Merge remote-tracking branch 'dgibson/tags/ppc-for-2.8-20161201' into staging (2016-12-01 13:39:29 +0000)

are available in the git repository at:

https://github.com/jasowang/qemu.git tags/net-pull-request

for you to fetch changes up to 9f5832d34b0c155e9538a745c80e441aed257670:

fsl_etsec: Fix various small problems in hexdump code (2016-12-06 10:23:50 +0800)

----------------------------------------------------------------

Changes from V1:
- fix coding style

----------------------------------------------------------------
Andrey Smirnov (2):
fsl_etsec: Pad short payloads with zeros
fsl_etsec: Fix various small problems in hexdump code

Prasad J Pandit (1):
net: mcf: check receive buffer size register value

 hw/net/fsl_etsec/etsec.c | 4 ++--
 hw/net/fsl_etsec/rings.c | 8 ++++++++
 hw/net/mcf_fec.c         | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)
author
#1 lore raw

[Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value

From: Prasad J Pandit <[email protected]>

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.

---
 hw/net/mcf_fec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/net/mcf_fec.c +1 -1
index dc61bac..4025eb3 100644
@@ -393,7 +393,7 @@ static void mcf_fec_write(void *opaque, hwaddr addr,
         s->tx_descriptor = s->etdsr;
         break;
     case 0x188:
-        s->emrbr = value & 0x7f0;
+        s->emrbr = value > 0 ? value & 0x7F0 : 0x7F0;
         break;
     default:
         hw_error("mcf_fec_write Bad address 0x%x\n", (int)addr);
Signature · 1 line
2.7.4
author
#2 lore raw

[Qemu-devel] [PULL V2 2/3] fsl_etsec: Pad short payloads with zeros

In reply to Jason Wang

From: Andrey Smirnov <[email protected]>

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

---
 hw/net/fsl_etsec/rings.c | 8 ++++++++
 1 file changed, 8 insertions(+)
hw/net/fsl_etsec/rings.c +8 -0
index 79d2f14..54c0127 100644
@@ -474,6 +474,14 @@ static void rx_init_frame(eTSEC *etsec, const uint8_t *buf, size_t size)
     /* CRC padding (We don't have to compute the CRC) */
     etsec->rx_padding = 4;
 
+    /*
+     * Ensure that payload length + CRC length is at least 802.3
+     * minimum MTU size bytes long (64)
+     */
+    if (etsec->rx_buffer_len < 60) {
+        etsec->rx_padding += 60 - etsec->rx_buffer_len;
+    }
+
     etsec->rx_first_in_frame = 1;
     etsec->rx_remaining_data = etsec->rx_buffer_len;
     RING_DEBUG("%s: rx_buffer_len:%u rx_padding+crc:%u\n", __func__,
Signature · 1 line
2.7.4
author
#3 lore raw

[Qemu-devel] [PULL V2 3/3] fsl_etsec: Fix various small problems in hexdump code

In reply to Jason Wang

From: Andrey Smirnov <[email protected]>

Fix various small problems in hexdump code, such as:
- Reference to non-existing field etsec->nic->nc.name is replaced with nc->name

- Type mismatch warnings

---
 hw/net/fsl_etsec/etsec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/net/fsl_etsec/etsec.c +2 -2
index 951c5f0..fadf9c8 100644
@@ -348,8 +348,8 @@ static ssize_t etsec_receive(NetClientState *nc,
     eTSEC *etsec = qemu_get_nic_opaque(nc);
 
 #if defined(HEX_DUMP)
-    fprintf(stderr, "%s receive size:%d\n", etsec->nic->nc.name, size);
-    qemu_hexdump(buf, stderr, "", size);
+    fprintf(stderr, "%s receive size:%zd\n", nc->name, size);
+    qemu_hexdump((void *)buf, stderr, "", size);
 #endif
     /* Flush is unnecessary as are already in receiving path */
     etsec->need_flush = false;
Signature · 1 line
2.7.4
#4 lore raw
In reply to Jason Wang
Quoted 22 lines · Jason Wang

The following changes since commit bd8ef5060dd2124a54578241da9a572faf7658dd:

Merge remote-tracking branch 'dgibson/tags/ppc-for-2.8-20161201' into staging (2016-12-01 13:39:29 +0000)

are available in the git repository at:

https://github.com/jasowang/qemu.git tags/net-pull-request

for you to fetch changes up to 9f5832d34b0c155e9538a745c80e441aed257670:

fsl_etsec: Fix various small problems in hexdump code (2016-12-06 10:23:50 +0800)

----------------------------------------------------------------

Changes from V1:
- fix coding style

----------------------------------------------------------------
Andrey Smirnov (2):
fsl_etsec: Pad short payloads with zeros
fsl_etsec: Fix various small problems in hexdump code

Quoted 9 lines

Prasad J Pandit (1):
net: mcf: check receive buffer size register value

 hw/net/fsl_etsec/etsec.c | 4 ++--
 hw/net/fsl_etsec/rings.c | 8 ++++++++
 hw/net/mcf_fec.c         | 2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)

Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging

Stefan