netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/31] sunrpc: auth_gss: use parity8
       [not found] ` <1458788612-4367-1-git-send-email-zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-03-27  6:51   ` zhaoxiu.zeng
  0 siblings, 0 replies; 4+ messages in thread
From: zhaoxiu.zeng @ 2016-03-27  6:51 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton,
	David S. Miller, Herbert Xu
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA

From: Zeng Zhaoxiu <zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 net/sunrpc/auth_gss/gss_krb5_keys.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/net/sunrpc/auth_gss/gss_krb5_keys.c b/net/sunrpc/auth_gss/gss_krb5_keys.c
index 8701331..c41b389 100644
--- a/net/sunrpc/auth_gss/gss_krb5_keys.c
+++ b/net/sunrpc/auth_gss/gss_krb5_keys.c
@@ -243,16 +243,12 @@ err_return:
 	return ret;
 }
 
-#define smask(step) ((1<<step)-1)
-#define pstep(x, step) (((x)&smask(step))^(((x)>>step)&smask(step)))
-#define parity_char(x) pstep(pstep(pstep((x), 4), 2), 1)
-
 static void mit_des_fixup_key_parity(u8 key[8])
 {
 	int i;
 	for (i = 0; i < 8; i++) {
 		key[i] &= 0xfe;
-		key[i] |= 1^parity_char(key[i]);
+		key[i] |= !parity8(key[i]);
 	}
 }
 
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 25/31] ethernet: use parity8 in sun/niu.c
       [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
       [not found] ` <1458788612-4367-1-git-send-email-zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2016-03-27  7:36 ` zhaoxiu.zeng
  2016-03-28 14:33   ` Michal Nazarewicz
  2016-03-27  7:50 ` [PATCH 31/31] ethernet: broadcom: use parity8 in tg3.c zhaoxiu.zeng
  2 siblings, 1 reply; 4+ messages in thread
From: zhaoxiu.zeng @ 2016-03-27  7:36 UTC (permalink / raw)
  To: Jiri Pirko, Andrew Morton, Michal Nazarewicz, David S. Miller,
	Vlastimil Babka, Joonsoo Kim
  Cc: linux-kernel, netdev

From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
---
 drivers/net/ethernet/sun/niu.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 9cc4564..8c344ef 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -2742,18 +2742,12 @@ static int niu_set_alt_mac_rdc_table(struct niu *np, int idx,
 
 static u64 vlan_entry_set_parity(u64 reg_val)
 {
-	u64 port01_mask;
-	u64 port23_mask;
-
-	port01_mask = 0x00ff;
-	port23_mask = 0xff00;
-
-	if (hweight64(reg_val & port01_mask) & 1)
+	if (parity8(reg_val))
 		reg_val |= ENET_VLAN_TBL_PARITY0;
 	else
 		reg_val &= ~ENET_VLAN_TBL_PARITY0;
 
-	if (hweight64(reg_val & port23_mask) & 1)
+	if (parity8((unsigned int)reg_val >> 8))
 		reg_val |= ENET_VLAN_TBL_PARITY1;
 	else
 		reg_val &= ~ENET_VLAN_TBL_PARITY1;
-- 
2.5.5

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

* [PATCH 31/31] ethernet: broadcom: use parity8 in tg3.c
       [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
       [not found] ` <1458788612-4367-1-git-send-email-zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2016-03-27  7:36 ` [PATCH 25/31] ethernet: use parity8 in sun/niu.c zhaoxiu.zeng
@ 2016-03-27  7:50 ` zhaoxiu.zeng
  2 siblings, 0 replies; 4+ messages in thread
From: zhaoxiu.zeng @ 2016-03-27  7:50 UTC (permalink / raw)
  To: Siva Reddy Kallam, Prashant Sreedharan, Michael Chan; +Cc: linux-kernel, netdev

From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 3010080..802a429 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -12939,11 +12939,7 @@ static int tg3_test_nvram(struct tg3 *tp)
 
 		err = -EIO;
 		for (i = 0; i < NVRAM_SELFBOOT_DATA_SIZE; i++) {
-			u8 hw8 = hweight8(data[i]);
-
-			if ((hw8 & 0x1) && parity[i])
-				goto out;
-			else if (!(hw8 & 0x1) && !parity[i])
+			if (parity8(data[i]) == !!parity[i])
 				goto out;
 		}
 		err = 0;
-- 
2.5.5

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

* Re: [PATCH 25/31] ethernet: use parity8 in sun/niu.c
  2016-03-27  7:36 ` [PATCH 25/31] ethernet: use parity8 in sun/niu.c zhaoxiu.zeng
@ 2016-03-28 14:33   ` Michal Nazarewicz
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Nazarewicz @ 2016-03-28 14:33 UTC (permalink / raw)
  To: zhaoxiu.zeng, Jiri Pirko, Andrew Morton, David S. Miller,
	Vlastimil Babka, Joonsoo Kim
  Cc: linux-kernel, netdev

On Sun, Mar 27 2016, zhaoxiu zeng wrote:
> From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
>
> Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>

No idea why I’ve been CC’d, but code looks good to me so:

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> ---
>  drivers/net/ethernet/sun/niu.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
> index 9cc4564..8c344ef 100644
> --- a/drivers/net/ethernet/sun/niu.c
> +++ b/drivers/net/ethernet/sun/niu.c
> @@ -2742,18 +2742,12 @@ static int niu_set_alt_mac_rdc_table(struct niu *np, int idx,
>  
>  static u64 vlan_entry_set_parity(u64 reg_val)
>  {
> -	u64 port01_mask;
> -	u64 port23_mask;
> -
> -	port01_mask = 0x00ff;
> -	port23_mask = 0xff00;
> -
> -	if (hweight64(reg_val & port01_mask) & 1)
> +	if (parity8(reg_val))
>  		reg_val |= ENET_VLAN_TBL_PARITY0;
>  	else
>  		reg_val &= ~ENET_VLAN_TBL_PARITY0;
>  
> -	if (hweight64(reg_val & port23_mask) & 1)
> +	if (parity8((unsigned int)reg_val >> 8))
>  		reg_val |= ENET_VLAN_TBL_PARITY1;
>  	else
>  		reg_val &= ~ENET_VLAN_TBL_PARITY1;
> -- 
> 2.5.5
>

-- 
Best regards
ミハウ “𝓶𝓲𝓷𝓪86” ナザレヴイツ
«If at first you don’t succeed, give up skydiving»

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

end of thread, other threads:[~2016-03-28 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
     [not found] ` <1458788612-4367-1-git-send-email-zhaoxiu.zeng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-03-27  6:51   ` [PATCH 12/31] sunrpc: auth_gss: use parity8 zhaoxiu.zeng
2016-03-27  7:36 ` [PATCH 25/31] ethernet: use parity8 in sun/niu.c zhaoxiu.zeng
2016-03-28 14:33   ` Michal Nazarewicz
2016-03-27  7:50 ` [PATCH 31/31] ethernet: broadcom: use parity8 in tg3.c zhaoxiu.zeng

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