[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aa375f97-a94a-66bf-e96c-2a8f75e2cf8b@omp.ru>
Date: Sun, 21 Apr 2024 23:23:33 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Paul Barker <paul.barker.ct@...renesas.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>
CC: Niklas Söderlund <niklas.soderlund+renesas@...natech.se>,
Geert Uytterhoeven <geert+renesas@...der.be>, <netdev@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [net-next RFC v3 4/7] net: ravb: Refactor GbEth RX code path
On 4/21/24 6:49 PM, Paul Barker wrote:
[...]
>>> We can reduce code duplication in ravb_rx_gbeth() and add comments to
>>> make the code flow easier to understand.
>>>
>>> Signed-off-by: Paul Barker <paul.barker.ct@...renesas.com>
>>> ---
>>> drivers/net/ethernet/renesas/ravb_main.c | 70 ++++++++++++------------
>>> 1 file changed, 35 insertions(+), 35 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
>>> index baa01bd81f2d..12618171f6d5 100644
>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>>> @@ -818,47 +818,47 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q)
>>> stats->rx_missed_errors++;
>>> } else {
>>> die_dt = desc->die_dt & 0xF0;
>>> - switch (die_dt) {
>>> - case DT_FSINGLE:
>>> - skb = ravb_get_skb_gbeth(ndev, entry, desc);
>>> + skb = ravb_get_skb_gbeth(ndev, entry, desc);
>>> + if (die_dt == DT_FSINGLE || die_dt == DT_FSTART) {
>>
>> No, please keep using *switch* statement here...
>
> That's a shame - I much prefer this version with reduced code
> duplication, especially when we add page pool support. Duplication with
> subtle differences leads to bugs, see [1] for an example.
>
> [1]: https://lore.kernel.org/all/20240416120254.2620-4-paul.barker.ct@bp.renesas.com/
I wasn't clear enough probably, sorry about that.
What I meant to say was that your use of the *if* statement
wasn't actually justified. Please use the *switch* statement
instead.
[...]
> Thanks,
MBR, Sergey
Powered by blists - more mailing lists