Skip to content

Commit b589513

Browse files
sowminivdavem330
authored andcommitted
rds: tcp: compute m_ack_seq as offset from ->write_seq
rds-tcp uses m_ack_seq to track the tcp ack# that indicates that the peer has received a rds_message. The m_ack_seq is used in rds_tcp_is_acked() to figure out when it is safe to drop the rds_message from the RDS retransmit queue. The m_ack_seq must be calculated as an offset from the right edge of the in-flight tcp buffer, i.e., it should be based on the ->write_seq, not the ->snd_nxt. Signed-off-by: Sowmini Varadhan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ab18a9c commit b589513

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

net/rds/tcp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ void rds_tcp_nonagle(struct socket *sock)
9090
sizeof(val));
9191
}
9292

93-
u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc)
93+
u32 rds_tcp_write_seq(struct rds_tcp_connection *tc)
9494
{
95-
return tcp_sk(tc->t_sock->sk)->snd_nxt;
95+
/* seq# of the last byte of data in tcp send buffer */
96+
return tcp_sk(tc->t_sock->sk)->write_seq;
9697
}
9798

9899
u32 rds_tcp_snd_una(struct rds_tcp_connection *tc)

net/rds/tcp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp);
5454
void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp);
5555
void rds_tcp_restore_callbacks(struct socket *sock,
5656
struct rds_tcp_connection *tc);
57-
u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
57+
u32 rds_tcp_write_seq(struct rds_tcp_connection *tc);
5858
u32 rds_tcp_snd_una(struct rds_tcp_connection *tc);
5959
u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq);
6060
extern struct rds_transport rds_tcp_transport;

net/rds/tcp_send.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
8686
* m_ack_seq is set to the sequence number of the last byte of
8787
* header and data. see rds_tcp_is_acked().
8888
*/
89-
tc->t_last_sent_nxt = rds_tcp_snd_nxt(tc);
89+
tc->t_last_sent_nxt = rds_tcp_write_seq(tc);
9090
rm->m_ack_seq = tc->t_last_sent_nxt +
9191
sizeof(struct rds_header) +
9292
be32_to_cpu(rm->m_inc.i_hdr.h_len) - 1;
@@ -98,7 +98,7 @@ int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
9898
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
9999

100100
rdsdebug("rm %p tcp nxt %u ack_seq %llu\n",
101-
rm, rds_tcp_snd_nxt(tc),
101+
rm, rds_tcp_write_seq(tc),
102102
(unsigned long long)rm->m_ack_seq);
103103
}
104104

0 commit comments

Comments
 (0)