* [Qemu-devel] [PATCH] make e1000 use the checksuming code
@ 2008-07-29 14:06 Gerd Hoffmann
2008-07-29 19:42 ` Anthony Liguori
0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2008-07-29 14:06 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
Hi,
This patch makes the e1000 nic driver use the checksumming code added
with the previous patch. That one better should be reviewed by someone
knowing the e1000 better than I do. I think I got it right though ...
cheers,
Gerd
--
http://kraxel.fedorapeople.org/xenner/
[-- Attachment #2: 0005-e1000-use-common-checksumming-code.patch --]
[-- Type: text/x-patch, Size: 1296 bytes --]
>From 6b61fa35c52092c6372e9d095e2131370cc151cd Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Tue, 29 Jul 2008 13:39:32 +0200
Subject: [PATCH 05/22] e1000: use common checksumming code.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/e1000.c | 20 ++++++--------------
1 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 1a14051..d81d9be 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -279,26 +279,18 @@ flash_eerd_read(E1000State *s, int x)
E1000_EEPROM_RW_REG_DONE | r;
}
-static unsigned int
-do_cksum(uint8_t *dp, uint8_t *de)
-{
- unsigned int bsum[2] = {0, 0}, i, sum;
-
- for (i = 1; dp < de; bsum[i^=1] += *dp++)
- ;
- sum = (bsum[0] << 8) + bsum[1];
- sum = (sum >> 16) + (sum & 0xffff);
- return ~(sum + (sum >> 16));
-}
-
static void
putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t css, uint32_t cse)
{
+ uint32_t sum;
+
if (cse && cse < n)
n = cse + 1;
- if (sloc < n-1)
+ if (sloc < n-1) {
+ sum = net_checksum_add(n-css, data+css);
cpu_to_be16wu((uint16_t *)(data + sloc),
- do_cksum(data + css, data + n));
+ net_checksum_finish(sum));
+ }
}
static void
--
1.5.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] make e1000 use the checksuming code
2008-07-29 14:06 [Qemu-devel] [PATCH] make e1000 use the checksuming code Gerd Hoffmann
@ 2008-07-29 19:42 ` Anthony Liguori
0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-07-29 19:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Gerd Hoffmann wrote:
> Hi,
>
> This patch makes the e1000 nic driver use the checksumming code added
> with the previous patch. That one better should be reviewed by someone
> knowing the e1000 better than I do. I think I got it right though ...
>
Applied this and the v2 of the checksumming patch. I reviewed the
checksumming code carefully for the e1000 and AFAICT, it's identical to
the old behaviour. It also tested for packet corruption and everything
appears okay.
Thanks.
Regards,
Anthony Liguori
> cheers,
> Gerd
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-07-29 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29 14:06 [Qemu-devel] [PATCH] make e1000 use the checksuming code Gerd Hoffmann
2008-07-29 19:42 ` Anthony Liguori
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).