]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/benet/be_ethtool.c
be2net: Changes to update ethtool get_settings function to return appropriate values.
[net-next-2.6.git] / drivers / net / benet / be_ethtool.c
index 333729bd6d92b50c897e40d6fb2b0b1f5d88b6d3..edebce9949066d1ca0d073b64e550c5875dd5d54 100644 (file)
@@ -293,9 +293,43 @@ static int be_get_sset_count(struct net_device *netdev, int stringset)
 
 static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
 {
-       ecmd->speed = SPEED_10000;
+       struct be_adapter *adapter = netdev_priv(netdev);
+       u8 mac_speed = 0, connector = 0;
+       u16 link_speed = 0;
+       bool link_up = false;
+
+       be_cmd_link_status_query(adapter, &link_up, &mac_speed, &link_speed);
+
+       /* link_speed is in units of 10 Mbps */
+       if (link_speed) {
+               ecmd->speed = link_speed*10;
+       } else {
+               switch (mac_speed) {
+               case PHY_LINK_SPEED_1GBPS:
+                       ecmd->speed = SPEED_1000;
+                       break;
+               case PHY_LINK_SPEED_10GBPS:
+                       ecmd->speed = SPEED_10000;
+                       break;
+               }
+       }
        ecmd->duplex = DUPLEX_FULL;
        ecmd->autoneg = AUTONEG_DISABLE;
+       ecmd->supported = (SUPPORTED_10000baseT_Full | SUPPORTED_TP);
+
+       be_cmd_read_port_type(adapter, adapter->port_num, &connector);
+       switch (connector) {
+       case 7:
+               ecmd->port = PORT_FIBRE;
+               break;
+       default:
+               ecmd->port = PORT_TP;
+               break;
+       }
+
+       ecmd->phy_address = adapter->port_num;
+       ecmd->transceiver = XCVR_INTERNAL;
+
        return 0;
 }
 
@@ -337,6 +371,35 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
        return status;
 }
 
+static int
+be_phys_id(struct net_device *netdev, u32 data)
+{
+       struct be_adapter *adapter = netdev_priv(netdev);
+       int status;
+       u32 cur;
+
+       if (!netif_running(netdev))
+               return 0;
+
+       be_cmd_get_beacon_state(adapter, adapter->port_num, &cur);
+
+       if (cur == BEACON_STATE_ENABLED)
+               return 0;
+
+       if (data < 2)
+               data = 2;
+
+       status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
+                       BEACON_STATE_ENABLED);
+       set_current_state(TASK_INTERRUPTIBLE);
+       schedule_timeout(data*HZ);
+
+       status = be_cmd_set_beacon_state(adapter, adapter->port_num, 0, 0,
+                       BEACON_STATE_DISABLED);
+
+       return status;
+}
+
 static int
 be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
 {
@@ -369,6 +432,7 @@ const struct ethtool_ops be_ethtool_ops = {
        .get_tso = ethtool_op_get_tso,
        .set_tso = ethtool_op_set_tso,
        .get_strings = be_get_stat_strings,
+       .phys_id = be_phys_id,
        .get_sset_count = be_get_sset_count,
        .get_ethtool_stats = be_get_ethtool_stats,
        .flash_device = be_do_flash,