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 vlan support to dibs_dev_ops

It can be debated how much benefit definition of vlan ids for dibs devices
brings, as the dmbs are accessible only by a single peer anyhow. But ism
provides vlan support and smcd exploits it, so move it to dibs layer as an
optional feature.

smcd_loopback simply ignores all vlan settings, do the same in
dibs_loopback.

SMC-D and ISM have a method to use the invalid VLAN ID 1FFF
(ISM_RESERVED_VLANID), to indicate that both communication peers support
routable SMC-Dv2. Tolerate it in dibs, but move it to SMC only.

Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Link: https://patch.msgid.link/20250918110500.1731261-12-wintera@linux.ibm.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Alexandra Winter and committed by
Paolo Abeni
92a0f7bb 05e68d8d

+34 -56
+6 -41
drivers/s390/net/ism_drv.c
··· 36 36 /* a list for fast mapping */ 37 37 static u8 max_client; 38 38 static DEFINE_MUTEX(clients_lock); 39 - static bool ism_v2_capable; 40 39 struct ism_dev_list { 41 40 struct list_head list; 42 41 struct mutex mutex; /* protects ism device list */ ··· 408 409 } 409 410 EXPORT_SYMBOL_GPL(ism_unregister_dmb); 410 411 411 - static int ism_add_vlan_id(struct ism_dev *ism, u64 vlan_id) 412 + static int ism_add_vlan_id(struct dibs_dev *dibs, u64 vlan_id) 412 413 { 414 + struct ism_dev *ism = dibs->drv_priv; 413 415 union ism_set_vlan_id cmd; 414 416 415 417 memset(&cmd, 0, sizeof(cmd)); ··· 422 422 return ism_cmd(ism, &cmd); 423 423 } 424 424 425 - static int ism_del_vlan_id(struct ism_dev *ism, u64 vlan_id) 425 + static int ism_del_vlan_id(struct dibs_dev *dibs, u64 vlan_id) 426 426 { 427 + struct ism_dev *ism = dibs->drv_priv; 427 428 union ism_set_vlan_id cmd; 428 429 429 430 memset(&cmd, 0, sizeof(cmd)); ··· 537 536 538 537 static const struct dibs_dev_ops ism_ops = { 539 538 .get_fabric_id = ism_get_chid, 539 + .add_vlan_id = ism_add_vlan_id, 540 + .del_vlan_id = ism_del_vlan_id, 540 541 }; 541 542 542 543 static int ism_dev_init(struct ism_dev *ism) ··· 567 564 ret = register_ieq(ism); 568 565 if (ret) 569 566 goto unreg_sba; 570 - 571 - if (!ism_add_vlan_id(ism, ISM_RESERVED_VLANID)) 572 - /* hardware is V2 capable */ 573 - ism_v2_capable = true; 574 - else 575 - ism_v2_capable = false; 576 567 577 568 mutex_lock(&ism_dev_list.mutex); 578 569 mutex_lock(&clients_lock); ··· 608 611 609 612 mutex_lock(&ism_dev_list.mutex); 610 613 611 - if (ism_v2_capable) 612 - ism_del_vlan_id(ism, ISM_RESERVED_VLANID); 613 614 unregister_ieq(ism); 614 615 unregister_sba(ism); 615 616 free_irq(pci_irq_vector(pdev, 0), ism); ··· 781 786 return ism_unregister_dmb(smcd->priv, (struct ism_dmb *)dmb); 782 787 } 783 788 784 - static int smcd_add_vlan_id(struct smcd_dev *smcd, u64 vlan_id) 785 - { 786 - return ism_add_vlan_id(smcd->priv, vlan_id); 787 - } 788 - 789 - static int smcd_del_vlan_id(struct smcd_dev *smcd, u64 vlan_id) 790 - { 791 - return ism_del_vlan_id(smcd->priv, vlan_id); 792 - } 793 - 794 - static int smcd_set_vlan_required(struct smcd_dev *smcd) 795 - { 796 - return ism_cmd_simple(smcd->priv, ISM_SET_VLAN); 797 - } 798 - 799 - static int smcd_reset_vlan_required(struct smcd_dev *smcd) 800 - { 801 - return ism_cmd_simple(smcd->priv, ISM_RESET_VLAN); 802 - } 803 - 804 789 static int ism_signal_ieq(struct ism_dev *ism, u64 rgid, u32 trigger_irq, 805 790 u32 event_code, u64 info) 806 791 { ··· 812 837 return ism_move(smcd->priv, dmb_tok, idx, sf, offset, data, size); 813 838 } 814 839 815 - static int smcd_supports_v2(void) 816 - { 817 - return ism_v2_capable; 818 - } 819 - 820 840 static const struct smcd_ops ism_smcd_ops = { 821 841 .query_remote_gid = smcd_query_rgid, 822 842 .register_dmb = smcd_register_dmb, 823 843 .unregister_dmb = smcd_unregister_dmb, 824 - .add_vlan_id = smcd_add_vlan_id, 825 - .del_vlan_id = smcd_del_vlan_id, 826 - .set_vlan_required = smcd_set_vlan_required, 827 - .reset_vlan_required = smcd_reset_vlan_required, 828 844 .signal_event = smcd_signal_ieq, 829 845 .move_data = smcd_move, 830 - .supports_v2 = smcd_supports_v2, 831 846 }; 832 847 833 848 const struct smcd_ops *ism_get_smcd_ops(void)
+19
include/linux/dibs.h
··· 133 133 * Return: 2 byte dibs fabric id 134 134 */ 135 135 u16 (*get_fabric_id)(struct dibs_dev *dev); 136 + /** 137 + * add_vlan_id() - add dibs device to vlan (optional, deprecated) 138 + * @dev: dibs device 139 + * @vlan_id: vlan id 140 + * 141 + * In order to write into a vlan-tagged dmb, the remote device needs 142 + * to belong to the this vlan. A device can belong to more than 1 vlan. 143 + * Any device can access an untagged dmb. 144 + * Deprecated, only supported for backwards compatibility. 145 + * Return: zero on success 146 + */ 147 + int (*add_vlan_id)(struct dibs_dev *dev, u64 vlan_id); 148 + /** 149 + * del_vlan_id() - remove dibs device from vlan (optional, deprecated) 150 + * @dev: dibs device 151 + * @vlan_id: vlan id 152 + * Return: zero on success 153 + */ 154 + int (*del_vlan_id)(struct dibs_dev *dev, u64 vlan_id); 136 155 }; 137 156 138 157 struct dibs_dev {
-5
include/net/smc.h
··· 61 61 int (*move_data)(struct smcd_dev *dev, u64 dmb_tok, unsigned int idx, 62 62 bool sf, unsigned int offset, void *data, 63 63 unsigned int size); 64 - int (*supports_v2)(void); 65 64 66 65 /* optional operations */ 67 - int (*add_vlan_id)(struct smcd_dev *dev, u64 vlan_id); 68 - int (*del_vlan_id)(struct smcd_dev *dev, u64 vlan_id); 69 - int (*set_vlan_required)(struct smcd_dev *dev); 70 - int (*reset_vlan_required)(struct smcd_dev *dev); 71 66 int (*signal_event)(struct smcd_dev *dev, struct smcd_gid *rgid, 72 67 u32 trigger_irq, u32 event_code, u64 info); 73 68 int (*support_dmb_nocopy)(struct smcd_dev *dev);
+9 -5
net/smc/smc_ism.c
··· 140 140 141 141 if (!vlanid) /* No valid vlan id */ 142 142 return -EINVAL; 143 - if (!smcd->ops->add_vlan_id) 143 + if (!smcd->dibs->ops->add_vlan_id) 144 144 return -EOPNOTSUPP; 145 145 146 146 /* create new vlan entry, in case we need it */ ··· 163 163 /* no existing entry found. 164 164 * add new entry to device; might fail, e.g., if HW limit reached 165 165 */ 166 - if (smcd->ops->add_vlan_id(smcd, vlanid)) { 166 + if (smcd->dibs->ops->add_vlan_id(smcd->dibs, vlanid)) { 167 167 kfree(new_vlan); 168 168 rc = -EIO; 169 169 goto out; ··· 187 187 188 188 if (!vlanid) /* No valid vlan id */ 189 189 return -EINVAL; 190 - if (!smcd->ops->del_vlan_id) 190 + if (!smcd->dibs->ops->del_vlan_id) 191 191 return -EOPNOTSUPP; 192 192 193 193 spin_lock_irqsave(&smcd->lock, flags); ··· 205 205 } 206 206 207 207 /* Found and the last reference just gone */ 208 - if (smcd->ops->del_vlan_id(smcd, vlanid)) 208 + if (smcd->dibs->ops->del_vlan_id(smcd->dibs, vlanid)) 209 209 rc = -EIO; 210 210 list_del(&vlan->list); 211 211 kfree(vlan); ··· 539 539 if (smc_pnetid_by_dev_port(dibs->dev.parent, 0, smcd->pnetid)) 540 540 smc_pnetid_by_table_smcd(smcd); 541 541 542 - if (smc_ism_is_loopback(dibs) || smcd->ops->supports_v2()) 542 + if (smc_ism_is_loopback(dibs) || 543 + (dibs->ops->add_vlan_id && 544 + !dibs->ops->add_vlan_id(dibs, ISM_RESERVED_VLANID))) { 543 545 smc_ism_set_v2_capable(); 546 + } 547 + 544 548 mutex_lock(&smcd_dev_list.mutex); 545 549 /* sort list: 546 550 * - devices without pnetid before devices with pnetid;
-5
net/smc/smc_loopback.c
··· 20 20 #include "smc_ism.h" 21 21 #include "smc_loopback.h" 22 22 23 - #define SMC_LO_V2_CAPABLE 0x1 /* loopback-ism acts as ISMv2 */ 24 23 #define SMC_LO_SUPPORT_NOCOPY 0x1 25 24 #define SMC_DMA_ADDR_INVALID (~(dma_addr_t)0) 26 25 ··· 241 242 .support_dmb_nocopy = smc_lo_support_dmb_nocopy, 242 243 .attach_dmb = smc_lo_attach_dmb, 243 244 .detach_dmb = smc_lo_detach_dmb, 244 - .add_vlan_id = NULL, 245 - .del_vlan_id = NULL, 246 - .set_vlan_required = NULL, 247 - .reset_vlan_required = NULL, 248 245 .signal_event = NULL, 249 246 .move_data = smc_lo_move_data, 250 247 };