From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: Keith Monahan <keith@techtravels.org>,
Richard Henderson <richard.henderson@linaro.org>,
Helge Deller <deller@gmx.de>
Subject: [PULL v2 6/8] i82596: Drop crc calculation
Date: Thu, 5 Nov 2026 23:31:20 +0100 [thread overview]
Message-ID: <20261105223122.8729-7-deller@kernel.org> (raw)
In-Reply-To: <20261105223122.8729-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
No need to calculate and add additional CRCs here.
Noticed-by: Keith Monahan <keith@techtravels.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
hw/net/i82596.c | 32 +++-----------------------------
1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/hw/net/i82596.c b/hw/net/i82596.c
index 35e0b58330..6bcae73815 100644
--- a/hw/net/i82596.c
+++ b/hw/net/i82596.c
@@ -180,7 +180,6 @@ static void examine_scb(I82596State *s);
static bool i82596_check_medium_status(I82596State *s);
static int i82596_csma_backoff(I82596State *s, int retry_count);
static uint16_t i82596_calculate_crc16(const uint8_t *data, size_t len);
-static size_t i82596_append_crc(I82596State *s, uint8_t *buffer, size_t len);
static void i82596_bus_throttle_timer(void *opaque);
static void i82596_flush_queue_timer(void *opaque);
static int i82596_flush_packet_queue(I82596State *s);
@@ -624,7 +623,7 @@ static int i82596_tx_copy_buffers(I82596State *s, hwaddr tfd_addr,
return total_len;
}
-static int i82596_tx_process_frame(I82596State *s, bool insert_crc)
+static int i82596_tx_process_frame(I82596State *s)
{
uint32_t total_len = s->tx_frame_len;
@@ -642,10 +641,6 @@ static int i82596_tx_process_frame(I82596State *s, bool insert_crc)
total_len = I596_MIN_FRAME_LEN;
}
- if (insert_crc) {
- total_len = i82596_append_crc(s, s->tx_buffer, total_len);
- }
-
s->tx_frame_len = total_len;
return total_len;
}
@@ -710,15 +705,12 @@ static void i82596_transmit(I82596State *s, uint32_t addr)
int collision_count = 0;
int frame_len;
bool success = true;
- bool insert_crc;
i82596_tx_tfd_read(s, tfd_addr, &tfd);
trace_i82596_tx_tfd(tfd_addr, tfd.status_bits, tfd.command,
tfd.link_addr, tfd.tbd_addr);
s->current_tx_desc = tfd_addr;
- insert_crc = (I596_NOCRC_INS == 0) && ((tfd.command & 0x10) == 0) &&
- !I596_LOOPBACK;
collision_count = i82596_tx_csma_cd(s, &tx_status);
if (collision_count < 0) {
success = false;
@@ -730,7 +722,8 @@ static void i82596_transmit(I82596State *s, uint32_t addr)
success = false;
goto tx_complete;
}
- frame_len = i82596_tx_process_frame(s, insert_crc);
+ /* QEMU net clients exchange frames without the FCS */
+ frame_len = i82596_tx_process_frame(s);
if (frame_len <= 0) {
tx_status |= TX_ABORTED_ERRORS;
success = false;
@@ -1401,25 +1394,6 @@ static uint16_t i82596_calculate_crc16(const uint8_t *data, size_t len)
return crc;
}
-static size_t i82596_append_crc(I82596State *s, uint8_t *buffer, size_t len)
-{
- if (len + 4 > PKT_BUF_SZ) {
- return len;
- }
-
- if (I596_CRC16_32) {
- uint32_t crc = crc32(~0, buffer, len);
- crc = cpu_to_be32(crc);
- memcpy(&buffer[len], &crc, sizeof(crc));
- return len + sizeof(crc);
- } else {
- uint16_t crc = i82596_calculate_crc16(buffer, len);
- crc = cpu_to_be16(crc);
- memcpy(&buffer[len], &crc, sizeof(crc));
- return len + sizeof(crc);
- }
-}
-
static void i82596_update_statistics(I82596State *s, bool is_tx,
uint16_t error_flags,
uint16_t collision_count)
--
2.54.0
next prev parent reply other threads:[~2026-11-05 22:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 22:31 [PULL v2 0/8] Hppa 715 cpu nic patches Helge Deller
2026-11-05 22:31 ` [PULL v2 1/8] target/hppa: Move emulated power button into CPU I/O region Helge Deller
2026-11-05 22:31 ` [PULL v2 2/8] target/hppa: Add special blr instruction for HP-UX 9.05 Helge Deller
2026-11-05 22:31 ` [PULL v2 3/8] lasi_i82596: Decode the PORT command from bits 3:0, not 7:0 Helge Deller
2026-11-05 22:31 ` [PULL v2 4/8] i82596: Implement 82596CA big-endian mode (SYSBUS bit 7) Helge Deller
2026-11-05 22:31 ` [PULL v2 5/8] i82596: Initialize variables at chip reset Helge Deller
2026-11-05 22:31 ` Helge Deller [this message]
2026-11-05 22:31 ` [PULL v2 7/8] i82596: Fix source address inserting Helge Deller
2026-11-05 22:31 ` [PULL v2 8/8] i82596: Various send- and transmit fixes for 715 Helge Deller
2026-11-06 16:46 ` [PULL v2 0/8] Hppa 715 cpu nic patches Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261105223122.8729-7-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=keith@techtravels.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.