* [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
@ 2019-01-22 6:48 ` Leon Romanovsky
0 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Leon Romanovsky <leonro@mellanox.com>
Hi,
This series extend ODP to work with SRQ and XRC. Being both per-operation
(e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
we extend IB/core and mlx5 driver to provide needed information to user space.
Thanks
Moni Shoua (12):
IB/mlx5: Fix locking SRQ object in ODP event
IB/core: Allocate bit for SRQ ODP support
IB/uverbs: Expose XRC ODP device capabilities
IB/mlx5: Remove useless check in ODP handler
IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
IB/mlx5: Add XRC initiator ODP support
IB/mlx5: Let read user wqe also from SRQ buffer
IB/mlx5: Add ODP SRQ support
IB/mlx5: Advertise SRQ ODP support for supported transports
net/mlx5: Add XRC transport to ODP device capabilities layout
IB/mlx5: Advertise XRC ODP support
net/mlx5: Set ODP SRQ support in firmware
drivers/infiniband/core/uverbs_cmd.c | 1 +
drivers/infiniband/hw/mlx5/cq.c | 4 +-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 9 +-
drivers/infiniband/hw/mlx5/odp.c | 138 ++++++++++---
drivers/infiniband/hw/mlx5/qp.c | 192 +++++++++++++-----
drivers/infiniband/hw/mlx5/srq.h | 2 -
drivers/infiniband/hw/mlx5/srq_cmd.c | 16 +-
.../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++
include/linux/mlx5/device.h | 3 +
include/linux/mlx5/mlx5_ifc.h | 5 +-
include/rdma/ib_verbs.h | 2 +
include/uapi/rdma/ib_user_verbs.h | 2 +
12 files changed, 331 insertions(+), 96 deletions(-)
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
@ 2019-01-22 6:48 ` Leon Romanovsky
0 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Leon Romanovsky <leonro@mellanox.com>
Hi,
This series extend ODP to work with SRQ and XRC. Being both per-operation
(e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
we extend IB/core and mlx5 driver to provide needed information to user space.
Thanks
Moni Shoua (12):
IB/mlx5: Fix locking SRQ object in ODP event
IB/core: Allocate bit for SRQ ODP support
IB/uverbs: Expose XRC ODP device capabilities
IB/mlx5: Remove useless check in ODP handler
IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
IB/mlx5: Add XRC initiator ODP support
IB/mlx5: Let read user wqe also from SRQ buffer
IB/mlx5: Add ODP SRQ support
IB/mlx5: Advertise SRQ ODP support for supported transports
net/mlx5: Add XRC transport to ODP device capabilities layout
IB/mlx5: Advertise XRC ODP support
net/mlx5: Set ODP SRQ support in firmware
drivers/infiniband/core/uverbs_cmd.c | 1 +
drivers/infiniband/hw/mlx5/cq.c | 4 +-
drivers/infiniband/hw/mlx5/mlx5_ib.h | 9 +-
drivers/infiniband/hw/mlx5/odp.c | 138 ++++++++++---
drivers/infiniband/hw/mlx5/qp.c | 192 +++++++++++++-----
drivers/infiniband/hw/mlx5/srq.h | 2 -
drivers/infiniband/hw/mlx5/srq_cmd.c | 16 +-
.../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++
include/linux/mlx5/device.h | 3 +
include/linux/mlx5/mlx5_ifc.h | 5 +-
include/rdma/ib_verbs.h | 2 +
include/uapi/rdma/ib_user_verbs.h | 2 +
12 files changed, 331 insertions(+), 96 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH rdma-next 01/12] IB/mlx5: Fix locking SRQ object in ODP event
2019-01-22 6:48 ` Leon Romanovsky
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
QP and SRQ objects are stored in different containers so the action to
get and lock a common resource during ODP event needs to address that.
While that get rid of 'refcount' and 'free' fields in mlx5_core_srq
struct and use the fields with same semantics in common structure.
Fixes: 032080ab43ac ("IB/mlx5: Lock QP during page fault handling")
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/cq.c | 4 ++--
drivers/infiniband/hw/mlx5/odp.c | 13 ++++++++-----
drivers/infiniband/hw/mlx5/srq.h | 2 --
drivers/infiniband/hw/mlx5/srq_cmd.c | 16 +++++++---------
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c
index 202f977e7092..eb149de9f156 100644
--- a/drivers/infiniband/hw/mlx5/cq.c
+++ b/drivers/infiniband/hw/mlx5/cq.c
@@ -187,8 +187,8 @@ static void handle_responder(struct ib_wc *wc, struct mlx5_cqe64 *cqe,
wqe_ctr = be16_to_cpu(cqe->wqe_counter);
wc->wr_id = srq->wrid[wqe_ctr];
mlx5_ib_free_srq_wqe(srq, wqe_ctr);
- if (msrq && atomic_dec_and_test(&msrq->refcount))
- complete(&msrq->free);
+ if (msrq)
+ mlx5_core_res_put(&msrq->common);
}
} else {
wq = &qp->rq;
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 82ac6cdc7130..beff8c8908b5 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1115,22 +1115,25 @@ static int mlx5_ib_mr_responder_pfault_handler(
static inline struct mlx5_core_rsc_common *odp_get_rsc(struct mlx5_ib_dev *dev,
u32 wq_num, int pf_type)
{
- enum mlx5_res_type res_type;
+ struct mlx5_core_rsc_common *common = NULL;
+ struct mlx5_core_srq *srq;
switch (pf_type) {
case MLX5_WQE_PF_TYPE_RMP:
- res_type = MLX5_RES_SRQ;
+ srq = mlx5_cmd_get_srq(dev, wq_num);
+ if (srq)
+ common = &srq->common;
break;
case MLX5_WQE_PF_TYPE_REQ_SEND_OR_WRITE:
case MLX5_WQE_PF_TYPE_RESP:
case MLX5_WQE_PF_TYPE_REQ_READ_OR_ATOMIC:
- res_type = MLX5_RES_QP;
+ common = mlx5_core_res_hold(dev->mdev, wq_num, MLX5_RES_QP);
break;
default:
- return NULL;
+ break;
}
- return mlx5_core_res_hold(dev->mdev, wq_num, res_type);
+ return common;
}
static inline struct mlx5_ib_qp *res_to_qp(struct mlx5_core_rsc_common *res)
diff --git a/drivers/infiniband/hw/mlx5/srq.h b/drivers/infiniband/hw/mlx5/srq.h
index 75eb5839ae95..c330af35ff10 100644
--- a/drivers/infiniband/hw/mlx5/srq.h
+++ b/drivers/infiniband/hw/mlx5/srq.h
@@ -46,8 +46,6 @@ struct mlx5_core_srq {
int wqe_shift;
void (*event)(struct mlx5_core_srq *srq, enum mlx5_event e);
- atomic_t refcount;
- struct completion free;
u16 uid;
};
diff --git a/drivers/infiniband/hw/mlx5/srq_cmd.c b/drivers/infiniband/hw/mlx5/srq_cmd.c
index 7aaaffbd4afa..63ac38bb3498 100644
--- a/drivers/infiniband/hw/mlx5/srq_cmd.c
+++ b/drivers/infiniband/hw/mlx5/srq_cmd.c
@@ -87,7 +87,7 @@ struct mlx5_core_srq *mlx5_cmd_get_srq(struct mlx5_ib_dev *dev, u32 srqn)
srq = radix_tree_lookup(&table->tree, srqn);
if (srq)
- atomic_inc(&srq->refcount);
+ atomic_inc(&srq->common.refcount);
spin_unlock(&table->lock);
@@ -594,8 +594,8 @@ int mlx5_cmd_create_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq,
if (err)
return err;
- atomic_set(&srq->refcount, 1);
- init_completion(&srq->free);
+ atomic_set(&srq->common.refcount, 1);
+ init_completion(&srq->common.free);
spin_lock_irq(&table->lock);
err = radix_tree_insert(&table->tree, srq->srqn, srq);
@@ -627,9 +627,8 @@ int mlx5_cmd_destroy_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq)
if (err)
return err;
- if (atomic_dec_and_test(&srq->refcount))
- complete(&srq->free);
- wait_for_completion(&srq->free);
+ mlx5_core_res_put(&srq->common);
+ wait_for_completion(&srq->common.free);
return 0;
}
@@ -685,7 +684,7 @@ static int srq_event_notifier(struct notifier_block *nb,
srq = radix_tree_lookup(&table->tree, srqn);
if (srq)
- atomic_inc(&srq->refcount);
+ atomic_inc(&srq->common.refcount);
spin_unlock(&table->lock);
@@ -694,8 +693,7 @@ static int srq_event_notifier(struct notifier_block *nb,
srq->event(srq, eqe->type);
- if (atomic_dec_and_test(&srq->refcount))
- complete(&srq->free);
+ mlx5_core_res_put(&srq->common);
return NOTIFY_OK;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 02/12] IB/core: Allocate bit for SRQ ODP support
2019-01-22 6:48 ` Leon Romanovsky
(?)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
ODP support matrix is per operation and per transport. The support for
each transport (RC, UD, etc.) is described with a bit field.
ODP for SRQ WQEs is considered a different kind of support from ODP for
RQ WQs and therefore need a different capability bit.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/rdma/ib_verbs.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index d6e0a7d35097..38438561b648 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -268,6 +268,7 @@ enum ib_odp_transport_cap_bits {
IB_ODP_SUPPORT_WRITE = 1 << 2,
IB_ODP_SUPPORT_READ = 1 << 3,
IB_ODP_SUPPORT_ATOMIC = 1 << 4,
+ IB_ODP_SUPPORT_SRQ_RECV = 1 << 5,
};
struct ib_odp_caps {
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 03/12] IB/uverbs: Expose XRC ODP device capabilities
2019-01-22 6:48 ` Leon Romanovsky
` (2 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
Expose XRC ODP capabilities as part of the extended device capabilities.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/core/uverbs_cmd.c | 1 +
include/rdma/ib_verbs.h | 1 +
include/uapi/rdma/ib_user_verbs.h | 2 ++
3 files changed, 4 insertions(+)
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 4e40a04d1857..b3430c7c67f3 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3613,6 +3613,7 @@ static int ib_uverbs_ex_query_device(struct uverbs_attr_bundle *attrs)
attr.odp_caps.per_transport_caps.uc_odp_caps;
resp.odp_caps.per_transport_caps.ud_odp_caps =
attr.odp_caps.per_transport_caps.ud_odp_caps;
+ resp.xrc_odp_caps = attr.odp_caps.per_transport_caps.xrc_odp_caps;
resp.timestamp_mask = attr.timestamp_mask;
resp.hca_core_clock = attr.hca_core_clock;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 38438561b648..d54c87640f89 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -277,6 +277,7 @@ struct ib_odp_caps {
uint32_t rc_odp_caps;
uint32_t uc_odp_caps;
uint32_t ud_odp_caps;
+ uint32_t xrc_odp_caps;
} per_transport_caps;
};
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 480d9a60b68e..0474c7400268 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -270,6 +270,8 @@ struct ib_uverbs_ex_query_device_resp {
struct ib_uverbs_tm_caps tm_caps;
struct ib_uverbs_cq_moderation_caps cq_moderation_caps;
__aligned_u64 max_dm_size;
+ __u32 xrc_odp_caps;
+ __u32 reserved;
};
struct ib_uverbs_query_port {
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 04/12] IB/mlx5: Remove useless check in ODP handler
2019-01-22 6:48 ` Leon Romanovsky
` (3 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
When handling an ODP event for a revive WQE in SRQ the target QP
is unknown. Therefore, it is wrong to ask if QP has a SRQ in
the page-fault handler.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index beff8c8908b5..d2e8e74e24c9 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -869,7 +869,6 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, u32 key,
/**
* Parse a series of data segments for page fault handling.
*
- * @qp the QP on which the fault occurred.
* @pfault contains page fault information.
* @wqe points at the first data segment in the WQE.
* @wqe_end points after the end of the WQE.
@@ -886,7 +885,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, u32 key,
*/
static int pagefault_data_segments(struct mlx5_ib_dev *dev,
struct mlx5_pagefault *pfault,
- struct mlx5_ib_qp *qp, void *wqe,
+ void *wqe,
void *wqe_end, u32 *bytes_mapped,
u32 *total_wqe_bytes, int receive_queue)
{
@@ -897,10 +896,6 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev,
size_t bcnt;
int inline_segment;
- /* Skip SRQ next-WQE segment. */
- if (receive_queue && qp->ibqp.srq)
- wqe += sizeof(struct mlx5_wqe_srq_next_seg);
-
if (bytes_mapped)
*bytes_mapped = 0;
if (total_wqe_bytes)
@@ -1200,7 +1195,7 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
goto resolve_page_fault;
}
- ret = pagefault_data_segments(dev, pfault, qp, wqe, wqe_end,
+ ret = pagefault_data_segments(dev, pfault, wqe, wqe_end,
&bytes_mapped, &total_wqe_bytes,
!requestor);
if (ret == -EAGAIN) {
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 05/12] IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
2019-01-22 6:48 ` Leon Romanovsky
` (4 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
In the function mlx5_ib_mr_responder_pfault_handler()
1. The parameter wqe is used as read-only so there
is no need to pass it by reference.
2. Remove the unused argument pfault from list of arguments.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index d2e8e74e24c9..71f543d3b70e 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1064,12 +1064,12 @@ static int mlx5_ib_mr_initiator_pfault_handler(
}
/*
- * Parse responder WQE. Advances the wqe pointer to point at the
- * scatter-gather list, and set wqe_end to the end of the WQE.
+ * Parse responder WQE and set wqe_end to the end of the WQE.
*/
-static int mlx5_ib_mr_responder_pfault_handler(
- struct mlx5_ib_dev *dev, struct mlx5_pagefault *pfault,
- struct mlx5_ib_qp *qp, void **wqe, void **wqe_end, int wqe_length)
+static int mlx5_ib_mr_responder_pfault_handler(struct mlx5_ib_dev *dev,
+ struct mlx5_ib_qp *qp, void *wqe,
+ void **wqe_end,
+ int wqe_length)
{
struct mlx5_ib_wq *wq = &qp->rq;
int wqe_size = 1 << wq->wqe_shift;
@@ -1102,7 +1102,7 @@ static int mlx5_ib_mr_responder_pfault_handler(
return -EFAULT;
}
- *wqe_end = *wqe + wqe_size;
+ *wqe_end = wqe + wqe_size;
return 0;
}
@@ -1185,7 +1185,7 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp, &wqe,
&wqe_end, ret);
else
- ret = mlx5_ib_mr_responder_pfault_handler(dev, pfault, qp, &wqe,
+ ret = mlx5_ib_mr_responder_pfault_handler(dev, qp, wqe,
&wqe_end, ret);
if (ret < 0)
goto resolve_page_fault;
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 06/12] IB/mlx5: Add XRC initiator ODP support
2019-01-22 6:48 ` Leon Romanovsky
` (5 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
Skip XRC segment in the beginning of a send WQE and fetch ODP XRC
capabilities when QP type is IB_QPT_XRC_INI. The rest of the handling is
the same as in RC QP.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 71f543d3b70e..cc01d92490cc 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1020,6 +1020,10 @@ static int mlx5_ib_mr_initiator_pfault_handler(
MLX5_WQE_CTRL_OPCODE_MASK;
switch (qp->ibqp.qp_type) {
+ case IB_QPT_XRC_INI:
+ *wqe += sizeof(struct mlx5_wqe_xrc_seg);
+ transport_caps = dev->odp_caps.per_transport_caps.xrc_odp_caps;
+ break;
case IB_QPT_RC:
transport_caps = dev->odp_caps.per_transport_caps.rc_odp_caps;
break;
@@ -1039,7 +1043,7 @@ static int mlx5_ib_mr_initiator_pfault_handler(
return -EFAULT;
}
- if (qp->ibqp.qp_type != IB_QPT_RC) {
+ if (qp->ibqp.qp_type == IB_QPT_UD) {
av = *wqe;
if (av->dqp_dct & cpu_to_be32(MLX5_EXTENDED_UD_AV))
*wqe += sizeof(struct mlx5_av);
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 07/12] IB/mlx5: Let read user wqe also from SRQ buffer
2019-01-22 6:48 ` Leon Romanovsky
` (6 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
Reading a WQE from SRQ is almost identical to reading from regular RQ.
The differences are the size of the queue, the size of a WQE and buffer
location.
Make necessary changes to mlx5_ib_read_user_wqe() to let it read a WQE
from a SRQ or RQ by caller choice.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/mlx5_ib.h | 9 +-
drivers/infiniband/hw/mlx5/odp.c | 20 ++-
drivers/infiniband/hw/mlx5/qp.c | 192 ++++++++++++++++++++-------
3 files changed, 166 insertions(+), 55 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index 1f1dd19c9d85..c4f74c425c12 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -1076,9 +1076,12 @@ int mlx5_ib_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
const struct ib_send_wr **bad_wr);
int mlx5_ib_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
const struct ib_recv_wr **bad_wr);
-int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index,
- void *buffer, u32 length,
- struct mlx5_ib_qp_base *base);
+int mlx5_ib_read_user_wqe_sq(struct mlx5_ib_qp *qp, int wqe_index, void *buffer,
+ int buflen, size_t *bc);
+int mlx5_ib_read_user_wqe_rq(struct mlx5_ib_qp *qp, int wqe_index, void *buffer,
+ int buflen, size_t *bc);
+int mlx5_ib_read_user_wqe_srq(struct mlx5_ib_srq *srq, int wqe_index,
+ void *buffer, int buflen, size_t *bc);
struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev,
const struct ib_cq_init_attr *attr,
struct ib_ucontext *context,
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index cc01d92490cc..cc690aa915de 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1154,6 +1154,7 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
int requestor = pfault->type & MLX5_PFAULT_REQUESTOR;
struct mlx5_core_rsc_common *res;
struct mlx5_ib_qp *qp;
+ size_t bytes_copied;
res = odp_get_rsc(dev, pfault->wqe.wq_num, pfault->type);
if (!res) {
@@ -1176,9 +1177,16 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
goto resolve_page_fault;
}
- ret = mlx5_ib_read_user_wqe(qp, requestor, wqe_index, buffer,
- PAGE_SIZE, &qp->trans_qp.base);
- if (ret < 0) {
+ if (requestor)
+ ret = mlx5_ib_read_user_wqe_sq(qp, wqe_index,
+ buffer, PAGE_SIZE,
+ &bytes_copied);
+ else
+ ret = mlx5_ib_read_user_wqe_rq(qp, wqe_index,
+ buffer, PAGE_SIZE,
+ &bytes_copied);
+
+ if (ret) {
mlx5_ib_err(dev, "Failed reading a WQE following page fault, error=%d, wqe_index=%x, qpn=%x\n",
ret, wqe_index, pfault->token);
goto resolve_page_fault;
@@ -1187,10 +1195,12 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
wqe = buffer;
if (requestor)
ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp, &wqe,
- &wqe_end, ret);
+ &wqe_end,
+ bytes_copied);
else
ret = mlx5_ib_mr_responder_pfault_handler(dev, qp, wqe,
- &wqe_end, ret);
+ &wqe_end,
+ bytes_copied);
if (ret < 0)
goto resolve_page_fault;
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index dba75b96f971..9f41e114fc20 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -109,75 +109,173 @@ static int is_sqp(enum ib_qp_type qp_type)
}
/**
- * mlx5_ib_read_user_wqe() - Copy a user-space WQE to kernel space.
+ * mlx5_ib_read_user_wqe_common() - Copy a WQE (or part of) from user WQ
+ * to kernel buffer
*
- * @qp: QP to copy from.
- * @send: copy from the send queue when non-zero, use the receive queue
- * otherwise.
- * @wqe_index: index to start copying from. For send work queues, the
- * wqe_index is in units of MLX5_SEND_WQE_BB.
- * For receive work queue, it is the number of work queue
- * element in the queue.
- * @buffer: destination buffer.
- * @length: maximum number of bytes to copy.
+ * @umem: User space memory where the WQ is
+ * @buffer: buffer to copy to
+ * @buflen: buffer length
+ * @wqe_index: index of WQE to copy from
+ * @wq_offset: offset to start of WQ
+ * @wq_wqe_cnt: number of WQEs in WQ
+ * @wq_wqe_shift: log2 of WQE size
+ * @bcnt: number of bytes to copy
+ * @bytes_copied: number of bytes to copy (return value)
*
- * Copies at least a single WQE, but may copy more data.
+ * Copies from start of WQE bcnt or less bytes.
+ * Does not gurantee to copy the entire WQE.
*
- * Return: the number of bytes copied, or an error code.
+ * Return: zero on success, or an error code.
*/
-int mlx5_ib_read_user_wqe(struct mlx5_ib_qp *qp, int send, int wqe_index,
- void *buffer, u32 length,
- struct mlx5_ib_qp_base *base)
+static int mlx5_ib_read_user_wqe_common(struct ib_umem *umem,
+ void *buffer,
+ u32 buflen,
+ int wqe_index,
+ int wq_offset,
+ int wq_wqe_cnt,
+ int wq_wqe_shift,
+ int bcnt,
+ size_t *bytes_copied)
+{
+ size_t offset = wq_offset + ((wqe_index % wq_wqe_cnt) << wq_wqe_shift);
+ size_t wq_end = wq_offset + (wq_wqe_cnt << wq_wqe_shift);
+ size_t copy_length;
+ int ret;
+
+ /* don't copy more than requested, more than buffer length or
+ * beyond WQ end
+ */
+ copy_length = min_t(u32, buflen, wq_end - offset);
+ copy_length = min_t(u32, copy_length, bcnt);
+
+ ret = ib_umem_copy_from(buffer, umem, offset, copy_length);
+ if (ret)
+ return ret;
+
+ if (!ret && bytes_copied)
+ *bytes_copied = copy_length;
+
+ return 0;
+}
+
+int mlx5_ib_read_user_wqe_sq(struct mlx5_ib_qp *qp,
+ int wqe_index,
+ void *buffer,
+ int buflen,
+ size_t *bc)
{
- struct ib_device *ibdev = qp->ibqp.device;
- struct mlx5_ib_dev *dev = to_mdev(ibdev);
- struct mlx5_ib_wq *wq = send ? &qp->sq : &qp->rq;
- size_t offset;
- size_t wq_end;
+ struct mlx5_ib_qp_base *base = &qp->trans_qp.base;
struct ib_umem *umem = base->ubuffer.umem;
- u32 first_copy_length;
- int wqe_length;
+ struct mlx5_ib_wq *wq = &qp->sq;
+ struct mlx5_wqe_ctrl_seg *ctrl;
+ size_t bytes_copied;
+ size_t bytes_copied2;
+ size_t wqe_length;
int ret;
+ int ds;
- if (wq->wqe_cnt == 0) {
- mlx5_ib_dbg(dev, "mlx5_ib_read_user_wqe for a QP with wqe_cnt == 0. qp_type: 0x%x\n",
- qp->ibqp.qp_type);
+ if (buflen < sizeof(*ctrl))
return -EINVAL;
- }
- offset = wq->offset + ((wqe_index % wq->wqe_cnt) << wq->wqe_shift);
- wq_end = wq->offset + (wq->wqe_cnt << wq->wqe_shift);
+ /* at first read as much as possible */
+ ret = mlx5_ib_read_user_wqe_common(umem,
+ buffer,
+ buflen,
+ wqe_index,
+ wq->offset,
+ wq->wqe_cnt,
+ wq->wqe_shift,
+ buflen,
+ &bytes_copied);
+ if (ret)
+ return ret;
- if (send && length < sizeof(struct mlx5_wqe_ctrl_seg))
+ /* we need at least control segment size to proceed */
+ if (bytes_copied < sizeof(*ctrl))
return -EINVAL;
- if (offset > umem->length ||
- (send && offset + sizeof(struct mlx5_wqe_ctrl_seg) > umem->length))
- return -EINVAL;
+ ctrl = buffer;
+ ds = be32_to_cpu(ctrl->qpn_ds) & MLX5_WQE_CTRL_DS_MASK;
+ wqe_length = ds * MLX5_WQE_DS_UNITS;
+
+ /* if we copied enough then we are done */
+ if (bytes_copied >= wqe_length) {
+ *bc = bytes_copied;
+ return 0;
+ }
+
+ /* otherwise this a wrapped around wqe
+ * so read the remaining bytes starting
+ * from wqe_index 0
+ */
+ ret = mlx5_ib_read_user_wqe_common(umem,
+ buffer + bytes_copied,
+ buflen - bytes_copied,
+ 0,
+ wq->offset,
+ wq->wqe_cnt,
+ wq->wqe_shift,
+ wqe_length - bytes_copied,
+ &bytes_copied2);
- first_copy_length = min_t(u32, offset + length, wq_end) - offset;
- ret = ib_umem_copy_from(buffer, umem, offset, first_copy_length);
if (ret)
return ret;
+ *bc = bytes_copied + bytes_copied2;
+ return 0;
+}
- if (send) {
- struct mlx5_wqe_ctrl_seg *ctrl = buffer;
- int ds = be32_to_cpu(ctrl->qpn_ds) & MLX5_WQE_CTRL_DS_MASK;
-
- wqe_length = ds * MLX5_WQE_DS_UNITS;
- } else {
- wqe_length = 1 << wq->wqe_shift;
- }
+int mlx5_ib_read_user_wqe_rq(struct mlx5_ib_qp *qp,
+ int wqe_index,
+ void *buffer,
+ int buflen,
+ size_t *bc)
+{
+ struct mlx5_ib_qp_base *base = &qp->trans_qp.base;
+ struct ib_umem *umem = base->ubuffer.umem;
+ struct mlx5_ib_wq *wq = &qp->rq;
+ size_t bytes_copied;
+ int ret;
- if (wqe_length <= first_copy_length)
- return first_copy_length;
+ ret = mlx5_ib_read_user_wqe_common(umem,
+ buffer,
+ buflen,
+ wqe_index,
+ wq->offset,
+ wq->wqe_cnt,
+ wq->wqe_shift,
+ buflen,
+ &bytes_copied);
- ret = ib_umem_copy_from(buffer + first_copy_length, umem, wq->offset,
- wqe_length - first_copy_length);
if (ret)
return ret;
+ *bc = bytes_copied;
+ return 0;
+}
+
+int mlx5_ib_read_user_wqe_srq(struct mlx5_ib_srq *srq,
+ int wqe_index,
+ void *buffer,
+ int buflen,
+ size_t *bc)
+{
+ struct ib_umem *umem = srq->umem;
+ size_t bytes_copied;
+ int ret;
+
+ ret = mlx5_ib_read_user_wqe_common(umem,
+ buffer,
+ buflen,
+ wqe_index,
+ 0,
+ srq->msrq.max,
+ srq->msrq.wqe_shift,
+ buflen,
+ &bytes_copied);
- return wqe_length;
+ if (ret)
+ return ret;
+ *bc = bytes_copied;
+ return 0;
}
static void mlx5_ib_qp_event(struct mlx5_core_qp *qp, int type)
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 08/12] IB/mlx5: Add ODP SRQ support
2019-01-22 6:48 ` Leon Romanovsky
` (7 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
Add changes to the WQE page-fault handler to
1. Identify that the event is for a SRQ WQE
2. Pass SRQ object instead of a QP to the function that reads the WQE
3. Parse the SRQ WQE with respect to its structure
The rest is handled as for regular RQ WQE.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 84 +++++++++++++++++++++++---------
1 file changed, 61 insertions(+), 23 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index cc690aa915de..4ddb22e0059d 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -1070,19 +1070,32 @@ static int mlx5_ib_mr_initiator_pfault_handler(
/*
* Parse responder WQE and set wqe_end to the end of the WQE.
*/
-static int mlx5_ib_mr_responder_pfault_handler(struct mlx5_ib_dev *dev,
- struct mlx5_ib_qp *qp, void *wqe,
- void **wqe_end,
- int wqe_length)
+static int mlx5_ib_mr_responder_pfault_handler_srq(struct mlx5_ib_dev *dev,
+ struct mlx5_ib_srq *srq,
+ void **wqe, void **wqe_end,
+ int wqe_length)
{
- struct mlx5_ib_wq *wq = &qp->rq;
- int wqe_size = 1 << wq->wqe_shift;
+ int wqe_size = 1 << srq->msrq.wqe_shift;
- if (qp->ibqp.srq) {
- mlx5_ib_err(dev, "ODP fault on SRQ is not supported\n");
+ if (wqe_size > wqe_length) {
+ mlx5_ib_err(dev, "Couldn't read all of the receive WQE's content\n");
return -EFAULT;
}
+ *wqe_end = *wqe + wqe_size;
+ *wqe += sizeof(struct mlx5_wqe_srq_next_seg);
+
+ return 0;
+}
+
+static int mlx5_ib_mr_responder_pfault_handler_rq(struct mlx5_ib_dev *dev,
+ struct mlx5_ib_qp *qp,
+ void *wqe, void **wqe_end,
+ int wqe_length)
+{
+ struct mlx5_ib_wq *wq = &qp->rq;
+ int wqe_size = 1 << wq->wqe_shift;
+
if (qp->wq_sig) {
mlx5_ib_err(dev, "ODP fault with WQE signatures is not supported\n");
return -EFAULT;
@@ -1142,6 +1155,14 @@ static inline struct mlx5_ib_qp *res_to_qp(struct mlx5_core_rsc_common *res)
return to_mibqp(mqp);
}
+static inline struct mlx5_ib_srq *res_to_srq(struct mlx5_core_rsc_common *res)
+{
+ struct mlx5_core_srq *msrq =
+ container_of(res, struct mlx5_core_srq, common);
+
+ return to_mibsrq(msrq);
+}
+
static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
struct mlx5_pagefault *pfault)
{
@@ -1152,8 +1173,9 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
int resume_with_error = 1;
u16 wqe_index = pfault->wqe.wqe_index;
int requestor = pfault->type & MLX5_PFAULT_REQUESTOR;
- struct mlx5_core_rsc_common *res;
- struct mlx5_ib_qp *qp;
+ struct mlx5_core_rsc_common *res = NULL;
+ struct mlx5_ib_qp *qp = NULL;
+ struct mlx5_ib_srq *srq = NULL;
size_t bytes_copied;
res = odp_get_rsc(dev, pfault->wqe.wq_num, pfault->type);
@@ -1166,6 +1188,10 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
case MLX5_RES_QP:
qp = res_to_qp(res);
break;
+ case MLX5_RES_SRQ:
+ case MLX5_RES_XSRQ:
+ srq = res_to_srq(res);
+ break;
default:
mlx5_ib_err(dev, "wqe page fault for unsupported type %d\n", pfault->type);
goto resolve_page_fault;
@@ -1177,14 +1203,21 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
goto resolve_page_fault;
}
- if (requestor)
- ret = mlx5_ib_read_user_wqe_sq(qp, wqe_index,
- buffer, PAGE_SIZE,
- &bytes_copied);
- else
- ret = mlx5_ib_read_user_wqe_rq(qp, wqe_index,
- buffer, PAGE_SIZE,
- &bytes_copied);
+ if (qp) {
+ if (requestor) {
+ ret = mlx5_ib_read_user_wqe_sq(qp, wqe_index,
+ buffer, PAGE_SIZE,
+ &bytes_copied);
+ } else {
+ ret = mlx5_ib_read_user_wqe_rq(qp, wqe_index,
+ buffer, PAGE_SIZE,
+ &bytes_copied);
+ }
+ } else {
+ ret = mlx5_ib_read_user_wqe_srq(srq, wqe_index,
+ buffer, PAGE_SIZE,
+ &bytes_copied);
+ }
if (ret) {
mlx5_ib_err(dev, "Failed reading a WQE following page fault, error=%d, wqe_index=%x, qpn=%x\n",
@@ -1194,13 +1227,18 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev,
wqe = buffer;
if (requestor)
- ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp, &wqe,
- &wqe_end,
+ ret = mlx5_ib_mr_initiator_pfault_handler(dev, pfault, qp,
+ &wqe, &wqe_end,
bytes_copied);
+ else if (qp)
+ ret = mlx5_ib_mr_responder_pfault_handler_rq(dev, qp,
+ wqe, &wqe_end,
+ bytes_copied);
else
- ret = mlx5_ib_mr_responder_pfault_handler(dev, qp, wqe,
- &wqe_end,
- bytes_copied);
+ ret = mlx5_ib_mr_responder_pfault_handler_srq(dev, srq,
+ &wqe, &wqe_end,
+ bytes_copied);
+
if (ret < 0)
goto resolve_page_fault;
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 09/12] IB/mlx5: Advertise SRQ ODP support for supported transports
2019-01-22 6:48 ` Leon Romanovsky
` (8 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
ODP support in SRQ is per transport capability. Based on device
capabilities set this flag in device structure for future queries.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 4ddb22e0059d..6d2ed8c6ed17 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -315,6 +315,9 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
if (MLX5_CAP_ODP(dev->mdev, ud_odp_caps.send))
caps->per_transport_caps.ud_odp_caps |= IB_ODP_SUPPORT_SEND;
+ if (MLX5_CAP_ODP(dev->mdev, ud_odp_caps.srq_receive))
+ caps->per_transport_caps.ud_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
+
if (MLX5_CAP_ODP(dev->mdev, rc_odp_caps.send))
caps->per_transport_caps.rc_odp_caps |= IB_ODP_SUPPORT_SEND;
@@ -330,6 +333,9 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
if (MLX5_CAP_ODP(dev->mdev, rc_odp_caps.atomic))
caps->per_transport_caps.rc_odp_caps |= IB_ODP_SUPPORT_ATOMIC;
+ if (MLX5_CAP_ODP(dev->mdev, rc_odp_caps.srq_receive))
+ caps->per_transport_caps.rc_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
+
if (MLX5_CAP_GEN(dev->mdev, fixed_buffer_size) &&
MLX5_CAP_GEN(dev->mdev, null_mkey) &&
MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset))
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH mlx5-next 10/12] net/mlx5: Add XRC transport to ODP device capabilities layout
2019-01-22 6:48 ` Leon Romanovsky
` (9 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
The device capabilities for ODP structure was missing the field for XRC
transport so add it here.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
include/linux/mlx5/mlx5_ifc.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 35fe5217b244..5407db8ba8e1 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -831,7 +831,9 @@ struct mlx5_ifc_odp_cap_bits {
struct mlx5_ifc_odp_per_transport_service_cap_bits ud_odp_caps;
- u8 reserved_at_e0[0x720];
+ struct mlx5_ifc_odp_per_transport_service_cap_bits xrc_odp_caps;
+
+ u8 reserved_at_100[0x700];
};
struct mlx5_ifc_calc_op {
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH rdma-next 11/12] IB/mlx5: Advertise XRC ODP support
2019-01-22 6:48 ` Leon Romanovsky
` (10 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
Query all per transport caps for XRC and set the appropriate bits in the
per transport field of the advertised struct.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/infiniband/hw/mlx5/odp.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c
index 6d2ed8c6ed17..d3fdc0853b4b 100644
--- a/drivers/infiniband/hw/mlx5/odp.c
+++ b/drivers/infiniband/hw/mlx5/odp.c
@@ -336,6 +336,24 @@ void mlx5_ib_internal_fill_odp_caps(struct mlx5_ib_dev *dev)
if (MLX5_CAP_ODP(dev->mdev, rc_odp_caps.srq_receive))
caps->per_transport_caps.rc_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.send))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_SEND;
+
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.receive))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_RECV;
+
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.write))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_WRITE;
+
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.read))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_READ;
+
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.atomic))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_ATOMIC;
+
+ if (MLX5_CAP_ODP(dev->mdev, xrc_odp_caps.srq_receive))
+ caps->per_transport_caps.xrc_odp_caps |= IB_ODP_SUPPORT_SRQ_RECV;
+
if (MLX5_CAP_GEN(dev->mdev, fixed_buffer_size) &&
MLX5_CAP_GEN(dev->mdev, null_mkey) &&
MLX5_CAP_GEN(dev->mdev, umr_extended_translation_offset))
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-01-22 6:48 ` Leon Romanovsky
` (11 preceding siblings ...)
(?)
@ 2019-01-22 6:48 ` Leon Romanovsky
2019-01-31 23:28 ` Jason Gunthorpe
2019-02-04 23:47 ` Saeed Mahameed
-1 siblings, 2 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-22 6:48 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: Leon Romanovsky, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
From: Moni Shoua <monis@mellanox.com>
To avoid compatibility issue with older kernels the firmware doesn't
allow SRQ to work with ODP unless kernel asks for it.
Signed-off-by: Moni Shoua <monis@mellanox.com>
Reviewed-by: Majd Dibbiny <majd@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
.../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++++++++++++++++
include/linux/mlx5/device.h | 3 ++
include/linux/mlx5/mlx5_ifc.h | 1 +
3 files changed, 57 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index be81b319b0dc..b3a76df0cf6c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
return err;
}
+static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
+{
+ void *set_ctx;
+ void *set_hca_cap;
+ int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
+ int err;
+
+ if (!MLX5_CAP_GEN(dev, pg))
+ return 0;
+
+ err = mlx5_core_get_caps(dev, MLX5_CAP_ODP);
+ if (err)
+ return err;
+
+ /**
+ * If all bits are cleared we shouldn't try to set it
+ * or we might fail while trying to access a reserved bit.
+ */
+ if (!(MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive) ||
+ MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive) ||
+ MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)))
+ return 0;
+
+ set_ctx = kzalloc(set_sz, GFP_KERNEL);
+ if (!set_ctx)
+ return -ENOMEM;
+
+ set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability);
+ memcpy(set_hca_cap, dev->caps.hca_cur[MLX5_CAP_ODP],
+ MLX5_ST_SZ_BYTES(odp_cap));
+
+ /* set ODP SRQ support for RC/UD and XRC transports */
+ MLX5_SET(odp_cap, set_hca_cap, ud_odp_caps.srq_receive,
+ (MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive)));
+
+ MLX5_SET(odp_cap, set_hca_cap, rc_odp_caps.srq_receive,
+ (MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive)));
+
+ MLX5_SET(odp_cap, set_hca_cap, xrc_odp_caps.srq_receive,
+ (MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)));
+
+ err = set_caps(dev, set_ctx, set_sz, MLX5_SET_HCA_CAP_OP_MOD_ODP);
+
+ kfree(set_ctx);
+ return err;
+}
+
static int handle_hca_cap(struct mlx5_core_dev *dev)
{
void *set_ctx = NULL;
@@ -926,6 +973,12 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
goto reclaim_boot_pages;
}
+ err = handle_hca_cap_odp(dev);
+ if (err) {
+ dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
+ goto reclaim_boot_pages;
+ }
+
err = mlx5_satisfy_startup_pages(dev, 0);
if (err) {
dev_err(&pdev->dev, "failed to allocate init pages\n");
diff --git a/include/linux/mlx5/device.h b/include/linux/mlx5/device.h
index 8c4a820bd4c1..0845a227a7b2 100644
--- a/include/linux/mlx5/device.h
+++ b/include/linux/mlx5/device.h
@@ -1201,6 +1201,9 @@ enum mlx5_qcam_feature_groups {
#define MLX5_CAP_ODP(mdev, cap)\
MLX5_GET(odp_cap, mdev->caps.hca_cur[MLX5_CAP_ODP], cap)
+#define MLX5_CAP_ODP_MAX(mdev, cap)\
+ MLX5_GET(odp_cap, mdev->caps.hca_max[MLX5_CAP_ODP], cap)
+
#define MLX5_CAP_VECTOR_CALC(mdev, cap) \
MLX5_GET(vector_calc_cap, \
mdev->caps.hca_cur[MLX5_CAP_VECTOR_CALC], cap)
diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
index 5407db8ba8e1..c5c679390fbd 100644
--- a/include/linux/mlx5/mlx5_ifc.h
+++ b/include/linux/mlx5/mlx5_ifc.h
@@ -72,6 +72,7 @@ enum {
enum {
MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE = 0x0,
+ MLX5_SET_HCA_CAP_OP_MOD_ODP = 0x2,
MLX5_SET_HCA_CAP_OP_MOD_ATOMIC = 0x3,
};
--
2.19.1
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
2019-01-22 6:48 ` Leon Romanovsky
` (12 preceding siblings ...)
(?)
@ 2019-01-24 12:25 ` Leon Romanovsky
-1 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-01-24 12:25 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: RDMA mailing list, Majd Dibbiny, Moni Shoua, Saeed Mahameed,
linux-netdev
[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]
On Tue, Jan 22, 2019 at 08:48:39AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> This series extend ODP to work with SRQ and XRC. Being both per-operation
> (e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
> we extend IB/core and mlx5 driver to provide needed information to user space.
>
> Thanks
>
> Moni Shoua (12):
> IB/mlx5: Fix locking SRQ object in ODP event
> IB/core: Allocate bit for SRQ ODP support
> IB/uverbs: Expose XRC ODP device capabilities
> IB/mlx5: Remove useless check in ODP handler
> IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
> IB/mlx5: Add XRC initiator ODP support
> IB/mlx5: Let read user wqe also from SRQ buffer
> IB/mlx5: Add ODP SRQ support
> IB/mlx5: Advertise SRQ ODP support for supported transports
> net/mlx5: Add XRC transport to ODP device capabilities layout
> IB/mlx5: Advertise XRC ODP support
> net/mlx5: Set ODP SRQ support in firmware
Doug, Jason,
Please pay attention that patches below should go to shared branch:
net/mlx5: Add XRC transport to ODP device capabilities layout
net/mlx5: Set ODP SRQ support in firmware
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
2019-01-22 6:48 ` Leon Romanovsky
` (13 preceding siblings ...)
(?)
@ 2019-01-31 23:27 ` Jason Gunthorpe
2019-02-03 10:54 ` Leon Romanovsky
-1 siblings, 1 reply; 24+ messages in thread
From: Jason Gunthorpe @ 2019-01-31 23:27 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Majd Dibbiny,
Moni Shoua, Saeed Mahameed, linux-netdev
On Tue, Jan 22, 2019 at 08:48:39AM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> This series extend ODP to work with SRQ and XRC. Being both per-operation
> (e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
> we extend IB/core and mlx5 driver to provide needed information to user space.
>
> Thanks
>
> Moni Shoua (12):
> IB/mlx5: Fix locking SRQ object in ODP event
> IB/core: Allocate bit for SRQ ODP support
> IB/uverbs: Expose XRC ODP device capabilities
> IB/mlx5: Remove useless check in ODP handler
> IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
> IB/mlx5: Add XRC initiator ODP support
> IB/mlx5: Let read user wqe also from SRQ buffer
> IB/mlx5: Add ODP SRQ support
> IB/mlx5: Advertise SRQ ODP support for supported transports
I applied these patches to for-next
> net/mlx5: Add XRC transport to ODP device capabilities layout
> IB/mlx5: Advertise XRC ODP support
> net/mlx5: Set ODP SRQ support in firmware
This might need some re-organizing - the last patch could be split
(possibly merge with the first) so the header changes can go to the
shared branch, but the handle_hca_cap_odp() stuff must only be applied
to the rdma tree.
I'm fine either way, if you don't want to split it send a commit ID
for the first patch on mlx5-next.
Thanks,
Jason
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-01-22 6:48 ` [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware Leon Romanovsky
@ 2019-01-31 23:28 ` Jason Gunthorpe
2019-02-03 9:03 ` Leon Romanovsky
2019-02-04 23:47 ` Saeed Mahameed
1 sibling, 1 reply; 24+ messages in thread
From: Jason Gunthorpe @ 2019-01-31 23:28 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, Leon Romanovsky, RDMA mailing list, Majd Dibbiny,
Moni Shoua, Saeed Mahameed, linux-netdev
On Tue, Jan 22, 2019 at 08:48:51AM +0200, Leon Romanovsky wrote:
> From: Moni Shoua <monis@mellanox.com>
>
> To avoid compatibility issue with older kernels the firmware doesn't
> allow SRQ to work with ODP unless kernel asks for it.
>
> Signed-off-by: Moni Shoua <monis@mellanox.com>
> Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> .../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++++++++++++++++
> include/linux/mlx5/device.h | 3 ++
> include/linux/mlx5/mlx5_ifc.h | 1 +
> 3 files changed, 57 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index be81b319b0dc..b3a76df0cf6c 100644
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
> return err;
> }
>
> +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> +{
> + void *set_ctx;
> + void *set_hca_cap;
> + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> + int err;
> +
> + if (!MLX5_CAP_GEN(dev, pg))
> + return 0;
Should a
if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING))
return 0;
Be here?
Jason
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-01-31 23:28 ` Jason Gunthorpe
@ 2019-02-03 9:03 ` Leon Romanovsky
2019-02-04 21:23 ` Jason Gunthorpe
0 siblings, 1 reply; 24+ messages in thread
From: Leon Romanovsky @ 2019-02-03 9:03 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Doug Ledford, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
[-- Attachment #1: Type: text/plain, Size: 1612 bytes --]
On Thu, Jan 31, 2019 at 04:28:44PM -0700, Jason Gunthorpe wrote:
> On Tue, Jan 22, 2019 at 08:48:51AM +0200, Leon Romanovsky wrote:
> > From: Moni Shoua <monis@mellanox.com>
> >
> > To avoid compatibility issue with older kernels the firmware doesn't
> > allow SRQ to work with ODP unless kernel asks for it.
> >
> > Signed-off-by: Moni Shoua <monis@mellanox.com>
> > Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > .../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++++++++++++++++
> > include/linux/mlx5/device.h | 3 ++
> > include/linux/mlx5/mlx5_ifc.h | 1 +
> > 3 files changed, 57 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > index be81b319b0dc..b3a76df0cf6c 100644
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
> > return err;
> > }
> >
> > +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> > +{
> > + void *set_ctx;
> > + void *set_hca_cap;
> > + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> > + int err;
> > +
> > + if (!MLX5_CAP_GEN(dev, pg))
> > + return 0;
>
> Should a
>
> if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING))
> return 0;
>
> Be here?
We had similar discussion in mlx5_ib main.c, but here we are talking
about mlx5_core code, which from my point of view should represent the
real HW capabilities without relation to kernel compilation mode.
Thanks
>
> Jason
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
2019-01-31 23:27 ` Jason Gunthorpe
@ 2019-02-03 10:54 ` Leon Romanovsky
2019-02-04 21:53 ` Jason Gunthorpe
0 siblings, 1 reply; 24+ messages in thread
From: Leon Romanovsky @ 2019-02-03 10:54 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Doug Ledford, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
[-- Attachment #1: Type: text/plain, Size: 1688 bytes --]
On Thu, Jan 31, 2019 at 04:27:39PM -0700, Jason Gunthorpe wrote:
> On Tue, Jan 22, 2019 at 08:48:39AM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Hi,
> >
> > This series extend ODP to work with SRQ and XRC. Being both per-operation
> > (e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
> > we extend IB/core and mlx5 driver to provide needed information to user space.
> >
> > Thanks
> >
> > Moni Shoua (12):
> > IB/mlx5: Fix locking SRQ object in ODP event
> > IB/core: Allocate bit for SRQ ODP support
> > IB/uverbs: Expose XRC ODP device capabilities
> > IB/mlx5: Remove useless check in ODP handler
> > IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
> > IB/mlx5: Add XRC initiator ODP support
> > IB/mlx5: Let read user wqe also from SRQ buffer
> > IB/mlx5: Add ODP SRQ support
> > IB/mlx5: Advertise SRQ ODP support for supported transports
>
> I applied these patches to for-next
>
> > net/mlx5: Add XRC transport to ODP device capabilities layout
> > IB/mlx5: Advertise XRC ODP support
> > net/mlx5: Set ODP SRQ support in firmware
>
> This might need some re-organizing - the last patch could be split
> (possibly merge with the first) so the header changes can go to the
> shared branch, but the handle_hca_cap_odp() stuff must only be applied
> to the rdma tree.
>
> I'm fine either way, if you don't want to split it send a commit ID
> for the first patch on mlx5-next.
I applied two following patches,
46861e3e88be net/mlx5: Set ODP SRQ support in firmware
dda7a817f287 net/mlx5: Add XRC transport to ODP device capabilities layout
Thanks
>
> Thanks,
> Jason
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-02-03 9:03 ` Leon Romanovsky
@ 2019-02-04 21:23 ` Jason Gunthorpe
2019-02-04 23:54 ` Saeed Mahameed
0 siblings, 1 reply; 24+ messages in thread
From: Jason Gunthorpe @ 2019-02-04 21:23 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
On Sun, Feb 03, 2019 at 11:03:11AM +0200, Leon Romanovsky wrote:
> On Thu, Jan 31, 2019 at 04:28:44PM -0700, Jason Gunthorpe wrote:
> > On Tue, Jan 22, 2019 at 08:48:51AM +0200, Leon Romanovsky wrote:
> > > From: Moni Shoua <monis@mellanox.com>
> > >
> > > To avoid compatibility issue with older kernels the firmware doesn't
> > > allow SRQ to work with ODP unless kernel asks for it.
> > >
> > > Signed-off-by: Moni Shoua <monis@mellanox.com>
> > > Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > > .../net/ethernet/mellanox/mlx5/core/main.c | 53 +++++++++++++++++++
> > > include/linux/mlx5/device.h | 3 ++
> > > include/linux/mlx5/mlx5_ifc.h | 1 +
> > > 3 files changed, 57 insertions(+)
> > >
> > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > index be81b319b0dc..b3a76df0cf6c 100644
> > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
> > > return err;
> > > }
> > >
> > > +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> > > +{
> > > + void *set_ctx;
> > > + void *set_hca_cap;
> > > + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> > > + int err;
> > > +
> > > + if (!MLX5_CAP_GEN(dev, pg))
> > > + return 0;
> >
> > Should a
> >
> > if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING))
> > return 0;
> >
> > Be here?
>
> We had similar discussion in mlx5_ib main.c, but here we are talking
> about mlx5_core code, which from my point of view should represent the
> real HW capabilities without relation to kernel compilation mode.
This switch is to tell the FW that the mlx5_ib module supports the new
protocol - so having it in core code at all is really weird. I assume
there is some startup sequence reason?
Since the modularity is already wrecked it seems like an odd
reason not to add the if..
Jason
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs
2019-02-03 10:54 ` Leon Romanovsky
@ 2019-02-04 21:53 ` Jason Gunthorpe
0 siblings, 0 replies; 24+ messages in thread
From: Jason Gunthorpe @ 2019-02-04 21:53 UTC (permalink / raw)
To: Leon Romanovsky
Cc: Doug Ledford, RDMA mailing list, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
On Sun, Feb 03, 2019 at 12:54:30PM +0200, Leon Romanovsky wrote:
> On Thu, Jan 31, 2019 at 04:27:39PM -0700, Jason Gunthorpe wrote:
> > On Tue, Jan 22, 2019 at 08:48:39AM +0200, Leon Romanovsky wrote:
> > > From: Leon Romanovsky <leonro@mellanox.com>
> > >
> > > Hi,
> > >
> > > This series extend ODP to work with SRQ and XRC. Being both per-operation
> > > (e.g. RDMA write, RDMA read and atomic) and per-transport (e.g. RC, UD and XRC),
> > > we extend IB/core and mlx5 driver to provide needed information to user space.
> > >
> > > Thanks
> > >
> > > Moni Shoua (12):
> > > IB/mlx5: Fix locking SRQ object in ODP event
> > > IB/core: Allocate bit for SRQ ODP support
> > > IB/uverbs: Expose XRC ODP device capabilities
> > > IB/mlx5: Remove useless check in ODP handler
> > > IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
> > > IB/mlx5: Add XRC initiator ODP support
> > > IB/mlx5: Let read user wqe also from SRQ buffer
> > > IB/mlx5: Add ODP SRQ support
> > > IB/mlx5: Advertise SRQ ODP support for supported transports
> >
> > I applied these patches to for-next
> >
> > > net/mlx5: Add XRC transport to ODP device capabilities layout
> > > IB/mlx5: Advertise XRC ODP support
> > > net/mlx5: Set ODP SRQ support in firmware
> >
> > This might need some re-organizing - the last patch could be split
> > (possibly merge with the first) so the header changes can go to the
> > shared branch, but the handle_hca_cap_odp() stuff must only be applied
> > to the rdma tree.
> >
> > I'm fine either way, if you don't want to split it send a commit ID
> > for the first patch on mlx5-next.
>
> I applied two following patches,
>
> 46861e3e88be net/mlx5: Set ODP SRQ support in firmware
> dda7a817f287 net/mlx5: Add XRC transport to ODP device capabilities layout
Okay, done..
Thanks,
Jason
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-01-22 6:48 ` [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware Leon Romanovsky
2019-01-31 23:28 ` Jason Gunthorpe
@ 2019-02-04 23:47 ` Saeed Mahameed
2019-02-05 6:27 ` Leon Romanovsky
1 sibling, 1 reply; 24+ messages in thread
From: Saeed Mahameed @ 2019-02-04 23:47 UTC (permalink / raw)
To: Jason Gunthorpe, leon, dledford
Cc: Majd Dibbiny, Moni Shoua, Leon Romanovsky, linux-rdma, netdev
On Tue, 2019-01-22 at 08:48 +0200, Leon Romanovsky wrote:
> From: Moni Shoua <monis@mellanox.com>
>
> To avoid compatibility issue with older kernels the firmware doesn't
> allow SRQ to work with ODP unless kernel asks for it.
>
> Signed-off-by: Moni Shoua <monis@mellanox.com>
> Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
> .../net/ethernet/mellanox/mlx5/core/main.c | 53
> +++++++++++++++++++
> include/linux/mlx5/device.h | 3 ++
> include/linux/mlx5/mlx5_ifc.h | 1 +
> 3 files changed, 57 insertions(+)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> index be81b319b0dc..b3a76df0cf6c 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct
> mlx5_core_dev *dev)
> return err;
> }
>
> +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> +{
> + void *set_ctx;
> + void *set_hca_cap;
> + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> + int err;
> +
reversed xmas tree.
> + if (!MLX5_CAP_GEN(dev, pg))
> + return 0;
> +
> + err = mlx5_core_get_caps(dev, MLX5_CAP_ODP);
> + if (err)
> + return err;
> +
> + /**
> + * If all bits are cleared we shouldn't try to set it
> + * or we might fail while trying to access a reserved bit.
> + */
"set them" not "set it" ?
to me this is a redundant comment, the code is self explanatory.
> + if (!(MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive) ||
> + MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive) ||
> + MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)))
> + return 0;
> +
> + set_ctx = kzalloc(set_sz, GFP_KERNEL);
> + if (!set_ctx)
> + return -ENOMEM;
> +
> + set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx,
> capability);
> + memcpy(set_hca_cap, dev->caps.hca_cur[MLX5_CAP_ODP],
> + MLX5_ST_SZ_BYTES(odp_cap));
> +
> + /* set ODP SRQ support for RC/UD and XRC transports */
> + MLX5_SET(odp_cap, set_hca_cap, ud_odp_caps.srq_receive,
> + (MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive)));
> +
> + MLX5_SET(odp_cap, set_hca_cap, rc_odp_caps.srq_receive,
> + (MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive)));
> +
> + MLX5_SET(odp_cap, set_hca_cap, xrc_odp_caps.srq_receive,
> + (MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)));
> +
Redundant parentheses around the 3rd parameter.
> + err = set_caps(dev, set_ctx, set_sz,
> MLX5_SET_HCA_CAP_OP_MOD_ODP);
> +
> + kfree(set_ctx);
> + return err;
> +}
> +
> static int handle_hca_cap(struct mlx5_core_dev *dev)
> {
> void *set_ctx = NULL;
> @@ -926,6 +973,12 @@ static int mlx5_load_one(struct mlx5_core_dev
> *dev, struct mlx5_priv *priv,
> goto reclaim_boot_pages;
> }
>
> + err = handle_hca_cap_odp(dev);
> + if (err) {
> + dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
> + goto reclaim_boot_pages;
> + }
> +
> err = mlx5_satisfy_startup_pages(dev, 0);
> if (err) {
> dev_err(&pdev->dev, "failed to allocate init pages\n");
> diff --git a/include/linux/mlx5/device.h
> b/include/linux/mlx5/device.h
> index 8c4a820bd4c1..0845a227a7b2 100644
> --- a/include/linux/mlx5/device.h
> +++ b/include/linux/mlx5/device.h
> @@ -1201,6 +1201,9 @@ enum mlx5_qcam_feature_groups {
> #define MLX5_CAP_ODP(mdev, cap)\
> MLX5_GET(odp_cap, mdev->caps.hca_cur[MLX5_CAP_ODP], cap)
>
> +#define MLX5_CAP_ODP_MAX(mdev, cap)\
> + MLX5_GET(odp_cap, mdev->caps.hca_max[MLX5_CAP_ODP], cap)
> +
> #define MLX5_CAP_VECTOR_CALC(mdev, cap) \
> MLX5_GET(vector_calc_cap, \
> mdev->caps.hca_cur[MLX5_CAP_VECTOR_CALC], cap)
> diff --git a/include/linux/mlx5/mlx5_ifc.h
> b/include/linux/mlx5/mlx5_ifc.h
> index 5407db8ba8e1..c5c679390fbd 100644
> --- a/include/linux/mlx5/mlx5_ifc.h
> +++ b/include/linux/mlx5/mlx5_ifc.h
> @@ -72,6 +72,7 @@ enum {
>
> enum {
> MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE = 0x0,
> + MLX5_SET_HCA_CAP_OP_MOD_ODP = 0x2,
> MLX5_SET_HCA_CAP_OP_MOD_ATOMIC = 0x3,
> };
>
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-02-04 21:23 ` Jason Gunthorpe
@ 2019-02-04 23:54 ` Saeed Mahameed
0 siblings, 0 replies; 24+ messages in thread
From: Saeed Mahameed @ 2019-02-04 23:54 UTC (permalink / raw)
To: jgg, leon; +Cc: Majd Dibbiny, Moni Shoua, linux-rdma, netdev, dledford
On Mon, 2019-02-04 at 14:23 -0700, Jason Gunthorpe wrote:
> On Sun, Feb 03, 2019 at 11:03:11AM +0200, Leon Romanovsky wrote:
> > On Thu, Jan 31, 2019 at 04:28:44PM -0700, Jason Gunthorpe wrote:
> > > On Tue, Jan 22, 2019 at 08:48:51AM +0200, Leon Romanovsky wrote:
> > > > From: Moni Shoua <monis@mellanox.com>
> > > >
> > > > To avoid compatibility issue with older kernels the firmware
> > > > doesn't
> > > > allow SRQ to work with ODP unless kernel asks for it.
> > > >
> > > > Signed-off-by: Moni Shoua <monis@mellanox.com>
> > > > Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> > > > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > > > .../net/ethernet/mellanox/mlx5/core/main.c | 53
> > > > +++++++++++++++++++
> > > > include/linux/mlx5/device.h | 3 ++
> > > > include/linux/mlx5/mlx5_ifc.h | 1 +
> > > > 3 files changed, 57 insertions(+)
> > > >
> > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > > b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > > index be81b319b0dc..b3a76df0cf6c 100644
> > > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > > > @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct
> > > > mlx5_core_dev *dev)
> > > > return err;
> > > > }
> > > >
> > > > +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> > > > +{
> > > > + void *set_ctx;
> > > > + void *set_hca_cap;
> > > > + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> > > > + int err;
> > > > +
> > > > + if (!MLX5_CAP_GEN(dev, pg))
> > > > + return 0;
> > >
> > > Should a
> > >
> > > if (IS_ENABLED(CONFIG_INFINIBAND_ON_DEMAND_PAGING))
> > > return 0;
> > >
> > > Be here?
> >
> > We had similar discussion in mlx5_ib main.c, but here we are
> > talking
> > about mlx5_core code, which from my point of view should represent
> > the
> > real HW capabilities without relation to kernel compilation mode.
>
> This switch is to tell the FW that the mlx5_ib module supports the
> new
> protocol - so having it in core code at all is really weird. I assume
> there is some startup sequence reason?
>
Yes, sadly this must be in startup, set_hca_cap requests must come
prior to init_hca command.
> Since the modularity is already wrecked it seems like an odd
> reason not to add the if..
>
Agree, even better, let's compile out the whole function. I would even
consider having a separate file in mlx5/core for IB related start-up
procedures :).
> Jason
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware
2019-02-04 23:47 ` Saeed Mahameed
@ 2019-02-05 6:27 ` Leon Romanovsky
0 siblings, 0 replies; 24+ messages in thread
From: Leon Romanovsky @ 2019-02-05 6:27 UTC (permalink / raw)
To: Saeed Mahameed
Cc: Jason Gunthorpe, dledford, Majd Dibbiny, Moni Shoua, linux-rdma, netdev
[-- Attachment #1: Type: text/plain, Size: 1371 bytes --]
On Mon, Feb 04, 2019 at 11:47:23PM +0000, Saeed Mahameed wrote:
> On Tue, 2019-01-22 at 08:48 +0200, Leon Romanovsky wrote:
> > From: Moni Shoua <monis@mellanox.com>
> >
> > To avoid compatibility issue with older kernels the firmware doesn't
> > allow SRQ to work with ODP unless kernel asks for it.
> >
> > Signed-off-by: Moni Shoua <monis@mellanox.com>
> > Reviewed-by: Majd Dibbiny <majd@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> > .../net/ethernet/mellanox/mlx5/core/main.c | 53
> > +++++++++++++++++++
> > include/linux/mlx5/device.h | 3 ++
> > include/linux/mlx5/mlx5_ifc.h | 1 +
> > 3 files changed, 57 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > index be81b319b0dc..b3a76df0cf6c 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
> > @@ -459,6 +459,53 @@ static int handle_hca_cap_atomic(struct
> > mlx5_core_dev *dev)
> > return err;
> > }
> >
> > +static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
> > +{
> > + void *set_ctx;
> > + void *set_hca_cap;
> > + int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
> > + int err;
> > +
>
> reversed xmas tree.
I'll send followup to address your comments.
Thanks
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2019-02-05 6:27 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-22 6:48 [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs Leon Romanovsky
2019-01-22 6:48 ` Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 01/12] IB/mlx5: Fix locking SRQ object in ODP event Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 02/12] IB/core: Allocate bit for SRQ ODP support Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 03/12] IB/uverbs: Expose XRC ODP device capabilities Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 04/12] IB/mlx5: Remove useless check in ODP handler Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 05/12] IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 06/12] IB/mlx5: Add XRC initiator ODP support Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 07/12] IB/mlx5: Let read user wqe also from SRQ buffer Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 08/12] IB/mlx5: Add ODP SRQ support Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 09/12] IB/mlx5: Advertise SRQ ODP support for supported transports Leon Romanovsky
2019-01-22 6:48 ` [PATCH mlx5-next 10/12] net/mlx5: Add XRC transport to ODP device capabilities layout Leon Romanovsky
2019-01-22 6:48 ` [PATCH rdma-next 11/12] IB/mlx5: Advertise XRC ODP support Leon Romanovsky
2019-01-22 6:48 ` [PATCH mlx5-next 12/12] net/mlx5: Set ODP SRQ support in firmware Leon Romanovsky
2019-01-31 23:28 ` Jason Gunthorpe
2019-02-03 9:03 ` Leon Romanovsky
2019-02-04 21:23 ` Jason Gunthorpe
2019-02-04 23:54 ` Saeed Mahameed
2019-02-04 23:47 ` Saeed Mahameed
2019-02-05 6:27 ` Leon Romanovsky
2019-01-24 12:25 ` [PATCH rdma-next 00/12] Add SRQ and XRC support for ODP MRs Leon Romanovsky
2019-01-31 23:27 ` Jason Gunthorpe
2019-02-03 10:54 ` Leon Romanovsky
2019-02-04 21:53 ` Jason Gunthorpe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.