diff options
author | Sony Chacko <sony.chacko@qlogic.com> | 2011-03-15 17:54:55 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-03-15 17:54:55 -0400 |
commit | bfd823bd74333615783d8108889814c6d82f2ab0 (patch) | |
tree | c02d6deb8e323c8fc72988ada1a67ec1d0a579f0 /drivers/net | |
parent | d87f4fe2121a017241e495fedc0a79d0dec05a92 (diff) |
netxen: support for GbE port settings
o Enable setting speed and auto negotiation parameters for GbE ports.
o Hardware do not support half duplex setting currently.
David Miller:
Amit please update your patch to silently reject link setting
attempts that are unsupported by the device.
Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/netxen/netxen_nic.h | 6 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ctx.c | 15 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_ethtool.c | 58 |
3 files changed, 34 insertions, 45 deletions
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index a11380544e6c..d7299f1a4940 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -739,7 +739,8 @@ struct netxen_recv_context { | |||
739 | #define NX_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c | 739 | #define NX_CDRP_CMD_READ_PEXQ_PARAMETERS 0x0000001c |
740 | #define NX_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d | 740 | #define NX_CDRP_CMD_GET_LIC_CAPABILITIES 0x0000001d |
741 | #define NX_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e | 741 | #define NX_CDRP_CMD_READ_MAX_LRO_PER_BOARD 0x0000001e |
742 | #define NX_CDRP_CMD_MAX 0x0000001f | 742 | #define NX_CDRP_CMD_CONFIG_GBE_PORT 0x0000001f |
743 | #define NX_CDRP_CMD_MAX 0x00000020 | ||
743 | 744 | ||
744 | #define NX_RCODE_SUCCESS 0 | 745 | #define NX_RCODE_SUCCESS 0 |
745 | #define NX_RCODE_NO_HOST_MEM 1 | 746 | #define NX_RCODE_NO_HOST_MEM 1 |
@@ -1054,6 +1055,7 @@ typedef struct { | |||
1054 | #define NX_FW_CAPABILITY_BDG (1 << 8) | 1055 | #define NX_FW_CAPABILITY_BDG (1 << 8) |
1055 | #define NX_FW_CAPABILITY_FVLANTX (1 << 9) | 1056 | #define NX_FW_CAPABILITY_FVLANTX (1 << 9) |
1056 | #define NX_FW_CAPABILITY_HW_LRO (1 << 10) | 1057 | #define NX_FW_CAPABILITY_HW_LRO (1 << 10) |
1058 | #define NX_FW_CAPABILITY_GBE_LINK_CFG (1 << 11) | ||
1057 | 1059 | ||
1058 | /* module types */ | 1060 | /* module types */ |
1059 | #define LINKEVENT_MODULE_NOT_PRESENT 1 | 1061 | #define LINKEVENT_MODULE_NOT_PRESENT 1 |
@@ -1349,6 +1351,8 @@ void netxen_advert_link_change(struct netxen_adapter *adapter, int linkup); | |||
1349 | void netxen_pci_camqm_read_2M(struct netxen_adapter *, u64, u64 *); | 1351 | void netxen_pci_camqm_read_2M(struct netxen_adapter *, u64, u64 *); |
1350 | void netxen_pci_camqm_write_2M(struct netxen_adapter *, u64, u64); | 1352 | void netxen_pci_camqm_write_2M(struct netxen_adapter *, u64, u64); |
1351 | 1353 | ||
1354 | int nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter, | ||
1355 | u32 speed, u32 duplex, u32 autoneg); | ||
1352 | int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); | 1356 | int nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu); |
1353 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); | 1357 | int netxen_nic_change_mtu(struct net_device *netdev, int new_mtu); |
1354 | int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable); | 1358 | int netxen_config_hw_lro(struct netxen_adapter *adapter, int enable); |
diff --git a/drivers/net/netxen/netxen_nic_ctx.c b/drivers/net/netxen/netxen_nic_ctx.c index f7d06cbc70ae..f16966afa64e 100644 --- a/drivers/net/netxen/netxen_nic_ctx.c +++ b/drivers/net/netxen/netxen_nic_ctx.c | |||
@@ -112,6 +112,21 @@ nx_fw_cmd_set_mtu(struct netxen_adapter *adapter, int mtu) | |||
112 | return 0; | 112 | return 0; |
113 | } | 113 | } |
114 | 114 | ||
115 | int | ||
116 | nx_fw_cmd_set_gbe_port(struct netxen_adapter *adapter, | ||
117 | u32 speed, u32 duplex, u32 autoneg) | ||
118 | { | ||
119 | |||
120 | return netxen_issue_cmd(adapter, | ||
121 | adapter->ahw.pci_func, | ||
122 | NXHAL_VERSION, | ||
123 | speed, | ||
124 | duplex, | ||
125 | autoneg, | ||
126 | NX_CDRP_CMD_CONFIG_GBE_PORT); | ||
127 | |||
128 | } | ||
129 | |||
115 | static int | 130 | static int |
116 | nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) | 131 | nx_fw_cmd_create_rx_ctx(struct netxen_adapter *adapter) |
117 | { | 132 | { |
diff --git a/drivers/net/netxen/netxen_nic_ethtool.c b/drivers/net/netxen/netxen_nic_ethtool.c index 587498e140bb..653d308e0f5d 100644 --- a/drivers/net/netxen/netxen_nic_ethtool.c +++ b/drivers/net/netxen/netxen_nic_ethtool.c | |||
@@ -214,7 +214,6 @@ skip: | |||
214 | check_sfp_module = netif_running(dev) && | 214 | check_sfp_module = netif_running(dev) && |
215 | adapter->has_link_events; | 215 | adapter->has_link_events; |
216 | } else { | 216 | } else { |
217 | ecmd->autoneg = AUTONEG_ENABLE; | ||
218 | ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); | 217 | ecmd->supported |= (SUPPORTED_TP |SUPPORTED_Autoneg); |
219 | ecmd->advertising |= | 218 | ecmd->advertising |= |
220 | (ADVERTISED_TP | ADVERTISED_Autoneg); | 219 | (ADVERTISED_TP | ADVERTISED_Autoneg); |
@@ -252,53 +251,24 @@ static int | |||
252 | netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | 251 | netxen_nic_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) |
253 | { | 252 | { |
254 | struct netxen_adapter *adapter = netdev_priv(dev); | 253 | struct netxen_adapter *adapter = netdev_priv(dev); |
255 | __u32 status; | 254 | int ret; |
256 | 255 | ||
257 | /* read which mode */ | 256 | if (adapter->ahw.port_type != NETXEN_NIC_GBE) |
258 | if (adapter->ahw.port_type == NETXEN_NIC_GBE) { | 257 | return -EOPNOTSUPP; |
259 | /* autonegotiation */ | ||
260 | if (adapter->phy_write && | ||
261 | adapter->phy_write(adapter, | ||
262 | NETXEN_NIU_GB_MII_MGMT_ADDR_AUTONEG, | ||
263 | ecmd->autoneg) != 0) | ||
264 | return -EIO; | ||
265 | else | ||
266 | adapter->link_autoneg = ecmd->autoneg; | ||
267 | 258 | ||
268 | if (adapter->phy_read && | 259 | if (!(adapter->capabilities & NX_FW_CAPABILITY_GBE_LINK_CFG)) |
269 | adapter->phy_read(adapter, | 260 | return -EOPNOTSUPP; |
270 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
271 | &status) != 0) | ||
272 | return -EIO; | ||
273 | 261 | ||
274 | /* speed */ | 262 | ret = nx_fw_cmd_set_gbe_port(adapter, ecmd->speed, ecmd->duplex, |
275 | switch (ecmd->speed) { | 263 | ecmd->autoneg); |
276 | case SPEED_10: | 264 | if (ret == NX_RCODE_NOT_SUPPORTED) |
277 | netxen_set_phy_speed(status, 0); | ||
278 | break; | ||
279 | case SPEED_100: | ||
280 | netxen_set_phy_speed(status, 1); | ||
281 | break; | ||
282 | case SPEED_1000: | ||
283 | netxen_set_phy_speed(status, 2); | ||
284 | break; | ||
285 | } | ||
286 | /* set duplex mode */ | ||
287 | if (ecmd->duplex == DUPLEX_HALF) | ||
288 | netxen_clear_phy_duplex(status); | ||
289 | if (ecmd->duplex == DUPLEX_FULL) | ||
290 | netxen_set_phy_duplex(status); | ||
291 | if (adapter->phy_write && | ||
292 | adapter->phy_write(adapter, | ||
293 | NETXEN_NIU_GB_MII_MGMT_ADDR_PHY_STATUS, | ||
294 | *((int *)&status)) != 0) | ||
295 | return -EIO; | ||
296 | else { | ||
297 | adapter->link_speed = ecmd->speed; | ||
298 | adapter->link_duplex = ecmd->duplex; | ||
299 | } | ||
300 | } else | ||
301 | return -EOPNOTSUPP; | 265 | return -EOPNOTSUPP; |
266 | else if (ret) | ||
267 | return -EIO; | ||
268 | |||
269 | adapter->link_speed = ecmd->speed; | ||
270 | adapter->link_duplex = ecmd->duplex; | ||
271 | adapter->link_autoneg = ecmd->autoneg; | ||
302 | 272 | ||
303 | if (!netif_running(dev)) | 273 | if (!netif_running(dev)) |
304 | return 0; | 274 | return 0; |