From: Simon Horman <horms@kernel.org>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: s.shtylyov@omp.ru, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-next v3 3/9] net: rswitch: Use build_skb() for RX
Date: Wed, 6 Dec 2023 19:07:58 +0000 [thread overview]
Message-ID: <20231206190758.GZ50400@kernel.org> (raw)
In-Reply-To: <20231204012058.3876078-4-yoshihiro.shimoda.uh@renesas.com>
On Mon, Dec 04, 2023 at 10:20:52AM +0900, Yoshihiro Shimoda wrote:
> If this hardware receives a jumbo frame like 2KiB or more, it will be
> split into multiple queues. In the near future, to support this, use
> build_skb() instead of netdev_alloc_skb_ip_align().
>
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
...
> static void rswitch_gwca_ts_queue_free(struct rswitch_private *priv)
> @@ -308,17 +308,19 @@ static int rswitch_gwca_queue_alloc(struct net_device *ndev,
> gq->ring_size = ring_size;
> gq->ndev = ndev;
>
> - gq->skbs = kcalloc(gq->ring_size, sizeof(*gq->skbs), GFP_KERNEL);
> - if (!gq->skbs)
> - return -ENOMEM;
> -
> if (!dir_tx) {
> - rswitch_gwca_queue_alloc_skb(gq, 0, gq->ring_size);
> + gq->rx_bufs = kcalloc(gq->ring_size, sizeof(*gq->rx_bufs), GFP_KERNEL);
> + if (!gq->rx_bufs)
> + goto out;
Hi Shimoda-san,
there is no need to re-spin because of this,
but I have some commends on error handling.
I think that for consistency this can just return -ENOMEM.
Or alternatively, perhaps 'goto out' can be used for the (!gq->skbs)
condition below.
> + rswitch_gwca_queue_alloc_rx_buf(gq, 0, gq->ring_size);
Not strictly related to this patch, but should
the return value of rswitch_gwca_queue_alloc_rx_buf be checked?
>
> gq->rx_ring = dma_alloc_coherent(ndev->dev.parent,
> sizeof(struct rswitch_ext_ts_desc) *
> (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL);
> } else {
> + gq->skbs = kcalloc(gq->ring_size, sizeof(*gq->skbs), GFP_KERNEL);
> + if (!gq->skbs)
> + return -ENOMEM;
> gq->tx_ring = dma_alloc_coherent(ndev->dev.parent,
> sizeof(struct rswitch_ext_desc) *
> (gq->ring_size + 1), &gq->ring_dma, GFP_KERNEL);
...
next prev parent reply other threads:[~2023-12-06 19:08 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 1:20 [PATCH net-next v3 0/9] net: rswitch: Add jumbo frames support Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 1/9] net: rswitch: Drop unused argument/return value Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 2/9] net: rswitch: Use unsigned int for desc related array index Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 3/9] net: rswitch: Use build_skb() for RX Yoshihiro Shimoda
2023-12-06 19:07 ` Simon Horman [this message]
2023-12-07 0:25 ` Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 4/9] net: rswitch: Add unmap_addrs instead of dma address in each desc Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 5/9] net: rswitch: Add a setting ext descriptor function Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 6/9] net: rswitch: Set GWMDNC register Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 7/9] net: rswitch: Add jumbo frames handling for RX Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 8/9] net: rswitch: Add jumbo frames handling for TX Yoshihiro Shimoda
2023-12-06 10:21 ` Paolo Abeni
2023-12-07 0:23 ` Yoshihiro Shimoda
2023-12-04 1:20 ` [PATCH net-next v3 9/9] net: rswitch: Allow jumbo frames Yoshihiro Shimoda
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=20231206190758.GZ50400@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=s.shtylyov@omp.ru \
--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;
as well as URLs for NNTP newsgroup(s).