diff mbox series

[RFC,net-next,v5,2/9] net/smc: Decouple ism_dev from SMC-D DMB registration

Message ID 1682252271-2544-3-git-send-email-guwen@linux.alibaba.com (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series net/smc: Introduce SMC-D-based OS internal communication acceleration | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net-next
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: 8 this patch: 8
netdev/cc_maintainers warning 6 maintainers not CCed: wintera@linux.ibm.com gor@linux.ibm.com svens@linux.ibm.com agordeev@linux.ibm.com borntraeger@linux.ibm.com hca@linux.ibm.com
netdev/build_clang fail Errors and warnings before: 13 this patch: 13
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 fail Errors and warnings before: 14 this patch: 14
netdev/checkpatch warning WARNING: line length of 83 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wen Gu April 23, 2023, 12:17 p.m. UTC
This patch tries to decouple ISM device from SMC-D DMB registration,
So that the register_dmb option is not restricted to be used by ISM
device.

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

Comments

Simon Horman April 28, 2023, 2:40 p.m. UTC | #1
On Sun, Apr 23, 2023 at 08:17:44PM +0800, Wen Gu wrote:
> This patch tries to decouple ISM device from SMC-D DMB registration,
> So that the register_dmb option is not restricted to be used by ISM
> device.
> 
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---
>  drivers/s390/net/ism_drv.c | 5 +++--
>  include/net/smc.h          | 4 ++--
>  net/smc/smc_ism.c          | 7 ++-----
>  3 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> index 8acb9eb..5eeb54d 100644
> --- a/drivers/s390/net/ism_drv.c
> +++ b/drivers/s390/net/ism_drv.c
> @@ -796,9 +796,10 @@ static int smcd_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid,
>  }
>  
>  static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
> -			     struct ism_client *client)
> +			     void *client_priv)
>  {
> -	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
> +	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb,
> +				(struct ism_client *)client_priv);

Hi Wen Gu,

a minor nit from my side: there is no need to cast a void pointer to
another type.

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

...
Wen Gu May 4, 2023, 6:22 a.m. UTC | #2
On 2023/4/28 22:40, Simon Horman wrote:

> On Sun, Apr 23, 2023 at 08:17:44PM +0800, Wen Gu wrote:
>> This patch tries to decouple ISM device from SMC-D DMB registration,
>> So that the register_dmb option is not restricted to be used by ISM
>> device.
>>
>> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
>> ---
>>   drivers/s390/net/ism_drv.c | 5 +++--
>>   include/net/smc.h          | 4 ++--
>>   net/smc/smc_ism.c          | 7 ++-----
>>   3 files changed, 7 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
>> index 8acb9eb..5eeb54d 100644
>> --- a/drivers/s390/net/ism_drv.c
>> +++ b/drivers/s390/net/ism_drv.c
>> @@ -796,9 +796,10 @@ static int smcd_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid,
>>   }
>>   
>>   static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
>> -			     struct ism_client *client)
>> +			     void *client_priv)
>>   {
>> -	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
>> +	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb,
>> +				(struct ism_client *)client_priv);
> 
> Hi Wen Gu,
> 
> a minor nit from my side: there is no need to cast a void pointer to
> another type.
> 
>>   }
>>   
>>   static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
> 
> ...

Hi Simon Horman,

Thanks for your review and suggestions in this patch and others.
I will take them in the next version.

Thanks!
Wen Gu
diff mbox series

Patch

diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index 8acb9eb..5eeb54d 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -796,9 +796,10 @@  static int smcd_query_rgid(struct smcd_dev *smcd, u64 rgid, u32 vid_valid,
 }
 
 static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
-			     struct ism_client *client)
+			     void *client_priv)
 {
-	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
+	return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb,
+				(struct ism_client *)client_priv);
 }
 
 static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)
diff --git a/include/net/smc.h b/include/net/smc.h
index 963ce9c..26206d2 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -50,13 +50,12 @@  struct smcd_dmb {
 #define ISM_ERROR	0xFFFF
 
 struct smcd_dev;
-struct ism_client;
 
 struct smcd_ops {
 	int (*query_remote_gid)(struct smcd_dev *dev, u64 rgid, u32 vid_valid,
 				u32 vid);
 	int (*register_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb,
-			    struct ism_client *client);
+			    void *client_priv);
 	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);
@@ -77,6 +76,7 @@  struct smcd_ops {
 struct smcd_dev {
 	const struct smcd_ops *ops;
 	void *priv;
+	void *client_priv;
 	struct device *parent_pci_dev;
 	struct list_head list;
 	spinlock_t lock;
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index 4249fb9..d4709ca 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -200,7 +200,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;
 
@@ -209,7 +208,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;
-	rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, &smc_ism_client);
+	rc = lgr->smcd->ops->register_dmb(lgr->smcd, &dmb, lgr->smcd->client_priv);
 	if (!rc) {
 		dmb_desc->sba_idx = dmb.sba_idx;
 		dmb_desc->token = dmb.dmb_tok;
@@ -218,9 +217,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,
@@ -419,6 +415,7 @@  static void smcd_register_dev(struct ism_dev *ism)
 	if (!smcd)
 		return;
 	smcd->priv = ism;
+	smcd->client_priv = &smc_ism_client;
 	smcd->parent_pci_dev = ism->dev.parent;
 	ism_set_priv(ism, &smc_ism_client, smcd);
 	if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid))