diff mbox

[v2,08/17] net/dp8393x: always calculate proper checksums

Message ID 1432729200-5322-9-git-send-email-hpoussin@reactos.org
State New
Headers show

Commit Message

Hervé Poussineau May 27, 2015, 12:19 p.m. UTC
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/net/dp8393x.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Aurelien Jarno June 2, 2015, 11:03 a.m. UTC | #1
On 2015-05-27 14:19, Hervé Poussineau wrote:
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  hw/net/dp8393x.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
> index 2297231..093f0cc 100644
> --- a/hw/net/dp8393x.c
> +++ b/hw/net/dp8393x.c
> @@ -21,16 +21,10 @@
>  #include "qemu/timer.h"
>  #include "net/net.h"
>  #include "hw/mips/mips.h"
> +#include <zlib.h>
>  
>  //#define DEBUG_SONIC
>  
> -/* Calculate CRCs properly on Rx packets */
> -#define SONIC_CALCULATE_RXCRC
> -
> -#if defined(SONIC_CALCULATE_RXCRC)
> -/* For crc32 */
> -#include <zlib.h>
> -#endif
>  
>  #ifdef DEBUG_SONIC
>  #define DPRINTF(fmt, ...) \
> @@ -764,11 +758,7 @@ static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
>      s->regs[SONIC_TRBA0] = s->regs[SONIC_CRBA0];
>  
>      /* Calculate the ethernet checksum */
> -#ifdef SONIC_CALCULATE_RXCRC
>      checksum = cpu_to_le32(crc32(0, buf, rx_len));
> -#else
> -    checksum = 0;
> -#endif
>  
>      /* Put packet into RBA */
>      DPRINTF("Receive packet at %08x\n", (s->regs[SONIC_CRBA1] << 16) | s->regs[SONIC_CRBA0]);

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
diff mbox

Patch

diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 2297231..093f0cc 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -21,16 +21,10 @@ 
 #include "qemu/timer.h"
 #include "net/net.h"
 #include "hw/mips/mips.h"
+#include <zlib.h>
 
 //#define DEBUG_SONIC
 
-/* Calculate CRCs properly on Rx packets */
-#define SONIC_CALCULATE_RXCRC
-
-#if defined(SONIC_CALCULATE_RXCRC)
-/* For crc32 */
-#include <zlib.h>
-#endif
 
 #ifdef DEBUG_SONIC
 #define DPRINTF(fmt, ...) \
@@ -764,11 +758,7 @@  static ssize_t nic_receive(NetClientState *nc, const uint8_t * buf, size_t size)
     s->regs[SONIC_TRBA0] = s->regs[SONIC_CRBA0];
 
     /* Calculate the ethernet checksum */
-#ifdef SONIC_CALCULATE_RXCRC
     checksum = cpu_to_le32(crc32(0, buf, rx_len));
-#else
-    checksum = 0;
-#endif
 
     /* Put packet into RBA */
     DPRINTF("Receive packet at %08x\n", (s->regs[SONIC_CRBA1] << 16) | s->regs[SONIC_CRBA0]);