Skip to content

Commit f0ec4f1

Browse files
karstengrdavem330
authored andcommitted
net/smc: save state of last sent CDC message
When a link goes down and all connections of this link need to be switched to an other link then the producer cursor and the sequence of the last successfully sent CDC message must be known. Add the two fields to the SMC connection and update it in the tx completion handler. And to allow matching of sequences in error cases reset the seqno to the old value in smc_cdc_msg_send() when the actual send failed. Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Reviewed-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent fc99584 commit f0ec4f1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

net/smc/smc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ struct smc_connection {
143143
* .prod cf. TCP snd_nxt
144144
* .cons cf. TCP sends ack
145145
*/
146+
union smc_host_cursor local_tx_ctrl_fin;
147+
/* prod crsr - confirmed by peer
148+
*/
146149
union smc_host_cursor tx_curs_prep; /* tx - prepared data
147150
* snd_max..wmem_alloc
148151
*/
@@ -154,6 +157,7 @@ struct smc_connection {
154157
*/
155158
atomic_t sndbuf_space; /* remaining space in sndbuf */
156159
u16 tx_cdc_seq; /* sequence # for CDC send */
160+
u16 tx_cdc_seq_fin; /* sequence # - tx completed */
157161
spinlock_t send_lock; /* protect wr_sends */
158162
struct delayed_work tx_work; /* retry of smc_cdc_msg_send */
159163
u32 tx_off; /* base offset in peer rmb */

net/smc/smc_cdc.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd,
4747
/* guarantee 0 <= sndbuf_space <= sndbuf_desc->len */
4848
smp_mb__after_atomic();
4949
smc_curs_copy(&conn->tx_curs_fin, &cdcpend->cursor, conn);
50+
smc_curs_copy(&conn->local_tx_ctrl_fin, &cdcpend->p_cursor,
51+
conn);
52+
conn->tx_cdc_seq_fin = cdcpend->ctrl_seq;
5053
}
5154
smc_tx_sndbuf_nonfull(smc);
5255
bh_unlock_sock(&smc->sk);
@@ -104,6 +107,9 @@ int smc_cdc_msg_send(struct smc_connection *conn,
104107
if (!rc) {
105108
smc_curs_copy(&conn->rx_curs_confirmed, &cfed, conn);
106109
conn->local_rx_ctrl.prod_flags.cons_curs_upd_req = 0;
110+
} else {
111+
conn->tx_cdc_seq--;
112+
conn->local_tx_ctrl.seqno = conn->tx_cdc_seq;
107113
}
108114

109115
return rc;

0 commit comments

Comments
 (0)