Patchwork [v6,1/3] rtl8139: cleanup FCS calculation

login
register
mail settings
Submitter Benjamin Poirier
Date March 11, 2011, 12:35 a.m.
Message ID <1299803757-26812-2-git-send-email-benjamin.poirier@gmail.com>
Download mbox | patch
Permalink /patch/86345/
State New
Headers show

Comments

Benjamin Poirier - March 11, 2011, 12:35 a.m.
clean out ifdef's around ethernet checksum calculation

Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
---
 hw/rtl8139.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)
Igor V. Kovalenko - March 11, 2011, 5:35 a.m.
On Fri, Mar 11, 2011 at 3:35 AM, Benjamin Poirier
<benjamin.poirier@gmail.com> wrote:
> clean out ifdef's around ethernet checksum calculation
>
> Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
> Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> ---
>  hw/rtl8139.c |   20 +++-----------------
>  1 files changed, 3 insertions(+), 17 deletions(-)

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Michael S. Tsirkin - March 11, 2011, 6:44 a.m.
On Fri, Mar 11, 2011 at 08:35:10AM +0300, Igor Kovalenko wrote:
> On Fri, Mar 11, 2011 at 3:35 AM, Benjamin Poirier
> <benjamin.poirier@gmail.com> wrote:
> > clean out ifdef's around ethernet checksum calculation
> >
> > Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
> > Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Blue Swirl <blauwirbel@gmail.com>
> > ---
> >  hw/rtl8139.c |   20 +++-----------------
> >  1 files changed, 3 insertions(+), 17 deletions(-)
> 
> Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

I think you mean Acked-by or Tested-by.  Signed-off-by is for when you
forward someone's patch to the list.

> -- 
> Kind regards,
> Igor V. Kovalenko
Igor V. Kovalenko - March 11, 2011, 6:49 a.m.
On Fri, Mar 11, 2011 at 3:35 AM, Benjamin Poirier
<benjamin.poirier@gmail.com> wrote:
> clean out ifdef's around ethernet checksum calculation
>
> Signed-off-by: Benjamin Poirier <benjamin.poirier@gmail.com>
> Cc: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> ---
>  hw/rtl8139.c |   20 +++-----------------
>  1 files changed, 3 insertions(+), 17 deletions(-)
>

Acked-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>

Patch

diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index a22530c..3772ac1 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -47,6 +47,9 @@ 
  *                                  Darwin)
  */
 
+/* For crc32 */
+#include <zlib.h>
+
 #include "hw.h"
 #include "pci.h"
 #include "qemu-timer.h"
@@ -62,14 +65,6 @@ 
 /* debug RTL8139 card C+ mode only */
 //#define DEBUG_RTL8139CP 1
 
-/* Calculate CRCs properly on Rx packets */
-#define RTL8139_CALCULATE_RXCRC 1
-
-#if defined(RTL8139_CALCULATE_RXCRC)
-/* For crc32 */
-#include <zlib.h>
-#endif
-
 #define SET_MASKED(input, mask, curr) \
     ( ( (input) & ~(mask) ) | ( (curr) & (mask) ) )
 
@@ -1030,11 +1025,7 @@  static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_
         }
 
         /* write checksum */
-#if defined (RTL8139_CALCULATE_RXCRC)
         val = cpu_to_le32(crc32(0, buf, size));
-#else
-        val = 0;
-#endif
         cpu_physical_memory_write( rx_addr+size, (uint8_t *)&val, 4);
 
 /* first segment of received packet flag */
@@ -1136,12 +1127,7 @@  static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_
         rtl8139_write_buffer(s, buf, size);
 
         /* write checksum */
-#if defined (RTL8139_CALCULATE_RXCRC)
         val = cpu_to_le32(crc32(0, buf, size));
-#else
-        val = 0;
-#endif
-
         rtl8139_write_buffer(s, (uint8_t *)&val, 4);
 
         /* correct buffer write pointer */