1

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 <guwen@linux.alibaba.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-and-tested-by: Jan Karcher <jaka@linux.ibm.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Wen Gu 2024-04-28 14:07:28 +08:00 committed by Paolo Abeni
parent e5c5f3596d
commit 784c46f546
3 changed files with 5 additions and 8 deletions

View File

@ -745,7 +745,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, 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); return ism_register_dmb(smcd->priv, (struct ism_dmb *)dmb, client);
} }

View File

@ -47,7 +47,6 @@ struct smcd_dmb {
#define ISM_ERROR 0xFFFF #define ISM_ERROR 0xFFFF
struct smcd_dev; struct smcd_dev;
struct ism_client;
struct smcd_gid { struct smcd_gid {
u64 gid; u64 gid;
@ -58,7 +57,7 @@ struct smcd_ops {
int (*query_remote_gid)(struct smcd_dev *dev, struct smcd_gid *rgid, int (*query_remote_gid)(struct smcd_dev *dev, struct smcd_gid *rgid,
u32 vid_valid, u32 vid); u32 vid_valid, u32 vid);
int (*register_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb, 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 (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id); int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id);
int (*del_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 { struct smcd_dev {
const struct smcd_ops *ops; const struct smcd_ops *ops;
void *priv; void *priv;
void *client;
struct list_head list; struct list_head list;
spinlock_t lock; spinlock_t lock;
struct smc_connection **conn; struct smc_connection **conn;

View File

@ -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, int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
struct smc_buf_desc *dmb_desc) struct smc_buf_desc *dmb_desc)
{ {
#if IS_ENABLED(CONFIG_ISM)
struct smcd_dmb dmb; struct smcd_dmb dmb;
int rc; 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.sba_idx = dmb_desc->sba_idx;
dmb.vlan_id = lgr->vlan_id; dmb.vlan_id = lgr->vlan_id;
dmb.rgid = lgr->peer_gid.gid; 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) { if (!rc) {
dmb_desc->sba_idx = dmb.sba_idx; dmb_desc->sba_idx = dmb.sba_idx;
dmb_desc->token = dmb.dmb_tok; 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; dmb_desc->len = dmb.dmb_len;
} }
return rc; return rc;
#else
return 0;
#endif
} }
static int smc_nl_handle_smcd_dev(struct smcd_dev *smcd, 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) if (!smcd)
return; return;
smcd->priv = ism; smcd->priv = ism;
smcd->client = &smc_ism_client;
ism_set_priv(ism, &smc_ism_client, smcd); ism_set_priv(ism, &smc_ism_client, smcd);
if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid)) if (smc_pnetid_by_dev_port(&ism->pdev->dev, 0, smcd->pnetid))
smc_pnetid_by_table_smcd(smcd); smc_pnetid_by_table_smcd(smcd);