* [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename
@ 2025-11-18 9:41 Russell King (Oracle)
2025-11-18 14:04 ` Maxime Chevallier
2025-11-19 16:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2025-11-18 9:41 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Alexei Starovoitov, Andrew Lunn, bpf,
Daniel Borkmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
Jesper Dangaard Brouer, John Fastabend, linux-arm-kernel,
linux-stm32, Maxime Coquelin, netdev, Paolo Abeni,
Stanislav Fomichev
priv->sph* only have 'true' and 'false' used with them, yet they are an
int. Change their type to a bool, and rename to make their usage more
clear.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +--
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 26 +++++++++----------
.../stmicro/stmmac/stmmac_selftests.c | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_xdp.c | 2 +-
4 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index e9ed5086c049..012b0a477255 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -254,8 +254,8 @@ struct stmmac_priv {
int hwts_tx_en;
bool tx_path_in_lpi_mode;
bool tso;
- int sph;
- int sph_cap;
+ bool sph_active;
+ bool sph_capable;
u32 sarc_type;
u32 rx_riwt[MTL_MAX_RX_QUEUES];
int hwts_rx_en;
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index d08ff8f5ff15..db68c89316ec 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1523,7 +1523,7 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv,
buf->page_offset = stmmac_rx_offset(priv);
}
- if (priv->sph && !buf->sec_page) {
+ if (priv->sph_active && !buf->sec_page) {
buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
if (!buf->sec_page)
return -ENOMEM;
@@ -2109,7 +2109,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
pp_params.offset = stmmac_rx_offset(priv);
pp_params.max_len = dma_conf->dma_buf_sz;
- if (priv->sph) {
+ if (priv->sph_active) {
pp_params.offset = 0;
pp_params.max_len += stmmac_rx_offset(priv);
}
@@ -3603,7 +3603,7 @@ static int stmmac_hw_setup(struct net_device *dev)
}
/* Enable Split Header */
- sph_en = (priv->hw->rx_csum > 0) && priv->sph;
+ sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
for (chan = 0; chan < rx_cnt; chan++)
stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
@@ -4895,7 +4895,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
break;
}
- if (priv->sph && !buf->sec_page) {
+ if (priv->sph_active && !buf->sec_page) {
buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
if (!buf->sec_page)
break;
@@ -4906,7 +4906,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset;
stmmac_set_desc_addr(priv, p, buf->addr);
- if (priv->sph)
+ if (priv->sph_active)
stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
else
stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
@@ -4941,12 +4941,12 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv,
int coe = priv->hw->rx_csum;
/* Not first descriptor, buffer is always zero */
- if (priv->sph && len)
+ if (priv->sph_active && len)
return 0;
/* First descriptor, get split header length */
stmmac_get_rx_header_len(priv, p, &hlen);
- if (priv->sph && hlen) {
+ if (priv->sph_active && hlen) {
priv->xstats.rx_split_hdr_pkt_n++;
return hlen;
}
@@ -4969,7 +4969,7 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
unsigned int plen = 0;
/* Not split header, buffer is not available */
- if (!priv->sph)
+ if (!priv->sph_active)
return 0;
/* Not last descriptor */
@@ -6037,8 +6037,8 @@ static int stmmac_set_features(struct net_device *netdev,
*/
stmmac_rx_ipc(priv, priv->hw);
- if (priv->sph_cap) {
- bool sph_en = (priv->hw->rx_csum > 0) && priv->sph;
+ if (priv->sph_capable) {
+ bool sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
u32 chan;
for (chan = 0; chan < priv->plat->rx_queues_to_use; chan++)
@@ -6987,7 +6987,7 @@ int stmmac_xdp_open(struct net_device *dev)
}
/* Adjust Split header */
- sph_en = (priv->hw->rx_csum > 0) && priv->sph;
+ sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
/* DMA RX Channel Configuration */
for (chan = 0; chan < rx_cnt; chan++) {
@@ -7736,8 +7736,8 @@ int stmmac_dvr_probe(struct device *device,
if (priv->dma_cap.sphen &&
!(priv->plat->flags & STMMAC_FLAG_SPH_DISABLE)) {
ndev->hw_features |= NETIF_F_GRO;
- priv->sph_cap = true;
- priv->sph = priv->sph_cap;
+ priv->sph_capable = true;
+ priv->sph_active = priv->sph_capable;
dev_info(priv->device, "SPH feature enabled\n");
}
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index a01bc394d1ac..e90a2c469b9a 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -1721,7 +1721,7 @@ static int stmmac_test_sph(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
- if (!priv->sph)
+ if (!priv->sph_active)
return -EOPNOTSUPP;
/* Check for UDP first */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
index aa6f16d3df64..d7e4db7224b0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
@@ -129,7 +129,7 @@ int stmmac_xdp_set_prog(struct stmmac_priv *priv, struct bpf_prog *prog,
bpf_prog_put(old_prog);
/* Disable RX SPH for XDP operation */
- priv->sph = priv->sph_cap && !stmmac_xdp_is_enabled(priv);
+ priv->sph_active = priv->sph_capable && !stmmac_xdp_is_enabled(priv);
if (if_running && need_update)
stmmac_xdp_open(dev);
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename
2025-11-18 9:41 [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename Russell King (Oracle)
@ 2025-11-18 14:04 ` Maxime Chevallier
2025-11-19 16:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Maxime Chevallier @ 2025-11-18 14:04 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Alexei Starovoitov, Andrew Lunn, bpf,
Daniel Borkmann, David S. Miller, Eric Dumazet, Jakub Kicinski,
Jesper Dangaard Brouer, John Fastabend, linux-arm-kernel,
linux-stm32, Maxime Coquelin, netdev, Paolo Abeni,
Stanislav Fomichev
On 18/11/2025 10:41, Russell King (Oracle) wrote:
> priv->sph* only have 'true' and 'false' used with them, yet they are an
> int. Change their type to a bool, and rename to make their usage more
> clear.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +--
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 26 +++++++++----------
> .../stmicro/stmmac/stmmac_selftests.c | 2 +-
> .../net/ethernet/stmicro/stmmac/stmmac_xdp.c | 2 +-
> 4 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> index e9ed5086c049..012b0a477255 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
> @@ -254,8 +254,8 @@ struct stmmac_priv {
> int hwts_tx_en;
> bool tx_path_in_lpi_mode;
> bool tso;
> - int sph;
> - int sph_cap;
> + bool sph_active;
> + bool sph_capable;
> u32 sarc_type;
> u32 rx_riwt[MTL_MAX_RX_QUEUES];
> int hwts_rx_en;
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index d08ff8f5ff15..db68c89316ec 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -1523,7 +1523,7 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv,
> buf->page_offset = stmmac_rx_offset(priv);
> }
>
> - if (priv->sph && !buf->sec_page) {
> + if (priv->sph_active && !buf->sec_page) {
> buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
> if (!buf->sec_page)
> return -ENOMEM;
> @@ -2109,7 +2109,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
> pp_params.offset = stmmac_rx_offset(priv);
> pp_params.max_len = dma_conf->dma_buf_sz;
>
> - if (priv->sph) {
> + if (priv->sph_active) {
> pp_params.offset = 0;
> pp_params.max_len += stmmac_rx_offset(priv);
> }
> @@ -3603,7 +3603,7 @@ static int stmmac_hw_setup(struct net_device *dev)
> }
>
> /* Enable Split Header */
> - sph_en = (priv->hw->rx_csum > 0) && priv->sph;
> + sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
> for (chan = 0; chan < rx_cnt; chan++)
> stmmac_enable_sph(priv, priv->ioaddr, sph_en, chan);
>
> @@ -4895,7 +4895,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
> break;
> }
>
> - if (priv->sph && !buf->sec_page) {
> + if (priv->sph_active && !buf->sec_page) {
> buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp);
> if (!buf->sec_page)
> break;
> @@ -4906,7 +4906,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
> buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset;
>
> stmmac_set_desc_addr(priv, p, buf->addr);
> - if (priv->sph)
> + if (priv->sph_active)
> stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true);
> else
> stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false);
> @@ -4941,12 +4941,12 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv,
> int coe = priv->hw->rx_csum;
>
> /* Not first descriptor, buffer is always zero */
> - if (priv->sph && len)
> + if (priv->sph_active && len)
> return 0;
>
> /* First descriptor, get split header length */
> stmmac_get_rx_header_len(priv, p, &hlen);
> - if (priv->sph && hlen) {
> + if (priv->sph_active && hlen) {
> priv->xstats.rx_split_hdr_pkt_n++;
> return hlen;
> }
> @@ -4969,7 +4969,7 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
> unsigned int plen = 0;
>
> /* Not split header, buffer is not available */
> - if (!priv->sph)
> + if (!priv->sph_active)
> return 0;
>
> /* Not last descriptor */
> @@ -6037,8 +6037,8 @@ static int stmmac_set_features(struct net_device *netdev,
> */
> stmmac_rx_ipc(priv, priv->hw);
>
> - if (priv->sph_cap) {
> - bool sph_en = (priv->hw->rx_csum > 0) && priv->sph;
> + if (priv->sph_capable) {
> + bool sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
> u32 chan;
>
> for (chan = 0; chan < priv->plat->rx_queues_to_use; chan++)
> @@ -6987,7 +6987,7 @@ int stmmac_xdp_open(struct net_device *dev)
> }
>
> /* Adjust Split header */
> - sph_en = (priv->hw->rx_csum > 0) && priv->sph;
> + sph_en = (priv->hw->rx_csum > 0) && priv->sph_active;
>
> /* DMA RX Channel Configuration */
> for (chan = 0; chan < rx_cnt; chan++) {
> @@ -7736,8 +7736,8 @@ int stmmac_dvr_probe(struct device *device,
> if (priv->dma_cap.sphen &&
> !(priv->plat->flags & STMMAC_FLAG_SPH_DISABLE)) {
> ndev->hw_features |= NETIF_F_GRO;
> - priv->sph_cap = true;
> - priv->sph = priv->sph_cap;
> + priv->sph_capable = true;
> + priv->sph_active = priv->sph_capable;
> dev_info(priv->device, "SPH feature enabled\n");
> }
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> index a01bc394d1ac..e90a2c469b9a 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
> @@ -1721,7 +1721,7 @@ static int stmmac_test_sph(struct stmmac_priv *priv)
> struct stmmac_packet_attrs attr = { };
> int ret;
>
> - if (!priv->sph)
> + if (!priv->sph_active)
> return -EOPNOTSUPP;
>
> /* Check for UDP first */
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
> index aa6f16d3df64..d7e4db7224b0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c
> @@ -129,7 +129,7 @@ int stmmac_xdp_set_prog(struct stmmac_priv *priv, struct bpf_prog *prog,
> bpf_prog_put(old_prog);
>
> /* Disable RX SPH for XDP operation */
> - priv->sph = priv->sph_cap && !stmmac_xdp_is_enabled(priv);
> + priv->sph_active = priv->sph_capable && !stmmac_xdp_is_enabled(priv);
>
> if (if_running && need_update)
> stmmac_xdp_open(dev);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename
2025-11-18 9:41 [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename Russell King (Oracle)
2025-11-18 14:04 ` Maxime Chevallier
@ 2025-11-19 16:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-19 16:40 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandre.torgue, ast, andrew+netdev, bpf,
daniel, davem, edumazet, kuba, hawk, john.fastabend,
linux-arm-kernel, linux-stm32, mcoquelin.stm32, netdev, pabeni,
sdf
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 18 Nov 2025 09:41:33 +0000 you wrote:
> priv->sph* only have 'true' and 'false' used with them, yet they are an
> int. Change their type to a bool, and rename to make their usage more
> clear.
>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
> drivers/net/ethernet/stmicro/stmmac/stmmac.h | 4 +--
> .../net/ethernet/stmicro/stmmac/stmmac_main.c | 26 +++++++++----------
> .../stmicro/stmmac/stmmac_selftests.c | 2 +-
> .../net/ethernet/stmicro/stmmac/stmmac_xdp.c | 2 +-
> 4 files changed, 17 insertions(+), 17 deletions(-)
Here is the summary with links:
- [net-next] net: stmmac: convert priv->sph* to boolean and rename
https://git.kernel.org/netdev/net-next/c/7ac60a14d3fc
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] 3+ messages in thread
end of thread, other threads:[~2025-11-19 16:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18 9:41 [PATCH net-next] net: stmmac: convert priv->sph* to boolean and rename Russell King (Oracle)
2025-11-18 14:04 ` Maxime Chevallier
2025-11-19 16:40 ` 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).