* [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses
@ 2018-03-31 21:15 Sergei Shtylyov
2018-03-31 21:22 ` [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag Sergei Shtylyov
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2018-03-31 21:15 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc, linux-sh
Hello!
Here's a set of 2 patches against DaveM's 'net-next.git' repo. They get rid of
the abuse of SH_ETH_OFFSET_INVALID for the register existence checks, so that
only its necessary uses would remain...
[1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag
[2/2] sh_eth: kill useless check in __sh_eth_get_regs()
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag
2018-03-31 21:15 [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses Sergei Shtylyov
@ 2018-03-31 21:22 ` Sergei Shtylyov
2018-03-31 21:28 ` Sergei Shtylyov
2018-03-31 21:23 ` [PATCH net-next 2/2] sh_eth: kill useless check in __sh_eth_get_regs() Sergei Shtylyov
2018-04-01 18:10 ` [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses David Miller
2 siblings, 1 reply; 5+ messages in thread
From: Sergei Shtylyov @ 2018-03-31 21:22 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc, linux-sh
The commit 6ded286555c2 ("sh_eth: Fix RX recovery on R-Car in case of RX
ring underrun") added a check for an bad RDFAR offset in sh_eth_rx(), so
that the code could work on the R-Car Ether controllers which don't have
this register (and TDFAR), then the commit 3365711df02 ("sh_eth: WARN on
access to a register not implemented in a particular chip") replaced
offset 0 with 0xffff. Adding/checking the 'no_xdfar' bit field in the
'struct sh_eth_cpu_data' instead results in less object code...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 5 +++--
drivers/net/ethernet/renesas/sh_eth.h | 1 +
2 files changed, 4 insertions(+), 2 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
@@ -702,6 +702,7 @@ static struct sh_eth_cpu_data rcar_gen1_
.mpr = 1,
.tpauser = 1,
.hw_swap = 1,
+ .no_xdfar = 1,
};
/* R-Car Gen2 and RZ/G1 */
@@ -735,6 +736,7 @@ static struct sh_eth_cpu_data rcar_gen2_
.mpr = 1,
.tpauser = 1,
.hw_swap = 1,
+ .no_xdfar = 1,
.rmiimode = 1,
.magic = 1,
};
@@ -1615,8 +1617,7 @@ static int sh_eth_rx(struct net_device *
/* If we don't need to check status, don't. -KDU */
if (!(sh_eth_read(ndev, EDRRR) & EDRRR_R)) {
/* fix the values for the next receiving if RDE is set */
- if (intr_status & EESR_RDE &&
- mdp->reg_offset[RDFAR] != SH_ETH_OFFSET_INVALID) {
+ if (intr_status & EESR_RDE && !mdp->cd->no_xdfar) {
u32 count = (sh_eth_read(ndev, RDFAR) -
sh_eth_read(ndev, RDLAR)) >> 4;
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
@@ -508,6 +508,7 @@ struct sh_eth_cpu_data {
unsigned rpadir:1; /* E-DMAC have RPADIR */
unsigned no_trimd:1; /* E-DMAC DO NOT have TRIMD */
unsigned no_ade:1; /* E-DMAC DO NOT have ADE bit in EESR */
+ unsigned no_xdfar:1; /* E-DMAC DOES NOT have RDFAR/TDFAR */
unsigned xdfar_rw:1; /* E-DMAC has writeable RDFAR/TDFAR */
unsigned hw_checksum:1; /* E-DMAC has CSMR */
unsigned select_mii:1; /* EtherC have RMII_MII (MII select register) */
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net-next 2/2] sh_eth: kill useless check in __sh_eth_get_regs()
2018-03-31 21:15 [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses Sergei Shtylyov
2018-03-31 21:22 ` [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag Sergei Shtylyov
@ 2018-03-31 21:23 ` Sergei Shtylyov
2018-04-01 18:10 ` [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses David Miller
2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2018-03-31 21:23 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc, linux-sh
Iff TSU registers exist on a given [G]Ether controller, they always include
the CAM entry table registers (TSU_ADR{H|L}<n>), thus the check for invalid
TSU_ADRH0 offset in __sh_eth_get_regs() is useless...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
drivers/net/ethernet/renesas/sh_eth.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 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
@@ -2153,22 +2153,17 @@ static size_t __sh_eth_get_regs(struct n
add_tsu_reg(TSU_POST2);
add_tsu_reg(TSU_POST3);
add_tsu_reg(TSU_POST4);
- if (mdp->reg_offset[TSU_ADRH0] != SH_ETH_OFFSET_INVALID) {
- /* This is the start of a table, not just a single
- * register.
- */
- if (buf) {
- unsigned int i;
+ /* This is the start of a table, not just a single register. */
+ if (buf) {
+ unsigned int i;
- mark_reg_valid(TSU_ADRH0);
- for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES * 2; i++)
- *buf++ = ioread32(
- mdp->tsu_addr +
- mdp->reg_offset[TSU_ADRH0] +
- i * 4);
- }
- len += SH_ETH_TSU_CAM_ENTRIES * 2;
+ mark_reg_valid(TSU_ADRH0);
+ for (i = 0; i < SH_ETH_TSU_CAM_ENTRIES * 2; i++)
+ *buf++ = ioread32(mdp->tsu_addr +
+ mdp->reg_offset[TSU_ADRH0] +
+ i * 4);
}
+ len += SH_ETH_TSU_CAM_ENTRIES * 2;
}
#undef mark_reg_valid
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag
2018-03-31 21:22 ` [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag Sergei Shtylyov
@ 2018-03-31 21:28 ` Sergei Shtylyov
0 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2018-03-31 21:28 UTC (permalink / raw)
To: netdev; +Cc: linux-renesas-soc, linux-sh
On 04/01/2018 12:22 AM, Sergei Shtylyov wrote:
> The commit 6ded286555c2 ("sh_eth: Fix RX recovery on R-Car in case of RX
> ring underrun") added a check for an bad RDFAR offset in sh_eth_rx(), so
> that the code could work on the R-Car Ether controllers which don't have
> this register (and TDFAR), then the commit 3365711df02 ("sh_eth: WARN on
Oops, only 11 digits! Should have been 3365711df024. :-)
> access to a register not implemented in a particular chip") replaced
> offset 0 with 0xffff. Adding/checking the 'no_xdfar' bit field in the
> 'struct sh_eth_cpu_data' instead results in less object code...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses
2018-03-31 21:15 [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses Sergei Shtylyov
2018-03-31 21:22 ` [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag Sergei Shtylyov
2018-03-31 21:23 ` [PATCH net-next 2/2] sh_eth: kill useless check in __sh_eth_get_regs() Sergei Shtylyov
@ 2018-04-01 18:10 ` David Miller
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-04-01 18:10 UTC (permalink / raw)
To: sergei.shtylyov; +Cc: netdev, linux-renesas-soc, linux-sh
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 1 Apr 2018 00:15:04 +0300
> Hello!
>
> Here's a set of 2 patches against DaveM's 'net-next.git' repo. They get rid of
> the abuse of SH_ETH_OFFSET_INVALID for the register existence checks, so that
> only its necessary uses would remain...
>
> [1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag
> [2/2] sh_eth: kill useless check in __sh_eth_get_regs()
Series applied, thank you.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-01 18:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-31 21:15 [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses Sergei Shtylyov
2018-03-31 21:22 ` [PATCH net-next 1/2] sh_eth: add sh_eth_cpu_data::no_xdfar flag Sergei Shtylyov
2018-03-31 21:28 ` Sergei Shtylyov
2018-03-31 21:23 ` [PATCH net-next 2/2] sh_eth: kill useless check in __sh_eth_get_regs() Sergei Shtylyov
2018-04-01 18:10 ` [PATCH 0/2] sh_eth: remove SH_ETH_OFFSET_INVALID abuses David Miller
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).