2 * Network device driver for Cell Processor-Based Blade
4 * (C) Copyright IBM Corp. 2005
6 * Authors : Utz Bacher <utz.bacher@de.ibm.com>
7 * Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
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)
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.
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.
24 #include <linux/netdevice.h>
25 #include <linux/ethtool.h>
26 #include <linux/pci.h>
28 #include "spider_net.h"
31 spider_net_ethtool_get_settings(struct net_device
*netdev
,
32 struct ethtool_cmd
*cmd
)
34 struct spider_net_card
*card
;
35 card
= netdev_priv(netdev
);
37 cmd
->supported
= (SUPPORTED_1000baseT_Full
|
39 cmd
->advertising
= (ADVERTISED_1000baseT_Full
|
41 cmd
->port
= PORT_FIBRE
;
42 cmd
->speed
= card
->phy
.speed
;
43 cmd
->duplex
= DUPLEX_FULL
;
49 spider_net_ethtool_get_drvinfo(struct net_device
*netdev
,
50 struct ethtool_drvinfo
*drvinfo
)
52 struct spider_net_card
*card
;
53 card
= netdev_priv(netdev
);
55 /* clear and fill out info */
56 memset(drvinfo
, 0, sizeof(struct ethtool_drvinfo
));
57 strncpy(drvinfo
->driver
, spider_net_driver_name
, 32);
58 strncpy(drvinfo
->version
, "0.1", 32);
59 strcpy(drvinfo
->fw_version
, "no information");
60 strncpy(drvinfo
->bus_info
, pci_name(card
->pdev
), 32);
64 spider_net_ethtool_get_wol(struct net_device
*netdev
,
65 struct ethtool_wolinfo
*wolinfo
)
67 /* no support for wol */
68 wolinfo
->supported
= 0;
73 spider_net_ethtool_get_msglevel(struct net_device
*netdev
)
75 struct spider_net_card
*card
;
76 card
= netdev_priv(netdev
);
77 return card
->msg_enable
;
81 spider_net_ethtool_set_msglevel(struct net_device
*netdev
,
84 struct spider_net_card
*card
;
85 card
= netdev_priv(netdev
);
86 card
->msg_enable
= level
;
90 spider_net_ethtool_nway_reset(struct net_device
*netdev
)
92 if (netif_running(netdev
)) {
93 spider_net_stop(netdev
);
94 spider_net_open(netdev
);
100 spider_net_ethtool_get_rx_csum(struct net_device
*netdev
)
102 struct spider_net_card
*card
= netdev
->priv
;
104 return card
->options
.rx_csum
;
108 spider_net_ethtool_set_rx_csum(struct net_device
*netdev
, u32 n
)
110 struct spider_net_card
*card
= netdev
->priv
;
112 card
->options
.rx_csum
= n
;
117 spider_net_ethtool_get_tx_csum(struct net_device
*netdev
)
119 return (netdev
->features
& NETIF_F_HW_CSUM
) != 0;
123 spider_net_ethtool_set_tx_csum(struct net_device
*netdev
, uint32_t data
)
126 netdev
->features
|= NETIF_F_HW_CSUM
;
128 netdev
->features
&= ~NETIF_F_HW_CSUM
;
133 struct ethtool_ops spider_net_ethtool_ops
= {
134 .get_settings
= spider_net_ethtool_get_settings
,
135 .get_drvinfo
= spider_net_ethtool_get_drvinfo
,
136 .get_wol
= spider_net_ethtool_get_wol
,
137 .get_msglevel
= spider_net_ethtool_get_msglevel
,
138 .set_msglevel
= spider_net_ethtool_set_msglevel
,
139 .nway_reset
= spider_net_ethtool_nway_reset
,
140 .get_rx_csum
= spider_net_ethtool_get_rx_csum
,
141 .set_rx_csum
= spider_net_ethtool_set_rx_csum
,
142 .get_tx_csum
= spider_net_ethtool_get_tx_csum
,
143 .set_tx_csum
= spider_net_ethtool_set_tx_csum
,