aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-01-14 23:48:32 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-14 23:48:32 -0500
commitc7860a2aec571ea95d3ad19b8d9775b27828baac (patch)
tree584b64a32061a6ba01546dc839eee26a076e2899
parent391587c3447d99b842a647f8e701895c9eea050b (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>
-rw-r--r--drivers/net/netxen/netxen_nic.h3
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c31
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c28
-rw-r--r--drivers/net/netxen/netxen_nic_main.c14
4 files changed, 58 insertions, 18 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h
index acb2ac971ca3..a674a23f72b4 100644
--- a/drivers/net/netxen/netxen_nic.h
+++ b/drivers/net/netxen/netxen_nic.h
@@ -499,7 +499,8 @@ typedef enum {
499 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a, 499 NETXEN_BRDTYPE_P3_10G_SFP_CT = 0x002a,
500 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b, 500 NETXEN_BRDTYPE_P3_10G_SFP_QT = 0x002b,
501 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031, 501 NETXEN_BRDTYPE_P3_10G_CX4 = 0x0031,
502 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032 502 NETXEN_BRDTYPE_P3_10G_XFP = 0x0032,
503 NETXEN_BRDTYPE_P3_10G_TP = 0x0080
503 504
504} netxen_brdtype_t; 505} netxen_brdtype_t;
505 506
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index e45ce2951729..c0bd40fcf708 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -136,11 +136,9 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
136 136
137 ecmd->port = PORT_TP; 137 ecmd->port = PORT_TP;
138 138
139 if (netif_running(dev)) { 139 ecmd->speed = adapter->link_speed;
140 ecmd->speed = adapter->link_speed; 140 ecmd->duplex = adapter->link_duplex;
141 ecmd->duplex = adapter->link_duplex; 141 ecmd->autoneg = adapter->link_autoneg;
142 ecmd->autoneg = adapter->link_autoneg;
143 }
144 142
145 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) { 143 } else if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
146 u32 val; 144 u32 val;
@@ -171,7 +169,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
171 } else 169 } else
172 return -EIO; 170 return -EIO;
173 171
174 ecmd->phy_address = adapter->portnum; 172 ecmd->phy_address = adapter->physical_port;
175 ecmd->transceiver = XCVR_EXTERNAL; 173 ecmd->transceiver = XCVR_EXTERNAL;
176 174
177 switch ((netxen_brdtype_t) boardinfo->board_type) { 175 switch ((netxen_brdtype_t) boardinfo->board_type) {
@@ -180,13 +178,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
180 case NETXEN_BRDTYPE_P3_REF_QG: 178 case NETXEN_BRDTYPE_P3_REF_QG:
181 case NETXEN_BRDTYPE_P3_4_GB: 179 case NETXEN_BRDTYPE_P3_4_GB:
182 case NETXEN_BRDTYPE_P3_4_GB_MM: 180 case NETXEN_BRDTYPE_P3_4_GB_MM:
183 case NETXEN_BRDTYPE_P3_10000_BASE_T:
184 181
185 ecmd->supported |= SUPPORTED_Autoneg; 182 ecmd->supported |= SUPPORTED_Autoneg;
186 ecmd->advertising |= ADVERTISED_Autoneg; 183 ecmd->advertising |= ADVERTISED_Autoneg;
187 case NETXEN_BRDTYPE_P2_SB31_10G_CX4: 184 case NETXEN_BRDTYPE_P2_SB31_10G_CX4:
188 case NETXEN_BRDTYPE_P3_10G_CX4: 185 case NETXEN_BRDTYPE_P3_10G_CX4:
189 case NETXEN_BRDTYPE_P3_10G_CX4_LP: 186 case NETXEN_BRDTYPE_P3_10G_CX4_LP:
187 case NETXEN_BRDTYPE_P3_10000_BASE_T:
190 ecmd->supported |= SUPPORTED_TP; 188 ecmd->supported |= SUPPORTED_TP;
191 ecmd->advertising |= ADVERTISED_TP; 189 ecmd->advertising |= ADVERTISED_TP;
192 ecmd->port = PORT_TP; 190 ecmd->port = PORT_TP;
@@ -204,16 +202,33 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
204 ecmd->port = PORT_FIBRE; 202 ecmd->port = PORT_FIBRE;
205 ecmd->autoneg = AUTONEG_DISABLE; 203 ecmd->autoneg = AUTONEG_DISABLE;
206 break; 204 break;
207 case NETXEN_BRDTYPE_P2_SB31_10G:
208 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: 205 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS:
209 case NETXEN_BRDTYPE_P3_10G_SFP_CT: 206 case NETXEN_BRDTYPE_P3_10G_SFP_CT:
210 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 207 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
208 ecmd->advertising |= ADVERTISED_TP;
209 ecmd->supported |= SUPPORTED_TP;
210 case NETXEN_BRDTYPE_P2_SB31_10G:
211 case NETXEN_BRDTYPE_P3_10G_XFP: 211 case NETXEN_BRDTYPE_P3_10G_XFP:
212 ecmd->supported |= SUPPORTED_FIBRE; 212 ecmd->supported |= SUPPORTED_FIBRE;
213 ecmd->advertising |= ADVERTISED_FIBRE; 213 ecmd->advertising |= ADVERTISED_FIBRE;
214 ecmd->port = PORT_FIBRE; 214 ecmd->port = PORT_FIBRE;
215 ecmd->autoneg = AUTONEG_DISABLE; 215 ecmd->autoneg = AUTONEG_DISABLE;
216 break; 216 break;
217 case NETXEN_BRDTYPE_P3_10G_TP:
218 if (adapter->ahw.board_type == NETXEN_NIC_XGBE) {
219 ecmd->autoneg = AUTONEG_DISABLE;
220 ecmd->supported |= (SUPPORTED_FIBRE | SUPPORTED_TP);
221 ecmd->advertising |=
222 (ADVERTISED_FIBRE | ADVERTISED_TP);
223 ecmd->port = PORT_FIBRE;
224 } else {
225 ecmd->autoneg = AUTONEG_ENABLE;
226 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
227 ecmd->advertising |=
228 (ADVERTISED_TP | ADVERTISED_Autoneg);
229 ecmd->port = PORT_TP;
230 }
231 break;
217 default: 232 default:
218 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n", 233 printk(KERN_ERR "netxen-nic: Unsupported board model %d\n",
219 (netxen_brdtype_t) boardinfo->board_type); 234 (netxen_brdtype_t) boardinfo->board_type);
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 }
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index cb3912381802..2c6ce6ffde09 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -243,7 +243,7 @@ static void netxen_check_options(struct netxen_adapter *adapter)
243 case NETXEN_BRDTYPE_P3_4_GB: 243 case NETXEN_BRDTYPE_P3_4_GB:
244 case NETXEN_BRDTYPE_P3_4_GB_MM: 244 case NETXEN_BRDTYPE_P3_4_GB_MM:
245 adapter->msix_supported = !!use_msi_x; 245 adapter->msix_supported = !!use_msi_x;
246 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G; 246 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
247 break; 247 break;
248 248
249 case NETXEN_BRDTYPE_P2_SB35_4G: 249 case NETXEN_BRDTYPE_P2_SB35_4G:
@@ -252,6 +252,14 @@ static void netxen_check_options(struct netxen_adapter *adapter)
252 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 252 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
253 break; 253 break;
254 254
255 case NETXEN_BRDTYPE_P3_10G_TP:
256 adapter->msix_supported = !!use_msi_x;
257 if (adapter->ahw.board_type == NETXEN_NIC_XGBE)
258 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_10G;
259 else
260 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
261 break;
262
255 default: 263 default:
256 adapter->msix_supported = 0; 264 adapter->msix_supported = 0;
257 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G; 265 adapter->max_rx_desc_count = MAX_RCV_DESCRIPTORS_1G;
@@ -1396,6 +1404,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1396 netif_carrier_off(netdev); 1404 netif_carrier_off(netdev);
1397 netif_stop_queue(netdev); 1405 netif_stop_queue(netdev);
1398 } 1406 }
1407
1408 netxen_nic_set_link_parameters(adapter);
1399 } else if (!adapter->ahw.linkup && linkup) { 1409 } else if (!adapter->ahw.linkup && linkup) {
1400 printk(KERN_INFO "%s: %s NIC Link is up\n", 1410 printk(KERN_INFO "%s: %s NIC Link is up\n",
1401 netxen_nic_driver_name, netdev->name); 1411 netxen_nic_driver_name, netdev->name);
@@ -1404,6 +1414,8 @@ static void netxen_nic_handle_phy_intr(struct netxen_adapter *adapter)
1404 netif_carrier_on(netdev); 1414 netif_carrier_on(netdev);
1405 netif_wake_queue(netdev); 1415 netif_wake_queue(netdev);
1406 } 1416 }
1417
1418 netxen_nic_set_link_parameters(adapter);
1407 } 1419 }
1408} 1420}
1409 1421