[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230313224237.28757-4-Sergey.Semin@baikalelectronics.ru>
Date: Tue, 14 Mar 2023 01:42:27 +0300
From: Serge Semin <Sergey.Semin@...kalelectronics.ru>
To: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Russell King <linux@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>
CC: Serge Semin <Sergey.Semin@...kalelectronics.ru>,
Serge Semin <fancer.lancer@...il.com>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
Christian Marangi <ansuelsmth@...il.com>,
Biao Huang <biao.huang@...iatek.com>,
Yang Yingliang <yangyingliang@...wei.com>,
<netdev@...r.kernel.org>,
<linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>
Subject: [PATCH net 03/13] net: stmmac: Fix extended descriptors usage for jumbos in chain-mode
If a DW MAC NIC is synthesized to support the extended descriptors, then
the driver uses dma_etx pointer to keep an array of once in the Tx DMA
Queue structures. For some reason the specific to the chained-mode
jumbo_frm() referred to the dma_tx pointer of DMA Tx Queue descriptor in
any case, which of course was initialized with NULL for the DW MACs
expecting extended descriptors being specified. So any attempt to send a
Jumbo frame in chain-mode caused "Unable to handle kernel paging request
at virtual address" kernel crash. Fix that by selecting a proper
descriptor pointer depending on whether the NIC supports extended
descriptors or not.
Fixes: c24602ef8664 ("stmmac: support extend descriptors")
Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
---
Yeah, that Normal/Enhanced access pattern really annoying. Food for
thoughts about a more thorough cleanup of the driver.
---
drivers/net/ethernet/stmicro/stmmac/chain_mode.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
index 60e4fa5060ce..9a92f0c5e577 100644
--- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
+++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
@@ -24,7 +24,10 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
unsigned int i = 1, len;
struct dma_desc *desc;
- desc = tx_q->dma_tx + entry;
+ if (priv->extend_desc)
+ desc = (struct dma_desc *)(tx_q->dma_etx + entry);
+ else
+ desc = tx_q->dma_tx + entry;
if (priv->plat->enh_desc)
bmax = BUF_SIZE_8KiB;
@@ -47,7 +50,11 @@ static int jumbo_frm(void *p, struct sk_buff *skb, int csum)
while (len != 0) {
tx_q->tx_skbuff[entry] = NULL;
entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
- desc = tx_q->dma_tx + entry;
+
+ if (priv->extend_desc)
+ desc = (struct dma_desc *)(tx_q->dma_etx + entry);
+ else
+ desc = tx_q->dma_tx + entry;
if (len > bmax) {
des2 = dma_map_single(priv->device,
--
2.39.2
Powered by blists - more mailing lists