Skip to contentSkip to conversation

Net patches

GIT PULL Jason Wang 3 participants 7 messages Dec 5, 2016 – 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 18766d28848f2a4c309e78c6706b872f2cb32786:

fsl_etsec: Fix various small problems in hexdump code (2016-12-05 17:45:14 +0800)

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

----------------------------------------------------------------
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 | 7 +++++++
 hw/net/mcf_fec.c         | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)
author
#1 lore raw

[Qemu-devel] [PULL 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 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
author
#3 lore raw

[Qemu-devel] [PULL 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 | 7 +++++++
 1 file changed, 7 insertions(+)
hw/net/fsl_etsec/rings.c +7 -0
index 79d2f14..1434c91 100644
@@ -474,6 +474,13 @@ 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
#4 lore raw
In reply to Jason Wang
Your series seems to have some coding style problems. See output below for more information:

Hi,

Your series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 0/3] Net patches
Type: series
Message-id: [email protected]

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

# Useful git options
git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 Switched to a new branch 'test'
18cd9a6 fsl_etsec: Fix various small problems in hexdump code 947509b fsl_etsec: Pad short payloads with zeros e2362ab net: mcf: check receive buffer size register value

=== OUTPUT BEGIN ===
Checking PATCH 1/3: net: mcf: check receive buffer size register value... Checking PATCH 2/3: fsl_etsec: Pad short payloads with zeros...
ERROR: braces {} are necessary for all arms of this statement #33: FILE: hw/net/fsl_etsec/rings.c:481:
+ if (etsec->rx_buffer_len < 60)
[...]

total: 1 errors, 0 warnings, 13 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/3: fsl_etsec: Fix various small problems in hexdump code... === OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#5 lore raw
In reply to Jason Wang
Quoted 6 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:

Quoted 7 lines

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

for you to fetch changes up to 18766d28848f2a4c309e78c6706b872f2cb32786:

fsl_etsec: Fix various small problems in hexdump code (2016-12-05 17:45:14 +0800)

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

Please resend with the coding style violation fixed. See the patchew email for details.

author
#6 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 8 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

Quoted 7 lines
Quoted 5 lines

for you to fetch changes up to 18766d28848f2a4c309e78c6706b872f2cb32786:

fsl_etsec: Fix various small problems in hexdump code (2016-12-05 17:45:14 +0800)

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

Please resend with the coding style violation fixed. See the patchew email for details.

V2 posted.

Thanks