diff mbox series

[net-next,v6,01/11] net/smc: decouple ism_client from SMC-D DMB registration

Message ID 20240414040304.54255-2-guwen@linux.alibaba.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net/smc: SMC intra-OS shortcut with loopback-ism | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 17 of 17 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 61 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-04-15--15-00 (tests: 961)

Commit Message

Wen Gu April 14, 2024, 4:02 a.m. UTC
The struct 'ism_client' is specialized for s390 platform firmware ISM.
So replace it with 'void' to make SMCD DMB registration helper generic
for both Emulated-ISM and existing ISM.

Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
---
 drivers/s390/net/ism_drv.c | 2 +-
 include/net/smc.h          | 4 ++--
 net/smc/smc_ism.c          | 7 ++-----
 3 files changed, 5 insertions(+), 8 deletions(-)

Comments

Alexandra Winter April 15, 2024, 8:41 a.m. UTC | #1
On 14.04.24 06:02, Wen Gu wrote:
> The struct 'ism_client' is specialized for s390 platform firmware ISM.
> So replace it with 'void' to make SMCD DMB registration helper generic
> for both Emulated-ISM and existing ISM.
> 
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---

Just a thought:
The client concept is really specific to s390 platform firmware ISM.
So wouldn't it be nice to do something like:

diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index 78cca4839a31..37dcdf2bc044 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -747,10 +747,9 @@ static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
        return ism_query_rgid(smcd->priv, rgid->gid, vid_valid, vid);
 }

-static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
-                            struct ism_client *client)
+static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
 {
-       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
+       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, &smc_ism_client);
 }

 static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)

--------------

This is not a real patch, just a sketch, but I hope you
get the idea.


This may be a step in the direction of moving the ism_client concept from 
net/smc/smc_ism.c to drivers/s390/net/ism*


I know that there are several dependencies to consider. 
And I haven't looked at the other patches in this series yet in detail, to see how you solve
things like smcd_register_dev. Seems like smcd_register_dmb() is the only one of the smcd_ops
that you need for loopback and uses ism_client.



Wenjia, Gerd, and others what do you think?
Wen Gu April 16, 2024, 1:58 p.m. UTC | #2
On 2024/4/15 16:41, Alexandra Winter wrote:
> 
> 
> On 14.04.24 06:02, Wen Gu wrote:
>> The struct 'ism_client' is specialized for s390 platform firmware ISM.
>> So replace it with 'void' to make SMCD DMB registration helper generic
>> for both Emulated-ISM and existing ISM.
>>
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
> 
> Just a thought:
> The client concept is really specific to s390 platform firmware ISM.
> So wouldn't it be nice to do something like:
> 
> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> index 78cca4839a31..37dcdf2bc044 100644
> --- a/drivers/s390/net/ism_drv.c
> +++ b/drivers/s390/net/ism_drv.c
> @@ -747,10 +747,9 @@ static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
>          return ism_query_rgid(smcd->priv, rgid->gid, vid_valid, vid);
>   }
> 
> -static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
> -                            struct ism_client *client)
> +static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
>   {
> -       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
> +       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, &smc_ism_client);
>   }
> 
>   static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
> 
> --------------
> 
> This is not a real patch, just a sketch, but I hope you
> get the idea.
> 
> 
> This may be a step in the direction of moving the ism_client concept from
> net/smc/smc_ism.c to drivers/s390/net/ism*
> 
> 
> I know that there are several dependencies to consider.

Yeah.. I think so too. The move of ism_client concept may involve much work.

> And I haven't looked at the other patches in this series yet in detail, to see how you solve
> things like smcd_register_dev. Seems like smcd_register_dmb() is the only one of the smcd_ops
> that you need for loopback and uses ism_client.
> 

loopback-ism uses smcd_lo_register_dev instead. And yes, smcd_register_dmb() is
the only one of smcd_ops that use ism_client in its function argument.

> 
> 
> Wenjia, Gerd, and others what do you think?
Wenjia Zhang April 25, 2024, 11:29 a.m. UTC | #3
On 15.04.24 10:41, Alexandra Winter wrote:
> 
> 
> On 14.04.24 06:02, Wen Gu wrote:
>> The struct 'ism_client' is specialized for s390 platform firmware ISM.
>> So replace it with 'void' to make SMCD DMB registration helper generic
>> for both Emulated-ISM and existing ISM.
>>
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
> 
> Just a thought:
> The client concept is really specific to s390 platform firmware ISM.
> So wouldn't it be nice to do something like:
> 
> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> index 78cca4839a31..37dcdf2bc044 100644
> --- a/drivers/s390/net/ism_drv.c
> +++ b/drivers/s390/net/ism_drv.c
> @@ -747,10 +747,9 @@ static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
>          return ism_query_rgid(smcd->priv, rgid->gid, vid_valid, vid);
>   }
> 
> -static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
> -                            struct ism_client *client)
> +static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
>   {
> -       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
> +       return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, &smc_ism_client);
>   }
> 
>   static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
> 
> --------------
> 
> This is not a real patch, just a sketch, but I hope you
> get the idea.
> 
> 
> This may be a step in the direction of moving the ism_client concept from
> net/smc/smc_ism.c to drivers/s390/net/ism*
> 
> 
> I know that there are several dependencies to consider.
> And I haven't looked at the other patches in this series yet in detail, to see how you solve
> things like smcd_register_dev. Seems like smcd_register_dmb() is the only one of the smcd_ops
> that you need for loopback and uses ism_client.
> 
> 
> 
> Wenjia, Gerd, and others what do you think?


IMO, the idea is not bad, but it should not belong to this patch series.
diff mbox series

Patch

diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index 2c8e964425dc..9b2a52913e76 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -726,7 +726,7 @@  static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
 }
 
 static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
-			     struct ism_client *client)
+			     void *client)
 {
 	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
 }
diff --git a/include/net/smc.h b/include/net/smc.h
index 10684d0a33df..542d12372c18 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -47,7 +47,6 @@  struct smcd_dmb {
 #define ISM_ERROR	0xFFFF
 
 struct smcd_dev;
-struct ism_client;
 
 struct smcd_gid {
 	u64	gid;
@@ -58,7 +57,7 @@  struct smcd_ops {
 	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);
+			    void *client);
 	int (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
 	int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id);
 	int (*del_vlan_id)(struct smcd_dev *dev, u64 vlan_id);
@@ -78,6 +77,7 @@  struct smcd_ops {
 struct smcd_dev {
 	const struct smcd_ops *ops;
 	void *priv;
+	void *client;
 	struct list_head list;
 	spinlock_t lock;
 	struct smc_connection **conn;
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index ac88de2a06a0..051726586730 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -222,7 +222,6 @@  int smc_ism_unregister_dmb(struct smcd_dev *smcd, struct smc_buf_desc *dmb_desc)
 int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
 			 struct smc_buf_desc *dmb_desc)
 {
-#if IS_ENABLED(CONFIG_ISM)
 	struct smcd_dmb dmb;
 	int rc;
 
@@ -231,7 +230,7 @@  int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
 	dmb.sba_idx = dmb_desc->sba_idx;
 	dmb.vlan_id = lgr->vlan_id;
 	dmb.rgid = lgr->peer_gid.gid;
-	rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, &smc_ism_client);
+	rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, lgr->smcd->client);
 	if (!rc) {
 		dmb_desc->sba_idx = dmb.sba_idx;
 		dmb_desc->token = dmb.dmb_tok;
@@ -240,9 +239,6 @@  int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
 		dmb_desc->len = dmb.dmb_len;
 	}
 	return rc;
-#else
-	return 0;
-#endif
 }
 
 static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd,
@@ -446,6 +442,7 @@  static void smcd_register_dev(struct ism_dev *ism)
 	if (!smcd)
 		return;
 	smcd->priv = ism;
+	smcd->client = &smc_ism_client;
 	ism_set_priv(ism, &smc_ism_client, smcd);
 	if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid))
 		smc_pnetid_by_table_smcd(smcd);