[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 12 Dec 2013 10:17:05 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Salam Noureddine <noureddine@...stanetworks.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jiri Pirko <jiri@...nulli.us>,
Patrick McHardy <kaber@...sh.net>,
Larry Finger <Larry.Finger@...inger.net>,
Peter Zijlstra <peterz@...radead.org>,
netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/1] forcedeth: add MII ioctls support
2013/12/11 Salam Noureddine <noureddine@...stanetworks.com>:
>
> Signed-off-by: Salam Noureddine <noureddine@...stanetworks.com>
Would you consider implementing the PHY library knobs instead? You
would get all of that basically for free.
> ---
> drivers/net/ethernet/nvidia/forcedeth.c | 34 +++++++++++++++++++++++++++++++
> 1 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/net/ethernet/nvidia/forcedeth.c b/drivers/net/ethernet/nvidia/forcedeth.c
> index 2d045be..0d8c88a 100644
> --- a/drivers/net/ethernet/nvidia/forcedeth.c
> +++ b/drivers/net/ethernet/nvidia/forcedeth.c
> @@ -5558,6 +5558,38 @@ static int nv_close(struct net_device *dev)
> return 0;
> }
>
> +static int nv_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
> +{
> + int ret = 0;
> + u32 val;
> + struct fe_priv *np = netdev_priv(dev);
> + struct mii_ioctl_data *data = (struct mii_ioctl_data *) &req->ifr_data;
> +
> + switch (cmd) {
> + case SIOCGMIIPHY:
> + data->phy_id = np->phyaddr;
> + break;
> + case SIOCGMIIREG:
> + spin_lock_irq(&np->lock);
> + val = mii_rw(dev, np->phyaddr, data->reg_num & 0x1f, MII_READ);
> + spin_unlock_irq(&np->lock);
> + data->val_out = val;
> + break;
> + case SIOCSMIIREG:
> + if (!capable(CAP_NET_ADMIN))
> + return -EPERM;
> + spin_lock_irq(&np->lock);
> + ret = mii_rw(dev, np->phyaddr, data->reg_num & 0x1f,
> + data->val_in);
> + spin_unlock_irq(&np->lock);
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return ret;
> +}
> +
> static const struct net_device_ops nv_netdev_ops = {
> .ndo_open = nv_open,
> .ndo_stop = nv_close,
> @@ -5568,6 +5600,7 @@ static const struct net_device_ops nv_netdev_ops = {
> .ndo_fix_features = nv_fix_features,
> .ndo_set_features = nv_set_features,
> .ndo_validate_addr = eth_validate_addr,
> + .ndo_do_ioctl = nv_ioctl,
> .ndo_set_mac_address = nv_set_mac_address,
> .ndo_set_rx_mode = nv_set_multicast,
> #ifdef CONFIG_NET_POLL_CONTROLLER
> @@ -5585,6 +5618,7 @@ static const struct net_device_ops nv_netdev_ops_optimized = {
> .ndo_fix_features = nv_fix_features,
> .ndo_set_features = nv_set_features,
> .ndo_validate_addr = eth_validate_addr,
> + .ndo_do_ioctl = nv_ioctl,
> .ndo_set_mac_address = nv_set_mac_address,
> .ndo_set_rx_mode = nv_set_multicast,
> #ifdef CONFIG_NET_POLL_CONTROLLER
> --
> 1.7.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists