linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: lnet: remove dead code
@ 2017-06-29  4:42 Dmitriy Cherkasov
  2017-06-29 14:32 ` Greg Kroah-Hartman
  2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
  0 siblings, 2 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-06-29  4:42 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List, 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

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..7c487fa 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -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
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] staging: lustre: lnet: remove dead code
  2017-06-29  4:42 [PATCH] staging: lustre: lnet: remove dead code Dmitriy Cherkasov
@ 2017-06-29 14:32 ` Greg Kroah-Hartman
  2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
  1 sibling, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-29 14:32 UTC (permalink / raw)
  To: Dmitriy Cherkasov
  Cc: devel, Oleg Drokin, Andreas Dilger, James Simmons,
	Linux Kernel Mailing List, Lustre Development List

On Wed, Jun 28, 2017 at 09:42:36PM -0700, Dmitriy Cherkasov wrote:
> 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
> 
> Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
> ---
>  drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> index 5540de6..7c487fa 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> @@ -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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-29  4:42 [PATCH] staging: lustre: lnet: remove dead code Dmitriy Cherkasov
  2017-06-29 14:32 ` Greg Kroah-Hartman
@ 2017-06-30  3:29 ` Dmitriy Cherkasov
  2017-06-30  3:37   ` Joe Perches
  2017-06-30  3:52   ` [PATCH v3] " Dmitriy Cherkasov
  1 sibling, 2 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-06-30  3:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List, 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

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---
 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(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..9eb169d 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -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)
 {
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8a036f4..a3735da 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -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);
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
@ 2017-06-30  3:37   ` Joe Perches
  2017-06-30  3:54     ` Dmitriy Cherkasov
  2017-06-30  3:52   ` [PATCH v3] " Dmitriy Cherkasov
  1 sibling, 1 reply; 12+ messages in thread
From: Joe Perches @ 2017-06-30  3:37 UTC (permalink / raw)
  To: Dmitriy Cherkasov, Greg Kroah-Hartman, devel, Oleg Drokin,
	Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List

On Fri, 2017-06-30 at 03:29 +0000, Dmitriy Cherkasov wrote:
> 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.

> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
[]
> @@ -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.

>  		}
> @@ -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...

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
  2017-06-30  3:37   ` Joe Perches
@ 2017-06-30  3:52   ` Dmitriy Cherkasov
  2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
  2017-06-30  6:01     ` [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper Greg Kroah-Hartman
  1 sibling, 2 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-06-30  3:52 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List, 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

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---
 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(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..9eb169d 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -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)
 {
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8a036f4..5e7e4e1 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  3:37   ` Joe Perches
@ 2017-06-30  3:54     ` Dmitriy Cherkasov
  0 siblings, 0 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-06-30  3:54 UTC (permalink / raw)
  To: Joe Perches, Greg Kroah-Hartman, devel, Oleg Drokin,
	Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List

On 06/30/2017, Joe Perches wrote:

> Please use checkpatch on your proposed patches before
> sending them.

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v4] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  3:52   ` [PATCH v3] " Dmitriy Cherkasov
@ 2017-06-30  5:50     ` Dmitriy Cherkasov
  2017-07-06 19:14       ` Dmitriy Cherkasov
  2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
  2017-06-30  6:01     ` [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper Greg Kroah-Hartman
  1 sibling, 2 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-06-30  5:50 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List, 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.

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

WARNING: space prohibited before semicolon

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---

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(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..9eb169d 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -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)
 {
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8a036f4..41715cd 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  3:52   ` [PATCH v3] " Dmitriy Cherkasov
  2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
@ 2017-06-30  6:01     ` Greg Kroah-Hartman
  1 sibling, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-30  6:01 UTC (permalink / raw)
  To: Dmitriy Cherkasov
  Cc: devel, Oleg Drokin, Andreas Dilger, James Simmons,
	Linux Kernel Mailing List, Lustre Development List

On Fri, Jun 30, 2017 at 03:52:46AM +0000, Dmitriy Cherkasov wrote:
> 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
> 
> Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v4] staging: lustre: lnet: remove dead code and crc32_le() wrapper
  2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
@ 2017-07-06 19:14       ` Dmitriy Cherkasov
  2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
  1 sibling, 0 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-07-06 19:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List

On 06/29/2017 10:50 PM, Dmitriy Cherkasov wrote:
> 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?

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper
  2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
  2017-07-06 19:14       ` Dmitriy Cherkasov
@ 2017-07-07 23:03       ` Dmitriy Cherkasov
  2017-07-13  0:27         ` Dilger, Andreas
  2017-07-13  0:27         ` Dilger, Andreas
  1 sibling, 2 replies; 12+ messages in thread
From: Dmitriy Cherkasov @ 2017-07-07 23:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger, James Simmons
  Cc: Linux Kernel Mailing List, Lustre Development List, 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

Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>
---
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(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index 5540de6..9eb169d 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -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)
 {
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
index 8a036f4..9c328dc 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
@@ -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) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper
  2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
  2017-07-13  0:27         ` Dilger, Andreas
@ 2017-07-13  0:27         ` Dilger, Andreas
  1 sibling, 0 replies; 12+ messages in thread
From: Dilger, Andreas @ 2017-07-13  0:27 UTC (permalink / raw)
  To: Dmitriy Cherkasov
  Cc: Greg Kroah-Hartman, devel, Drokin, Oleg, James Simmons,
	Linux Kernel Mailing List, Lustre Development List

On Jul 7, 2017, at 16:03, Dmitriy Cherkasov <dmitriy@oss-tech.org> wrote:
> 
> 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
> 
> Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>

Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>


> ---
> 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(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> index 5540de6..9eb169d 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> @@ -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)
> {
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> index 8a036f4..9c328dc 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> @@ -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) {
> -- 
> 1.9.1
> 

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper
  2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
@ 2017-07-13  0:27         ` Dilger, Andreas
  2017-07-13  0:27         ` Dilger, Andreas
  1 sibling, 0 replies; 12+ messages in thread
From: Dilger, Andreas @ 2017-07-13  0:27 UTC (permalink / raw)
  To: Dmitriy Cherkasov
  Cc: Greg Kroah-Hartman, devel, Drokin, Oleg, James Simmons,
	Linux Kernel Mailing List, Lustre Development List

On Jul 7, 2017, at 16:03, Dmitriy Cherkasov <dmitriy@oss-tech.org> wrote:
> 
> 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
> 
> Signed-off-by: Dmitriy Cherkasov <dmitriy@oss-tech.org>

Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>


> ---
> 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(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> index 5540de6..9eb169d 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
> @@ -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)
> {
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> index 8a036f4..9c328dc 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib.c
> @@ -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) {
> -- 
> 1.9.1
> 

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2017-07-13  0:27 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-29  4:42 [PATCH] staging: lustre: lnet: remove dead code Dmitriy Cherkasov
2017-06-29 14:32 ` Greg Kroah-Hartman
2017-06-30  3:29 ` [PATCH v2] staging: lustre: lnet: remove dead code and crc32_le() wrapper Dmitriy Cherkasov
2017-06-30  3:37   ` Joe Perches
2017-06-30  3:54     ` Dmitriy Cherkasov
2017-06-30  3:52   ` [PATCH v3] " Dmitriy Cherkasov
2017-06-30  5:50     ` [PATCH v4] " Dmitriy Cherkasov
2017-07-06 19:14       ` Dmitriy Cherkasov
2017-07-07 23:03       ` [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper Dmitriy Cherkasov
2017-07-13  0:27         ` Dilger, Andreas
2017-07-13  0:27         ` Dilger, Andreas
2017-06-30  6:01     ` [PATCH v3] staging: lustre: lnet: remove dead code and crc32_le() wrapper Greg Kroah-Hartman

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).