Skip to contentSkip to conversation

staging: lustre: lnet: remove dead code

PATCH Superseded Dmitriy Cherkasov 4 participants 12 messages Jun 29, 2017 – Jul 13, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: lnet: remove dead code

Remove code which was permanently disabled with ifdefs.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -6
index 5540de6..7c487fa 100644
@@ -521,13 +521,7 @@ struct ksock_proto {
 
 static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
 {
-#if 1
 	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
 }
 
 static inline int
Signature · 1 line
1.9.1
#1 lore raw
Quoted 17 lines · Dmitriy Cherkasov

Remove code which was permanently disabled with ifdefs.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 ------
 1 file changed, 6 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -0
index 5540de6..7c487fa 100644

drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h struct ksock_proto { · line 524

Quoted 5 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -1
@@ -521,13 +521,7 @@ struct ksock_proto {
 
 static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
 {
-#if 1
 	return crc32_le(crc, p, len);

Even better yet, why not just replace the callers of this tiny function, with crc32_le() instead and delete this useless wrapper?

thanks,

greg k-h

#2 lore raw

PATCH v2 1/1 staging: lustre: lnet: remove dead code and crc32_le() wrapper

In reply to Dmitriy Cherkasov

After removing code which was premanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h     | 11 -----------
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 10 +++++-----
 2 files changed, 5 insertions(+), 16 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-
 static inline int
 ksocknal_route_mask(void)
 {
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +5 -5
index 8a036f4..a3735da 100644
@@ -201,7 +201,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   iov[i].iov_base,
 							   fragnob);
 		}
@@ -243,7 +243,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   base, fragnob);
 
 			kunmap(kiov[i].bv_page);
@@ -265,7 +265,7 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
 			     tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
@@ -273,13 +273,13 @@
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
 					     tx->tx_iov[i].iov_len);
 	}
 
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper

Quoted 8 lines · Dmitriy Cherkasov

After removing code which was premanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

Please use checkpatch on your proposed patches before sending them.

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c

Quoted 1 line
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +0 -0

[]

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c line 206

Quoted 8 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +1 -1
@@ -201,7 +201,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   iov[i].iov_base,
 							   fragnob);

Please realign the subsequent lines to the open parenthesis.

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c line 247

Quoted 8 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +1 -1
 		}
@@ -243,7 +243,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   base, fragnob);

etc...

#4 lore raw

Re: [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper

Quoted 2 lines · Joe Perches

Please use checkpatch on your proposed patches before sending them.

Whoops! Sorry about that. Fixed and re-sent.

#5 lore raw

PATCH v3 1/1 staging: lustre: lnet: remove dead code and crc32_le() wrapper

In reply to Dmitriy Cherkasov

After removing code which was premanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h     | 11 -----------
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 14 +++++++-------
 2 files changed, 7 insertions(+), 18 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-
 static inline int
 ksocknal_route_mask(void)
 {
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +7 -7
index 8a036f4..5e7e4e1 100644
@@ -201,7 +201,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   iov[i].iov_base,
 							   fragnob);
 		}
@@ -243,7 +243,7 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
 							   base, fragnob);
 
 			kunmap(kiov[i].bv_page);
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
Signature · 1 line
1.9.1
#6 lore raw

PATCH v4 1/1 staging: lustre: lnet: remove dead code and crc32_le() wrapper

After removing code which was permanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was triggered by the dead code:

WARNING: space prohibited before semicolon

---

Changes since v3:
* fixed spacing issues
* fixed typo in commit message

 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h  | 11 -----------
 .../staging/lustre/lnet/klnds/socklnd/socklnd_lib.c  | 20 ++++++++++----------
 2 files changed, 10 insertions(+), 21 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-
 static inline int
 ksocknal_route_mask(void)
 {
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +10 -10
index 8a036f4..41715cd 100644
@@ -201,9 +201,9 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   iov[i].iov_base,
-							   fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+							iov[i].iov_base,
+							fragnob);
 		}
 		conn->ksnc_msg.ksm_csum = saved_csum;
 	}
@@ -243,8 +243,8 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   base, fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+							base, fragnob);
 
 			kunmap(kiov[i].bv_page);
 		}
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
Signature · 1 line
1.9.1
#7 lore raw

Re: [PATCH v4] staging: lustre: lnet: remove dead code and crc32_le() wrapper

Quoted 4 lines · Dmitriy Cherkasov

After removing code which was permanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

Any feedback on v4 please?

#8 lore raw

PATCH v5 1/1 staging: lustre: lnet: remove dead code and useless wrapper

In reply to Dmitriy Cherkasov

After removing commented out code, ksocknal_csum() becomes a useless wrapper for crc32_le(). Remove it, and instead call crc32_le() directly.

Fixes the following checkpatch warning:

WARNING: space prohibited before semicolon

---
v5:
- fix incomplete patch changelog
- improve code alignment
- reword commit message and summary to be more concise
v4:
- fix spacing issues
- fix typo in commit message
- add patch changelog
v3:
- fix spacing and alignment issues
(suggested by Joe Perches)
v2:
- remove ksocknal_csum() and call crc32_le() directly (suggested by Greg KH)
- update commit message and summary to reflect these changes

 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h  | 11 -----------
 .../staging/lustre/lnet/klnds/socklnd/socklnd_lib.c  | 20 ++++++++++----------
 2 files changed, 10 insertions(+), 21 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-
 static inline int
 ksocknal_route_mask(void)
 {
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +10 -10
index 8a036f4..9c328dc 100644
@@ -201,9 +201,9 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   iov[i].iov_base,
-							   fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      iov[i].iov_base,
+						      fragnob);
 		}
 		conn->ksnc_msg.ksm_csum = saved_csum;
 	}
@@ -243,8 +243,8 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   base, fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      base, fragnob);
 
 			kunmap(kiov[i].bv_page);
 		}
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
Signature · 1 line
1.9.1
Reviewed-by on v5 1/1
#9 lore raw

Re: [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper

Quoted 9 lines · Dmitriy Cherkasov

After removing commented out code, ksocknal_csum() becomes a useless wrapper for crc32_le(). Remove it, and instead call crc32_le() directly.

Fixes the following checkpatch warning:

WARNING: space prohibited before semicolon

Quoted 102 lines

---
v5:
- fix incomplete patch changelog
- improve code alignment
- reword commit message and summary to be more concise
v4:
- fix spacing issues
- fix typo in commit message
- add patch changelog
v3:
- fix spacing and alignment issues
(suggested by Joe Perches)
v2:
- remove ksocknal_csum() and call crc32_le() directly (suggested by Greg KH)
- update commit message and summary to reflect these changes

drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 11 ----------- .../staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 20 ++++++++++----------

2 files changed, 10 insertions(+), 21 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-

static inline int
ksocknal_route_mask(void)
{

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +10 -10
index 8a036f4..9c328dc 100644
@@ -201,9 +201,9 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   iov[i].iov_base,
-							   fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      iov[i].iov_base,
+						      fragnob);
 		}
 		conn->ksnc_msg.ksm_csum = saved_csum;
 	}
@@ -243,8 +243,8 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   base, fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      base, fragnob);
 
 			kunmap(kiov[i].bv_page);
 		}
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
Signature · 1 line
1.9.1

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation

Reviewed-by on v5 1/1
#10 lore raw

Re: [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper

In reply to Dmitriy Cherkasov
Quoted 9 lines · Dmitriy Cherkasov

After removing commented out code, ksocknal_csum() becomes a useless wrapper for crc32_le(). Remove it, and instead call crc32_le() directly.

Fixes the following checkpatch warning:

WARNING: space prohibited before semicolon

Quoted 102 lines

---
v5:
- fix incomplete patch changelog
- improve code alignment
- reword commit message and summary to be more concise
v4:
- fix spacing issues
- fix typo in commit message
- add patch changelog
v3:
- fix spacing and alignment issues
(suggested by Joe Perches)
v2:
- remove ksocknal_csum() and call crc32_le() directly (suggested by Greg KH)
- update commit message and summary to reflect these changes

drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 11 ----------- .../staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 20 ++++++++++----------

2 files changed, 10 insertions(+), 21 deletions(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h +0 -11
index 5540de6..9eb169d 100644
@@ -519,17 +519,6 @@ struct ksock_proto {
 #define CPU_MASK_NONE   0UL
 #endif
 
-static inline __u32 ksocknal_csum(__u32 crc, unsigned char const *p, size_t len)
-{
-#if 1
-	return crc32_le(crc, p, len);
-#else
-	while (len-- > 0)
-		crc = ((crc + 0x100) & ~0xff) | ((crc + *p++) & 0xff) ;
-	return crc;
-#endif
-}
-

static inline int
ksocknal_route_mask(void)
{

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c +10 -10
index 8a036f4..9c328dc 100644
@@ -201,9 +201,9 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   iov[i].iov_base,
-							   fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      iov[i].iov_base,
+						      fragnob);
 		}
 		conn->ksnc_msg.ksm_csum = saved_csum;
 	}
@@ -243,8 +243,8 @@
 			if (fragnob > sum)
 				fragnob = sum;
 
-			conn->ksnc_rx_csum = ksocknal_csum(conn->ksnc_rx_csum,
-							   base, fragnob);
+			conn->ksnc_rx_csum = crc32_le(conn->ksnc_rx_csum,
+						      base, fragnob);
 
 			kunmap(kiov[i].bv_page);
 		}
@@ -265,22 +265,22 @@
 
 	tx->tx_msg.ksm_csum = 0;
 
-	csum = ksocknal_csum(~0, tx->tx_iov[0].iov_base,
-			     tx->tx_iov[0].iov_len);
+	csum = crc32_le(~0, tx->tx_iov[0].iov_base,
+			tx->tx_iov[0].iov_len);
 
 	if (tx->tx_kiov) {
 		for (i = 0; i < tx->tx_nkiov; i++) {
 			base = kmap(tx->tx_kiov[i].bv_page) +
 			       tx->tx_kiov[i].bv_offset;
 
-			csum = ksocknal_csum(csum, base, tx->tx_kiov[i].bv_len);
+			csum = crc32_le(csum, base, tx->tx_kiov[i].bv_len);
 
 			kunmap(tx->tx_kiov[i].bv_page);
 		}
 	} else {
 		for (i = 1; i < tx->tx_niov; i++)
-			csum = ksocknal_csum(csum, tx->tx_iov[i].iov_base,
-					     tx->tx_iov[i].iov_len);
+			csum = crc32_le(csum, tx->tx_iov[i].iov_base,
+					tx->tx_iov[i].iov_len);
 	}
 
 	if (*ksocknal_tunables.ksnd_inject_csum_error) {
Signature · 1 line
1.9.1

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation

#11 lore raw

Re: [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper

In reply to Dmitriy Cherkasov
Quoted 7 lines · Dmitriy Cherkasov

After removing code which was premanently disabled with ifdefs, the function ksocknal_csum() becomes just a wrapper for crc32_le(). Remove this useless wrapper and instead call crc32_le() directly.

This also resolves the following checkpatch warning which was triggered by the dead code:

Quoted 7 lines

WARNING: space prohibited before semicolon

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h     | 11 -----------
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c | 14 +++++++-------
 2 files changed, 7 insertions(+), 18 deletions(-)

What changed from previous versions of this patch? You need to put that information below the --- line, as documented.

v4? :)

thanks,

greg k-h