From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>, linux-rdma@vger.kernel.org
Subject: [PATCH rdma-core 09/12] librdmacm: Implement ECE handshake logic
Date: Mon, 20 Apr 2020 17:06:45 +0300 [thread overview]
Message-ID: <20200420140648.275554-10-leon@kernel.org> (raw)
In-Reply-To: <20200420140648.275554-1-leon@kernel.org>
From: Leon Romanovsky <leonro@mellanox.com>
Perform ECE handshake through REQ/REP messages. The REQ message
initiated by active side towards passive side and carries the
ECE data. The passive side returns its decision in REP message.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
librdmacm/cma.c | 46 ++++++++++++++++++++++++++++++++++------
librdmacm/rdma_cma_abi.h | 1 +
2 files changed, 40 insertions(+), 7 deletions(-)
diff --git a/librdmacm/cma.c b/librdmacm/cma.c
index fc6e6a89..db562496 100644
--- a/librdmacm/cma.c
+++ b/librdmacm/cma.c
@@ -1398,10 +1398,20 @@ static int init_ece(struct rdma_cm_id *id, struct ibv_qp *qp)
id_priv->local_ece.vendor_id = ece.vendor_id;
id_priv->local_ece.options = ece.options;
+ if (!id_priv->remote_ece.vendor_id)
+ return 0;
+
+ /* This QP was created due to REQ event */
+ ece.vendor_id = id_priv->remote_ece.vendor_id;
+ ece.options = id_priv->remote_ece.options;
+ ret = ibv_set_ece(qp, &ece);
+ if (ret)
+ return (errno == ECONNREFUSED) ? errno : 0;
+
+ id_priv->local_ece.options = ece.options;
return 0;
}
-
int rdma_create_qp_ex(struct rdma_cm_id *id,
struct ibv_qp_init_attr_ex *attr)
{
@@ -2070,8 +2080,8 @@ static int ucma_query_req_info(struct rdma_cm_id *id)
return 0;
}
-static int ucma_process_conn_req(struct cma_event *evt,
- uint32_t handle)
+static int ucma_process_conn_req(struct cma_event *evt, uint32_t handle,
+ struct ucma_abi_ece *ece)
{
struct cma_id_private *id_priv;
int ret;
@@ -2091,6 +2101,8 @@ static int ucma_process_conn_req(struct cma_event *evt,
ucma_insert_id(id_priv);
id_priv->initiator_depth = evt->event.param.conn.initiator_depth;
id_priv->responder_resources = evt->event.param.conn.responder_resources;
+ id_priv->remote_ece.vendor_id = ece->vendor_id;
+ id_priv->remote_ece.options = ece->attr_mod;
if (evt->id_priv->sync) {
ret = rdma_migrate_id(&id_priv->id, NULL);
@@ -2139,6 +2151,26 @@ err:
return ret;
}
+static int ucma_process_conn_resp_ece(struct cma_id_private *id_priv,
+ struct ucma_abi_ece *ece)
+{
+ struct ibv_ece ibv_ece = { .vendor_id = ece->vendor_id,
+ .options = ece->attr_mod };
+ int ret;
+
+ ret = ibv_set_ece(id_priv->id.qp, &ibv_ece);
+ if (ret && errno == EOPNOTSUPP)
+ goto out;
+
+ if (ret && errno == ECONNREFUSED)
+ /* libibverbs provider asked to reject connection */
+ return -1;
+
+ id_priv->local_ece.options = ibv_ece.options;
+out:
+ return ucma_process_conn_resp(id_priv);
+}
+
static int ucma_process_join(struct cma_event *evt)
{
evt->mc->mgid = evt->event.param.ud.ah_attr.grh.dgid;
@@ -2275,7 +2307,7 @@ retry:
else
ucma_copy_conn_event(evt, &resp.param.conn);
- ret = ucma_process_conn_req(evt, resp.id);
+ ret = ucma_process_conn_req(evt, resp.id, &resp.ece);
if (ret)
goto retry;
break;
@@ -2284,8 +2316,8 @@ retry:
if (!evt->id_priv->id.qp) {
evt->event.event = RDMA_CM_EVENT_CONNECT_RESPONSE;
} else {
- evt->event.status =
- ucma_process_conn_resp(evt->id_priv);
+ evt->event.status = ucma_process_conn_resp_ece(
+ evt->id_priv, &resp.ece);
if (!evt->event.status)
evt->event.event = RDMA_CM_EVENT_ESTABLISHED;
else {
@@ -2635,7 +2667,7 @@ int rdma_get_remote_ece(struct rdma_cm_id *id, struct ibv_ece *ece)
{
struct cma_id_private *id_priv;
- if (id->qp || !ece)
+ if (!id || id->qp || !ece)
return ERR(EINVAL);
id_priv = container_of(id, struct cma_id_private, id);
diff --git a/librdmacm/rdma_cma_abi.h b/librdmacm/rdma_cma_abi.h
index 911863cc..f24417dd 100644
--- a/librdmacm/rdma_cma_abi.h
+++ b/librdmacm/rdma_cma_abi.h
@@ -334,6 +334,7 @@ struct ucma_abi_event_resp {
struct ucma_abi_conn_param conn;
struct ucma_abi_ud_param ud;
} param;
+ struct ucma_abi_ece ece;
};
struct ucma_abi_set_option {
--
2.25.2
next prev parent reply other threads:[~2020-04-20 14:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-20 14:06 [PATCH rdma-core 00/12] Add Enhanced Connection Established (ECE) APIs Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 01/12] Update kernel headers Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 02/12] libibverbs: Add interfaces to configure and use ECE Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 03/12] libibverbs: Document ECE API Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 04/12] debian: Install all available librdmacm man pages Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 05/12] librdmacm: Provide interface to use ECE for external QPs Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 06/12] librdmacm: Connect rdma_connect to the ECE Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 07/12] librdmacm: Return ECE results through rdma_accept Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 08/12] librdmacm: Add an option to reject ECE request Leon Romanovsky
2020-04-20 14:06 ` Leon Romanovsky [this message]
2020-04-20 14:06 ` [PATCH rdma-core 10/12] librdmacm: Document ECE API Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 11/12] pyverbs: Add support for ECE Leon Romanovsky
2020-04-20 14:06 ` [PATCH rdma-core 12/12] tests: Add test for rdmacm ECE mechanism Leon Romanovsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200420140648.275554-10-leon@kernel.org \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@mellanox.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.