mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
net: cpsw: isolate cpsw_ndo_ioctl() to just the old driver
cpsw->slaves[slave_no].phy should be equal to netdev->phydev, because it is assigned from phy_attach_direct(). The latter is indirectly called from the two identically named cpsw_slave_open() functions, one in cpsw.c and another in cpsw_new.c. Thus, the driver should not need custom logic to find the PHY, the core can find it, and phy_do_ioctl_running() achieves exactly that. However, that is only the case for cpsw_new and for the cpsw driver in dual EMAC mode. This is explained in more detail in the previous commit. Thus, allow the simpler core logic to execute for cpsw_new, and move cpsw_ndo_ioctl() to cpsw.c. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Link: https://patch.msgid.link/20250512114422.4176010-2-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
36d9b54258
commit
4cde0e4224
|
|
@ -1156,6 +1156,27 @@ static void cpsw_ndo_poll_controller(struct net_device *ndev)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* We need a custom implementation of phy_do_ioctl_running() because in switch
|
||||
* mode, dev->phydev may be different than the phy of the active_slave. We need
|
||||
* to operate on the locally saved phy instead.
|
||||
*/
|
||||
static int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
||||
{
|
||||
struct cpsw_priv *priv = netdev_priv(dev);
|
||||
struct cpsw_common *cpsw = priv->cpsw;
|
||||
int slave_no = cpsw_slave_index(cpsw, priv);
|
||||
struct phy_device *phy;
|
||||
|
||||
if (!netif_running(dev))
|
||||
return -EINVAL;
|
||||
|
||||
phy = cpsw->slaves[slave_no].phy;
|
||||
if (phy)
|
||||
return phy_mii_ioctl(phy, req, cmd);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static const struct net_device_ops cpsw_netdev_ops = {
|
||||
.ndo_open = cpsw_ndo_open,
|
||||
.ndo_stop = cpsw_ndo_stop,
|
||||
|
|
|
|||
|
|
@ -1132,7 +1132,7 @@ static const struct net_device_ops cpsw_netdev_ops = {
|
|||
.ndo_stop = cpsw_ndo_stop,
|
||||
.ndo_start_xmit = cpsw_ndo_start_xmit,
|
||||
.ndo_set_mac_address = cpsw_ndo_set_mac_address,
|
||||
.ndo_eth_ioctl = cpsw_ndo_ioctl,
|
||||
.ndo_eth_ioctl = phy_do_ioctl_running,
|
||||
.ndo_validate_addr = eth_validate_addr,
|
||||
.ndo_tx_timeout = cpsw_ndo_tx_timeout,
|
||||
.ndo_set_rx_mode = cpsw_ndo_set_rx_mode,
|
||||
|
|
|
|||
|
|
@ -710,23 +710,6 @@ int cpsw_hwtstamp_set(struct net_device *dev,
|
|||
}
|
||||
#endif /*CONFIG_TI_CPTS*/
|
||||
|
||||
int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
||||
{
|
||||
struct cpsw_priv *priv = netdev_priv(dev);
|
||||
struct cpsw_common *cpsw = priv->cpsw;
|
||||
int slave_no = cpsw_slave_index(cpsw, priv);
|
||||
struct phy_device *phy;
|
||||
|
||||
if (!netif_running(dev))
|
||||
return -EINVAL;
|
||||
|
||||
phy = cpsw->slaves[slave_no].phy;
|
||||
if (phy)
|
||||
return phy_mii_ioctl(phy, req, cmd);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate)
|
||||
{
|
||||
struct cpsw_priv *priv = netdev_priv(ndev);
|
||||
|
|
|
|||
|
|
@ -461,7 +461,6 @@ void soft_reset(const char *module, void __iomem *reg);
|
|||
void cpsw_set_slave_mac(struct cpsw_slave *slave, struct cpsw_priv *priv);
|
||||
void cpsw_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue);
|
||||
int cpsw_need_resplit(struct cpsw_common *cpsw);
|
||||
int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
|
||||
int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate);
|
||||
int cpsw_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
|
||||
void *type_data);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user