* Re: [PATCH net-next v6 00/10] net/smc: implement SMCv2.1 virtual ISM device support
[not found] <1702371151-125258-1-git-send-email-guwen@linux.alibaba.com>
@ 2023-12-13 16:18 ` Jan Karcher
[not found] ` <1702371151-125258-4-git-send-email-guwen@linux.alibaba.com>
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Jan Karcher @ 2023-12-13 16:18 UTC (permalink / raw)
To: Wen Gu, wintera, wenjia, hca, gor, agordeev, davem, edumazet,
kuba, pabeni, kgraul
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 12/12/2023 09:52, Wen Gu wrote:
> 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/1695568613-125057-1-git-send-email-guwen@linux.alibaba.com/
Also there was a typo in the
linux-kernel@vger.kernel.org
Fixed it on this Mail.
Sorry for the noise.
>
> 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/1701882157-87956-1-git-send-email-guwen@linux.alibaba.com/
> - 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(-)
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
[not found] ` <1702371151-125258-4-git-send-email-guwen@linux.alibaba.com>
@ 2023-12-18 8:39 ` Alexandra Winter
2023-12-18 12:21 ` Wen Gu
0 siblings, 1 reply; 7+ messages in thread
From: Alexandra Winter @ 2023-12-18 8:39 UTC (permalink / raw)
To: Wen Gu, wenjia, hca, gor, agordeev, davem, edumazet, kuba,
pabeni, kgraul, jaka
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 12.12.23 09:52, Wen Gu wrote:
> 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.
>
> Suggested-by: Alexandra Winter <wintera@linux.ibm.com>
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---
> 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.
> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
> index 1697b84..614fa2f 100644
> --- a/net/smc/smc_clc.h
> +++ b/net/smc/smc_clc.h
> @@ -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
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.
> };
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.
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 02/10] net/smc: introduce sub-functions for smc_clc_send_confirm_accept()
[not found] ` <1702371151-125258-3-git-send-email-guwen@linux.alibaba.com>
@ 2023-12-18 8:41 ` Alexandra Winter
0 siblings, 0 replies; 7+ messages in thread
From: Alexandra Winter @ 2023-12-18 8:41 UTC (permalink / raw)
To: Wen Gu, wenjia, hca, gor, agordeev, davem, edumazet, kuba,
pabeni, kgraul, jaka
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 12.12.23 09:52, Wen Gu wrote:
> 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 <wintera@linux.ibm.com>
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---
Reviewed-by: Alexandra Winter <wintera@linux.ibm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
2023-12-18 8:39 ` [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2 Alexandra Winter
@ 2023-12-18 12:21 ` Wen Gu
2023-12-18 17:40 ` Alexandra Winter
0 siblings, 1 reply; 7+ messages in thread
From: Wen Gu @ 2023-12-18 12:21 UTC (permalink / raw)
To: Alexandra Winter, wenjia, hca, gor, agordeev, davem, edumazet,
kuba, pabeni, kgraul, jaka
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 2023/12/18 16:39, Alexandra Winter wrote:
>
>
> On 12.12.23 09:52, Wen Gu wrote:
>> 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.
>>
>> Suggested-by: Alexandra Winter <wintera@linux.ibm.com>
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
>> 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.
>
>
>
>> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
>> index 1697b84..614fa2f 100644
>> --- a/net/smc/smc_clc.h
>> +++ b/net/smc/smc_clc.h
>> @@ -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
>
> 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.
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
diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
index 614fa2f298f5..18157aeb14ec 100644
--- a/net/smc/smc_clc.h
+++ b/net/smc/smc_clc.h
@@ -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
};
>
>> };
>
> 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.
>
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.
>
> [...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
2023-12-18 12:21 ` Wen Gu
@ 2023-12-18 17:40 ` Alexandra Winter
2023-12-19 8:18 ` Wen Gu
0 siblings, 1 reply; 7+ messages in thread
From: Alexandra Winter @ 2023-12-18 17:40 UTC (permalink / raw)
To: Wen Gu, wenjia, hca, gor, agordeev, davem, edumazet, kuba,
pabeni, kgraul, jaka
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 18.12.23 13:21, Wen Gu wrote:
> 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.
V1 is documented in
https://datatracker.ietf.org/doc/html/draft-fox-tcpm-shared-memory-rdma-03
>
> 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?
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..
>
> If still, I will change these structures as
>
> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
> index 614fa2f298f5..18157aeb14ec 100644
> --- a/net/smc/smc_clc.h
> +++ b/net/smc/smc_clc.h
> @@ -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: */
^^ 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.
> - 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: */
> - __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
> };
>
>>
>>> };
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.
>>
>> 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.
>>
>
> 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.
>
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.
> Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2
2023-12-18 17:40 ` Alexandra Winter
@ 2023-12-19 8:18 ` Wen Gu
0 siblings, 0 replies; 7+ messages in thread
From: Wen Gu @ 2023-12-19 8:18 UTC (permalink / raw)
To: Alexandra Winter, wenjia, hca, gor, agordeev, davem, edumazet,
kuba, pabeni, kgraul, jaka
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 2023/12/19 01:40, Alexandra Winter wrote:
>
>
> On 18.12.23 13:21, Wen Gu wrote:
>> 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.
>
> 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?
>>
>> 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?
>
> 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 agree. Macros may cause some unexpected substitutions. I will remove them.
> 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.
>>
>> If still, I will change these structures as
>>
>> diff --git a/net/smc/smc_clc.h b/net/smc/smc_clc.h
>> index 614fa2f298f5..18157aeb14ec 100644
>> --- a/net/smc/smc_clc.h
>> +++ b/net/smc/smc_clc.h
>> @@ -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: */
>
> ^^ 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.
>
>> - 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: */
>
>> - __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
>> };
>>
>>>
>>>> };
>
> 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.)
>
>
>>>
>>> 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.
>>>
>>
>> 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.
>>
>
> 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.
>
Agree. I will add them to r1 and d1 definition.
Thank you.
Wen Gu
>
>> Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net-next v6 00/10] net/smc: implement SMCv2.1 virtual ISM device support
[not found] ` <8d118a94-945f-466f-9d34-e0b8a6d8a9e7@linux.ibm.com>
@ 2023-12-19 11:16 ` Wen Gu
0 siblings, 0 replies; 7+ messages in thread
From: Wen Gu @ 2023-12-19 11:16 UTC (permalink / raw)
To: Jan Karcher, wintera, wenjia, hca, gor, agordeev, davem,
edumazet, kuba, pabeni, kgraul
Cc: borntraeger, svens, alibuda, tonylu, raspl, schnelle,
guangguan.wang, linux-s390, netdev, linux-kernel
On 2023/12/14 00:13, Jan Karcher wrote:
>
>
> On 12/12/2023 09:52, Wen Gu wrote:
>> 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/1695568613-125057-1-git-send-email-guwen@linux.alibaba.com/
>
> 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/20231219084536.8158-1-guwen@linux.alibaba.com/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-12-19 11:16 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1702371151-125258-1-git-send-email-guwen@linux.alibaba.com>
2023-12-13 16:18 ` [PATCH net-next v6 00/10] net/smc: implement SMCv2.1 virtual ISM device support Jan Karcher
[not found] ` <1702371151-125258-4-git-send-email-guwen@linux.alibaba.com>
2023-12-18 8:39 ` [PATCH net-next v6 03/10] net/smc: unify the structs of accept or confirm message for v1 and v2 Alexandra Winter
2023-12-18 12:21 ` Wen Gu
2023-12-18 17:40 ` Alexandra Winter
2023-12-19 8:18 ` Wen Gu
[not found] ` <1702371151-125258-3-git-send-email-guwen@linux.alibaba.com>
2023-12-18 8:41 ` [PATCH net-next v6 02/10] net/smc: introduce sub-functions for smc_clc_send_confirm_accept() Alexandra Winter
[not found] ` <8d118a94-945f-466f-9d34-e0b8a6d8a9e7@linux.ibm.com>
2023-12-19 11:16 ` [PATCH net-next v6 00/10] net/smc: implement SMCv2.1 virtual ISM device support Wen Gu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®