[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6e4971cb-3567-6f1d-11d6-467c0ba88f27@gmail.com>
Date: Wed, 4 Aug 2021 23:27:12 +0300
From: Sergei Shtylyov <sergei.shtylyov@...il.com>
To: Biju Das <biju.das.jz@...renesas.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
Sergey Shtylyov <s.shtylyov@...russia.ru>,
Adam Ford <aford173@...il.com>, Andrew Lunn <andrew@...n.ch>,
Yuusuke Ashizuka <ashiduka@...itsu.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-renesas-soc@...r.kernel.org"
<linux-renesas-soc@...r.kernel.org>,
Chris Paterson <Chris.Paterson2@...esas.com>,
Biju Das <biju.das@...renesas.com>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [PATCH net-next v2 1/8] ravb: Add struct ravb_hw_info to driver
data
On 8/4/21 10:27 PM, Sergei Shtylyov wrote:
>>> Subject: Re: [PATCH net-next v2 1/8] ravb: Add struct ravb_hw_info to
>>> driver data
>>>
>>> On 8/2/21 1:26 PM, Biju Das wrote:
>>>
>>>> The DMAC and EMAC blocks of Gigabit Ethernet IP found on RZ/G2L SoC
>>>> are similar to the R-Car Ethernet AVB IP. With a few changes in the
>>>> driver we can support both IPs.
>>>>
>>>> Currently a runtime decision based on the chip type is used to
>>>> distinguish the HW differences between the SoC families.
>>>>
>>>> The number of TX descriptors for R-Car Gen3 is 1 whereas on R-Car Gen2
>>>> and RZ/G2L it is 2. For cases like this it is better to select the
>>>> number of TX descriptors by using a structure with a value, rather
>>>> than a runtime decision based on the chip type.
>>>>
>>>> This patch adds the num_tx_desc variable to struct ravb_hw_info and
>>>> also replaces the driver data chip type with struct ravb_hw_info by
>>>> moving chip type to it.
>>>>
>>>> Signed-off-by: Biju Das <biju.das.jz@...renesas.com>
>>>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...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 | 7 +++++
>>>> drivers/net/ethernet/renesas/ravb_main.c | 38
>>>> +++++++++++++++---------
>>>> 2 files changed, 31 insertions(+), 14 deletions(-)
>>>>
>>>> diff --git a/drivers/net/ethernet/renesas/ravb.h
>>>> b/drivers/net/ethernet/renesas/ravb.h
>>>> index 80e62ca2e3d3..cfb972c05b34 100644
>>>> --- a/drivers/net/ethernet/renesas/ravb.h
>>>> +++ b/drivers/net/ethernet/renesas/ravb.h
>>>> @@ -988,6 +988,11 @@ enum ravb_chip_id {
>>>> RCAR_GEN3,
>>>> };
>>>>
>>>> +struct ravb_hw_info {
>>>> + enum ravb_chip_id chip_id;
>>>> + int num_tx_desc;
>
> How about leaving that field in the *struct* ravb_private? And adding the following instead:
>
> unsigned unaligned_tx: 1;
Or aligned_tx, so that gen2 has it set, and gen3 has it cleared.
>
>>> I think this is rather the driver's choice, than the h/w feature...
>>> Perhaps a rename would help with that? :-)
>>
>> It is consistent with current naming convention used by the driver. NUM_TX_DESC macro is replaced by num_tx_desc and the below run time decision based on chip type for H/W configuration for Gen2/Gen3 is replaced by info->num_tx_desc.
>>
>> priv->num_tx_desc = chip_id == RCAR_GEN2 ? NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;
>
> .. and then:
>
> priv->num_tx_desc = info->unaligned_tx ? NUM_TX_DESC_GEN2 : NUM_TX_DESC_GEN3;
Sorry, mixed the values, should have been:
priv->num_tx_desc = info->unaligned_tx ? NUM_TX_DESC_GEN3 : NUM_TX_DESC_GEN2;
>> Please let me know, if I am missing anything,
>>
>> Previously there is a suggestion to change the generic struct ravb_driver_data (which holds driver differences and HW features) with struct ravb_hw_info.
>
> Well, my plan was to place all the hardware features supported into the *struct* ravb_hw_info and leave all
> the driver's software data in the *struct* ravb_private.
... just like *struct* sh_eth_cpu_data and sh_eth_private in the sh_eth driver.
>> Regards,
>> Biju
MBR, Sergei
Powered by blists - more mailing lists