diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 15 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.h | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 71 |
3 files changed, 62 insertions, 25 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 9a9de51ecc91..8b3d0512a46b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -1338,6 +1338,7 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
1338 | { | 1338 | { |
1339 | struct mlx4_cmd_mailbox *mailbox; | 1339 | struct mlx4_cmd_mailbox *mailbox; |
1340 | __be32 *outbox; | 1340 | __be32 *outbox; |
1341 | u32 dword_field; | ||
1341 | int err; | 1342 | int err; |
1342 | u8 byte_field; | 1343 | u8 byte_field; |
1343 | 1344 | ||
@@ -1372,10 +1373,18 @@ int mlx4_QUERY_HCA(struct mlx4_dev *dev, | |||
1372 | MLX4_GET(param->rdmarc_base, outbox, INIT_HCA_RDMARC_BASE_OFFSET); | 1373 | MLX4_GET(param->rdmarc_base, outbox, INIT_HCA_RDMARC_BASE_OFFSET); |
1373 | MLX4_GET(param->log_rd_per_qp, outbox, INIT_HCA_LOG_RD_OFFSET); | 1374 | MLX4_GET(param->log_rd_per_qp, outbox, INIT_HCA_LOG_RD_OFFSET); |
1374 | 1375 | ||
1376 | MLX4_GET(dword_field, outbox, INIT_HCA_FLAGS_OFFSET); | ||
1377 | if (dword_field & (1 << INIT_HCA_DEVICE_MANAGED_FLOW_STEERING_EN)) { | ||
1378 | param->steering_mode = MLX4_STEERING_MODE_DEVICE_MANAGED; | ||
1379 | } else { | ||
1380 | MLX4_GET(byte_field, outbox, INIT_HCA_UC_STEERING_OFFSET); | ||
1381 | if (byte_field & 0x8) | ||
1382 | param->steering_mode = MLX4_STEERING_MODE_B0; | ||
1383 | else | ||
1384 | param->steering_mode = MLX4_STEERING_MODE_A0; | ||
1385 | } | ||
1375 | /* steering attributes */ | 1386 | /* steering attributes */ |
1376 | if (dev->caps.steering_mode == | 1387 | if (param->steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { |
1377 | MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
1378 | |||
1379 | MLX4_GET(param->mc_base, outbox, INIT_HCA_FS_BASE_OFFSET); | 1388 | MLX4_GET(param->mc_base, outbox, INIT_HCA_FS_BASE_OFFSET); |
1380 | MLX4_GET(param->log_mc_entry_sz, outbox, | 1389 | MLX4_GET(param->log_mc_entry_sz, outbox, |
1381 | INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); | 1390 | INIT_HCA_FS_LOG_ENTRY_SZ_OFFSET); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.h b/drivers/net/ethernet/mellanox/mlx4/fw.h index 2c2e7ade2a34..dbf2f69cc59f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.h +++ b/drivers/net/ethernet/mellanox/mlx4/fw.h | |||
@@ -172,6 +172,7 @@ struct mlx4_init_hca_param { | |||
172 | u8 log_uar_sz; | 172 | u8 log_uar_sz; |
173 | u8 uar_page_sz; /* log pg sz in 4k chunks */ | 173 | u8 uar_page_sz; /* log pg sz in 4k chunks */ |
174 | u8 fs_hash_enable_bits; | 174 | u8 fs_hash_enable_bits; |
175 | u8 steering_mode; /* for QUERY_HCA */ | ||
175 | u64 dev_cap_enabled; | 176 | u64 dev_cap_enabled; |
176 | }; | 177 | }; |
177 | 178 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index b2acbe7706a3..680d81026cbd 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -281,28 +281,6 @@ static int mlx4_dev_cap(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap) | |||
281 | dev->caps.max_gso_sz = dev_cap->max_gso_sz; | 281 | dev->caps.max_gso_sz = dev_cap->max_gso_sz; |
282 | dev->caps.max_rss_tbl_sz = dev_cap->max_rss_tbl_sz; | 282 | dev->caps.max_rss_tbl_sz = dev_cap->max_rss_tbl_sz; |
283 | 283 | ||
284 | if (dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_FS_EN) { | ||
285 | dev->caps.steering_mode = MLX4_STEERING_MODE_DEVICE_MANAGED; | ||
286 | dev->caps.num_qp_per_mgm = dev_cap->fs_max_num_qp_per_entry; | ||
287 | dev->caps.fs_log_max_ucast_qp_range_size = | ||
288 | dev_cap->fs_log_max_ucast_qp_range_size; | ||
289 | } else { | ||
290 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER && | ||
291 | dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) { | ||
292 | dev->caps.steering_mode = MLX4_STEERING_MODE_B0; | ||
293 | } else { | ||
294 | dev->caps.steering_mode = MLX4_STEERING_MODE_A0; | ||
295 | |||
296 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER || | ||
297 | dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) | ||
298 | mlx4_warn(dev, "Must have UC_STEER and MC_STEER flags " | ||
299 | "set to use B0 steering. Falling back to A0 steering mode.\n"); | ||
300 | } | ||
301 | dev->caps.num_qp_per_mgm = mlx4_get_qp_per_mgm(dev); | ||
302 | } | ||
303 | mlx4_dbg(dev, "Steering mode is: %s\n", | ||
304 | mlx4_steering_mode_str(dev->caps.steering_mode)); | ||
305 | |||
306 | /* Sense port always allowed on supported devices for ConnectX-1 and -2 */ | 284 | /* Sense port always allowed on supported devices for ConnectX-1 and -2 */ |
307 | if (mlx4_priv(dev)->pci_dev_data & MLX4_PCI_DEV_FORCE_SENSE_PORT) | 285 | if (mlx4_priv(dev)->pci_dev_data & MLX4_PCI_DEV_FORCE_SENSE_PORT) |
308 | dev->caps.flags |= MLX4_DEV_CAP_FLAG_SENSE_SUPPORT; | 286 | dev->caps.flags |= MLX4_DEV_CAP_FLAG_SENSE_SUPPORT; |
@@ -493,6 +471,23 @@ int mlx4_is_slave_active(struct mlx4_dev *dev, int slave) | |||
493 | } | 471 | } |
494 | EXPORT_SYMBOL(mlx4_is_slave_active); | 472 | EXPORT_SYMBOL(mlx4_is_slave_active); |
495 | 473 | ||
474 | static void slave_adjust_steering_mode(struct mlx4_dev *dev, | ||
475 | struct mlx4_dev_cap *dev_cap, | ||
476 | struct mlx4_init_hca_param *hca_param) | ||
477 | { | ||
478 | dev->caps.steering_mode = hca_param->steering_mode; | ||
479 | if (dev->caps.steering_mode == MLX4_STEERING_MODE_DEVICE_MANAGED) { | ||
480 | dev->caps.num_qp_per_mgm = dev_cap->fs_max_num_qp_per_entry; | ||
481 | dev->caps.fs_log_max_ucast_qp_range_size = | ||
482 | dev_cap->fs_log_max_ucast_qp_range_size; | ||
483 | } else | ||
484 | dev->caps.num_qp_per_mgm = | ||
485 | 4 * ((1 << hca_param->log_mc_entry_sz)/16 - 2); | ||
486 | |||
487 | mlx4_dbg(dev, "Steering mode is: %s\n", | ||
488 | mlx4_steering_mode_str(dev->caps.steering_mode)); | ||
489 | } | ||
490 | |||
496 | static int mlx4_slave_cap(struct mlx4_dev *dev) | 491 | static int mlx4_slave_cap(struct mlx4_dev *dev) |
497 | { | 492 | { |
498 | int err; | 493 | int err; |
@@ -635,6 +630,8 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) | |||
635 | dev->caps.cqe_size = 32; | 630 | dev->caps.cqe_size = 32; |
636 | } | 631 | } |
637 | 632 | ||
633 | slave_adjust_steering_mode(dev, &dev_cap, &hca_param); | ||
634 | |||
638 | return 0; | 635 | return 0; |
639 | 636 | ||
640 | err_mem: | 637 | err_mem: |
@@ -1321,6 +1318,34 @@ static void mlx4_parav_master_pf_caps(struct mlx4_dev *dev) | |||
1321 | } | 1318 | } |
1322 | } | 1319 | } |
1323 | 1320 | ||
1321 | static void choose_steering_mode(struct mlx4_dev *dev, | ||
1322 | struct mlx4_dev_cap *dev_cap) | ||
1323 | { | ||
1324 | if (dev_cap->flags2 & MLX4_DEV_CAP_FLAG2_FS_EN && | ||
1325 | (!mlx4_is_mfunc(dev) || | ||
1326 | (dev_cap->fs_max_num_qp_per_entry >= (num_vfs + 1)))) { | ||
1327 | dev->caps.steering_mode = MLX4_STEERING_MODE_DEVICE_MANAGED; | ||
1328 | dev->caps.num_qp_per_mgm = dev_cap->fs_max_num_qp_per_entry; | ||
1329 | dev->caps.fs_log_max_ucast_qp_range_size = | ||
1330 | dev_cap->fs_log_max_ucast_qp_range_size; | ||
1331 | } else { | ||
1332 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER && | ||
1333 | dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) | ||
1334 | dev->caps.steering_mode = MLX4_STEERING_MODE_B0; | ||
1335 | else { | ||
1336 | dev->caps.steering_mode = MLX4_STEERING_MODE_A0; | ||
1337 | |||
1338 | if (dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_UC_STEER || | ||
1339 | dev->caps.flags & MLX4_DEV_CAP_FLAG_VEP_MC_STEER) | ||
1340 | mlx4_warn(dev, "Must have both UC_STEER and MC_STEER flags " | ||
1341 | "set to use B0 steering. Falling back to A0 steering mode.\n"); | ||
1342 | } | ||
1343 | dev->caps.num_qp_per_mgm = mlx4_get_qp_per_mgm(dev); | ||
1344 | } | ||
1345 | mlx4_dbg(dev, "Steering mode is: %s\n", | ||
1346 | mlx4_steering_mode_str(dev->caps.steering_mode)); | ||
1347 | } | ||
1348 | |||
1324 | static int mlx4_init_hca(struct mlx4_dev *dev) | 1349 | static int mlx4_init_hca(struct mlx4_dev *dev) |
1325 | { | 1350 | { |
1326 | struct mlx4_priv *priv = mlx4_priv(dev); | 1351 | struct mlx4_priv *priv = mlx4_priv(dev); |
@@ -1360,6 +1385,8 @@ static int mlx4_init_hca(struct mlx4_dev *dev) | |||
1360 | goto err_stop_fw; | 1385 | goto err_stop_fw; |
1361 | } | 1386 | } |
1362 | 1387 | ||
1388 | choose_steering_mode(dev, &dev_cap); | ||
1389 | |||
1363 | if (mlx4_is_master(dev)) | 1390 | if (mlx4_is_master(dev)) |
1364 | mlx4_parav_master_pf_caps(dev); | 1391 | mlx4_parav_master_pf_caps(dev); |
1365 | 1392 | ||