net/smc: implement SMCv2.1 virtual ISM device support
Subsystems (5)
Wen Gu
reviewerv6 cover net/smc: implement SMCv2.1 virtual ISM device support
The fourth edition of SMCv2 adds the SMC version 2.1 feature updates for SMC-Dv2 with virtual ISM. Virtual ISM are created and supported mainly by OS or hypervisor software, comparable to IBM ISM which is based on platform firmware or hardware.
With the introduction of virtual ISM, SMCv2.1 makes some updates:
- Introduce feature bitmask to indicate supplemental features.
- Reserve a range of CHIDs for virtual ISM.
- Support extended GIDs (128 bits) in CLC handshake.
So this patch set aims to implement these updates in Linux kernel. And it acts as the first part of SMC-D virtual ISM extension & loopback-ism [1].
[1] https://lore.kernel.org/netdev/[email protected]/
v6->v5:
- Add 'Reviewed-by' label given in the previous versions:
* Patch #4, #6, #9, #10 have nothing changed since v3;
- Patch #2:
* fix the format issue (Alignment should match open parenthesis) compared to v5;
* remove useless clc->hdr.length assignment in smcr_clc_prep_confirm_accept()
compared to v5;
- Patch #3: new added compared to v5.
- Patch #7: some minor changes like aclc_v2->aclc or clc_v2->clc compared to v5 due to the introduction of Patch #3. Since there were no major changes, I kept the 'Reviewed-by' label.
Other changes in previous versions but not yet acked:
- Patch #1: Some minor changes in subject and fix the format issue (length exceeds 80 columns) compared to v3.
- Patch #5: removes useless ini->feature_mask assignment in __smc_connect() and smc_listen_v2_check() compared to v4.
- Patch #8: new added, compared to v3.
v5->v4:
- Patch #6: improve the comment of SMCD_CLC_MAX_V2_GID_ENTRIES;
- Patch #4: remove useless ini->feature_mask assignment;
v4->v3:
- Patch #6: use SMCD_CLC_MAX_V2_GID_ENTRIES to indicate the max gid entries in CLC proposal and using SMC_MAX_V2_ISM_DEVS to indicate the max devices to propose;
- Patch #6: use i and i+1 in smc_find_ism_v2_device_serv();
- Patch #2: replace the large if-else block in smc_clc_send_confirm_accept() with 2 subfunctions;
- Fix missing byte order conversion of GID and token in CLC handshake, which is in a separate patch sending to net:
https://lore.kernel.org/netdev/[email protected]/
- Patch #7: add extended GID in SMC-D lgr netlink attribute;
v3->v2:
- Rename smc_clc_fill_fce as smc_clc_fill_fce_v2x;
- Remove ISM_IDENT_MASK from drivers/s390/net/ism.h;
- Add explicitly assigning 'false' to ism_v2_capable in ism_dev_init();
- Remove smc_ism_set_v2_capable() helper for now, and introduce it in later loopback-ism implementation;
v2->v1:
- Fix sparse complaint;
- Rebase to the latest net-next;
Wen Gu (10):
net/smc: rename some 'fce' to 'fce_v2x' for clarity net/smc: introduce sub-functions for smc_clc_send_confirm_accept() net/smc: unify the structs of accept or confirm message for v1 and v2 net/smc: support SMCv2.x supplemental features negotiation net/smc: introduce virtual ISM device support feature net/smc: define a reserved CHID range for virtual ISM devices net/smc: compatible with 128-bits extended GID of virtual ISM device net/smc: support extended GID in SMC-D lgr netlink attribute net/smc: disable SEID on non-s390 archs where virtual ISM may be used net/smc: manage system EID in SMC stack instead of ISM driver
drivers/s390/net/ism.h | 7 - drivers/s390/net/ism_drv.c | 57 +++----- include/linux/ism.h | 1 - include/net/smc.h | 16 ++- include/uapi/linux/smc.h | 2 + include/uapi/linux/smc_diag.h | 2 + net/smc/af_smc.c | 116 +++++++++------ net/smc/smc.h | 10 +- net/smc/smc_clc.c | 318 +++++++++++++++++++++++++----------------- net/smc/smc_clc.h | 58 ++++---- net/smc/smc_core.c | 37 +++-- net/smc/smc_core.h | 18 ++- net/smc/smc_diag.c | 9 +- net/smc/smc_ism.c | 50 +++++-- net/smc/smc_ism.h | 30 +++- net/smc/smc_pnet.c | 4 +- 16 files changed, 445 insertions(+), 290 deletions(-)
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 1/10 net/smc: rename some 'fce' to 'fce_v2x' for clarity
Rename some functions or variables with 'fce' in their name but used in SMCv2.1 as 'fce_v2x' for clarity.
--- net/smc/smc_clc.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-)
net/smc/smc_clc.c +16 -14
@@ -418,15 +418,16 @@ static bool smc_clc_msg_prop_valid(struct smc_clc_msg_proposal *pclc)return true; } -static int smc_clc_fill_fce (struct smc_clc_first_contact_ext_v2x *fce, -struct smc_init_info *ini) +static int smc_clc_fill_fce_v2x (struct smc_clc_first_contact_ext_v2x *fce_v2x, +struct smc_init_info *ini) { -int ret =sizeof (*fce); +int ret =sizeof (*fce_v2x); -memset (fce,0 ,sizeof (*fce)); - fce->fce_v2_base.os_type =SMC_CLC_OS_LINUX ; - fce->fce_v2_base.release = ini->release_nr; -memcpy (fce->fce_v2_base.hostname, smc_hostname,sizeof (smc_hostname)); +memset (fce_v2x,0 ,sizeof (*fce_v2x)); + fce_v2x->fce_v2_base.os_type =SMC_CLC_OS_LINUX ; + fce_v2x->fce_v2_base.release = ini->release_nr; +memcpy (fce_v2x->fce_v2_base.hostname, + smc_hostname,sizeof (smc_hostname));if (ini->is_smcd && ini->release_nr <SMC_RELEASE_1 ) { ret =sizeof (struct smc_clc_first_contact_ext ); goto out;
@@ -434,8 +435,8 @@ static int smc_clc_fill_fce(struct smc_clc_first_contact_ext_v2x *fce,if (ini->release_nr >=SMC_RELEASE_1 ) {if (!ini->is_smcd) { - fce->max_conns = ini->max_conns; - fce->max_links = ini->max_links; + fce_v2x->max_conns = ini->max_conns; + fce_v2x->max_links = ini->max_links; } }
@@ -1003,8 +1004,8 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, int first_contact, u8 version, u8 *eid, struct smc_init_info *ini) { + struct smc_clc_first_contact_ext_v2x fce_v2x;struct smc_connection *conn = &smc->conn; -struct smc_clc_first_contact_ext_v2x fce;struct smcd_dev *smcd = conn->lgr->smcd;struct smc_clc_msg_accept_confirm *clc;struct smc_clc_fce_gid_ext gle;
@@ -1036,7 +1037,7 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,memcpy (clc_v2->d1.eid, eid,SMC_MAX_EID_LEN ); len =SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 ;if (first_contact) { - fce_len =smc_clc_fill_fce (&fce, ini); + fce_len =smc_clc_fill_fce_v2x (&fce_v2x, ini); len += fce_len; } clc_v2->hdr.length =htons (len);
@@ -1082,9 +1083,10 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc,memcpy (clc_v2->r1.eid, eid,SMC_MAX_EID_LEN ); len =SMCR_CLC_ACCEPT_CONFIRM_LEN_V2 ;if (first_contact) { - fce_len =smc_clc_fill_fce (&fce, ini); + fce_len =smc_clc_fill_fce_v2x (&fce_v2x, ini); len += fce_len; - fce.fce_v2_base.v2_direct = !link->lgr->uses_gateway; + fce_v2x.fce_v2_base.v2_direct = + !link->lgr->uses_gateway;if (clc->hdr.type ==SMC_CLC_CONFIRM ) {memset (&gle,0 ,sizeof (gle)); gle.gid_cnt = ini->smcrv2.gidlist.len;
@@ -1111,7 +1113,7 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, SMCR_CLC_ACCEPT_CONFIRM_LEN) -sizeof (trl);if (version >SMC_V1 && first_contact) { - vec[i].iov_base = &fce; + vec[i].iov_base = &fce_v2x; vec[i++].iov_len = fce_len;if (!conn->lgr->is_smcd) {if (clc->hdr.type ==SMC_CLC_CONFIRM ) {
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 2/10 net/smc: introduce sub-functions for smc_clc_send_confirm_accept()
In reply to Wen GuThere is a large if-else block in smc_clc_send_confirm_accept() and it is better to split it into two sub-functions.
--- net/smc/smc_clc.c | 197 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 115 insertions(+), 82 deletions(-)
net/smc/smc_clc.c +115 -82
@@ -998,6 +998,112 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)return reason_code; } +static void +smcd_clc_prep_confirm_accept (struct smc_connection *conn, +struct smc_clc_msg_accept_confirm_v2 *clc_v2, +int first_contact,u8 version, +u8 *eid,struct smc_init_info *ini, +int *fce_len, +struct smc_clc_first_contact_ext_v2x *fce_v2x, +struct smc_clc_msg_trail *trl) +{ +struct smcd_dev *smcd = conn->lgr->smcd; +struct smc_clc_msg_accept_confirm *clc; +int len; + +/* SMC-D specific settings */ + clc = (struct smc_clc_msg_accept_confirm *)clc_v2; +memcpy (clc->hdr.eyecatcher,SMCD_EYECATCHER , +sizeof (SMCD_EYECATCHER )); + clc->hdr.typev1 =SMC_TYPE_D ; + clc->d0.gid =htonll (smcd->ops->get_local_gid (smcd)); + clc->d0.token =htonll (conn->rmb_desc->token); + clc->d0.dmbe_size = conn->rmbe_size_comp; + clc->d0.dmbe_idx =0 ; +memcpy (&clc->d0.linkid, conn->lgr->id,SMC_LGR_ID_SIZE ); +if (version ==SMC_V1 ) { + clc->hdr.length =htons (SMCD_CLC_ACCEPT_CONFIRM_LEN ); + }else { + clc_v2->d1.chid =htons (smc_ism_get_chid (smcd)); +if (eid && eid[0 ]) +memcpy (clc_v2->d1.eid, eid,SMC_MAX_EID_LEN ); + len =SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 ; +if (first_contact) { + *fce_len =smc_clc_fill_fce_v2x (fce_v2x, ini); + len += *fce_len; + } + clc_v2->hdr.length =htons (len); + } +memcpy (trl->eyecatcher,SMCD_EYECATCHER , +sizeof (SMCD_EYECATCHER )); +} + +static void +smcr_clc_prep_confirm_accept (struct smc_connection *conn, +struct smc_clc_msg_accept_confirm_v2 *clc_v2, +int first_contact,u8 version, +u8 *eid,struct smc_init_info *ini, +int *fce_len, +struct smc_clc_first_contact_ext_v2x *fce_v2x, +struct smc_clc_fce_gid_ext *gle, +struct smc_clc_msg_trail *trl) +{ +struct smc_clc_msg_accept_confirm *clc; +struct smc_link *link = conn->lnk; +int len; + +/* SMC-R specific settings */ + clc = (struct smc_clc_msg_accept_confirm *)clc_v2; +memcpy (clc->hdr.eyecatcher,SMC_EYECATCHER , +sizeof (SMC_EYECATCHER )); + clc->hdr.typev1 =SMC_TYPE_R ; +memcpy (clc->r0.lcl.id_for_peer, local_systemid, +sizeof (local_systemid)); +memcpy (&clc->r0.lcl.gid, link->gid,SMC_GID_SIZE ); +memcpy (&clc->r0.lcl.mac, &link->smcibdev->mac[link->ibport -1 ], +ETH_ALEN ); +hton24 (clc->r0.qpn, link->roce_qp->qp_num); + clc->r0.rmb_rkey = +htonl (conn->rmb_desc->mr[link->link_idx]->rkey); + clc->r0.rmbe_idx =1 ;/* for now: 1 RMB = 1 RMBE */ + clc->r0.rmbe_alert_token =htonl (conn->alert_token_local); +switch (clc->hdr.type) { +case SMC_CLC_ACCEPT : + clc->r0.qp_mtu = link->path_mtu; +break ; +case SMC_CLC_CONFIRM : + clc->r0.qp_mtu =min (link->path_mtu, link->peer_mtu); +break ; + } + clc->r0.rmbe_size = conn->rmbe_size_comp; + clc->r0.rmb_dma_addr = conn->rmb_desc->is_vm ? +cpu_to_be64 ((uintptr_t )conn->rmb_desc->cpu_addr) : +cpu_to_be64 ((u64 )sg_dma_address + (conn->rmb_desc->sgt[link->link_idx].sgl)); +hton24 (clc->r0.psn, link->psn_initial); +if (version ==SMC_V1 ) { + clc->hdr.length =htons (SMCR_CLC_ACCEPT_CONFIRM_LEN ); + }else { +if (eid && eid[0 ]) +memcpy (clc_v2->r1.eid, eid,SMC_MAX_EID_LEN ); + len =SMCR_CLC_ACCEPT_CONFIRM_LEN_V2 ; +if (first_contact) { + *fce_len =smc_clc_fill_fce_v2x (fce_v2x, ini); + len += *fce_len; + fce_v2x->fce_v2_base.v2_direct = + !link->lgr->uses_gateway; +if (clc->hdr.type ==SMC_CLC_CONFIRM ) { +memset (gle,0 ,sizeof (*gle)); + gle->gid_cnt = ini->smcrv2.gidlist.len; + len +=sizeof (*gle); + len += gle->gid_cnt *sizeof (gle->gid[0 ]); + } + } + clc_v2->hdr.length =htons (len); + } +memcpy (trl->eyecatcher,SMC_EYECATCHER ,sizeof (SMC_EYECATCHER )); +} +/* build and send CLC CONFIRM / ACCEPT message */ static int smc_clc_send_confirm_accept(struct smc_sock *smc, struct smc_clc_msg_accept_confirm_v2 *clc_v2,
@@ -1006,11 +1112,10 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, {struct smc_clc_first_contact_ext_v2x fce_v2x;struct smc_connection *conn = &smc->conn; -struct smcd_dev *smcd = conn->lgr->smcd;struct smc_clc_msg_accept_confirm *clc;struct smc_clc_fce_gid_ext gle;struct smc_clc_msg_trail trl; -int i, len, fce_len; +int i, fce_len;struct kvec vec[5 ];struct msghdr msg;
@@ -1019,86 +1124,14 @@ static int smc_clc_send_confirm_accept(struct smc_sock *smc, clc->hdr.version = version;/* SMC version */ if (first_contact) clc->hdr.typev2 |=SMC_FIRST_CONTACT_MASK ; -if (conn->lgr->is_smcd) { -/* SMC-D specific settings */ -memcpy (clc->hdr.eyecatcher,SMCD_EYECATCHER , -sizeof (SMCD_EYECATCHER )); - clc->hdr.typev1 =SMC_TYPE_D ; - clc->d0.gid =htonll (smcd->ops->get_local_gid (smcd)); - clc->d0.token =htonll (conn->rmb_desc->token); - clc->d0.dmbe_size = conn->rmbe_size_comp; - clc->d0.dmbe_idx =0 ; -memcpy (&clc->d0.linkid, conn->lgr->id,SMC_LGR_ID_SIZE ); -if (version ==SMC_V1 ) { - clc->hdr.length =htons (SMCD_CLC_ACCEPT_CONFIRM_LEN ); - }else { - clc_v2->d1.chid =htons (smc_ism_get_chid (smcd)); -if (eid && eid[0 ]) -memcpy (clc_v2->d1.eid, eid,SMC_MAX_EID_LEN ); - len =SMCD_CLC_ACCEPT_CONFIRM_LEN_V2 ; -if (first_contact) { - fce_len =smc_clc_fill_fce_v2x (&fce_v2x, ini); - len += fce_len; - } - clc_v2->hdr.length =htons (len); - } -memcpy (trl.eyecatcher,SMCD_EYECATCHER , -sizeof (SMCD_EYECATCHER )); - }else { -struct smc_link *link = conn->lnk; - -/* SMC-R specific settings */ -memcpy (clc->hdr.eyecatcher,SMC_EYECATCHER , -sizeof (SMC_EYECATCHER )); - clc->hdr.typev1 =SMC_TYPE_R ; - clc->hdr.length =htons (SMCR_CLC_ACCEPT_CONFIRM_LEN ); -memcpy (clc->r0.lcl.id_for_peer, local_systemid, -sizeof (local_systemid)); -memcpy (&clc->r0.lcl.gid, link->gid,SMC_GID_SIZE ); -memcpy (&clc->r0.lcl.mac, &link->smcibdev->mac[link->ibport -1 ], -ETH_ALEN ); -hton24 (clc->r0.qpn, link->roce_qp->qp_num); - clc->r0.rmb_rkey = -htonl (conn->rmb_desc->mr[link->link_idx]->rkey); - clc->r0.rmbe_idx =1 ;/* for now: 1 RMB = 1 RMBE */ - clc->r0.rmbe_alert_token =htonl (conn->alert_token_local); -switch (clc->hdr.type) { -case SMC_CLC_ACCEPT : - clc->r0.qp_mtu = link->path_mtu; -break ; -case SMC_CLC_CONFIRM : - clc->r0.qp_mtu =min (link->path_mtu, link->peer_mtu); -break ; - } - clc->r0.rmbe_size = conn->rmbe_size_comp; - clc->r0.rmb_dma_addr = conn->rmb_desc->is_vm ? -cpu_to_be64 ((uintptr_t )conn->rmb_desc->cpu_addr) : -cpu_to_be64 ((u64 )sg_dma_address - (conn->rmb_desc->sgt[link->link_idx].sgl)); -hton24 (clc->r0.psn, link->psn_initial); -if (version ==SMC_V1 ) { - clc->hdr.length =htons (SMCR_CLC_ACCEPT_CONFIRM_LEN ); - }else { -if (eid && eid[0 ]) -memcpy (clc_v2->r1.eid, eid,SMC_MAX_EID_LEN ); - len =SMCR_CLC_ACCEPT_CONFIRM_LEN_V2 ; -if (first_contact) { - fce_len =smc_clc_fill_fce_v2x (&fce_v2x, ini); - len += fce_len; - fce_v2x.fce_v2_base.v2_direct = - !link->lgr->uses_gateway; -if (clc->hdr.type ==SMC_CLC_CONFIRM ) { -memset (&gle,0 ,sizeof (gle)); - gle.gid_cnt = ini->smcrv2.gidlist.len; - len +=sizeof (gle); - len += gle.gid_cnt *sizeof (gle.gid[0 ]); - } - } - clc_v2->hdr.length =htons (len); - } -memcpy (trl.eyecatcher,SMC_EYECATCHER ,sizeof (SMC_EYECATCHER )); - } - +if (conn->lgr->is_smcd) +smcd_clc_prep_confirm_accept (conn, clc_v2, first_contact, + version, eid, ini, &fce_len, + &fce_v2x, &trl); +else +smcr_clc_prep_confirm_accept (conn, clc_v2, first_contact, + version, eid, ini, &fce_len, + &fce_v2x, &gle, &trl);memset (&msg,0 ,sizeof (msg)); i =0 ; vec[i].iov_base = clc_v2;
Signature · 1 line
1.8.3.1
Re: [PATCH net-next v6 02/10] net/smc: introduce sub-functions for smc_clc_send_confirm_accept()
Quoted 6 lines · Wen Gu
There is a large if-else block in
smc_clc_send_confirm_accept()and it is better to split it into two sub-functions.Suggested-by Alexandra Winter <[email protected]>Signed-off-by Wen Gu <[email protected]>---
Wen Gu
reviewerPATCH v6 3/10 net/smc: unify the structs of accept or confirm message for v1 and v2
In reply to Wen GuThe structs of CLC accept and confirm messages for SMCv1 and SMCv2 are separately defined and often casted to each other in the code, which may increase the risk of errors caused by future divergence of them. So unify them into one struct for better maintainability.
--- net/smc/af_smc.c | 50 +++++++++++++++--------------------------- net/smc/smc_clc.c | 65 ++++++++++++++++++++++++------------------------------- net/smc/smc_clc.h | 32 ++++++++++----------------- 3 files changed, 57 insertions(+), 90 deletions(-)
net/smc/af_smc.c +17 -33
@@ -677,8 +677,6 @@ static bool smc_isascii(char *hostname)static void smc_conn_save_peer_info_fce (struct smc_sock *smc,struct smc_clc_msg_accept_confirm *clc) { -struct smc_clc_msg_accept_confirm_v2 *clc_v2 = - (struct smc_clc_msg_accept_confirm_v2 *)clc;struct smc_clc_first_contact_ext *fce;int clc_v2_len;
@@ -687,17 +685,17 @@ static void smc_conn_save_peer_info_fce(struct smc_sock *smc,return ;if (smc->conn.lgr->is_smcd) { -memcpy (smc->conn.lgr->negotiated_eid, clc_v2->d1.eid, +memcpy (smc->conn.lgr->negotiated_eid, clc->d1.eid,SMC_MAX_EID_LEN ); - clc_v2_len = offsetofend(struct smc_clc_msg_accept_confirm_v2, + clc_v2_len = offsetofend(struct smc_clc_msg_accept_confirm, d1); }else { -memcpy (smc->conn.lgr->negotiated_eid, clc_v2->r1.eid, +memcpy (smc->conn.lgr->negotiated_eid, clc->r1.eid,SMC_MAX_EID_LEN ); - clc_v2_len = offsetofend(struct smc_clc_msg_accept_confirm_v2, + clc_v2_len = offsetofend(struct smc_clc_msg_accept_confirm, r1); } - fce = (struct smc_clc_first_contact_ext *)(((u8 *)clc_v2) + clc_v2_len); + fce = (struct smc_clc_first_contact_ext *)(((u8 *)clc) + clc_v2_len); smc->conn.lgr->peer_os = fce->os_type; smc->conn.lgr->peer_smc_release = fce->release;if (smc_isascii (fce->hostname))
@@ -1149,13 +1147,13 @@ static int smc_connect_ism_vlan_cleanup(struct smc_sock *smc, }#define SMC_CLC_MAX_ACCEPT_LEN \ - (sizeof(struct smc_clc_msg_accept_confirm_v2) + \ + (sizeof(struct smc_clc_msg_accept_confirm) + \ sizeof(struct smc_clc_first_contact_ext_v2x) + \ sizeof(struct smc_clc_msg_trail))/* CLC handshake during connect */ static int smc_connect_clc (struct smc_sock *smc, -struct smc_clc_msg_accept_confirm_v2 *aclc2, +struct smc_clc_msg_accept_confirm *aclc,struct smc_init_info *ini) {int rc =0 ;
@@ -1165,7 +1163,7 @@ static int smc_connect_clc(struct smc_sock *smc,if (rc)return rc;/* receive SMC Accept CLC message */ -return smc_clc_wait_msg (smc, aclc2,SMC_CLC_MAX_ACCEPT_LEN , +return smc_clc_wait_msg (smc, aclc,SMC_CLC_MAX_ACCEPT_LEN ,SMC_CLC_ACCEPT ,CLC_WAIT_TIME ); }
@@ -1201,10 +1199,8 @@ static int smc_connect_rdma_v2_prepare(struct smc_sock *smc,struct smc_clc_msg_accept_confirm *aclc, struct smc_init_info *ini) { - struct smc_clc_msg_accept_confirm_v2 *clc_v2 = - (struct smc_clc_msg_accept_confirm_v2 *)aclc; struct smc_clc_first_contact_ext *fce = -smc_get_clc_first_contact_ext (clc_v2, false); +smc_get_clc_first_contact_ext (aclc, false);struct net *net =sock_net (&smc->sk);int rc;
@@ -1327,10 +1323,7 @@ static int smc_connect_rdma(struct smc_sock *smc, }if (aclc->hdr.version >SMC_V1 ) { -struct smc_clc_msg_accept_confirm_v2 *clc_v2 = - (struct smc_clc_msg_accept_confirm_v2 *)aclc; - - eid = clc_v2->r1.eid; + eid = aclc->r1.eid;if (ini->first_contact_local)smc_fill_gid_list (link->lgr, &ini->smcrv2.gidlist, link->smcibdev, link->gid);
@@ -1371,7 +1364,7 @@ static int smc_connect_rdma(struct smc_sock *smc,* Determine from the CHID of the received CLC ACCEPT the ISM device chosen. */ static int -smc_v2_determine_accepted_chid (struct smc_clc_msg_accept_confirm_v2 *aclc, +smc_v2_determine_accepted_chid (struct smc_clc_msg_accept_confirm *aclc,struct smc_init_info *ini) {int i;
@@ -1398,12 +1391,9 @@ static int smc_connect_ism(struct smc_sock *smc, ini->first_contact_peer = aclc->hdr.typev2 &SMC_FIRST_CONTACT_MASK ;if (aclc->hdr.version ==SMC_V2 ) { -struct smc_clc_msg_accept_confirm_v2 *aclc_v2 = - (struct smc_clc_msg_accept_confirm_v2 *)aclc; -if (ini->first_contact_peer) {struct smc_clc_first_contact_ext *fce = -smc_get_clc_first_contact_ext (aclc_v2, true); +smc_get_clc_first_contact_ext (aclc, true); ini->release_nr = fce->release; rc =smc_clc_clnt_v2x_features_validate (fce, ini);
@@ -1411,7 +1401,7 @@ static int smc_connect_ism(struct smc_sock *smc,return rc; } - rc =smc_v2_determine_accepted_chid (aclc_v2, ini); + rc =smc_v2_determine_accepted_chid (aclc, ini);if (rc)return rc; }
@@ -1437,12 +1427,8 @@ static int smc_connect_ism(struct smc_sock *smc,smc_rx_init (smc);smc_tx_init (smc); -if (aclc->hdr.version >SMC_V1 ) { -struct smc_clc_msg_accept_confirm_v2 *clc_v2 = - (struct smc_clc_msg_accept_confirm_v2 *)aclc; - - eid = clc_v2->d1.eid; - } +if (aclc->hdr.version >SMC_V1 ) + eid = aclc->d1.eid; rc =smc_clc_send_confirm (smc, ini->first_contact_local, aclc->hdr.version, eid, ini);
@@ -1493,7 +1479,6 @@ static int smc_connect_check_aclc(struct smc_init_info *ini,static int __smc_connect (struct smc_sock *smc) {u8 version =smc_ism_is_v2_capable () ?SMC_V2 :SMC_V1 ; -struct smc_clc_msg_accept_confirm_v2 *aclc2;struct smc_clc_msg_accept_confirm *aclc;struct smc_init_info *ini =NULL ;u8 *buf =NULL ;
@@ -1541,11 +1526,10 @@ static int __smc_connect(struct smc_sock *smc) rc =SMC_CLC_DECL_MEM ; goto fallback; } - aclc2 = (struct smc_clc_msg_accept_confirm_v2 *)buf; - aclc = (struct smc_clc_msg_accept_confirm *)aclc2; + aclc = (struct smc_clc_msg_accept_confirm *)buf;/* perform CLC handshake */ - rc =smc_connect_clc (smc, aclc2, ini); + rc =smc_connect_clc (smc, aclc, ini);if (rc) {/* -EAGAIN on timeout, see tcp_recvmsg() */ if (rc == -EAGAIN ) {
net/smc/smc_clc.c +28 -37
196 lines not on this page · raw message
net/smc/smc_clc.h +12 -20
@@ -259,29 +259,22 @@ struct smc_clc_fce_gid_ext {struct smc_clc_msg_accept_confirm {/* clc accept / confirm message */ struct smc_clc_msg_hdr hdr;union { -struct smcr_clc_msg_accept_confirm r0;/* SMC-R */ -struct {/* SMC-D */ -struct smcd_clc_msg_accept_confirm_common d0; -u32 reserved5[3 ]; - }; - }; -} __packed;/* format defined in RFC7609 */ - -struct smc_clc_msg_accept_confirm_v2 {/* clc accept / confirm message */ -struct smc_clc_msg_hdr hdr; -union {struct {/* SMC-R */ -struct smcr_clc_msg_accept_confirm r0; +struct smcr_clc_msg_accept_confirm _r0; +/* v2 only, reserved and ignored in v1: */ u8 eid[SMC_MAX_EID_LEN ];u8 reserved6[8 ]; } r1;struct {/* SMC-D */ -struct smcd_clc_msg_accept_confirm_common d0; +struct smcd_clc_msg_accept_confirm_common _d0; +/* v2 only, reserved and ignored in v1: */ __be16 chid;u8 eid[SMC_MAX_EID_LEN ];u8 reserved5[8 ]; } d1; }; +#define r0 r1._r0 +#define d0 d1._d0 };struct smc_clc_msg_decline {/* clc decline message */
@@ -389,24 +382,23 @@ static inline u8 smc_indicated_type(int is_smcd, int is_smcr) }static inline struct smc_clc_first_contact_ext * -smc_get_clc_first_contact_ext (struct smc_clc_msg_accept_confirm_v2 *clc_v2, +smc_get_clc_first_contact_ext (struct smc_clc_msg_accept_confirm *clc,bool is_smcd) {int clc_v2_len; -if (clc_v2->hdr.version ==SMC_V1 || - !(clc_v2->hdr.typev2 &SMC_FIRST_CONTACT_MASK )) +if (clc->hdr.version ==SMC_V1 || + !(clc->hdr.typev2 &SMC_FIRST_CONTACT_MASK ))return NULL ;if (is_smcd) clc_v2_len = - offsetofend(struct smc_clc_msg_accept_confirm_v2, d1); + offsetofend(struct smc_clc_msg_accept_confirm, d1);else clc_v2_len = - offsetofend(struct smc_clc_msg_accept_confirm_v2, r1); + offsetofend(struct smc_clc_msg_accept_confirm, r1); -return (struct smc_clc_first_contact_ext *)(((u8 *)clc_v2) + - clc_v2_len); +return (struct smc_clc_first_contact_ext *)(((u8 *)clc) + clc_v2_len); }struct smcd_dev ;
Signature · 1 line
1.8.3.1
Alexandra Winter
maintainerRe: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
Quoted 5 lines · Wen Gu
The structs of CLC accept and confirm messages for SMCv1 and SMCv2 are separately defined and often casted to each other in the code, which may increase the risk of errors caused by future divergence of them. So unify them into one struct for better maintainability.
Quoted 8 lines
Suggested-by Alexandra Winter <[email protected]>Signed-off-by Wen Gu <[email protected]>--- net/smc/af_smc.c | 50 +++++++++++++++--------------------------- net/smc/smc_clc.c | 65 ++++++++++++++++++++++++------------------------------- net/smc/smc_clc.h | 32 ++++++++++----------------- 3 files changed, 57 insertions(+), 90 deletions(-)
[...]
Thank you very much, Wen Gu. I think this makes it much easier to spot the places in the accept/confirm code code where v1 vs v2 really make a difference. I understand that this is not really related to v2.1, but I feel it is worth simplifying the already complex strucutres before adding even more complexity.
Quoted 27 lines
net/smc/smc_clc.h +2
-12@@ -259,29 +259,22 @@ struct smc_clc_fce_gid_ext { struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */ struct smc_clc_msg_hdr hdr; union { -struct smcr_clc_msg_accept_confirm r0;/* SMC-R */ -struct {/* SMC-D */ -struct smcd_clc_msg_accept_confirm_common d0; -u32 reserved5[3 ]; - }; - }; -} __packed;/* format defined in RFC7609 */ - -struct smc_clc_msg_accept_confirm_v2 { /* clc accept / confirm message */ - struct smc_clc_msg_hdr hdr; - union { struct { /* SMC-R */ - struct smcr_clc_msg_accept_confirm r0; + struct smcr_clc_msg_accept_confirm _r0; + /* v2 only, reserved and ignored in v1: */ u8 eid[SMC_MAX_EID_LEN]; u8 reserved6[8]; } r1; struct { /* SMC-D */
net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 277
Quoted 10 lines
net/smc/smc_clc.h +4
-1-struct smcd_clc_msg_accept_confirm_common d0; +struct smcd_clc_msg_accept_confirm_common _d0; +/* v2 only, reserved and ignored in v1: */ __be16 chid;u8 eid[SMC_MAX_EID_LEN ];u8 reserved5[8 ]; } d1; }; +#define r0 r1._r0 +#define d0 d1._d0
This adds complexity.
If you add the v2-only fields to struct smcr_clc_msg_accept_confirm and struct smcd_clc_msg_accept_confirm_common respectively, you can avoid the #define and the extra layer in the struct.
Actually there are already v2-only fields in smcd_clc_msg_accept_confirm_common and smcd_clc_msg_accept_confirm_common (gid and others). So you could add the correct informative comments there.
net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 278
Quoted 1 line
net/smc/smc_clc.h +0
-0};
You have removed the __packed attribute.
patch 07/10 adds it back for the SMC-D case, but the SMC-R case needs it as well.
[...]
Wen Gu
reviewerRe: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
Quoted 63 lines · Alexandra Winter
Quoted 5 lines · Wen Gu
The structs of CLC accept and confirm messages for SMCv1 and SMCv2 are separately defined and often casted to each other in the code, which may increase the risk of errors caused by future divergence of them. So unify them into one struct for better maintainability.
Quoted 8 lines
Suggested-by Alexandra Winter <[email protected]>Signed-off-by Wen Gu <[email protected]>--- net/smc/af_smc.c | 50 +++++++++++++++--------------------------- net/smc/smc_clc.c | 65 ++++++++++++++++++++++++------------------------------- net/smc/smc_clc.h | 32 ++++++++++----------------- 3 files changed, 57 insertions(+), 90 deletions(-)[...]
Thank you very much, Wen Gu. I think this makes it much easier to spot the places in the accept/confirm code code where v1 vs v2 really make a difference. I understand that this is not really related to v2.1, but I feel it is worth simplifying the already complex strucutres before adding even more complexity.Quoted 27 lines
net/smc/smc_clc.h +2
-12@@ -259,29 +259,22 @@ struct smc_clc_fce_gid_ext { struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */ struct smc_clc_msg_hdr hdr; union { -struct smcr_clc_msg_accept_confirm r0;/* SMC-R */ -struct {/* SMC-D */ -struct smcd_clc_msg_accept_confirm_common d0; -u32 reserved5[3 ]; - }; - }; -} __packed;/* format defined in RFC7609 */ - -struct smc_clc_msg_accept_confirm_v2 { /* clc accept / confirm message */ - struct smc_clc_msg_hdr hdr; - union { struct { /* SMC-R */ - struct smcr_clc_msg_accept_confirm r0; + struct smcr_clc_msg_accept_confirm _r0; + /* v2 only, reserved and ignored in v1: */ u8 eid[SMC_MAX_EID_LEN]; u8 reserved6[8]; } r1; struct { /* SMC-D */net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 277
Quoted 10 lines
net/smc/smc_clc.h +4
-1-struct smcd_clc_msg_accept_confirm_common d0; +struct smcd_clc_msg_accept_confirm_common _d0; +/* v2 only, reserved and ignored in v1: */ __be16 chid;u8 eid[SMC_MAX_EID_LEN ];u8 reserved5[8 ]; } d1; }; +#define r0 r1._r0 +#define d0 d1._d0
Quoted 7 lines
This adds complexity.
If you add the v2-only fields to structsmcr_clc_msg_accept_confirmand structsmcd_clc_msg_accept_confirm_commonrespectively, you can avoid the #define and the extra layer in the struct.
Actually there are already v2-only fields insmcd_clc_msg_accept_confirm_commonandsmcd_clc_msg_accept_confirm_common(gid and others). So you could add the correct informative comments there.
Thank you very much for the suggestions, Sandy.
I checked the history commits:c758dfddc1b5 ("net/smc: add SMC-D support in CLC messages") 3d9725a6a133 ("net/smc: common routine for CLC accept and confirm") a7c9c5f4af7f ("net/smc: CLC accept / confirm V2") e5c4744cfb59 ("net/smc: add SMC-Rv2 connection establishment")
The fields in smcr_clc_msg_accept_confirm and smcd_clc_msg_accept_confirm_common seem to have not changed since SMCDv1. So I guess there is no v2-only fields in this two struct. I tried to confirm this in some documents but didn't find the message format for v1.
If the smcr_clc_msg_accept_confirm and smcd_clc_msg_accept_confirm_common is inherited from v1, should we still put the fields of v2 into these two structures?
If still, I will change these structures as
net/smc/smc_clc.h +10 -16
@@ -201,9 +201,12 @@ struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */__be64 rmb_dma_addr;/* RMB virtual address */ u8 reserved2;u8 psn[3 ];/* packet sequence number */ +/* v2 only, reserved and ignored in v1: */ +u8 eid[SMC_MAX_EID_LEN ]; +u8 reserved6[8 ]; } __packed; -struct smcd_clc_msg_accept_confirm_common {/* SMCD accept/confirm */ +struct smcd_clc_msg_accept_confirm {/* SMCD accept/confirm */ __be64 gid;/* Sender GID */ __be64 token;/* DMB token */ u8 dmbe_idx;/* DMBE index */
@@ -216,6 +219,10 @@ struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */#endif u16 reserved4;__be32 linkid;/* Link identifier */ +/* v2 only, reserved and ignored in v1: */ +__be16 chid; +u8 eid[SMC_MAX_EID_LEN ]; +u8 reserved5[8 ]; } __packed;#define SMC_CLC_OS_ZOS 1
@@ -259,22 +266,9 @@ struct smc_clc_fce_gid_ext {struct smc_clc_msg_accept_confirm {/* clc accept / confirm message */ struct smc_clc_msg_hdr hdr;union { -struct {/* SMC-R */ -struct smcr_clc_msg_accept_confirm _r0; -/* v2 only, reserved and ignored in v1: */ -u8 eid[SMC_MAX_EID_LEN ]; -u8 reserved6[8 ]; - } r1; -struct {/* SMC-D */ -struct smcd_clc_msg_accept_confirm_common _d0; -/* v2 only, reserved and ignored in v1: */ -__be16 chid; -u8 eid[SMC_MAX_EID_LEN ]; -u8 reserved5[8 ]; - } d1; +struct smcr_clc_msg_accept_confirm r0;/* SMC-R */ +struct smcd_clc_msg_accept_confirm d0;/* SMC-D */ }; -#define r0 r1._r0 -#define d0 d1._d0 };
Quoted 6 lines
net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 278
Quoted 2 lines
net/smc/smc_clc.h +0
-0};You have removed the
__packedattribute.
patch 07/10 adds it back for the SMC-D case, but the SMC-R case needs it as well.
r1 and d1 in smc_clc_msg_accept_confirm_v2 (smc_clc_msg_accept_confirm now in this patch) is aligned well. In patch 07/10 I replaced reserved5[8] with u64 gid_ext, thus making a hole before gid_ext, so I added __packed attribute to SMC-D.
If it is to avoid potential mistakes in future expansion, I can also add __packed to SMC-R.
Thanks.
Quoted 2 lines
[...]
Alexandra Winter
maintainerRe: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
Quoted 4 lines · Wen Gu
The fields in
smcr_clc_msg_accept_confirmandsmcd_clc_msg_accept_confirm_commonseem to have not changed since SMCDv1. So I guess there is no v2-only fields in this two struct. I tried to confirm this in some documents but didn't find the message format for v1.
V1 is documented in
https://datatracker.ietf.org/doc/html/draft-fox-tcpm-shared-memory-rdma-03
Quoted 3 lines
If the
smcr_clc_msg_accept_confirmandsmcd_clc_msg_accept_confirm_commonis inherited from v1, should we still put the fields of v2 into these two structures?
You are right, they do not contain v2 fields, I guess I was confused.
I still think, it would be better for readability and maintainability to avoid
+#define r0 r1._r0
+#define d0 d1._d0
I guess you and previous editors wanted to avoid changing all the instances that use r0 and d0. But then.. it is a rather simple search/replace..
Quoted 33 lines
If still, I will change these structures as
net/smc/smc_clc.h +0
-0@@ -201,9 +201,12 @@ struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */
__be64rmb_dma_addr; /* RMB virtual address */ u8 reserved2;
u8 psn[3]; /* packet sequence number */ + /* v2 only, reserved and ignored in v1: */ + u8 eid[SMC_MAX_EID_LEN];
+ u8 reserved6[8];
}__packed;net/smc/smc_clc.h +1
-1-struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */ +struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */
__be64gid; /* Sender GID */
__be64token; /* DMB token */
u8 dmbe_idx; /* DMBE index */net/smc/smc_clc.h +0
-0@@ -216,6 +219,10 @@ struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */ #endif u16 reserved4;
__be32linkid; /* Link identifier */ + /* v2 only, reserved and ignored in v1: */ +__be16chid;
+ u8 eid[SMC_MAX_EID_LEN];
+ u8 reserved5[8];
}__packed;#define SMC_CLC_OS_ZOS 1
net/smc/smc_clc.h +0
-0@@ -259,22 +266,9 @@ struct smc_clc_fce_gid_ext {
Quoted 6 lines
struct
smc_clc_msg_accept_confirm{ /* clc accept / confirm message */ structsmc_clc_msg_hdrhdr;
union {
- struct { /* SMC-R */
- structsmcr_clc_msg_accept_confirm_r0; - /* v2 only, reserved and ignored in v1: */
^^ Actually these commetns are not fully correct. The fields are not reserved in V1. (my bad) The message length is shorter in V1.
So /* v2 only: */ would be more correct.
Quoted 6 lines
- u8 eid[SMC_MAX_EID_LEN];
- u8 reserved6[8];
- } r1;
- struct { /* SMC-D */
- structsmcd_clc_msg_accept_confirm_common_d0; - /* v2 only, reserved and ignored in v1: */
same here: /* v2 only: */
Quoted 9 lines
-
__be16chid;
- u8 eid[SMC_MAX_EID_LEN];
- u8 reserved5[8];
- } d1;
+ structsmcr_clc_msg_accept_confirmr0; /* SMC-R */ + structsmcd_clc_msg_accept_confirmd0; /* SMC-D */ };net/smc/smc_clc.h +0
-2-#define r0 r1._r0 -#define d0 d1._d0
Quoted 4 lines
};
Quoted 2 lines
Quoted 2 lines
};
Yes, I like that solution better.
But I have no strong feelings. At least the duplicate declarations are gone. So, if you prefer the #defines , it's ok with me.
Quoted 11 lines
Quoted 4 lines
You have removed the
__packedattribute.
patch 07/10 adds it back for the SMC-D case, but the SMC-R case needs it as well.r1 and d1 in
smc_clc_msg_accept_confirm_v2(smc_clc_msg_accept_confirmnow in this patch) is aligned well. In patch 07/10 I replaced reserved5[8] with u64gid_ext, thus making a hole beforegid_ext, so I added__packedattribute to SMC-D.If it is to avoid potential mistakes in future expansion, I can also add
__packedto SMC-R.
Yes, __packed is not only about preventing misalignement today.
IMU, without __packed, there is no guarantee that a future compile run will not insert unused bytes. (highly unlikely, I admit). But __packed makes it visible that this needs to go to hardware in exactly this layout.
Quoted 1 line
Thanks.
Wen Gu
reviewerRe: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
Quoted 11 lines · Alexandra Winter
Quoted 4 lines · Wen Gu
The fields in
smcr_clc_msg_accept_confirmandsmcd_clc_msg_accept_confirm_commonseem to have not changed since SMCDv1. So I guess there is no v2-only fields in this two struct. I tried to confirm this in some documents but didn't find the message format for v1.V1 is documented in
https://datatracker.ietf.org/doc/html/draft-fox-tcpm-shared-memory-rdma-03
Thank you, Sandy. It clearly shows the SMC-Rv1 message format. I guess SMC-Dv1 message format is not publicly documented?
Review
Quoted 10 lines
Quoted 3 lines
If the
smcr_clc_msg_accept_confirmandsmcd_clc_msg_accept_confirm_commonis inherited from v1, should we still put the fields of v2 into these two structures?You are right, they do not contain v2 fields, I guess I was confused.
I still think, it would be better for readability and maintainability to avoid
(quoted diff) +2
-0+#define r0 r1._r0 +#define d0 d1._d0
I agree. Macros may cause some unexpected substitutions. I will remove them.
Quoted 3 lines
I guess you and previous editors wanted to avoid changing all the instances that use r0 and d0. But then.. it is a rather simple search/replace..
Yes, but not exactly. clc->r1.r0.xxx is somewhat strange for me, compared to clc->r0.xxx. So I try to avoid it.
Quoted 65 lines
Quoted 33 lines
If still, I will change these structures as
net/smc/smc_clc.h +8
-1@@ -201,9 +201,12 @@ struct smcr_clc_msg_accept_confirm { /* SMCR accept/confirm */ __be64 rmb_dma_addr; /* RMB virtual address */ u8 reserved2; u8 psn[3]; /* packet sequence number */ + /* v2 only, reserved and ignored in v1: */ + u8 eid[SMC_MAX_EID_LEN]; + u8 reserved6[8]; } __packed; -struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */ +struct smcd_clc_msg_accept_confirm { /* SMCD accept/confirm */ __be64 gid; /* Sender GID */ __be64 token; /* DMB token */ u8 dmbe_idx; /* DMBE index */@@ -216,6 +219,10 @@ struct smcd_clc_msg_accept_confirm_common { /* SMCD accept/confirm */ #endif u16 reserved4; __be32 linkid; /* Link identifier */ + /* v2 only, reserved and ignored in v1: */ + __be16 chid; + u8 eid[SMC_MAX_EID_LEN]; + u8 reserved5[8]; } __packed; #define SMC_CLC_OS_ZOS 1net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 264
Quoted 6 lines
net/smc/smc_clc.h +0
-3@@ -259,22 +266,9 @@ struct smc_clc_fce_gid_ext { struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */ struct smc_clc_msg_hdr hdr; union { - struct { /* SMC-R */ - struct smcr_clc_msg_accept_confirm _r0; - /* v2 only, reserved and ignored in v1: */^^ Actually these commetns are not fully correct. The fields are not reserved in V1. (my bad) The message length is shorter in V1.
So /* v2 only: */ would be more correct.net/smc/smc_clc.h struct smc_clc_fce_gid_ext { · line 270
Quoted 6 lines
net/smc/smc_clc.h +0
-6- u8 eid[SMC_MAX_EID_LEN]; - u8 reserved6[8]; - } r1; - struct { /* SMC-D */ - struct smcd_clc_msg_accept_confirm_common _d0; - /* v2 only, reserved and ignored in v1: */same here: /* v2 only: */
Quoted 12 lines
net/smc/smc_clc.h +2
-6- __be16 chid; - u8 eid[SMC_MAX_EID_LEN]; - u8 reserved5[8]; - } d1; + struct smcr_clc_msg_accept_confirm r0; /* SMC-R */ + struct smcd_clc_msg_accept_confirm d0; /* SMC-D */ }; -#define r0 r1._r0 -#define d0 d1._d0 };Quoted 1 line
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
};
Yes, I like that solution better.
But I have no strong feelings. At least the duplicate declarations are gone. So, if you prefer the #defines , it's ok with me.
After wrestling with several options, I decided to go with this definition.
struct smc_clc_msg_accept_confirm { /* clc accept / confirm message */
- struct smc_clc_msg_hdr hdr;
- union {
- struct smcr_clc_msg_accept_confirm r0; /* SMC-R */
- struct { /* SMC-D */
- struct smcd_clc_msg_accept_confirm_common d0;
- u32 reserved5[3];
- };
- };
-} __packed; /* format defined in RFC7609 */
-
-struct smc_clc_msg_accept_confirm_v2 { /* clc accept / confirm message */
struct smc_clc_msg_hdr hdr;
union {
struct { /* SMC-R */
struct smcr_clc_msg_accept_confirm r0;- u8 eid[SMC_MAX_EID_LEN];
- u8 reserved6[8];
- } r1;
+ struct { /* v2 only */
+ u8 eid[SMC_MAX_EID_LEN];
+ u8 reserved6[8];
+ } __packed r1;
+ };
struct { /* SMC-D */
struct smcd_clc_msg_accept_confirm_common d0;
- __be16 chid;
- u8 eid[SMC_MAX_EID_LEN];
- u8 reserved5[8];
- } d1;
+ struct { /* v2 only, but 12 bytes reserved in v1 */
+ __be16 chid;
+ u8 eid[SMC_MAX_EID_LEN];
+ u8 reserved5[8];
+ } __packed d1;
+ };
};};
Based on these considerations:
- smcr_clc_msg_accept_confirm and smcd_clc_msg_accept_confirm_common are inherited from v1 or common with v1, I think it's better to reflect this in the definition. So I didn't put the v2 fields into them.
- d1 and r1 is used as name of following v2 fields, so that no need to change the instances that use r0/d0/r1/d1, and no need to use macro.
- __packed is added in d1 and r1 since smc_clc_msg_hdr, smcr_clc_msg_accept_confirm and smcd_clc_msg_accept_confirm_common is packed, and the subsequent modifications will most likely occur on d1 and r1 (e.g. using the reserved fields).
- Add the comment 'but 12 bytes reserved in v1' since I guess people may wonder why SMCD_CLC_ACCEPT_CONFIRM_LEN is defined as 48. The comments could be a explanation. (I have also considered using a union to show the 12 bytes, but this would make the structure appear complicated. Given that the length of the SMCDv2 field has already exceeded 12 bytes and cannot be shortened, I think it is fine as it is.)
Quoted 11 lines
Quoted 11 lines
Quoted 6 lines
You have removed the
__packedattribute.
patch 07/10 adds it back for the SMC-D case, but the SMC-R case needs it as well.r1 and d1 in
smc_clc_msg_accept_confirm_v2(smc_clc_msg_accept_confirmnow in this patch) is aligned well. In patch 07/10 I replaced reserved5[8] with u64gid_ext, thus making a hole beforegid_ext, so I added__packedattribute to SMC-D.
Quoted 8 lines
Quoted 2 lines
If it is to avoid potential mistakes in future expansion, I can also add
__packedto SMC-R.Yes,
__packedis not only about preventing misalignement today.
IMU, without__packed, there is no guarantee that a future compile run will not insert unused bytes. (highly unlikely, I admit). But__packedmakes it visible that this needs to go to hardware in exactly this layout.
Agree. I will add them to r1 and d1 definition.
Thank you.
Wen Gu
Quoted 2 lines
Quoted 2 lines
Thanks.
Wen Gu
reviewerPATCH v6 4/10 net/smc: support SMCv2.x supplemental features negotiation
In reply to Wen GuThis patch adds SMCv2.x supplemental features negotiation. Supported SMCv2.x supplemental features are represented by feature_mask in FCE field. The negotiation process is as follows.
Server Client
Proposal(features(c-mask bits))
<-----------------------------------------
Accept(features(s-mask bits))
----------------------------------------->
Confirm(features(s&c-mask bits))
<-------------------------------------------- net/smc/smc.h | 4 ++++ net/smc/smc_clc.c | 7 +++++++ net/smc/smc_clc.h | 14 ++++++++++---- net/smc/smc_core.h | 1 + 4 files changed, 22 insertions(+), 4 deletions(-)
net/smc/smc.h +4 -0
@@ -58,6 +58,10 @@ enum smc_state { /* possible states of an SMC socket */ SMC_PROCESSABORT = 27, }; +#define SMC_FEATURE_MASK 0/* bitmask of +* supported supplemental features +*/ +struct smc_link_group ;struct smc_wr_rx_hdr {/* common prefix part of LLC and CDC to demultiplex */
net/smc/smc_clc.c +7 -0
@@ -438,6 +438,7 @@ static int smc_clc_fill_fce_v2x(struct smc_clc_first_contact_ext_v2x *fce_v2x, fce_v2x->max_conns = ini->max_conns; fce_v2x->max_links = ini->max_links; } + fce_v2x->feature_mask =htons (ini->feature_mask); } out:
@@ -907,6 +908,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini) pclc_smcd->v2_ext_offset =htons (v2_ext_offset); plen +=sizeof (*v2_ext); + v2_ext->feature_mask =htons (SMC_FEATURE_MASK );read_lock (&smc_clc_eid_table.lock); v2_ext->hdr.eid_cnt = smc_clc_eid_table.ueid_cnt; plen += smc_clc_eid_table.ueid_cnt *SMC_MAX_EID_LEN ;
@@ -1208,6 +1210,7 @@ int smc_clc_srv_v2x_features_validate(struct smc_sock *smc, ini->max_conns =SMC_CONN_PER_LGR_MAX ; ini->max_links =SMC_LINKS_ADD_LNK_MAX ; + ini->feature_mask =SMC_FEATURE_MASK ;if ((!(ini->smcd_version &SMC_V2 ) && !(ini->smcr_version &SMC_V2 )) || ini->release_nr <SMC_RELEASE_1 )
@@ -1251,6 +1254,8 @@ int smc_clc_clnt_v2x_features_validate(struct smc_clc_first_contact_ext *fce,return SMC_CLC_DECL_MAXLINKERR ; ini->max_links = fce_v2x->max_links; } +/* common supplemental features of server and client */ + ini->feature_mask =ntohs (fce_v2x->feature_mask) &SMC_FEATURE_MASK ;return 0 ; }
@@ -1279,6 +1284,8 @@ int smc_clc_v2x_features_confirm_check(struct smc_clc_msg_accept_confirm *cclc,if (fce_v2x->max_links != ini->max_links)return SMC_CLC_DECL_MAXLINKERR ; } +/* common supplemental features returned by client */ + ini->feature_mask =ntohs (fce_v2x->feature_mask);return 0 ; }
net/smc/smc_clc.h +10 -4
@@ -138,7 +138,8 @@ struct smc_clc_v2_extension {u8 roce[16 ];/* RoCEv2 GID */ u8 max_conns;u8 max_links; -u8 reserved[14 ]; +__be16 feature_mask; +u8 reserved[12 ];u8 user_eids[][SMC_MAX_EID_LEN ]; };
@@ -240,9 +241,14 @@ struct smc_clc_first_contact_ext {struct smc_clc_first_contact_ext_v2x {struct smc_clc_first_contact_ext fce_v2_base; -u8 max_conns;/* for SMC-R only */ -u8 max_links;/* for SMC-R only */ -u8 reserved3[2 ]; +union { +struct { +u8 max_conns;/* for SMC-R only */ +u8 max_links;/* for SMC-R only */ + }; +u8 reserved3[2 ];/* for SMC-D only */ + }; +__be16 feature_mask;__be32 vendor_exp_options;u8 reserved4[8 ]; } __packed;/* format defined in
net/smc/smc_core.h +1 -0
@@ -401,6 +401,7 @@ struct smc_init_info {u8 max_links;u8 first_contact_peer;u8 first_contact_local; +u16 feature_mask;unsigned short vlan_id;u32 rc;u8 negotiated_eid[SMC_MAX_EID_LEN ];
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 5/10 net/smc: introduce virtual ISM device support feature
In reply to Wen GuThis introduces virtual ISM device support feature to SMCv2.1 as the first supplemental feature.
--- net/smc/smc.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/smc/smc.h +6 -3
@@ -58,9 +58,12 @@ enum smc_state { /* possible states of an SMC socket */ SMC_PROCESSABORT = 27, }; -#define SMC_FEATURE_MASK 0/* bitmask of -* supported supplemental features -*/ +enum smc_supplemental_features { +SMC_SPF_VIRT_ISM_DEV =0 , +}; + +#define SMC_FEATURE_MASK \ + (BIT(SMC_SPF_VIRT_ISM_DEV))struct smc_link_group ;
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 6/10 net/smc: define a reserved CHID range for virtual ISM devices
In reply to Wen GuAccording to virtual ISM support feature defined by SMCv2.1, CHIDs in the range 0xFF00 to 0xFFFF are reserved for use by virtual ISM devices.
And two helpers are introduced to distinguish virtual ISM devices from the existing platform firmware ISM devices.
--- net/smc/smc_ism.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
net/smc/smc_ism.h +20 -0
@@ -15,6 +15,8 @@#include "smc.h" +#define SMC_VIRTUAL_ISM_CHID_MASK 0xFF00 +struct smcd_dev_list {/* List of SMCD devices */ struct list_head list;struct mutex mutex;/* Protects list of devices */
@@ -56,4 +58,22 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, return rc < 0 ? rc : 0; } +static inline bool __smc_ism_is_virtual (u16 chid) +{ +/* CHIDs in range of 0xFF00 to 0xFFFF are reserved +* for virtual ISM device. +* +* loopback-ism: 0xFFFF +* virtio-ism: 0xFF00 ~ 0xFFFE +*/ +return ((chid &0xFF00 ) ==0xFF00 ); +} + +static inline bool smc_ism_is_virtual (struct smcd_dev *smcd) +{ +u16 chid = smcd->ops->get_chid (smcd); + +return __smc_ism_is_virtual (chid); +} +#endif
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 7/10 net/smc: compatible with 128-bits extended GID of virtual ISM device
In reply to Wen GuAccording to virtual ISM support feature defined by SMCv2.1, GIDs of virtual ISM device are UUIDs defined by RFC4122, which are 128-bits long. So some adaptation work is required. And note that the GIDs of existing platform firmware ISM devices still remain 64-bits long.
--- drivers/s390/net/ism_drv.c | 19 +++++++------ include/net/smc.h | 15 +++++++---- net/smc/af_smc.c | 66 +++++++++++++++++++++++++++++++++++++--------- net/smc/smc.h | 3 --- net/smc/smc_clc.c | 43 ++++++++++++++++++++++-------- net/smc/smc_clc.h | 12 ++++++--- net/smc/smc_core.c | 31 +++++++++++++++------- net/smc/smc_core.h | 17 ++++++++---- net/smc/smc_diag.c | 7 +++-- net/smc/smc_ism.c | 17 +++++++----- net/smc/smc_ism.h | 3 ++- net/smc/smc_pnet.c | 4 +-- 12 files changed, 168 insertions(+), 69 deletions(-)
drivers/s390/net/ism_drv.c +11 -8
@@ -743,10 +743,10 @@ static int ism_query_rgid(struct ism_dev *ism, u64 rgid, u32 vid_valid,return ism_cmd (ism, &cmd); } -static int smcd_query_rgid (struct smcd_dev *smcd,u64 rgid,u32 vid_valid, -u32 vid) +static int smcd_query_rgid (struct smcd_dev *smcd,struct smcd_gid *rgid, +u32 vid_valid,u32 vid) { -return ism_query_rgid (smcd->priv, rgid, vid_valid, vid); +return ism_query_rgid (smcd->priv, rgid->gid, vid_valid, vid); } static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
@@ -797,10 +797,11 @@ static int ism_signal_ieq(struct ism_dev *ism, u64 rgid, u32 trigger_irq,return ism_cmd (ism, &cmd); } -static int smcd_signal_ieq (struct smcd_dev *smcd,u64 rgid,u32 trigger_irq, -u32 event_code,u64 info) +static int smcd_signal_ieq (struct smcd_dev *smcd,struct smcd_gid *rgid, +u32 trigger_irq,u32 event_code,u64 info) { -return ism_signal_ieq (smcd->priv, rgid, trigger_irq, event_code, info); +return ism_signal_ieq (smcd->priv, rgid->gid, + trigger_irq, event_code, info); } static int smcd_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,
@@ -821,9 +822,11 @@ static u64 ism_get_local_gid(struct ism_dev *ism)return ism->local_gid; } -static u64 smcd_get_local_gid (struct smcd_dev *smcd) +static void smcd_get_local_gid (struct smcd_dev *smcd, +struct smcd_gid *smcd_gid) { -return ism_get_local_gid (smcd->priv); + smcd_gid->gid =ism_get_local_gid (smcd->priv); + smcd_gid->gid_ext =0 ; }static u16 ism_get_chid (struct ism_dev *ism)
include/net/smc.h +10 -5
@@ -52,9 +52,14 @@ struct smcd_dmb {struct smcd_dev ;struct ism_client ; +struct smcd_gid { +u64 gid; +u64 gid_ext; +}; +struct smcd_ops { -int (*query_remote_gid)(struct smcd_dev *dev,u64 rgid,u32 vid_valid, -u32 vid); +int (*query_remote_gid)(struct smcd_dev *dev,struct smcd_gid *rgid, +u32 vid_valid,u32 vid);int (*register_dmb)(struct smcd_dev *dev,struct smcd_dmb *dmb,struct ism_client *client);int (*unregister_dmb)(struct smcd_dev *dev,struct smcd_dmb *dmb);
@@ -62,14 +67,14 @@ struct smcd_ops {int (*del_vlan_id)(struct smcd_dev *dev,u64 vlan_id);int (*set_vlan_required)(struct smcd_dev *dev);int (*reset_vlan_required)(struct smcd_dev *dev); -int (*signal_event)(struct smcd_dev *dev,u64 rgid,u32 trigger_irq, -u32 event_code,u64 info); +int (*signal_event)(struct smcd_dev *dev,struct smcd_gid *rgid, +u32 trigger_irq,u32 event_code,u64 info);int (*move_data)(struct smcd_dev *dev,u64 dmb_tok,unsigned int idx,bool sf,unsigned int offset,void *data,unsigned int size);int (*supports_v2)(void ); u8* (*get_system_eid)(void); -u64 (*get_local_gid)(struct smcd_dev *dev); +void (*get_local_gid)(struct smcd_dev *dev,struct smcd_gid *gid);u16 (*get_chid)(struct smcd_dev *dev);struct device * (*get_dev)(struct smcd_dev *dev); };
net/smc/af_smc.c +53 -13
130 lines not on this page · raw message
net/smc/smc.h +0 -3
@@ -29,9 +29,6 @@#define SMCPROTO_SMC 0/* SMC protocol, IPv4 */ #define SMCPROTO_SMC6 1/* SMC protocol, IPv6 */ -#define SMC_MAX_ISM_DEVS 8/* max # of proposed non-native ISM -* devices -*/ #define SMC_AUTOCORKING_DEFAULT_SIZE 0x10000/* 64K by default */ extern struct proto smc_proto;
net/smc/smc_clc.c +32 -11
96 lines not on this page · raw message
net/smc/smc_clc.h +9 -3
@@ -172,6 +172,11 @@ struct smc_clc_msg_proposal { /* clc proposal message sent by Linux */#define SMC_CLC_MAX_V6_PREFIX 8#define SMC_CLC_MAX_UEID 8 +#define SMCD_CLC_MAX_V2_GID_ENTRIES 8/* max # of CHID-GID entries in CLC +* proposal SMC-Dv2 extension. +* each ISM device takes one entry and +* each virtual ISM takes two entries. +*/ struct smc_clc_msg_proposal_area {struct smc_clc_msg_proposal pclc_base;
@@ -181,7 +186,8 @@ struct smc_clc_msg_proposal_area {struct smc_clc_v2_extension pclc_v2_ext;u8 user_eids[SMC_CLC_MAX_UEID ][SMC_MAX_EID_LEN ];struct smc_clc_smcd_v2_extension pclc_smcd_v2_ext; -struct smc_clc_smcd_gid_chid pclc_gidchids[SMC_MAX_ISM_DEVS ]; +struct smc_clc_smcd_gid_chid + pclc_gidchids[SMCD_CLC_MAX_V2_GID_ENTRIES ];struct smc_clc_msg_trail pclc_trl; };
@@ -276,8 +282,8 @@ struct smc_clc_msg_accept_confirm { /* clc accept / confirm message *//* v2 only, reserved and ignored in v1: */ __be16 chid;u8 eid[SMC_MAX_EID_LEN ]; -u8 reserved5[8 ]; - } d1; +__be64 gid_ext; + }__packed d1; };#define r0 r1._r0#define d0 d1._d0
net/smc/smc_core.c +21 -10
@@ -506,6 +506,7 @@ static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr, {char smc_pnet[SMC_MAX_PNETID_LEN +1 ];struct smcd_dev *smcd = lgr->smcd; +struct smcd_gid smcd_gid;struct nlattr *attrs;void *nlh;
@@ -521,11 +522,11 @@ static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr,if (nla_put_u32 (skb,SMC_NLA_LGR_D_ID , *((u32 *)&lgr->id))) goto errattr; + smcd->ops->get_local_gid (smcd, &smcd_gid);if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_GID , - smcd->ops->get_local_gid (smcd), -SMC_NLA_LGR_D_PAD )) + smcd_gid.gid,SMC_NLA_LGR_D_PAD )) goto errattr; -if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_PEER_GID , lgr->peer_gid, +if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_PEER_GID , lgr->peer_gid.gid,SMC_NLA_LGR_D_PAD )) goto errattr;if (nla_put_u8 (skb,SMC_NLA_LGR_D_VLAN_ID , lgr->vlan_id))
@@ -876,7 +877,10 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)/* SMC-D specific settings */ smcd = ini->ism_dev[ini->ism_selected];get_device (smcd->ops->get_dev (smcd)); - lgr->peer_gid = ini->ism_peer_gid[ini->ism_selected]; + lgr->peer_gid.gid = + ini->ism_peer_gid[ini->ism_selected].gid; + lgr->peer_gid.gid_ext = + ini->ism_peer_gid[ini->ism_selected].gid_ext; lgr->smcd = ini->ism_dev[ini->ism_selected]; lgr_list = &ini->ism_dev[ini->ism_selected]->lgr_list; lgr_lock = &lgr->smcd->lgr_lock;
@@ -1514,7 +1518,8 @@ void smc_lgr_terminate_sched(struct smc_link_group *lgr) }/* Called when peer lgr shutdown (regularly or abnormally) is received */ -void smc_smcd_terminate (struct smcd_dev *dev,u64 peer_gid,unsigned short vlan) +void smc_smcd_terminate (struct smcd_dev *dev,struct smcd_gid *peer_gid, +unsigned short vlan) {struct smc_link_group *lgr, *l;LIST_HEAD (lgr_free_list);
@@ -1522,9 +1527,12 @@ void smc_smcd_terminate(struct smcd_dev *dev, u64 peer_gid, unsigned short vlan)/* run common cleanup function and build free list */ spin_lock_bh (&dev->lgr_lock);list_for_each_entry_safe (lgr, l, &dev->lgr_list, list) { -if ((!peer_gid || lgr->peer_gid == peer_gid) && +if ((!peer_gid->gid || + (lgr->peer_gid.gid == peer_gid->gid && + !smc_ism_is_virtual (dev) ?1 : + lgr->peer_gid.gid_ext == peer_gid->gid_ext)) && (vlan ==VLAN_VID_MASK || lgr->vlan_id == vlan)) { -if (peer_gid)/* peer triggered termination */ +if (peer_gid->gid)/* peer triggered termination */ lgr->peer_shutdown =1 ;list_move (&lgr->list, &lgr_free_list); lgr->freeing =1 ;
@@ -1860,9 +1868,12 @@ static bool smcr_lgr_match(struct smc_link_group *lgr, u8 smcr_version, }static bool smcd_lgr_match (struct smc_link_group *lgr, -struct smcd_dev *smcismdev,u64 peer_gid) +struct smcd_dev *smcismdev, +struct smcd_gid *peer_gid) { -return lgr->peer_gid == peer_gid && lgr->smcd == smcismdev; +return lgr->peer_gid.gid == peer_gid->gid && lgr->smcd == smcismdev && +smc_ism_is_virtual (smcismdev) ? + (lgr->peer_gid.gid_ext == peer_gid->gid_ext) :1 ; }/* create a new SMC connection (and a new link group if necessary) */
@@ -1892,7 +1903,7 @@ int smc_conn_create(struct smc_sock *smc, struct smc_init_info *ini)write_lock_bh (&lgr->conns_lock); if ((ini->is_smcd ? smcd_lgr_match(lgr, ini->ism_dev[ini->ism_selected], - ini->ism_peer_gid[ini->ism_selected]) : + &ini->ism_peer_gid[ini->ism_selected]) : smcr_lgr_match(lgr, ini->smcr_version, ini->peer_systemid, ini->peer_gid, ini->peer_mac, role,
net/smc/smc_core.h +12 -5
@@ -17,9 +17,11 @@#include <linux/pci.h> #include <rdma/ib_verbs.h> #include <net/genetlink.h> +#include <net/smc.h> #include "smc.h" #include "smc_ib.h" +#include "smc_clc.h" #define SMC_RMBS_PER_LGR_MAX 255/* max. # of RMBs per link group */ #define SMC_CONN_PER_LGR_MIN 16/* min. # of connections per link group */
@@ -355,7 +357,7 @@ struct smc_link_group {/* max links can be added in lgr */ };struct {/* SMC-D */ -u64 peer_gid; +struct smcd_gid peer_gid;/* Peer GID (remote) */ struct smcd_dev *smcd;/* ISM device for VLAN reg. */
@@ -392,6 +394,11 @@ struct smc_init_info_smcrv2 {struct smc_gidlist gidlist; }; +#define SMC_MAX_V2_ISM_DEVS SMCD_CLC_MAX_V2_GID_ENTRIES +/* max # of proposed non-native ISM devices, +* which can't exceed the max # of CHID-GID +* entries in CLC proposal SMC-Dv2 extension. +*/ struct smc_init_info {u8 is_smcd;u8 smc_type_v1;
@@ -417,9 +424,9 @@ struct smc_init_info {u32 ib_clcqpn;struct smc_init_info_smcrv2 smcrv2;/* SMC-D */ -u64 ism_peer_gid[SMC_MAX_ISM_DEVS +1 ]; -struct smcd_dev *ism_dev[SMC_MAX_ISM_DEVS +1 ]; -u16 ism_chid[SMC_MAX_ISM_DEVS +1 ]; +struct smcd_gid ism_peer_gid[SMC_MAX_V2_ISM_DEVS +1 ]; +struct smcd_dev *ism_dev[SMC_MAX_V2_ISM_DEVS +1 ]; +u16 ism_chid[SMC_MAX_V2_ISM_DEVS +1 ];u8 ism_offered_cnt;/* # of ISM devices offered */ u8 ism_selected;/* index of selected ISM dev*/ u8 smcd_version;
@@ -545,7 +552,7 @@ static inline void smc_set_pci_values(struct pci_dev *pci_dev,void smc_lgr_put (struct smc_link_group *lgr);void smcr_port_add (struct smc_ib_device *smcibdev,u8 ibport);void smcr_port_err (struct smc_ib_device *smcibdev,u8 ibport); -void smc_smcd_terminate (struct smcd_dev *dev,u64 peer_gid, +void smc_smcd_terminate (struct smcd_dev *dev,struct smcd_gid *peer_gid,unsigned short vlan);void smc_smcd_terminate_all (struct smcd_dev *dev);void smc_smcr_terminate_all (struct smc_ib_device *smcibdev);
net/smc/smc_diag.c +5 -2
@@ -21,6 +21,7 @@#include "smc.h" #include "smc_core.h" +#include "smc_ism.h" struct smc_diag_dump_ctx {int pos[2 ];
@@ -168,12 +169,14 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb,struct smc_connection *conn = &smc->conn;struct smcd_diag_dmbinfo dinfo;struct smcd_dev *smcd = conn->lgr->smcd; +struct smcd_gid smcd_gid;memset (&dinfo,0 ,sizeof (dinfo)); dinfo.linkid = *((u32 *)conn->lgr->id); - dinfo.peer_gid = conn->lgr->peer_gid; - dinfo.my_gid = smcd->ops->get_local_gid (smcd); + dinfo.peer_gid = conn->lgr->peer_gid.gid; + smcd->ops->get_local_gid (smcd, &smcd_gid); + dinfo.my_gid = smcd_gid.gid; dinfo.token = conn->rmb_desc->token; dinfo.peer_token = conn->peer_token;
net/smc/smc_ism.c +11 -6
@@ -44,7 +44,8 @@ static void smcd_handle_irq(struct ism_dev *ism, unsigned int dmbno,#endif /* Test if an ISM communication is possible - same CPC */ -int smc_ism_cantalk (u64 peer_gid,unsigned short vlan_id,struct smcd_dev *smcd) +int smc_ism_cantalk (struct smcd_gid *peer_gid,unsigned short vlan_id, +struct smcd_dev *smcd) {return smcd->ops->query_remote_gid (smcd, peer_gid, vlan_id ?1 :0 , vlan_id);
@@ -208,7 +209,7 @@ int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len, dmb.dmb_len = dmb_len; dmb.sba_idx = dmb_desc->sba_idx; dmb.vlan_id = lgr->vlan_id; - dmb.rgid = lgr->peer_gid; + dmb.rgid = lgr->peer_gid.gid; rc = lgr->smcd->ops->register_dmb (lgr->smcd, &dmb, &smc_ism_client);if (!rc) { dmb_desc->sba_idx = dmb.sba_idx;
@@ -340,18 +341,20 @@ struct smc_ism_event_work {static void smcd_handle_sw_event (struct smc_ism_event_work *wrk) { +struct smcd_gid peer_gid = { .gid = wrk->event.tok, + .gid_ext =0 };union smcd_sw_event_info ev_info; ev_info.info = wrk->event.info;switch (wrk->event.code) {case ISM_EVENT_CODE_SHUTDOWN :/* Peer shut down DMBs */ -smc_smcd_terminate (wrk->smcd, wrk->event.tok, ev_info.vlan_id); +smc_smcd_terminate (wrk->smcd, &peer_gid, ev_info.vlan_id);break ;case ISM_EVENT_CODE_TESTLINK :/* Activity timer */ if (ev_info.code ==ISM_EVENT_REQUEST ) { ev_info.code =ISM_EVENT_RESPONSE ; wrk->smcd->ops->signal_event (wrk->smcd, - wrk->event.tok, + &peer_gid,ISM_EVENT_REQUEST_IR ,ISM_EVENT_CODE_TESTLINK , ev_info.info);
@@ -365,10 +368,12 @@ static void smc_ism_event_work(struct work_struct *work) {struct smc_ism_event_work *wrk = container_of(work, struct smc_ism_event_work, work); +struct smcd_gid smcd_gid = { .gid = wrk->event.tok, + .gid_ext =0 };switch (wrk->event.type) {case ISM_EVENT_GID :/* GID event, token is peer GID */ -smc_smcd_terminate (wrk->smcd, wrk->event.tok,VLAN_VID_MASK ); +smc_smcd_terminate (wrk->smcd, &smcd_gid,VLAN_VID_MASK );break ;case ISM_EVENT_DMB :break ;
@@ -525,7 +530,7 @@ int smc_ism_signal_shutdown(struct smc_link_group *lgr)memcpy (ev_info.uid, lgr->id,SMC_LGR_ID_SIZE ); ev_info.vlan_id = lgr->vlan_id; ev_info.code =ISM_EVENT_REQUEST ; - rc = lgr->smcd->ops->signal_event (lgr->smcd, lgr->peer_gid, + rc = lgr->smcd->ops->signal_event (lgr->smcd, &lgr->peer_gid,ISM_EVENT_REQUEST_IR ,ISM_EVENT_CODE_SHUTDOWN , ev_info.info);
net/smc/smc_ism.h +2 -1
@@ -32,7 +32,8 @@ struct smc_ism_vlanid { /* VLAN id set on ISM device */struct smcd_dev ; -int smc_ism_cantalk (u64 peer_gid,unsigned short vlan_id,struct smcd_dev *dev); +int smc_ism_cantalk (struct smcd_gid *peer_gid,unsigned short vlan_id, +struct smcd_dev *dev);void smc_ism_set_conn (struct smc_connection *conn);void smc_ism_unset_conn (struct smc_connection *conn);int smc_ism_get_vlan (struct smcd_dev *dev,unsigned short vlan_id);
net/smc/smc_pnet.c +2 -2
@@ -1103,8 +1103,8 @@ static void smc_pnet_find_ism_by_pnetid(struct net_device *ndev,list_for_each_entry (ismdev, &smcd_dev_list.list, list) {if (smc_pnet_match (ismdev->pnetid, ndev_pnetid) && !ismdev->going_away && - (!ini->ism_peer_gid[0 ] || - !smc_ism_cantalk (ini->ism_peer_gid[0 ], ini->vlan_id, + (!ini->ism_peer_gid[0 ].gid || + !smc_ism_cantalk (&ini->ism_peer_gid[0 ], ini->vlan_id, ismdev))) { ini->ism_dev[0 ] = ismdev;break ;
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 8/10 net/smc: support extended GID in SMC-D lgr netlink attribute
In reply to Wen GuVirtual ISM devices introduced in SMCv2.1 requires a 128 bit extended GID vs. the existing ISM 64bit GID. So the 2nd 64 bit of extended GID should be included in SMC-D linkgroup netlink attribute as well.
--- include/uapi/linux/smc.h | 2 ++ include/uapi/linux/smc_diag.h | 2 ++ net/smc/smc_core.c | 6 ++++++ net/smc/smc_diag.c | 2 ++ 4 files changed, 12 insertions(+)
include/uapi/linux/smc.h +2 -0
@@ -160,6 +160,8 @@ enum {SMC_NLA_LGR_D_CHID ,/* u16 */ SMC_NLA_LGR_D_PAD ,/* flag */ SMC_NLA_LGR_D_V2_COMMON ,/* nest */ +SMC_NLA_LGR_D_EXT_GID ,/* u64 */ +SMC_NLA_LGR_D_PEER_EXT_GID ,/* u64 */ __SMC_NLA_LGR_D_MAX, SMC_NLA_LGR_D_MAX = __SMC_NLA_LGR_D_MAX - 1 };
include/uapi/linux/smc_diag.h +2 -0
@@ -107,6 +107,8 @@ struct smcd_diag_dmbinfo { /* SMC-D Socket internals */__aligned_u64 my_gid;/* My GID */ __aligned_u64 token;/* Token of DMB */ __aligned_u64 peer_token;/* Token of remote DMBE */ +__aligned_u64 peer_gid_ext;/* Peer GID (extended part) */ + __aligned_u64 my_gid_ext; /* My GID (extended part) */ };#endif /* _UAPI_SMC_DIAG_H_ */
net/smc/smc_core.c +6 -0
@@ -526,9 +526,15 @@ static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr,if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_GID , smcd_gid.gid,SMC_NLA_LGR_D_PAD )) goto errattr; +if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_EXT_GID , + smcd_gid.gid_ext,SMC_NLA_LGR_D_PAD )) + goto errattr;if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_PEER_GID , lgr->peer_gid.gid,SMC_NLA_LGR_D_PAD )) goto errattr; +if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_PEER_EXT_GID , + lgr->peer_gid.gid_ext,SMC_NLA_LGR_D_PAD )) + goto errattr;if (nla_put_u8 (skb,SMC_NLA_LGR_D_VLAN_ID , lgr->vlan_id)) goto errattr;if (nla_put_u32 (skb,SMC_NLA_LGR_D_CONNS_NUM , lgr->conns_num))
net/smc/smc_diag.c +2 -0
@@ -175,8 +175,10 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, dinfo.linkid = *((u32 *)conn->lgr->id); dinfo.peer_gid = conn->lgr->peer_gid.gid; + dinfo.peer_gid_ext = conn->lgr->peer_gid.gid_ext; smcd->ops->get_local_gid (smcd, &smcd_gid); dinfo.my_gid = smcd_gid.gid; + dinfo.my_gid_ext = smcd_gid.gid_ext; dinfo.token = conn->rmb_desc->token; dinfo.peer_token = conn->peer_token;
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 9/10 net/smc: disable SEID on non-s390 archs where virtual ISM may be used
In reply to Wen GuThe system EID (SEID) is an internal EID used by SMC-D to represent the s390 physical machine that OS is executing on. On s390 architecture, it predefined by fixed string and part of cpuid and is enabled regardless of whether underlay device is virtual ISM or platform firmware ISM.
However on non-s390 architectures where SMC-D can be used with virtual ISM devices, there is no similar information to identify physical machines, especially in virtualization scenarios. So in such cases, SEID is forcibly disabled and the user-defined UEID will be used to represent the communicable space.
--- net/smc/smc_clc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/smc/smc_clc.c +14 -0
@@ -155,10 +155,12 @@ static int smc_clc_ueid_remove(char *ueid) rc =0 ; } } +#if IS_ENABLED (CONFIG_S390 )if (!rc && !smc_clc_eid_table.ueid_cnt) { smc_clc_eid_table.seid_enabled =1 ; rc = -EAGAIN ;/* indicate success and enabling of seid */ } +#endif write_unlock (&smc_clc_eid_table.lock);return rc; }
@@ -273,22 +275,30 @@ int smc_nl_dump_seid(struct sk_buff *skb, struct netlink_callback *cb)int smc_nl_enable_seid (struct sk_buff *skb,struct genl_info *info) { +#if IS_ENABLED (CONFIG_S390 )write_lock (&smc_clc_eid_table.lock); smc_clc_eid_table.seid_enabled =1 ;write_unlock (&smc_clc_eid_table.lock);return 0 ; +#else +return -EOPNOTSUPP ; +#endif }int smc_nl_disable_seid (struct sk_buff *skb,struct genl_info *info) {int rc =0 ; +#if IS_ENABLED (CONFIG_S390 )write_lock (&smc_clc_eid_table.lock);if (!smc_clc_eid_table.ueid_cnt) rc = -ENOENT ;else smc_clc_eid_table.seid_enabled =0 ;write_unlock (&smc_clc_eid_table.lock); +#else + rc = -EOPNOTSUPP ; +#endif return rc; }
@@ -1328,7 +1338,11 @@ void __init smc_clc_init(void)INIT_LIST_HEAD (&smc_clc_eid_table.list);rwlock_init (&smc_clc_eid_table.lock); smc_clc_eid_table.ueid_cnt =0 ; +#if IS_ENABLED (CONFIG_S390 ) smc_clc_eid_table.seid_enabled =1 ; +#else + smc_clc_eid_table.seid_enabled =0 ; +#endif }void smc_clc_exit (void )
Signature · 1 line
1.8.3.1
Wen Gu
reviewerPATCH v6 10/10 net/smc: manage system EID in SMC stack instead of ISM driver
In reply to Wen GuThe System EID (SEID) is an internal EID that is used by the SMCv2 software stack that has a predefined and constant value representing the s390 physical machine that the OS is executing on. So it should be managed by SMC stack instead of ISM driver and be consistent for all ISMv2 device (including virtual ISM devices) on s390 architecture.
--- drivers/s390/net/ism.h | 7 ------- drivers/s390/net/ism_drv.c | 38 ++++++-------------------------------- include/linux/ism.h | 1 - include/net/smc.h | 1 - net/smc/smc_ism.c | 33 ++++++++++++++++++++++++--------- net/smc/smc_ism.h | 7 +++++++ 6 files changed, 37 insertions(+), 50 deletions(-)
drivers/s390/net/ism.h +0 -7
@@ -16,7 +16,6 @@*/ #define ISM_DMB_WORD_OFFSET 1#define ISM_DMB_BIT_OFFSET (ISM_DMB_WORD_OFFSET * 32) -#define ISM_IDENT_MASK 0x00FFFF#define ISM_REG_SBA 0x1#define ISM_REG_IEQ 0x2
@@ -192,12 +191,6 @@ struct ism_sba {#define ISM_CREATE_REQ (dmb, idx, sf, offset) \ ((dmb) | (idx) << 24 | (sf) << 23 | (offset)) -struct ism_systemeid { -u8 seid_string[24 ]; -u8 serial_number[4 ]; -u8 type[4 ]; -}; -static inline void __ism_read_cmd (struct ism_dev *ism,void *data,unsigned long offset,unsigned long len) {
drivers/s390/net/ism_drv.c +6 -32
@@ -36,6 +36,7 @@/* a list for fast mapping */ static u8 max_client;static DEFINE_MUTEX (clients_lock); +static bool ism_v2_capable;struct ism_dev_list {struct list_head list;struct mutex mutex;/* protects ism device list */
@@ -443,32 +444,6 @@ int ism_move(struct ism_dev *ism, u64 dmb_tok, unsigned int idx, bool sf, }EXPORT_SYMBOL_GPL (ism_move); -static struct ism_systemeid SYSTEM_EID = { - .seid_string ="IBM-SYSZ-ISMSEID00000000" , - .serial_number ="0000" , - .type ="0000" , -}; - -static void ism_create_system_eid (void ) -{ -struct cpuid id; -u16 ident_tail; -char tmp[5 ]; - -get_cpu_id (&id); - ident_tail = (u16)(id.ident &ISM_IDENT_MASK ); -snprintf (tmp,5 ,"%04X" , ident_tail); -memcpy (&SYSTEM_EID .serial_number, tmp,4 ); -snprintf (tmp,5 ,"%04X" , id.machine); -memcpy (&SYSTEM_EID .type, tmp,4 ); -} - -u8 *ism_get_seid (void ) -{ -return SYSTEM_EID .seid_string; -} -EXPORT_SYMBOL_GPL (ism_get_seid); -static void ism_handle_event (struct ism_dev *ism) {struct ism_event *entry;
@@ -560,7 +535,9 @@ static int ism_dev_init(struct ism_dev *ism)if (!ism_add_vlan_id (ism,ISM_RESERVED_VLANID ))/* hardware is V2 capable */ -ism_create_system_eid (); + ism_v2_capable = true; +else + ism_v2_capable = false;mutex_lock (&ism_dev_list.mutex);mutex_lock (&clients_lock);
@@ -665,8 +642,7 @@ static void ism_dev_exit(struct ism_dev *ism) }mutex_unlock (&clients_lock); -if (SYSTEM_EID .serial_number[0 ] !='0' || -SYSTEM_EID .type[0 ] !='0' ) +if (ism_v2_capable)ism_del_vlan_id (ism,ISM_RESERVED_VLANID );unregister_ieq (ism);unregister_sba (ism);
@@ -813,8 +789,7 @@ static int smcd_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,static int smcd_supports_v2 (void ) { -return SYSTEM_EID .serial_number[0 ] !='0' || -SYSTEM_EID .type[0 ] !='0' ; +return ism_v2_capable; }static u64 ism_get_local_gid (struct ism_dev *ism)
@@ -860,7 +835,6 @@ static inline struct device *smcd_get_dev(struct smcd_dev *dev) .signal_event = smcd_signal_ieq, .move_data = smcd_move, .supports_v2 = smcd_supports_v2, - .get_system_eid = ism_get_seid, .get_local_gid = smcd_get_local_gid, .get_chid = smcd_get_chid, .get_dev = smcd_get_dev,
include/linux/ism.h +0 -1
@@ -86,7 +86,6 @@ int ism_register_dmb(struct ism_dev *dev, struct ism_dmb *dmb,int ism_unregister_dmb (struct ism_dev *dev,struct ism_dmb *dmb);int ism_move (struct ism_dev *dev,u64 dmb_tok,unsigned int idx,bool sf,unsigned int offset,void *data,unsigned int size); -u8 *ism_get_seid (void );const struct smcd_ops *ism_get_smcd_ops (void );
include/net/smc.h +0 -1
@@ -73,7 +73,6 @@ struct smcd_ops { bool sf, unsigned int offset, void *data, unsigned int size);int (*supports_v2)(void ); - u8* (*get_system_eid)(void);void (*get_local_gid)(struct smcd_dev *dev,struct smcd_gid *gid);u16 (*get_chid)(struct smcd_dev *dev);struct device * (*get_dev)(struct smcd_dev *dev);
net/smc/smc_ism.c +24 -9
@@ -43,6 +43,27 @@ static void smcd_handle_irq(struct ism_dev *ism, unsigned int dmbno, };#endif +static void smc_ism_create_system_eid (void ) +{ +struct smc_ism_seid *seid = + (struct smc_ism_seid *)smc_ism_v2_system_eid; +#if IS_ENABLED (CONFIG_S390 ) +struct cpuid id; +u16 ident_tail; +char tmp[5 ]; + +memcpy (seid->seid_string,"IBM-SYSZ-ISMSEID00000000" ,24 ); +get_cpu_id (&id); + ident_tail = (u16)(id.ident &SMC_ISM_IDENT_MASK ); +snprintf (tmp,5 ,"%04X" , ident_tail); +memcpy (seid->serial_number, tmp,4 ); +snprintf (tmp,5 ,"%04X" , id.machine); +memcpy (seid->type, tmp,4 ); +#else +memset (seid,0 ,SMC_MAX_EID_LEN ); +#endif +} +/* Test if an ISM communication is possible - same CPC */ int smc_ism_cantalk (struct smcd_gid *peer_gid,unsigned short vlan_id,struct smcd_dev *smcd)
@@ -431,14 +452,8 @@ static void smcd_register_dev(struct ism_dev *ism)mutex_lock (&smcd_dev_list.mutex);if (list_empty (&smcd_dev_list.list)) { -u8 *system_eid =NULL ; - - system_eid = smcd->ops->get_system_eid (); -if (smcd->ops->supports_v2 ()) { +if (smcd->ops->supports_v2 ()) smc_ism_v2_capable = true; -memcpy (smc_ism_v2_system_eid, system_eid, -SMC_MAX_EID_LEN ); - } }/* sort list: devices without pnetid before devices with pnetid */ if (smcd->pnetid[0 ])
@@ -542,10 +557,10 @@ int smc_ism_init(void) {int rc =0 ; -#if IS_ENABLED (CONFIG_ISM ) smc_ism_v2_capable = false; -memset (smc_ism_v2_system_eid,0 ,SMC_MAX_EID_LEN ); +smc_ism_create_system_eid (); +#if IS_ENABLED (CONFIG_ISM ) rc =ism_register_client (&smc_ism_client);#endif return rc;
net/smc/smc_ism.h +7 -0
@@ -16,6 +16,7 @@#include "smc.h" #define SMC_VIRTUAL_ISM_CHID_MASK 0xFF00 +#define SMC_ISM_IDENT_MASK 0x00FFFFstruct smcd_dev_list {/* List of SMCD devices */ struct list_head list;
@@ -30,6 +31,12 @@ struct smc_ism_vlanid { /* VLAN id set on ISM device */refcount_t refcnt;/* Reference count */ }; +struct smc_ism_seid { +u8 seid_string[24 ]; +u8 serial_number[4 ]; +u8 type[4 ]; +}; +struct smcd_dev ; int smc_ism_cantalk(struct smcd_gid *peer_gid, unsigned short vlan_id,
Signature · 1 line
1.8.3.1
Wen Gu
reviewerQuoted 28 lines · Wen Gu
The fourth edition of SMCv2 adds the SMC version 2.1 feature updates for SMC-Dv2 with virtual ISM. Virtual ISM are created and supported mainly by OS or hypervisor software, comparable to IBM ISM which is based on platform firmware or hardware.
With the introduction of virtual ISM, SMCv2.1 makes some updates:
- Introduce feature bitmask to indicate supplemental features.
- Reserve a range of CHIDs for virtual ISM.
- Support extended GIDs (128 bits) in CLC handshake.So this patch set aims to implement these updates in Linux kernel. And it acts as the first part of SMC-D virtual ISM extension & loopback-ism [1].
[1] https://lore.kernel.org/netdev/[email protected]/
v6->v5:
- Add 'Reviewed-by' label given in the previous versions:
* Patch #4, #6, #9, #10 have nothing changed since v3;
- Patch #2:
* fix the format issue (Alignment should match open parenthesis) compared to v5;
* remove uselessclc->hdr.lengthassignment insmcr_clc_prep_confirm_accept()compared to v5;- Patch #3: new added compared to v5.
- Patch #7: some minor changes likeaclc_v2->aclcorclc_v2->clccompared to v5 due to the introduction of Patch #3. Since there were no major changes, I kept the 'Reviewed-by' label.
Quoted 7 lines
Other changes in previous versions but not yet acked:
- Patch #1: Some minor changes in subject and fix the format issue (length exceeds 80 columns) compared to v3.
- Patch #5: removes uselessini->feature_maskassignment in__smc_connect()andsmc_listen_v2_check()compared to v4.
- Patch #8: new added, compared to v3.
Looks like I accidentally modified my send-email script..
There is a typo in the CC-ed mail address list:
[email protected] -> [email protected]
Quoted 7 lines · Wen Gu
The fourth edition of SMCv2 adds the SMC version 2.1 feature updates for SMC-Dv2 with virtual ISM. Virtual ISM are created and supported mainly by OS or hypervisor software, comparable to IBM ISM which is based on platform firmware or hardware.
With the introduction of virtual ISM, SMCv2.1 makes some updates:
Quoted 8 lines
- Introduce feature bitmask to indicate supplemental features.
- Reserve a range of CHIDs for virtual ISM.
- Support extended GIDs (128 bits) in CLC handshake.So this patch set aims to implement these updates in Linux kernel. And it acts as the first part of SMC-D virtual ISM extension & loopback-ism [1].
FYI I'm currently reviewing this version of the series. Hope to give you feedback by the end of tomorrow.
Thanks for your effort
- Jan
Quoted 77 lines
v6->v5:
- Add 'Reviewed-by' label given in the previous versions:
* Patch #4, #6, #9, #10 have nothing changed since v3;
- Patch #2:
* fix the format issue (Alignment should match open parenthesis) compared to v5;
* remove uselessclc->hdr.lengthassignment insmcr_clc_prep_confirm_accept()compared to v5;- Patch #3: new added compared to v5.
- Patch #7: some minor changes likeaclc_v2->aclcorclc_v2->clccompared to v5 due to the introduction of Patch #3. Since there were no major changes, I kept the 'Reviewed-by' label.Other changes in previous versions but not yet acked:
- Patch #1: Some minor changes in subject and fix the format issue (length exceeds 80 columns) compared to v3.
- Patch #5: removes uselessini->feature_maskassignment in__smc_connect()andsmc_listen_v2_check()compared to v4.
- Patch #8: new added, compared to v3.
v5->v4:
- Patch #6: improve the comment ofSMCD_CLC_MAX_V2_GID_ENTRIES;
- Patch #4: remove uselessini->feature_maskassignment;
v4->v3:
- Patch #6: useSMCD_CLC_MAX_V2_GID_ENTRIESto indicate the max gid entries in CLC proposal and usingSMC_MAX_V2_ISM_DEVSto indicate the max devices to propose;
- Patch #6: use i and i+1 insmc_find_ism_v2_device_serv();
- Patch #2: replace the large if-else block insmc_clc_send_confirm_accept()with 2 subfunctions;
- Fix missing byte order conversion of GID and token in CLC handshake, which is in a separate patch sending to net:https://lore.kernel.org/netdev/[email protected]/- Patch #7: add extended GID in SMC-D lgr netlink attribute;
v3->v2:
- Renamesmc_clc_fill_fceassmc_clc_fill_fce_v2x;
- RemoveISM_IDENT_MASKfromdrivers/s390/net/ism.h;
- Add explicitly assigning 'false' toism_v2_capableinism_dev_init();
- Removesmc_ism_set_v2_capable()helper for now, and introduce it in later loopback-ism implementation;
v2->v1:
- Fix sparse complaint;
- Rebase to the latest net-next;Wen Gu (10):
net/smc: rename some 'fce' to 'fce_v2x' for clarity net/smc: introduce sub-functions forsmc_clc_send_confirm_accept()net/smc: unify the structs of accept or confirm message for v1 and v2 net/smc: support SMCv2.x supplemental features negotiation net/smc: introduce virtual ISM device support feature net/smc: define a reserved CHID range for virtual ISM devices net/smc: compatible with 128-bits extended GID of virtual ISM device net/smc: support extended GID in SMC-D lgr netlink attribute net/smc: disable SEID on non-s390 archs where virtual ISM may be used net/smc: manage system EID in SMC stack instead of ISM driverdrivers/s390/net/ism.h | 7 - drivers/s390/net/ism_drv.c | 57 +++----- include/linux/ism.h | 1 - include/net/smc.h | 16 ++- include/uapi/linux/smc.h | 2 + include/uapi/linux/smc_diag.h | 2 + net/smc/af_smc.c | 116 +++++++++------ net/smc/smc.h | 10 +- net/smc/smc_clc.c | 318 +++++++++++++++++++++++++----------------- net/smc/smc_clc.h | 58 ++++---- net/smc/smc_core.c | 37 +++-- net/smc/smc_core.h | 18 ++- net/smc/smc_diag.c | 9 +- net/smc/smc_ism.c | 50 +++++-- net/smc/smc_ism.h | 30 +++- net/smc/smc_pnet.c | 4 +- 16 files changed, 445 insertions(+), 290 deletions(-)
Wen Gu
reviewerQuoted 17 lines · Jan Karcher
Quoted 14 lines · Wen Gu
The fourth edition of SMCv2 adds the SMC version 2.1 feature updates for SMC-Dv2 with virtual ISM. Virtual ISM are created and supported mainly by OS or hypervisor software, comparable to IBM ISM which is based on platform firmware or hardware.
With the introduction of virtual ISM, SMCv2.1 makes some updates:
- Introduce feature bitmask to indicate supplemental features.
- Reserve a range of CHIDs for virtual ISM.
- Support extended GIDs (128 bits) in CLC handshake.So this patch set aims to implement these updates in Linux kernel. And it acts as the first part of SMC-D virtual ISM extension & loopback-ism [1].
Quoted 8 lines
Quoted 1 line
FYI I'm currently reviewing this version of the series. Hope to give you feedback by the end of tomorrow.
Thanks for your effort
- Jan
Thank you very much for your time, Jan. The new version (v7) is updated:
https://lore.kernel.org/netdev/[email protected]/
Quoted 7 lines · Wen Gu
The fourth edition of SMCv2 adds the SMC version 2.1 feature updates for SMC-Dv2 with virtual ISM. Virtual ISM are created and supported mainly by OS or hypervisor software, comparable to IBM ISM which is based on platform firmware or hardware.
With the introduction of virtual ISM, SMCv2.1 makes some updates:
Quoted 8 lines
- Introduce feature bitmask to indicate supplemental features.
- Reserve a range of CHIDs for virtual ISM.
- Support extended GIDs (128 bits) in CLC handshake.So this patch set aims to implement these updates in Linux kernel. And it acts as the first part of SMC-D virtual ISM extension & loopback-ism [1].
Also there was a typo in the
[email protected]
Fixed it on this Mail.
Sorry for the noise.
Quoted 77 lines
v6->v5:
- Add 'Reviewed-by' label given in the previous versions:
* Patch #4, #6, #9, #10 have nothing changed since v3;
- Patch #2:
* fix the format issue (Alignment should match open parenthesis) compared to v5;
* remove uselessclc->hdr.lengthassignment insmcr_clc_prep_confirm_accept()compared to v5;- Patch #3: new added compared to v5.
- Patch #7: some minor changes likeaclc_v2->aclcorclc_v2->clccompared to v5 due to the introduction of Patch #3. Since there were no major changes, I kept the 'Reviewed-by' label.Other changes in previous versions but not yet acked:
- Patch #1: Some minor changes in subject and fix the format issue (length exceeds 80 columns) compared to v3.
- Patch #5: removes uselessini->feature_maskassignment in__smc_connect()andsmc_listen_v2_check()compared to v4.
- Patch #8: new added, compared to v3.
v5->v4:
- Patch #6: improve the comment ofSMCD_CLC_MAX_V2_GID_ENTRIES;
- Patch #4: remove uselessini->feature_maskassignment;
v4->v3:
- Patch #6: useSMCD_CLC_MAX_V2_GID_ENTRIESto indicate the max gid entries in CLC proposal and usingSMC_MAX_V2_ISM_DEVSto indicate the max devices to propose;
- Patch #6: use i and i+1 insmc_find_ism_v2_device_serv();
- Patch #2: replace the large if-else block insmc_clc_send_confirm_accept()with 2 subfunctions;
- Fix missing byte order conversion of GID and token in CLC handshake, which is in a separate patch sending to net:https://lore.kernel.org/netdev/[email protected]/- Patch #7: add extended GID in SMC-D lgr netlink attribute;
v3->v2:
- Renamesmc_clc_fill_fceassmc_clc_fill_fce_v2x;
- RemoveISM_IDENT_MASKfromdrivers/s390/net/ism.h;
- Add explicitly assigning 'false' toism_v2_capableinism_dev_init();
- Removesmc_ism_set_v2_capable()helper for now, and introduce it in later loopback-ism implementation;
v2->v1:
- Fix sparse complaint;
- Rebase to the latest net-next;Wen Gu (10):
net/smc: rename some 'fce' to 'fce_v2x' for clarity net/smc: introduce sub-functions forsmc_clc_send_confirm_accept()net/smc: unify the structs of accept or confirm message for v1 and v2 net/smc: support SMCv2.x supplemental features negotiation net/smc: introduce virtual ISM device support feature net/smc: define a reserved CHID range for virtual ISM devices net/smc: compatible with 128-bits extended GID of virtual ISM device net/smc: support extended GID in SMC-D lgr netlink attribute net/smc: disable SEID on non-s390 archs where virtual ISM may be used net/smc: manage system EID in SMC stack instead of ISM driverdrivers/s390/net/ism.h | 7 - drivers/s390/net/ism_drv.c | 57 +++----- include/linux/ism.h | 1 - include/net/smc.h | 16 ++- include/uapi/linux/smc.h | 2 + include/uapi/linux/smc_diag.h | 2 + net/smc/af_smc.c | 116 +++++++++------ net/smc/smc.h | 10 +- net/smc/smc_clc.c | 318 +++++++++++++++++++++++++----------------- net/smc/smc_clc.h | 58 ++++---- net/smc/smc_core.c | 37 +++-- net/smc/smc_core.h | 18 ++- net/smc/smc_diag.c | 9 +- net/smc/smc_ism.c | 50 +++++-- net/smc/smc_ism.h | 30 +++- net/smc/smc_pnet.c | 4 +- 16 files changed, 445 insertions(+), 290 deletions(-)