Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Blackfin EMAC Driver: Initial version of ethtool support

Signed-off-by: Bryan Wu <cooloney@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>

authored by

Bryan Wu and committed by
Jeff Garzik
679dce39 7ef0a7ee

+47
+47
drivers/net/bfin_mac.c
··· 27 27 #include <linux/phy.h> 28 28 #include <linux/netdevice.h> 29 29 #include <linux/etherdevice.h> 30 + #include <linux/ethtool.h> 30 31 #include <linux/skbuff.h> 31 32 #include <linux/platform_device.h> 32 33 ··· 454 453 455 454 return 0; 456 455 } 456 + 457 + /* 458 + * Ethtool support 459 + */ 460 + 461 + static int 462 + bfin_mac_ethtool_getsettings(struct net_device *dev, struct ethtool_cmd *cmd) 463 + { 464 + struct bfin_mac_local *lp = netdev_priv(dev); 465 + 466 + if (lp->phydev) 467 + return phy_ethtool_gset(lp->phydev, cmd); 468 + 469 + return -EINVAL; 470 + } 471 + 472 + static int 473 + bfin_mac_ethtool_setsettings(struct net_device *dev, struct ethtool_cmd *cmd) 474 + { 475 + struct bfin_mac_local *lp = netdev_priv(dev); 476 + 477 + if (!capable(CAP_NET_ADMIN)) 478 + return -EPERM; 479 + 480 + if (lp->phydev) 481 + return phy_ethtool_sset(lp->phydev, cmd); 482 + 483 + return -EINVAL; 484 + } 485 + 486 + static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev, 487 + struct ethtool_drvinfo *info) 488 + { 489 + strcpy(info->driver, DRV_NAME); 490 + strcpy(info->version, DRV_VERSION); 491 + strcpy(info->fw_version, "N/A"); 492 + strcpy(info->bus_info, dev->dev.bus_id); 493 + } 494 + 495 + static struct ethtool_ops bfin_mac_ethtool_ops = { 496 + .get_settings = bfin_mac_ethtool_getsettings, 497 + .set_settings = bfin_mac_ethtool_setsettings, 498 + .get_link = ethtool_op_get_link, 499 + .get_drvinfo = bfin_mac_ethtool_getdrvinfo, 500 + }; 457 501 458 502 /**************************************************************************/ 459 503 void setup_system_regs(struct net_device *dev) ··· 1043 997 #ifdef CONFIG_NET_POLL_CONTROLLER 1044 998 ndev->poll_controller = bfin_mac_poll; 1045 999 #endif 1000 + ndev->ethtool_ops = &bfin_mac_ethtool_ops; 1046 1001 1047 1002 spin_lock_init(&lp->lock); 1048 1003