mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 13:00:54 +07:00
net: preserve ifreq parameter when calling generic phy_mii_ioctl().
The phy_mii_ioctl() function unnecessarily throws away the original ifreq. We need access to the ifreq in order to support PHYs that can perform hardware time stamping. Two maverick drivers filter the ioctl commands passed to phy_mii_ioctl(). This is unnecessary since phylib will check the command in any case. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
4507a71507
commit
28b041139e
@ -782,7 +782,8 @@ static int eth_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
|
||||
|
||||
if (!netif_running(dev))
|
||||
return -EINVAL;
|
||||
return phy_mii_ioctl(port->phydev, if_mii(req), cmd);
|
||||
|
||||
return phy_mii_ioctl(port->phydev, req, cmd);
|
||||
}
|
||||
|
||||
/* ethtool support */
|
||||
|
@ -978,7 +978,7 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!aup->phy_dev)
|
||||
return -EINVAL; /* PHY not controllable */
|
||||
|
||||
return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(aup->phy_dev, rq, cmd);
|
||||
}
|
||||
|
||||
static const struct net_device_ops au1000_netdev_ops = {
|
||||
|
@ -1496,7 +1496,7 @@ static int bcm_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (priv->has_phy) {
|
||||
if (!priv->phydev)
|
||||
return -ENODEV;
|
||||
return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(priv->phydev, rq, cmd);
|
||||
} else {
|
||||
struct mii_if_info mii;
|
||||
|
||||
|
@ -846,11 +846,8 @@ static int cpmac_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
return -EINVAL;
|
||||
if (!priv->phy)
|
||||
return -EINVAL;
|
||||
if ((cmd == SIOCGMIIPHY) || (cmd == SIOCGMIIREG) ||
|
||||
(cmd == SIOCSMIIREG))
|
||||
return phy_mii_ioctl(priv->phy, if_mii(ifr), cmd);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
return phy_mii_ioctl(priv->phy, ifr, cmd);
|
||||
}
|
||||
|
||||
static int cpmac_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
|
||||
|
@ -797,7 +797,7 @@ static int dnet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static void dnet_get_drvinfo(struct net_device *dev,
|
||||
|
@ -730,7 +730,7 @@ static int ethoc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
phy = priv->phy;
|
||||
}
|
||||
|
||||
return phy_mii_ioctl(phy, mdio, cmd);
|
||||
return phy_mii_ioctl(phy, ifr, cmd);
|
||||
}
|
||||
|
||||
static int ethoc_config(struct net_device *dev, struct ifmap *map)
|
||||
|
@ -825,7 +825,7 @@ static int fec_enet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static void fec_enet_free_buffers(struct net_device *dev)
|
||||
|
@ -826,7 +826,7 @@ static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!priv->phydev)
|
||||
return -ENOTSUPP;
|
||||
|
||||
return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(priv->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static const struct net_device_ops mpc52xx_fec_netdev_ops = {
|
||||
|
@ -963,12 +963,11 @@ static const struct ethtool_ops fs_ethtool_ops = {
|
||||
static int fs_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct fs_enet_private *fep = netdev_priv(dev);
|
||||
struct mii_ioctl_data *mii = (struct mii_ioctl_data *)&rq->ifr_data;
|
||||
|
||||
if (!netif_running(dev))
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(fep->phydev, mii, cmd);
|
||||
return phy_mii_ioctl(fep->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
extern int fs_mii_connect(struct net_device *dev);
|
||||
|
@ -847,7 +847,7 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!priv->phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(priv->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static unsigned int reverse_bitmap(unsigned int bit_map, unsigned int max_qs)
|
||||
|
@ -1082,7 +1082,7 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static const struct net_device_ops macb_netdev_ops = {
|
||||
|
@ -2461,7 +2461,7 @@ static int mv643xx_eth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
struct mv643xx_eth_private *mp = netdev_priv(dev);
|
||||
|
||||
if (mp->phy != NULL)
|
||||
return phy_mii_ioctl(mp->phy, if_mii(ifr), cmd);
|
||||
return phy_mii_ioctl(mp->phy, ifr, cmd);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ static int octeon_mgmt_ioctl(struct net_device *netdev,
|
||||
if (!p->phydev)
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(p->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(p->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static void octeon_mgmt_adjust_link(struct net_device *netdev)
|
||||
|
@ -309,8 +309,9 @@ EXPORT_SYMBOL(phy_ethtool_gset);
|
||||
* current state. Use at own risk.
|
||||
*/
|
||||
int phy_mii_ioctl(struct phy_device *phydev,
|
||||
struct mii_ioctl_data *mii_data, int cmd)
|
||||
struct ifreq *ifr, int cmd)
|
||||
{
|
||||
struct mii_ioctl_data *mii_data = if_mii(ifr);
|
||||
u16 val = mii_data->val_in;
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -2532,7 +2532,7 @@ static int sbmac_mii_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!netif_running(dev) || !sc->phy_dev)
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(sc->phy_dev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(sc->phy_dev, rq, cmd);
|
||||
}
|
||||
|
||||
static int sbmac_close(struct net_device *dev)
|
||||
|
@ -1284,7 +1284,7 @@ static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
|
||||
if (!phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(phydev, rq, cmd);
|
||||
}
|
||||
|
||||
#if defined(SH_ETH_HAS_TSU)
|
||||
|
@ -1538,7 +1538,7 @@ static int smsc911x_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
if (!netif_running(dev) || !pdata->phy_dev)
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(pdata->phy_dev, if_mii(ifr), cmd);
|
||||
return phy_mii_ioctl(pdata->phy_dev, ifr, cmd);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -245,7 +245,7 @@ static int smsc9420_do_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
if (!netif_running(dev) || !pd->phy_dev)
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(pd->phy_dev, if_mii(ifr), cmd);
|
||||
return phy_mii_ioctl(pd->phy_dev, ifr, cmd);
|
||||
}
|
||||
|
||||
static int smsc9420_ethtool_get_settings(struct net_device *dev,
|
||||
|
@ -1437,24 +1437,18 @@ static void stmmac_poll_controller(struct net_device *dev)
|
||||
static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
{
|
||||
struct stmmac_priv *priv = netdev_priv(dev);
|
||||
int ret = -EOPNOTSUPP;
|
||||
int ret;
|
||||
|
||||
if (!netif_running(dev))
|
||||
return -EINVAL;
|
||||
|
||||
switch (cmd) {
|
||||
case SIOCGMIIPHY:
|
||||
case SIOCGMIIREG:
|
||||
case SIOCSMIIREG:
|
||||
if (!priv->phydev)
|
||||
return -EINVAL;
|
||||
if (!priv->phydev)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock(&priv->lock);
|
||||
ret = phy_mii_ioctl(priv->phydev, rq, cmd);
|
||||
spin_unlock(&priv->lock);
|
||||
|
||||
spin_lock(&priv->lock);
|
||||
ret = phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
|
||||
spin_unlock(&priv->lock);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2066,7 +2066,7 @@ static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
return -EINVAL;
|
||||
if (!lp->phy_dev)
|
||||
return -ENODEV;
|
||||
return phy_mii_ioctl(lp->phy_dev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(lp->phy_dev, rq, cmd);
|
||||
}
|
||||
|
||||
static void tc35815_chip_reset(struct net_device *dev)
|
||||
|
@ -10932,7 +10932,7 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
if (!(tp->tg3_flags3 & TG3_FLG3_PHY_CONNECTED))
|
||||
return -EAGAIN;
|
||||
phydev = tp->mdio_bus->phy_map[TG3_PHY_MII_ADDR];
|
||||
return phy_mii_ioctl(phydev, data, cmd);
|
||||
return phy_mii_ioctl(phydev, ifr, cmd);
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -3714,7 +3714,7 @@ static int ucc_geth_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!ugeth->phydev)
|
||||
return -ENODEV;
|
||||
|
||||
return phy_mii_ioctl(ugeth->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(ugeth->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static const struct net_device_ops ucc_geth_netdev_ops = {
|
||||
|
@ -113,7 +113,7 @@ int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
|
||||
if (!priv->phydev)
|
||||
return -EINVAL;
|
||||
|
||||
return phy_mii_ioctl(priv->phydev, if_mii(rq), cmd);
|
||||
return phy_mii_ioctl(priv->phydev, rq, cmd);
|
||||
}
|
||||
|
||||
static void cvm_oct_adjust_link(struct net_device *dev)
|
||||
|
@ -498,7 +498,7 @@ void phy_stop_machine(struct phy_device *phydev);
|
||||
int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
|
||||
int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
|
||||
int phy_mii_ioctl(struct phy_device *phydev,
|
||||
struct mii_ioctl_data *mii_data, int cmd);
|
||||
struct ifreq *ifr, int cmd);
|
||||
int phy_start_interrupts(struct phy_device *phydev);
|
||||
void phy_print_status(struct phy_device *phydev);
|
||||
struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
|
||||
|
@ -164,10 +164,9 @@ static int dsa_slave_set_mac_address(struct net_device *dev, void *a)
|
||||
static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
{
|
||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||
struct mii_ioctl_data *mii_data = if_mii(ifr);
|
||||
|
||||
if (p->phy != NULL)
|
||||
return phy_mii_ioctl(p->phy, mii_data, cmd);
|
||||
return phy_mii_ioctl(p->phy, ifr, cmd);
|
||||
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user