Commit 226f7a7d authored by Sowmini Varadhan's avatar Sowmini Varadhan Committed by David S. Miller

RDS: Rework path specific indirections

Refactor code to avoid separate indirections for single-path
and multipath transports. All transports (both single and mp-capable)
will get a pointer to the rds_conn_path, and can trivially derive
the rds_connection from the ->cp_conn.
Acked-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: default avatarSowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent dc9a2002
...@@ -326,9 +326,6 @@ void rds_conn_shutdown(struct rds_conn_path *cp) ...@@ -326,9 +326,6 @@ void rds_conn_shutdown(struct rds_conn_path *cp)
wait_event(cp->cp_waitq, wait_event(cp->cp_waitq,
!test_bit(RDS_RECV_REFILL, &cp->cp_flags)); !test_bit(RDS_RECV_REFILL, &cp->cp_flags));
if (!conn->c_trans->t_mp_capable)
conn->c_trans->conn_shutdown(conn);
else
conn->c_trans->conn_path_shutdown(cp); conn->c_trans->conn_path_shutdown(cp);
rds_conn_path_reset(cp); rds_conn_path_reset(cp);
......
...@@ -381,7 +381,7 @@ void rds_ib_exit(void) ...@@ -381,7 +381,7 @@ void rds_ib_exit(void)
struct rds_transport rds_ib_transport = { struct rds_transport rds_ib_transport = {
.laddr_check = rds_ib_laddr_check, .laddr_check = rds_ib_laddr_check,
.xmit_complete = rds_ib_xmit_complete, .xmit_path_complete = rds_ib_xmit_path_complete,
.xmit = rds_ib_xmit, .xmit = rds_ib_xmit,
.xmit_rdma = rds_ib_xmit_rdma, .xmit_rdma = rds_ib_xmit_rdma,
.xmit_atomic = rds_ib_xmit_atomic, .xmit_atomic = rds_ib_xmit_atomic,
...@@ -389,7 +389,7 @@ struct rds_transport rds_ib_transport = { ...@@ -389,7 +389,7 @@ struct rds_transport rds_ib_transport = {
.conn_alloc = rds_ib_conn_alloc, .conn_alloc = rds_ib_conn_alloc,
.conn_free = rds_ib_conn_free, .conn_free = rds_ib_conn_free,
.conn_connect = rds_ib_conn_connect, .conn_connect = rds_ib_conn_connect,
.conn_shutdown = rds_ib_conn_shutdown, .conn_path_shutdown = rds_ib_conn_path_shutdown,
.inc_copy_to_user = rds_ib_inc_copy_to_user, .inc_copy_to_user = rds_ib_inc_copy_to_user,
.inc_free = rds_ib_inc_free, .inc_free = rds_ib_inc_free,
.cm_initiate_connect = rds_ib_cm_initiate_connect, .cm_initiate_connect = rds_ib_cm_initiate_connect,
......
...@@ -329,7 +329,7 @@ extern struct list_head ib_nodev_conns; ...@@ -329,7 +329,7 @@ extern struct list_head ib_nodev_conns;
int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp); int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp);
void rds_ib_conn_free(void *arg); void rds_ib_conn_free(void *arg);
int rds_ib_conn_connect(struct rds_connection *conn); int rds_ib_conn_connect(struct rds_connection *conn);
void rds_ib_conn_shutdown(struct rds_connection *conn); void rds_ib_conn_path_shutdown(struct rds_conn_path *cp);
void rds_ib_state_change(struct sock *sk); void rds_ib_state_change(struct sock *sk);
int rds_ib_listen_init(void); int rds_ib_listen_init(void);
void rds_ib_listen_stop(void); void rds_ib_listen_stop(void);
...@@ -384,7 +384,7 @@ u32 rds_ib_ring_completed(struct rds_ib_work_ring *ring, u32 wr_id, u32 oldest); ...@@ -384,7 +384,7 @@ u32 rds_ib_ring_completed(struct rds_ib_work_ring *ring, u32 wr_id, u32 oldest);
extern wait_queue_head_t rds_ib_ring_empty_wait; extern wait_queue_head_t rds_ib_ring_empty_wait;
/* ib_send.c */ /* ib_send.c */
void rds_ib_xmit_complete(struct rds_connection *conn); void rds_ib_xmit_path_complete(struct rds_conn_path *cp);
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
unsigned int hdr_off, unsigned int sg, unsigned int off); unsigned int hdr_off, unsigned int sg, unsigned int off);
void rds_ib_send_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc); void rds_ib_send_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc);
......
...@@ -731,8 +731,9 @@ int rds_ib_conn_connect(struct rds_connection *conn) ...@@ -731,8 +731,9 @@ int rds_ib_conn_connect(struct rds_connection *conn)
* so that it can be called at any point during startup. In fact it * so that it can be called at any point during startup. In fact it
* can be called multiple times for a given connection. * can be called multiple times for a given connection.
*/ */
void rds_ib_conn_shutdown(struct rds_connection *conn) void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
{ {
struct rds_connection *conn = cp->cp_conn;
struct rds_ib_connection *ic = conn->c_transport_data; struct rds_ib_connection *ic = conn->c_transport_data;
int err = 0; int err = 0;
......
...@@ -980,8 +980,9 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op) ...@@ -980,8 +980,9 @@ int rds_ib_xmit_rdma(struct rds_connection *conn, struct rm_rdma_op *op)
return ret; return ret;
} }
void rds_ib_xmit_complete(struct rds_connection *conn) void rds_ib_xmit_path_complete(struct rds_conn_path *cp)
{ {
struct rds_connection *conn = cp->cp_conn;
struct rds_ib_connection *ic = conn->c_transport_data; struct rds_ib_connection *ic = conn->c_transport_data;
/* We may have a pending ACK or window update we were unable /* We may have a pending ACK or window update we were unable
......
...@@ -156,7 +156,7 @@ static int rds_loop_conn_connect(struct rds_connection *conn) ...@@ -156,7 +156,7 @@ static int rds_loop_conn_connect(struct rds_connection *conn)
return 0; return 0;
} }
static void rds_loop_conn_shutdown(struct rds_connection *conn) static void rds_loop_conn_path_shutdown(struct rds_conn_path *cp)
{ {
} }
...@@ -189,7 +189,7 @@ struct rds_transport rds_loop_transport = { ...@@ -189,7 +189,7 @@ struct rds_transport rds_loop_transport = {
.conn_alloc = rds_loop_conn_alloc, .conn_alloc = rds_loop_conn_alloc,
.conn_free = rds_loop_conn_free, .conn_free = rds_loop_conn_free,
.conn_connect = rds_loop_conn_connect, .conn_connect = rds_loop_conn_connect,
.conn_shutdown = rds_loop_conn_shutdown, .conn_path_shutdown = rds_loop_conn_path_shutdown,
.inc_copy_to_user = rds_message_inc_copy_to_user, .inc_copy_to_user = rds_message_inc_copy_to_user,
.inc_free = rds_loop_inc_free, .inc_free = rds_loop_inc_free,
.t_name = "loopback", .t_name = "loopback",
......
...@@ -455,11 +455,8 @@ struct rds_transport { ...@@ -455,11 +455,8 @@ struct rds_transport {
int (*conn_alloc)(struct rds_connection *conn, gfp_t gfp); int (*conn_alloc)(struct rds_connection *conn, gfp_t gfp);
void (*conn_free)(void *data); void (*conn_free)(void *data);
int (*conn_connect)(struct rds_connection *conn); int (*conn_connect)(struct rds_connection *conn);
void (*conn_shutdown)(struct rds_connection *conn);
void (*conn_path_shutdown)(struct rds_conn_path *conn); void (*conn_path_shutdown)(struct rds_conn_path *conn);
void (*xmit_prepare)(struct rds_connection *conn);
void (*xmit_path_prepare)(struct rds_conn_path *cp); void (*xmit_path_prepare)(struct rds_conn_path *cp);
void (*xmit_complete)(struct rds_connection *conn);
void (*xmit_path_complete)(struct rds_conn_path *cp); void (*xmit_path_complete)(struct rds_conn_path *cp);
int (*xmit)(struct rds_connection *conn, struct rds_message *rm, int (*xmit)(struct rds_connection *conn, struct rds_message *rm,
unsigned int hdr_off, unsigned int sg, unsigned int off); unsigned int hdr_off, unsigned int sg, unsigned int off);
......
...@@ -183,12 +183,8 @@ int rds_send_xmit(struct rds_conn_path *cp) ...@@ -183,12 +183,8 @@ int rds_send_xmit(struct rds_conn_path *cp)
goto out; goto out;
} }
if (conn->c_trans->t_mp_capable) {
if (conn->c_trans->xmit_path_prepare) if (conn->c_trans->xmit_path_prepare)
conn->c_trans->xmit_path_prepare(cp); conn->c_trans->xmit_path_prepare(cp);
} else if (conn->c_trans->xmit_prepare) {
conn->c_trans->xmit_prepare(conn);
}
/* /*
* spin trying to push headers and data down the connection until * spin trying to push headers and data down the connection until
...@@ -403,12 +399,8 @@ int rds_send_xmit(struct rds_conn_path *cp) ...@@ -403,12 +399,8 @@ int rds_send_xmit(struct rds_conn_path *cp)
} }
over_batch: over_batch:
if (conn->c_trans->t_mp_capable) {
if (conn->c_trans->xmit_path_complete) if (conn->c_trans->xmit_path_complete)
conn->c_trans->xmit_path_complete(cp); conn->c_trans->xmit_path_complete(cp);
} else if (conn->c_trans->xmit_complete) {
conn->c_trans->xmit_complete(conn);
}
release_in_xmit(cp); release_in_xmit(cp);
/* Nuke any messages we decided not to retransmit. */ /* Nuke any messages we decided not to retransmit. */
......
...@@ -340,14 +340,14 @@ static void rds_tcp_exit(void); ...@@ -340,14 +340,14 @@ static void rds_tcp_exit(void);
struct rds_transport rds_tcp_transport = { struct rds_transport rds_tcp_transport = {
.laddr_check = rds_tcp_laddr_check, .laddr_check = rds_tcp_laddr_check,
.xmit_prepare = rds_tcp_xmit_prepare, .xmit_path_prepare = rds_tcp_xmit_path_prepare,
.xmit_complete = rds_tcp_xmit_complete, .xmit_path_complete = rds_tcp_xmit_path_complete,
.xmit = rds_tcp_xmit, .xmit = rds_tcp_xmit,
.recv = rds_tcp_recv, .recv = rds_tcp_recv,
.conn_alloc = rds_tcp_conn_alloc, .conn_alloc = rds_tcp_conn_alloc,
.conn_free = rds_tcp_conn_free, .conn_free = rds_tcp_conn_free,
.conn_connect = rds_tcp_conn_connect, .conn_connect = rds_tcp_conn_connect,
.conn_shutdown = rds_tcp_conn_shutdown, .conn_path_shutdown = rds_tcp_conn_path_shutdown,
.inc_copy_to_user = rds_tcp_inc_copy_to_user, .inc_copy_to_user = rds_tcp_inc_copy_to_user,
.inc_free = rds_tcp_inc_free, .inc_free = rds_tcp_inc_free,
.stats_info_copy = rds_tcp_stats_info_copy, .stats_info_copy = rds_tcp_stats_info_copy,
......
...@@ -61,7 +61,7 @@ void rds_tcp_accept_work(struct sock *sk); ...@@ -61,7 +61,7 @@ void rds_tcp_accept_work(struct sock *sk);
/* tcp_connect.c */ /* tcp_connect.c */
int rds_tcp_conn_connect(struct rds_connection *conn); int rds_tcp_conn_connect(struct rds_connection *conn);
void rds_tcp_conn_shutdown(struct rds_connection *conn); void rds_tcp_conn_path_shutdown(struct rds_conn_path *conn);
void rds_tcp_state_change(struct sock *sk); void rds_tcp_state_change(struct sock *sk);
/* tcp_listen.c */ /* tcp_listen.c */
...@@ -80,8 +80,8 @@ void rds_tcp_inc_free(struct rds_incoming *inc); ...@@ -80,8 +80,8 @@ void rds_tcp_inc_free(struct rds_incoming *inc);
int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to);
/* tcp_send.c */ /* tcp_send.c */
void rds_tcp_xmit_prepare(struct rds_connection *conn); void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp);
void rds_tcp_xmit_complete(struct rds_connection *conn); void rds_tcp_xmit_path_complete(struct rds_conn_path *cp);
int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm, int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
unsigned int hdr_off, unsigned int sg, unsigned int off); unsigned int hdr_off, unsigned int sg, unsigned int off);
void rds_tcp_write_space(struct sock *sk); void rds_tcp_write_space(struct sock *sk);
......
...@@ -144,12 +144,13 @@ int rds_tcp_conn_connect(struct rds_connection *conn) ...@@ -144,12 +144,13 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
* callbacks to those set by TCP. Our callbacks won't execute again once we * callbacks to those set by TCP. Our callbacks won't execute again once we
* hold the sock lock. * hold the sock lock.
*/ */
void rds_tcp_conn_shutdown(struct rds_connection *conn) void rds_tcp_conn_path_shutdown(struct rds_conn_path *cp)
{ {
struct rds_tcp_connection *tc = conn->c_transport_data; struct rds_tcp_connection *tc = cp->cp_transport_data;
struct socket *sock = tc->t_sock; struct socket *sock = tc->t_sock;
rdsdebug("shutting down conn %p tc %p sock %p\n", conn, tc, sock); rdsdebug("shutting down conn %p tc %p sock %p\n",
cp->cp_conn, tc, sock);
if (sock) { if (sock) {
sock->ops->shutdown(sock, RCV_SHUTDOWN | SEND_SHUTDOWN); sock->ops->shutdown(sock, RCV_SHUTDOWN | SEND_SHUTDOWN);
......
...@@ -49,16 +49,16 @@ static void rds_tcp_cork(struct socket *sock, int val) ...@@ -49,16 +49,16 @@ static void rds_tcp_cork(struct socket *sock, int val)
set_fs(oldfs); set_fs(oldfs);
} }
void rds_tcp_xmit_prepare(struct rds_connection *conn) void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp)
{ {
struct rds_tcp_connection *tc = conn->c_transport_data; struct rds_tcp_connection *tc = cp->cp_transport_data;
rds_tcp_cork(tc->t_sock, 1); rds_tcp_cork(tc->t_sock, 1);
} }
void rds_tcp_xmit_complete(struct rds_connection *conn) void rds_tcp_xmit_path_complete(struct rds_conn_path *cp)
{ {
struct rds_tcp_connection *tc = conn->c_transport_data; struct rds_tcp_connection *tc = cp->cp_transport_data;
rds_tcp_cork(tc->t_sock, 0); rds_tcp_cork(tc->t_sock, 0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment