make e1000 use the checksuming code
PATCH 1/1 make e1000 use the checksuming code
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
Signature · 1 line
http://kraxel.fedorapeople.org/xenner/
Quoted 1 line
From
6b61fa35c52092c6372e9d095e2131370cc151cdMon Sep 17 00:00:00 2001
From: Gerd Hoffmann <[email protected]>
Date: Tue, 29 Jul 2008 13:39:32 +0200
Subject: [PATCH 05/22] e1000: use common checksumming code.
--- hw/e1000.c | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-)
hw/e1000.c +6 -14
@@ -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
Signature · 1 line
1.5.4.1
Quoted 6 lines · Gerd Hoffmann
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
Quoted 4 lines
cheers,
Gerd