Skip to content

Commit 77dd550

Browse files
author
Andy Grover
committed
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>
1 parent e32b4a7 commit 77dd550

8 files changed

Lines changed: 13 additions & 106 deletions

File tree

‎net/rds/ib.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ struct rds_transport rds_ib_transport = {
265265
.laddr_check = rds_ib_laddr_check,
266266
.xmit_complete = rds_ib_xmit_complete,
267267
.xmit = rds_ib_xmit,
268-
.xmit_cong_map = NULL,
269268
.xmit_rdma = rds_ib_xmit_rdma,
270269
.xmit_atomic = rds_ib_xmit_atomic,
271270
.recv = rds_ib_recv,

‎net/rds/iw.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ struct rds_transport rds_iw_transport = {
264264
.laddr_check = rds_iw_laddr_check,
265265
.xmit_complete = rds_iw_xmit_complete,
266266
.xmit = rds_iw_xmit,
267-
.xmit_cong_map = NULL,
268267
.xmit_rdma = rds_iw_xmit_rdma,
269268
.recv = rds_iw_recv,
270269
.conn_alloc = rds_iw_conn_alloc,

‎net/rds/loop.c‎

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm,
6161
unsigned int hdr_off, unsigned int sg,
6262
unsigned int off)
6363
{
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+
6470
BUG_ON(hdr_off || sg || off);
6571

6672
rds_inc_init(&rm->m_inc, conn, conn->c_laddr);
@@ -88,18 +94,6 @@ static void rds_loop_inc_free(struct rds_incoming *inc)
8894
rds_message_put(rm);
8995
}
9096

91-
static 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-
10397
/* we need to at least give the thread something to succeed */
10498
static int rds_loop_recv(struct rds_connection *conn)
10599
{
@@ -180,7 +174,6 @@ void rds_loop_exit(void)
180174
*/
181175
struct rds_transport rds_loop_transport = {
182176
.xmit = rds_loop_xmit,
183-
.xmit_cong_map = rds_loop_xmit_cong_map,
184177
.recv = rds_loop_recv,
185178
.conn_alloc = rds_loop_conn_alloc,
186179
.conn_free = rds_loop_conn_free,

‎net/rds/rds.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,6 @@ struct rds_notifier {
393393
* transport is responsible for other serialization, including
394394
* rds_recv_incoming(). This is called in process context but
395395
* 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.
400396
*/
401397

402398
#define RDS_TRANS_IB 0
@@ -420,8 +416,6 @@ struct rds_transport {
420416
void (*xmit_complete)(struct rds_connection *conn);
421417
int (*xmit)(struct rds_connection *conn, struct rds_message *rm,
422418
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);
425419
int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op);
426420
int (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op);
427421
int (*recv)(struct rds_connection *conn);

‎net/rds/send.c‎

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -147,41 +147,16 @@ int rds_send_xmit(struct rds_connection *conn)
147147
/*
148148
* If between sending messages, we can send a pending congestion
149149
* 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.
154150
*/
155151
if (!rm && test_and_clear_bit(0, &conn->c_map_queued)) {
156-
if (conn->c_trans->xmit_cong_map) {
157-
unsigned long map_offset = 0;
158-
unsigned long map_bytes = sizeof(struct rds_header) +
159-
RDS_CONG_MAP_BYTES;
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;
152+
rm = rds_cong_update_alloc(conn);
153+
if (IS_ERR(rm)) {
154+
ret = PTR_ERR(rm);
155+
break;
184156
}
157+
rm->data.op_active = 1;
158+
159+
conn->c_xmit_rm = rm;
185160
}
186161

187162
/*

‎net/rds/tcp.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ struct rds_transport rds_tcp_transport = {
258258
.laddr_check = rds_tcp_laddr_check,
259259
.xmit_prepare = rds_tcp_xmit_prepare,
260260
.xmit_complete = rds_tcp_xmit_complete,
261-
.xmit_cong_map = rds_tcp_xmit_cong_map,
262261
.xmit = rds_tcp_xmit,
263262
.recv = rds_tcp_recv,
264263
.conn_alloc = rds_tcp_conn_alloc,

‎net/rds/tcp.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ void rds_tcp_xmit_complete(struct rds_connection *conn);
8080
int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
8181
unsigned int hdr_off, unsigned int sg, unsigned int off);
8282
void rds_tcp_write_space(struct sock *sk);
83-
int rds_tcp_xmit_cong_map(struct rds_connection *conn,
84-
struct rds_cong_map *map, unsigned long offset);
8583

8684
/* tcp_stats.c */
8785
DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);

‎net/rds/tcp_send.c‎

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -76,56 +76,6 @@ int rds_tcp_sendmsg(struct socket *sock, void *data, unsigned int len)
7676
return kernel_sendmsg(sock, &msg, &vec, 1, vec.iov_len);
7777
}
7878

79-
/* the core send_sem serializes this with other xmit and shutdown */
80-
int 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-
12979
/* the core send_sem serializes this with other xmit and shutdown */
13080
int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
13181
unsigned int hdr_off, unsigned int sg, unsigned int off)

0 commit comments

Comments
 (0)