From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Jose Abreu <joabreu@synopsys.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>
Cc: Serge Semin <Sergey.Semin@baikalelectronics.ru>,
Serge Semin <fancer.lancer@gmail.com>,
Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
Christian Marangi <ansuelsmth@gmail.com>,
Biao Huang <biao.huang@mediatek.com>,
Yang Yingliang <yangyingliang@huawei.com>,
<netdev@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH net 03/13] net: stmmac: Fix extended descriptors usage for jumbos in chain-mode
Date: Tue, 14 Mar 2023 01:42:27 +0300 [thread overview]
Message-ID: <20230313224237.28757-4-Sergey.Semin@baikalelectronics.ru> (raw)
In-Reply-To: <20230313224237.28757-1-Sergey.Semin@baikalelectronics.ru>
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@baikalelectronics.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
next prev parent reply other threads:[~2023-03-13 22:43 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 22:42 [PATCH net 00/13] net: stmmac: Fixes bundle #1 Serge Semin
2023-03-13 22:42 ` [PATCH net 01/13] net: phy: realtek: Fix events detection failure in LPI mode Serge Semin
2023-03-14 0:39 ` Andrew Lunn
2023-03-14 11:16 ` Serge Semin
2023-03-13 22:42 ` [PATCH net 02/13] net: stmmac: Omit last desc flag for non-linear jumbos in chain-mode Serge Semin
2023-03-13 22:42 ` Serge Semin [this message]
2023-03-13 22:42 ` [PATCH net 04/13] net: stmmac: dwmac-sun8i: Don't modify chain-mode module parameter Serge Semin
2023-03-13 22:42 ` [PATCH net 05/13] net: stmmac: Enable ATDS for chain-mode Serge Semin
2023-03-14 11:42 ` Piotr Raczynski
2023-03-13 22:42 ` [PATCH net 06/13] net: stmmac: Free temporary Rx SKB on request Serge Semin
2023-03-14 11:26 ` Piotr Raczynski
2023-03-13 22:42 ` [PATCH net 07/13] net: stmmac: Free Rx descs on Tx allocation failure Serge Semin
2023-03-14 9:22 ` Piotr Raczynski
2023-03-13 22:42 ` [PATCH net 08/13] net: stmmac: Fix Rx IC bit setting procedure for Rx-mitigation Serge Semin
2023-03-13 22:42 ` [PATCH net 09/13] net: stmmac: Remove default maxmtu DT-platform setting Serge Semin
2023-03-14 11:20 ` Piotr Raczynski
2023-03-14 12:03 ` Serge Semin
2023-03-13 22:42 ` [PATCH net 10/13] net: stmmac: Make buf_sz module parameter useful Serge Semin
2023-03-13 22:42 ` [PATCH net 11/13] net: stmmac: gmac4: Use dwmac410_disable_dma_irq for DW MAC v4.10 DMA Serge Semin
2023-03-13 22:42 ` [PATCH net 12/13] net: stmmac: Stop overriding the PTP clock info static instance Serge Semin
2023-03-13 22:42 ` [PATCH net 13/13] net: dwmac-loongson: Perceive zero IRQ as invalid Serge Semin
2023-03-14 8:20 ` Piotr Raczynski
2023-03-14 11:38 ` Serge Semin
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=20230313224237.28757-4-Sergey.Semin@baikalelectronics.ru \
--to=sergey.semin@baikalelectronics.ru \
--cc=Alexey.Malahov@baikalelectronics.ru \
--cc=Pavel.Parkhomenko@baikalelectronics.ru \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=biao.huang@mediatek.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fancer.lancer@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=joabreu@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=linux@armlinux.org.uk \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=yangyingliang@huawei.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®