]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
ll_temac: Add support for ethtool
authorRicardo <ricardo.ribalda@gmail.com>
Tue, 18 Oct 2011 21:35:25 +0000 (21:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Oct 2011 21:10:55 +0000 (17:10 -0400)
This patch enables the ethtool interface. The implementation is done
using the libphy helper functions.

Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/xilinx/ll_temac_main.c

index 85ba4d9ac17019b62f6acecce64ce72bb02f0690..4d1658e78dee50e8493994d4d5d421fe176362a9 100644 (file)
@@ -955,6 +955,32 @@ static const struct attribute_group temac_attr_group = {
        .attrs = temac_device_attrs,
 };
 
+/* ethtool support */
+static int temac_get_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+       struct temac_local *lp = netdev_priv(ndev);
+       return phy_ethtool_gset(lp->phy_dev, cmd);
+}
+
+static int temac_set_settings(struct net_device *ndev, struct ethtool_cmd *cmd)
+{
+       struct temac_local *lp = netdev_priv(ndev);
+       return phy_ethtool_sset(lp->phy_dev, cmd);
+}
+
+static int temac_nway_reset(struct net_device *ndev)
+{
+       struct temac_local *lp = netdev_priv(ndev);
+       return phy_start_aneg(lp->phy_dev);
+}
+
+static const struct ethtool_ops temac_ethtool_ops = {
+       .get_settings = temac_get_settings,
+       .set_settings = temac_set_settings,
+       .nway_reset = temac_nway_reset,
+       .get_link = ethtool_op_get_link,
+};
+
 static int __devinit temac_of_probe(struct platform_device *op)
 {
        struct device_node *np;
@@ -976,6 +1002,7 @@ static int __devinit temac_of_probe(struct platform_device *op)
        ndev->flags &= ~IFF_MULTICAST;  /* clear multicast */
        ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST;
        ndev->netdev_ops = &temac_netdev_ops;
+       ndev->ethtool_ops = &temac_ethtool_ops;
 #if 0
        ndev->features |= NETIF_F_IP_CSUM; /* Can checksum TCP/UDP over IPv4. */
        ndev->features |= NETIF_F_HW_CSUM; /* Can checksum all the packets. */