aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYevgeny Petrilin <yevgenyp@mellanox.co.il>2010-08-23 23:46:23 -0400
committerDavid S. Miller <davem@davemloft.net>2010-08-24 17:54:51 -0400
commit7699517db435fd24143bd32dd644275e3eeb4c86 (patch)
treee39bad6758eb4172cd4bafe481803c8f752a2630 /drivers/net
parente7c1c2c46201e46f8ce817196507d2ffd3dafd8e (diff)
mlx4_en: Fixing report in Ethtool get_settings
The report now based on query from FW, giving the correct tranciever type and link speed. Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/mlx4/en_ethtool.c27
-rw-r--r--drivers/net/mlx4/fw.c9
-rw-r--r--drivers/net/mlx4/fw.h4
-rw-r--r--drivers/net/mlx4/main.c4
4 files changed, 42 insertions, 2 deletions
diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
index f7d72d7a8704..fa2f2f43ab48 100644
--- a/drivers/net/mlx4/en_ethtool.c
+++ b/drivers/net/mlx4/en_ethtool.c
@@ -244,16 +244,39 @@ static void mlx4_en_get_strings(struct net_device *dev,
244 244
245static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 245static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
246{ 246{
247 struct mlx4_en_priv *priv = netdev_priv(dev);
248 int trans_type;
249
247 cmd->autoneg = AUTONEG_DISABLE; 250 cmd->autoneg = AUTONEG_DISABLE;
248 cmd->supported = SUPPORTED_10000baseT_Full; 251 cmd->supported = SUPPORTED_10000baseT_Full;
249 cmd->advertising = ADVERTISED_1000baseT_Full; 252 cmd->advertising = ADVERTISED_10000baseT_Full;
253
254 if (mlx4_en_QUERY_PORT(priv->mdev, priv->port))
255 return -ENOMEM;
256
257 trans_type = priv->port_state.transciver;
250 if (netif_carrier_ok(dev)) { 258 if (netif_carrier_ok(dev)) {
251 cmd->speed = SPEED_10000; 259 cmd->speed = priv->port_state.link_speed;
252 cmd->duplex = DUPLEX_FULL; 260 cmd->duplex = DUPLEX_FULL;
253 } else { 261 } else {
254 cmd->speed = -1; 262 cmd->speed = -1;
255 cmd->duplex = -1; 263 cmd->duplex = -1;
256 } 264 }
265
266 if (trans_type > 0 && trans_type <= 0xC) {
267 cmd->port = PORT_FIBRE;
268 cmd->transceiver = XCVR_EXTERNAL;
269 cmd->supported |= SUPPORTED_FIBRE;
270 cmd->advertising |= ADVERTISED_FIBRE;
271 } else if (trans_type == 0x80 || trans_type == 0) {
272 cmd->port = PORT_TP;
273 cmd->transceiver = XCVR_INTERNAL;
274 cmd->supported |= SUPPORTED_TP;
275 cmd->advertising |= ADVERTISED_TP;
276 } else {
277 cmd->port = -1;
278 cmd->transceiver = -1;
279 }
257 return 0; 280 return 0;
258} 281}
259 282
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index a87bf3c97055..515c6348f32b 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -141,6 +141,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
141 struct mlx4_cmd_mailbox *mailbox; 141 struct mlx4_cmd_mailbox *mailbox;
142 u32 *outbox; 142 u32 *outbox;
143 u8 field; 143 u8 field;
144 u32 field32;
144 u16 size; 145 u16 size;
145 u16 stat_rate; 146 u16 stat_rate;
146 int err; 147 int err;
@@ -368,6 +369,9 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
368#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a 369#define QUERY_PORT_MAX_MACVLAN_OFFSET 0x0a
369#define QUERY_PORT_MAX_VL_OFFSET 0x0b 370#define QUERY_PORT_MAX_VL_OFFSET 0x0b
370#define QUERY_PORT_MAC_OFFSET 0x10 371#define QUERY_PORT_MAC_OFFSET 0x10
372#define QUERY_PORT_TRANS_VENDOR_OFFSET 0x18
373#define QUERY_PORT_WAVELENGTH_OFFSET 0x1c
374#define QUERY_PORT_TRANS_CODE_OFFSET 0x20
371 375
372 for (i = 1; i <= dev_cap->num_ports; ++i) { 376 for (i = 1; i <= dev_cap->num_ports; ++i) {
373 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT, 377 err = mlx4_cmd_box(dev, 0, mailbox->dma, i, 0, MLX4_CMD_QUERY_PORT,
@@ -391,6 +395,11 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
391 dev_cap->log_max_vlans[i] = field >> 4; 395 dev_cap->log_max_vlans[i] = field >> 4;
392 MLX4_GET(dev_cap->eth_mtu[i], outbox, QUERY_PORT_ETH_MTU_OFFSET); 396 MLX4_GET(dev_cap->eth_mtu[i], outbox, QUERY_PORT_ETH_MTU_OFFSET);
393 MLX4_GET(dev_cap->def_mac[i], outbox, QUERY_PORT_MAC_OFFSET); 397 MLX4_GET(dev_cap->def_mac[i], outbox, QUERY_PORT_MAC_OFFSET);
398 MLX4_GET(field32, outbox, QUERY_PORT_TRANS_VENDOR_OFFSET);
399 dev_cap->trans_type[i] = field32 >> 24;
400 dev_cap->vendor_oui[i] = field32 & 0xffffff;
401 MLX4_GET(dev_cap->wavelength[i], outbox, QUERY_PORT_WAVELENGTH_OFFSET);
402 MLX4_GET(dev_cap->trans_code[i], outbox, QUERY_PORT_TRANS_CODE_OFFSET);
394 } 403 }
395 } 404 }
396 405
diff --git a/drivers/net/mlx4/fw.h b/drivers/net/mlx4/fw.h
index 2cc1ba5452e3..443e456c9dab 100644
--- a/drivers/net/mlx4/fw.h
+++ b/drivers/net/mlx4/fw.h
@@ -73,6 +73,10 @@ struct mlx4_dev_cap {
73 int max_pkeys[MLX4_MAX_PORTS + 1]; 73 int max_pkeys[MLX4_MAX_PORTS + 1];
74 u64 def_mac[MLX4_MAX_PORTS + 1]; 74 u64 def_mac[MLX4_MAX_PORTS + 1];
75 u16 eth_mtu[MLX4_MAX_PORTS + 1]; 75 u16 eth_mtu[MLX4_MAX_PORTS + 1];
76 int trans_type[MLX4_MAX_PORTS + 1];
77 int vendor_oui[MLX4_MAX_PORTS + 1];
78 u16 wavelength[MLX4_MAX_PORTS + 1];
79 u64 trans_code[MLX4_MAX_PORTS + 1];
76 u16 stat_rate_support; 80 u16 stat_rate_support;
77 int loopback_support; 81 int loopback_support;
78 u32 flags; 82 u32 flags;
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 7390cdb19414..f4791fa2472f 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -184,6 +184,10 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
184 dev->caps.eth_mtu_cap[i] = dev_cap->eth_mtu[i]; 184 dev->caps.eth_mtu_cap[i] = dev_cap->eth_mtu[i];
185 dev->caps.def_mac[i] = dev_cap->def_mac[i]; 185 dev->caps.def_mac[i] = dev_cap->def_mac[i];
186 dev->caps.supported_type[i] = dev_cap->supported_port_types[i]; 186 dev->caps.supported_type[i] = dev_cap->supported_port_types[i];
187 dev->caps.trans_type[i] = dev_cap->trans_type[i];
188 dev->caps.vendor_oui[i] = dev_cap->vendor_oui[i];
189 dev->caps.wavelength[i] = dev_cap->wavelength[i];
190 dev->caps.trans_code[i] = dev_cap->trans_code[i];
187 } 191 }
188 192
189 dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE; 193 dev->caps.num_uars = dev_cap->uar_size / PAGE_SIZE;