Skip to content

Commit 3672ac8

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
Pull rdma updates from Jason Gunthorpe: "This is quite a small cycle, if not for Lee's 70 patches cleaning the kdocs it would be well below typical for patch count. Most of the interesting work here was in the HNS and rxe drivers which got fairly major internal changes. Summary: - Driver updates and bug fixes: siw, hns, bnxt_re, mlx5, efa - Significant rework in rxe to get it ready to have XRC support added - Several rts bug fixes - Big series to get to 'make W=1' cleanness, primarily updating kdocs - Support for creating a RDMA MR from a DMABUF fd to allow PCI peer to peer transfers to GPU VRAM - Device disassociation now works properly with umad - Work to support more than 255 ports on a RDMA device - Further support for the new HNS HIP09 hardware - Coding style cleanups: comma to semicolon, unneded semicolon/blank lines, remove 'h' printk format, don't check for NULL before kfree, use true/false for bool" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (205 commits) RDMA/rtrs-srv: Do not pass a valid pointer to PTR_ERR() RDMA/srp: Fix support for unpopulated and unbalanced NUMA nodes RDMA/mlx5: Fail QP creation if the device can not support the CQE TS RDMA/mlx5: Allow CQ creation without attached EQs RDMA/rtrs-srv-sysfs: fix missing put_device RDMA/rtrs-srv: fix memory leak by missing kobject free RDMA/rtrs: Only allow addition of path to an already established session RDMA/rtrs-srv: Fix stack-out-of-bounds RDMA/rxe: Remove unused pkt->offset RDMA/ucma: Fix use-after-free bug in ucma_create_uevent RDMA/core: Fix kernel doc warnings for ib_port_immutable_read() RDMA/qedr: Use true and false for bool variable RDMA/hns: Adjust definition of FRMR fields RDMA/hns: Refactor process of posting CMDQ RDMA/hns: Adjust fields and variables about CMDQ tail/head RDMA/hns: Remove redundant operations on CMDQ RDMA/hns: Fixes missing error code of CMDQ RDMA/hns: Remove unused member and variable of CMDQ RDMA/ipoib: Remove racy Subnet Manager sendonly join checks RDMA/mlx5: Support 400Gbps IB rate in mlx5 driver ...
2 parents bdb39c9 + 7289e26 commit 3672ac8

File tree

150 files changed

+3580
-2667
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3580
-2667
lines changed

drivers/infiniband/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config INFINIBAND_USER_MEM
4141
bool
4242
depends on INFINIBAND_USER_ACCESS != n
4343
depends on MMU
44+
select DMA_SHARED_BUFFER
4445
default y
4546

4647
config INFINIBAND_ON_DEMAND_PAGING

drivers/infiniband/core/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o \
4040
uverbs_std_types_srq.o \
4141
uverbs_std_types_wq.o \
4242
uverbs_std_types_qp.o
43-
ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o
43+
ib_uverbs-$(CONFIG_INFINIBAND_USER_MEM) += umem.o umem_dmabuf.o
4444
ib_uverbs-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o

drivers/infiniband/core/cache.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,10 @@ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
669669
* rdma_find_gid_by_port - Returns the GID entry attributes when it finds
670670
* a valid GID entry for given search parameters. It searches for the specified
671671
* GID value in the local software cache.
672-
* @device: The device to query.
672+
* @ib_dev: The device to query.
673673
* @gid: The GID value to search for.
674674
* @gid_type: The GID type to search for.
675-
* @port_num: The port number of the device where the GID value should be
676-
* searched.
675+
* @port: The port number of the device where the GID value should be searched.
677676
* @ndev: In RoCE, the net device of the device. NULL means ignore.
678677
*
679678
* Returns sgid attributes if the GID is found with valid reference or
@@ -719,7 +718,7 @@ EXPORT_SYMBOL(rdma_find_gid_by_port);
719718
/**
720719
* rdma_find_gid_by_filter - Returns the GID table attribute where a
721720
* specified GID value occurs
722-
* @device: The device to query.
721+
* @ib_dev: The device to query.
723722
* @gid: The GID value to search for.
724723
* @port: The port number of the device where the GID value could be
725724
* searched.
@@ -728,6 +727,7 @@ EXPORT_SYMBOL(rdma_find_gid_by_port);
728727
* otherwise, we continue searching the GID table. It's guaranteed that
729728
* while filter is executed, ndev field is valid and the structure won't
730729
* change. filter is executed in an atomic context. filter must not be NULL.
730+
* @context: Private data to pass into the call-back.
731731
*
732732
* rdma_find_gid_by_filter() searches for the specified GID value
733733
* of which the filter function returns true in the port's GID table.
@@ -1253,7 +1253,6 @@ EXPORT_SYMBOL(rdma_get_gid_attr);
12531253
* @entries: Entries where GID entries are returned.
12541254
* @max_entries: Maximum number of entries that can be returned.
12551255
* Entries array must be allocated to hold max_entries number of entries.
1256-
* @num_entries: Updated to the number of entries that were successfully read.
12571256
*
12581257
* Returns number of entries on success or appropriate error code.
12591258
*/

drivers/infiniband/core/cm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4333,7 +4333,7 @@ static int cm_add_one(struct ib_device *ib_device)
43334333
unsigned long flags;
43344334
int ret;
43354335
int count = 0;
4336-
u8 i;
4336+
unsigned int i;
43374337

43384338
cm_dev = kzalloc(struct_size(cm_dev, port, ib_device->phys_port_cnt),
43394339
GFP_KERNEL);
@@ -4345,7 +4345,7 @@ static int cm_add_one(struct ib_device *ib_device)
43454345
cm_dev->going_down = 0;
43464346

43474347
set_bit(IB_MGMT_METHOD_SEND, reg_req.method_mask);
4348-
for (i = 1; i <= ib_device->phys_port_cnt; i++) {
4348+
rdma_for_each_port (ib_device, i) {
43494349
if (!rdma_cap_ib_cm(ib_device, i))
43504350
continue;
43514351

@@ -4431,7 +4431,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data)
44314431
.clr_port_cap_mask = IB_PORT_CM_SUP
44324432
};
44334433
unsigned long flags;
4434-
int i;
4434+
unsigned int i;
44354435

44364436
write_lock_irqsave(&cm.device_lock, flags);
44374437
list_del(&cm_dev->list);
@@ -4441,7 +4441,7 @@ static void cm_remove_one(struct ib_device *ib_device, void *client_data)
44414441
cm_dev->going_down = 1;
44424442
spin_unlock_irq(&cm.lock);
44434443

4444-
for (i = 1; i <= ib_device->phys_port_cnt; i++) {
4444+
rdma_for_each_port (ib_device, i) {
44454445
if (!rdma_cap_ib_cm(ib_device, i))
44464446
continue;
44474447

drivers/infiniband/core/cma.c

Lines changed: 41 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,13 @@ struct ib_device *cma_get_ib_dev(struct cma_device *cma_dev)
352352

353353
struct cma_multicast {
354354
struct rdma_id_private *id_priv;
355-
struct ib_sa_multicast *sa_mc;
355+
union {
356+
struct ib_sa_multicast *sa_mc;
357+
struct {
358+
struct work_struct work;
359+
struct rdma_cm_event event;
360+
} iboe_join;
361+
};
356362
struct list_head list;
357363
void *context;
358364
struct sockaddr_storage addr;
@@ -1823,6 +1829,8 @@ static void destroy_mc(struct rdma_id_private *id_priv,
18231829
cma_igmp_send(ndev, &mgid, false);
18241830
dev_put(ndev);
18251831
}
1832+
1833+
cancel_work_sync(&mc->iboe_join.work);
18261834
}
18271835
kfree(mc);
18281836
}
@@ -2683,6 +2691,28 @@ static int cma_query_ib_route(struct rdma_id_private *id_priv,
26832691
return (id_priv->query_id < 0) ? id_priv->query_id : 0;
26842692
}
26852693

2694+
static void cma_iboe_join_work_handler(struct work_struct *work)
2695+
{
2696+
struct cma_multicast *mc =
2697+
container_of(work, struct cma_multicast, iboe_join.work);
2698+
struct rdma_cm_event *event = &mc->iboe_join.event;
2699+
struct rdma_id_private *id_priv = mc->id_priv;
2700+
int ret;
2701+
2702+
mutex_lock(&id_priv->handler_mutex);
2703+
if (READ_ONCE(id_priv->state) == RDMA_CM_DESTROYING ||
2704+
READ_ONCE(id_priv->state) == RDMA_CM_DEVICE_REMOVAL)
2705+
goto out_unlock;
2706+
2707+
ret = cma_cm_event_handler(id_priv, event);
2708+
WARN_ON(ret);
2709+
2710+
out_unlock:
2711+
mutex_unlock(&id_priv->handler_mutex);
2712+
if (event->event == RDMA_CM_EVENT_MULTICAST_JOIN)
2713+
rdma_destroy_ah_attr(&event->param.ud.ah_attr);
2714+
}
2715+
26862716
static void cma_work_handler(struct work_struct *_work)
26872717
{
26882718
struct cma_work *work = container_of(_work, struct cma_work, work);
@@ -4478,10 +4508,7 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast)
44784508
cma_make_mc_event(status, id_priv, multicast, &event, mc);
44794509
ret = cma_cm_event_handler(id_priv, &event);
44804510
rdma_destroy_ah_attr(&event.param.ud.ah_attr);
4481-
if (ret) {
4482-
destroy_id_handler_unlock(id_priv);
4483-
return 0;
4484-
}
4511+
WARN_ON(ret);
44854512

44864513
out:
44874514
mutex_unlock(&id_priv->handler_mutex);
@@ -4542,17 +4569,6 @@ static int cma_join_ib_multicast(struct rdma_id_private *id_priv,
45424569
rec.pkey = cpu_to_be16(ib_addr_get_pkey(dev_addr));
45434570
rec.join_state = mc->join_state;
45444571

4545-
if ((rec.join_state == BIT(SENDONLY_FULLMEMBER_JOIN)) &&
4546-
(!ib_sa_sendonly_fullmem_support(&sa_client,
4547-
id_priv->id.device,
4548-
id_priv->id.port_num))) {
4549-
dev_warn(
4550-
&id_priv->id.device->dev,
4551-
"RDMA CM: port %u Unable to multicast join: SM doesn't support Send Only Full Member option\n",
4552-
id_priv->id.port_num);
4553-
return -EOPNOTSUPP;
4554-
}
4555-
45564572
comp_mask = IB_SA_MCMEMBER_REC_MGID | IB_SA_MCMEMBER_REC_PORT_GID |
45574573
IB_SA_MCMEMBER_REC_PKEY | IB_SA_MCMEMBER_REC_JOIN_STATE |
45584574
IB_SA_MCMEMBER_REC_QKEY | IB_SA_MCMEMBER_REC_SL |
@@ -4604,7 +4620,6 @@ static void cma_iboe_set_mgid(struct sockaddr *addr, union ib_gid *mgid,
46044620
static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
46054621
struct cma_multicast *mc)
46064622
{
4607-
struct cma_work *work;
46084623
struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr;
46094624
int err = 0;
46104625
struct sockaddr *addr = (struct sockaddr *)&mc->addr;
@@ -4618,10 +4633,6 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
46184633
if (cma_zero_addr(addr))
46194634
return -EINVAL;
46204635

4621-
work = kzalloc(sizeof *work, GFP_KERNEL);
4622-
if (!work)
4623-
return -ENOMEM;
4624-
46254636
gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num -
46264637
rdma_start_port(id_priv->cma_dev->device)];
46274638
cma_iboe_set_mgid(addr, &ib.rec.mgid, gid_type);
@@ -4632,10 +4643,9 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
46324643

46334644
if (dev_addr->bound_dev_if)
46344645
ndev = dev_get_by_index(dev_addr->net, dev_addr->bound_dev_if);
4635-
if (!ndev) {
4636-
err = -ENODEV;
4637-
goto err_free;
4638-
}
4646+
if (!ndev)
4647+
return -ENODEV;
4648+
46394649
ib.rec.rate = iboe_get_rate(ndev);
46404650
ib.rec.hop_limit = 1;
46414651
ib.rec.mtu = iboe_get_mtu(ndev->mtu);
@@ -4653,24 +4663,15 @@ static int cma_iboe_join_multicast(struct rdma_id_private *id_priv,
46534663
err = -ENOTSUPP;
46544664
}
46554665
dev_put(ndev);
4656-
if (err || !ib.rec.mtu) {
4657-
if (!err)
4658-
err = -EINVAL;
4659-
goto err_free;
4660-
}
4666+
if (err || !ib.rec.mtu)
4667+
return err ?: -EINVAL;
4668+
46614669
rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.src_addr,
46624670
&ib.rec.port_gid);
4663-
work->id = id_priv;
4664-
INIT_WORK(&work->work, cma_work_handler);
4665-
cma_make_mc_event(0, id_priv, &ib, &work->event, mc);
4666-
/* Balances with cma_id_put() in cma_work_handler */
4667-
cma_id_get(id_priv);
4668-
queue_work(cma_wq, &work->work);
4671+
INIT_WORK(&mc->iboe_join.work, cma_iboe_join_work_handler);
4672+
cma_make_mc_event(0, id_priv, &ib, &mc->iboe_join.event, mc);
4673+
queue_work(cma_wq, &mc->iboe_join.work);
46694674
return 0;
4670-
4671-
err_free:
4672-
kfree(work);
4673-
return err;
46744675
}
46754676

46764677
int rdma_join_multicast(struct rdma_cm_id *id, struct sockaddr *addr,

drivers/infiniband/core/cma_configfs.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
204204
unsigned int i;
205205
unsigned int ports_num;
206206
struct cma_dev_port_group *ports;
207-
int err;
208207

209208
ibdev = cma_get_ib_dev(cma_dev);
210209

@@ -215,10 +214,8 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
215214
ports = kcalloc(ports_num, sizeof(*cma_dev_group->ports),
216215
GFP_KERNEL);
217216

218-
if (!ports) {
219-
err = -ENOMEM;
220-
goto free;
221-
}
217+
if (!ports)
218+
return -ENOMEM;
222219

223220
for (i = 0; i < ports_num; i++) {
224221
char port_str[10];
@@ -234,12 +231,7 @@ static int make_cma_ports(struct cma_dev_group *cma_dev_group,
234231

235232
}
236233
cma_dev_group->ports = ports;
237-
238234
return 0;
239-
free:
240-
kfree(ports);
241-
cma_dev_group->ports = NULL;
242-
return err;
243235
}
244236

245237
static void release_cma_dev(struct config_item *item)

0 commit comments

Comments
 (0)