qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC PATCH 1/3] dp8393x: Store CRC using address_space_stl_le()


From: Philippe Mathieu-Daudé
Subject: [RFC PATCH 1/3] dp8393x: Store CRC using address_space_stl_le()
Date: Sat, 3 Jul 2021 17:02:17 +0200

The address_space API can handle endianess conversion.
Replace cpu_to_le32() + address_space_write() by a
single address_space_stl_le() call.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/net/dp8393x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index db9cfd786f5..99e179a5e86 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -802,7 +802,7 @@ static ssize_t dp8393x_receive(NetClientState *nc, const 
uint8_t * buf,
     s->regs[SONIC_TRBA0] = s->regs[SONIC_CRBA0];
 
     /* Calculate the ethernet checksum */
-    checksum = cpu_to_le32(crc32(0, buf, pkt_size));
+    checksum = crc32(0, buf, pkt_size);
 
     /* Put packet into RBA */
     trace_dp8393x_receive_packet(dp8393x_crba(s));
@@ -812,8 +812,8 @@ static ssize_t dp8393x_receive(NetClientState *nc, const 
uint8_t * buf,
     address += pkt_size;
 
     /* Put frame checksum into RBA */
-    address_space_write(&s->as, address, MEMTXATTRS_UNSPECIFIED,
-                        &checksum, sizeof(checksum));
+    address_space_stl_le(&s->as, address, checksum, MEMTXATTRS_UNSPECIFIED,
+                         NULL);
     address += sizeof(checksum);
 
     /* Pad short packets to keep pointers aligned */
-- 
2.31.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]