Skip to content

Commit d2ad9cc

Browse files
committed
Merge branches 'mlx4', 'mlx5' and 'ocrdma' into k.o/for-4.6
4 parents 76b0640 + 35d1901 + 318d311 + 95f60bb commit d2ad9cc

Some content is hidden

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

49 files changed

+2452
-356
lines changed

drivers/infiniband/core/cma.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,21 @@ static int cma_save_req_info(const struct ib_cm_event *ib_event,
12061206
req->has_gid = true;
12071207
req->service_id = req_param->primary_path->service_id;
12081208
req->pkey = be16_to_cpu(req_param->primary_path->pkey);
1209+
if (req->pkey != req_param->bth_pkey)
1210+
pr_warn_ratelimited("RDMA CMA: got different BTH P_Key (0x%x) and primary path P_Key (0x%x)\n"
1211+
"RDMA CMA: in the future this may cause the request to be dropped\n",
1212+
req_param->bth_pkey, req->pkey);
12091213
break;
12101214
case IB_CM_SIDR_REQ_RECEIVED:
12111215
req->device = sidr_param->listen_id->device;
12121216
req->port = sidr_param->port;
12131217
req->has_gid = false;
12141218
req->service_id = sidr_param->service_id;
12151219
req->pkey = sidr_param->pkey;
1220+
if (req->pkey != sidr_param->bth_pkey)
1221+
pr_warn_ratelimited("RDMA CMA: got different BTH P_Key (0x%x) and SIDR request payload P_Key (0x%x)\n"
1222+
"RDMA CMA: in the future this may cause the request to be dropped\n",
1223+
sidr_param->bth_pkey, req->pkey);
12161224
break;
12171225
default:
12181226
return -EINVAL;

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1174,6 +1174,7 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
11741174
struct ib_uobject *uobj;
11751175
struct ib_pd *pd;
11761176
struct ib_mw *mw;
1177+
struct ib_udata udata;
11771178
int ret;
11781179

11791180
if (out_len < sizeof(resp))
@@ -1195,7 +1196,12 @@ ssize_t ib_uverbs_alloc_mw(struct ib_uverbs_file *file,
11951196
goto err_free;
11961197
}
11971198

1198-
mw = pd->device->alloc_mw(pd, cmd.mw_type);
1199+
INIT_UDATA(&udata, buf + sizeof(cmd),
1200+
(unsigned long)cmd.response + sizeof(resp),
1201+
in_len - sizeof(cmd) - sizeof(struct ib_uverbs_cmd_hdr),
1202+
out_len - sizeof(resp));
1203+
1204+
mw = pd->device->alloc_mw(pd, cmd.mw_type, &udata);
11991205
if (IS_ERR(mw)) {
12001206
ret = PTR_ERR(mw);
12011207
goto err_put;
@@ -3086,6 +3092,14 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
30863092
!capable(CAP_NET_ADMIN)) || !capable(CAP_NET_RAW))
30873093
return -EPERM;
30883094

3095+
if (cmd.flow_attr.flags >= IB_FLOW_ATTR_FLAGS_RESERVED)
3096+
return -EINVAL;
3097+
3098+
if ((cmd.flow_attr.flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) &&
3099+
((cmd.flow_attr.type == IB_FLOW_ATTR_ALL_DEFAULT) ||
3100+
(cmd.flow_attr.type == IB_FLOW_ATTR_MC_DEFAULT)))
3101+
return -EINVAL;
3102+
30893103
if (cmd.flow_attr.num_of_specs > IB_FLOW_SPEC_SUPPORT_LAYERS)
30903104
return -EINVAL;
30913105

drivers/infiniband/core/verbs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,8 @@ EXPORT_SYMBOL(ib_check_mr_status);
15671567
* - The last sg element is allowed to have length less than page_size.
15681568
* - If sg_nents total byte length exceeds the mr max_num_sge * page_size
15691569
* then only max_num_sg entries will be mapped.
1570+
* - If the MR was allocated with type IB_MR_TYPE_SG_GAPS_REG, non of these
1571+
* constraints holds and the page_size argument is ignored.
15701572
*
15711573
* Returns the number of sg elements that were mapped to the memory region.
15721574
*

drivers/infiniband/hw/cxgb3/iwch_provider.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,8 @@ static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
657657
return ERR_PTR(err);
658658
}
659659

660-
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
660+
static struct ib_mw *iwch_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
661+
struct ib_udata *udata)
661662
{
662663
struct iwch_dev *rhp;
663664
struct iwch_pd *php;

drivers/infiniband/hw/cxgb4/iw_cxgb4.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,8 @@ int c4iw_map_mr_sg(struct ib_mr *ibmr,
963963
struct scatterlist *sg,
964964
int sg_nents);
965965
int c4iw_dealloc_mw(struct ib_mw *mw);
966-
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
966+
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
967+
struct ib_udata *udata);
967968
struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
968969
u64 length, u64 virt, int acc,
969970
struct ib_udata *udata);

drivers/infiniband/hw/cxgb4/mem.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include <linux/moduleparam.h>
3535
#include <rdma/ib_umem.h>
3636
#include <linux/atomic.h>
37+
#include <rdma/ib_user_verbs.h>
3738

3839
#include "iw_cxgb4.h"
3940

@@ -552,7 +553,8 @@ struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
552553
return ERR_PTR(err);
553554
}
554555

555-
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
556+
struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
557+
struct ib_udata *udata)
556558
{
557559
struct c4iw_dev *rhp;
558560
struct c4iw_pd *php;

drivers/infiniband/hw/mlx4/alias_GUID.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static void aliasguid_query_handler(int status,
310310
if (status) {
311311
pr_debug("(port: %d) failed: status = %d\n",
312312
cb_ctx->port, status);
313-
rec->time_to_run = ktime_get_real_ns() + 1 * NSEC_PER_SEC;
313+
rec->time_to_run = ktime_get_boot_ns() + 1 * NSEC_PER_SEC;
314314
goto out;
315315
}
316316

@@ -416,7 +416,7 @@ static void aliasguid_query_handler(int status,
416416
be64_to_cpu((__force __be64)rec->guid_indexes),
417417
be64_to_cpu((__force __be64)applied_guid_indexes),
418418
be64_to_cpu((__force __be64)declined_guid_indexes));
419-
rec->time_to_run = ktime_get_real_ns() +
419+
rec->time_to_run = ktime_get_boot_ns() +
420420
resched_delay_sec * NSEC_PER_SEC;
421421
} else {
422422
rec->status = MLX4_GUID_INFO_STATUS_SET;
@@ -708,7 +708,7 @@ static int get_low_record_time_index(struct mlx4_ib_dev *dev, u8 port,
708708
}
709709
}
710710
if (resched_delay_sec) {
711-
u64 curr_time = ktime_get_real_ns();
711+
u64 curr_time = ktime_get_boot_ns();
712712

713713
*resched_delay_sec = (low_record_time < curr_time) ? 0 :
714714
div_u64((low_record_time - curr_time), NSEC_PER_SEC);

drivers/infiniband/hw/mlx4/main.c

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,6 +1643,56 @@ static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_
16431643
return err;
16441644
}
16451645

1646+
static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
1647+
struct ib_flow_attr *flow_attr,
1648+
enum mlx4_net_trans_promisc_mode *type)
1649+
{
1650+
int err = 0;
1651+
1652+
if (!(dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_UC_MC_SNIFFER) ||
1653+
(dev->caps.dmfs_high_steer_mode == MLX4_STEERING_DMFS_A0_STATIC) ||
1654+
(flow_attr->num_of_specs > 1) || (flow_attr->priority != 0)) {
1655+
return -EOPNOTSUPP;
1656+
}
1657+
1658+
if (flow_attr->num_of_specs == 0) {
1659+
type[0] = MLX4_FS_MC_SNIFFER;
1660+
type[1] = MLX4_FS_UC_SNIFFER;
1661+
} else {
1662+
union ib_flow_spec *ib_spec;
1663+
1664+
ib_spec = (union ib_flow_spec *)(flow_attr + 1);
1665+
if (ib_spec->type != IB_FLOW_SPEC_ETH)
1666+
return -EINVAL;
1667+
1668+
/* if all is zero than MC and UC */
1669+
if (is_zero_ether_addr(ib_spec->eth.mask.dst_mac)) {
1670+
type[0] = MLX4_FS_MC_SNIFFER;
1671+
type[1] = MLX4_FS_UC_SNIFFER;
1672+
} else {
1673+
u8 mac[ETH_ALEN] = {ib_spec->eth.mask.dst_mac[0] ^ 0x01,
1674+
ib_spec->eth.mask.dst_mac[1],
1675+
ib_spec->eth.mask.dst_mac[2],
1676+
ib_spec->eth.mask.dst_mac[3],
1677+
ib_spec->eth.mask.dst_mac[4],
1678+
ib_spec->eth.mask.dst_mac[5]};
1679+
1680+
/* Above xor was only on MC bit, non empty mask is valid
1681+
* only if this bit is set and rest are zero.
1682+
*/
1683+
if (!is_zero_ether_addr(&mac[0]))
1684+
return -EINVAL;
1685+
1686+
if (is_multicast_ether_addr(ib_spec->eth.val.dst_mac))
1687+
type[0] = MLX4_FS_MC_SNIFFER;
1688+
else
1689+
type[0] = MLX4_FS_UC_SNIFFER;
1690+
}
1691+
}
1692+
1693+
return err;
1694+
}
1695+
16461696
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
16471697
struct ib_flow_attr *flow_attr,
16481698
int domain)
@@ -1653,6 +1703,10 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
16531703
struct mlx4_dev *dev = (to_mdev(qp->device))->dev;
16541704
int is_bonded = mlx4_is_bonded(dev);
16551705

1706+
if ((flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP) &&
1707+
(flow_attr->type != IB_FLOW_ATTR_NORMAL))
1708+
return ERR_PTR(-EOPNOTSUPP);
1709+
16561710
memset(type, 0, sizeof(type));
16571711

16581712
mflow = kzalloc(sizeof(*mflow), GFP_KERNEL);
@@ -1663,7 +1717,19 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
16631717

16641718
switch (flow_attr->type) {
16651719
case IB_FLOW_ATTR_NORMAL:
1666-
type[0] = MLX4_FS_REGULAR;
1720+
/* If dont trap flag (continue match) is set, under specific
1721+
* condition traffic be replicated to given qp,
1722+
* without stealing it
1723+
*/
1724+
if (unlikely(flow_attr->flags & IB_FLOW_ATTR_FLAGS_DONT_TRAP)) {
1725+
err = mlx4_ib_add_dont_trap_rule(dev,
1726+
flow_attr,
1727+
type);
1728+
if (err)
1729+
goto err_free;
1730+
} else {
1731+
type[0] = MLX4_FS_REGULAR;
1732+
}
16671733
break;
16681734

16691735
case IB_FLOW_ATTR_ALL_DEFAULT:
@@ -1675,8 +1741,8 @@ static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
16751741
break;
16761742

16771743
case IB_FLOW_ATTR_SNIFFER:
1678-
type[0] = MLX4_FS_UC_SNIFFER;
1679-
type[1] = MLX4_FS_MC_SNIFFER;
1744+
type[0] = MLX4_FS_MIRROR_RX_PORT;
1745+
type[1] = MLX4_FS_MIRROR_SX_PORT;
16801746
break;
16811747

16821748
default:

drivers/infiniband/hw/mlx4/mlx4_ib.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,8 @@ struct ib_mr *mlx4_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
711711
u64 virt_addr, int access_flags,
712712
struct ib_udata *udata);
713713
int mlx4_ib_dereg_mr(struct ib_mr *mr);
714-
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
714+
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
715+
struct ib_udata *udata);
715716
int mlx4_ib_dealloc_mw(struct ib_mw *mw);
716717
struct ib_mr *mlx4_ib_alloc_mr(struct ib_pd *pd,
717718
enum ib_mr_type mr_type,

drivers/infiniband/hw/mlx4/mr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333

3434
#include <linux/slab.h>
35+
#include <rdma/ib_user_verbs.h>
3536

3637
#include "mlx4_ib.h"
3738

@@ -334,7 +335,8 @@ int mlx4_ib_dereg_mr(struct ib_mr *ibmr)
334335
return 0;
335336
}
336337

337-
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type)
338+
struct ib_mw *mlx4_ib_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
339+
struct ib_udata *udata)
338340
{
339341
struct mlx4_ib_dev *dev = to_mdev(pd->device);
340342
struct mlx4_ib_mw *mw;

drivers/infiniband/hw/mlx5/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
obj-$(CONFIG_MLX5_INFINIBAND) += mlx5_ib.o
22

3-
mlx5_ib-y := main.o cq.o doorbell.o qp.o mem.o srq.o mr.o ah.o mad.o
3+
mlx5_ib-y := main.o cq.o doorbell.o qp.o mem.o srq.o mr.o ah.o mad.o gsi.o
44
mlx5_ib-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += odp.o

0 commit comments

Comments
 (0)