[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-arm] [PATCH v3 04/30] imx_fec: Use ENET_FTRL to determine truncati
From: |
Andrey Smirnov |
Subject: |
[Qemu-arm] [PATCH v3 04/30] imx_fec: Use ENET_FTRL to determine truncation length |
Date: |
Mon, 6 Nov 2017 07:47:47 -0800 |
Frame truncation length, TRUNC_FL, is determined by the contents of
ENET_FTRL register, so convert the code to use it instead of a
hardcoded constant.
To avoid the case where TRUNC_FL is greater that ENET_MAX_FRAME_SIZE,
increase the value of the latter to its theoretical maximum of 16K.
Cc: Peter Maydell <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: Philippe Mathieu-Daudé <address@hidden>
Cc: address@hidden
Cc: address@hidden
Cc: address@hidden
Signed-off-by: Andrey Smirnov <address@hidden>
---
hw/net/imx_fec.c | 4 ++--
include/hw/net/imx_fec.h | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
index eb034ffd0c..dda0816fb3 100644
--- a/hw/net/imx_fec.c
+++ b/hw/net/imx_fec.c
@@ -1052,8 +1052,8 @@ static ssize_t imx_enet_receive(NetClientState *nc, const
uint8_t *buf,
crc_ptr = (uint8_t *) &crc;
/* Huge frames are truncted. */
- if (size > ENET_MAX_FRAME_SIZE) {
- size = ENET_MAX_FRAME_SIZE;
+ if (size > s->regs[ENET_FTRL]) {
+ size = s->regs[ENET_FTRL];
flags |= ENET_BD_TR | ENET_BD_LG;
}
diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h
index 4bc8f03ec2..0fcc4f0c71 100644
--- a/include/hw/net/imx_fec.h
+++ b/include/hw/net/imx_fec.h
@@ -86,7 +86,6 @@
#define ENET_TCCR3 393
#define ENET_MAX 400
-#define ENET_MAX_FRAME_SIZE 2032
/* EIR and EIMR */
#define ENET_INT_HB (1 << 31)
@@ -155,6 +154,8 @@
#define ENET_RCR_NLC (1 << 30)
#define ENET_RCR_GRS (1 << 31)
+#define ENET_MAX_FRAME_SIZE (1 << ENET_RCR_MAX_FL_LENGTH)
+
/* TCR */
#define ENET_TCR_GTS (1 << 0)
#define ENET_TCR_FDEN (1 << 2)
--
2.13.6
- [Qemu-arm] [PATCH v3 00/30] Initial i.MX7 support, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 03/30] imx_fec: Change queue flushing heuristics, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 05/30] imx_fec: Use MIN instead of explicit ternary operator, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 08/30] imx_fec: Use correct length for packet size, Andrey Smirnov, 2017/11/06
- [Qemu-arm] [PATCH v3 07/30] imx_fec: Add support for multiple Tx DMA rings, Andrey Smirnov, 2017/11/06