diff options
author | Sowmini Varadhan <sowmini.varadhan@oracle.com> | 2016-06-13 12:44:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-15 02:50:42 -0400 |
commit | 780a6d9e16d1827eb97c2497d7814fe34d280c15 (patch) | |
tree | 14ee7dd5031844df6e37fe2e518b9e48b4fe3c0e | |
parent | 7d885d0fc69abe22382fae5dddd84684333ab29b (diff) |
RDS: Make rds_send_queue_rm() rds_conn_path aware
Pass the rds_conn_path to rds_send_queue_rm, and use it to initialize
the i_conn_path field in struct rds_incoming. This commit also makes
rds_send_queue_rm() MP capable, because it now takes locks
specific to the rds_conn_path passed in, instead of defaulting to
the c_path[0] based defines from rds_single_path.h
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/rds/send.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/net/rds/send.c b/net/rds/send.c index 3fb280b75160..076ee413d21c 100644 --- a/net/rds/send.c +++ b/net/rds/send.c | |||
@@ -787,6 +787,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest) | |||
787 | * message from the flow with RDS_CANCEL_SENT_TO. | 787 | * message from the flow with RDS_CANCEL_SENT_TO. |
788 | */ | 788 | */ |
789 | static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn, | 789 | static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn, |
790 | struct rds_conn_path *cp, | ||
790 | struct rds_message *rm, __be16 sport, | 791 | struct rds_message *rm, __be16 sport, |
791 | __be16 dport, int *queued) | 792 | __be16 dport, int *queued) |
792 | { | 793 | { |
@@ -830,13 +831,14 @@ static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn, | |||
830 | trying to minimize the time we hold c_lock */ | 831 | trying to minimize the time we hold c_lock */ |
831 | rds_message_populate_header(&rm->m_inc.i_hdr, sport, dport, 0); | 832 | rds_message_populate_header(&rm->m_inc.i_hdr, sport, dport, 0); |
832 | rm->m_inc.i_conn = conn; | 833 | rm->m_inc.i_conn = conn; |
834 | rm->m_inc.i_conn_path = cp; | ||
833 | rds_message_addref(rm); | 835 | rds_message_addref(rm); |
834 | 836 | ||
835 | spin_lock(&conn->c_lock); | 837 | spin_lock(&cp->cp_lock); |
836 | rm->m_inc.i_hdr.h_sequence = cpu_to_be64(conn->c_next_tx_seq++); | 838 | rm->m_inc.i_hdr.h_sequence = cpu_to_be64(cp->cp_next_tx_seq++); |
837 | list_add_tail(&rm->m_conn_item, &conn->c_send_queue); | 839 | list_add_tail(&rm->m_conn_item, &cp->cp_send_queue); |
838 | set_bit(RDS_MSG_ON_CONN, &rm->m_flags); | 840 | set_bit(RDS_MSG_ON_CONN, &rm->m_flags); |
839 | spin_unlock(&conn->c_lock); | 841 | spin_unlock(&cp->cp_lock); |
840 | 842 | ||
841 | rdsdebug("queued msg %p len %d, rs %p bytes %d seq %llu\n", | 843 | rdsdebug("queued msg %p len %d, rs %p bytes %d seq %llu\n", |
842 | rm, len, rs, rs->rs_snd_bytes, | 844 | rm, len, rs, rs->rs_snd_bytes, |
@@ -968,6 +970,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) | |||
968 | int queued = 0, allocated_mr = 0; | 970 | int queued = 0, allocated_mr = 0; |
969 | int nonblock = msg->msg_flags & MSG_DONTWAIT; | 971 | int nonblock = msg->msg_flags & MSG_DONTWAIT; |
970 | long timeo = sock_sndtimeo(sk, nonblock); | 972 | long timeo = sock_sndtimeo(sk, nonblock); |
973 | struct rds_conn_path *cpath; | ||
971 | 974 | ||
972 | /* Mirror Linux UDP mirror of BSD error message compatibility */ | 975 | /* Mirror Linux UDP mirror of BSD error message compatibility */ |
973 | /* XXX: Perhaps MSG_MORE someday */ | 976 | /* XXX: Perhaps MSG_MORE someday */ |
@@ -1074,7 +1077,9 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) | |||
1074 | goto out; | 1077 | goto out; |
1075 | } | 1078 | } |
1076 | 1079 | ||
1077 | while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port, | 1080 | cpath = &conn->c_path[0]; |
1081 | |||
1082 | while (!rds_send_queue_rm(rs, conn, cpath, rm, rs->rs_bound_port, | ||
1078 | dport, &queued)) { | 1083 | dport, &queued)) { |
1079 | rds_stats_inc(s_send_queue_full); | 1084 | rds_stats_inc(s_send_queue_full); |
1080 | 1085 | ||
@@ -1084,7 +1089,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) | |||
1084 | } | 1089 | } |
1085 | 1090 | ||
1086 | timeo = wait_event_interruptible_timeout(*sk_sleep(sk), | 1091 | timeo = wait_event_interruptible_timeout(*sk_sleep(sk), |
1087 | rds_send_queue_rm(rs, conn, rm, | 1092 | rds_send_queue_rm(rs, conn, cpath, rm, |
1088 | rs->rs_bound_port, | 1093 | rs->rs_bound_port, |
1089 | dport, | 1094 | dport, |
1090 | &queued), | 1095 | &queued), |