lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1349378262.2817.25.camel@bwh-desktop.uk.solarflarecom.com>
Date:	Thu, 4 Oct 2012 20:17:42 +0100
From:	Ben Hutchings <bhutchings@...arflare.com>
To:	Michal Simek <monstr@...str.eu>
CC:	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	Anirudha Sarangi <anirudh@...inx.com>,
	John Linn <John.Linn@...inx.com>,
	Grant Likely <grant.likely@...retlab.ca>,
	Rob Herring <rob.herring@...xeda.com>,
	"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH 02/11] net: axienet: Add ioctl support

On Thu, 2012-10-04 at 20:14 +0200, Michal Simek wrote:
> Allow user to access the MDIO from userspace.
> 
> Signed-off-by: Michal Simek <monstr@...str.eu>
> CC: Anirudha Sarangi <anirudh@...inx.com>
> CC: John Linn <John.Linn@...inx.com>
> CC: Grant Likely <grant.likely@...retlab.ca>
> CC: Rob Herring <rob.herring@...xeda.com>
> CC: David S. Miller <davem@...emloft.net>
> ---
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 50167ab..a5b41cd 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1053,6 +1053,20 @@ static void axienet_poll_controller(struct net_device *ndev)
>  }
>  #endif
>  
> +/* Ioctl MII Interface */
> +static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> +{
> +	struct axienet_local *priv = netdev_priv(dev);
> +
> +	if (!netif_running(dev))
> +		return -EINVAL;

Not sure this is the appropriate error code.

> +	if (!priv->phy_dev)
> +		return -ENODEV;

Error code should be EOPNOTSUPP - the device is present but just doesn't
support MDIO.

Ben.

> +	return phy_mii_ioctl(priv->phy_dev, rq, cmd);
> +}
> +
>  static const struct net_device_ops axienet_netdev_ops = {
>  	.ndo_open = axienet_open,
>  	.ndo_stop = axienet_stop,
> @@ -1061,6 +1075,7 @@ static const struct net_device_ops axienet_netdev_ops = {
>  	.ndo_set_mac_address = netdev_set_mac_address,
>  	.ndo_validate_addr = eth_validate_addr,
>  	.ndo_set_rx_mode = axienet_set_multicast_list,
> +	.ndo_do_ioctl = axienet_ioctl,
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	.ndo_poll_controller = axienet_poll_controller,
>  #endif

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ