diff options
author | Dhananjay Phadke <dhananjay@netxen.com> | 2009-01-14 23:48:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-14 23:48:32 -0500 |
commit | c7860a2aec571ea95d3ad19b8d9775b27828baac (patch) | |
tree | 584b64a32061a6ba01546dc839eee26a076e2899 /drivers/net/netxen/netxen_nic_hw.c | |
parent | 391587c3447d99b842a647f8e701895c9eea050b (diff) |
netxen: fix link speed reporting for some boards
o Read negotiated link speed when link state changes.
o Fix link speed reporting for hybrid nic boards, which have both 1Gbps and
10Gbps ports.
Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 98d0bcda5f4f..4276f7f82238 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -2036,7 +2036,13 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2036 | rv = -1; | 2036 | rv = -1; |
2037 | } | 2037 | } |
2038 | 2038 | ||
2039 | DPRINTK(INFO, "Discovered board type:0x%x ", boardinfo->board_type); | 2039 | if (boardinfo->board_type == NETXEN_BRDTYPE_P3_4_GB_MM) { |
2040 | u32 gpio = netxen_nic_reg_read(adapter, | ||
2041 | NETXEN_ROMUSB_GLB_PAD_GPIO_I); | ||
2042 | if ((gpio & 0x8000) == 0) | ||
2043 | boardinfo->board_type = NETXEN_BRDTYPE_P3_10G_TP; | ||
2044 | } | ||
2045 | |||
2040 | switch ((netxen_brdtype_t) boardinfo->board_type) { | 2046 | switch ((netxen_brdtype_t) boardinfo->board_type) { |
2041 | case NETXEN_BRDTYPE_P2_SB35_4G: | 2047 | case NETXEN_BRDTYPE_P2_SB35_4G: |
2042 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2048 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
@@ -2055,7 +2061,6 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2055 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: | 2061 | case NETXEN_BRDTYPE_P3_10G_SFP_QT: |
2056 | case NETXEN_BRDTYPE_P3_10G_XFP: | 2062 | case NETXEN_BRDTYPE_P3_10G_XFP: |
2057 | case NETXEN_BRDTYPE_P3_10000_BASE_T: | 2063 | case NETXEN_BRDTYPE_P3_10000_BASE_T: |
2058 | |||
2059 | adapter->ahw.board_type = NETXEN_NIC_XGBE; | 2064 | adapter->ahw.board_type = NETXEN_NIC_XGBE; |
2060 | break; | 2065 | break; |
2061 | case NETXEN_BRDTYPE_P1_BD: | 2066 | case NETXEN_BRDTYPE_P1_BD: |
@@ -2065,9 +2070,12 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter) | |||
2065 | case NETXEN_BRDTYPE_P3_REF_QG: | 2070 | case NETXEN_BRDTYPE_P3_REF_QG: |
2066 | case NETXEN_BRDTYPE_P3_4_GB: | 2071 | case NETXEN_BRDTYPE_P3_4_GB: |
2067 | case NETXEN_BRDTYPE_P3_4_GB_MM: | 2072 | case NETXEN_BRDTYPE_P3_4_GB_MM: |
2068 | |||
2069 | adapter->ahw.board_type = NETXEN_NIC_GBE; | 2073 | adapter->ahw.board_type = NETXEN_NIC_GBE; |
2070 | break; | 2074 | break; |
2075 | case NETXEN_BRDTYPE_P3_10G_TP: | ||
2076 | adapter->ahw.board_type = (adapter->portnum < 2) ? | ||
2077 | NETXEN_NIC_XGBE : NETXEN_NIC_GBE; | ||
2078 | break; | ||
2071 | default: | 2079 | default: |
2072 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, | 2080 | printk("%s: Unknown(%x)\n", netxen_nic_driver_name, |
2073 | boardinfo->board_type); | 2081 | boardinfo->board_type); |
@@ -2112,12 +2120,16 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2112 | { | 2120 | { |
2113 | __u32 status; | 2121 | __u32 status; |
2114 | __u32 autoneg; | 2122 | __u32 autoneg; |
2115 | __u32 mode; | ||
2116 | __u32 port_mode; | 2123 | __u32 port_mode; |
2117 | 2124 | ||
2118 | netxen_nic_read_w0(adapter, NETXEN_NIU_MODE, &mode); | 2125 | if (!netif_carrier_ok(adapter->netdev)) { |
2119 | if (netxen_get_niu_enable_ge(mode)) { /* Gb 10/100/1000 Mbps mode */ | 2126 | adapter->link_speed = 0; |
2127 | adapter->link_duplex = -1; | ||
2128 | adapter->link_autoneg = AUTONEG_ENABLE; | ||
2129 | return; | ||
2130 | } | ||
2120 | 2131 | ||
2132 | if (adapter->ahw.board_type == NETXEN_NIC_GBE) { | ||
2121 | adapter->hw_read_wx(adapter, | 2133 | adapter->hw_read_wx(adapter, |
2122 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); | 2134 | NETXEN_PORT_MODE_ADDR, &port_mode, 4); |
2123 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { | 2135 | if (port_mode == NETXEN_PORT_MODE_802_3_AP) { |
@@ -2143,7 +2155,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2143 | adapter->link_speed = SPEED_1000; | 2155 | adapter->link_speed = SPEED_1000; |
2144 | break; | 2156 | break; |
2145 | default: | 2157 | default: |
2146 | adapter->link_speed = -1; | 2158 | adapter->link_speed = 0; |
2147 | break; | 2159 | break; |
2148 | } | 2160 | } |
2149 | switch (netxen_get_phy_duplex(status)) { | 2161 | switch (netxen_get_phy_duplex(status)) { |
@@ -2166,7 +2178,7 @@ void netxen_nic_set_link_parameters(struct netxen_adapter *adapter) | |||
2166 | goto link_down; | 2178 | goto link_down; |
2167 | } else { | 2179 | } else { |
2168 | link_down: | 2180 | link_down: |
2169 | adapter->link_speed = -1; | 2181 | adapter->link_speed = 0; |
2170 | adapter->link_duplex = -1; | 2182 | adapter->link_duplex = -1; |
2171 | } | 2183 | } |
2172 | } | 2184 | } |