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>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
<netdev@vger.kernel.org>, <linux-renesas-soc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [net-next PATCH v4 4/7] net: ravb: Refactor GbEth RX code path
Date: Wed, 29 May 2024 21:30:08 +0300 [thread overview]
Message-ID: <611a49b8-ecdb-6b91-9d3e-262bf3851f5b@omp.ru> (raw)
In-Reply-To: <20240528150339.6791-5-paul.barker.ct@bp.renesas.com>
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@bp.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
next prev parent reply other threads:[~2024-05-29 18:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-28 15:03 [net-next PATCH v4 0/7] Improve GbEth performance on Renesas RZ/G2L and related SoCs Paul Barker
2024-05-28 15:03 ` [net-next PATCH v4 1/7] net: ravb: Simplify poll & receive functions Paul Barker
2024-05-28 16:21 ` Sergey Shtylyov
2024-05-28 15:03 ` [net-next PATCH v4 2/7] net: ravb: Consider busypolling status when re-enabling interrupts Paul Barker
2024-05-28 16:44 ` Sergey Shtylyov
2024-05-28 16:47 ` Sergey Shtylyov
2024-05-29 19:09 ` Paul Barker
2024-05-28 15:03 ` [net-next PATCH v4 3/7] net: ravb: Refactor RX ring refill Paul Barker
2024-05-28 20:50 ` Sergey Shtylyov
2024-05-28 15:03 ` [net-next PATCH v4 4/7] net: ravb: Refactor GbEth RX code path Paul Barker
2024-05-29 18:30 ` Sergey Shtylyov [this message]
2024-05-29 19:07 ` Paul Barker
2024-05-30 20:37 ` Sergey Shtylyov
2024-05-28 15:03 ` [net-next PATCH v4 5/7] net: ravb: Enable SW IRQ Coalescing for GbEth Paul Barker
2024-05-28 15:03 ` [net-next PATCH v4 6/7] net: ravb: Use NAPI threaded mode on 1-core CPUs with GbEth IP Paul Barker
2024-05-28 15:03 ` [net-next PATCH v4 7/7] net: ravb: Allocate RX buffers via page pool Paul Barker
2024-05-29 20:52 ` Sergey Shtylyov
2024-05-30 9:21 ` Paul Barker
2024-05-30 10:29 ` Paul Barker
2024-05-31 17:25 ` Sergey Shtylyov
2024-06-01 10:13 ` Simon Horman
2024-06-03 8:02 ` Paul Barker
2024-06-03 12:07 ` Simon Horman
2024-06-03 12:15 ` Paul Barker
2024-06-05 17:18 ` Sergey Shtylyov
2024-06-03 20:45 ` Sergey Shtylyov
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=611a49b8-ecdb-6b91-9d3e-262bf3851f5b@omp.ru \
--to=s.shtylyov@omp.ru \
--cc=biju.das.jz@bp.renesas.com \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--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 \
--cc=yoshihiro.shimoda.uh@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
all inboxes | Powered by JetHome®