RDS: Stop supporting old cong map sending method
authorAndy Grover <andy.grover@oracle.com>
Mon, 22 Mar 2010 22:22:04 +0000 (15:22 -0700)
committerAndy Grover <andy.grover@oracle.com>
Thu, 9 Sep 2010 01:12:10 +0000 (18:12 -0700)
We now ask the transport to give us a rm for the congestion
map, and then we handle it normally. Previously, the
transport defined a function that we would call to send
a congestion map.

Convert TCP and loop transports to new cong map method.

Signed-off-by: Andy Grover <andy.grover@oracle.com>
net/rds/ib.c
net/rds/iw.c
net/rds/loop.c
net/rds/rds.h
net/rds/send.c
net/rds/tcp.c
net/rds/tcp.h
net/rds/tcp_send.c

index 932dacbdbea1be67d6331b366fed0cb7a34ce5ce..927c481b52452fed30f992ede510147dce8b33f3 100644 (file)
@@ -265,7 +265,6 @@ struct rds_transport rds_ib_transport = {
        .laddr_check            = rds_ib_laddr_check,
        .xmit_complete          = rds_ib_xmit_complete,
        .xmit                   = rds_ib_xmit,
-       .xmit_cong_map          = NULL,
        .xmit_rdma              = rds_ib_xmit_rdma,
        .xmit_atomic            = rds_ib_xmit_atomic,
        .recv                   = rds_ib_recv,
index e766aecd46c97771d163817807f3198a040fb51f..467790da1316ad86e8e617ea9239c249d5a72157 100644 (file)
@@ -264,7 +264,6 @@ struct rds_transport rds_iw_transport = {
        .laddr_check            = rds_iw_laddr_check,
        .xmit_complete          = rds_iw_xmit_complete,
        .xmit                   = rds_iw_xmit,
-       .xmit_cong_map          = NULL,
        .xmit_rdma              = rds_iw_xmit_rdma,
        .recv                   = rds_iw_recv,
        .conn_alloc             = rds_iw_conn_alloc,
index 4a3dd49315b4c6a594b0c3dfe4aa74474c6e67d6..c390156b426fc936c6b05fd607f4c32ddb1e3a81 100644 (file)
@@ -61,6 +61,12 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm,
                         unsigned int hdr_off, unsigned int sg,
                         unsigned int off)
 {
+       /* Do not send cong updates to loopback */
+       if (rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
+               rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
+               return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
+       }
+
        BUG_ON(hdr_off || sg || off);
 
        rds_inc_init(&rm->m_inc, conn, conn->c_laddr);
@@ -88,18 +94,6 @@ static void rds_loop_inc_free(struct rds_incoming *inc)
         rds_message_put(rm);
 }
 
-static int rds_loop_xmit_cong_map(struct rds_connection *conn,
-                                 struct rds_cong_map *map,
-                                 unsigned long offset)
-{
-       BUG_ON(offset);
-       BUG_ON(map != conn->c_lcong);
-
-       rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
-
-       return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
-}
-
 /* we need to at least give the thread something to succeed */
 static int rds_loop_recv(struct rds_connection *conn)
 {
@@ -180,7 +174,6 @@ void rds_loop_exit(void)
  */
 struct rds_transport rds_loop_transport = {
        .xmit                   = rds_loop_xmit,
-       .xmit_cong_map          = rds_loop_xmit_cong_map,
        .recv                   = rds_loop_recv,
        .conn_alloc             = rds_loop_conn_alloc,
        .conn_free              = rds_loop_conn_free,
index 7291f006f364ab60060aea67873f6dcfcbb398d3..e81d7e47847477c1216f9c815be8daa9e8101e28 100644 (file)
@@ -393,10 +393,6 @@ struct rds_notifier {
  *                 transport is responsible for other serialization, including
  *                 rds_recv_incoming().  This is called in process context but
  *                 should try hard not to block.
- *
- * @xmit_cong_map: This asks the transport to send the local bitmap down the
- *                given connection.  XXX get a better story about the bitmap
- *                flag and header.
  */
 
 #define RDS_TRANS_IB   0
@@ -420,8 +416,6 @@ struct rds_transport {
        void (*xmit_complete)(struct rds_connection *conn);
        int (*xmit)(struct rds_connection *conn, struct rds_message *rm,
                    unsigned int hdr_off, unsigned int sg, unsigned int off);
-       int (*xmit_cong_map)(struct rds_connection *conn,
-                            struct rds_cong_map *map, unsigned long offset);
        int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op);
        int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op);
        int (*recv)(struct rds_connection *conn);
index d1f364e44e36e6496e055c70e001b5f8023d4e15..8a0647af5d95a4557644a190c767fce60a3c6a2b 100644 (file)
@@ -147,41 +147,16 @@ int rds_send_xmit(struct rds_connection *conn)
                /*
                 * If between sending messages, we can send a pending congestion
                 * map update.
-                *
-                * Transports either define a special xmit_cong_map function,
-                * or we allocate a cong_map message and treat it just like any
-                * other send.
                 */
                if (!rm && test_and_clear_bit(0, &conn->c_map_queued)) {
-                       if (conn->c_trans->xmit_cong_map) {
-                               unsigned long map_offset = 0;
-                               unsigned long map_bytes = sizeof(struct rds_header) +
-                                       RDS_CONG_MAP_BYTES;
-
-                               while (map_bytes) {
-                                       ret = conn->c_trans->xmit_cong_map(conn, conn->c_lcong,
-                                                                          map_offset);
-                                       if (ret <= 0) {
-                                               /* too far down the rabbithole! */
-                                               mutex_unlock(&conn->c_send_lock);
-                                               rds_conn_error(conn, "Cong map xmit failed\n");
-                                               goto out;
-                                       }
-
-                                       map_offset += ret;
-                                       map_bytes -= ret;
-                               }
-                       } else {
-                               /* send cong update like a normal rm */
-                               rm = rds_cong_update_alloc(conn);
-                               if (IS_ERR(rm)) {
-                                       ret = PTR_ERR(rm);
-                                       break;
-                               }
-                               rm->data.op_active = 1;
-
-                               conn->c_xmit_rm = rm;
+                       rm = rds_cong_update_alloc(conn);
+                       if (IS_ERR(rm)) {
+                               ret = PTR_ERR(rm);
+                               break;
                        }
+                       rm->data.op_active = 1;
+
+                       conn->c_xmit_rm = rm;
                }
 
                /*
index 831881640e56bb1c20eb743d8d2f5889d4d66a6b..3262992f5f2b24830074bc018f710c0be7a49e16 100644 (file)
@@ -258,7 +258,6 @@ struct rds_transport rds_tcp_transport = {
        .laddr_check            = rds_tcp_laddr_check,
        .xmit_prepare           = rds_tcp_xmit_prepare,
        .xmit_complete          = rds_tcp_xmit_complete,
-       .xmit_cong_map          = rds_tcp_xmit_cong_map,
        .xmit                   = rds_tcp_xmit,
        .recv                   = rds_tcp_recv,
        .conn_alloc             = rds_tcp_conn_alloc,
index c639872bf701b1898bd3dbefb54d74f14a74d968..16b166379ea96377eeaf5c3a97dde59be79dc117 100644 (file)
@@ -80,8 +80,6 @@ void rds_tcp_xmit_complete(struct rds_connection *conn);
 int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
                 unsigned int hdr_off, unsigned int sg, unsigned int off);
 void rds_tcp_write_space(struct sock *sk);
-int rds_tcp_xmit_cong_map(struct rds_connection *conn,
-                         struct rds_cong_map *map, unsigned long offset);
 
 /* tcp_stats.c */
 DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
index 53c1de55f4717161af64ce971ce1cf99e05c658d..2979fb4a4b9aaf8df3b0216d69cac828885df398 100644 (file)
@@ -76,56 +76,6 @@ int rds_tcp_sendmsg(struct socket *sock, void *data, unsigned int len)
        return kernel_sendmsg(sock, &msg, &vec, 1, vec.iov_len);
 }
 
-/* the core send_sem serializes this with other xmit and shutdown */
-int rds_tcp_xmit_cong_map(struct rds_connection *conn,
-                         struct rds_cong_map *map, unsigned long offset)
-{
-       static struct rds_header rds_tcp_map_header = {
-               .h_flags = RDS_FLAG_CONG_BITMAP,
-       };
-       struct rds_tcp_connection *tc = conn->c_transport_data;
-       unsigned long i;
-       int ret;
-       int copied = 0;
-
-       /* Some problem claims cpu_to_be32(constant) isn't a constant. */
-       rds_tcp_map_header.h_len = cpu_to_be32(RDS_CONG_MAP_BYTES);
-
-       if (offset < sizeof(struct rds_header)) {
-               ret = rds_tcp_sendmsg(tc->t_sock,
-                                     (void *)&rds_tcp_map_header + offset,
-                                     sizeof(struct rds_header) - offset);
-               if (ret <= 0)
-                       return ret;
-               offset += ret;
-               copied = ret;
-               if (offset < sizeof(struct rds_header))
-                       return ret;
-       }
-
-       offset -= sizeof(struct rds_header);
-       i = offset / PAGE_SIZE;
-       offset = offset % PAGE_SIZE;
-       BUG_ON(i >= RDS_CONG_MAP_PAGES);
-
-       do {
-               ret = tc->t_sock->ops->sendpage(tc->t_sock,
-                                       virt_to_page(map->m_page_addrs[i]),
-                                       offset, PAGE_SIZE - offset,
-                                       MSG_DONTWAIT);
-               if (ret <= 0)
-                       break;
-               copied += ret;
-               offset += ret;
-               if (offset == PAGE_SIZE) {
-                       offset = 0;
-                       i++;
-               }
-       } while (i < RDS_CONG_MAP_PAGES);
-
-        return copied ? copied : ret;
-}
-
 /* the core send_sem serializes this with other xmit and shutdown */
 int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
                 unsigned int hdr_off, unsigned int sg, unsigned int off)