2017-06-29 04:56:04

by Dmitriy Cherkasov

[permalink] [raw]
Subject: [PATCH] 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

Signed-off-by: Dmitriy Cherkasov <[email protected]>
---
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


2017-06-29 14:32:33

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] staging: lustre: lnet: remove dead code

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 <[email protected]>
> ---
> 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

2017-06-30 03:30:17

by Dmitriy Cherkasov

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

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 <[email protected]>
---
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

2017-06-30 03:37:10

by Joe Perches

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

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

2017-06-30 03:54:38

by Dmitriy Cherkasov

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

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.

2017-06-30 04:01:05

by Dmitriy Cherkasov

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

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 <[email protected]>
---
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

2017-06-30 05:51:08

by Dmitriy Cherkasov

[permalink] [raw]
Subject: [PATCH v4] 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

Signed-off-by: Dmitriy Cherkasov <[email protected]>
---

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

2017-06-30 06:01:58

by Greg KH

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

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 <[email protected]>
> ---
> 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

2017-07-06 19:14:09

by Dmitriy Cherkasov

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

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?

2017-07-07 23:04:10

by Dmitriy Cherkasov

[permalink] [raw]
Subject: [PATCH v5] staging: lustre: lnet: remove dead code and useless wrapper

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 <[email protected]>
---
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

2017-07-13 00:27:08

by Dilger, Andreas

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

On Jul 7, 2017, at 16:03, Dmitriy Cherkasov <[email protected]> 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 <[email protected]>

Reviewed-by: Andreas Dilger <[email protected]>


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







2017-07-13 00:27:06

by Dilger, Andreas

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

On Jul 7, 2017, at 16:03, Dmitriy Cherkasov <[email protected]> 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 <[email protected]>

Reviewed-by: Andreas Dilger <[email protected]>


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