Skip to content

Commit ab425fe

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: "Usual size of updates, a new driver, and most of the bulk focusing on rxe: - Usual typos, style, and language updates - Driver updates for mlx5, irdma, siw, rts, srp, hfi1, hns, erdma, mlx4, srp - Lots of RXE updates: * Improve reply error handling for bad MR operations * Code tidying * Debug printing uses common loggers * Remove half implemented RD related stuff * Support IBA's recently defined Atomic Write and Flush operations - erdma support for atomic operations - New driver 'mana' for Ethernet HW available in Azure VMs. This driver only supports DPDK" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma: (122 commits) IB/IPoIB: Fix queue count inconsistency for PKEY child interfaces RDMA: Add missed netdev_put() for the netdevice_tracker RDMA/rxe: Enable RDMA FLUSH capability for rxe device RDMA/cm: Make QP FLUSHABLE for supported device RDMA/rxe: Implement flush completion RDMA/rxe: Implement flush execution in responder side RDMA/rxe: Implement RC RDMA FLUSH service in requester side RDMA/rxe: Extend rxe packet format to support flush RDMA/rxe: Allow registering persistent flag for pmem MR only RDMA/rxe: Extend rxe user ABI to support flush RDMA: Extend RDMA kernel verbs ABI to support flush RDMA: Extend RDMA user ABI to support flush RDMA/rxe: Fix incorrect responder length checking RDMA/rxe: Fix oops with zero length reads RDMA/mlx5: Remove not-used IB_FLOW_SPEC_IB define RDMA/hns: Fix XRC caps on HIP08 RDMA/hns: Fix error code of CMD RDMA/hns: Fix page size cap from firmware RDMA/hns: Fix PBL page MTR find RDMA/hns: Fix AH attr queried by query_qp ...
2 parents 08cdc21 + dbc94a0 commit ab425fe

Some content is hidden

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

99 files changed

+3621
-897
lines changed

MAINTAINERS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13806,6 +13806,15 @@ F: drivers/scsi/smartpqi/smartpqi*.[ch]
1380613806
F: include/linux/cciss*.h
1380713807
F: include/uapi/linux/cciss*.h
1380813808

13809+
MICROSOFT MANA RDMA DRIVER
13810+
M: Long Li <[email protected]>
13811+
M: Ajay Sharma <[email protected]>
13812+
13813+
S: Supported
13814+
F: drivers/infiniband/hw/mana/
13815+
F: include/net/mana
13816+
F: include/uapi/rdma/mana-abi.h
13817+
1380913818
MICROSOFT SURFACE AGGREGATOR TABLET-MODE SWITCH
1381013819
M: Maximilian Luz <[email protected]>
1381113820

drivers/infiniband/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,15 @@ config INFINIBAND_VIRT_DMA
7878
def_bool !HIGHMEM
7979

8080
if INFINIBAND_USER_ACCESS || !INFINIBAND_USER_ACCESS
81+
if !UML
8182
source "drivers/infiniband/hw/bnxt_re/Kconfig"
8283
source "drivers/infiniband/hw/cxgb4/Kconfig"
8384
source "drivers/infiniband/hw/efa/Kconfig"
8485
source "drivers/infiniband/hw/erdma/Kconfig"
8586
source "drivers/infiniband/hw/hfi1/Kconfig"
8687
source "drivers/infiniband/hw/hns/Kconfig"
8788
source "drivers/infiniband/hw/irdma/Kconfig"
89+
source "drivers/infiniband/hw/mana/Kconfig"
8890
source "drivers/infiniband/hw/mlx4/Kconfig"
8991
source "drivers/infiniband/hw/mlx5/Kconfig"
9092
source "drivers/infiniband/hw/mthca/Kconfig"
@@ -94,6 +96,7 @@ source "drivers/infiniband/hw/qib/Kconfig"
9496
source "drivers/infiniband/hw/usnic/Kconfig"
9597
source "drivers/infiniband/hw/vmw_pvrdma/Kconfig"
9698
source "drivers/infiniband/sw/rdmavt/Kconfig"
99+
endif # !UML
97100
source "drivers/infiniband/sw/rxe/Kconfig"
98101
source "drivers/infiniband/sw/siw/Kconfig"
99102
endif

drivers/infiniband/core/cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,7 @@ int rdma_read_gid_l2_fields(const struct ib_gid_attr *attr,
14221422
*vlan_id = vlan_dev_vlan_id(ndev);
14231423
} else {
14241424
/* If the netdev is upper device and if it's lower
1425-
* device is vlan device, consider vlan id of the
1425+
* device is vlan device, consider vlan id of
14261426
* the lower vlan device for this gid entry.
14271427
*/
14281428
netdev_walk_all_lower_dev_rcu(attr->ndev,

drivers/infiniband/core/cm.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
40944094
*qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS |
40954095
IB_QP_PKEY_INDEX | IB_QP_PORT;
40964096
qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE;
4097-
if (cm_id_priv->responder_resources)
4097+
if (cm_id_priv->responder_resources) {
4098+
struct ib_device *ib_dev = cm_id_priv->id.device;
4099+
u64 support_flush = ib_dev->attrs.device_cap_flags &
4100+
(IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT);
4101+
u32 flushable = support_flush ?
4102+
(IB_ACCESS_FLUSH_GLOBAL |
4103+
IB_ACCESS_FLUSH_PERSISTENT) : 0;
4104+
40984105
qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ |
4099-
IB_ACCESS_REMOTE_ATOMIC;
4106+
IB_ACCESS_REMOTE_ATOMIC |
4107+
flushable;
4108+
}
41004109
qp_attr->pkey_index = cm_id_priv->av.pkey_index;
41014110
if (cm_id_priv->av.port)
41024111
qp_attr->port_num = cm_id_priv->av.port->port_num;

drivers/infiniband/core/cma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ MODULE_LICENSE("Dual BSD/GPL");
4747
#define CMA_CM_RESPONSE_TIMEOUT 20
4848
#define CMA_MAX_CM_RETRIES 15
4949
#define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
50-
#define CMA_IBOE_PACKET_LIFETIME 18
50+
#define CMA_IBOE_PACKET_LIFETIME 16
5151
#define CMA_PREFERRED_ROCE_GID_TYPE IB_GID_TYPE_ROCE_UDP_ENCAP
5252

5353
static const char * const cma_events[] = {

drivers/infiniband/core/device.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2159,14 +2159,16 @@ int ib_device_set_netdev(struct ib_device *ib_dev, struct net_device *ndev,
21592159
return 0;
21602160
}
21612161

2162+
if (old_ndev)
2163+
netdev_tracker_free(ndev, &pdata->netdev_tracker);
21622164
if (ndev)
2163-
dev_hold(ndev);
2165+
netdev_hold(ndev, &pdata->netdev_tracker, GFP_ATOMIC);
21642166
rcu_assign_pointer(pdata->netdev, ndev);
21652167
spin_unlock_irqrestore(&pdata->netdev_lock, flags);
21662168

21672169
add_ndev_hash(pdata);
21682170
if (old_ndev)
2169-
dev_put(old_ndev);
2171+
__dev_put(old_ndev);
21702172

21712173
return 0;
21722174
}
@@ -2199,7 +2201,7 @@ static void free_netdevs(struct ib_device *ib_dev)
21992201
* comparisons after the put
22002202
*/
22012203
rcu_assign_pointer(pdata->netdev, NULL);
2202-
dev_put(ndev);
2204+
netdev_put(ndev, &pdata->netdev_tracker);
22032205
}
22042206
spin_unlock_irqrestore(&pdata->netdev_lock, flags);
22052207
}
@@ -2851,8 +2853,8 @@ static int __init ib_core_init(void)
28512853
static void __exit ib_core_cleanup(void)
28522854
{
28532855
roce_gid_mgmt_cleanup();
2854-
nldev_exit();
28552856
rdma_nl_unregister(RDMA_NL_LS);
2857+
nldev_exit();
28562858
unregister_pernet_device(&rdma_dev_net_ops);
28572859
unregister_blocking_lsm_notifier(&ibdev_lsm_nb);
28582860
ib_sa_cleanup();

drivers/infiniband/core/mad.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,13 @@ static void create_mad_addr_info(struct ib_mad_send_wr_private *mad_send_wr,
5959
struct ib_mad_qp_info *qp_info,
6060
struct trace_event_raw_ib_mad_send_template *entry)
6161
{
62-
u16 pkey;
63-
struct ib_device *dev = qp_info->port_priv->device;
64-
u32 pnum = qp_info->port_priv->port_num;
6562
struct ib_ud_wr *wr = &mad_send_wr->send_wr;
6663
struct rdma_ah_attr attr = {};
6764

6865
rdma_query_ah(wr->ah, &attr);
6966

7067
/* These are common */
7168
entry->sl = attr.sl;
72-
ib_query_pkey(dev, pnum, wr->pkey_index, &pkey);
73-
entry->pkey = pkey;
7469
entry->rqpn = wr->remote_qpn;
7570
entry->rqkey = wr->remote_qkey;
7671
entry->dlid = rdma_ah_get_dlid(&attr);

drivers/infiniband/core/nldev.c

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,
513513

514514
/* In create_qp() port is not set yet */
515515
if (qp->port && nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, qp->port))
516-
return -EINVAL;
516+
return -EMSGSIZE;
517517

518518
ret = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_LQPN, qp->qp_num);
519519
if (ret)
@@ -552,7 +552,7 @@ static int fill_res_cm_id_entry(struct sk_buff *msg, bool has_cap_net_admin,
552552
struct rdma_cm_id *cm_id = &id_priv->id;
553553

554554
if (port && port != cm_id->port_num)
555-
return 0;
555+
return -EAGAIN;
556556

557557
if (cm_id->port_num &&
558558
nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, cm_id->port_num))
@@ -894,6 +894,8 @@ static int fill_stat_counter_qps(struct sk_buff *msg,
894894
int ret = 0;
895895

896896
table_attr = nla_nest_start(msg, RDMA_NLDEV_ATTR_RES_QP);
897+
if (!table_attr)
898+
return -EMSGSIZE;
897899

898900
rt = &counter->device->res[RDMA_RESTRACK_QP];
899901
xa_lock(&rt->xa);
@@ -1041,6 +1043,10 @@ static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
10411043
nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
10421044
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
10431045
0, 0);
1046+
if (!nlh) {
1047+
err = -EMSGSIZE;
1048+
goto err_free;
1049+
}
10441050

10451051
err = fill_dev_info(msg, device);
10461052
if (err)
@@ -1126,7 +1132,7 @@ static int _nldev_get_dumpit(struct ib_device *device,
11261132
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
11271133
0, NLM_F_MULTI);
11281134

1129-
if (fill_dev_info(skb, device)) {
1135+
if (!nlh || fill_dev_info(skb, device)) {
11301136
nlmsg_cancel(skb, nlh);
11311137
goto out;
11321138
}
@@ -1185,6 +1191,10 @@ static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
11851191
nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
11861192
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
11871193
0, 0);
1194+
if (!nlh) {
1195+
err = -EMSGSIZE;
1196+
goto err_free;
1197+
}
11881198

11891199
err = fill_port_info(msg, device, port, sock_net(skb->sk));
11901200
if (err)
@@ -1246,7 +1256,7 @@ static int nldev_port_get_dumpit(struct sk_buff *skb,
12461256
RDMA_NLDEV_CMD_PORT_GET),
12471257
0, NLM_F_MULTI);
12481258

1249-
if (fill_port_info(skb, device, p, sock_net(skb->sk))) {
1259+
if (!nlh || fill_port_info(skb, device, p, sock_net(skb->sk))) {
12501260
nlmsg_cancel(skb, nlh);
12511261
goto out;
12521262
}
@@ -1288,6 +1298,10 @@ static int nldev_res_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
12881298
nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
12891299
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),
12901300
0, 0);
1301+
if (!nlh) {
1302+
ret = -EMSGSIZE;
1303+
goto err_free;
1304+
}
12911305

12921306
ret = fill_res_info(msg, device);
12931307
if (ret)
@@ -1319,7 +1333,7 @@ static int _nldev_res_get_dumpit(struct ib_device *device,
13191333
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_RES_GET),
13201334
0, NLM_F_MULTI);
13211335

1322-
if (fill_res_info(skb, device)) {
1336+
if (!nlh || fill_res_info(skb, device)) {
13231337
nlmsg_cancel(skb, nlh);
13241338
goto out;
13251339
}
@@ -1454,7 +1468,7 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
14541468
RDMA_NL_GET_OP(nlh->nlmsg_type)),
14551469
0, 0);
14561470

1457-
if (fill_nldev_handle(msg, device)) {
1471+
if (!nlh || fill_nldev_handle(msg, device)) {
14581472
ret = -EMSGSIZE;
14591473
goto err_free;
14601474
}
@@ -1533,7 +1547,7 @@ static int res_get_common_dumpit(struct sk_buff *skb,
15331547
RDMA_NL_GET_OP(cb->nlh->nlmsg_type)),
15341548
0, NLM_F_MULTI);
15351549

1536-
if (fill_nldev_handle(skb, device)) {
1550+
if (!nlh || fill_nldev_handle(skb, device)) {
15371551
ret = -EMSGSIZE;
15381552
goto err;
15391553
}
@@ -1795,6 +1809,10 @@ static int nldev_get_chardev(struct sk_buff *skb, struct nlmsghdr *nlh,
17951809
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
17961810
RDMA_NLDEV_CMD_GET_CHARDEV),
17971811
0, 0);
1812+
if (!nlh) {
1813+
err = -EMSGSIZE;
1814+
goto out_nlmsg;
1815+
}
17981816

17991817
data.nl_msg = msg;
18001818
err = ib_get_client_nl_info(ibdev, client_name, &data);
@@ -1852,6 +1870,10 @@ static int nldev_sys_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
18521870
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
18531871
RDMA_NLDEV_CMD_SYS_GET),
18541872
0, 0);
1873+
if (!nlh) {
1874+
nlmsg_free(msg);
1875+
return -EMSGSIZE;
1876+
}
18551877

18561878
err = nla_put_u8(msg, RDMA_NLDEV_SYS_ATTR_NETNS_MODE,
18571879
(u8)ib_devices_shared_netns);
@@ -2032,7 +2054,7 @@ static int nldev_stat_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
20322054
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
20332055
RDMA_NLDEV_CMD_STAT_SET),
20342056
0, 0);
2035-
if (fill_nldev_handle(msg, device) ||
2057+
if (!nlh || fill_nldev_handle(msg, device) ||
20362058
nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port)) {
20372059
ret = -EMSGSIZE;
20382060
goto err_free_msg;
@@ -2101,6 +2123,10 @@ static int nldev_stat_del_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
21012123
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
21022124
RDMA_NLDEV_CMD_STAT_SET),
21032125
0, 0);
2126+
if (!nlh) {
2127+
ret = -EMSGSIZE;
2128+
goto err_fill;
2129+
}
21042130

21052131
cntn = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]);
21062132
qpn = nla_get_u32(tb[RDMA_NLDEV_ATTR_RES_LQPN]);
@@ -2171,7 +2197,7 @@ static int stat_get_doit_default_counter(struct sk_buff *skb,
21712197
RDMA_NLDEV_CMD_STAT_GET),
21722198
0, 0);
21732199

2174-
if (fill_nldev_handle(msg, device) ||
2200+
if (!nlh || fill_nldev_handle(msg, device) ||
21752201
nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port)) {
21762202
ret = -EMSGSIZE;
21772203
goto err_msg;
@@ -2259,6 +2285,10 @@ static int stat_get_doit_qp(struct sk_buff *skb, struct nlmsghdr *nlh,
22592285
RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
22602286
RDMA_NLDEV_CMD_STAT_GET),
22612287
0, 0);
2288+
if (!nlh) {
2289+
ret = -EMSGSIZE;
2290+
goto err_msg;
2291+
}
22622292

22632293
ret = rdma_counter_get_mode(device, port, &mode, &mask);
22642294
if (ret)
@@ -2391,7 +2421,7 @@ static int nldev_stat_get_counter_status_doit(struct sk_buff *skb,
23912421
0, 0);
23922422

23932423
ret = -EMSGSIZE;
2394-
if (fill_nldev_handle(msg, device) ||
2424+
if (!nlh || fill_nldev_handle(msg, device) ||
23952425
nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port))
23962426
goto err_msg;
23972427

drivers/infiniband/core/restrack.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ void rdma_restrack_del(struct rdma_restrack_entry *res)
343343
rt = &dev->res[res->type];
344344

345345
old = xa_erase(&rt->xa, res->id);
346-
if (res->type == RDMA_RESTRACK_MR)
347-
return;
348346
WARN_ON(old != res);
349347

350348
out:

drivers/infiniband/core/sysfs.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,9 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,
12131213
p->port_num = port_num;
12141214
kobject_init(&p->kobj, &port_type);
12151215

1216+
if (device->port_data && is_full_dev)
1217+
device->port_data[port_num].sysfs = p;
1218+
12161219
cur_group = p->groups_list;
12171220
ret = alloc_port_table_group("gids", &p->groups[0], p->attrs_list,
12181221
attr->gid_tbl_len, show_port_gid);
@@ -1258,16 +1261,15 @@ static struct ib_port *setup_port(struct ib_core_device *coredev, int port_num,
12581261
}
12591262

12601263
list_add_tail(&p->kobj.entry, &coredev->port_list);
1261-
if (device->port_data && is_full_dev)
1262-
device->port_data[port_num].sysfs = p;
1263-
12641264
return p;
12651265

12661266
err_groups:
12671267
sysfs_remove_groups(&p->kobj, p->groups_list);
12681268
err_del:
12691269
kobject_del(&p->kobj);
12701270
err_put:
1271+
if (device->port_data && is_full_dev)
1272+
device->port_data[port_num].sysfs = NULL;
12711273
kobject_put(&p->kobj);
12721274
return ERR_PTR(ret);
12731275
}
@@ -1276,14 +1278,17 @@ static void destroy_port(struct ib_core_device *coredev, struct ib_port *port)
12761278
{
12771279
bool is_full_dev = &port->ibdev->coredev == coredev;
12781280

1279-
if (port->ibdev->port_data &&
1280-
port->ibdev->port_data[port->port_num].sysfs == port)
1281-
port->ibdev->port_data[port->port_num].sysfs = NULL;
12821281
list_del(&port->kobj.entry);
12831282
if (is_full_dev)
12841283
sysfs_remove_groups(&port->kobj, port->ibdev->ops.port_groups);
1284+
12851285
sysfs_remove_groups(&port->kobj, port->groups_list);
12861286
kobject_del(&port->kobj);
1287+
1288+
if (port->ibdev->port_data &&
1289+
port->ibdev->port_data[port->port_num].sysfs == port)
1290+
port->ibdev->port_data[port->port_num].sysfs = NULL;
1291+
12871292
kobject_put(&port->kobj);
12881293
}
12891294

0 commit comments

Comments
 (0)