public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sergey Shtylyov <s.shtylyov@omp.ru>
To: Paul Barker <paul.barker.ct@bp.renesas.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [net-next RFC v3 4/7] net: ravb: Refactor GbEth RX code path
Date: Sun, 21 Apr 2024 23:23:33 +0300	[thread overview]
Message-ID: <aa375f97-a94a-66bf-e96c-2a8f75e2cf8b@omp.ru> (raw)
In-Reply-To: <bcddc226-7cbf-4994-94fe-eb70331f2bfa@bp.renesas.com>

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@bp.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

  reply	other threads:[~2024-04-21 20:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  9:47 [net-next RFC v3 0/7] Improve GbEth performance on Renesas RZ/G2L and related SoCs Paul Barker
2024-04-15  9:47 ` [net-next RFC v3 1/7] net: ravb: Simplify poll & receive functions Paul Barker
2024-04-15 11:23   ` Niklas Söderlund
2024-04-15 11:31     ` Paul Barker
2024-04-15  9:47 ` [net-next RFC v3 2/7] net: ravb: Align poll function with NAPI docs Paul Barker
2024-04-15 11:44   ` Niklas Söderlund
2024-04-15 12:08     ` Paul Barker
2024-04-15  9:48 ` [net-next RFC v3 3/7] net: ravb: Refactor RX ring refill Paul Barker
2024-04-15 11:57   ` Niklas Söderlund
2024-04-15 12:18     ` Paul Barker
2024-04-15 12:30       ` Niklas Söderlund
2024-04-15  9:48 ` [net-next RFC v3 4/7] net: ravb: Refactor GbEth RX code path Paul Barker
2024-04-19 20:03   ` Sergey Shtylyov
2024-04-21 15:49     ` Paul Barker
2024-04-21 20:23       ` Sergey Shtylyov [this message]
2024-04-15  9:48 ` [net-next RFC v3 5/7] net: ravb: Enable SW IRQ Coalescing for GbEth Paul Barker
2024-04-19 20:26   ` Sergey Shtylyov
2024-04-15  9:48 ` [net-next RFC v3 6/7] net: ravb: Use NAPI threaded mode on 1-core CPUs with GbEth IP Paul Barker
2024-04-19 20:32   ` Sergey Shtylyov
2024-04-15  9:48 ` [net-next RFC v3 7/7] net: ravb: Allocate RX buffers via page pool Paul Barker
2024-04-15 12:16   ` Niklas Söderlund
2024-04-19  8:02     ` Paul Barker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aa375f97-a94a-66bf-e96c-2a8f75e2cf8b@omp.ru \
    --to=s.shtylyov@omp.ru \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=pabeni@redhat.com \
    --cc=paul.barker.ct@bp.renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox