2024-04-14 04:03:28

by Wen Gu

[permalink] [raw]
Subject: [PATCH net-next v6 01/11] net/smc: decouple ism_client from SMC-D DMB registration

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 <[email protected]>
---
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(-)

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);
--
2.32.0.3.g01195cf9f



2024-04-15 08:42:42

by Alexandra Winter

[permalink] [raw]
Subject: Re: [PATCH net-next v6 01/11] net/smc: decouple ism_client from SMC-D DMB registration



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 <[email protected]>
> ---

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?

2024-04-16 13:59:50

by Wen Gu

[permalink] [raw]
Subject: Re: [PATCH net-next v6 01/11] net/smc: decouple ism_client from SMC-D DMB registration



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 <[email protected]>
>> ---
>
> 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?

2024-04-25 11:30:44

by Wenjia Zhang

[permalink] [raw]
Subject: Re: [PATCH net-next v6 01/11] net/smc: decouple ism_client from SMC-D DMB registration



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 <[email protected]>
>> ---
>
> 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.