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

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: default avatarKarsten Graul <kgraul@linux.vnet.ibm.com>
Signed-off-by: default avatarUrsula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 696cd301
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
* applicable with RoCE-cards only * applicable with RoCE-cards only
* *
* Initial restrictions: * Initial restrictions:
* - non-blocking connect postponed
* - IPv6 support postponed * - IPv6 support postponed
* - support for alternate links postponed * - support for alternate links postponed
* - partial support for non-blocking sockets only * - partial support for non-blocking sockets only
...@@ -345,7 +344,6 @@ static void smc_lgr_forget(struct smc_link_group *lgr) ...@@ -345,7 +344,6 @@ static void smc_lgr_forget(struct smc_link_group *lgr)
/* setup for RDMA connection of client */ /* setup for RDMA connection of client */
static int smc_connect_rdma(struct smc_sock *smc) static int smc_connect_rdma(struct smc_sock *smc)
{ {
struct sockaddr_in *inaddr = (struct sockaddr_in *)smc->addr;
struct smc_clc_msg_accept_confirm aclc; struct smc_clc_msg_accept_confirm aclc;
int local_contact = SMC_FIRST_CONTACT; int local_contact = SMC_FIRST_CONTACT;
struct smc_ib_device *smcibdev; struct smc_ib_device *smcibdev;
...@@ -399,8 +397,8 @@ static int smc_connect_rdma(struct smc_sock *smc) ...@@ -399,8 +397,8 @@ static int smc_connect_rdma(struct smc_sock *smc)
srv_first_contact = aclc.hdr.flag; srv_first_contact = aclc.hdr.flag;
mutex_lock(&smc_create_lgr_pending); mutex_lock(&smc_create_lgr_pending);
local_contact = smc_conn_create(smc, inaddr->sin_addr.s_addr, smcibdev, local_contact = smc_conn_create(smc, smcibdev, ibport, &aclc.lcl,
ibport, &aclc.lcl, srv_first_contact); srv_first_contact);
if (local_contact < 0) { if (local_contact < 0) {
rc = local_contact; rc = local_contact;
if (rc == -ENOMEM) if (rc == -ENOMEM)
...@@ -518,7 +516,6 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr, ...@@ -518,7 +516,6 @@ static int smc_connect(struct socket *sock, struct sockaddr *addr,
goto out_err; goto out_err;
if (addr->sa_family != AF_INET) if (addr->sa_family != AF_INET)
goto out_err; goto out_err;
smc->addr = addr; /* needed for nonblocking connect */
lock_sock(sk); lock_sock(sk);
switch (sk->sk_state) { switch (sk->sk_state) {
...@@ -726,7 +723,6 @@ static void smc_listen_work(struct work_struct *work) ...@@ -726,7 +723,6 @@ static void smc_listen_work(struct work_struct *work)
struct sock *newsmcsk = &new_smc->sk; struct sock *newsmcsk = &new_smc->sk;
struct smc_clc_msg_proposal *pclc; struct smc_clc_msg_proposal *pclc;
struct smc_ib_device *smcibdev; struct smc_ib_device *smcibdev;
struct sockaddr_in peeraddr;
u8 buf[SMC_CLC_MAX_LEN]; u8 buf[SMC_CLC_MAX_LEN];
struct smc_link *link; struct smc_link *link;
int reason_code = 0; int reason_code = 0;
...@@ -782,13 +778,10 @@ static void smc_listen_work(struct work_struct *work) ...@@ -782,13 +778,10 @@ static void smc_listen_work(struct work_struct *work)
goto decline_rdma; goto decline_rdma;
} }
/* get address of the peer connected to the internal TCP socket */
kernel_getpeername(newclcsock, (struct sockaddr *)&peeraddr);
/* allocate connection / link group */ /* allocate connection / link group */
mutex_lock(&smc_create_lgr_pending); mutex_lock(&smc_create_lgr_pending);
local_contact = smc_conn_create(new_smc, peeraddr.sin_addr.s_addr, local_contact = smc_conn_create(new_smc, smcibdev, ibport, &pclc->lcl,
smcibdev, ibport, &pclc->lcl, 0); 0);
if (local_contact < 0) { if (local_contact < 0) {
rc = local_contact; rc = local_contact;
if (rc == -ENOMEM) if (rc == -ENOMEM)
......
...@@ -172,7 +172,6 @@ struct smc_sock { /* smc sock container */ ...@@ -172,7 +172,6 @@ struct smc_sock { /* smc sock container */
struct sock sk; struct sock sk;
struct socket *clcsock; /* internal tcp socket */ struct socket *clcsock; /* internal tcp socket */
struct smc_connection conn; /* smc connection */ struct smc_connection conn; /* smc connection */
struct sockaddr *addr; /* inet connect address */
struct smc_sock *listen_smc; /* listen parent */ struct smc_sock *listen_smc; /* listen parent */
struct work_struct tcp_listen_work;/* handle tcp socket accepts */ struct work_struct tcp_listen_work;/* handle tcp socket accepts */
struct work_struct smc_listen_work;/* prepare new accept socket */ struct work_struct smc_listen_work;/* prepare new accept socket */
...@@ -264,7 +263,7 @@ static inline bool using_ipsec(struct smc_sock *smc) ...@@ -264,7 +263,7 @@ static inline bool using_ipsec(struct smc_sock *smc)
struct smc_clc_msg_local; struct smc_clc_msg_local;
void smc_conn_free(struct smc_connection *conn); void smc_conn_free(struct smc_connection *conn);
int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, int smc_conn_create(struct smc_sock *smc,
struct smc_ib_device *smcibdev, u8 ibport, struct smc_ib_device *smcibdev, u8 ibport,
struct smc_clc_msg_local *lcl, int srv_first_contact); struct smc_clc_msg_local *lcl, int srv_first_contact);
struct sock *smc_accept_dequeue(struct sock *parent, struct socket *new_sock); struct sock *smc_accept_dequeue(struct sock *parent, struct socket *new_sock);
......
...@@ -144,7 +144,7 @@ static void smc_lgr_free_work(struct work_struct *work) ...@@ -144,7 +144,7 @@ static void smc_lgr_free_work(struct work_struct *work)
} }
/* create a new SMC link group */ /* create a new SMC link group */
static int smc_lgr_create(struct smc_sock *smc, __be32 peer_in_addr, static int smc_lgr_create(struct smc_sock *smc,
struct smc_ib_device *smcibdev, u8 ibport, struct smc_ib_device *smcibdev, u8 ibport,
char *peer_systemid, unsigned short vlan_id) char *peer_systemid, unsigned short vlan_id)
{ {
...@@ -161,7 +161,6 @@ static int smc_lgr_create(struct smc_sock *smc, __be32 peer_in_addr, ...@@ -161,7 +161,6 @@ static int smc_lgr_create(struct smc_sock *smc, __be32 peer_in_addr,
} }
lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT;
lgr->sync_err = false; lgr->sync_err = false;
lgr->daddr = peer_in_addr;
memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN); memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN);
lgr->vlan_id = vlan_id; lgr->vlan_id = vlan_id;
rwlock_init(&lgr->sndbufs_lock); rwlock_init(&lgr->sndbufs_lock);
...@@ -400,7 +399,7 @@ static int smc_link_determine_gid(struct smc_link_group *lgr) ...@@ -400,7 +399,7 @@ static int smc_link_determine_gid(struct smc_link_group *lgr)
} }
/* create a new SMC connection (and a new link group if necessary) */ /* create a new SMC connection (and a new link group if necessary) */
int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, int smc_conn_create(struct smc_sock *smc,
struct smc_ib_device *smcibdev, u8 ibport, struct smc_ib_device *smcibdev, u8 ibport,
struct smc_clc_msg_local *lcl, int srv_first_contact) struct smc_clc_msg_local *lcl, int srv_first_contact)
{ {
...@@ -457,7 +456,7 @@ int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr, ...@@ -457,7 +456,7 @@ int smc_conn_create(struct smc_sock *smc, __be32 peer_in_addr,
create: create:
if (local_contact == SMC_FIRST_CONTACT) { if (local_contact == SMC_FIRST_CONTACT) {
rc = smc_lgr_create(smc, peer_in_addr, smcibdev, ibport, rc = smc_lgr_create(smc, smcibdev, ibport,
lcl->id_for_peer, vlan_id); lcl->id_for_peer, vlan_id);
if (rc) if (rc)
goto out; goto out;
......
...@@ -124,7 +124,6 @@ struct smc_rtoken { /* address/key of remote RMB */ ...@@ -124,7 +124,6 @@ struct smc_rtoken { /* address/key of remote RMB */
struct smc_link_group { struct smc_link_group {
struct list_head list; struct list_head list;
enum smc_lgr_role role; /* client or server */ enum smc_lgr_role role; /* client or server */
__be32 daddr; /* destination ip address */
struct smc_link lnk[SMC_LINKS_PER_LGR_MAX]; /* smc link */ struct smc_link lnk[SMC_LINKS_PER_LGR_MAX]; /* smc link */
char peer_systemid[SMC_SYSTEMID_LEN]; char peer_systemid[SMC_SYSTEMID_LEN];
/* unique system_id of peer */ /* unique system_id of peer */
......
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