[PATCH net-next 1/3] net: stmmac: fpe: Enforce pmac_enabled in set_mm and keep it on at init

Maxime Chevallier maxime.chevallier at bootlin.com
Tue Jul 28 23:26:28 PDT 2026


Hi,

On 7/29/26 03:52, muhammad.nazim.amirul.nazle.asmade at altera.com wrote:
> From: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade at altera.com>
> 
> The preemptive MAC in DWMAC is always enabled, meaning DWMAC is always
> ready to receive preemptive mPackets. Initialize pmac_enabled to true
> at init time and reject attempts to disable it via ethtool set_mm.
> 
> Also add a missing fpesel capability check in stmmac_set_mm() to return
> -EOPNOTSUPP early on hardware without FPE support.
> 
> Signed-off-by: Rohan G Thomas <rohan.g.thomas at altera.com>
> Signed-off-by: Nazim Amirul <muhammad.nazim.amirul.nazle.asmade at altera.com>

Reviewed-by: Maxime Chevallier <maxime.chevallier at bootlin.com>

Maxime

> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 7 +++++++
>  drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c     | 5 +++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> index 92585d27ab88..8ebdd249e5c8 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
> @@ -1064,6 +1064,13 @@ static int stmmac_set_mm(struct net_device *ndev, struct ethtool_mm_cfg *cfg,
>  	if (err)
>  		return err;
>  
> +	if (!priv->dma_cap.fpesel)
> +		return -EOPNOTSUPP;
> +
> +	/* DWMAC always have preemptible MAC enabled */
> +	if (!cfg->pmac_enabled)
> +		return -EINVAL;
> +
>  	stmmac_fpe_set_add_frag_size(priv, frag_size);
>  	ethtool_mmsv_set_mm(&priv->fpe_cfg.mmsv, cfg);
>  
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
> index c54c70224351..2f880c5e35b0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c
> @@ -176,6 +176,11 @@ void stmmac_fpe_init(struct stmmac_priv *priv)
>  	if ((!priv->fpe_cfg.reg || !priv->hw->mac->fpe_map_preemption_class) &&
>  	    priv->dma_cap.fpesel)
>  		dev_info(priv->device, "FPE is not supported by driver.\n");
> +
> +	/* The preemptive MAC in DWMAC is always enabled, so initialize
> +	 * pmac_enabled to true to reflect the hardware state.
> +	 */
> +	priv->fpe_cfg.mmsv.pmac_enabled = true;
>  }
>  
>  int stmmac_fpe_get_add_frag_size(struct stmmac_priv *priv)




More information about the linux-arm-kernel mailing list