Skip to content

Commit 29bd73d

Browse files
karstengrdavem330
authored andcommitted
net/smc: send failover validation message
When a connection is switched to a new link then a link validation message must be sent to the peer over the new link, containing the sequence number of the last CDC message that was sent over the old link. The peer will validate if this sequence number is the same or lower then the number he received, and abort the connection if messages were lost. Add smcr_cdc_msg_send_validation() to send the message validation message and call it when a connection was switched in smc_switch_cursor(). 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 c6f02eb commit 29bd73d

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

net/smc/smc_cdc.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,31 @@ int smc_cdc_msg_send(struct smc_connection *conn,
115115
return rc;
116116
}
117117

118+
/* send a validation msg indicating the move of a conn to an other QP link */
119+
int smcr_cdc_msg_send_validation(struct smc_connection *conn)
120+
{
121+
struct smc_host_cdc_msg *local = &conn->local_tx_ctrl;
122+
struct smc_link *link = conn->lnk;
123+
struct smc_cdc_tx_pend *pend;
124+
struct smc_wr_buf *wr_buf;
125+
struct smc_cdc_msg *peer;
126+
int rc;
127+
128+
rc = smc_cdc_get_free_slot(conn, link, &wr_buf, NULL, &pend);
129+
if (rc)
130+
return rc;
131+
132+
peer = (struct smc_cdc_msg *)wr_buf;
133+
peer->common.type = local->common.type;
134+
peer->len = local->len;
135+
peer->seqno = htons(conn->tx_cdc_seq_fin); /* seqno last compl. tx */
136+
peer->token = htonl(local->token);
137+
peer->prod_flags.failover_validation = 1;
138+
139+
rc = smc_wr_tx_send(link, (struct smc_wr_tx_pend_priv *)pend);
140+
return rc;
141+
}
142+
118143
static int smcr_cdc_get_slot_and_msg_send(struct smc_connection *conn)
119144
{
120145
struct smc_cdc_tx_pend *pend;

net/smc/smc_cdc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ int smc_cdc_msg_send(struct smc_connection *conn, struct smc_wr_buf *wr_buf,
313313
struct smc_cdc_tx_pend *pend);
314314
int smc_cdc_get_slot_and_msg_send(struct smc_connection *conn);
315315
int smcd_cdc_msg_send(struct smc_connection *conn);
316+
int smcr_cdc_msg_send_validation(struct smc_connection *conn);
316317
int smc_cdc_init(void) __init;
317318
void smcd_cdc_rx_init(struct smc_connection *conn);
318319

net/smc/smc_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static int smc_switch_cursor(struct smc_sock *smc)
483483

484484
if (smc->sk.sk_state != SMC_INIT &&
485485
smc->sk.sk_state != SMC_CLOSED) {
486-
/* tbd: call rc = smc_cdc_get_slot_and_msg_send(conn); */
486+
rc = smcr_cdc_msg_send_validation(conn);
487487
if (!rc) {
488488
schedule_delayed_work(&conn->tx_work, 0);
489489
smc->sk.sk_data_ready(&smc->sk);

0 commit comments

Comments
 (0)