mirror of
https://github.com/torvalds/linux.git
synced 2025-11-02 09:40:27 +02:00
dibs: Move query_remote_gid() to dibs_dev_ops
Provide the dibs_dev_ops->query_remote_gid() in ism and dibs_loopback dibs_devices. And call it in smc dibs_client. Reviewed-by: Julian Ruess <julianr@linux.ibm.com> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com> Link: https://patch.msgid.link/20250918110500.1731261-13-wintera@linux.ibm.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
92a0f7bb08
commit
719c3b67bb
6 changed files with 48 additions and 40 deletions
|
|
@ -24,8 +24,18 @@ static u16 dibs_lo_get_fabric_id(struct dibs_dev *dibs)
|
|||
return DIBS_LOOPBACK_FABRIC;
|
||||
}
|
||||
|
||||
static int dibs_lo_query_rgid(struct dibs_dev *dibs, const uuid_t *rgid,
|
||||
u32 vid_valid, u32 vid)
|
||||
{
|
||||
/* rgid should be the same as lgid */
|
||||
if (!uuid_equal(rgid, &dibs->gid))
|
||||
return -ENETUNREACH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dibs_dev_ops dibs_lo_ops = {
|
||||
.get_fabric_id = dibs_lo_get_fabric_id,
|
||||
.query_remote_gid = dibs_lo_query_rgid,
|
||||
};
|
||||
|
||||
static int dibs_lo_dev_probe(void)
|
||||
|
|
|
|||
|
|
@ -291,6 +291,23 @@ static int ism_read_local_gid(struct dibs_dev *dibs)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ism_query_rgid(struct dibs_dev *dibs, const uuid_t *rgid,
|
||||
u32 vid_valid, u32 vid)
|
||||
{
|
||||
struct ism_dev *ism = dibs->drv_priv;
|
||||
union ism_query_rgid cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.request.hdr.cmd = ISM_QUERY_RGID;
|
||||
cmd.request.hdr.len = sizeof(cmd.request);
|
||||
|
||||
memcpy(&cmd.request.rgid, rgid, sizeof(cmd.request.rgid));
|
||||
cmd.request.vlan_valid = vid_valid;
|
||||
cmd.request.vlan_id = vid;
|
||||
|
||||
return ism_cmd(ism, &cmd);
|
||||
}
|
||||
|
||||
static void ism_free_dmb(struct ism_dev *ism, struct ism_dmb *dmb)
|
||||
{
|
||||
clear_bit(dmb->sba_idx, ism->sba_bitmap);
|
||||
|
|
@ -537,6 +554,7 @@ static irqreturn_t ism_handle_irq(int irq, void *data)
|
|||
|
||||
static const struct dibs_dev_ops ism_ops = {
|
||||
.get_fabric_id = ism_get_chid,
|
||||
.query_remote_gid = ism_query_rgid,
|
||||
.add_vlan_id = ism_add_vlan_id,
|
||||
.del_vlan_id = ism_del_vlan_id,
|
||||
};
|
||||
|
|
@ -748,28 +766,6 @@ module_exit(ism_exit);
|
|||
/*************************** SMC-D Implementation *****************************/
|
||||
|
||||
#if IS_ENABLED(CONFIG_SMC)
|
||||
static int ism_query_rgid(struct ism_dev *ism, u64 rgid, u32 vid_valid,
|
||||
u32 vid)
|
||||
{
|
||||
union ism_query_rgid cmd;
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
cmd.request.hdr.cmd = ISM_QUERY_RGID;
|
||||
cmd.request.hdr.len = sizeof(cmd.request);
|
||||
|
||||
cmd.request.rgid = rgid;
|
||||
cmd.request.vlan_valid = vid_valid;
|
||||
cmd.request.vlan_id = vid;
|
||||
|
||||
return ism_cmd(ism, &cmd);
|
||||
}
|
||||
|
||||
static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
|
||||
u32 vid_valid, u32 vid)
|
||||
{
|
||||
return ism_query_rgid(smcd->priv, rgid->gid, vid_valid, vid);
|
||||
}
|
||||
|
||||
static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
|
||||
void *client)
|
||||
{
|
||||
|
|
@ -813,7 +809,6 @@ static int smcd_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,
|
|||
}
|
||||
|
||||
static const struct smcd_ops ism_smcd_ops = {
|
||||
.query_remote_gid = smcd_query_rgid,
|
||||
.register_dmb = smcd_register_dmb,
|
||||
.unregister_dmb = smcd_unregister_dmb,
|
||||
.signal_event = smcd_signal_ieq,
|
||||
|
|
|
|||
|
|
@ -133,6 +133,20 @@ struct dibs_dev_ops {
|
|||
* Return: 2 byte dibs fabric id
|
||||
*/
|
||||
u16 (*get_fabric_id)(struct dibs_dev *dev);
|
||||
/**
|
||||
* query_remote_gid()
|
||||
* @dev: local dibs device
|
||||
* @rgid: gid of remote dibs device
|
||||
* @vid_valid: if zero, vid will be ignored;
|
||||
* deprecated, ignored if device does not support vlan
|
||||
* @vid: VLAN id; deprecated, ignored if device does not support vlan
|
||||
*
|
||||
* Query whether a remote dibs device is reachable via this local device
|
||||
* and this vlan id.
|
||||
* Return: 0 if remote gid is reachable.
|
||||
*/
|
||||
int (*query_remote_gid)(struct dibs_dev *dev, const uuid_t *rgid,
|
||||
u32 vid_valid, u32 vid);
|
||||
/**
|
||||
* add_vlan_id() - add dibs device to vlan (optional, deprecated)
|
||||
* @dev: dibs device
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ struct smcd_gid {
|
|||
};
|
||||
|
||||
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,
|
||||
void *client);
|
||||
int (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
|
||||
|
|
|
|||
|
|
@ -77,8 +77,12 @@ static void smc_ism_create_system_eid(void)
|
|||
int smc_ism_cantalk(struct smcd_gid *peer_gid, unsigned short vlan_id,
|
||||
struct smcd_dev *smcd)
|
||||
{
|
||||
return smcd->ops->query_remote_gid(smcd, peer_gid, vlan_id ? 1 : 0,
|
||||
vlan_id);
|
||||
struct dibs_dev *dibs = smcd->dibs;
|
||||
uuid_t ism_rgid;
|
||||
|
||||
copy_to_dibsgid(&ism_rgid, peer_gid);
|
||||
return dibs->ops->query_remote_gid(dibs, &ism_rgid, vlan_id ? 1 : 0,
|
||||
vlan_id);
|
||||
}
|
||||
|
||||
void smc_ism_get_system_eid(u8 **eid)
|
||||
|
|
|
|||
|
|
@ -25,18 +25,6 @@
|
|||
|
||||
static struct smc_lo_dev *lo_dev;
|
||||
|
||||
static int smc_lo_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid,
|
||||
u32 vid_valid, u32 vid)
|
||||
{
|
||||
uuid_t temp;
|
||||
|
||||
copy_to_dibsgid(&temp, rgid);
|
||||
/* rgid should be the same as lgid */
|
||||
if (!uuid_equal(&temp, &smcd->dibs->gid))
|
||||
return -ENETUNREACH;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int smc_lo_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb,
|
||||
void *client_priv)
|
||||
{
|
||||
|
|
@ -235,7 +223,6 @@ static int smc_lo_move_data(struct smcd_dev *smcd, u64 dmb_tok,
|
|||
}
|
||||
|
||||
static const struct smcd_ops lo_ops = {
|
||||
.query_remote_gid = smc_lo_query_rgid,
|
||||
.register_dmb = smc_lo_register_dmb,
|
||||
.unregister_dmb = smc_lo_unregister_dmb,
|
||||
.support_dmb_nocopy = smc_lo_support_dmb_nocopy,
|
||||
|
|
|
|||
Loading…
Reference in a new issue