From: Jacob Keller <jacob.e.keller@intel.com>
To: Stefan Wahren <wahrenst@gmx.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 08/12 net-next] qca_spi: Improve calculation of RX buffer size
Date: Wed, 20 Dec 2023 15:00:29 -0800 [thread overview]
Message-ID: <04e4381d-0b74-4bb4-8c53-093b99bba3ff@intel.com> (raw)
In-Reply-To: <20231218232639.33327-9-wahrenst@gmx.net>
On 12/18/2023 3:26 PM, Stefan Wahren wrote:
> There are two points with the calculation of RX buffer size which are
> not optimal:
> 1. mtu is a mutual parameter, but actually we need the maximum possible
> MTU. So better use the define directly.
> 2. This magic number 4 represent the hardware generated frame length
> which is specific to SPI. We better replace this with the suitable
> define.
>
> There is no functional change.
>
This is a bit confusing why you said no functional change. At first my
thought was that dev->mtu could easily be smaller than the maximum MTU.
(thats why its configurable after all?). But actually the diff context
cuts off a few lines that are extremely relevant:
> struct qcaspi *qca = netdev_priv(dev);
>
> dev->mtu = QCAFRM_MAX_MTU;
We assign dev->mtu here to QCAFRM_MAX_MTU
> dev->type = ARPHRD_ETHER;
> qca->clkspeed = qcaspi_clkspeed;
> qca->burst_len = qcaspi_burst_len;
> qca->spi_thread = NULL;
> qca->buffer_size = (dev->mtu + VLAN_ETH_HLEN + QCAFRM_HEADER_LEN +
> QCAFRM_FOOTER_LEN + 4) * 4;
And then use it here.
>
> memset(&qca->stats, 0, sizeof(struct qcaspi_stats));
>
Makes sense to use the constant directly.
It might have helped to have a bit more of this context in the commit
message, but its still a good cleanup.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> ---
> drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
> index 80182f8a4a50..6d2859aad921 100644
> --- a/drivers/net/ethernet/qualcomm/qca_spi.c
> +++ b/drivers/net/ethernet/qualcomm/qca_spi.c
> @@ -813,8 +813,8 @@ qcaspi_netdev_init(struct net_device *dev)
> qca->clkspeed = qcaspi_clkspeed;
> qca->burst_len = qcaspi_burst_len;
> qca->spi_thread = NULL;
> - qca->buffer_size = (dev->mtu + VLAN_ETH_HLEN + QCAFRM_HEADER_LEN +
> - QCAFRM_FOOTER_LEN + 4) * QCASPI_RX_MAX_FRAMES;
> + qca->buffer_size = (QCAFRM_MAX_MTU + VLAN_ETH_HLEN + QCAFRM_HEADER_LEN +
> + QCAFRM_FOOTER_LEN + QCASPI_HW_PKT_LEN) * QCASPI_RX_MAX_FRAMES;
>
> memset(&qca->stats, 0, sizeof(struct qcaspi_stats));
>
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2023-12-20 23:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-18 23:26 [PATCH V2 00/12 net-next] qca_spi: collection of improvements Stefan Wahren
2023-12-18 23:26 ` [PATCH V2 01/12 net-next] qca_spi: Improve SPI thread creation Stefan Wahren
2023-12-20 23:05 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 02/12 net-next] qca_spi: Improve SPI IRQ handling Stefan Wahren
2023-12-20 22:21 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 03/12 net-next] qca_spi: Avoid skb_copy_expand in TX path Stefan Wahren
2023-12-20 22:22 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 04/12 net-next] qca_7k_common: Drop unnecessary function description Stefan Wahren
2023-12-20 22:23 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 05/12 net-next] qca_7k_common: Drop unused len from qcafrm_handle Stefan Wahren
2023-12-20 22:23 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 06/12 net-next] qca_spi: Add QCASPI prefix to ring defines Stefan Wahren
2023-12-20 22:24 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 07/12 net-next] qca_spi: Introduce QCASPI_RX_MAX_FRAMES Stefan Wahren
2023-12-20 22:26 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 08/12 net-next] qca_spi: Improve calculation of RX buffer size Stefan Wahren
2023-12-20 23:00 ` Jacob Keller [this message]
2023-12-18 23:26 ` [PATCH V2 09/12 net-next] qca_spi: Log expected signature in error case Stefan Wahren
2023-12-20 23:01 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 10/12 net-next] qca_spi: Adjust log of SPI_REG_RDBUF_BYTE_AVA Stefan Wahren
2023-12-20 23:02 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 11/12 net-next] qca_7k: Replace BSD boilerplate with SPDX Stefan Wahren
2023-12-20 23:02 ` Jacob Keller
2023-12-18 23:26 ` [PATCH V2 12/12 net-next] qca_7k: Replace old mail address Stefan Wahren
2023-12-20 23:04 ` Jacob Keller
2024-01-02 14:58 ` Jakub Kicinski
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=04e4381d-0b74-4bb4-8c53-093b99bba3ff@intel.com \
--to=jacob.e.keller@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wahrenst@gmx.net \
/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®