Re: [PATCH 3/3] net: cpsw: implement ioctl for MII

2012-12-04 Thread Jan Lübbe
On Mon, 2012-12-03 at 22:34 +0530, Mugunthan V N wrote:
 Already ndo_do_ioctl is already implemented. Can you rebase the patch 
 with latest git repo
 and resubmit the patch

Sorry, I should have checked that before. I'll update the other patches
and resubmit.
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] net: cpsw: implement ioctl for MII

2012-12-03 Thread Jan Luebbe
This allows using tools like mii-diag on CPSW.

Signed-off-by: Jan Luebbe j...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.c |   15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 8de3e92..f476c03 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -629,6 +629,20 @@ static void cpsw_ndo_change_rx_flags(struct net_device 
*ndev, int flags)
dev_err(ndev-dev, multicast traffic cannot be filtered!\n);
 }
 
+static int cpsw_ndo_do_ioctl(struct net_device *ndev, struct ifreq *rq, int 
cmd)
+{
+   struct cpsw_priv *priv = netdev_priv(ndev);
+   struct phy_device *phy = priv-slaves[0].phy;
+
+   if (!netif_running(ndev))
+   return -EINVAL;
+
+   if (!phy)
+   return -ENODEV;
+
+   return phy_mii_ioctl(phy, rq, cmd);
+}
+
 static void cpsw_ndo_tx_timeout(struct net_device *ndev)
 {
struct cpsw_priv *priv = netdev_priv(ndev);
@@ -670,6 +684,7 @@ static const struct net_device_ops cpsw_netdev_ops = {
.ndo_start_xmit = cpsw_ndo_start_xmit,
.ndo_change_rx_flags= cpsw_ndo_change_rx_flags,
.ndo_validate_addr  = eth_validate_addr,
+   .ndo_do_ioctl   = cpsw_ndo_do_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_tx_timeout = cpsw_ndo_tx_timeout,
.ndo_get_stats  = cpsw_ndo_get_stats,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] net: cpsw: implement ioctl for MII

2012-12-03 Thread Ben Hutchings
On Mon, 2012-12-03 at 14:49 +0100, Jan Luebbe wrote:
 This allows using tools like mii-diag on CPSW.
 
 Signed-off-by: Jan Luebbe j...@pengutronix.de
 ---
  drivers/net/ethernet/ti/cpsw.c |   15 +++
  1 file changed, 15 insertions(+)
 
 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
 index 8de3e92..f476c03 100644
 --- a/drivers/net/ethernet/ti/cpsw.c
 +++ b/drivers/net/ethernet/ti/cpsw.c
 @@ -629,6 +629,20 @@ static void cpsw_ndo_change_rx_flags(struct net_device 
 *ndev, int flags)
   dev_err(ndev-dev, multicast traffic cannot be filtered!\n);
  }
  
 +static int cpsw_ndo_do_ioctl(struct net_device *ndev, struct ifreq *rq, int 
 cmd)
 +{
 + struct cpsw_priv *priv = netdev_priv(ndev);
 + struct phy_device *phy = priv-slaves[0].phy;
 +
 + if (!netif_running(ndev))
 + return -EINVAL;

This is consistent with other drivers, and I'm not going to object to
one more instance, but I don't think this is the proper error code - we
don't know that there's anything wrong with the arguments, it's just
that the *device* is in the wrong state.  I don't know what the right
error code is, though.  Really I would prefer that MDIO would work even
when the device is down, unless you know that all MDIO-manageable
devices are powered off.

Ben.

 + if (!phy)
 + return -ENODEV;
 +
 + return phy_mii_ioctl(phy, rq, cmd);
 +}
 +
  static void cpsw_ndo_tx_timeout(struct net_device *ndev)
  {
   struct cpsw_priv *priv = netdev_priv(ndev);
 @@ -670,6 +684,7 @@ static const struct net_device_ops cpsw_netdev_ops = {
   .ndo_start_xmit = cpsw_ndo_start_xmit,
   .ndo_change_rx_flags= cpsw_ndo_change_rx_flags,
   .ndo_validate_addr  = eth_validate_addr,
 + .ndo_do_ioctl   = cpsw_ndo_do_ioctl,
   .ndo_change_mtu = eth_change_mtu,
   .ndo_tx_timeout = cpsw_ndo_tx_timeout,
   .ndo_get_stats  = cpsw_ndo_get_stats,

-- 
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 linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] net: cpsw: implement ioctl for MII

2012-12-03 Thread Mugunthan V N

On 12/3/2012 7:19 PM, Jan Luebbe wrote:

This allows using tools like mii-diag on CPSW.

Signed-off-by: Jan Luebbe j...@pengutronix.de
---
  drivers/net/ethernet/ti/cpsw.c |   15 +++
  1 file changed, 15 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 8de3e92..f476c03 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -629,6 +629,20 @@ static void cpsw_ndo_change_rx_flags(struct net_device 
*ndev, int flags)
dev_err(ndev-dev, multicast traffic cannot be filtered!\n);
  }
  
+static int cpsw_ndo_do_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)

+{
+   struct cpsw_priv *priv = netdev_priv(ndev);
+   struct phy_device *phy = priv-slaves[0].phy;
+
+   if (!netif_running(ndev))
+   return -EINVAL;
+
+   if (!phy)
+   return -ENODEV;
+
+   return phy_mii_ioctl(phy, rq, cmd);
+}
+
  static void cpsw_ndo_tx_timeout(struct net_device *ndev)
  {
struct cpsw_priv *priv = netdev_priv(ndev);
@@ -670,6 +684,7 @@ static const struct net_device_ops cpsw_netdev_ops = {
.ndo_start_xmit = cpsw_ndo_start_xmit,
.ndo_change_rx_flags= cpsw_ndo_change_rx_flags,
.ndo_validate_addr  = eth_validate_addr,
+   .ndo_do_ioctl   = cpsw_ndo_do_ioctl,
.ndo_change_mtu = eth_change_mtu,
.ndo_tx_timeout = cpsw_ndo_tx_timeout,
.ndo_get_stats  = cpsw_ndo_get_stats,


Already ndo_do_ioctl is already implemented. Can you rebase the patch 
with latest git repo

and resubmit the patch

Regards
Mugunthan V N
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html