spider_net_ethtool.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Network device driver for Cell Processor-Based Blade
  3. *
  4. * (C) Copyright IBM Corp. 2005
  5. *
  6. * Authors : Utz Bacher <utz.bacher@de.ibm.com>
  7. * Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2, or (at your option)
  12. * any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */
  23. #include <linux/netdevice.h>
  24. #include <linux/ethtool.h>
  25. #include <linux/pci.h>
  26. #include "spider_net.h"
  27. static void
  28. spider_net_ethtool_get_drvinfo(struct net_device *netdev,
  29. struct ethtool_drvinfo *drvinfo)
  30. {
  31. struct spider_net_card *card;
  32. card = netdev_priv(netdev);
  33. /* clear and fill out info */
  34. memset(drvinfo, 0, sizeof(struct ethtool_drvinfo));
  35. strncpy(drvinfo->driver, spider_net_driver_name, 32);
  36. strncpy(drvinfo->version, "0.1", 32);
  37. strcpy(drvinfo->fw_version, "no information");
  38. strncpy(drvinfo->bus_info, pci_name(card->pdev), 32);
  39. }
  40. static void
  41. spider_net_ethtool_get_wol(struct net_device *netdev,
  42. struct ethtool_wolinfo *wolinfo)
  43. {
  44. /* no support for wol */
  45. wolinfo->supported = 0;
  46. wolinfo->wolopts = 0;
  47. }
  48. static u32
  49. spider_net_ethtool_get_msglevel(struct net_device *netdev)
  50. {
  51. struct spider_net_card *card;
  52. card = netdev_priv(netdev);
  53. return card->msg_enable;
  54. }
  55. static void
  56. spider_net_ethtool_set_msglevel(struct net_device *netdev,
  57. u32 level)
  58. {
  59. struct spider_net_card *card;
  60. card = netdev_priv(netdev);
  61. card->msg_enable = level;
  62. }
  63. static int
  64. spider_net_ethtool_nway_reset(struct net_device *netdev)
  65. {
  66. if (netif_running(netdev)) {
  67. spider_net_stop(netdev);
  68. spider_net_open(netdev);
  69. }
  70. return 0;
  71. }
  72. static u32
  73. spider_net_ethtool_get_rx_csum(struct net_device *netdev)
  74. {
  75. struct spider_net_card *card = netdev->priv;
  76. return card->options.rx_csum;
  77. }
  78. static int
  79. spider_net_ethtool_set_rx_csum(struct net_device *netdev, u32 n)
  80. {
  81. struct spider_net_card *card = netdev->priv;
  82. card->options.rx_csum = n;
  83. return 0;
  84. }
  85. struct ethtool_ops spider_net_ethtool_ops = {
  86. .get_drvinfo = spider_net_ethtool_get_drvinfo,
  87. .get_wol = spider_net_ethtool_get_wol,
  88. .get_msglevel = spider_net_ethtool_get_msglevel,
  89. .set_msglevel = spider_net_ethtool_set_msglevel,
  90. .nway_reset = spider_net_ethtool_nway_reset,
  91. .get_rx_csum = spider_net_ethtool_get_rx_csum,
  92. .set_rx_csum = spider_net_ethtool_set_rx_csum,
  93. };