From: Wolfgang Denk <wd@pollux.(none)>
Date: Thu, 10 Nov 2005 19:59:46 +0000 (+0100)
Subject: Add explanation for CDP checksum algorithm
X-Git-Tag: v2025.01-rc5-pxa1908~23146
X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=3ada834e30a0742991209140049035c626ccea85;p=u-boot.git

Add explanation for CDP checksum algorithm
---

diff --git a/net/net.c b/net/net.c
index 2986924824..37c5fb698e 100644
--- a/net/net.c
+++ b/net/net.c
@@ -829,7 +829,10 @@ static ushort CDP_compute_csum(const uchar *buff, ushort len)
 		}
 		if (len) {
 			leftover = (signed short)(*(const signed char *)buff);
-			/* * XXX CISCO SUCKS big time! (and blows too) */
+			/* CISCO SUCKS big time! (and blows too):
+			 * CDP uses the IP checksum algorithm with a twist;
+			 * for the last byte it *sign* extends and sums.
+			 */
 			result = (result & 0xffff0000) | ((result + leftover) & 0x0000ffff);
 		}
 		while (result >> 16)