Commit 64513d26 authored by Guvenc Gulce's avatar Guvenc Gulce Committed by David S. Miller

net/smc: Correct smc link connection counter in case of smc client

SMC clients may be assigned to a different link after the initial
connection between two peers was established. In such a case,
the connection counter was not correctly set.

Update the connection counter correctly when a smc client connection
is assigned to a different smc link.

Fixes: 07d51580 ("net/smc: Add connection counters for links")
Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
Tested-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8f3d65c1
...@@ -795,7 +795,7 @@ static int smc_connect_rdma(struct smc_sock *smc, ...@@ -795,7 +795,7 @@ static int smc_connect_rdma(struct smc_sock *smc,
reason_code = SMC_CLC_DECL_NOSRVLINK; reason_code = SMC_CLC_DECL_NOSRVLINK;
goto connect_abort; goto connect_abort;
} }
smc->conn.lnk = link; smc_switch_link_and_count(&smc->conn, link);
} }
/* create send buffer and rmb */ /* create send buffer and rmb */
......
...@@ -917,7 +917,7 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend, ...@@ -917,7 +917,7 @@ static int smc_switch_cursor(struct smc_sock *smc, struct smc_cdc_tx_pend *pend,
return rc; return rc;
} }
static void smc_switch_link_and_count(struct smc_connection *conn, void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk) struct smc_link *to_lnk)
{ {
atomic_dec(&conn->lnk->conn_cnt); atomic_dec(&conn->lnk->conn_cnt);
......
...@@ -446,6 +446,8 @@ void smc_core_exit(void); ...@@ -446,6 +446,8 @@ void smc_core_exit(void);
int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk, int smcr_link_init(struct smc_link_group *lgr, struct smc_link *lnk,
u8 link_idx, struct smc_init_info *ini); u8 link_idx, struct smc_init_info *ini);
void smcr_link_clear(struct smc_link *lnk, bool log); void smcr_link_clear(struct smc_link *lnk, bool log);
void smc_switch_link_and_count(struct smc_connection *conn,
struct smc_link *to_lnk);
int smcr_buf_map_lgr(struct smc_link *lnk); int smcr_buf_map_lgr(struct smc_link *lnk);
int smcr_buf_reg_lgr(struct smc_link *lnk); int smcr_buf_reg_lgr(struct smc_link *lnk);
void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type); void smcr_lgr_set_type(struct smc_link_group *lgr, enum smc_lgr_type new_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment