Message ID | 20210923140813.13541-18-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add Gigabit Ethernet driver support | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | fail | Series longer than 15 patches |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 11 of 11 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 47 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On 9/23/21 5:08 PM, Biju Das wrote: > RZ/G2L E-MAC supports carrier counters. > Add a carrier_counter hw feature bit to struct ravb_hw_info > to add this feature only for RZ/G2L. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> I have to trust you on this one: Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> [...] MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 85260f89e1cd..d42e8ea981df 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -198,11 +198,15 @@ enum ravb_reg { MAHR = 0x05c0, MALR = 0x05c8, TROCR = 0x0700, /* R-Car Gen3 and RZ/G2L only */ + CXR41 = 0x0708, /* Documented for RZ/G2L only */ + CXR42 = 0x0710, /* Documented for RZ/G2L only */ CEFCR = 0x0740, FRECR = 0x0748, TSFRCR = 0x0750, TLFRCR = 0x0758, RFCR = 0x0760, + CXR55 = 0x0768, /* Documented for RZ/G2L only */ + CXR56 = 0x0770, /* Documented for RZ/G2L only */ MAFCR = 0x0778, CSR0 = 0x0800, /* Documented for RZ/G2L only */ }; @@ -1036,6 +1040,7 @@ struct ravb_hw_info { unsigned half_duplex:1; /* E-MAC supports half duplex mode */ unsigned rx_2k_buffers:1; /* AVB-DMAC has Max 2K buf size on RX */ unsigned timestamp:1; /* AVB-DMAC has timestamp */ + unsigned carrier_counters:1; /* E-MAC has carrier counters */ }; struct ravb_private { diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 867e180e6655..72aea5875bc5 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2060,6 +2060,18 @@ static struct net_device_stats *ravb_get_stats(struct net_device *ndev) ravb_write(ndev, 0, TROCR); /* (write clear) */ } + if (info->carrier_counters) { + nstats->collisions += ravb_read(ndev, CXR41); + ravb_write(ndev, 0, CXR41); /* (write clear) */ + nstats->tx_carrier_errors += ravb_read(ndev, CXR42); + ravb_write(ndev, 0, CXR42); /* (write clear) */ + + nstats->tx_carrier_errors += ravb_read(ndev, CXR55); + ravb_write(ndev, 0, CXR55); /* (write clear) */ + nstats->tx_carrier_errors += ravb_read(ndev, CXR56); + ravb_write(ndev, 0, CXR56); /* (write clear) */ + } + nstats->rx_packets = stats0->rx_packets + stats1->rx_packets; nstats->tx_packets = stats0->tx_packets + stats1->tx_packets; nstats->rx_bytes = stats0->rx_bytes + stats1->rx_bytes; @@ -2425,6 +2437,7 @@ static const struct ravb_hw_info rgeth_hw_info = { .no_gptp = 1, .mii_rgmii_selection = 1, .half_duplex = 1, + .carrier_counters = 1, }; static const struct of_device_id ravb_match_table[] = {
RZ/G2L E-MAC supports carrier counters. Add a carrier_counter hw feature bit to struct ravb_hw_info to add this feature only for RZ/G2L. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/net/ethernet/renesas/ravb.h | 5 +++++ drivers/net/ethernet/renesas/ravb_main.c | 13 +++++++++++++ 2 files changed, 18 insertions(+)