aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Grover <andy.grover@oracle.com>2010-03-22 18:22:04 -0400
committerAndy Grover <andy.grover@oracle.com>2010-09-08 21:12:10 -0400
commit77dd550e5547846604ff6f90c4dc6bba4414e485 (patch)
treeea37afea7f0d857e01f214f703018426f6d8b920
parente32b4a70495aac6a612e13f4c21db09dd756ff2c (diff)
RDS: Stop supporting old cong map sending method
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>
-rw-r--r--net/rds/ib.c1
-rw-r--r--net/rds/iw.c1
-rw-r--r--net/rds/loop.c19
-rw-r--r--net/rds/rds.h6
-rw-r--r--net/rds/send.c39
-rw-r--r--net/rds/tcp.c1
-rw-r--r--net/rds/tcp.h2
-rw-r--r--net/rds/tcp_send.c50
8 files changed, 13 insertions, 106 deletions
diff --git a/net/rds/ib.c b/net/rds/ib.c
index 932dacbdbea1..927c481b5245 100644
--- a/net/rds/ib.c
+++ b/net/rds/ib.c
@@ -265,7 +265,6 @@ struct rds_transport rds_ib_transport = {
265 .laddr_check = rds_ib_laddr_check, 265 .laddr_check = rds_ib_laddr_check,
266 .xmit_complete = rds_ib_xmit_complete, 266 .xmit_complete = rds_ib_xmit_complete,
267 .xmit = rds_ib_xmit, 267 .xmit = rds_ib_xmit,
268 .xmit_cong_map = NULL,
269 .xmit_rdma = rds_ib_xmit_rdma, 268 .xmit_rdma = rds_ib_xmit_rdma,
270 .xmit_atomic = rds_ib_xmit_atomic, 269 .xmit_atomic = rds_ib_xmit_atomic,
271 .recv = rds_ib_recv, 270 .recv = rds_ib_recv,
diff --git a/net/rds/iw.c b/net/rds/iw.c
index e766aecd46c9..467790da1316 100644
--- a/net/rds/iw.c
+++ b/net/rds/iw.c
@@ -264,7 +264,6 @@ struct rds_transport rds_iw_transport = {
264 .laddr_check = rds_iw_laddr_check, 264 .laddr_check = rds_iw_laddr_check,
265 .xmit_complete = rds_iw_xmit_complete, 265 .xmit_complete = rds_iw_xmit_complete,
266 .xmit = rds_iw_xmit, 266 .xmit = rds_iw_xmit,
267 .xmit_cong_map = NULL,
268 .xmit_rdma = rds_iw_xmit_rdma, 267 .xmit_rdma = rds_iw_xmit_rdma,
269 .recv = rds_iw_recv, 268 .recv = rds_iw_recv,
270 .conn_alloc = rds_iw_conn_alloc, 269 .conn_alloc = rds_iw_conn_alloc,
diff --git a/net/rds/loop.c b/net/rds/loop.c
index 4a3dd49315b4..c390156b426f 100644
--- a/net/rds/loop.c
+++ b/net/rds/loop.c
@@ -61,6 +61,12 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm,
61 unsigned int hdr_off, unsigned int sg, 61 unsigned int hdr_off, unsigned int sg,
62 unsigned int off) 62 unsigned int off)
63{ 63{
64 /* Do not send cong updates to loopback */
65 if (rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
66 rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
67 return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
68 }
69
64 BUG_ON(hdr_off || sg || off); 70 BUG_ON(hdr_off || sg || off);
65 71
66 rds_inc_init(&rm->m_inc, conn, conn->c_laddr); 72 rds_inc_init(&rm->m_inc, conn, conn->c_laddr);
@@ -88,18 +94,6 @@ static void rds_loop_inc_free(struct rds_incoming *inc)
88 rds_message_put(rm); 94 rds_message_put(rm);
89} 95}
90 96
91static int rds_loop_xmit_cong_map(struct rds_connection *conn,
92 struct rds_cong_map *map,
93 unsigned long offset)
94{
95 BUG_ON(offset);
96 BUG_ON(map != conn->c_lcong);
97
98 rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
99
100 return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
101}
102
103/* we need to at least give the thread something to succeed */ 97/* we need to at least give the thread something to succeed */
104static int rds_loop_recv(struct rds_connection *conn) 98static int rds_loop_recv(struct rds_connection *conn)
105{ 99{
@@ -180,7 +174,6 @@ void rds_loop_exit(void)
180 */ 174 */
181struct rds_transport rds_loop_transport = { 175struct rds_transport rds_loop_transport = {
182 .xmit = rds_loop_xmit, 176 .xmit = rds_loop_xmit,
183 .xmit_cong_map = rds_loop_xmit_cong_map,
184 .recv = rds_loop_recv, 177 .recv = rds_loop_recv,
185 .conn_alloc = rds_loop_conn_alloc, 178 .conn_alloc = rds_loop_conn_alloc,
186 .conn_free = rds_loop_conn_free, 179 .conn_free = rds_loop_conn_free,
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 7291f006f364..e81d7e478474 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -393,10 +393,6 @@ struct rds_notifier {
393 * transport is responsible for other serialization, including 393 * transport is responsible for other serialization, including
394 * rds_recv_incoming(). This is called in process context but 394 * rds_recv_incoming(). This is called in process context but
395 * should try hard not to block. 395 * should try hard not to block.
396 *
397 * @xmit_cong_map: This asks the transport to send the local bitmap down the
398 * given connection. XXX get a better story about the bitmap
399 * flag and header.
400 */ 396 */
401 397
402#define RDS_TRANS_IB 0 398#define RDS_TRANS_IB 0
@@ -420,8 +416,6 @@ struct rds_transport {
420 void (*xmit_complete)(struct rds_connection *conn); 416 void (*xmit_complete)(struct rds_connection *conn);
421 int (*xmit)(struct rds_connection *conn, struct rds_message *rm, 417 int (*xmit)(struct rds_connection *conn, struct rds_message *rm,
422 unsigned int hdr_off, unsigned int sg, unsigned int off); 418 unsigned int hdr_off, unsigned int sg, unsigned int off);
423 int (*xmit_cong_map)(struct rds_connection *conn,
424 struct rds_cong_map *map, unsigned long offset);
425 int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op); 419 int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op);
426 int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op); 420 int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op);
427 int (*recv)(struct rds_connection *conn); 421 int (*recv)(struct rds_connection *conn);
diff --git a/net/rds/send.c b/net/rds/send.c
index d1f364e44e36..8a0647af5d95 100644
--- a/net/rds/send.c
+++ b/net/rds/send.c
@@ -147,41 +147,16 @@ int rds_send_xmit(struct rds_connection *conn)
147 /* 147 /*
148 * If between sending messages, we can send a pending congestion 148 * If between sending messages, we can send a pending congestion
149 * map update. 149 * map update.
150 *
151 * Transports either define a special xmit_cong_map function,
152 * or we allocate a cong_map message and treat it just like any
153 * other send.
154 */ 150 */
155 if (!rm && test_and_clear_bit(0, &conn->c_map_queued)) { 151 if (!rm && test_and_clear_bit(0, &conn->c_map_queued)) {
156 if (conn->c_trans->xmit_cong_map) { 152 rm = rds_cong_update_alloc(conn);
157 unsigned long map_offset = 0; 153 if (IS_ERR(rm)) {
158 unsigned long map_bytes = sizeof(struct rds_header) + 154 ret = PTR_ERR(rm);
159 RDS_CONG_MAP_BYTES; 155 break;
160
161 while (map_bytes) {
162 ret = conn->c_trans->xmit_cong_map(conn, conn->c_lcong,
163 map_offset);
164 if (ret <= 0) {
165 /* too far down the rabbithole! */
166 mutex_unlock(&conn->c_send_lock);
167 rds_conn_error(conn, "Cong map xmit failed\n");
168 goto out;
169 }
170
171 map_offset += ret;
172 map_bytes -= ret;
173 }
174 } else {
175 /* send cong update like a normal rm */
176 rm = rds_cong_update_alloc(conn);
177 if (IS_ERR(rm)) {
178 ret = PTR_ERR(rm);
179 break;
180 }
181 rm->data.op_active = 1;
182
183 conn->c_xmit_rm = rm;
184 } 156 }
157 rm->data.op_active = 1;
158
159 conn->c_xmit_rm = rm;
185 } 160 }
186 161
187 /* 162 /*
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 831881640e56..3262992f5f2b 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -258,7 +258,6 @@ struct rds_transport rds_tcp_transport = {
258 .laddr_check = rds_tcp_laddr_check, 258 .laddr_check = rds_tcp_laddr_check,
259 .xmit_prepare = rds_tcp_xmit_prepare, 259 .xmit_prepare = rds_tcp_xmit_prepare,
260 .xmit_complete = rds_tcp_xmit_complete, 260 .xmit_complete = rds_tcp_xmit_complete,
261 .xmit_cong_map = rds_tcp_xmit_cong_map,
262 .xmit = rds_tcp_xmit, 261 .xmit = rds_tcp_xmit,
263 .recv = rds_tcp_recv, 262 .recv = rds_tcp_recv,
264 .conn_alloc = rds_tcp_conn_alloc, 263 .conn_alloc = rds_tcp_conn_alloc,
diff --git a/net/rds/tcp.h b/net/rds/tcp.h
index c639872bf701..16b166379ea9 100644
--- a/net/rds/tcp.h
+++ b/net/rds/tcp.h
@@ -80,8 +80,6 @@ void rds_tcp_xmit_complete(struct rds_connection *conn);
80int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm, 80int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
81 unsigned int hdr_off, unsigned int sg, unsigned int off); 81 unsigned int hdr_off, unsigned int sg, unsigned int off);
82void rds_tcp_write_space(struct sock *sk); 82void rds_tcp_write_space(struct sock *sk);
83int rds_tcp_xmit_cong_map(struct rds_connection *conn,
84 struct rds_cong_map *map, unsigned long offset);
85 83
86/* tcp_stats.c */ 84/* tcp_stats.c */
87DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats); 85DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
diff --git a/net/rds/tcp_send.c b/net/rds/tcp_send.c
index 53c1de55f471..2979fb4a4b9a 100644
--- a/net/rds/tcp_send.c
+++ b/net/rds/tcp_send.c
@@ -77,56 +77,6 @@ int rds_tcp_sendmsg(struct socket *sock, void *data, unsigned int len)
77} 77}
78 78
79/* the core send_sem serializes this with other xmit and shutdown */ 79/* the core send_sem serializes this with other xmit and shutdown */
80int rds_tcp_xmit_cong_map(struct rds_connection *conn,
81 struct rds_cong_map *map, unsigned long offset)
82{
83 static struct rds_header rds_tcp_map_header = {
84 .h_flags = RDS_FLAG_CONG_BITMAP,
85 };
86 struct rds_tcp_connection *tc = conn->c_transport_data;
87 unsigned long i;
88 int ret;
89 int copied = 0;
90
91 /* Some problem claims cpu_to_be32(constant) isn't a constant. */
92 rds_tcp_map_header.h_len = cpu_to_be32(RDS_CONG_MAP_BYTES);
93
94 if (offset < sizeof(struct rds_header)) {
95 ret = rds_tcp_sendmsg(tc->t_sock,
96 (void *)&rds_tcp_map_header + offset,
97 sizeof(struct rds_header) - offset);
98 if (ret <= 0)
99 return ret;
100 offset += ret;
101 copied = ret;
102 if (offset < sizeof(struct rds_header))
103 return ret;
104 }
105
106 offset -= sizeof(struct rds_header);
107 i = offset / PAGE_SIZE;
108 offset = offset % PAGE_SIZE;
109 BUG_ON(i >= RDS_CONG_MAP_PAGES);
110
111 do {
112 ret = tc->t_sock->ops->sendpage(tc->t_sock,
113 virt_to_page(map->m_page_addrs[i]),
114 offset, PAGE_SIZE - offset,
115 MSG_DONTWAIT);
116 if (ret <= 0)
117 break;
118 copied += ret;
119 offset += ret;
120 if (offset == PAGE_SIZE) {
121 offset = 0;
122 i++;
123 }
124 } while (i < RDS_CONG_MAP_PAGES);
125
126 return copied ? copied : ret;
127}
128
129/* the core send_sem serializes this with other xmit and shutdown */
130int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm, 80int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
131 unsigned int hdr_off, unsigned int sg, unsigned int off) 81 unsigned int hdr_off, unsigned int sg, unsigned int off)
132{ 82{