aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_ethtool.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-04-07 18:50:42 -0400
committerDavid S. Miller <davem@davemloft.net>2009-04-08 18:58:27 -0400
commit3bf26ce3f4cc3c9e0d0478b4016c6113a16faaf1 (patch)
tree8478804493b6e749a6e61870c8c3b5b9549469ad /drivers/net/netxen/netxen_nic_ethtool.c
parent56a007871a6689db80e19f63fe6dc3692daa2a6f (diff)
netxen: async link event handling
Add support for asynchronous events from firmware, received over one of the rx rings. Add support for event based phy interrupts, enhanced links status reporting from firmware. 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_ethtool.c')
-rw-r--r--drivers/net/netxen/netxen_nic_ethtool.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c
index fe910c1715d6..5fde9e088a94 100644
--- a/drivers/net/netxen/netxen_nic_ethtool.c
+++ b/drivers/net/netxen/netxen_nic_ethtool.c
@@ -110,6 +110,7 @@ static int
110netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd) 110netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
111{ 111{
112 struct netxen_adapter *adapter = netdev_priv(dev); 112 struct netxen_adapter *adapter = netdev_priv(dev);
113 int check_sfp_module = 0;
113 114
114 /* read which mode */ 115 /* read which mode */
115 if (adapter->ahw.port_type == NETXEN_NIC_GBE) { 116 if (adapter->ahw.port_type == NETXEN_NIC_GBE) {
@@ -143,6 +144,13 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
143 ecmd->advertising = ADVERTISED_10000baseT_Full; 144 ecmd->advertising = ADVERTISED_10000baseT_Full;
144 } 145 }
145 146
147 if (netif_running(dev) && adapter->has_link_events) {
148 ecmd->speed = adapter->link_speed;
149 ecmd->autoneg = adapter->link_autoneg;
150 ecmd->duplex = adapter->link_duplex;
151 goto skip;
152 }
153
146 ecmd->port = PORT_TP; 154 ecmd->port = PORT_TP;
147 155
148 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) { 156 if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) {
@@ -160,6 +168,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
160 } else 168 } else
161 return -EIO; 169 return -EIO;
162 170
171skip:
163 ecmd->phy_address = adapter->physical_port; 172 ecmd->phy_address = adapter->physical_port;
164 ecmd->transceiver = XCVR_EXTERNAL; 173 ecmd->transceiver = XCVR_EXTERNAL;
165 174
@@ -190,7 +199,7 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
190 case NETXEN_BRDTYPE_P3_HMEZ: 199 case NETXEN_BRDTYPE_P3_HMEZ:
191 ecmd->supported |= SUPPORTED_MII; 200 ecmd->supported |= SUPPORTED_MII;
192 ecmd->advertising |= ADVERTISED_MII; 201 ecmd->advertising |= ADVERTISED_MII;
193 ecmd->port = PORT_FIBRE; 202 ecmd->port = PORT_MII;
194 ecmd->autoneg = AUTONEG_DISABLE; 203 ecmd->autoneg = AUTONEG_DISABLE;
195 break; 204 break;
196 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS: 205 case NETXEN_BRDTYPE_P3_10G_SFP_PLUS:
@@ -198,6 +207,8 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
198 case NETXEN_BRDTYPE_P3_10G_SFP_QT: 207 case NETXEN_BRDTYPE_P3_10G_SFP_QT:
199 ecmd->advertising |= ADVERTISED_TP; 208 ecmd->advertising |= ADVERTISED_TP;
200 ecmd->supported |= SUPPORTED_TP; 209 ecmd->supported |= SUPPORTED_TP;
210 check_sfp_module = netif_running(dev) &&
211 adapter->has_link_events;
201 case NETXEN_BRDTYPE_P2_SB31_10G: 212 case NETXEN_BRDTYPE_P2_SB31_10G:
202 case NETXEN_BRDTYPE_P3_10G_XFP: 213 case NETXEN_BRDTYPE_P3_10G_XFP:
203 ecmd->supported |= SUPPORTED_FIBRE; 214 ecmd->supported |= SUPPORTED_FIBRE;
@@ -212,6 +223,8 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
212 ecmd->advertising |= 223 ecmd->advertising |=
213 (ADVERTISED_FIBRE | ADVERTISED_TP); 224 (ADVERTISED_FIBRE | ADVERTISED_TP);
214 ecmd->port = PORT_FIBRE; 225 ecmd->port = PORT_FIBRE;
226 check_sfp_module = netif_running(dev) &&
227 adapter->has_link_events;
215 } else { 228 } else {
216 ecmd->autoneg = AUTONEG_ENABLE; 229 ecmd->autoneg = AUTONEG_ENABLE;
217 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); 230 ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg);
@@ -226,6 +239,23 @@ netxen_nic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
226 return -EIO; 239 return -EIO;
227 } 240 }
228 241
242 if (check_sfp_module) {
243 switch (adapter->module_type) {
244 case LINKEVENT_MODULE_OPTICAL_UNKNOWN:
245 case LINKEVENT_MODULE_OPTICAL_SRLR:
246 case LINKEVENT_MODULE_OPTICAL_LRM:
247 case LINKEVENT_MODULE_OPTICAL_SFP_1G:
248 ecmd->port = PORT_FIBRE;
249 break;
250 case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLE:
251 case LINKEVENT_MODULE_TWINAX_UNSUPPORTED_CABLELEN:
252 case LINKEVENT_MODULE_TWINAX:
253 ecmd->port = PORT_TP;
254 default:
255 ecmd->port = -1;
256 }
257 }
258
229 return 0; 259 return 0;
230} 260}
231 261