diff options
Diffstat (limited to 'drivers/infiniband/hw/mlx5/main.c')
| -rw-r--r-- | drivers/infiniband/hw/mlx5/main.c | 26 |
1 files changed, 20 insertions, 6 deletions
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; |
