Commit fba7e8ef authored by Karsten Graul's avatar Karsten Graul Committed by David S. Miller

net/smc: cleanup of get vlan id

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: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bc36d2fc
...@@ -699,9 +699,10 @@ static int __smc_connect(struct smc_sock *smc) ...@@ -699,9 +699,10 @@ static int __smc_connect(struct smc_sock *smc)
if (using_ipsec(smc)) if (using_ipsec(smc))
return smc_connect_decline_fallback(smc, SMC_CLC_DECL_IPSEC); 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)) 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 */ /* check if there is an ism device available */
if (!smc_check_ism(smc, &ini) && if (!smc_check_ism(smc, &ini) &&
...@@ -1267,6 +1268,12 @@ static void smc_listen_work(struct work_struct *work) ...@@ -1267,6 +1268,12 @@ static void smc_listen_work(struct work_struct *work)
return; 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); mutex_lock(&smc_server_lgr_pending);
smc_close_init(new_smc); smc_close_init(new_smc);
smc_rx_init(new_smc); smc_rx_init(new_smc);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#define SMC_CLC_DECL_RMBE_EC 0x03050000 /* peer has eyecatcher in RMBE */ #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_OPTUNSUPP 0x03060000 /* fastopen sockopt not supported */
#define SMC_CLC_DECL_DIFFPREFIX 0x03070000 /* IP prefix / subnet mismatch */ #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_SYNCERR 0x04000000 /* synchronization error */
#define SMC_CLC_DECL_PEERDECL 0x05000000 /* peer declined during handshake */ #define SMC_CLC_DECL_PEERDECL 0x05000000 /* peer declined during handshake */
#define SMC_CLC_DECL_INTERR 0x09990000 /* internal error */ #define SMC_CLC_DECL_INTERR 0x09990000 /* internal error */
......
...@@ -603,10 +603,6 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini) ...@@ -603,10 +603,6 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)
int rc = 0; int rc = 0;
role = smc->listen_smc ? SMC_SERV : SMC_CLNT; 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) if (role == SMC_CLNT && ini->srv_first_contact)
/* create new link group as well */ /* create new link group as well */
goto create; goto create;
......
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