Commit e15c6c46 authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

net/smc: split CLC confirm/accept data to be sent

When sending CLC confirm and CLC accept, separate the trailing
part of the message from the initial part (to be prepared for
future first contact extension).
Signed-off-by: default avatarUrsula Braun <ubraun@linux.ibm.com>
Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7affc809
...@@ -505,8 +505,10 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, ...@@ -505,8 +505,10 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,
int first_contact) int first_contact)
{ {
struct smc_connection *conn = &smc->conn; struct smc_connection *conn = &smc->conn;
struct smc_clc_msg_trail trl;
struct kvec vec[2];
struct msghdr msg; struct msghdr msg;
struct kvec vec; int i;
/* send SMC Confirm CLC msg */ /* send SMC Confirm CLC msg */
clc->hdr.version = SMC_V1; /* SMC version */ clc->hdr.version = SMC_V1; /* SMC version */
...@@ -523,7 +525,7 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, ...@@ -523,7 +525,7 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,
clc->d0.dmbe_size = conn->rmbe_size_short; clc->d0.dmbe_size = conn->rmbe_size_short;
clc->d0.dmbe_idx = 0; clc->d0.dmbe_idx = 0;
memcpy(&clc->d0.linkid, conn->lgr->id, SMC_LGR_ID_SIZE); memcpy(&clc->d0.linkid, conn->lgr->id, SMC_LGR_ID_SIZE);
memcpy(clc->d0.smcd_trl.eyecatcher, SMCD_EYECATCHER, memcpy(trl.eyecatcher, SMCD_EYECATCHER,
sizeof(SMCD_EYECATCHER)); sizeof(SMCD_EYECATCHER));
} else { } else {
struct smc_link *link = conn->lnk; struct smc_link *link = conn->lnk;
...@@ -556,14 +558,19 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, ...@@ -556,14 +558,19 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,
clc->r0.rmb_dma_addr = cpu_to_be64((u64)sg_dma_address clc->r0.rmb_dma_addr = cpu_to_be64((u64)sg_dma_address
(conn->rmb_desc->sgt[link->link_idx].sgl)); (conn->rmb_desc->sgt[link->link_idx].sgl));
hton24(clc->r0.psn, link->psn_initial); hton24(clc->r0.psn, link->psn_initial);
memcpy(clc->r0.smcr_trl.eyecatcher, SMC_EYECATCHER, memcpy(trl.eyecatcher, SMC_EYECATCHER, sizeof(SMC_EYECATCHER));
sizeof(SMC_EYECATCHER));
} }
memset(&msg, 0, sizeof(msg)); memset(&msg, 0, sizeof(msg));
vec.iov_base = clc; i = 0;
vec.iov_len = ntohs(clc->hdr.length); vec[i].iov_base = clc;
return kernel_sendmsg(smc->clcsock, &msg, &vec, 1, vec[i++].iov_len = (clc->hdr.typev1 == SMC_TYPE_D ?
SMCD_CLC_ACCEPT_CONFIRM_LEN :
SMCR_CLC_ACCEPT_CONFIRM_LEN) -
sizeof(trl);
vec[i].iov_base = &trl;
vec[i++].iov_len = sizeof(trl);
return kernel_sendmsg(smc->clcsock, &msg, vec, 1,
ntohs(clc->hdr.length)); ntohs(clc->hdr.length));
} }
......
...@@ -134,8 +134,6 @@ struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */ ...@@ -134,8 +134,6 @@ struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */
__be64 rmb_dma_addr; /* RMB virtual address */ __be64 rmb_dma_addr; /* RMB virtual address */
u8 reserved2; u8 reserved2;
u8 psn[3]; /* packet sequence number */ u8 psn[3]; /* packet sequence number */
struct smc_clc_msg_trail smcr_trl;
/* eye catcher "SMCR" EBCDIC */
} __packed; } __packed;
struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */ struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */
...@@ -150,10 +148,8 @@ struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */ ...@@ -150,10 +148,8 @@ struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */
dmbe_size : 4; dmbe_size : 4;
#endif #endif
u16 reserved4; u16 reserved4;
u32 linkid; /* Link identifier */ __be32 linkid; /* Link identifier */
u32 reserved5[3]; u32 reserved5[3];
struct smc_clc_msg_trail smcd_trl;
/* eye catcher "SMCD" EBCDIC */
} __packed; } __packed;
struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */ struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */
......
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