diff options
author | Jack Morgenstein <jackm@dev.mellanox.co.il> | 2012-05-30 05:14:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-31 18:18:16 -0400 |
commit | b91cb3ebcd5ef8db956b8caa486d780dc52b07f1 (patch) | |
tree | 76aa23e2322dc4a6ea39778656688a85ea5b03f3 /drivers | |
parent | 13bf58b7604d9adfebb8b7c95e6cfb31ec17c699 (diff) |
net/mlx4_core: Fixes for VF / Guest startup flow
- pass the following parameters:
- firmware version (added QUERY_FW paravirtualization for that)
- disable Blueflame on slaves. KVM disables write combining on guests,
and we get better performance without BF in this case. (This requires
QUERY_DEV_CAP paravirtualization, also in this commit)
- max qp rdma as destination
- get rid of a chunk of "if (0)" dead code
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/cmd.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/fw.c | 46 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/main.c | 17 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4.h | 10 |
4 files changed, 63 insertions, 14 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c index 1bcead1fa2f6..842c8ce9494e 100644 --- a/drivers/net/ethernet/mellanox/mlx4/cmd.c +++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c | |||
@@ -617,7 +617,7 @@ static struct mlx4_cmd_info cmd_info[] = { | |||
617 | .out_is_imm = false, | 617 | .out_is_imm = false, |
618 | .encode_slave_id = false, | 618 | .encode_slave_id = false, |
619 | .verify = NULL, | 619 | .verify = NULL, |
620 | .wrapper = NULL | 620 | .wrapper = mlx4_QUERY_FW_wrapper |
621 | }, | 621 | }, |
622 | { | 622 | { |
623 | .opcode = MLX4_CMD_QUERY_HCA, | 623 | .opcode = MLX4_CMD_QUERY_HCA, |
@@ -635,7 +635,7 @@ static struct mlx4_cmd_info cmd_info[] = { | |||
635 | .out_is_imm = false, | 635 | .out_is_imm = false, |
636 | .encode_slave_id = false, | 636 | .encode_slave_id = false, |
637 | .verify = NULL, | 637 | .verify = NULL, |
638 | .wrapper = NULL | 638 | .wrapper = mlx4_QUERY_DEV_CAP_wrapper |
639 | }, | 639 | }, |
640 | { | 640 | { |
641 | .opcode = MLX4_CMD_QUERY_FUNC_CAP, | 641 | .opcode = MLX4_CMD_QUERY_FUNC_CAP, |
diff --git a/drivers/net/ethernet/mellanox/mlx4/fw.c b/drivers/net/ethernet/mellanox/mlx4/fw.c index 68f5cd6cb3c7..7f2a4a659627 100644 --- a/drivers/net/ethernet/mellanox/mlx4/fw.c +++ b/drivers/net/ethernet/mellanox/mlx4/fw.c | |||
@@ -669,6 +669,28 @@ out: | |||
669 | return err; | 669 | return err; |
670 | } | 670 | } |
671 | 671 | ||
672 | int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | ||
673 | struct mlx4_vhcr *vhcr, | ||
674 | struct mlx4_cmd_mailbox *inbox, | ||
675 | struct mlx4_cmd_mailbox *outbox, | ||
676 | struct mlx4_cmd_info *cmd) | ||
677 | { | ||
678 | int err = 0; | ||
679 | u8 field; | ||
680 | |||
681 | err = mlx4_cmd_box(dev, 0, outbox->dma, 0, 0, MLX4_CMD_QUERY_DEV_CAP, | ||
682 | MLX4_CMD_TIME_CLASS_A, MLX4_CMD_NATIVE); | ||
683 | if (err) | ||
684 | return err; | ||
685 | |||
686 | /* For guests, report Blueflame disabled */ | ||
687 | MLX4_GET(field, outbox->buf, QUERY_DEV_CAP_BF_OFFSET); | ||
688 | field &= 0x7f; | ||
689 | MLX4_PUT(outbox->buf, field, QUERY_DEV_CAP_BF_OFFSET); | ||
690 | |||
691 | return 0; | ||
692 | } | ||
693 | |||
672 | int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | 694 | int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, |
673 | struct mlx4_vhcr *vhcr, | 695 | struct mlx4_vhcr *vhcr, |
674 | struct mlx4_cmd_mailbox *inbox, | 696 | struct mlx4_cmd_mailbox *inbox, |
@@ -860,6 +882,9 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev) | |||
860 | ((fw_ver & 0xffff0000ull) >> 16) | | 882 | ((fw_ver & 0xffff0000ull) >> 16) | |
861 | ((fw_ver & 0x0000ffffull) << 16); | 883 | ((fw_ver & 0x0000ffffull) << 16); |
862 | 884 | ||
885 | if (mlx4_is_slave(dev)) | ||
886 | goto out; | ||
887 | |||
863 | MLX4_GET(lg, outbox, QUERY_FW_PPF_ID); | 888 | MLX4_GET(lg, outbox, QUERY_FW_PPF_ID); |
864 | dev->caps.function = lg; | 889 | dev->caps.function = lg; |
865 | 890 | ||
@@ -927,6 +952,27 @@ out: | |||
927 | return err; | 952 | return err; |
928 | } | 953 | } |
929 | 954 | ||
955 | int mlx4_QUERY_FW_wrapper(struct mlx4_dev *dev, int slave, | ||
956 | struct mlx4_vhcr *vhcr, | ||
957 | struct mlx4_cmd_mailbox *inbox, | ||
958 | struct mlx4_cmd_mailbox *outbox, | ||
959 | struct mlx4_cmd_info *cmd) | ||
960 | { | ||
961 | u8 *outbuf; | ||
962 | int err; | ||
963 | |||
964 | outbuf = outbox->buf; | ||
965 | err = mlx4_cmd_box(dev, 0, outbox->dma, 0, 0, MLX4_CMD_QUERY_FW, | ||
966 | MLX4_CMD_TIME_CLASS_A, MLX4_CMD_NATIVE); | ||
967 | if (err) | ||
968 | return err; | ||
969 | |||
970 | /* for slaves, zero out everything except FW version */ | ||
971 | outbuf[0] = outbuf[1] = 0; | ||
972 | memset(&outbuf[8], 0, QUERY_FW_OUT_SIZE - 8); | ||
973 | return 0; | ||
974 | } | ||
975 | |||
930 | static void get_board_id(void *vsd, char *board_id) | 976 | static void get_board_id(void *vsd, char *board_id) |
931 | { | 977 | { |
932 | int i; | 978 | int i; |
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index 2fe9fe5f7cfb..7f71be0ca5f2 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c | |||
@@ -430,12 +430,17 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) | |||
430 | mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz; | 430 | mlx4_log_num_mgm_entry_size = hca_param.log_mc_entry_sz; |
431 | 431 | ||
432 | memset(&dev_cap, 0, sizeof(dev_cap)); | 432 | memset(&dev_cap, 0, sizeof(dev_cap)); |
433 | dev->caps.max_qp_dest_rdma = 1 << hca_param.log_rd_per_qp; | ||
433 | err = mlx4_dev_cap(dev, &dev_cap); | 434 | err = mlx4_dev_cap(dev, &dev_cap); |
434 | if (err) { | 435 | if (err) { |
435 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n"); | 436 | mlx4_err(dev, "QUERY_DEV_CAP command failed, aborting.\n"); |
436 | return err; | 437 | return err; |
437 | } | 438 | } |
438 | 439 | ||
440 | err = mlx4_QUERY_FW(dev); | ||
441 | if (err) | ||
442 | mlx4_err(dev, "QUERY_FW command failed: could not get FW version.\n"); | ||
443 | |||
439 | page_size = ~dev->caps.page_size_cap + 1; | 444 | page_size = ~dev->caps.page_size_cap + 1; |
440 | mlx4_warn(dev, "HCA minimum page size:%d\n", page_size); | 445 | mlx4_warn(dev, "HCA minimum page size:%d\n", page_size); |
441 | if (page_size > PAGE_SIZE) { | 446 | if (page_size > PAGE_SIZE) { |
@@ -499,18 +504,6 @@ static int mlx4_slave_cap(struct mlx4_dev *dev) | |||
499 | return -ENODEV; | 504 | return -ENODEV; |
500 | } | 505 | } |
501 | 506 | ||
502 | #if 0 | ||
503 | mlx4_warn(dev, "sqp_demux:%d\n", dev->caps.sqp_demux); | ||
504 | mlx4_warn(dev, "num_uars:%d reserved_uars:%d uar region:0x%x bar2:0x%llx\n", | ||
505 | dev->caps.num_uars, dev->caps.reserved_uars, | ||
506 | dev->caps.uar_page_size * dev->caps.num_uars, | ||
507 | pci_resource_len(dev->pdev, 2)); | ||
508 | mlx4_warn(dev, "num_eqs:%d reserved_eqs:%d\n", dev->caps.num_eqs, | ||
509 | dev->caps.reserved_eqs); | ||
510 | mlx4_warn(dev, "num_pds:%d reserved_pds:%d slave_pd_shift:%d pd_base:%d\n", | ||
511 | dev->caps.num_pds, dev->caps.reserved_pds, | ||
512 | dev->caps.slave_pd_shift, dev->caps.pd_base); | ||
513 | #endif | ||
514 | return 0; | 507 | return 0; |
515 | } | 508 | } |
516 | 509 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4.h b/drivers/net/ethernet/mellanox/mlx4/mlx4.h index 86b6e5a2fabf..e5d20220762c 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4.h | |||
@@ -1039,6 +1039,11 @@ int mlx4_init_resource_tracker(struct mlx4_dev *dev); | |||
1039 | void mlx4_free_resource_tracker(struct mlx4_dev *dev, | 1039 | void mlx4_free_resource_tracker(struct mlx4_dev *dev, |
1040 | enum mlx4_res_tracker_free_type type); | 1040 | enum mlx4_res_tracker_free_type type); |
1041 | 1041 | ||
1042 | int mlx4_QUERY_FW_wrapper(struct mlx4_dev *dev, int slave, | ||
1043 | struct mlx4_vhcr *vhcr, | ||
1044 | struct mlx4_cmd_mailbox *inbox, | ||
1045 | struct mlx4_cmd_mailbox *outbox, | ||
1046 | struct mlx4_cmd_info *cmd); | ||
1042 | int mlx4_SET_PORT_wrapper(struct mlx4_dev *dev, int slave, | 1047 | int mlx4_SET_PORT_wrapper(struct mlx4_dev *dev, int slave, |
1043 | struct mlx4_vhcr *vhcr, | 1048 | struct mlx4_vhcr *vhcr, |
1044 | struct mlx4_cmd_mailbox *inbox, | 1049 | struct mlx4_cmd_mailbox *inbox, |
@@ -1054,6 +1059,11 @@ int mlx4_CLOSE_PORT_wrapper(struct mlx4_dev *dev, int slave, | |||
1054 | struct mlx4_cmd_mailbox *inbox, | 1059 | struct mlx4_cmd_mailbox *inbox, |
1055 | struct mlx4_cmd_mailbox *outbox, | 1060 | struct mlx4_cmd_mailbox *outbox, |
1056 | struct mlx4_cmd_info *cmd); | 1061 | struct mlx4_cmd_info *cmd); |
1062 | int mlx4_QUERY_DEV_CAP_wrapper(struct mlx4_dev *dev, int slave, | ||
1063 | struct mlx4_vhcr *vhcr, | ||
1064 | struct mlx4_cmd_mailbox *inbox, | ||
1065 | struct mlx4_cmd_mailbox *outbox, | ||
1066 | struct mlx4_cmd_info *cmd); | ||
1057 | int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, | 1067 | int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave, |
1058 | struct mlx4_vhcr *vhcr, | 1068 | struct mlx4_vhcr *vhcr, |
1059 | struct mlx4_cmd_mailbox *inbox, | 1069 | struct mlx4_cmd_mailbox *inbox, |