Skip to content

Commit bef85bd

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma fixes from Doug Ledford: "First set of -rc fixes for 4.13 cycle: - misc iSER fixes - namespace fixups - fix the fact that IPoIB didn't use the proper API for noio mem allocs - rxe driver fixes - hns_roce fixes - misc core fixes - misc IPoIB fixes" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (27 commits) IB/core: Allow QP state transition from reset to error IB/hns: Fix for checkpatch.pl comment style warnings IB/hns: Fix the bug with modifying the MAC address without removing the driver IB/hns: Fix the bug with rdma operation IB/hns: Fix the bug with wild pointer when destroy rc qp IB/hns: Fix the bug of polling cq failed for loopback Qps IB/rxe: Set dma_mask and coherent_dma_mask IB/rxe: Fix kernel panic from skb destructor IB/ipoib: Let lower driver handle get_stats64 call IB/core: Add ordered workqueue for RoCE GID management IB/mlx5: Clean mr_cache debugfs in case of failure IB/core: Remove NOIO QP create flag {net, IB}/mlx4: Remove gfp flags argument IB/{rdmavt, qib, hfi1}: Remove gfp flags argument IB/IPoIB: Convert IPoIB to memalloc_noio_* calls IB/IPoIB: Forward MTU change to driver below IB: Convert msleep below 20ms to usleep_range IB/uverbs: Make use of ib_modify_qp variant to avoid resolving DMAC IB/core: Introduce modify QP operation with udata IB/core: Don't resolve IP address to the loopback device ...
2 parents 15b0a8d + ebc9ca4 commit bef85bd

Some content is hidden

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

43 files changed

+366
-290
lines changed

MAINTAINERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10868,6 +10868,14 @@ L: [email protected]
1086810868
S: Supported
1086910869
F: drivers/scsi/qedf/
1087010870

10871+
QLOGIC QL4xxx RDMA DRIVER
10872+
M: Ram Amrani <[email protected]>
10873+
M: Ariel Elior <[email protected]>
10874+
10875+
S: Supported
10876+
F: drivers/infiniband/hw/qedr/
10877+
F: include/uapi/rdma/qedr-abi.h
10878+
1087110879
QNX4 FILESYSTEM
1087210880
M: Anders Larsen <[email protected]>
1087310881
W: http://www.alarsen.net/linux/qnx4fs/

drivers/infiniband/core/addr.c

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
268268
return ret;
269269

270270
ret = rdma_copy_addr(dev_addr, dev, NULL);
271+
dev_addr->bound_dev_if = dev->ifindex;
271272
if (vlan_id)
272273
*vlan_id = rdma_vlan_dev_vlan_id(dev);
273274
dev_put(dev);
@@ -280,6 +281,7 @@ int rdma_translate_ip(const struct sockaddr *addr,
280281
&((const struct sockaddr_in6 *)addr)->sin6_addr,
281282
dev, 1)) {
282283
ret = rdma_copy_addr(dev_addr, dev, NULL);
284+
dev_addr->bound_dev_if = dev->ifindex;
283285
if (vlan_id)
284286
*vlan_id = rdma_vlan_dev_vlan_id(dev);
285287
break;
@@ -405,10 +407,10 @@ static int addr4_resolve(struct sockaddr_in *src_in,
405407
fl4.saddr = src_ip;
406408
fl4.flowi4_oif = addr->bound_dev_if;
407409
rt = ip_route_output_key(addr->net, &fl4);
408-
if (IS_ERR(rt)) {
409-
ret = PTR_ERR(rt);
410-
goto out;
411-
}
410+
ret = PTR_ERR_OR_ZERO(rt);
411+
if (ret)
412+
return ret;
413+
412414
src_in->sin_family = AF_INET;
413415
src_in->sin_addr.s_addr = fl4.saddr;
414416

@@ -423,8 +425,6 @@ static int addr4_resolve(struct sockaddr_in *src_in,
423425

424426
*prt = rt;
425427
return 0;
426-
out:
427-
return ret;
428428
}
429429

430430
#if IS_ENABLED(CONFIG_IPV6)
@@ -509,6 +509,11 @@ static int addr_resolve(struct sockaddr *src_in,
509509
struct dst_entry *dst;
510510
int ret;
511511

512+
if (!addr->net) {
513+
pr_warn_ratelimited("%s: missing namespace\n", __func__);
514+
return -EINVAL;
515+
}
516+
512517
if (src_in->sa_family == AF_INET) {
513518
struct rtable *rt = NULL;
514519
const struct sockaddr_in *dst_in4 =
@@ -522,8 +527,12 @@ static int addr_resolve(struct sockaddr *src_in,
522527
if (resolve_neigh)
523528
ret = addr_resolve_neigh(&rt->dst, dst_in, addr, seq);
524529

525-
ndev = rt->dst.dev;
526-
dev_hold(ndev);
530+
if (addr->bound_dev_if) {
531+
ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
532+
} else {
533+
ndev = rt->dst.dev;
534+
dev_hold(ndev);
535+
}
527536

528537
ip_rt_put(rt);
529538
} else {
@@ -539,14 +548,27 @@ static int addr_resolve(struct sockaddr *src_in,
539548
if (resolve_neigh)
540549
ret = addr_resolve_neigh(dst, dst_in, addr, seq);
541550

542-
ndev = dst->dev;
543-
dev_hold(ndev);
551+
if (addr->bound_dev_if) {
552+
ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
553+
} else {
554+
ndev = dst->dev;
555+
dev_hold(ndev);
556+
}
544557

545558
dst_release(dst);
546559
}
547560

548-
addr->bound_dev_if = ndev->ifindex;
549-
addr->net = dev_net(ndev);
561+
if (ndev->flags & IFF_LOOPBACK) {
562+
ret = rdma_translate_ip(dst_in, addr, NULL);
563+
/*
564+
* Put the loopback device and get the translated
565+
* device instead.
566+
*/
567+
dev_put(ndev);
568+
ndev = dev_get_by_index(addr->net, addr->bound_dev_if);
569+
} else {
570+
addr->bound_dev_if = ndev->ifindex;
571+
}
550572
dev_put(ndev);
551573

552574
return ret;

drivers/infiniband/core/cma.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -623,22 +623,11 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,
623623
if ((dev_type != ARPHRD_INFINIBAND) && rdma_protocol_ib(device, port))
624624
return ret;
625625

626-
if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) {
626+
if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port))
627627
ndev = dev_get_by_index(&init_net, bound_if_index);
628-
if (ndev && ndev->flags & IFF_LOOPBACK) {
629-
pr_info("detected loopback device\n");
630-
dev_put(ndev);
631-
632-
if (!device->get_netdev)
633-
return -EOPNOTSUPP;
634-
635-
ndev = device->get_netdev(device, port);
636-
if (!ndev)
637-
return -ENODEV;
638-
}
639-
} else {
628+
else
640629
gid_type = IB_GID_TYPE_IB;
641-
}
630+
642631

643632
ret = ib_find_cached_gid_by_port(device, gid, gid_type, port,
644633
ndev, NULL);
@@ -2569,21 +2558,6 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
25692558
goto err2;
25702559
}
25712560

2572-
if (ndev->flags & IFF_LOOPBACK) {
2573-
dev_put(ndev);
2574-
if (!id_priv->id.device->get_netdev) {
2575-
ret = -EOPNOTSUPP;
2576-
goto err2;
2577-
}
2578-
2579-
ndev = id_priv->id.device->get_netdev(id_priv->id.device,
2580-
id_priv->id.port_num);
2581-
if (!ndev) {
2582-
ret = -ENODEV;
2583-
goto err2;
2584-
}
2585-
}
2586-
25872561
supported_gids = roce_gid_type_mask_support(id_priv->id.device,
25882562
id_priv->id.port_num);
25892563
gid_type = cma_route_gid_type(addr->dev_addr.network,

drivers/infiniband/core/roce_gid_mgmt.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#include <rdma/ib_cache.h>
4343
#include <rdma/ib_addr.h>
4444

45+
static struct workqueue_struct *gid_cache_wq;
46+
4547
enum gid_op_type {
4648
GID_DEL = 0,
4749
GID_ADD
@@ -560,7 +562,7 @@ static int netdevice_queue_work(struct netdev_event_work_cmd *cmds,
560562
}
561563
INIT_WORK(&ndev_work->work, netdevice_event_work_handler);
562564

563-
queue_work(ib_wq, &ndev_work->work);
565+
queue_work(gid_cache_wq, &ndev_work->work);
564566

565567
return NOTIFY_DONE;
566568
}
@@ -693,7 +695,7 @@ static int addr_event(struct notifier_block *this, unsigned long event,
693695
dev_hold(ndev);
694696
work->gid_attr.ndev = ndev;
695697

696-
queue_work(ib_wq, &work->work);
698+
queue_work(gid_cache_wq, &work->work);
697699

698700
return NOTIFY_DONE;
699701
}
@@ -740,6 +742,10 @@ static struct notifier_block nb_inet6addr = {
740742

741743
int __init roce_gid_mgmt_init(void)
742744
{
745+
gid_cache_wq = alloc_ordered_workqueue("gid-cache-wq", 0);
746+
if (!gid_cache_wq)
747+
return -ENOMEM;
748+
743749
register_inetaddr_notifier(&nb_inetaddr);
744750
if (IS_ENABLED(CONFIG_IPV6))
745751
register_inet6addr_notifier(&nb_inet6addr);
@@ -764,4 +770,5 @@ void __exit roce_gid_mgmt_cleanup(void)
764770
* ib-core is removed, all physical devices have been removed,
765771
* so no issue with remaining hardware contexts.
766772
*/
773+
destroy_workqueue(gid_cache_wq);
767774
}

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,28 +2005,13 @@ static int modify_qp(struct ib_uverbs_file *file,
20052005
rdma_ah_set_port_num(&attr->alt_ah_attr,
20062006
cmd->base.alt_dest.port_num);
20072007

2008-
if (qp->real_qp == qp) {
2009-
if (cmd->base.attr_mask & IB_QP_AV) {
2010-
ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
2011-
if (ret)
2012-
goto release_qp;
2013-
}
2014-
ret = ib_security_modify_qp(qp,
2015-
attr,
2016-
modify_qp_mask(qp->qp_type,
2017-
cmd->base.attr_mask),
2018-
udata);
2019-
} else {
2020-
ret = ib_security_modify_qp(qp,
2021-
attr,
2022-
modify_qp_mask(qp->qp_type,
2023-
cmd->base.attr_mask),
2024-
NULL);
2025-
}
2008+
ret = ib_modify_qp_with_udata(qp, attr,
2009+
modify_qp_mask(qp->qp_type,
2010+
cmd->base.attr_mask),
2011+
udata);
20262012

20272013
release_qp:
20282014
uobj_put_obj_read(qp);
2029-
20302015
out:
20312016
kfree(attr);
20322017

drivers/infiniband/core/verbs.c

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,19 @@ int ib_get_gids_from_rdma_hdr(const union rdma_network_hdr *hdr,
452452
}
453453
EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr);
454454

455+
/*
456+
* This function creates ah from the incoming packet.
457+
* Incoming packet has dgid of the receiver node on which this code is
458+
* getting executed and, sgid contains the GID of the sender.
459+
*
460+
* When resolving mac address of destination, the arrived dgid is used
461+
* as sgid and, sgid is used as dgid because sgid contains destinations
462+
* GID whom to respond to.
463+
*
464+
* This is why when calling rdma_addr_find_l2_eth_by_grh() function, the
465+
* position of arguments dgid and sgid do not match the order of the
466+
* parameters.
467+
*/
455468
int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
456469
const struct ib_wc *wc, const struct ib_grh *grh,
457470
struct rdma_ah_attr *ah_attr)
@@ -507,11 +520,6 @@ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
507520
}
508521

509522
resolved_dev = dev_get_by_index(&init_net, if_index);
510-
if (resolved_dev->flags & IFF_LOOPBACK) {
511-
dev_put(resolved_dev);
512-
resolved_dev = idev;
513-
dev_hold(resolved_dev);
514-
}
515523
rcu_read_lock();
516524
if (resolved_dev != idev && !rdma_is_upper_dev_rcu(idev,
517525
resolved_dev))
@@ -887,6 +895,7 @@ static const struct {
887895
} qp_state_table[IB_QPS_ERR + 1][IB_QPS_ERR + 1] = {
888896
[IB_QPS_RESET] = {
889897
[IB_QPS_RESET] = { .valid = 1 },
898+
[IB_QPS_ERR] = { .valid = 1 },
890899
[IB_QPS_INIT] = {
891900
.valid = 1,
892901
.req_param = {
@@ -1268,20 +1277,36 @@ int ib_resolve_eth_dmac(struct ib_device *device,
12681277
}
12691278
EXPORT_SYMBOL(ib_resolve_eth_dmac);
12701279

1271-
int ib_modify_qp(struct ib_qp *qp,
1272-
struct ib_qp_attr *qp_attr,
1273-
int qp_attr_mask)
1280+
/**
1281+
* ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
1282+
* @qp: The QP to modify.
1283+
* @attr: On input, specifies the QP attributes to modify. On output,
1284+
* the current values of selected QP attributes are returned.
1285+
* @attr_mask: A bit-mask used to specify which attributes of the QP
1286+
* are being modified.
1287+
* @udata: pointer to user's input output buffer information
1288+
* are being modified.
1289+
* It returns 0 on success and returns appropriate error code on error.
1290+
*/
1291+
int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
1292+
int attr_mask, struct ib_udata *udata)
12741293
{
1294+
int ret;
12751295

1276-
if (qp_attr_mask & IB_QP_AV) {
1277-
int ret;
1278-
1279-
ret = ib_resolve_eth_dmac(qp->device, &qp_attr->ah_attr);
1296+
if (attr_mask & IB_QP_AV) {
1297+
ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
12801298
if (ret)
12811299
return ret;
12821300
}
1301+
return ib_security_modify_qp(qp, attr, attr_mask, udata);
1302+
}
1303+
EXPORT_SYMBOL(ib_modify_qp_with_udata);
12831304

1284-
return ib_security_modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL);
1305+
int ib_modify_qp(struct ib_qp *qp,
1306+
struct ib_qp_attr *qp_attr,
1307+
int qp_attr_mask)
1308+
{
1309+
return ib_modify_qp_with_udata(qp, qp_attr, qp_attr_mask, NULL);
12851310
}
12861311
EXPORT_SYMBOL(ib_modify_qp);
12871312

drivers/infiniband/hw/hfi1/chip.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12847,7 +12847,12 @@ static void remap_intr(struct hfi1_devdata *dd, int isrc, int msix_intr)
1284712847
/* clear from the handled mask of the general interrupt */
1284812848
m = isrc / 64;
1284912849
n = isrc % 64;
12850-
dd->gi_mask[m] &= ~((u64)1 << n);
12850+
if (likely(m < CCE_NUM_INT_CSRS)) {
12851+
dd->gi_mask[m] &= ~((u64)1 << n);
12852+
} else {
12853+
dd_dev_err(dd, "remap interrupt err\n");
12854+
return;
12855+
}
1285112856

1285212857
/* direct the chip source to the given MSI-X interrupt */
1285312858
m = isrc / 8;

drivers/infiniband/hw/hfi1/qp.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,18 +647,17 @@ void qp_iter_print(struct seq_file *s, struct qp_iter *iter)
647647
qp->pid);
648648
}
649649

650-
void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp,
651-
gfp_t gfp)
650+
void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp)
652651
{
653652
struct hfi1_qp_priv *priv;
654653

655-
priv = kzalloc_node(sizeof(*priv), gfp, rdi->dparms.node);
654+
priv = kzalloc_node(sizeof(*priv), GFP_KERNEL, rdi->dparms.node);
656655
if (!priv)
657656
return ERR_PTR(-ENOMEM);
658657

659658
priv->owner = qp;
660659

661-
priv->s_ahg = kzalloc_node(sizeof(*priv->s_ahg), gfp,
660+
priv->s_ahg = kzalloc_node(sizeof(*priv->s_ahg), GFP_KERNEL,
662661
rdi->dparms.node);
663662
if (!priv->s_ahg) {
664663
kfree(priv);

drivers/infiniband/hw/hfi1/qp.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,7 @@ void hfi1_migrate_qp(struct rvt_qp *qp);
123123
/*
124124
* Functions provided by hfi1 driver for rdmavt to use
125125
*/
126-
void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp,
127-
gfp_t gfp);
126+
void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp);
128127
void qp_priv_free(struct rvt_dev_info *rdi, struct rvt_qp *qp);
129128
unsigned free_all_qps(struct rvt_dev_info *rdi);
130129
void notify_qp_reset(struct rvt_qp *qp);

0 commit comments

Comments
 (0)