[PATCH] net: fix bonding with spider_net
authorJens Osterkamp <Jens.Osterkamp@de.ibm.com>
Wed, 7 Sep 2005 02:30:55 +0000 (19:30 -0700)
committerJeff Garzik <jgarzik@pobox.com>
Wed, 7 Sep 2005 02:35:30 +0000 (22:35 -0400)
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>
drivers/net/spider_net.c
drivers/net/spider_net_ethtool.c

index 6784e6e13685a8bbd22c04a8e8324aab69498771..4e19220473d0ddcaaa1a0417647a827f6bfca597 100644 (file)
@@ -1292,23 +1292,29 @@ static int
 spider_net_set_mac(struct net_device *netdev, void *p)
 {
        struct spider_net_card *card = netdev_priv(netdev);
-       u32 macl, macu;
+       u32 macl, macu, regvalue;
        struct sockaddr *addr = p;
 
-       /* GMACTPE and GMACRPE must be off, so we only allow this, if
-        * the device is down */
-       if (netdev->flags & IFF_UP)
-               return -EBUSY;
-
        if (!is_valid_ether_addr(addr->sa_data))
                return -EADDRNOTAVAIL;
 
+       /* switch off GMACTPE and GMACRPE */
+       regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD);
+       regvalue &= ~((1 << 5) | (1 << 6));
+       spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue);
+
+       /* write mac */
        macu = (addr->sa_data[0]<<24) + (addr->sa_data[1]<<16) +
                (addr->sa_data[2]<<8) + (addr->sa_data[3]);
        macl = (addr->sa_data[4]<<8) + (addr->sa_data[5]);
        spider_net_write_reg(card, SPIDER_NET_GMACUNIMACU, macu);
        spider_net_write_reg(card, SPIDER_NET_GMACUNIMACL, macl);
 
+       /* switch GMACTPE and GMACRPE back on */
+       regvalue = spider_net_read_reg(card, SPIDER_NET_GMACOPEMD);
+       regvalue |= ((1 << 5) | (1 << 6));
+       spider_net_write_reg(card, SPIDER_NET_GMACOPEMD, regvalue);
+
        spider_net_set_promisc(card);
 
        /* look up, whether we have been successful */
index 9447c2ccd70ad6e3484e29c5ad19e77cb8a899d3..d42e60ba74ceb3013b2b80170aeb9ceede60c352 100644 (file)
 
 #include "spider_net.h"
 
+static int
+spider_net_ethtool_get_settings(struct net_device *netdev,
+                              struct ethtool_cmd *cmd)
+{
+       struct spider_net_card *card;
+       card = netdev_priv(netdev);
+
+       cmd->supported   = (SUPPORTED_1000baseT_Full |
+                            SUPPORTED_FIBRE);
+       cmd->advertising = (ADVERTISED_1000baseT_Full |
+                            ADVERTISED_FIBRE);
+       cmd->port = PORT_FIBRE;
+       cmd->speed = card->phy.speed;
+       cmd->duplex = DUPLEX_FULL;
+
+       return 0;
+}
+
 static void
 spider_net_ethtool_get_drvinfo(struct net_device *netdev,
                               struct ethtool_drvinfo *drvinfo)
@@ -96,6 +114,7 @@ spider_net_ethtool_set_rx_csum(struct net_device *netdev, u32 n)
 }
 
 struct ethtool_ops spider_net_ethtool_ops = {
+       .get_settings           = spider_net_ethtool_get_settings,
        .get_drvinfo            = spider_net_ethtool_get_drvinfo,
        .get_wol                = spider_net_ethtool_get_wol,
        .get_msglevel           = spider_net_ethtool_get_msglevel,