Skip to contentSkip to conversation

net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error

PATCH In review D. Wythe 1 participant 2 messages Feb 25, 2022

Subsystems (5)
lore
Share & tools
lore

D. Wythe

author maintainer
#0 lore raw

PATCH 1/1 net/smc: fix unexpected SMC_CLC_DECL_ERR_REGRMB error

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

Therefore, we need to judge according to the number of idle rtoken entry.

Fixes cd6851f30386 ("smc: remote memory buffers (RMBs)")
---
 net/smc/smc_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_core.c +2 -1
index 29525d0..24ef0af 100644
@@ -1864,7 +1864,8 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
 		    (ini->smcd_version == SMC_V2 ||
 		     lgr->vlan_id == ini->vlan_id) &&
 		    (role == SMC_CLNT || ini->is_smcd ||
-		     lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
+		     lgr->conns_num < SMC_RMBS_PER_LGR_MAX -
+		     bitmap_weight(lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX))) {
 			/* link group found */
 			ini->first_contact_local = 0;
 			conn->lgr = lgr;
Signature · 1 line
1.8.3.1
author maintainer
#1 lore raw
Quoted 24 lines · D. Wythe

From: "D. Wythe" <[email protected]>

Remove connections from link group is not synchronous with handling SMC_LLC_DELETE_RKEY, which means that even the number of connections is less that SMC_RMBS_PER_LGR_MAX, it does not mean that the connection can register rtoken successfully later, in other words, the rtoken entry may have not been released. This will cause an unexpected SMC_CLC_DECL_ERR_REGRMB to be reported, and then ths smc connection have to fallback to TCP.

Therefore, we need to judge according to the number of idle rtoken entry.

Fixes cd6851f30386 ("smc: remote memory buffers (RMBs)")
---
  net/smc/smc_core.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_core.c +0 -0
index 29525d0..24ef0af 100644

net/smc/smc_core.c int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini) · line 1871

Quoted 9 lines
net/smc/smc_core.c +2 -1
@@ -1864,7 +1864,8 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
  		    (ini->smcd_version == SMC_V2 ||
  		     lgr->vlan_id == ini->vlan_id) &&
  		    (role == SMC_CLNT || ini->is_smcd ||
-		     lgr->conns_num < SMC_RMBS_PER_LGR_MAX)) {
+		     lgr->conns_num < SMC_RMBS_PER_LGR_MAX -
+		     bitmap_weight(lgr->rtokens_used_mask, SMC_RMBS_PER_LGR_MAX))) {
  			/* link group found */
  			ini->first_contact_local = 0;
  			conn->lgr = lgr;

I did a horrible math here, i'll send another fix later.

Best wishes.