Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Nov 2021 18:39:34 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 09100f936be0 - main - netinet: Remove in_cksum_update()
Message-ID:  <202111241839.1AOIdYeq095033@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=09100f936be0684aa8caef441b96345960fd9c72

commit 09100f936be0684aa8caef441b96345960fd9c72
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-11-24 18:15:40 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-24 18:31:15 +0000

    netinet: Remove in_cksum_update()
    
    It was never implemented on powerpc or riscv and appears to have been
    unused since it was added in 1998.  No functional change intended.
    
    Reviewed by:    kp, glebius, cy
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D33093
---
 sys/amd64/include/in_cksum.h   | 29 -----------------------------
 sys/i386/include/in_cksum.h    | 19 -------------------
 sys/mips/include/in_cksum.h    | 29 -----------------------------
 sys/powerpc/include/in_cksum.h | 29 -----------------------------
 4 files changed, 106 deletions(-)

diff --git a/sys/amd64/include/in_cksum.h b/sys/amd64/include/in_cksum.h
index 79d30cafbc90..89ff1097f369 100644
--- a/sys/amd64/include/in_cksum.h
+++ b/sys/amd64/include/in_cksum.h
@@ -45,35 +45,6 @@
 
 #define in_cksum(m, len)	in_cksum_skip(m, len, 0)
 
-#if defined(IPVERSION) && (IPVERSION == 4)
-/*
- * It it useful to have an Internet checksum routine which is inlineable
- * and optimized specifically for the task of computing IP header checksums
- * in the normal case (where there are no options and the header length is
- * therefore always exactly five 32-bit words.
- */
-#ifdef __CC_SUPPORTS___INLINE
-
-static __inline void
-in_cksum_update(struct ip *ip)
-{
-	int __tmpsum;
-	__tmpsum = (int)ntohs(ip->ip_sum) + 256;
-	ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
-}
-
-#else
-
-#define	in_cksum_update(ip) \
-	do { \
-		int __tmpsum; \
-		__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
-		ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
-	} while(0)
-
-#endif
-#endif
-
 #ifdef _KERNEL
 #if defined(IPVERSION) && (IPVERSION == 4)
 u_int in_cksum_hdr(const struct ip *ip);
diff --git a/sys/i386/include/in_cksum.h b/sys/i386/include/in_cksum.h
index 87c18ec4066d..a8214e97cd9a 100644
--- a/sys/i386/include/in_cksum.h
+++ b/sys/i386/include/in_cksum.h
@@ -83,14 +83,6 @@ in_cksum_hdr(const struct ip *ip)
 
 	return ~sum & 0xffff;
 }
-
-static __inline void
-in_cksum_update(struct ip *ip)
-{
-	int __tmpsum;
-	__tmpsum = (int)ntohs(ip->ip_sum) + 256;
-	ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
-}
 #endif
 
 static __inline u_short
@@ -123,17 +115,6 @@ in_pseudo(u_int sum, u_int b, u_int c)
 		sum -= 0xffff;
 	return (sum);
 }
-
-#else
-#if defined(IPVERSION) && (IPVERSION == 4)
-#define	in_cksum_update(ip) \
-	do { \
-		int __tmpsum; \
-		__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
-		ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
-	} while(0)
-
-#endif
 #endif
 
 #ifdef _KERNEL
diff --git a/sys/mips/include/in_cksum.h b/sys/mips/include/in_cksum.h
index d55b838b42ed..580fb9c024f8 100644
--- a/sys/mips/include/in_cksum.h
+++ b/sys/mips/include/in_cksum.h
@@ -42,35 +42,6 @@
 
 #define	in_cksum(m, len)	in_cksum_skip(m, len, 0)
 
-#if defined(IPVERSION) && (IPVERSION == 4)
-/*
- * It it useful to have an Internet checksum routine which is inlineable
- * and optimized specifically for the task of computing IP header checksums
- * in the normal case (where there are no options and the header length is
- * therefore always exactly five 32-bit words.
- */
-#ifdef __CC_SUPPORTS___INLINE
-
-static __inline void
-in_cksum_update(struct ip *ip)
-{
-	int __tmpsum;
-	__tmpsum = (int)ntohs(ip->ip_sum) + 256;
-	ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
-}
-
-#else
-
-#define	in_cksum_update(ip)						\
-	do {								\
-		int __tmpsum;						\
-		__tmpsum = (int)ntohs(ip->ip_sum) + 256;		\
-		ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));	\
-	} while(0)
-
-#endif
-#endif
-
 #ifdef _KERNEL
 #if defined(IPVERSION) && (IPVERSION == 4)
 u_int in_cksum_hdr(const struct ip *ip);
diff --git a/sys/powerpc/include/in_cksum.h b/sys/powerpc/include/in_cksum.h
index fd34e13d3822..7407b4ad7104 100644
--- a/sys/powerpc/include/in_cksum.h
+++ b/sys/powerpc/include/in_cksum.h
@@ -41,35 +41,6 @@
 
 #define in_cksum(m, len)	in_cksum_skip(m, len, 0)
 
-#if defined(IPVERSION) && (IPVERSION == 4)
-/*
- * It it useful to have an Internet checksum routine which is inlineable
- * and optimized specifically for the task of computing IP header checksums
- * in the normal case (where there are no options and the header length is
- * therefore always exactly five 32-bit words.
- */
-#ifdef __CC_SUPPORTS___INLINE
-
-static __inline void
-in_cksum_update(struct ip *ip)
-{
-	int __tmpsum;
-	__tmpsum = (int)ntohs(ip->ip_sum) + 256;
-	ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16));
-}
-
-#else
-
-#define	in_cksum_update(ip) \
-	do { \
-		int __tmpsum; \
-		__tmpsum = (int)ntohs(ip->ip_sum) + 256; \
-		ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \
-	} while(0)
-
-#endif
-#endif
-
 #ifdef _KERNEL
 #if defined(IPVERSION) && (IPVERSION == 4)
 u_int in_cksum_hdr(const struct ip *ip);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111241839.1AOIdYeq095033>