From: Ursula Braun <ubraun@linux.ibm.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org,
schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
raspl@linux.ibm.com, kgraul@linux.ibm.com, ubraun@linux.ibm.com
Subject: [PATCH net-next 5/8] net/smc: cleanup of get vlan id
Date: Fri, 12 Apr 2019 12:57:27 +0200 [thread overview]
Message-ID: <20190412105730.96245-6-ubraun@linux.ibm.com> (raw)
In-Reply-To: <20190412105730.96245-1-ubraun@linux.ibm.com>
From: Karsten Graul <kgraul@linux.ibm.com>
The vlan_id of the underlying CLC socket was retrieved two times
during processing of the listen handshaking. Change this to get the
vlan id one time in connect and in listen processing, and reuse the id.
And add a new CLC DECLINE return code for the case when the retrieval
of the vlan id failed.
Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
---
net/smc/af_smc.c | 11 +++++++++--
net/smc/smc_clc.h | 1 +
net/smc/smc_core.c | 4 ----
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index b45372879a70..8ec971f6d828 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -699,9 +699,10 @@ static int __smc_connect(struct smc_sock *smc)
if (using_ipsec(smc))
return smc_connect_decline_fallback(smc, SMC_CLC_DECL_IPSEC);
- /* check for VLAN ID */
+ /* get vlan id from IP device */
if (smc_vlan_by_tcpsk(smc->clcsock, &ini))
- return smc_connect_decline_fallback(smc, SMC_CLC_DECL_CNFERR);
+ return smc_connect_decline_fallback(smc,
+ SMC_CLC_DECL_GETVLANERR);
/* check if there is an ism device available */
if (!smc_check_ism(smc, &ini) &&
@@ -1267,6 +1268,12 @@ static void smc_listen_work(struct work_struct *work)
return;
}
+ /* get vlan id from IP device */
+ if (smc_vlan_by_tcpsk(new_smc->clcsock, &ini)) {
+ smc_listen_decline(new_smc, SMC_CLC_DECL_GETVLANERR, 0);
+ return;
+ }
+
mutex_lock(&smc_server_lgr_pending);
smc_close_init(new_smc);
smc_rx_init(new_smc);
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
index 0ac3b95e71a3..96a9eab0a0aa 100644
--- a/net/smc/smc_clc.h
+++ b/net/smc/smc_clc.h
@@ -39,6 +39,7 @@
#define SMC_CLC_DECL_RMBE_EC 0x03050000 /* peer has eyecatcher in RMBE */
#define SMC_CLC_DECL_OPTUNSUPP 0x03060000 /* fastopen sockopt not supported */
#define SMC_CLC_DECL_DIFFPREFIX 0x03070000 /* IP prefix / subnet mismatch */
+#define SMC_CLC_DECL_GETVLANERR 0x03080000 /* err to get vlan id of ip device*/
#define SMC_CLC_DECL_SYNCERR 0x04000000 /* synchronization error */
#define SMC_CLC_DECL_PEERDECL 0x05000000 /* peer declined during handshake */
#define SMC_CLC_DECL_INTERR 0x09990000 /* internal error */
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c
index a016665abba9..1574c7d7343b 100644
--- a/net/smc/smc_core.c
+++ b/net/smc/smc_core.c
@@ -603,10 +603,6 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
int rc = 0;
role = smc->listen_smc ? SMC_SERV : SMC_CLNT;
- rc = smc_vlan_by_tcpsk(smc->clcsock, ini);
- if (rc)
- return rc;
-
if (role == SMC_CLNT && ini->srv_first_contact)
/* create new link group as well */
goto create;
--
2.16.4
next prev parent reply other threads:[~2019-04-12 10:57 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 10:57 [PATCH net-next 0/8] net/smc: patches 2019-04-12 Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 1/8] net/smc: nonblocking connect rework Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 2/8] net/smc: fallback to TCP after connect problems Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 3/8] net/smc: check for ip prefix and subnet Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 4/8] net/smc: consolidate function parameters Ursula Braun
2019-04-12 10:57 ` Ursula Braun [this message]
2019-04-12 10:57 ` [PATCH net-next 6/8] net/smc: code cleanup smc_listen_work Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 7/8] net/smc: improve smc_listen_work reason codes Ursula Braun
2019-04-12 10:57 ` [PATCH net-next 8/8] net/smc: improve smc_conn_create " Ursula Braun
2019-04-12 18:25 ` [PATCH net-next 0/8] net/smc: patches 2019-04-12 David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412105730.96245-6-ubraun@linux.ibm.com \
--to=ubraun@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=heiko.carstens@de.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=raspl@linux.ibm.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox