diff options
author | Jens Osterkamp <Jens.Osterkamp@de.ibm.com> | 2005-09-06 22:30:55 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-09-06 22:35:30 -0400 |
commit | 054034dbf5b1a6aef800af4eb22d421d1c7d4b6d (patch) | |
tree | 091ca7020ba565d590e0d714894ad4cf8261c4c7 | |
parent | 543cec517dbc07c7c801ccacd02141d99f09f756 (diff) |
[PATCH] net: fix bonding with spider_net
Another small update for the spidernet driver to fix a bug encountered
during testing our latest hardware with dual-ethernet support.
Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
-rw-r--r-- | drivers/net/spider_net.c | 18 | ||||
-rw-r--r-- | drivers/net/spider_net_ethtool.c | 19 |
2 files changed, 31 insertions, 6 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 6784e6e13685..4e19220473d0 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -1292,23 +1292,29 @@ static int | |||
1292 | spider_net_set_mac(struct net_device *netdev, void *p) | 1292 | spider_net_set_mac(struct net_device *netdev, void *p) |
1293 | { | 1293 | { |
1294 | struct spider_net_card *card = netdev_priv(netdev); | 1294 | struct spider_net_card *card = netdev_priv(netdev); |
1295 | u32 macl, macu; | 1295 | u32 macl, macu, regvalue; |
1296 | struct sockaddr *addr = p; | 1296 | struct sockaddr *addr = p; |
1297 | 1297 | ||
1298 | /* GMACTPE and GMACRPE must be off, so we only allow this, if | ||
1299 | * the device is down */ | ||
1300 | if (netdev->flags & IFF_UP) | ||
1301 | return -EBUSY; | ||
1302 | |||
1303 | if (!is_valid_ether_addr(addr->sa_data)) | 1298 | if (!is_valid_ether_addr(addr->sa_data)) |
1304 | return -EADDRNOTAVAIL; | 1299 | return -EADDRNOTAVAIL; |
1305 | 1300 | ||
1301 | /* switch off GMACTPE and GMACRPE */ | ||
1302 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); | ||
1303 | regvalue &= ~((1 << 5) | (1 << 6)); | ||
1304 | spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); | ||
1305 | |||
1306 | /* write mac */ | ||
1306 | macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) + | 1307 | macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) + |
1307 | (addr->sa_data[2]<<8) + (addr->sa_data[3]); | 1308 | (addr->sa_data[2]<<8) + (addr->sa_data[3]); |
1308 | macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]); | 1309 | macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]); |
1309 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu); | 1310 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu); |
1310 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl); | 1311 | spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl); |
1311 | 1312 | ||
1313 | /* switch GMACTPE and GMACRPE back on */ | ||
1314 | regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD); | ||
1315 | regvalue |= ((1 << 5) | (1 << 6)); | ||
1316 | spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue); | ||
1317 | |||
1312 | spider_net_set_promisc(card); | 1318 | spider_net_set_promisc(card); |
1313 | 1319 | ||
1314 | /* look up, whether we have been successful */ | 1320 | /* look up, whether we have been successful */ |
diff --git a/drivers/net/spider_net_ethtool.c b/drivers/net/spider_net_ethtool.c index 9447c2ccd70a..d42e60ba74ce 100644 --- a/drivers/net/spider_net_ethtool.c +++ b/drivers/net/spider_net_ethtool.c | |||
@@ -27,6 +27,24 @@ | |||
27 | 27 | ||
28 | #include "spider_net.h" | 28 | #include "spider_net.h" |
29 | 29 | ||
30 | static int | ||
31 | spider_net_ethtool_get_settings(struct net_device *netdev, | ||
32 | struct ethtool_cmd *cmd) | ||
33 | { | ||
34 | struct spider_net_card *card; | ||
35 | card = netdev_priv(netdev); | ||
36 | |||
37 | cmd->supported = (SUPPORTED_1000baseT_Full | | ||
38 | SUPPORTED_FIBRE); | ||
39 | cmd->advertising = (ADVERTISED_1000baseT_Full | | ||
40 | ADVERTISED_FIBRE); | ||
41 | cmd->port = PORT_FIBRE; | ||
42 | cmd->speed = card->phy.speed; | ||
43 | cmd->duplex = DUPLEX_FULL; | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
30 | static void | 48 | static void |
31 | spider_net_ethtool_get_drvinfo(struct net_device *netdev, | 49 | spider_net_ethtool_get_drvinfo(struct net_device *netdev, |
32 | struct ethtool_drvinfo *drvinfo) | 50 | struct ethtool_drvinfo *drvinfo) |
@@ -96,6 +114,7 @@ spider_net_ethtool_set_rx_csum(struct net_device *netdev, u32 n) | |||
96 | } | 114 | } |
97 | 115 | ||
98 | struct ethtool_ops spider_net_ethtool_ops = { | 116 | struct ethtool_ops spider_net_ethtool_ops = { |
117 | .get_settings = spider_net_ethtool_get_settings, | ||
99 | .get_drvinfo = spider_net_ethtool_get_drvinfo, | 118 | .get_drvinfo = spider_net_ethtool_get_drvinfo, |
100 | .get_wol = spider_net_ethtool_get_wol, | 119 | .get_wol = spider_net_ethtool_get_wol, |
101 | .get_msglevel = spider_net_ethtool_get_msglevel, | 120 | .get_msglevel = spider_net_ethtool_get_msglevel, |