Skip to content

Commit b9ac092

Browse files
Knut OmangMukesh Kacker
authored andcommitted
ib: Add udata argument to create_ah
Most of the ib device driver entry points supports optional device specific parameter transfer between user space and kernel space via the udata argument - add a similar argument for ib_create_ah. Update all infiniband drivers to include this agument in their driver entry point implementation. Orabug: 20930262 Signed-off-by: Knut Omang <[email protected]> Signed-off-by: Mukesh Kacker <[email protected]>
1 parent 352e3b0 commit b9ac092

File tree

18 files changed

+42
-18
lines changed

18 files changed

+42
-18
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2533,6 +2533,7 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
25332533
struct ib_pd *pd;
25342534
struct ib_ah *ah;
25352535
struct ib_ah_attr attr;
2536+
struct ib_udata udata;
25362537
int ret;
25372538

25382539
if (out_len < sizeof resp)
@@ -2541,6 +2542,10 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
25412542
if (copy_from_user(&cmd, buf, sizeof cmd))
25422543
return -EFAULT;
25432544

2545+
INIT_UDATA(&udata, buf + sizeof cmd,
2546+
(unsigned long) cmd.response + sizeof resp,
2547+
in_len - sizeof cmd, out_len - sizeof resp);
2548+
25442549
uobj = kmalloc(sizeof *uobj, GFP_KERNEL);
25452550
if (!uobj)
25462551
return -ENOMEM;
@@ -2568,14 +2573,17 @@ ssize_t ib_uverbs_create_ah(struct ib_uverbs_file *file,
25682573
memset(&attr.dmac, 0, sizeof(attr.dmac));
25692574
memcpy(attr.grh.dgid.raw, cmd.attr.grh.dgid, 16);
25702575

2571-
ah = ib_create_ah(pd, &attr);
2576+
ah = pd->device->create_ah(pd, &attr, &udata);
25722577
if (IS_ERR(ah)) {
25732578
ret = PTR_ERR(ah);
25742579
goto err_put;
25752580
}
25762581

2582+
ah->device = pd->device;
2583+
ah->pd = pd;
25772584
ah->uobject = uobj;
25782585
uobj->object = ah;
2586+
atomic_inc(&pd->usecnt);
25792587

25802588
ret = idr_add_uobj(&ib_uverbs_ah_idr, uobj);
25812589
if (ret)

drivers/infiniband/core/verbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ struct ib_ah *ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
179179
{
180180
struct ib_ah *ah;
181181

182-
ah = pd->device->create_ah(pd, ah_attr);
182+
ah = pd->device->create_ah(pd, ah_attr, NULL);
183183

184184
if (!IS_ERR(ah)) {
185185
ah->device = pd->device;

drivers/infiniband/hw/amso1100/c2_provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ static int c2_dealloc_pd(struct ib_pd *pd)
187187
return 0;
188188
}
189189

190-
static struct ib_ah *c2_ah_create(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
190+
static struct ib_ah *c2_ah_create(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
191+
struct ib_udata *udata)
191192
{
192193
pr_debug("%s:%u\n", __func__, __LINE__);
193194
return ERR_PTR(-ENOSYS);

drivers/infiniband/hw/cxgb3/iwch_provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
#include "common.h"
6363

6464
static struct ib_ah *iwch_ah_create(struct ib_pd *pd,
65-
struct ib_ah_attr *ah_attr)
65+
struct ib_ah_attr *ah_attr,
66+
struct ib_udata *udata)
6667
{
6768
return ERR_PTR(-ENOSYS);
6869
}

drivers/infiniband/hw/cxgb4/provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ module_param(fastreg_support, int, 0644);
5959
MODULE_PARM_DESC(fastreg_support, "Advertise fastreg support (default=1)");
6060

6161
static struct ib_ah *c4iw_ah_create(struct ib_pd *pd,
62-
struct ib_ah_attr *ah_attr)
62+
struct ib_ah_attr *ah_attr,
63+
struct ib_udata *udata)
6364
{
6465
return ERR_PTR(-ENOSYS);
6566
}

drivers/infiniband/hw/ipath/ipath_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1760,7 +1760,8 @@ static int ipath_dealloc_pd(struct ib_pd *ibpd)
17601760
* This may be called from interrupt context.
17611761
*/
17621762
static struct ib_ah *ipath_create_ah(struct ib_pd *pd,
1763-
struct ib_ah_attr *ah_attr)
1763+
struct ib_ah_attr *ah_attr,
1764+
struct ib_udata *udata)
17641765
{
17651766
struct ipath_ah *ah;
17661767
struct ib_ah *ret;

drivers/infiniband/hw/mlx4/ah.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
110110
return &ah->ibah;
111111
}
112112

113-
struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
113+
struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
114+
struct ib_udata *udata)
114115
{
115116
struct mlx4_ib_ah *ah;
116117
struct ib_ah *ret;

drivers/infiniband/hw/mlx4/mlx4_ib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,8 @@ int mlx4_ib_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
683683
void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq);
684684
void mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq);
685685

686-
struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
686+
struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
687+
struct ib_udata *udata);
687688
int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr);
688689
int mlx4_ib_destroy_ah(struct ib_ah *ah);
689690

drivers/infiniband/hw/mlx5/ah.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ struct ib_ah *create_ib_ah(struct ib_ah_attr *ah_attr,
5151
return &ah->ibah;
5252
}
5353

54-
struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
54+
struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
55+
struct ib_udata *udata)
5556
{
5657
struct mlx5_ib_ah *ah;
5758

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,8 @@ int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey,
529529
void *in_mad, void *response_mad);
530530
struct ib_ah *create_ib_ah(struct ib_ah_attr *ah_attr,
531531
struct mlx5_ib_ah *ah);
532-
struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
532+
struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
533+
struct ib_udata *udata);
533534
int mlx5_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr);
534535
int mlx5_ib_destroy_ah(struct ib_ah *ah);
535536
struct ib_srq *mlx5_ib_create_srq(struct ib_pd *pd,

drivers/infiniband/hw/mthca/mthca_provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ static int mthca_dealloc_pd(struct ib_pd *pd)
405405
}
406406

407407
static struct ib_ah *mthca_ah_create(struct ib_pd *pd,
408-
struct ib_ah_attr *ah_attr)
408+
struct ib_ah_attr *ah_attr,
409+
struct ib_udata *udata)
409410
{
410411
int err;
411412
struct mthca_ah *ah;

drivers/infiniband/hw/nes/nes_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,8 @@ static int nes_dealloc_pd(struct ib_pd *ibpd)
865865
/**
866866
* nes_create_ah
867867
*/
868-
static struct ib_ah *nes_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr)
868+
static struct ib_ah *nes_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
869+
struct ib_udata *udata)
869870
{
870871
return ERR_PTR(-ENOSYS);
871872
}

drivers/infiniband/hw/ocrdma/ocrdma_ah.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct ocrdma_ah *ah,
9797
return status;
9898
}
9999

100-
struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr)
100+
struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct ib_ah_attr *attr,
101+
struct ib_udata *udata)
101102
{
102103
u32 *ahid_addr;
103104
bool isvlan = false;

drivers/infiniband/hw/ocrdma/ocrdma_ah.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ enum {
3434
OCRDMA_AH_VLAN_VALID_SHIFT = 0x1F
3535
};
3636

37-
struct ib_ah *ocrdma_create_ah(struct ib_pd *, struct ib_ah_attr *);
37+
struct ib_ah *ocrdma_create_ah(struct ib_pd *, struct ib_ah_attr *,
38+
struct ib_udata *);
3839
int ocrdma_destroy_ah(struct ib_ah *);
3940
int ocrdma_query_ah(struct ib_ah *, struct ib_ah_attr *);
4041
int ocrdma_modify_ah(struct ib_ah *, struct ib_ah_attr *);

drivers/infiniband/hw/qib/qib_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1818,7 +1818,8 @@ int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)
18181818
* This may be called from interrupt context.
18191819
*/
18201820
static struct ib_ah *qib_create_ah(struct ib_pd *pd,
1821-
struct ib_ah_attr *ah_attr)
1821+
struct ib_ah_attr *ah_attr,
1822+
struct ib_udata *udata)
18221823
{
18231824
struct qib_ah *ah;
18241825
struct ib_ah *ret;

drivers/infiniband/hw/usnic/usnic_ib_verbs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,8 @@ int usnic_ib_mmap(struct ib_ucontext *context,
717717

718718
/* In ib callbacks section - Start of stub funcs */
719719
struct ib_ah *usnic_ib_create_ah(struct ib_pd *pd,
720-
struct ib_ah_attr *ah_attr)
720+
struct ib_ah_attr *ah_attr,
721+
struct ib_udata *udata)
721722
{
722723
usnic_dbg("\n");
723724
return ERR_PTR(-EPERM);

drivers/infiniband/hw/usnic/usnic_ib_verbs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ int usnic_ib_dealloc_ucontext(struct ib_ucontext *ibcontext);
5858
int usnic_ib_mmap(struct ib_ucontext *context,
5959
struct vm_area_struct *vma);
6060
struct ib_ah *usnic_ib_create_ah(struct ib_pd *pd,
61-
struct ib_ah_attr *ah_attr);
61+
struct ib_ah_attr *ah_attr,
62+
struct ib_udata *udata);
6263
int usnic_ib_destroy_ah(struct ib_ah *ah);
6364
int usnic_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
6465
struct ib_send_wr **bad_wr);

include/rdma/ib_verbs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,8 @@ struct ib_device {
15291529
struct ib_udata *udata);
15301530
int (*dealloc_pd)(struct ib_pd *pd);
15311531
struct ib_ah * (*create_ah)(struct ib_pd *pd,
1532-
struct ib_ah_attr *ah_attr);
1532+
struct ib_ah_attr *ah_attr,
1533+
struct ib_udata *udata);
15331534
int (*modify_ah)(struct ib_ah *ah,
15341535
struct ib_ah_attr *ah_attr);
15351536
int (*query_ah)(struct ib_ah *ah,

0 commit comments

Comments
 (0)