@@ -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 */
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(-)