linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: [RFC PATCH rdma-core 09/11] librdmacm: Add an option to reject ECE request
Date: Thu,  5 Mar 2020 17:03:54 +0200	[thread overview]
Message-ID: <20200305150356.208843-10-leon@kernel.org> (raw)
In-Reply-To: <20200305150356.208843-1-leon@kernel.org>

From: Leon Romanovsky <leonro@mellanox.com>

IBTA has specific rejected reason for users who doesn't
want proposed ECE options in request messages. Provide special
version (rdma_reject_ece) to mark such rejects.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 debian/librdmacm1.symbols |  1 +
 librdmacm/cma.c           | 19 +++++++++++++++++--
 librdmacm/librdmacm.map   |  1 +
 librdmacm/rdma_cma.h      |  8 ++++++++
 librdmacm/rdma_cma_abi.h  |  7 ++++++-
 5 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/debian/librdmacm1.symbols b/debian/librdmacm1.symbols
index cc4d7a6c..ce5ffd20 100644
--- a/debian/librdmacm1.symbols
+++ b/debian/librdmacm1.symbols
@@ -44,6 +44,7 @@ librdmacm.so.1 librdmacm1 #MINVER#
  rdma_migrate_id@RDMACM_1.0 1.0.15
  rdma_notify@RDMACM_1.0 1.0.15
  rdma_reject@RDMACM_1.0 1.0.15
+ rdma_reject_ece@RDMACM_1.3 28
  rdma_resolve_addr@RDMACM_1.0 1.0.15
  rdma_resolve_route@RDMACM_1.0 1.0.15
  rdma_set_local_ece@RDMACM_1.3 28
diff --git a/librdmacm/cma.c b/librdmacm/cma.c
index 30a5de75..ba8a9a57 100644
--- a/librdmacm/cma.c
+++ b/librdmacm/cma.c
@@ -1735,8 +1735,9 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)
 	return ucma_complete(id);
 }

-int rdma_reject(struct rdma_cm_id *id, const void *private_data,
-		uint8_t private_data_len)
+static int reject_with_reason(struct rdma_cm_id *id, const void *private_data,
+			      uint8_t private_data_len,
+			      enum ucm_abi_reject_reason reason)
 {
 	struct ucma_abi_reject cmd;
 	struct cma_id_private *id_priv;
@@ -1750,6 +1751,7 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
 		memcpy(cmd.private_data, private_data, private_data_len);
 		cmd.private_data_len = private_data_len;
 	}
+	cmd.reason = reason;

 	ret = write(id->channel->fd, &cmd, sizeof cmd);
 	if (ret != sizeof cmd)
@@ -1758,6 +1760,19 @@ int rdma_reject(struct rdma_cm_id *id, const void *private_data,
 	return 0;
 }

+int rdma_reject(struct rdma_cm_id *id, const void *private_data,
+		uint8_t private_data_len)
+{
+	return reject_with_reason(id, private_data, private_data_len, 0);
+}
+
+int rdma_reject_ece(struct rdma_cm_id *id, const void *private_data,
+		    uint8_t private_data_len)
+{
+	return reject_with_reason(id, private_data, private_data_len,
+				  RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED);
+}
+
 int rdma_notify(struct rdma_cm_id *id, enum ibv_event_type event)
 {
 	struct ucma_abi_notify cmd;
diff --git a/librdmacm/librdmacm.map b/librdmacm/librdmacm.map
index f29a23b4..d162ef09 100644
--- a/librdmacm/librdmacm.map
+++ b/librdmacm/librdmacm.map
@@ -86,5 +86,6 @@ RDMACM_1.2 {
 RDMACM_1.3 {
 	global:
 		rdma_get_remote_ece;
+		rdma_reject_ece;
 		rdma_set_local_ece;
 } RDMACM_1.2;
diff --git a/librdmacm/rdma_cma.h b/librdmacm/rdma_cma.h
index c42a28f7..e1f4e236 100644
--- a/librdmacm/rdma_cma.h
+++ b/librdmacm/rdma_cma.h
@@ -524,6 +524,14 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
 int rdma_reject(struct rdma_cm_id *id, const void *private_data,
 		uint8_t private_data_len);

+/**
+ * rdma_reject_ece - Called to reject a connection request with ECE
+ * rejected reason.
+ * The same as rdma_reject()
+ */
+int rdma_reject_ece(struct rdma_cm_id *id, const void *private_data,
+		uint8_t private_data_len);
+
 /**
  * rdma_notify - Notifies the librdmacm of an asynchronous event.
  * @id: RDMA identifier.
diff --git a/librdmacm/rdma_cma_abi.h b/librdmacm/rdma_cma_abi.h
index 4639941b..911863cc 100644
--- a/librdmacm/rdma_cma_abi.h
+++ b/librdmacm/rdma_cma_abi.h
@@ -73,6 +73,10 @@ enum {
 	UCMA_CMD_JOIN_MCAST
 };

+enum ucm_abi_reject_reason {
+	RDMA_USER_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED = 35
+};
+
 struct ucma_abi_cmd_hdr {
 	__u32 cmd;
 	__u16 in;
@@ -263,7 +267,8 @@ struct ucma_abi_reject {
 	__u16 out;
 	__u32 id;
 	__u8  private_data_len;
-	__u8  reserved[3];
+	__u8  reason; /* enum ucm_abi_reject_reason */
+	__u8  reserved[2];
 	__u8  private_data[RDMA_MAX_PRIVATE_DATA];
 };

--
2.24.1


  parent reply	other threads:[~2020-03-05 15:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 15:03 [RFC PATCH rdma-core 00/11] Add Enhanced Connection Established (ECE) APIs Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 01/11] Update kernel headers Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 02/11] libibverbs: Add interfaces to configure and use ECE Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 03/11] mlx5: Implement ECE callbacks Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 04/11] libibverbs: Document ECE API Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 05/11] debian: Install all available librdmacm man pages Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 06/11] librdmacm: Provide interface to use ECE for external QPs Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 07/11] librdmacm: Connect rdma_connect to the ECE Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 08/11] librdmacm: Return ECE results through rdma_accept Leon Romanovsky
2020-03-05 15:03 ` Leon Romanovsky [this message]
2020-03-05 15:03 ` [RFC PATCH rdma-core 10/11] librdmacm: Implement ECE handshake logic Leon Romanovsky
2020-03-05 15:03 ` [RFC PATCH rdma-core 11/11] librdmacm: Document ECE API 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=20200305150356.208843-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).