diff options
author | Karsten Graul <kgraul@linux.vnet.ibm.com> | 2018-03-01 07:51:28 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-01 13:21:31 -0500 |
commit | be6d467b997f9e32aa9b27add06e7b0c8627a566 (patch) | |
tree | 1e9ae81ea5a5dea14d5c6c2709142a042646f2ef | |
parent | 696cd3016975d31e3499c49a7a747d7615a16b3b (diff) |
net/smc: remove unused fields from smc structures
The daddr field holds the destination IPv4 address. The field was set but
never used and can be removed. The addr field was a left-over from an
earlier version of non-blocking connects and can be removed.
The result of the call to kernel_getpeername is not used, the call can be
removed. Non-blocking connects are working, so remove restriction comment.
Signed-off-by: Karsten Graul <kgraul@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/smc/af_smc.c | 15 | ||||
-rw-r--r-- | net/smc/smc.h | 3 | ||||
-rw-r--r-- | net/smc/smc_core.c | 7 | ||||
-rw-r--r-- | net/smc/smc_core.h | 1 |
4 files changed, 8 insertions, 18 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index b90cbfdb9916..cda3d5314e3f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c | |||
@@ -7,7 +7,6 @@ | |||
7 | * applicable with RoCE-cards only | 7 | * applicable with RoCE-cards only |
8 | * | 8 | * |
9 | * Initial restrictions: | 9 | * Initial restrictions: |
10 | * - non-blocking connect postponed | ||
11 | * - IPv6 support postponed | 10 | * - IPv6 support postponed |
12 | * - support for alternate links postponed | 11 | * - support for alternate links postponed |
13 | * - partial support for non-blocking sockets only | 12 | * - partial support for non-blocking sockets only |
@@ -345,7 +344,6 @@ static void smc_lgr_forget(struct smc_link_group *lgr) | |||
345 | /* setup for RDMA connection of client */ | 344 | /* setup for RDMA connection of client */ |
346 | static int smc_connect_rdma(struct smc_sock *smc) | 345 | static int smc_connect_rdma(struct smc_sock *smc) |
347 | { | 346 | { |
348 | struct sockaddr_in *inaddr = (struct sockaddr_in *)smc->addr; | ||
349 | struct smc_clc_msg_accept_confirm aclc; | 347 | struct smc_clc_msg_accept_confirm aclc; |
350 | int local_contact = SMC_FIRST_CONTACT; | 348 | int local_contact = SMC_FIRST_CONTACT; |
351 | struct smc_ib_device *smcibdev; | 349 | struct smc_ib_device *smcibdev; |
@@ -399,8 +397,8 @@ static int smc_connect_rdma(struct smc_sock *smc) | |||
399 | 397 | ||
400 | srv_first_contact = aclc.hdr.flag; | 398 | srv_first_contact = aclc.hdr.flag; |
401 | mutex_lock(&smc_create_lgr_pending); | 399 | mutex_lock(&smc_create_lgr_pending); |
402 | local_contact = smc_conn_create(smc, inaddr->sin_addr.s_addr, smcibdev, | 400 | local_contact = smc_conn_create(smc, smcibdev, ibport, &aclc.lcl, |
403 | ibport, &aclc.lcl, srv_first_contact); | 401 | srv_first_contact); |
404 | if (local_contact < 0) { | 402 | if (local_contact < 0) { |
405 | rc = local_contact; | 403 | rc = local_contact; |
406 | if (rc == -ENOMEM) | 404 | if (rc == -ENOMEM) |
@@ -518,7 +516,6 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr, | |||
518 | goto out_err; | 516 | goto out_err; |
519 | if (addr->sa_family != AF_INET) | 517 | if (addr->sa_family != AF_INET) |
520 | goto out_err; | 518 | goto out_err; |
521 | smc->addr = addr; /* needed for nonblocking connect */ | ||
522 | 519 | ||
523 | lock_sock(sk); | 520 | lock_sock(sk); |
524 | switch (sk->sk_state) { | 521 | switch (sk->sk_state) { |
@@ -726,7 +723,6 @@ static void smc_listen_work(struct work_struct *work) | |||
726 | struct sock *newsmcsk = &new_smc->sk; | 723 | struct sock *newsmcsk = &new_smc->sk; |
727 | struct smc_clc_msg_proposal *pclc; | 724 | struct smc_clc_msg_proposal *pclc; |
728 | struct smc_ib_device *smcibdev; | 725 | struct smc_ib_device *smcibdev; |
729 | struct sockaddr_in peeraddr; | ||
730 | u8 buf[SMC_CLC_MAX_LEN]; | 726 | u8 buf[SMC_CLC_MAX_LEN]; |
731 | struct smc_link *link; | 727 | struct smc_link *link; |
732 | int reason_code = 0; | 728 | int reason_code = 0; |
@@ -782,13 +778,10 @@ static void smc_listen_work(struct work_struct *work) | |||
782 | goto decline_rdma; | 778 | goto decline_rdma; |
783 | } | 779 | } |
784 | 780 | ||
785 | /* get address of the peer connected to the internal TCP socket */ | ||
786 | kernel_getpeername(newclcsock, (struct sockaddr *)&peeraddr); | ||
787 | |||
788 | /* allocate connection / link group */ | 781 | /* allocate connection / link group */ |
789 | mutex_lock(&smc_create_lgr_pending); | 782 | mutex_lock(&smc_create_lgr_pending); |
790 | local_contact = smc_conn_create(new_smc, peeraddr.sin_addr.s_addr, | 783 | local_contact = smc_conn_create(new_smc, smcibdev, ibport, &pclc->lcl, |
791 | smcibdev, ibport, &pclc->lcl, 0); | 784 | 0); |
792 | if (local_contact < 0) { | 785 | if (local_contact < 0) { |
793 | rc = local_contact; | 786 | rc = local_contact; |
794 | if (rc == -ENOMEM) | 787 | if (rc == -ENOMEM) |
diff --git a/net/smc/smc.h b/net/smc/smc.h index 9895c190d146..268cdf11533c 100644 --- a/net/smc/smc.h +++ b/net/smc/smc.h | |||
@@ -172,7 +172,6 @@ struct smc_sock { /* smc sock container */ | |||
172 | struct sock sk; | 172 | struct sock sk; |
173 | struct socket *clcsock; /* internal tcp socket */ | 173 | struct socket *clcsock; /* internal tcp socket */ |
174 | struct smc_connection conn; /* smc connection */ | 174 | struct smc_connection conn; /* smc connection */ |
175 | struct sockaddr *addr; /* inet connect address */ | ||
176 | struct smc_sock *listen_smc; /* listen parent */ | 175 | struct smc_sock *listen_smc; /* listen parent */ |
177 | struct work_struct tcp_listen_work;/* handle tcp socket accepts */ | 176 | struct work_struct tcp_listen_work;/* handle tcp socket accepts */ |
178 | struct work_struct smc_listen_work;/* prepare new accept socket */ | 177 | struct work_struct smc_listen_work;/* prepare new accept socket */ |
@@ -264,7 +263,7 @@ static inline bool using_ipsec(struct smc_sock *smc) | |||
264 | struct smc_clc_msg_local; | 263 | struct smc_clc_msg_local; |
265 | 264 | ||
266 | void smc_conn_free(struct smc_connection *conn); | 265 | void smc_conn_free(struct smc_connection *conn); |
267 | int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, | 266 | int smc_conn_create(struct smc_sock *smc, |
268 | struct smc_ib_device *smcibdev, u8 ibport, | 267 | struct smc_ib_device *smcibdev, u8 ibport, |
269 | struct smc_clc_msg_local *lcl, int srv_first_contact); | 268 | struct smc_clc_msg_local *lcl, int srv_first_contact); |
270 | struct sock *smc_accept_dequeue(struct sock *parent, struct socket *new_sock); | 269 | struct sock *smc_accept_dequeue(struct sock *parent, struct socket *new_sock); |
diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index 2424c7100aaf..bc11d06e38ae 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c | |||
@@ -144,7 +144,7 @@ free: | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* create a new SMC link group */ | 146 | /* create a new SMC link group */ |
147 | static int smc_lgr_create(struct smc_sock *smc, __be32 peer_in_addr, | 147 | static int smc_lgr_create(struct smc_sock *smc, |
148 | struct smc_ib_device *smcibdev, u8 ibport, | 148 | struct smc_ib_device *smcibdev, u8 ibport, |
149 | char *peer_systemid, unsigned short vlan_id) | 149 | char *peer_systemid, unsigned short vlan_id) |
150 | { | 150 | { |
@@ -161,7 +161,6 @@ static int smc_lgr_create(struct smc_sock *smc, __be32 peer_in_addr, | |||
161 | } | 161 | } |
162 | lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; | 162 | lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; |
163 | lgr->sync_err = false; | 163 | lgr->sync_err = false; |
164 | lgr->daddr = peer_in_addr; | ||
165 | memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN); | 164 | memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN); |
166 | lgr->vlan_id = vlan_id; | 165 | lgr->vlan_id = vlan_id; |
167 | rwlock_init(&lgr->sndbufs_lock); | 166 | rwlock_init(&lgr->sndbufs_lock); |
@@ -400,7 +399,7 @@ static int smc_link_determine_gid(struct smc_link_group *lgr) | |||
400 | } | 399 | } |
401 | 400 | ||
402 | /* create a new SMC connection (and a new link group if necessary) */ | 401 | /* create a new SMC connection (and a new link group if necessary) */ |
403 | int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, | 402 | int smc_conn_create(struct smc_sock *smc, |
404 | struct smc_ib_device *smcibdev, u8 ibport, | 403 | struct smc_ib_device *smcibdev, u8 ibport, |
405 | struct smc_clc_msg_local *lcl, int srv_first_contact) | 404 | struct smc_clc_msg_local *lcl, int srv_first_contact) |
406 | { | 405 | { |
@@ -457,7 +456,7 @@ int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, | |||
457 | 456 | ||
458 | create: | 457 | create: |
459 | if (local_contact == SMC_FIRST_CONTACT) { | 458 | if (local_contact == SMC_FIRST_CONTACT) { |
460 | rc = smc_lgr_create(smc, peer_in_addr, smcibdev, ibport, | 459 | rc = smc_lgr_create(smc, smcibdev, ibport, |
461 | lcl->id_for_peer, vlan_id); | 460 | lcl->id_for_peer, vlan_id); |
462 | if (rc) | 461 | if (rc) |
463 | goto out; | 462 | goto out; |
diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index fe691bf9af91..7852c3fabf12 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h | |||
@@ -124,7 +124,6 @@ struct smc_rtoken { /* address/key of remote RMB */ | |||
124 | struct smc_link_group { | 124 | struct smc_link_group { |
125 | struct list_head list; | 125 | struct list_head list; |
126 | enum smc_lgr_role role; /* client or server */ | 126 | enum smc_lgr_role role; /* client or server */ |
127 | __be32 daddr; /* destination ip address */ | ||
128 | struct smc_link lnk[SMC_LINKS_PER_LGR_MAX]; /* smc link */ | 127 | struct smc_link lnk[SMC_LINKS_PER_LGR_MAX]; /* smc link */ |
129 | char peer_systemid[SMC_SYSTEMID_LEN]; | 128 | char peer_systemid[SMC_SYSTEMID_LEN]; |
130 | /* unique system_id of peer */ | 129 | /* unique system_id of peer */ |