From: Furong Xu <0x1207@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Joao Pinto <jpinto@synopsys.com>, Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com,
Furong Xu <0x1207@gmail.com>
Subject: [PATCH net-next v1] net: stmmac: xgmac: increase length limit of descriptor ring
Date: Thu, 20 Jun 2024 16:52:00 +0800 [thread overview]
Message-ID: <20240620085200.583709-1-0x1207@gmail.com> (raw)
DWXGMAC CORE supports a ring length of 65536 descriptors, bump max length
from 1024 to 65536
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
.../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 ++
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 24 +++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
index 6a2c7d22df1e..264f4f876c74 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
@@ -11,6 +11,8 @@
/* Misc */
#define XGMAC_JUMBO_LEN 16368
+#define XGMAC_DMA_MAX_TX_SIZE 65536
+#define XGMAC_DMA_MAX_RX_SIZE 65536
/* MAC Registers */
#define XGMAC_TX_CONFIG 0x00000000
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 18468c0228f0..3ae465c5a712 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -491,9 +491,16 @@ static void stmmac_get_ringparam(struct net_device *netdev,
struct netlink_ext_ack *extack)
{
struct stmmac_priv *priv = netdev_priv(netdev);
+ u32 dma_max_rx_size = DMA_MAX_RX_SIZE;
+ u32 dma_max_tx_size = DMA_MAX_TX_SIZE;
- ring->rx_max_pending = DMA_MAX_RX_SIZE;
- ring->tx_max_pending = DMA_MAX_TX_SIZE;
+ if (priv->plat->has_xgmac) {
+ dma_max_rx_size = XGMAC_DMA_MAX_RX_SIZE;
+ dma_max_tx_size = XGMAC_DMA_MAX_TX_SIZE;
+ }
+
+ ring->rx_max_pending = dma_max_rx_size;
+ ring->tx_max_pending = dma_max_tx_size;
ring->rx_pending = priv->dma_conf.dma_rx_size;
ring->tx_pending = priv->dma_conf.dma_tx_size;
}
@@ -503,12 +510,21 @@ static int stmmac_set_ringparam(struct net_device *netdev,
struct kernel_ethtool_ringparam *kernel_ring,
struct netlink_ext_ack *extack)
{
+ struct stmmac_priv *priv = netdev_priv(netdev);
+ u32 dma_max_rx_size = DMA_MAX_RX_SIZE;
+ u32 dma_max_tx_size = DMA_MAX_TX_SIZE;
+
+ if (priv->plat->has_xgmac) {
+ dma_max_rx_size = XGMAC_DMA_MAX_RX_SIZE;
+ dma_max_tx_size = XGMAC_DMA_MAX_TX_SIZE;
+ }
+
if (ring->rx_mini_pending || ring->rx_jumbo_pending ||
ring->rx_pending < DMA_MIN_RX_SIZE ||
- ring->rx_pending > DMA_MAX_RX_SIZE ||
+ ring->rx_pending > dma_max_rx_size ||
!is_power_of_2(ring->rx_pending) ||
ring->tx_pending < DMA_MIN_TX_SIZE ||
- ring->tx_pending > DMA_MAX_TX_SIZE ||
+ ring->tx_pending > dma_max_tx_size ||
!is_power_of_2(ring->tx_pending))
return -EINVAL;
--
2.34.1
next reply other threads:[~2024-06-20 8:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 8:52 Furong Xu [this message]
2024-06-20 12:06 ` [PATCH net-next v1] net: stmmac: xgmac: increase length limit of descriptor ring Serge Semin
2024-06-21 2:26 ` Furong Xu
2024-06-21 3:12 ` Andrew Lunn
2024-06-20 13:23 ` Andrew Lunn
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=20240620085200.583709-1-0x1207@gmail.com \
--to=0x1207@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=joabreu@synopsys.com \
--cc=jpinto@synopsys.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rock.xu@nio.com \
--cc=xfr@outlook.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).