Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Alexandra Winter and committed by
Paolo Abeni
719c3b67 92a0f7bb

+48 -40
+10
drivers/dibs/dibs_loopback.c
··· 24 24 return DIBS_LOOPBACK_FABRIC; 25 25 } 26 26 27 + static int dibs_lo_query_rgid(struct dibs_dev *dibs, const uuid_t *rgid, 28 + u32 vid_valid, u32 vid) 29 + { 30 + /* rgid should be the same as lgid */ 31 + if (!uuid_equal(rgid, &dibs->gid)) 32 + return -ENETUNREACH; 33 + return 0; 34 + } 35 + 27 36 static const struct dibs_dev_ops dibs_lo_ops = { 28 37 .get_fabric_id = dibs_lo_get_fabric_id, 38 + .query_remote_gid = dibs_lo_query_rgid, 29 39 }; 30 40 31 41 static int dibs_lo_dev_probe(void)
+18 -23
drivers/s390/net/ism_drv.c
··· 291 291 return ret; 292 292 } 293 293 294 + static int ism_query_rgid(struct dibs_dev *dibs, const uuid_t *rgid, 295 + u32 vid_valid, u32 vid) 296 + { 297 + struct ism_dev *ism = dibs->drv_priv; 298 + union ism_query_rgid cmd; 299 + 300 + memset(&cmd, 0, sizeof(cmd)); 301 + cmd.request.hdr.cmd = ISM_QUERY_RGID; 302 + cmd.request.hdr.len = sizeof(cmd.request); 303 + 304 + memcpy(&cmd.request.rgid, rgid, sizeof(cmd.request.rgid)); 305 + cmd.request.vlan_valid = vid_valid; 306 + cmd.request.vlan_id = vid; 307 + 308 + return ism_cmd(ism, &cmd); 309 + } 310 + 294 311 static void ism_free_dmb(struct ism_dev *ism, struct ism_dmb *dmb) 295 312 { 296 313 clear_bit(dmb->sba_idx, ism->sba_bitmap); ··· 554 537 555 538 static const struct dibs_dev_ops ism_ops = { 556 539 .get_fabric_id = ism_get_chid, 540 + .query_remote_gid = ism_query_rgid, 557 541 .add_vlan_id = ism_add_vlan_id, 558 542 .del_vlan_id = ism_del_vlan_id, 559 543 }; ··· 766 748 /*************************** SMC-D Implementation *****************************/ 767 749 768 750 #if IS_ENABLED(CONFIG_SMC) 769 - static int ism_query_rgid(struct ism_dev *ism, u64 rgid, u32 vid_valid, 770 - u32 vid) 771 - { 772 - union ism_query_rgid cmd; 773 - 774 - memset(&cmd, 0, sizeof(cmd)); 775 - cmd.request.hdr.cmd = ISM_QUERY_RGID; 776 - cmd.request.hdr.len = sizeof(cmd.request); 777 - 778 - cmd.request.rgid = rgid; 779 - cmd.request.vlan_valid = vid_valid; 780 - cmd.request.vlan_id = vid; 781 - 782 - return ism_cmd(ism, &cmd); 783 - } 784 - 785 - static int smcd_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid, 786 - u32 vid_valid, u32 vid) 787 - { 788 - return ism_query_rgid(smcd->priv, rgid->gid, vid_valid, vid); 789 - } 790 - 791 751 static int smcd_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb, 792 752 void *client) 793 753 { ··· 809 813 } 810 814 811 815 static const struct smcd_ops ism_smcd_ops = { 812 - .query_remote_gid = smcd_query_rgid, 813 816 .register_dmb = smcd_register_dmb, 814 817 .unregister_dmb = smcd_unregister_dmb, 815 818 .signal_event = smcd_signal_ieq,
+14
include/linux/dibs.h
··· 134 134 */ 135 135 u16 (*get_fabric_id)(struct dibs_dev *dev); 136 136 /** 137 + * query_remote_gid() 138 + * @dev: local dibs device 139 + * @rgid: gid of remote dibs device 140 + * @vid_valid: if zero, vid will be ignored; 141 + * deprecated, ignored if device does not support vlan 142 + * @vid: VLAN id; deprecated, ignored if device does not support vlan 143 + * 144 + * Query whether a remote dibs device is reachable via this local device 145 + * and this vlan id. 146 + * Return: 0 if remote gid is reachable. 147 + */ 148 + int (*query_remote_gid)(struct dibs_dev *dev, const uuid_t *rgid, 149 + u32 vid_valid, u32 vid); 150 + /** 137 151 * add_vlan_id() - add dibs device to vlan (optional, deprecated) 138 152 * @dev: dibs device 139 153 * @vlan_id: vlan id
-2
include/net/smc.h
··· 53 53 }; 54 54 55 55 struct smcd_ops { 56 - int (*query_remote_gid)(struct smcd_dev *dev, struct smcd_gid *rgid, 57 - u32 vid_valid, u32 vid); 58 56 int (*register_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb, 59 57 void *client); 60 58 int (*unregister_dmb)(struct smcd_dev *dev, struct smcd_dmb *dmb);
+6 -2
net/smc/smc_ism.c
··· 77 77 int smc_ism_cantalk(struct smcd_gid *peer_gid, unsigned short vlan_id, 78 78 struct smcd_dev *smcd) 79 79 { 80 - return smcd->ops->query_remote_gid(smcd, peer_gid, vlan_id ? 1 : 0, 81 - vlan_id); 80 + struct dibs_dev *dibs = smcd->dibs; 81 + uuid_t ism_rgid; 82 + 83 + copy_to_dibsgid(&ism_rgid, peer_gid); 84 + return dibs->ops->query_remote_gid(dibs, &ism_rgid, vlan_id ? 1 : 0, 85 + vlan_id); 82 86 } 83 87 84 88 void smc_ism_get_system_eid(u8 **eid)
-13
net/smc/smc_loopback.c
··· 25 25 26 26 static struct smc_lo_dev *lo_dev; 27 27 28 - static int smc_lo_query_rgid(struct smcd_dev *smcd, struct smcd_gid *rgid, 29 - u32 vid_valid, u32 vid) 30 - { 31 - uuid_t temp; 32 - 33 - copy_to_dibsgid(&temp, rgid); 34 - /* rgid should be the same as lgid */ 35 - if (!uuid_equal(&temp, &smcd->dibs->gid)) 36 - return -ENETUNREACH; 37 - return 0; 38 - } 39 - 40 28 static int smc_lo_register_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb, 41 29 void *client_priv) 42 30 { ··· 223 235 } 224 236 225 237 static const struct smcd_ops lo_ops = { 226 - .query_remote_gid = smc_lo_query_rgid, 227 238 .register_dmb = smc_lo_register_dmb, 228 239 .unregister_dmb = smc_lo_unregister_dmb, 229 240 .support_dmb_nocopy = smc_lo_support_dmb_nocopy,