diff mbox series

[net-next,v2,3/8] ravb: Add num_gstat_queue to struct ravb_hw_info

Message ID 20210802102654.5996-4-biju.das.jz@bp.renesas.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series Add Gigabit Ethernet driver support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 2 maintainers not CCed: yangyingliang@huawei.com andrew_gabbasov@mentor.com
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, 34 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Biju Das Aug. 2, 2021, 10:26 a.m. UTC
The number of queues used in retrieving device stats for R-Car is 2,
whereas for RZ/G2L it is 1.

Add the num_gstat_queue variable to struct ravb_hw_info, to add subsequent
SoCs without any code changes to the ravb_get_ethtool_stats function.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2:
 * Incorporated Andrew and Sergei's review comments for making it smaller patch
   and provided detailed description.
---
 drivers/net/ethernet/renesas/ravb.h      | 1 +
 drivers/net/ethernet/renesas/ravb_main.c | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Andrew Lunn Aug. 2, 2021, 3:09 p.m. UTC | #1
On Mon, Aug 02, 2021 at 11:26:49AM +0100, Biju Das wrote:
> The number of queues used in retrieving device stats for R-Car is 2,
> whereas for RZ/G2L it is 1.
> 
> Add the num_gstat_queue variable to struct ravb_hw_info, to add subsequent
> SoCs without any code changes to the ravb_get_ethtool_stats function.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
Sergey Shtylyov Aug. 3, 2021, 6:21 p.m. UTC | #2
Hello!

On 8/2/21 1:26 PM, Biju Das wrote:

> The number of queues used in retrieving device stats for R-Car is 2,
> whereas for RZ/G2L it is 1.

   Mhm, how many RX queues are on your platform, 1? Then we don't need so specific name, just num_rx_queue.

> Add the num_gstat_queue variable to struct ravb_hw_info, to add subsequent
> SoCs without any code changes to the ravb_get_ethtool_stats function.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
[...]

MBR, Sergei
Biju Das Aug. 3, 2021, 7:13 p.m. UTC | #3
Hi Sergei,

Thanks for the feedback.

> Subject: Re: [PATCH net-next v2 3/8] ravb: Add num_gstat_queue to struct
> ravb_hw_info
> 
> Hello!
> 
> On 8/2/21 1:26 PM, Biju Das wrote:
> 
> > The number of queues used in retrieving device stats for R-Car is 2,
> > whereas for RZ/G2L it is 1.

> 
>    Mhm, how many RX queues are on your platform, 1? Then we don't need so
> specific name, just num_rx_queue.

There are 2 RX queues, but we provide only device stats information from first queue.

R-Car = 2x15 = 30 device stats
RZ/G2L = 1x15 = 15 device stats.

Cheers,
Biju


> 
> > Add the num_gstat_queue variable to struct ravb_hw_info, to add
> > subsequent SoCs without any code changes to the ravb_get_ethtool_stats
> function.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> [...]
> 
> MBR, Sergei
Sergey Shtylyov Aug. 3, 2021, 7:22 p.m. UTC | #4
On 8/3/21 10:13 PM, Biju Das wrote:

[...]
>>> The number of queues used in retrieving device stats for R-Car is 2,
>>> whereas for RZ/G2L it is 1.
> 
>>
>>    Mhm, how many RX queues are on your platform, 1? Then we don't need so
>> specific name, just num_rx_queue.
> 
> There are 2 RX queues, but we provide only device stats information from first queue.
> 
> R-Car = 2x15 = 30 device stats
> RZ/G2L = 1x15 = 15 device stats.

    That's pretty strange... how the RX queue #1 is called? How many RX queues are, at all?

> Cheers,
> Biju

MBR, Sergei
Biju Das Aug. 3, 2021, 7:47 p.m. UTC | #5
Hi Sergei,

> Subject: Re: [PATCH net-next v2 3/8] ravb: Add num_gstat_queue to struct
> ravb_hw_info
> 
> On 8/3/21 10:13 PM, Biju Das wrote:
> 
> [...]
> >>> The number of queues used in retrieving device stats for R-Car is 2,
> >>> whereas for RZ/G2L it is 1.
> >
> >>
> >>    Mhm, how many RX queues are on your platform, 1? Then we don't
> >> need so specific name, just num_rx_queue.
> >
> > There are 2 RX queues, but we provide only device stats information from
> first queue.
> >
> > R-Car = 2x15 = 30 device stats
> > RZ/G2L = 1x15 = 15 device stats.
> 
>     That's pretty strange... how the RX queue #1 is called? How many RX
> queues are, at all?

For both R-Car and RZ/G2L,
------------------------- 
#define NUM_RX_QUEUE    2
#define NUM_TX_QUEUE    2

Target device stat output for RZ/G2L:-
------------------------------------
root@smarc-rzg2l:~# ethtool -S eth0
NIC statistics:
     rx_queue_0_current: 21852
     tx_queue_0_current: 18854
     rx_queue_0_dirty: 21852
     tx_queue_0_dirty: 18854
     rx_queue_0_packets: 21852
     tx_queue_0_packets: 9427
     rx_queue_0_bytes: 28224093
     tx_queue_0_bytes: 1659438
     rx_queue_0_mcast_packets: 498
     rx_queue_0_errors: 0
     rx_queue_0_crc_errors: 0
     rx_queue_0_frame_errors: 0
     rx_queue_0_length_errors: 0
     rx_queue_0_csum_offload_errors: 0
     rx_queue_0_over_errors: 0
root@smarc-rzg2l:~#


Target device stat output for R-Car Gen3:-
----------------------------------------
root@hihope-rzg2m:~#  ethtool -S eth0
NIC statistics:
     rx_queue_0_current: 34215
     tx_queue_0_current: 14158
     rx_queue_0_dirty: 34215
     tx_queue_0_dirty: 14158
     rx_queue_0_packets: 34215
     tx_queue_0_packets: 14158
     rx_queue_0_bytes: 38313586
     tx_queue_0_bytes: 3222182
     rx_queue_0_mcast_packets: 499
     rx_queue_0_errors: 0
     rx_queue_0_crc_errors: 0
     rx_queue_0_frame_errors: 0
     rx_queue_0_length_errors: 0
     rx_queue_0_missed_errors: 0
     rx_queue_0_over_errors: 0
     rx_queue_1_current: 0
     tx_queue_1_current: 0
     rx_queue_1_dirty: 0
     tx_queue_1_dirty: 0
     rx_queue_1_packets: 0
     tx_queue_1_packets: 0
     rx_queue_1_bytes: 0
     tx_queue_1_bytes: 0
     rx_queue_1_mcast_packets: 0
     rx_queue_1_errors: 0
     rx_queue_1_crc_errors: 0
     rx_queue_1_frame_errors: 0
     rx_queue_1_length_errors: 0
     rx_queue_1_missed_errors: 0
     rx_queue_1_over_errors: 0

Cheers,
Biju
Biju Das Aug. 17, 2021, 3:08 p.m. UTC | #6
Hi All,

I have tested without this patch and got expected results. So I am dropping this patch in the next version.

Cheers,
Biju

> Subject: RE: [PATCH net-next v2 3/8] ravb: Add num_gstat_queue to struct
> ravb_hw_info
> 
> Hi Sergei,
> 
> > Subject: Re: [PATCH net-next v2 3/8] ravb: Add num_gstat_queue to
> > struct ravb_hw_info
> >
> > On 8/3/21 10:13 PM, Biju Das wrote:
> >
> > [...]
> > >>> The number of queues used in retrieving device stats for R-Car is
> > >>> 2, whereas for RZ/G2L it is 1.
> > >
> > >>
> > >>    Mhm, how many RX queues are on your platform, 1? Then we don't
> > >> need so specific name, just num_rx_queue.
> > >
> > > There are 2 RX queues, but we provide only device stats information
> > > from
> > first queue.
> > >
> > > R-Car = 2x15 = 30 device stats
> > > RZ/G2L = 1x15 = 15 device stats.
> >
> >     That's pretty strange... how the RX queue #1 is called? How many
> > RX queues are, at all?
> 
> For both R-Car and RZ/G2L,
> -------------------------
> #define NUM_RX_QUEUE    2
> #define NUM_TX_QUEUE    2
> 
> Target device stat output for RZ/G2L:-
> ------------------------------------
> root@smarc-rzg2l:~# ethtool -S eth0
> NIC statistics:
>      rx_queue_0_current: 21852
>      tx_queue_0_current: 18854
>      rx_queue_0_dirty: 21852
>      tx_queue_0_dirty: 18854
>      rx_queue_0_packets: 21852
>      tx_queue_0_packets: 9427
>      rx_queue_0_bytes: 28224093
>      tx_queue_0_bytes: 1659438
>      rx_queue_0_mcast_packets: 498
>      rx_queue_0_errors: 0
>      rx_queue_0_crc_errors: 0
>      rx_queue_0_frame_errors: 0
>      rx_queue_0_length_errors: 0
>      rx_queue_0_csum_offload_errors: 0
>      rx_queue_0_over_errors: 0
> root@smarc-rzg2l:~#
> 
> 
> Target device stat output for R-Car Gen3:-
> ----------------------------------------
> root@hihope-rzg2m:~#  ethtool -S eth0
> NIC statistics:
>      rx_queue_0_current: 34215
>      tx_queue_0_current: 14158
>      rx_queue_0_dirty: 34215
>      tx_queue_0_dirty: 14158
>      rx_queue_0_packets: 34215
>      tx_queue_0_packets: 14158
>      rx_queue_0_bytes: 38313586
>      tx_queue_0_bytes: 3222182
>      rx_queue_0_mcast_packets: 499
>      rx_queue_0_errors: 0
>      rx_queue_0_crc_errors: 0
>      rx_queue_0_frame_errors: 0
>      rx_queue_0_length_errors: 0
>      rx_queue_0_missed_errors: 0
>      rx_queue_0_over_errors: 0
>      rx_queue_1_current: 0
>      tx_queue_1_current: 0
>      rx_queue_1_dirty: 0
>      tx_queue_1_dirty: 0
>      rx_queue_1_packets: 0
>      tx_queue_1_packets: 0
>      rx_queue_1_bytes: 0
>      tx_queue_1_bytes: 0
>      rx_queue_1_mcast_packets: 0
>      rx_queue_1_errors: 0
>      rx_queue_1_crc_errors: 0
>      rx_queue_1_frame_errors: 0
>      rx_queue_1_length_errors: 0
>      rx_queue_1_missed_errors: 0
>      rx_queue_1_over_errors: 0
> 
> Cheers,
> Biju
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 16d1711a0731..38552e0319d3 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -990,6 +990,7 @@  enum ravb_chip_id {
 
 struct ravb_hw_info {
 	enum ravb_chip_id chip_id;
+	int num_gstat_queue;
 	int num_tx_desc;
 	size_t skb_sz;
 };
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 08146c1975e5..30132693edd7 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1149,11 +1149,12 @@  static void ravb_get_ethtool_stats(struct net_device *ndev,
 				   struct ethtool_stats *estats, u64 *data)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
 	int i = 0;
 	int q;
 
 	/* Device-specific stats */
-	for (q = RAVB_BE; q < NUM_RX_QUEUE; q++) {
+	for (q = RAVB_BE; q < info->num_gstat_queue; q++) {
 		struct net_device_stats *stats = &priv->stats[q];
 
 		data[i++] = priv->cur_rx[q];
@@ -1926,12 +1927,14 @@  static int ravb_mdio_release(struct ravb_private *priv)
 
 static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.chip_id = RCAR_GEN3,
+	.num_gstat_queue = NUM_RX_QUEUE,
 	.num_tx_desc = NUM_TX_DESC_GEN3,
 	.skb_sz = RX_BUF_SZ + RAVB_ALIGN - 1,
 };
 
 static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.chip_id = RCAR_GEN2,
+	.num_gstat_queue = NUM_RX_QUEUE,
 	.num_tx_desc = NUM_TX_DESC_GEN2,
 	.skb_sz = RX_BUF_SZ + RAVB_ALIGN - 1,
 };