diff options
author | Yevgeny Petrilin <yevgenyp@mellanox.co.il> | 2011-12-18 23:00:34 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-19 14:57:07 -0500 |
commit | 8d0fc7b61191c9433a4f738987b89e1d962eb637 (patch) | |
tree | f538c085fefdeddd321a66ed0fb54a0cd86cbf34 /drivers | |
parent | 58a60168d12c4e5be21c29420a3de4a41ef3470f (diff) |
mlx4_core: Changing link sensing logic
New FW can give clues to driver regarding default port type
and whether or not we should default to link sensing on the port.
2 bits are added to QUERY_PORT command:
1. suggested_type: This bit gives a hint whether the default port type should be
IB or Ethernet.
The driver will use this hint in case the user didn't specify explicitly the link layer
type he wants to set.
2. default_sense: If this bit is set, we would sense the port type on start-up
and default the port to link sensing
Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 50 |
3 files changed, 38 insertions, 16 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index f03b54e0aa53..abefcc86e2d1 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -577,6 +577,8 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
577 | 577 | ||
578 | MLX4_GET(field, outbox, QUERY_PORT_SUPPORTED_TYPE_OFFSET); | 578 | MLX4_GET(field, outbox, QUERY_PORT_SUPPORTED_TYPE_OFFSET); |
579 | dev_cap->supported_port_types[i] = field & 3; | 579 | dev_cap->supported_port_types[i] = field & 3; |
580 | dev_cap->suggested_type[i] = (field >> 3) & 1; | ||
581 | dev_cap->default_sense[i] = (field >> 4) & 1; | ||
580 | MLX4_GET(field, outbox, QUERY_PORT_MTU_OFFSET); | 582 | MLX4_GET(field, outbox, QUERY_PORT_MTU_OFFSET); |
581 | dev_cap->ib_mtu[i] = field & 0xf; | 583 | dev_cap->ib_mtu[i] = field & 0xf; |
582 | MLX4_GET(field, outbox, QUERY_PORT_WIDTH_OFFSET); | 584 | MLX4_GET(field, outbox, QUERY_PORT_WIDTH_OFFSET); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h index 3368363a8ec5..119e0cc9fab3 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.h +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h | |||
@@ -111,6 +111,8 @@ struct mlx4_dev_cap { | |||
111 | u64 max_icm_sz; | 111 | u64 max_icm_sz; |
112 | int max_gso_sz; | 112 | int max_gso_sz; |
113 | u8 supported_port_types[MLX4_MAX_PORTS + 1]; | 113 | u8 supported_port_types[MLX4_MAX_PORTS + 1]; |
114 | u8 suggested_type[MLX4_MAX_PORTS + 1]; | ||
115 | u8 default_sense[MLX4_MAX_PORTS + 1]; | ||
114 | u8 log_max_macs[MLX4_MAX_PORTS + 1]; | 116 | u8 log_max_macs[MLX4_MAX_PORTS + 1]; |
115 | u8 log_max_vlans[MLX4_MAX_PORTS + 1]; | 117 | u8 log_max_vlans[MLX4_MAX_PORTS + 1]; |
116 | u32 max_counters; | 118 | u32 max_counters; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 8f7314394cc2..e984ded2249f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -130,10 +130,11 @@ int log_mtts_per_seg = ilog2(MLX4_MTT_ENTRY_PER_SEG); | |||
130 | module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); | 130 | module_param_named(log_mtts_per_seg, log_mtts_per_seg, int, 0444); |
131 | MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-7)"); | 131 | MODULE_PARM_DESC(log_mtts_per_seg, "Log2 number of MTT entries per segment (1-7)"); |
132 | 132 | ||
133 | static int port_type_array[2] = {1, 1}; | 133 | static int port_type_array[2] = {MLX4_PORT_TYPE_NONE, MLX4_PORT_TYPE_NONE}; |
134 | static int arr_argc = 2; | 134 | static int arr_argc = 2; |
135 | module_param_array(port_type_array, int, &arr_argc, 0444); | 135 | module_param_array(port_type_array, int, &arr_argc, 0444); |
136 | MODULE_PARM_DESC(port_type_array, "Array of port types: IB by default"); | 136 | MODULE_PARM_DESC(port_type_array, "Array of port types: HW_DEFAULT (0) is default " |
137 | "1 for IB, 2 for Ethernet"); | ||
137 | 138 | ||
138 | struct mlx4_port_config { | 139 | struct mlx4_port_config { |
139 | struct list_head list; | 140 | struct list_head list; |
@@ -225,6 +226,8 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
225 | dev->caps.eth_mtu_cap[i] = dev_cap->eth_mtu[i]; | 226 | dev->caps.eth_mtu_cap[i] = dev_cap->eth_mtu[i]; |
226 | dev->caps.def_mac[i] = dev_cap->def_mac[i]; | 227 | dev->caps.def_mac[i] = dev_cap->def_mac[i]; |
227 | dev->caps.supported_type[i] = dev_cap->supported_port_types[i]; | 228 | dev->caps.supported_type[i] = dev_cap->supported_port_types[i]; |
229 | dev->caps.suggested_type[i] = dev_cap->suggested_type[i]; | ||
230 | dev->caps.default_sense[i] = dev_cap->default_sense[i]; | ||
228 | dev->caps.trans_type[i] = dev_cap->trans_type[i]; | 231 | dev->caps.trans_type[i] = dev_cap->trans_type[i]; |
229 | dev->caps.vendor_oui[i] = dev_cap->vendor_oui[i]; | 232 | dev->caps.vendor_oui[i] = dev_cap->vendor_oui[i]; |
230 | dev->caps.wavelength[i] = dev_cap->wavelength[i]; | 233 | dev->caps.wavelength[i] = dev_cap->wavelength[i]; |
@@ -302,22 +305,43 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
302 | * first of all check if SRIOV is on */ | 305 | * first of all check if SRIOV is on */ |
303 | } else if (dev->flags & MLX4_FLAG_SRIOV) | 306 | } else if (dev->flags & MLX4_FLAG_SRIOV) |
304 | dev->caps.port_type[i] = MLX4_PORT_TYPE_ETH; | 307 | dev->caps.port_type[i] = MLX4_PORT_TYPE_ETH; |
305 | /* if IB and ETH are supported and SRIOV is off | ||
306 | * use module parameters */ | ||
307 | else { | 308 | else { |
308 | if (port_type_array[i-1]) | 309 | /* In non-SRIOV mode, we set the port type |
309 | dev->caps.port_type[i] = | 310 | * according to user selection of port type, |
310 | MLX4_PORT_TYPE_IB; | 311 | * if usere selected none, take the FW hint */ |
312 | if (port_type_array[i-1] == MLX4_PORT_TYPE_NONE) | ||
313 | dev->caps.port_type[i] = dev->caps.suggested_type[i] ? | ||
314 | MLX4_PORT_TYPE_ETH : MLX4_PORT_TYPE_IB; | ||
311 | else | 315 | else |
312 | dev->caps.port_type[i] = | 316 | dev->caps.port_type[i] = port_type_array[i-1]; |
313 | MLX4_PORT_TYPE_ETH; | ||
314 | } | 317 | } |
315 | } | 318 | } |
316 | dev->caps.possible_type[i] = dev->caps.port_type[i]; | 319 | /* |
320 | * Link sensing is allowed on the port if 3 conditions are true: | ||
321 | * 1. Both protocols are supported on the port. | ||
322 | * 2. Different types are supported on the port | ||
323 | * 3. FW declared that it supports link sensing | ||
324 | */ | ||
317 | mlx4_priv(dev)->sense.sense_allowed[i] = | 325 | mlx4_priv(dev)->sense.sense_allowed[i] = |
318 | ((dev->caps.supported_type[i] == MLX4_PORT_TYPE_AUTO) && | 326 | ((dev->caps.supported_type[i] == MLX4_PORT_TYPE_AUTO) && |
327 | (dev->caps.flags & MLX4_DEV_CAP_FLAG_DPDP) && | ||
319 | (dev->caps.flags & MLX4_DEV_CAP_FLAG_SENSE_SUPPORT)); | 328 | (dev->caps.flags & MLX4_DEV_CAP_FLAG_SENSE_SUPPORT)); |
320 | 329 | ||
330 | /* | ||
331 | * If "default_sense" bit is set, we move the port to "AUTO" mode | ||
332 | * and perform sense_port FW command to try and set the correct | ||
333 | * port type from beginning | ||
334 | */ | ||
335 | if (mlx4_priv(dev)->sense.sense_allowed && dev->caps.default_sense[i]) { | ||
336 | enum mlx4_port_type sensed_port = MLX4_PORT_TYPE_NONE; | ||
337 | dev->caps.possible_type[i] = MLX4_PORT_TYPE_AUTO; | ||
338 | mlx4_SENSE_PORT(dev, i, &sensed_port); | ||
339 | if (sensed_port != MLX4_PORT_TYPE_NONE) | ||
340 | dev->caps.port_type[i] = sensed_port; | ||
341 | } else { | ||
342 | dev->caps.possible_type[i] = dev->caps.port_type[i]; | ||
343 | } | ||
344 | |||
321 | if (dev->caps.log_num_macs > dev_cap->log_max_macs[i]) { | 345 | if (dev->caps.log_num_macs > dev_cap->log_max_macs[i]) { |
322 | dev->caps.log_num_macs = dev_cap->log_max_macs[i]; | 346 | dev->caps.log_num_macs = dev_cap->log_max_macs[i]; |
323 | mlx4_warn(dev, "Requested number of MACs is too much " | 347 | mlx4_warn(dev, "Requested number of MACs is too much " |
@@ -1329,12 +1353,6 @@ static int mlx4_setup_hca(struct mlx4_dev *dev) | |||
1329 | 1353 | ||
1330 | if (!mlx4_is_slave(dev)) { | 1354 | if (!mlx4_is_slave(dev)) { |
1331 | for (port = 1; port <= dev->caps.num_ports; port++) { | 1355 | for (port = 1; port <= dev->caps.num_ports; port++) { |
1332 | if (!mlx4_is_mfunc(dev)) { | ||
1333 | enum mlx4_port_type port_type = 0; | ||
1334 | mlx4_SENSE_PORT(dev, port, &port_type); | ||
1335 | if (port_type) | ||
1336 | dev->caps.port_type[port] = port_type; | ||
1337 | } | ||
1338 | ib_port_default_caps = 0; | 1356 | ib_port_default_caps = 0; |
1339 | err = mlx4_get_port_ib_caps(dev, port, | 1357 | err = mlx4_get_port_ib_caps(dev, port, |
1340 | &ib_port_default_caps); | 1358 | &ib_port_default_caps); |