* [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
@ 2024-12-18 8:34 Furong Xu
2024-12-18 15:48 ` Alexander Lobakin
2024-12-20 3:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Furong Xu @ 2024-12-18 8:34 UTC (permalink / raw)
To: netdev, linux-stm32, linux-arm-kernel, linux-kernel
Cc: Simon Horman, Alexandre Torgue, Jose Abreu, Andrew Lunn,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Maxime Coquelin, xfr, Furong Xu
After commit 2af6106ae949 ("net: stmmac: Introducing support for Page
Pool"), the driver always copies frames to get a better performance,
zero-copy for RX frames is no more, then these code turned to be
useless and users of ethtool may get confused about the unhandled
rx-copybreak parameter.
This patch mostly reverts
commit 22ad38381547 ("stmmac: do not perform zero-copy for rx frames")
Signed-off-by: Furong Xu <0x1207@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 39 -------------------
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ---
3 files changed, 46 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index 1d86439b8a14..b8d631e559c0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -126,7 +126,6 @@ struct stmmac_rx_queue {
unsigned int cur_rx;
unsigned int dirty_rx;
unsigned int buf_alloc_num;
- u32 rx_zeroc_thresh;
dma_addr_t dma_rx_phy;
u32 rx_tail_addr;
unsigned int state_saved;
@@ -266,7 +265,6 @@ struct stmmac_priv {
int sph_cap;
u32 sarc_type;
- unsigned int rx_copybreak;
u32 rx_riwt[MTL_MAX_TX_QUEUES];
int hwts_rx_en;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 1d77389ce953..16b4d8c21c90 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -1227,43 +1227,6 @@ static int stmmac_get_ts_info(struct net_device *dev,
return ethtool_op_get_ts_info(dev, info);
}
-static int stmmac_get_tunable(struct net_device *dev,
- const struct ethtool_tunable *tuna, void *data)
-{
- struct stmmac_priv *priv = netdev_priv(dev);
- int ret = 0;
-
- switch (tuna->id) {
- case ETHTOOL_RX_COPYBREAK:
- *(u32 *)data = priv->rx_copybreak;
- break;
- default:
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
-static int stmmac_set_tunable(struct net_device *dev,
- const struct ethtool_tunable *tuna,
- const void *data)
-{
- struct stmmac_priv *priv = netdev_priv(dev);
- int ret = 0;
-
- switch (tuna->id) {
- case ETHTOOL_RX_COPYBREAK:
- priv->rx_copybreak = *(u32 *)data;
- break;
- default:
- ret = -EINVAL;
- break;
- }
-
- return ret;
-}
-
static int stmmac_get_mm(struct net_device *ndev,
struct ethtool_mm_state *state)
{
@@ -1390,8 +1353,6 @@ static const struct ethtool_ops stmmac_ethtool_ops = {
.set_per_queue_coalesce = stmmac_set_per_queue_coalesce,
.get_channels = stmmac_get_channels,
.set_channels = stmmac_set_channels,
- .get_tunable = stmmac_get_tunable,
- .set_tunable = stmmac_set_tunable,
.get_link_ksettings = stmmac_ethtool_get_link_ksettings,
.set_link_ksettings = stmmac_ethtool_set_link_ksettings,
.get_mm = stmmac_get_mm,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 16b8bcfa8b11..6bc10ffe7a2b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -77,7 +77,6 @@ module_param(phyaddr, int, 0444);
MODULE_PARM_DESC(phyaddr, "Physical device address");
#define STMMAC_TX_THRESH(x) ((x)->dma_conf.dma_tx_size / 4)
-#define STMMAC_RX_THRESH(x) ((x)->dma_conf.dma_rx_size / 4)
/* Limit to make sure XDP TX and slow path can coexist */
#define STMMAC_XSK_TX_BUDGET_MAX 256
@@ -107,8 +106,6 @@ static int buf_sz = DEFAULT_BUFSIZE;
module_param(buf_sz, int, 0644);
MODULE_PARM_DESC(buf_sz, "DMA buffer size");
-#define STMMAC_RX_COPYBREAK 256
-
static const u32 default_msg_level = (NETIF_MSG_DRV | NETIF_MSG_PROBE |
NETIF_MSG_LINK | NETIF_MSG_IFUP |
NETIF_MSG_IFDOWN | NETIF_MSG_TIMER);
@@ -3927,8 +3924,6 @@ static int __stmmac_open(struct net_device *dev,
}
}
- priv->rx_copybreak = STMMAC_RX_COPYBREAK;
-
buf_sz = dma_conf->dma_buf_sz;
for (int i = 0; i < MTL_MAX_TX_QUEUES; i++)
if (priv->dma_conf.tx_queue[i].tbs & STMMAC_TBS_EN)
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
2024-12-18 8:34 [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak Furong Xu
@ 2024-12-18 15:48 ` Alexander Lobakin
2024-12-19 0:42 ` Jakub Kicinski
2024-12-20 3:30 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Lobakin @ 2024-12-18 15:48 UTC (permalink / raw)
To: Furong Xu
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, Simon Horman,
Alexandre Torgue, Jose Abreu, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin, xfr
From: Furong Xu <0x1207@gmail.com>
Date: Wed, 18 Dec 2024 16:34:07 +0800
> After commit 2af6106ae949 ("net: stmmac: Introducing support for Page
> Pool"), the driver always copies frames to get a better performance,
> zero-copy for RX frames is no more, then these code turned to be
> useless and users of ethtool may get confused about the unhandled
> rx-copybreak parameter.
>
> This patch mostly reverts
> commit 22ad38381547 ("stmmac: do not perform zero-copy for rx frames")
>
> Signed-off-by: Furong Xu <0x1207@gmail.com>
The patch itself is fine, *but*
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 -
> .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 39 -------------------
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 5 ---
> 3 files changed, 46 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index 1d86439b8a14..b8d631e559c0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -126,7 +126,6 @@ struct stmmac_rx_queue {
> unsigned int cur_rx;
> unsigned int dirty_rx;
> unsigned int buf_alloc_num;
> - u32 rx_zeroc_thresh;
> dma_addr_t dma_rx_phy;
If sizeof(dma_addr_t) == 8, you're clearly introducing a 4-byte hole
here. Perhaps you could reshuffle the struct a bit to avoid this.
It's always good to inspect the .kos with pahole after modifying
structures to make sure there are no regressions.
> u32 rx_tail_addr;
> unsigned int state_saved;
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
2024-12-18 15:48 ` Alexander Lobakin
@ 2024-12-19 0:42 ` Jakub Kicinski
2024-12-19 14:20 ` Alexander Lobakin
0 siblings, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-12-19 0:42 UTC (permalink / raw)
To: Alexander Lobakin
Cc: Furong Xu, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Simon Horman, Alexandre Torgue, Jose Abreu, Andrew Lunn,
David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin, xfr
On Wed, 18 Dec 2024 16:48:38 +0100 Alexander Lobakin wrote:
> If sizeof(dma_addr_t) == 8, you're clearly introducing a 4-byte hole
> here. Perhaps you could reshuffle the struct a bit to avoid this.
>
> It's always good to inspect the .kos with pahole after modifying
> structures to make sure there are no regressions.
Pretty off topic but I have a dumb question - how do you dump a struct
with pahole using debug info or BTF from a random .ko?
Ever since pahole got converted to BTF modules stopped working for me :S
I never cared enough to check as most interesting stuff is built-in
in Meta's kernels but it annoys me every now and then..
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
2024-12-19 0:42 ` Jakub Kicinski
@ 2024-12-19 14:20 ` Alexander Lobakin
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2024-12-19 14:20 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Furong Xu, netdev, linux-stm32, linux-arm-kernel, linux-kernel,
Simon Horman, Alexandre Torgue, Jose Abreu, Andrew Lunn,
David S. Miller, Eric Dumazet, Paolo Abeni, Maxime Coquelin, xfr
From: Jakub Kicinski <kuba@kernel.org>
Date: Wed, 18 Dec 2024 16:42:06 -0800
> On Wed, 18 Dec 2024 16:48:38 +0100 Alexander Lobakin wrote:
>> If sizeof(dma_addr_t) == 8, you're clearly introducing a 4-byte hole
>> here. Perhaps you could reshuffle the struct a bit to avoid this.
>>
>> It's always good to inspect the .kos with pahole after modifying
>> structures to make sure there are no regressions.
>
> Pretty off topic but I have a dumb question - how do you dump a struct
> with pahole using debug info or BTF from a random .ko?
> Ever since pahole got converted to BTF modules stopped working for me :S
Hmm...
I have this
CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_INFO_NONE is not set
# CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is not set
# CONFIG_DEBUG_INFO_DWARF4 is not set
CONFIG_DEBUG_INFO_DWARF5=y
# CONFIG_DEBUG_INFO_REDUCED is not set
# CONFIG_DEBUG_INFO_COMPRESSED_NONE is not set
# CONFIG_DEBUG_INFO_COMPRESSED_ZLIB is not set
CONFIG_DEBUG_INFO_COMPRESSED_ZSTD=y
# CONFIG_DEBUG_INFO_SPLIT is not set
CONFIG_DEBUG_INFO_BTF=y
CONFIG_DEBUG_INFO_BTF_MODULES=y
CONFIG_PAHOLE_VERSION=127
CONFIG_PAHOLE_HAS_SPLIT_BTF=y
CONFIG_PAHOLE_HAS_BTF_TAG=y
CONFIG_PAHOLE_HAS_LANG_EXCLUDE=y
enabled in .config, then I just do
$ pahole path/to/module.ko | less
and search for the struct :D
My pahole is korg Git HEAD.
> I never cared enough to check as most interesting stuff is built-in
> in Meta's kernels but it annoys me every now and then..
Thanks,
Olek
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
2024-12-18 8:34 [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak Furong Xu
2024-12-18 15:48 ` Alexander Lobakin
@ 2024-12-20 3:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-20 3:30 UTC (permalink / raw)
To: Furong Xu
Cc: netdev, linux-stm32, linux-arm-kernel, linux-kernel, horms,
alexandre.torgue, joabreu, andrew+netdev, davem, edumazet, kuba,
pabeni, mcoquelin.stm32, xfr
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 18 Dec 2024 16:34:07 +0800 you wrote:
> After commit 2af6106ae949 ("net: stmmac: Introducing support for Page
> Pool"), the driver always copies frames to get a better performance,
> zero-copy for RX frames is no more, then these code turned to be
> useless and users of ethtool may get confused about the unhandled
> rx-copybreak parameter.
>
> This patch mostly reverts
> commit 22ad38381547 ("stmmac: do not perform zero-copy for rx frames")
>
> [...]
Here is the summary with links:
- [net-next,v1] net: stmmac: Drop useless code related to ethtool rx-copybreak
https://git.kernel.org/netdev/net-next/c/5c98e89d96ec
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-20 3:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 8:34 [PATCH net-next v1] net: stmmac: Drop useless code related to ethtool rx-copybreak Furong Xu
2024-12-18 15:48 ` Alexander Lobakin
2024-12-19 0:42 ` Jakub Kicinski
2024-12-19 14:20 ` Alexander Lobakin
2024-12-20 3:30 ` patchwork-bot+netdevbpf
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).