lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 11 Jun 2013 00:22:50 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	netdev@...r.kernel.org
Cc:	nobuhiro.iwamatsu.yj@...esas.com, linux-sh@...r.kernel.org,
	yoshihiro.shimoda.uh@...esas.com
Subject: [PATCH] sh_eth: get R8A7740 Rx descriptor word 0 shift out of #ifdef

The only R8A7740 specific #ifdef hindering ARM multiplatform  build is left  in
sh_eth_rx(): it covers a very strange code shifting Rx buffer descriptor word 0
by 16 (which should cause Rx length error to be logged on every buffer  several
lines later). Get rid of the #ifdef by adding 'shift_rd0' field to the  'struct
sh_eth_cpu_data', making the shift dependent on it, and setting it to 1 for the
R8A7740 case...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>

---
The patch is against Dave Miller's 'net-next.git' repo.
I have no R8A7740 manual,  so have to trust that the code is correct.  It would
be good to get some comments from the author of the original commit  that added
R8A7740 support, so CCing him... 

 drivers/net/ethernet/renesas/sh_eth.c |    6 +++---
 drivers/net/ethernet/renesas/sh_eth.h |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)

Index: net-next/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net-next/drivers/net/ethernet/renesas/sh_eth.c
@@ -667,6 +667,7 @@ static struct sh_eth_cpu_data r8a7740_da
 	.no_ade		= 1,
 	.tsu		= 1,
 	.select_mii	= 1,
+	.shift_rd0	= 1,
 };
 
 static struct sh_eth_cpu_data sh7619_data = {
@@ -1260,9 +1261,8 @@ static int sh_eth_rx(struct net_device *
 		desc_status = edmac_to_cpu(mdp, rxdesc->status);
 		pkt_len = rxdesc->frame_length;
 
-#if defined(CONFIG_ARCH_R8A7740)
-		desc_status >>= 16;
-#endif
+		if (mdp->cd->shift_rd0)
+			desc_status >>= 16;
 
 		if (--boguscnt < 0)
 			break;
Index: net-next/drivers/net/ethernet/renesas/sh_eth.h
===================================================================
--- net-next.orig/drivers/net/ethernet/renesas/sh_eth.h
+++ net-next/drivers/net/ethernet/renesas/sh_eth.h
@@ -476,6 +476,7 @@ struct sh_eth_cpu_data {
 	unsigned no_ade:1;	/* E-DMAC DO NOT have ADE bit in EESR */
 	unsigned hw_crc:1;	/* E-DMAC have CSMR */
 	unsigned select_mii:1;	/* EtherC have RMII_MII (MII select register) */
+	unsigned shift_rd0:1;	/* shift Rx buffer descriptor word 0 by 16 */
 };
 
 struct sh_eth_private {
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ