[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH-for-9.0? 1/2] hw/net/lan9118: Replace magic '2048' value by 'PKT_
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH-for-9.0? 1/2] hw/net/lan9118: Replace magic '2048' value by 'PKT_SIZE' definition |
Date: |
Mon, 8 Apr 2024 12:51:48 +0200 |
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/net/lan9118.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
index 47ff25b441..7be0430ac5 100644
--- a/hw/net/lan9118.c
+++ b/hw/net/lan9118.c
@@ -150,6 +150,8 @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
#define GPT_TIMER_EN 0x20000000
+#define PKT_SIZE 2048
+
enum tx_state {
TX_IDLE,
TX_B,
@@ -166,7 +168,7 @@ typedef struct {
int32_t pad;
int32_t fifo_used;
int32_t len;
- uint8_t data[2048];
+ uint8_t data[PKT_SIZE];
} LAN9118Packet;
static const VMStateDescription vmstate_lan9118_packet = {
@@ -182,7 +184,7 @@ static const VMStateDescription vmstate_lan9118_packet = {
VMSTATE_INT32(pad, LAN9118Packet),
VMSTATE_INT32(fifo_used, LAN9118Packet),
VMSTATE_INT32(len, LAN9118Packet),
- VMSTATE_UINT8_ARRAY(data, LAN9118Packet, 2048),
+ VMSTATE_UINT8_ARRAY(data, LAN9118Packet, PKT_SIZE),
VMSTATE_END_OF_LIST()
}
};
@@ -544,7 +546,7 @@ static ssize_t lan9118_receive(NetClientState *nc, const
uint8_t *buf,
return -1;
}
- if (size >= 2048 || size < 14) {
+ if (size >= PKT_SIZE || size < 14) {
return -1;
}
--
2.41.0