From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jochen Henneberg <jh@henneberg-systemdesign.com>
Cc: netdev@vger.kernel.org,
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>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Wong Vee Khee <veekhee@apple.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
Revanth Kumar Uppala <ruppala@nvidia.com>,
Andrey Konovalov <andrey.konovalov@linaro.org>,
Tan Tee Min <tee.min.tan@linux.intel.com>,
Voon Weifeng <weifeng.voon@intel.com>,
Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net V2] net: stmmac: Fix for mismatched host/device DMA address width
Date: Thu, 16 Mar 2023 23:10:03 +0000 [thread overview]
Message-ID: <ZBOhy02DFBlnIQR1@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230316131503.738933-1-jh@henneberg-systemdesign.com>
On Thu, Mar 16, 2023 at 02:15:03PM +0100, Jochen Henneberg wrote:
> Currently DMA address width is either read from a RO device register
> or force set from the platform data. This breaks DMA when the host DMA
> address width is <=32it but the device is >32bit.
>
> Right now the driver may decide to use a 2nd DMA descriptor for
> another buffer (happens in case of TSO xmit) assuming that 32bit
> addressing is used due to platform configuration but the device will
> still use both descriptor addresses as one address.
>
> This can be observed with the Intel EHL platform driver that sets
> 32bit for addr64 but the MAC reports 40bit. The TX queue gets stuck in
> case of TCP with iptables NAT configuration on TSO packets.
>
> The logic should be like this: Whatever we do on the host side (memory
> allocation GFP flags) should happen with the host DMA width, whenever
> we decide how to set addresses on the device registers we must use the
> device DMA address width.
>
> This patch renames the platform address width field from addr64 (term
> used in device datasheet) to host_addr and uses this value exclusively
> for host side operations while all chip operations consider the device
> DMA width as read from the device register.
>
> Fixes: 7cfc4486e7ea ("stmmac: intel: Configure EHL PSE0 GbE and PSE1 GbE to 32 bits DMA addressing")
> Signed-off-by: Jochen Henneberg <jh@henneberg-systemdesign.com>
> ---
> V2: Fixes from checkpatch.pl for commit message
>
> drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
> .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
> .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 4 +--
> .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 2 +-
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 30 ++++++++++---------
> include/linux/stmmac.h | 2 +-
> 6 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 6b5d96bced47..55a728b1b708 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -418,6 +418,7 @@ struct dma_features {
> unsigned int frpbs;
> unsigned int frpes;
> unsigned int addr64;
> + unsigned int host_addr;
Obvious question: is host_addr an address? From the above description it
sounds like this is more of a host address width indicator.
Maybe call these "dev_addr_width" and "host_addr_width" so it's clear
what each of these are?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
WARNING: multiple messages have this Message-ID (diff)
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Jochen Henneberg <jh@henneberg-systemdesign.com>
Cc: netdev@vger.kernel.org,
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>,
Shawn Guo <shawnguo@kernel.org>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
NXP Linux Team <linux-imx@nxp.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Wong Vee Khee <veekhee@apple.com>,
Kurt Kanzenbach <kurt@linutronix.de>,
Revanth Kumar Uppala <ruppala@nvidia.com>,
Andrey Konovalov <andrey.konovalov@linaro.org>,
Tan Tee Min <tee.min.tan@linux.intel.com>,
Voon Weifeng <weifeng.voon@intel.com>,
Mohammad Athari Bin Ismail <mohammad.athari.ismail@intel.com>,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net V2] net: stmmac: Fix for mismatched host/device DMA address width
Date: Thu, 16 Mar 2023 23:10:03 +0000 [thread overview]
Message-ID: <ZBOhy02DFBlnIQR1@shell.armlinux.org.uk> (raw)
In-Reply-To: <20230316131503.738933-1-jh@henneberg-systemdesign.com>
On Thu, Mar 16, 2023 at 02:15:03PM +0100, Jochen Henneberg wrote:
> Currently DMA address width is either read from a RO device register
> or force set from the platform data. This breaks DMA when the host DMA
> address width is <=32it but the device is >32bit.
>
> Right now the driver may decide to use a 2nd DMA descriptor for
> another buffer (happens in case of TSO xmit) assuming that 32bit
> addressing is used due to platform configuration but the device will
> still use both descriptor addresses as one address.
>
> This can be observed with the Intel EHL platform driver that sets
> 32bit for addr64 but the MAC reports 40bit. The TX queue gets stuck in
> case of TCP with iptables NAT configuration on TSO packets.
>
> The logic should be like this: Whatever we do on the host side (memory
> allocation GFP flags) should happen with the host DMA width, whenever
> we decide how to set addresses on the device registers we must use the
> device DMA address width.
>
> This patch renames the platform address width field from addr64 (term
> used in device datasheet) to host_addr and uses this value exclusively
> for host side operations while all chip operations consider the device
> DMA width as read from the device register.
>
> Fixes: 7cfc4486e7ea ("stmmac: intel: Configure EHL PSE0 GbE and PSE1 GbE to 32 bits DMA addressing")
> Signed-off-by: Jochen Henneberg <jh@henneberg-systemdesign.com>
> ---
> V2: Fixes from checkpatch.pl for commit message
>
> drivers/net/ethernet/stmicro/stmmac/common.h | 1 +
> .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
> .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 4 +--
> .../ethernet/stmicro/stmmac/dwmac-mediatek.c | 2 +-
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 30 ++++++++++---------
> include/linux/stmmac.h | 2 +-
> 6 files changed, 22 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
> index 6b5d96bced47..55a728b1b708 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/common.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/common.h
> @@ -418,6 +418,7 @@ struct dma_features {
> unsigned int frpbs;
> unsigned int frpes;
> unsigned int addr64;
> + unsigned int host_addr;
Obvious question: is host_addr an address? From the above description it
sounds like this is more of a host address width indicator.
Maybe call these "dev_addr_width" and "host_addr_width" so it's clear
what each of these are?
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-03-16 23:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-16 9:53 [PATCH] net: stmmac: Fix for mismatched host/device DMA address width Jochen Henneberg
2023-03-16 9:53 ` Jochen Henneberg
2023-03-16 13:15 ` [PATCH net V2] " Jochen Henneberg
2023-03-16 13:15 ` Jochen Henneberg
2023-03-16 23:10 ` Russell King (Oracle) [this message]
2023-03-16 23:10 ` Russell King (Oracle)
2023-03-17 7:22 ` Jochen Henneberg
2023-03-17 7:22 ` Jochen Henneberg
2023-03-17 8:08 ` [PATCH net V3] " Jochen Henneberg
2023-03-17 8:08 ` Jochen Henneberg
2023-03-19 11:00 ` patchwork-bot+netdevbpf
2023-03-19 11:00 ` patchwork-bot+netdevbpf
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=ZBOhy02DFBlnIQR1@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrey.konovalov@linaro.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=festevam@gmail.com \
--cc=jh@henneberg-systemdesign.com \
--cc=joabreu@synopsys.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=kurt@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mohammad.athari.ismail@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peppe.cavallaro@st.com \
--cc=ruppala@nvidia.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=tee.min.tan@linux.intel.com \
--cc=veekhee@apple.com \
--cc=weifeng.voon@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.