[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <611a49b8-ecdb-6b91-9d3e-262bf3851f5b@omp.ru>
Date: Wed, 29 May 2024 21:30:08 +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>,
Niklas Söderlund <niklas.soderlund+renesas@...natech.se>
CC: Biju Das <biju.das.jz@...renesas.com>, Claudiu Beznea
<claudiu.beznea.uj@...renesas.com>, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@...esas.com>, <netdev@...r.kernel.org>,
<linux-renesas-soc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [net-next PATCH v4 4/7] net: ravb: Refactor GbEth RX code path
On 5/28/24 6:03 PM, Paul Barker wrote:
> We can reduce code duplication in ravb_rx_gbeth().
>
> Signed-off-by: Paul Barker <paul.barker.ct@...renesas.com>
[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 7df7d2e93a3a..c9c5cc641589 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -817,47 +817,54 @@ static int ravb_rx_gbeth(struct net_device *ndev, int budget, int q)
> stats->rx_missed_errors++;
> } else {
> die_dt = desc->die_dt & 0xF0;
> + skb = ravb_get_skb_gbeth(ndev, entry, desc);
> switch (die_dt) {
Why not do instead (as I've asked you alraedy):
case DT_FSTART:
priv->rx_1st_skb = skb;
fallthrough;
> case DT_FSINGLE:
> - skb = ravb_get_skb_gbeth(ndev, entry, desc);
> + case DT_FSTART:
> + /* Start of packet:
> + * Set initial data length.
> + */
Please consider turning that block comment into one-liner...
> skb_put(skb, desc_len);
> +
> + /* Save this SKB if the packet spans multiple
> + * descriptors.
> + */
This one too...
(The current line length limit is 100 columns.)
> + if (die_dt == DT_FSTART)
> + priv->rx_1st_skb = skb;
This needs to be done under *case* DT_FSTART above instead...
> + break;
> +
> + case DT_FMID:
> + case DT_FEND:
> + /* Continuing a packet:
> + * Move data into the saved SKB.
> + */
> + skb_copy_to_linear_data_offset(priv->rx_1st_skb,
> + priv->rx_1st_skb->len,
> + skb->data,
> + desc_len);
> + skb_put(priv->rx_1st_skb, desc_len);
> + dev_kfree_skb(skb);
> +
> + /* Set skb to point at the whole packet so that
Please call it consistently, either SKB or skb (I prefer this one).
> + * we only need one code path for finishing a
> + * packet.
> + */
> + skb = priv->rx_1st_skb;
> + }
> +
> + switch (die_dt) {
> + case DT_FSINGLE:
> + case DT_FEND:
> + /* Finishing a packet:
> + * Determine protocol & checksum, hand off to
> + * NAPI and update our stats.
> + */
> skb->protocol = eth_type_trans(skb, ndev);
> if (ndev->features & NETIF_F_RXCSUM)
> ravb_rx_csum_gbeth(skb);
> + stats->rx_bytes += skb->len;
> napi_gro_receive(&priv->napi[q], skb);
> rx_packets++;
Otherwise, this is very good patch! Sorry for letting in the duplcate
code earlier! :-)
[...]
MBR, Sergey
Powered by blists - more mailing lists