summaryrefslogtreecommitdiffstats
path: root/net/smc/af_smc.c
diff options
context:
space:
mode:
authorKarsten Graul <kgraul@linux.ibm.com>2020-07-26 20:34:28 +0200
committerDavid S. Miller <davem@davemloft.net>2020-07-27 10:30:01 -0700
commit72b7f6c48708e4524765a2f1316063207d8e0cd5 (patch)
treeefb004cf45b4e6b81233908c39c429259ab96a1a /net/smc/af_smc.c
parent211e5b7a0007e6a172eafdb89c512768f82d73bf (diff)
downloadlinux-72b7f6c48708e4524765a2f1316063207d8e0cd5.tar.gz
linux-72b7f6c48708e4524765a2f1316063207d8e0cd5.tar.bz2
linux-72b7f6c48708e4524765a2f1316063207d8e0cd5.zip
net/smc: unique reason code for exceeded max dmb count
When the maximum dmb buffer limit for an ism device is reached no more dmb buffers can be registered. When this happens the reason code is set to SMC_CLC_DECL_MEM indicating out-of-memory. This is the same reason code that is used when no memory could be allocated for the new dmb buffer. This is confusing for users when they see this error but there is more memory available. To solve this set a separate new reason code when the maximum dmb limit exceeded. Reviewed-by: Ursula Braun <ubraun@linux.ibm.com> Signed-off-by: Karsten Graul <kgraul@linux.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/smc/af_smc.c')
-rw-r--r--net/smc/af_smc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 832e36269b10..e7649bbc2b87 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -719,8 +719,11 @@ static int smc_connect_ism(struct smc_sock *smc,
}
/* Create send and receive buffers */
- if (smc_buf_create(smc, true))
- return smc_connect_abort(smc, SMC_CLC_DECL_MEM,
+ rc = smc_buf_create(smc, true);
+ if (rc)
+ return smc_connect_abort(smc, (rc == -ENOSPC) ?
+ SMC_CLC_DECL_MAX_DMB :
+ SMC_CLC_DECL_MEM,
ini->cln_first_contact);
smc_conn_save_peer_info(smc, aclc);
@@ -1200,12 +1203,14 @@ static int smc_listen_ism_init(struct smc_sock *new_smc,
}
/* Create send and receive buffers */
- if (smc_buf_create(new_smc, true)) {
+ rc = smc_buf_create(new_smc, true);
+ if (rc) {
if (ini->cln_first_contact == SMC_FIRST_CONTACT)
smc_lgr_cleanup_early(&new_smc->conn);
else
smc_conn_free(&new_smc->conn);
- return SMC_CLC_DECL_MEM;
+ return (rc == -ENOSPC) ? SMC_CLC_DECL_MAX_DMB :
+ SMC_CLC_DECL_MEM;
}
return 0;