Jens Osterkamp | aaec0fa | 2005-09-05 15:19:29 -0700 | [diff] [blame^] | 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 | |
| 24 | #include <linux/netdevice.h> |
| 25 | #include <linux/ethtool.h> |
| 26 | #include <linux/pci.h> |
| 27 | |
| 28 | #include "spider_net.h" |
| 29 | |
| 30 | static void |
| 31 | spider_net_ethtool_get_drvinfo(struct net_device *netdev, |
| 32 | struct ethtool_drvinfo *drvinfo) |
| 33 | { |
| 34 | struct spider_net_card *card; |
| 35 | card = netdev_priv(netdev); |
| 36 | |
| 37 | /* clear and fill out info */ |
| 38 | memset(drvinfo, 0, sizeof(struct ethtool_drvinfo)); |
| 39 | strncpy(drvinfo->driver, spider_net_driver_name, 32); |
| 40 | strncpy(drvinfo->version, "0.1", 32); |
| 41 | strcpy(drvinfo->fw_version, "no information"); |
| 42 | strncpy(drvinfo->bus_info, pci_name(card->pdev), 32); |
| 43 | } |
| 44 | |
| 45 | static void |
| 46 | spider_net_ethtool_get_wol(struct net_device *netdev, |
| 47 | struct ethtool_wolinfo *wolinfo) |
| 48 | { |
| 49 | /* no support for wol */ |
| 50 | wolinfo->supported = 0; |
| 51 | wolinfo->wolopts = 0; |
| 52 | } |
| 53 | |
| 54 | static u32 |
| 55 | spider_net_ethtool_get_msglevel(struct net_device *netdev) |
| 56 | { |
| 57 | struct spider_net_card *card; |
| 58 | card = netdev_priv(netdev); |
| 59 | return card->msg_enable; |
| 60 | } |
| 61 | |
| 62 | static void |
| 63 | spider_net_ethtool_set_msglevel(struct net_device *netdev, |
| 64 | u32 level) |
| 65 | { |
| 66 | struct spider_net_card *card; |
| 67 | card = netdev_priv(netdev); |
| 68 | card->msg_enable = level; |
| 69 | } |
| 70 | |
| 71 | static int |
| 72 | spider_net_ethtool_nway_reset(struct net_device *netdev) |
| 73 | { |
| 74 | if (netif_running(netdev)) { |
| 75 | spider_net_stop(netdev); |
| 76 | spider_net_open(netdev); |
| 77 | } |
| 78 | return 0; |
| 79 | } |
| 80 | |
| 81 | static u32 |
| 82 | spider_net_ethtool_get_rx_csum(struct net_device *netdev) |
| 83 | { |
| 84 | struct spider_net_card *card = netdev->priv; |
| 85 | |
| 86 | return card->options.rx_csum; |
| 87 | } |
| 88 | |
| 89 | static int |
| 90 | spider_net_ethtool_set_rx_csum(struct net_device *netdev, u32 n) |
| 91 | { |
| 92 | struct spider_net_card *card = netdev->priv; |
| 93 | |
| 94 | card->options.rx_csum = n; |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | struct ethtool_ops spider_net_ethtool_ops = { |
| 99 | .get_drvinfo = spider_net_ethtool_get_drvinfo, |
| 100 | .get_wol = spider_net_ethtool_get_wol, |
| 101 | .get_msglevel = spider_net_ethtool_get_msglevel, |
| 102 | .set_msglevel = spider_net_ethtool_set_msglevel, |
| 103 | .nway_reset = spider_net_ethtool_nway_reset, |
| 104 | .get_rx_csum = spider_net_ethtool_get_rx_csum, |
| 105 | .set_rx_csum = spider_net_ethtool_set_rx_csum, |
| 106 | }; |
| 107 | |