Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: stmmac: Simplify ioctl handling
@ 2026-07-18 14:38 Maxime Chevallier
  2026-07-18 21:19 ` Vadim Fedorenko
  0 siblings, 1 reply; 2+ messages in thread
From: Maxime Chevallier @ 2026-07-18 14:38 UTC (permalink / raw)
  To: Andrew Lunn, Jakub Kicinski, davem, Eric Dumazet, Paolo Abeni,
	Simon Horman, Maxime Coquelin, Alexandre Torgue, Russell King
  Cc: Maxime Chevallier, thomas.petazzoni, Alexis Lothoré, netdev,
	linux-kernel, linux-arm-kernel, linux-stm32

Now that timestamping is controlled through an NDO, we can simply
call phylink_mii_ioctl() to handle ioctls.

The only functional difference is that phylink_mii_ioctl() ->
phy_mii_ioctl() can handle SIOCSHWTSTAMP, but this no longer happens
as this ioctl is not longer dispatched to the ndo_eth_ioctl().

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---

Looking at this, I'm wondering if we can't just get rid of SIOCSHWTSTAMP
handling in phy_mii_ioctl(). Looks like we can ?

 .../net/ethernet/stmicro/stmmac/stmmac_main.c   | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 2a0d7eff88d3..562d20830b94 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -6371,28 +6371,17 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data)
  *  @rq: An IOCTL specific structure, that can contain a pointer to
  *  a proprietary structure used to pass information to the driver.
  *  @cmd: IOCTL command
- *  Description:
- *  Currently it supports the phy_mii_ioctl(...) and HW time stamping.
+ *  Description: Forward the PHY ioctls to phylink
+ *  Return: Zero on success or negative error code.
  */
 static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 {
 	struct stmmac_priv *priv = netdev_priv (dev);
-	int ret = -EOPNOTSUPP;
 
 	if (!netif_running(dev))
 		return -EINVAL;
 
-	switch (cmd) {
-	case SIOCGMIIPHY:
-	case SIOCGMIIREG:
-	case SIOCSMIIREG:
-		ret = phylink_mii_ioctl(priv->phylink, rq, cmd);
-		break;
-	default:
-		break;
-	}
-
-	return ret;
+	return phylink_mii_ioctl(priv->phylink, rq, cmd);
 }
 
 static int stmmac_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: stmmac: Simplify ioctl handling
  2026-07-18 14:38 [PATCH net-next] net: stmmac: Simplify ioctl handling Maxime Chevallier
@ 2026-07-18 21:19 ` Vadim Fedorenko
  0 siblings, 0 replies; 2+ messages in thread
From: Vadim Fedorenko @ 2026-07-18 21:19 UTC (permalink / raw)
  To: Maxime Chevallier, Andrew Lunn, Jakub Kicinski, davem,
	Eric Dumazet, Paolo Abeni, Simon Horman, Maxime Coquelin,
	Alexandre Torgue, Russell King
  Cc: thomas.petazzoni, Alexis Lothoré, netdev, linux-kernel,
	linux-arm-kernel, linux-stm32

On 18.07.2026 15:38, Maxime Chevallier wrote:
> Now that timestamping is controlled through an NDO, we can simply
> call phylink_mii_ioctl() to handle ioctls.
> 
> The only functional difference is that phylink_mii_ioctl() ->
> phy_mii_ioctl() can handle SIOCSHWTSTAMP, but this no longer happens
> as this ioctl is not longer dispatched to the ndo_eth_ioctl().
> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
> 
> Looking at this, I'm wondering if we can't just get rid of SIOCSHWTSTAMP
> handling in phy_mii_ioctl(). Looks like we can ?
> 
>   .../net/ethernet/stmicro/stmmac/stmmac_main.c   | 17 +++--------------
>   1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 2a0d7eff88d3..562d20830b94 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -6371,28 +6371,17 @@ static irqreturn_t stmmac_msi_intr_rx(int irq, void *data)
>    *  @rq: An IOCTL specific structure, that can contain a pointer to
>    *  a proprietary structure used to pass information to the driver.
>    *  @cmd: IOCTL command
> - *  Description:
> - *  Currently it supports the phy_mii_ioctl(...) and HW time stamping.
> + *  Description: Forward the PHY ioctls to phylink
> + *  Return: Zero on success or negative error code.
>    */
>   static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
>   {
>   	struct stmmac_priv *priv = netdev_priv (dev);
> -	int ret = -EOPNOTSUPP;
>   
>   	if (!netif_running(dev))
>   		return -EINVAL;
>   
> -	switch (cmd) {
> -	case SIOCGMIIPHY:
> -	case SIOCGMIIREG:
> -	case SIOCSMIIREG:
> -		ret = phylink_mii_ioctl(priv->phylink, rq, cmd);
> -		break;
> -	default:
> -		break;
> -	}
> -
> -	return ret;
> +	return phylink_mii_ioctl(priv->phylink, rq, cmd);
>   }
>   
>   static int stmmac_setup_tc_block_cb(enum tc_setup_type type, void *type_data,

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-18 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-18 14:38 [PATCH net-next] net: stmmac: Simplify ioctl handling Maxime Chevallier
2026-07-18 21:19 ` Vadim Fedorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox