Skip to content

Commit 780a6d9

Browse files
sowminivdavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 7d885d0 commit 780a6d9

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

net/rds/send.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,7 @@ void rds_send_drop_to(struct rds_sock *rs, struct sockaddr_in *dest)
787787
* message from the flow with RDS_CANCEL_SENT_TO.
788788
*/
789789
static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn,
790+
struct rds_conn_path *cp,
790791
struct rds_message *rm, __be16 sport,
791792
__be16 dport, int *queued)
792793
{
@@ -830,13 +831,14 @@ static int rds_send_queue_rm(struct rds_sock *rs, struct rds_connection *conn,
830831
trying to minimize the time we hold c_lock */
831832
rds_message_populate_header(&rm->m_inc.i_hdr, sport, dport, 0);
832833
rm->m_inc.i_conn = conn;
834+
rm->m_inc.i_conn_path = cp;
833835
rds_message_addref(rm);
834836

835-
spin_lock(&conn->c_lock);
836-
rm->m_inc.i_hdr.h_sequence = cpu_to_be64(conn->c_next_tx_seq++);
837-
list_add_tail(&rm->m_conn_item, &conn->c_send_queue);
837+
spin_lock(&cp->cp_lock);
838+
rm->m_inc.i_hdr.h_sequence = cpu_to_be64(cp->cp_next_tx_seq++);
839+
list_add_tail(&rm->m_conn_item, &cp->cp_send_queue);
838840
set_bit(RDS_MSG_ON_CONN, &rm->m_flags);
839-
spin_unlock(&conn->c_lock);
841+
spin_unlock(&cp->cp_lock);
840842

841843
rdsdebug("queued msg %p len %d, rs %p bytes %d seq %llu\n",
842844
rm, len, rs, rs->rs_snd_bytes,
@@ -968,6 +970,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
968970
int queued = 0, allocated_mr = 0;
969971
int nonblock = msg->msg_flags & MSG_DONTWAIT;
970972
long timeo = sock_sndtimeo(sk, nonblock);
973+
struct rds_conn_path *cpath;
971974

972975
/* Mirror Linux UDP mirror of BSD error message compatibility */
973976
/* XXX: Perhaps MSG_MORE someday */
@@ -1074,7 +1077,9 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
10741077
goto out;
10751078
}
10761079

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,
10781083
dport, &queued)) {
10791084
rds_stats_inc(s_send_queue_full);
10801085

@@ -1084,7 +1089,7 @@ int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len)
10841089
}
10851090

10861091
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,
10881093
rs->rs_bound_port,
10891094
dport,
10901095
&queued),

0 commit comments

Comments
 (0)