RDS: TCP: make receive path use the rds_conn_path
The ->sk_user_data contains a pointer to the rds_conn_path for the socket. Use this consistently in the rds_tcp_data_ready callbacks to get the rds_conn_path for rds_recv_incoming. Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
ea3b1ea539
commit
2da43c4a1b
|
@ -385,7 +385,7 @@ struct rds_transport rds_ib_transport = {
|
||||||
.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,
|
||||||
.recv = rds_ib_recv,
|
.recv_path = rds_ib_recv_path,
|
||||||
.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,
|
||||||
|
|
|
@ -354,7 +354,7 @@ void rds_ib_mr_cqe_handler(struct rds_ib_connection *ic, struct ib_wc *wc);
|
||||||
/* ib_recv.c */
|
/* ib_recv.c */
|
||||||
int rds_ib_recv_init(void);
|
int rds_ib_recv_init(void);
|
||||||
void rds_ib_recv_exit(void);
|
void rds_ib_recv_exit(void);
|
||||||
int rds_ib_recv(struct rds_connection *conn);
|
int rds_ib_recv_path(struct rds_conn_path *conn);
|
||||||
int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic);
|
int rds_ib_recv_alloc_caches(struct rds_ib_connection *ic);
|
||||||
void rds_ib_recv_free_caches(struct rds_ib_connection *ic);
|
void rds_ib_recv_free_caches(struct rds_ib_connection *ic);
|
||||||
void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp);
|
void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp);
|
||||||
|
|
|
@ -1009,8 +1009,9 @@ void rds_ib_recv_cqe_handler(struct rds_ib_connection *ic,
|
||||||
rds_ib_recv_refill(conn, 0, GFP_NOWAIT);
|
rds_ib_recv_refill(conn, 0, GFP_NOWAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rds_ib_recv(struct rds_connection *conn)
|
int rds_ib_recv_path(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 ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ static void rds_loop_inc_free(struct rds_incoming *inc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need to at least give the thread something to succeed */
|
/* we need to at least give the thread something to succeed */
|
||||||
static int rds_loop_recv(struct rds_connection *conn)
|
static int rds_loop_recv_path(struct rds_conn_path *cp)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ void rds_loop_exit(void)
|
||||||
*/
|
*/
|
||||||
struct rds_transport rds_loop_transport = {
|
struct rds_transport rds_loop_transport = {
|
||||||
.xmit = rds_loop_xmit,
|
.xmit = rds_loop_xmit,
|
||||||
.recv = rds_loop_recv,
|
.recv_path = rds_loop_recv_path,
|
||||||
.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,
|
||||||
|
|
|
@ -462,7 +462,7 @@ struct rds_transport {
|
||||||
unsigned int hdr_off, unsigned int sg, unsigned int off);
|
unsigned int hdr_off, unsigned int sg, unsigned int off);
|
||||||
int (*xmit_rdma)(struct rds_connection *conn, struct rm_rdma_op *op);
|
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 (*xmit_atomic)(struct rds_connection *conn, struct rm_atomic_op *op);
|
||||||
int (*recv)(struct rds_connection *conn);
|
int (*recv_path)(struct rds_conn_path *cp);
|
||||||
int (*inc_copy_to_user)(struct rds_incoming *inc, struct iov_iter *to);
|
int (*inc_copy_to_user)(struct rds_incoming *inc, struct iov_iter *to);
|
||||||
void (*inc_free)(struct rds_incoming *inc);
|
void (*inc_free)(struct rds_incoming *inc);
|
||||||
|
|
||||||
|
|
|
@ -359,7 +359,7 @@ struct rds_transport rds_tcp_transport = {
|
||||||
.xmit_path_prepare = rds_tcp_xmit_path_prepare,
|
.xmit_path_prepare = rds_tcp_xmit_path_prepare,
|
||||||
.xmit_path_complete = rds_tcp_xmit_path_complete,
|
.xmit_path_complete = rds_tcp_xmit_path_complete,
|
||||||
.xmit = rds_tcp_xmit,
|
.xmit = rds_tcp_xmit,
|
||||||
.recv = rds_tcp_recv,
|
.recv_path = rds_tcp_recv_path,
|
||||||
.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,
|
||||||
|
|
|
@ -75,7 +75,7 @@ int rds_tcp_keepalive(struct socket *sock);
|
||||||
int rds_tcp_recv_init(void);
|
int rds_tcp_recv_init(void);
|
||||||
void rds_tcp_recv_exit(void);
|
void rds_tcp_recv_exit(void);
|
||||||
void rds_tcp_data_ready(struct sock *sk);
|
void rds_tcp_data_ready(struct sock *sk);
|
||||||
int rds_tcp_recv(struct rds_connection *conn);
|
int rds_tcp_recv_path(struct rds_conn_path *cp);
|
||||||
void rds_tcp_inc_free(struct rds_incoming *inc);
|
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);
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <net/tcp.h>
|
#include <net/tcp.h>
|
||||||
|
|
||||||
#include "rds_single_path.h"
|
|
||||||
#include "rds.h"
|
#include "rds.h"
|
||||||
#include "tcp.h"
|
#include "tcp.h"
|
||||||
|
|
||||||
|
@ -148,7 +147,7 @@ static void rds_tcp_cong_recv(struct rds_connection *conn,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct rds_tcp_desc_arg {
|
struct rds_tcp_desc_arg {
|
||||||
struct rds_connection *conn;
|
struct rds_conn_path *conn_path;
|
||||||
gfp_t gfp;
|
gfp_t gfp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -156,8 +155,8 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
|
||||||
unsigned int offset, size_t len)
|
unsigned int offset, size_t len)
|
||||||
{
|
{
|
||||||
struct rds_tcp_desc_arg *arg = desc->arg.data;
|
struct rds_tcp_desc_arg *arg = desc->arg.data;
|
||||||
struct rds_connection *conn = arg->conn;
|
struct rds_conn_path *cp = arg->conn_path;
|
||||||
struct rds_tcp_connection *tc = conn->c_transport_data;
|
struct rds_tcp_connection *tc = cp->cp_transport_data;
|
||||||
struct rds_tcp_incoming *tinc = tc->t_tinc;
|
struct rds_tcp_incoming *tinc = tc->t_tinc;
|
||||||
struct sk_buff *clone;
|
struct sk_buff *clone;
|
||||||
size_t left = len, to_copy;
|
size_t left = len, to_copy;
|
||||||
|
@ -179,7 +178,8 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
|
||||||
}
|
}
|
||||||
tc->t_tinc = tinc;
|
tc->t_tinc = tinc;
|
||||||
rdsdebug("alloced tinc %p\n", tinc);
|
rdsdebug("alloced tinc %p\n", tinc);
|
||||||
rds_inc_init(&tinc->ti_inc, conn, conn->c_faddr);
|
rds_inc_path_init(&tinc->ti_inc, cp,
|
||||||
|
cp->cp_conn->c_faddr);
|
||||||
/*
|
/*
|
||||||
* XXX * we might be able to use the __ variants when
|
* XXX * we might be able to use the __ variants when
|
||||||
* we've already serialized at a higher level.
|
* we've already serialized at a higher level.
|
||||||
|
@ -229,6 +229,8 @@ static int rds_tcp_data_recv(read_descriptor_t *desc, struct sk_buff *skb,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tc->t_tinc_hdr_rem == 0 && tc->t_tinc_data_rem == 0) {
|
if (tc->t_tinc_hdr_rem == 0 && tc->t_tinc_data_rem == 0) {
|
||||||
|
struct rds_connection *conn = cp->cp_conn;
|
||||||
|
|
||||||
if (tinc->ti_inc.i_hdr.h_flags == RDS_FLAG_CONG_BITMAP)
|
if (tinc->ti_inc.i_hdr.h_flags == RDS_FLAG_CONG_BITMAP)
|
||||||
rds_tcp_cong_recv(conn, tinc);
|
rds_tcp_cong_recv(conn, tinc);
|
||||||
else
|
else
|
||||||
|
@ -251,15 +253,15 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the caller has to hold the sock lock */
|
/* the caller has to hold the sock lock */
|
||||||
static int rds_tcp_read_sock(struct rds_connection *conn, gfp_t gfp)
|
static int rds_tcp_read_sock(struct rds_conn_path *cp, gfp_t gfp)
|
||||||
{
|
{
|
||||||
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;
|
||||||
read_descriptor_t desc;
|
read_descriptor_t desc;
|
||||||
struct rds_tcp_desc_arg arg;
|
struct rds_tcp_desc_arg arg;
|
||||||
|
|
||||||
/* It's like glib in the kernel! */
|
/* It's like glib in the kernel! */
|
||||||
arg.conn = conn;
|
arg.conn_path = cp;
|
||||||
arg.gfp = gfp;
|
arg.gfp = gfp;
|
||||||
desc.arg.data = &arg;
|
desc.arg.data = &arg;
|
||||||
desc.error = 0;
|
desc.error = 0;
|
||||||
|
@ -279,16 +281,17 @@ static int rds_tcp_read_sock(struct rds_connection *conn, gfp_t gfp)
|
||||||
* if we fail to allocate we're in trouble.. blindly wait some time before
|
* if we fail to allocate we're in trouble.. blindly wait some time before
|
||||||
* trying again to see if the VM can free up something for us.
|
* trying again to see if the VM can free up something for us.
|
||||||
*/
|
*/
|
||||||
int rds_tcp_recv(struct rds_connection *conn)
|
int rds_tcp_recv_path(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;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
rdsdebug("recv worker conn %p tc %p sock %p\n", conn, tc, sock);
|
rdsdebug("recv worker path [%d] tc %p sock %p\n",
|
||||||
|
cp->cp_index, tc, sock);
|
||||||
|
|
||||||
lock_sock(sock->sk);
|
lock_sock(sock->sk);
|
||||||
ret = rds_tcp_read_sock(conn, GFP_KERNEL);
|
ret = rds_tcp_read_sock(cp, GFP_KERNEL);
|
||||||
release_sock(sock->sk);
|
release_sock(sock->sk);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -313,7 +316,7 @@ void rds_tcp_data_ready(struct sock *sk)
|
||||||
ready = tc->t_orig_data_ready;
|
ready = tc->t_orig_data_ready;
|
||||||
rds_tcp_stats_inc(s_tcp_data_ready_calls);
|
rds_tcp_stats_inc(s_tcp_data_ready_calls);
|
||||||
|
|
||||||
if (rds_tcp_read_sock(cp->cp_conn, GFP_ATOMIC) == -ENOMEM)
|
if (rds_tcp_read_sock(cp, GFP_ATOMIC) == -ENOMEM)
|
||||||
queue_delayed_work(rds_wq, &cp->cp_recv_w, 0);
|
queue_delayed_work(rds_wq, &cp->cp_recv_w, 0);
|
||||||
out:
|
out:
|
||||||
read_unlock_bh(&sk->sk_callback_lock);
|
read_unlock_bh(&sk->sk_callback_lock);
|
||||||
|
|
|
@ -203,7 +203,7 @@ void rds_recv_worker(struct work_struct *work)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (rds_conn_path_state(cp) == RDS_CONN_UP) {
|
if (rds_conn_path_state(cp) == RDS_CONN_UP) {
|
||||||
ret = cp->cp_conn->c_trans->recv(cp->cp_conn);
|
ret = cp->cp_conn->c_trans->recv_path(cp);
|
||||||
rdsdebug("conn %p ret %d\n", cp->cp_conn, ret);
|
rdsdebug("conn %p ret %d\n", cp->cp_conn, ret);
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case -EAGAIN:
|
case -EAGAIN:
|
||||||
|
|
Loading…
Reference in New Issue