diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx5')
| -rw-r--r-- | drivers/infiniband/hw/mlx5/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 26 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mlx5/qp.c | 18 | ||||
| -rw-r--r-- | drivers/infiniband/hw/mlx5/user.h | 7 |
4 files changed, 41 insertions, 12 deletions
diff --git a/drivers/infiniband/hw/mlx5/Kconfig b/drivers/infiniband/hw/mlx5/Kconfig index 8e6aebfaf8a4..10df386c6344 100644 --- a/drivers/infiniband/hw/mlx5/Kconfig +++ b/drivers/infiniband/hw/mlx5/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config MLX5_INFINIBAND | 1 | config MLX5_INFINIBAND |
| 2 | tristate "Mellanox Connect-IB HCA support" | 2 | tristate "Mellanox Connect-IB HCA support" |
| 3 | depends on NETDEVICES && ETHERNET && PCI && X86 | 3 | depends on NETDEVICES && ETHERNET && PCI |
| 4 | select NET_VENDOR_MELLANOX | 4 | select NET_VENDOR_MELLANOX |
| 5 | select MLX5_CORE | 5 | select MLX5_CORE |
| 6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c index 9660d093f8cf..bf900579ac08 100644 --- a/drivers/infiniband/hw/mlx5/main.c +++ b/drivers/infiniband/hw/mlx5/main.c | |||
| @@ -46,8 +46,8 @@ | |||
| 46 | #include "mlx5_ib.h" | 46 | #include "mlx5_ib.h" |
| 47 | 47 | ||
| 48 | #define DRIVER_NAME "mlx5_ib" | 48 | #define DRIVER_NAME "mlx5_ib" |
| 49 | #define DRIVER_VERSION "1.0" | 49 | #define DRIVER_VERSION "2.2-1" |
| 50 | #define DRIVER_RELDATE "June 2013" | 50 | #define DRIVER_RELDATE "Feb 2014" |
| 51 | 51 | ||
| 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); | 52 | MODULE_AUTHOR("Eli Cohen <eli@mellanox.com>"); |
| 53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); | 53 | MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); |
| @@ -261,8 +261,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev, | |||
| 261 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | | 261 | props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT | |
| 262 | IB_DEVICE_PORT_ACTIVE_EVENT | | 262 | IB_DEVICE_PORT_ACTIVE_EVENT | |
| 263 | IB_DEVICE_SYS_IMAGE_GUID | | 263 | IB_DEVICE_SYS_IMAGE_GUID | |
| 264 | IB_DEVICE_RC_RNR_NAK_GEN | | 264 | IB_DEVICE_RC_RNR_NAK_GEN; |
| 265 | IB_DEVICE_BLOCK_MULTICAST_LOOPBACK; | ||
| 266 | flags = dev->mdev.caps.flags; | 265 | flags = dev->mdev.caps.flags; |
| 267 | if (flags & MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR) | 266 | if (flags & MLX5_DEV_CAP_FLAG_BAD_PKEY_CNTR) |
| 268 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; | 267 | props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR; |
| @@ -536,24 +535,38 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
| 536 | struct ib_udata *udata) | 535 | struct ib_udata *udata) |
| 537 | { | 536 | { |
| 538 | struct mlx5_ib_dev *dev = to_mdev(ibdev); | 537 | struct mlx5_ib_dev *dev = to_mdev(ibdev); |
| 539 | struct mlx5_ib_alloc_ucontext_req req; | 538 | struct mlx5_ib_alloc_ucontext_req_v2 req; |
| 540 | struct mlx5_ib_alloc_ucontext_resp resp; | 539 | struct mlx5_ib_alloc_ucontext_resp resp; |
| 541 | struct mlx5_ib_ucontext *context; | 540 | struct mlx5_ib_ucontext *context; |
| 542 | struct mlx5_uuar_info *uuari; | 541 | struct mlx5_uuar_info *uuari; |
| 543 | struct mlx5_uar *uars; | 542 | struct mlx5_uar *uars; |
| 544 | int gross_uuars; | 543 | int gross_uuars; |
| 545 | int num_uars; | 544 | int num_uars; |
| 545 | int ver; | ||
| 546 | int uuarn; | 546 | int uuarn; |
| 547 | int err; | 547 | int err; |
| 548 | int i; | 548 | int i; |
| 549 | int reqlen; | ||
| 549 | 550 | ||
| 550 | if (!dev->ib_active) | 551 | if (!dev->ib_active) |
| 551 | return ERR_PTR(-EAGAIN); | 552 | return ERR_PTR(-EAGAIN); |
| 552 | 553 | ||
| 553 | err = ib_copy_from_udata(&req, udata, sizeof(req)); | 554 | memset(&req, 0, sizeof(req)); |
| 555 | reqlen = udata->inlen - sizeof(struct ib_uverbs_cmd_hdr); | ||
| 556 | if (reqlen == sizeof(struct mlx5_ib_alloc_ucontext_req)) | ||
| 557 | ver = 0; | ||
| 558 | else if (reqlen == sizeof(struct mlx5_ib_alloc_ucontext_req_v2)) | ||
| 559 | ver = 2; | ||
| 560 | else | ||
| 561 | return ERR_PTR(-EINVAL); | ||
| 562 | |||
| 563 | err = ib_copy_from_udata(&req, udata, reqlen); | ||
| 554 | if (err) | 564 | if (err) |
| 555 | return ERR_PTR(err); | 565 | return ERR_PTR(err); |
| 556 | 566 | ||
| 567 | if (req.flags || req.reserved) | ||
| 568 | return ERR_PTR(-EINVAL); | ||
| 569 | |||
| 557 | if (req.total_num_uuars > MLX5_MAX_UUARS) | 570 | if (req.total_num_uuars > MLX5_MAX_UUARS) |
| 558 | return ERR_PTR(-ENOMEM); | 571 | return ERR_PTR(-ENOMEM); |
| 559 | 572 | ||
| @@ -626,6 +639,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(struct ib_device *ibdev, | |||
| 626 | if (err) | 639 | if (err) |
| 627 | goto out_uars; | 640 | goto out_uars; |
| 628 | 641 | ||
| 642 | uuari->ver = ver; | ||
| 629 | uuari->num_low_latency_uuars = req.num_low_latency_uuars; | 643 | uuari->num_low_latency_uuars = req.num_low_latency_uuars; |
| 630 | uuari->uars = uars; | 644 | uuari->uars = uars; |
| 631 | uuari->num_uars = num_uars; | 645 | uuari->num_uars = num_uars; |
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c index ae37fb9bf262..7dfe8a1c84cf 100644 --- a/drivers/infiniband/hw/mlx5/qp.c +++ b/drivers/infiniband/hw/mlx5/qp.c | |||
| @@ -216,7 +216,9 @@ static int sq_overhead(enum ib_qp_type qp_type) | |||
| 216 | 216 | ||
| 217 | case IB_QPT_UC: | 217 | case IB_QPT_UC: |
| 218 | size += sizeof(struct mlx5_wqe_ctrl_seg) + | 218 | size += sizeof(struct mlx5_wqe_ctrl_seg) + |
| 219 | sizeof(struct mlx5_wqe_raddr_seg); | 219 | sizeof(struct mlx5_wqe_raddr_seg) + |
| 220 | sizeof(struct mlx5_wqe_umr_ctrl_seg) + | ||
| 221 | sizeof(struct mlx5_mkey_seg); | ||
| 220 | break; | 222 | break; |
| 221 | 223 | ||
| 222 | case IB_QPT_UD: | 224 | case IB_QPT_UD: |
| @@ -428,11 +430,17 @@ static int alloc_uuar(struct mlx5_uuar_info *uuari, | |||
| 428 | break; | 430 | break; |
| 429 | 431 | ||
| 430 | case MLX5_IB_LATENCY_CLASS_MEDIUM: | 432 | case MLX5_IB_LATENCY_CLASS_MEDIUM: |
| 431 | uuarn = alloc_med_class_uuar(uuari); | 433 | if (uuari->ver < 2) |
| 434 | uuarn = -ENOMEM; | ||
| 435 | else | ||
| 436 | uuarn = alloc_med_class_uuar(uuari); | ||
| 432 | break; | 437 | break; |
| 433 | 438 | ||
| 434 | case MLX5_IB_LATENCY_CLASS_HIGH: | 439 | case MLX5_IB_LATENCY_CLASS_HIGH: |
| 435 | uuarn = alloc_high_class_uuar(uuari); | 440 | if (uuari->ver < 2) |
| 441 | uuarn = -ENOMEM; | ||
| 442 | else | ||
| 443 | uuarn = alloc_high_class_uuar(uuari); | ||
| 436 | break; | 444 | break; |
| 437 | 445 | ||
| 438 | case MLX5_IB_LATENCY_CLASS_FAST_PATH: | 446 | case MLX5_IB_LATENCY_CLASS_FAST_PATH: |
| @@ -657,8 +665,8 @@ static int create_kernel_qp(struct mlx5_ib_dev *dev, | |||
| 657 | int err; | 665 | int err; |
| 658 | 666 | ||
| 659 | uuari = &dev->mdev.priv.uuari; | 667 | uuari = &dev->mdev.priv.uuari; |
| 660 | if (init_attr->create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK) | 668 | if (init_attr->create_flags) |
| 661 | qp->flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK; | 669 | return -EINVAL; |
| 662 | 670 | ||
| 663 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) | 671 | if (init_attr->qp_type == MLX5_IB_QPT_REG_UMR) |
| 664 | lc = MLX5_IB_LATENCY_CLASS_FAST_PATH; | 672 | lc = MLX5_IB_LATENCY_CLASS_FAST_PATH; |
diff --git a/drivers/infiniband/hw/mlx5/user.h b/drivers/infiniband/hw/mlx5/user.h index 32a2a5dfc523..0f4f8e42a17f 100644 --- a/drivers/infiniband/hw/mlx5/user.h +++ b/drivers/infiniband/hw/mlx5/user.h | |||
| @@ -62,6 +62,13 @@ struct mlx5_ib_alloc_ucontext_req { | |||
| 62 | __u32 num_low_latency_uuars; | 62 | __u32 num_low_latency_uuars; |
| 63 | }; | 63 | }; |
| 64 | 64 | ||
| 65 | struct mlx5_ib_alloc_ucontext_req_v2 { | ||
| 66 | __u32 total_num_uuars; | ||
| 67 | __u32 num_low_latency_uuars; | ||
| 68 | __u32 flags; | ||
| 69 | __u32 reserved; | ||
| 70 | }; | ||
| 71 | |||
| 65 | struct mlx5_ib_alloc_ucontext_resp { | 72 | struct mlx5_ib_alloc_ucontext_resp { |
| 66 | __u32 qp_tab_size; | 73 | __u32 qp_tab_size; |
| 67 | __u32 bf_reg_size; | 74 | __u32 bf_reg_size; |
