History

rds: rdma: add consumer reject

For legacy protocol version incompatibility with non linux RDS, consumer reject reason being used to convey it to peer. But the choice of reject reason value as '1' was really poor. Anyway for interoperability reasons with shipping products, it needs to be supported. For any future versions, properly encoded reject reason should to be used.

Santosh Shilimkar committed 8 years ago

Commit d021fab1 parent cdc306a3 files · +22 −2Browse files

Unified · Split

3 files
  1. net/rds/ib_cm.c +4 −2
  2. net/rds/rdma_transport.c +12 −0
  3. net/rds/rdma_transport.h +6 −0
net/rds/ib_cm.c+4−2
@@ -734,8 +734,10 @@ int rds_ib_cm_handle_connect(struct rdma_cm_id *cm_id, · 733 unmodified lines
734734
735735 /* Check whether the remote protocol version matches ours. */
736736 version = rds_ib_protocol_compatible(event, isv6);
737− if (!version)
737+ if (!version) {
738+ err = RDS_RDMA_REJ_INCOMPAT;
738739 goto out;
740+ }
739741
740742 dp = event->param.conn.private_data;
741743 if (isv6) {
@@ -851,7 +853,7 @@ out: · 109 unmodified lines
851853 if (conn)
852854 mutex_unlock(&conn->c_cm_lock);
853855 if (err)
854− rdma_reject(cm_id, NULL, 0);
856+ rdma_reject(cm_id, &err, sizeof(int));
855857 return destroy;
856858 }
857859
net/rds/rdma_transport.c+12−0
@@ -51,6 +51,8 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id, · 50 unmodified lines
5151 struct rds_connection *conn = cm_id->context;
5252 struct rds_transport *trans;
5353 int ret = 0;
54+ int *err;
55+ u8 len;
5456
5557 rdsdebug("conn %p id %p handling event %u (%s)\n", conn, cm_id,
5658 event->event, rdma_event_msg(event->event));
@@ -106,8 +108,18 @@ static int rds_rdma_cm_event_handler_cmn(struct rdma_cm_id *cm_id, · 49 unmodified lines
106108 break;
107109
108110 case RDMA_CM_EVENT_REJECTED:
111+ if (!conn)
112+ break;
113+ err = (int *)rdma_consumer_reject_data(cm_id, event, &len);
114+ if (!err || (err && ((*err) == RDS_RDMA_REJ_INCOMPAT))) {
115+ pr_warn("RDS/RDMA: conn <%pI6c, %pI6c> rejected, dropping connection\n",
116+ &conn->c_laddr, &conn->c_faddr);
117+ conn->c_proposed_version = RDS_PROTOCOL_COMPAT_VERSION;
118+ rds_conn_drop(conn);
119+ }
109120 rdsdebug("Connection rejected: %s\n",
110121 rdma_reject_msg(cm_id, event->status));
122+ break;
111123 /* FALLTHROUGH */
112124 case RDMA_CM_EVENT_ADDR_ERROR:
113125 case RDMA_CM_EVENT_ROUTE_ERROR:
net/rds/rdma_transport.h+6−0
@@ -11,6 +11,12 @@ · 10 unmodified lines
1111
1212 #define RDS_RDMA_RESOLVE_TIMEOUT_MS 5000
1313
14+/* Below reject reason is for legacy interoperability issue with non-linux
15+ * RDS endpoints where older version incompatibility is conveyed via value 1.
16+ * For future version(s), proper encoded reject reason should be be used.
17+ */
18+#define RDS_RDMA_REJ_INCOMPAT 1
19+
1420 int rds_rdma_conn_connect(struct rds_connection *conn);
1521 int rds_rdma_cm_event_handler(struct rdma_cm_id *cm_id,
1622 struct rdma_cm_event *event);