rds: make v3.1 as compat version
authorSantosh Shilimkar <santosh.shilimkar@oracle.com>
Sat, 13 Oct 2018 12:34:42 +0000 (20:34 +0800)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Mon, 4 Feb 2019 22:59:11 +0000 (14:59 -0800)
Mark RDSv3.1 as compat version and add v4.1 version macro's.
Subsequent patches enable TOS(Type of Service) feature which is
tied with v4.1 for RDMA transport.

Reviewed-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
[yanjun.zhu@oracle.com: Adapted original patch with ipv6 changes]
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
net/rds/connection.c
net/rds/ib_cm.c
net/rds/rds.h
net/rds/threads.c

index 3bd2f4a5a30d9eccc83f3242db0a59031d5ac5a3..1ab14b68ecc8ccfb63ef32eee7cffe8051f3db01 100644 (file)
@@ -139,6 +139,7 @@ static void __rds_conn_path_init(struct rds_connection *conn,
        atomic_set(&cp->cp_state, RDS_CONN_DOWN);
        cp->cp_send_gen = 0;
        cp->cp_reconnect_jiffies = 0;
+       cp->cp_conn->c_proposed_version = RDS_PROTOCOL_VERSION;
        INIT_DELAYED_WORK(&cp->cp_send_w, rds_send_worker);
        INIT_DELAYED_WORK(&cp->cp_recv_w, rds_recv_worker);
        INIT_DELAYED_WORK(&cp->cp_conn_w, rds_connect_worker);
index bfbb31f0c7fd9a83a90a954c7eabc69780615788..0eeae0910f06ff55afe2dc305b48b416d15a8992 100644 (file)
@@ -133,23 +133,24 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
                rds_ib_set_flow_control(conn, be32_to_cpu(credit));
        }
 
-       if (conn->c_version < RDS_PROTOCOL(3, 1)) {
-               pr_notice("RDS/IB: Connection <%pI6c,%pI6c> version %u.%u no longer supported\n",
-                         &conn->c_laddr, &conn->c_faddr,
-                         RDS_PROTOCOL_MAJOR(conn->c_version),
-                         RDS_PROTOCOL_MINOR(conn->c_version));
-               set_bit(RDS_DESTROY_PENDING, &conn->c_path[0].cp_flags);
-               rds_conn_destroy(conn);
-               return;
-       } else {
-               pr_notice("RDS/IB: %s conn connected <%pI6c,%pI6c> version %u.%u%s\n",
-                         ic->i_active_side ? "Active" : "Passive",
-                         &conn->c_laddr, &conn->c_faddr,
-                         RDS_PROTOCOL_MAJOR(conn->c_version),
-                         RDS_PROTOCOL_MINOR(conn->c_version),
-                         ic->i_flowctl ? ", flow control" : "");
+       if (conn->c_version < RDS_PROTOCOL_VERSION) {
+               if (conn->c_version != RDS_PROTOCOL_COMPAT_VERSION) {
+                       pr_notice("RDS/IB: Connection <%pI6c,%pI6c> version %u.%u no longer supported\n",
+                                 &conn->c_laddr, &conn->c_faddr,
+                                 RDS_PROTOCOL_MAJOR(conn->c_version),
+                                 RDS_PROTOCOL_MINOR(conn->c_version));
+                       rds_conn_destroy(conn);
+                       return;
+               }
        }
 
+       pr_notice("RDS/IB: %s conn connected <%pI6c,%pI6c> version %u.%u%s\n",
+                 ic->i_active_side ? "Active" : "Passive",
+                 &conn->c_laddr, &conn->c_faddr,
+                 RDS_PROTOCOL_MAJOR(conn->c_version),
+                 RDS_PROTOCOL_MINOR(conn->c_version),
+                 ic->i_flowctl ? ", flow control" : "");
+
        atomic_set(&ic->i_cq_quiesce, 0);
 
        /* Init rings and fill recv. this needs to wait until protocol
@@ -184,6 +185,7 @@ void rds_ib_cm_connect_complete(struct rds_connection *conn, struct rdma_cm_even
                                            NULL);
        }
 
+       conn->c_proposed_version = conn->c_version;
        rds_connect_complete(conn);
 }
 
@@ -667,6 +669,9 @@ static u32 rds_ib_protocol_compatible(struct rdma_cm_event *event, bool isv6)
                version = RDS_PROTOCOL_3_0;
                while ((common >>= 1) != 0)
                        version++;
+       } else if (RDS_PROTOCOL_COMPAT_VERSION ==
+                  RDS_PROTOCOL(major, minor)) {
+               version = RDS_PROTOCOL_COMPAT_VERSION;
        } else {
                if (isv6)
                        printk_ratelimited(KERN_NOTICE "RDS: Connection from %pI6c using incompatible protocol version %u.%u\n",
@@ -861,7 +866,7 @@ int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id, bool isv6)
 
        /* If the peer doesn't do protocol negotiation, we must
         * default to RDSv3.0 */
-       rds_ib_set_protocol(conn, RDS_PROTOCOL_3_0);
+       rds_ib_set_protocol(conn, RDS_PROTOCOL_VERSION);
        ic->i_flowctl = rds_ib_sysctl_flow_control;     /* advertise flow control */
 
        ret = rds_ib_setup_qp(conn);
@@ -870,7 +875,8 @@ int rds_ib_cm_initiate_connect(struct rdma_cm_id *cm_id, bool isv6)
                goto out;
        }
 
-       rds_ib_cm_fill_conn_param(conn, &conn_param, &dp, RDS_PROTOCOL_VERSION,
+       rds_ib_cm_fill_conn_param(conn, &conn_param, &dp,
+                                 conn->c_proposed_version,
                                  UINT_MAX, UINT_MAX, isv6);
        ret = rdma_connect(cm_id, &conn_param);
        if (ret)
index 4ffe100ff5e697847c2631933a17155443b82f4b..660023f08553b5eb2f29631c8451b0532f25d45e 100644 (file)
  */
 #define RDS_PROTOCOL_3_0       0x0300
 #define RDS_PROTOCOL_3_1       0x0301
+#define RDS_PROTOCOL_4_0       0x0400
+#define RDS_PROTOCOL_4_1       0x0401
 #define RDS_PROTOCOL_VERSION   RDS_PROTOCOL_3_1
 #define RDS_PROTOCOL_MAJOR(v)  ((v) >> 8)
 #define RDS_PROTOCOL_MINOR(v)  ((v) & 255)
 #define RDS_PROTOCOL(maj, min) (((maj) << 8) | min)
+#define RDS_PROTOCOL_COMPAT_VERSION    RDS_PROTOCOL_3_1
 
 /* The following ports, 16385, 18634, 18635, are registered with IANA as
  * the ports to be used for RDS over TCP and UDP.  Currently, only RDS over
@@ -151,6 +154,7 @@ struct rds_connection {
        struct rds_cong_map     *c_fcong;
 
        /* Protocol version */
+       unsigned int            c_proposed_version;
        unsigned int            c_version;
        possible_net_t          c_net;
 
index e64f9e4c3cdaf6c0f7c566421241b659c0603a69..32dc50f0a303118a151dc6f451ae7debe4e301bb 100644 (file)
@@ -93,6 +93,7 @@ void rds_connect_path_complete(struct rds_conn_path *cp, int curr)
                queue_delayed_work(rds_wq, &cp->cp_recv_w, 0);
        }
        rcu_read_unlock();
+       cp->cp_conn->c_proposed_version = RDS_PROTOCOL_VERSION;
 }
 EXPORT_SYMBOL_GPL(rds_connect_path_complete);