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@xxxxxxxxxxxxxx> >>> --- >>> 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@xxxxxxxxxxxxxx/ 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