* [Qemu-devel] [PULL V2 0/3] Net patches
@ 2016-12-06 2:32 Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value Jason Wang
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jason Wang @ 2016-12-06 2:32 UTC (permalink / raw)
To: peter.maydell, stefanha, qemu-devel; +Cc: 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
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(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value
2016-12-06 2:32 [Qemu-devel] [PULL V2 0/3] Net patches Jason Wang
@ 2016-12-06 2:32 ` Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 2/3] fsl_etsec: Pad short payloads with zeros Jason Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2016-12-06 2:32 UTC (permalink / raw)
To: peter.maydell, stefanha, qemu-devel; +Cc: Prasad J Pandit, Jason Wang
From: Prasad J Pandit <pjp@fedoraproject.org>
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: Wjjzhang <wjjzhang@tencent.com>
Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/mcf_fec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/net/mcf_fec.c b/hw/net/mcf_fec.c
index dc61bac..4025eb3 100644
--- a/hw/net/mcf_fec.c
+++ b/hw/net/mcf_fec.c
@@ -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);
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL V2 2/3] fsl_etsec: Pad short payloads with zeros
2016-12-06 2:32 [Qemu-devel] [PULL V2 0/3] Net patches Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value Jason Wang
@ 2016-12-06 2:32 ` Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 3/3] fsl_etsec: Fix various small problems in hexdump code Jason Wang
2016-12-06 10:24 ` [Qemu-devel] [PULL V2 0/3] Net patches Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2016-12-06 2:32 UTC (permalink / raw)
To: peter.maydell, stefanha, qemu-devel; +Cc: Andrey Smirnov, Jason Wang
From: Andrey Smirnov <andrew.smirnov@gmail.com>
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: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/fsl_etsec/rings.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c
index 79d2f14..54c0127 100644
--- a/hw/net/fsl_etsec/rings.c
+++ b/hw/net/fsl_etsec/rings.c
@@ -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__,
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [Qemu-devel] [PULL V2 3/3] fsl_etsec: Fix various small problems in hexdump code
2016-12-06 2:32 [Qemu-devel] [PULL V2 0/3] Net patches Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 2/3] fsl_etsec: Pad short payloads with zeros Jason Wang
@ 2016-12-06 2:32 ` Jason Wang
2016-12-06 10:24 ` [Qemu-devel] [PULL V2 0/3] Net patches Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2016-12-06 2:32 UTC (permalink / raw)
To: peter.maydell, stefanha, qemu-devel; +Cc: Andrey Smirnov, Jason Wang
From: Andrey Smirnov <andrew.smirnov@gmail.com>
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
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/fsl_etsec/etsec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c
index 951c5f0..fadf9c8 100644
--- a/hw/net/fsl_etsec/etsec.c
+++ b/hw/net/fsl_etsec/etsec.c
@@ -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;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PULL V2 0/3] Net patches
2016-12-06 2:32 [Qemu-devel] [PULL V2 0/3] Net patches Jason Wang
` (2 preceding siblings ...)
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 3/3] fsl_etsec: Fix various small problems in hexdump code Jason Wang
@ 2016-12-06 10:24 ` Stefan Hajnoczi
3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2016-12-06 10:24 UTC (permalink / raw)
To: Jason Wang; +Cc: peter.maydell, stefanha, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1237 bytes --]
On Tue, Dec 06, 2016 at 10:32:29AM +0800, Jason Wang wrote:
> 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(-)
>
>
Thanks, applied to my staging tree:
https://github.com/stefanha/qemu/commits/staging
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-12-06 10:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06 2:32 [Qemu-devel] [PULL V2 0/3] Net patches Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 1/3] net: mcf: check receive buffer size register value Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 2/3] fsl_etsec: Pad short payloads with zeros Jason Wang
2016-12-06 2:32 ` [Qemu-devel] [PULL V2 3/3] fsl_etsec: Fix various small problems in hexdump code Jason Wang
2016-12-06 10:24 ` [Qemu-devel] [PULL V2 0/3] Net patches Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).