dibs - Direct Internal Buffer Sharing
Subsystems (7)
Alexandra Winter
maintainerv3 cover dibs - Direct Internal Buffer Sharing
This series introduces a generic abstraction of existing components like:
- the s390 specific ISM device (Internal Shared Memory),
- the SMC-D loopback mechanism (Shared Memory Communication - Direct)
- the client interface of the SMC-D module to the transport devices This generic shim layer can be extended with more devices, more clients and more features in the future.
This layer is called 'dibs' for Direct Internal Buffer Sharing based on the common scheme that these mechanisms enable controlled sharing of memory buffers within some containing entity such as a hypervisor or a Linux instance.
Benefits:
- Cleaner separation of ISM and SMC-D functionality
- simpler and less module dependencies
- Clear interface definition.
- Extendable for future devices and clients.
An overview was given at the Netdev 0x19 conference, recordings and slides are available [1].
Background / Status quo:
------------------------
Currently s390 hardware provides virtual PCI ISM devices (Internal Shared Memory). Their driver is in drivers/s390/net/ism_drv.c. The main user is SMC-D (net/smc). The ism driver offers a client interface so other users/protocols can also use them, but it is still heavily intermingled with the smc code. Namely, the ism module cannot be used without the smc module, which feels artificial.
There is ongoing work to extend the ISM concept of shared buffers that can be accessed directly by another instance on the same hardware: [2] proposed a loopback interface (ism_lo), that can be used on non-s390 architectures (e.g. between containers or to test SMC-D). A minimal implementation went upstream with [3]: ism_lo currently is a part of the smc protocol and rather hidden.
[4] proposed a virtio definition of ism (ism_virtio) that can be used between kvm guests.
We will shortly send an RFC for an dibs client that uses dibs as transport for TTY.
Concept:
--------
Create a shim layer in net/dibs that contains common definitions and code for all dibs devices and all dibs clients. Any device or client module only needs to depend on this dibs layer module and any device or client code only needs to include the definitions in include/linux/dibs.h.
The name dibs was chosen to clearly distinguish it from the existing s390 ism devices. And to emphasize that it is not about sharing whole memory regions with anybody, but dedicating single buffers for another system.
Implementation:
---------------
The end result of this series is: A dibs shim layer with
- One dibs client: smc-d
- Two dibs device drivers: ism and dibs-loopback
- Everything prepared to add more clients and more device drivers.
Patches 1-2 contain some issues that were found along the way. They make sense on their own, but also enable a better structured dibs series.
There are three components that exist today:
a) smc module (especially SMC-D functionality, which is an ism client today)
b) ism device driver (supports multiple ism clients today)
c) smc-loopback (integrated with smc today)
In order to preserve existing functionality at each step, these are not moved to dibs layer by component, instead:
- the dibs layer is established in parallel to existing code [patches 3-6]
- then some service functions are moved to the dibs layer [patches 7-12]
- the actual data movement is moved to the dibs layer [patch 13]
- and last event handling is moved to the dibs layer [patch 14]
Future:
-------
Items that are not part of this patchset but can be added later:
- dynamically add or remove dibs_loopback. That will be allow for simple testing of add_dev()/del_dev()
- handle_irq(): Call clients without interrupt context. e.g using threaded interrupts. I left this for a follow-on, because it includes conceptual changes for the smcd receive code.
- Any improvements of locking scopes. I mainly moved some of the the existing locks to dibs layer. I have the feeling there is room for improvements.
- The device drivers should not loop through the client array
- dibs_dev_op.*_dmb() functions reveal unnecessary details of the internal dmb struct to the clients
- Check whether client calls to dibs_dev_ops should be replaced by interface functions that provide additional value
- Check whether device driver calls to dibs_client_ops should be replaced by interface functions that provide additional value.
---
Changes in v3:
- Use kfree() instead of kvfree() for kmalloc()ed dmbs (Paolo Abeni) [13]
Changes in v2:
- More fixes of transient scope of IS_ENABLED(CONFIG_ISM) [7,13] (patchwork)
- Delete obsolete net/smc/smc_loopback.* files [13] (Dust Li)
- Fix transient usage of supports_v2() after rebase on top of 091d019adce0 ("net/smc: remove unused function smc_lo_supports_v2") [7]
- Fix CC according to get_maintainer.pl (patchwork)
- Place dibs level code in drivers/dibs/ instead of net/dibs/ (Dust Li, Julian Ruess)
- Link: https://lore.kernel.org/netdev/[email protected]/
Changes in v1:
- Don't change __init in smc_core_init() (was [1]) (Dust Li)
- Split off log message improvements from this series (was [2,5]) (Dust Li)
- Fix arch/s390/[debug_]defconfig [4,6,7,14]
- Helptext of dibs/Kconfig [3,6]
- include linux/slab.h to avoid Wimplicit-function-declaration of kzalloc() and kfree() [5,6] (Simon Horman and
'kernel test robot <[email protected]>')
- Fix transient use of undefined 'ism' pointer [7] (Simon Horman)
- Fix transient scope of IS_ENABLED(CONFIG_ISM) [7,13] (Simon Horman)
- Change position of is_attached in struct smc_buf_desc to reduce gaps [1] (Dust Li)
- Fix SW-pnetid handling for s390 ism devices [9]
- use dibs->dev instead of defining dibs_get_dev() [8]
- add const to uuid_t* parameters [12,14] (Julian Ruess)
- no log message for module load/unload [3] (Jakub Kicinski)
- Link: https://lore.kernel.org/netdev/[email protected]/
RFC:
- Link: https://lore.kernel.org/netdev/[email protected]/
Alexandra Winter (11):
net/smc: Remove error handling of unregister_dmb() net/smc: Decouple sf and attached send_buf in smc_loopback
dibs: Create drivers/dibs
dibs: Register smc as dibs_client
dibs: Register ism as dibs device
dibs: Define dibs loopback
dibs: Define dibs_client_ops and dibs_dev_ops
dibs: Local gid for dibs devices
dibs: Move vlan support to dibs_dev_ops
dibs: Move query_remote_gid() to dibs_dev_ops
dibs: Move data path to dibs layer
Julian Ruess (3):
dibs: Move struct device to dibs_dev
dibs: Create class dibs
dibs: Move event handling to dibs layer
MAINTAINERS | 9 +- arch/s390/configs/debug_defconfig | 4 +- arch/s390/configs/defconfig | 4 +- drivers/Makefile | 1 + drivers/dibs/Kconfig | 23 ++ drivers/dibs/Makefile | 8 + drivers/dibs/dibs_loopback.c | 356 +++++++++++++++++++ drivers/dibs/dibs_loopback.h | 57 +++ drivers/dibs/dibs_main.c | 278 +++++++++++++++ drivers/s390/net/Kconfig | 3 +- drivers/s390/net/ism.h | 53 ++- drivers/s390/net/ism_drv.c | 573 +++++++++++------------------- include/linux/dibs.h | 464 ++++++++++++++++++++++++ include/linux/ism.h | 28 +- include/net/smc.h | 51 +-- net/Kconfig | 1 + net/smc/Kconfig | 16 +- net/smc/Makefile | 1 - net/smc/af_smc.c | 12 +- net/smc/smc_clc.c | 6 +- net/smc/smc_core.c | 6 +- net/smc/smc_core.h | 5 + net/smc/smc_diag.c | 2 +- net/smc/smc_ism.c | 224 ++++++------ net/smc/smc_ism.h | 36 +- net/smc/smc_loopback.c | 421 ---------------------- net/smc/smc_loopback.h | 60 ---- net/smc/smc_pnet.c | 25 +- net/smc/smc_tx.c | 3 + 29 files changed, 1645 insertions(+), 1085 deletions(-) create mode 100644 drivers/dibs/Kconfig create mode 100644 drivers/dibs/Makefile create mode 100644 drivers/dibs/dibs_loopback.c create mode 100644 drivers/dibs/dibs_loopback.h create mode 100644 drivers/dibs/dibs_main.c create mode 100644 include/linux/dibs.h delete mode 100644 net/smc/smc_loopback.c delete mode 100644 net/smc/smc_loopback.h
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 1/14 net/smc: Remove error handling of unregister_dmb()
smcd_buf_free() calls smc_ism_unregister_dmb(lgr->smcd, buf_desc) and then unconditionally frees buf_desc.
Remove the cleaning up of fields of buf_desc in smc_ism_unregister_dmb(), because it is not helpful.
This removes the only usage of ISM_ERROR from the smc module. So move it to drivers/s390/net/ism.h.
--- drivers/s390/net/ism.h | 1 + include/net/smc.h | 2 -- net/smc/smc_ism.c | 14 +++++--------- net/smc/smc_ism.h | 3 ++- 4 files changed, 8 insertions(+), 12 deletions(-)
drivers/s390/net/ism.h +1 -0
@@ -10,6 +10,7 @@#include <asm/pci_insn.h> #define UTIL_STR_LEN 16 +#define ISM_ERROR 0xFFFF/* * Do not use the first word of the DMB bits to ensure 8 byte aligned access.
include/net/smc.h +0 -2
@@ -44,8 +44,6 @@ struct smcd_dmb {#define ISM_RESERVED_VLANID 0x1FFF -#define ISM_ERROR 0xFFFF -struct smcd_dev ;struct smcd_gid {
net/smc/smc_ism.c +5 -9
@@ -205,13 +205,13 @@ int smc_ism_put_vlan(struct smcd_dev *smcd, unsigned short vlanid)return rc; } -int smc_ism_unregister_dmb (struct smcd_dev *smcd,struct smc_buf_desc *dmb_desc) +void smc_ism_unregister_dmb (struct smcd_dev *smcd, +struct smc_buf_desc *dmb_desc) {struct smcd_dmb dmb; -int rc =0 ;if (!dmb_desc->dma_addr) -return rc; +return ;memset (&dmb,0 ,sizeof (dmb)); dmb.dmb_tok = dmb_desc->token;
@@ -219,13 +219,9 @@ int smc_ism_unregister_dmb(struct smcd_dev *smcd, struct smc_buf_desc *dmb_desc) dmb.cpu_addr = dmb_desc->cpu_addr; dmb.dma_addr = dmb_desc->dma_addr; dmb.dmb_len = dmb_desc->len; - rc = smcd->ops->unregister_dmb (smcd, &dmb); -if (!rc || rc ==ISM_ERROR ) { - dmb_desc->cpu_addr =NULL ; - dmb_desc->dma_addr =0 ; - } + smcd->ops->unregister_dmb (smcd, &dmb); -return rc; +return ; } int smc_ism_register_dmb(struct smc_link_group *lgr, int dmb_len,
net/smc/smc_ism.h +2 -1
@@ -47,7 +47,8 @@ int smc_ism_get_vlan(struct smcd_dev *dev, unsigned short vlan_id);int smc_ism_put_vlan (struct smcd_dev *dev,unsigned short vlan_id);int smc_ism_register_dmb (struct smc_link_group *lgr,int buf_size,struct smc_buf_desc *dmb_desc); -int smc_ism_unregister_dmb (struct smcd_dev *dev,struct smc_buf_desc *dmb_desc); +void smc_ism_unregister_dmb (struct smcd_dev *dev, +struct smc_buf_desc *dmb_desc);bool smc_ism_support_dmb_nocopy (struct smcd_dev *smcd);int smc_ism_attach_dmb (struct smcd_dev *dev,u64 token,struct smc_buf_desc *dmb_desc);
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 2/14 net/smc: Decouple sf and attached send_buf in smc_loopback
In reply to Alexandra WinterBefore this patch there was the following assumption in smc_loopback.c>smc_lo_move_data():
sf (signalling flag) == 0 : data is already in an attached target dmb sf == 1 : data is not yet in the target dmb
This is true for the 2 callers in smc clientsmcd_cdc_msg_send() : sf=1smcd_tx_rdma_writes() : sf=0
but should not be a general assumption.
Add a bool to struct smc_buf_desc to indicate whether an SMC-D sndbuf_desc is an attached buffer. Don't call move_data() for attached send_buffers, because it is not necessary.
Move the data in smc_lo_move_data() if len != 0 and signal when requested.
--- net/smc/smc_core.h | 5 +++++ net/smc/smc_ism.c | 1 + net/smc/smc_loopback.c | 9 +++------ net/smc/smc_tx.c | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-)
net/smc/smc_core.h +5 -0
@@ -13,6 +13,7 @@#define _SMC_CORE_H#include <linux/atomic.h> +#include <linux/types.h> #include <linux/smc.h> #include <linux/pci.h> #include <rdma/ib_verbs.h>
@@ -221,6 +222,10 @@ struct smc_buf_desc {/* virtually contiguous */ };struct {/* SMC-D */ +/* SMC-D tx buffer */ +bool is_attached; +/* no need for explicit writes */ +/* SMC-D rx buffer: */ unsigned short sba_idx;/* SBA index number */ u64 token;
net/smc/smc_ism.c +1 -0
@@ -274,6 +274,7 @@ int smc_ism_attach_dmb(struct smcd_dev *dev, u64 token, dmb_desc->cpu_addr = dmb.cpu_addr; dmb_desc->dma_addr = dmb.dma_addr; dmb_desc->len = dmb.dmb_len; + dmb_desc->is_attached = true; }return rc; }
net/smc/smc_loopback.c +3 -6
@@ -224,12 +224,6 @@ static int smc_lo_move_data(struct smcd_dev *smcd, u64 dmb_tok,struct smc_lo_dev *ldev = smcd->priv;struct smc_connection *conn; -if (!sf) -/* since sndbuf is merged with peer DMB, there is -* no need to copy data from sndbuf to peer DMB. -*/ -return 0 ; -read_lock_bh (&ldev->dmb_ht_lock);hash_for_each_possible (ldev->dmb_ht, tmp_node, list, dmb_tok) {if (tmp_node->token == dmb_tok) {
@@ -244,6 +238,9 @@ static int smc_lo_move_data(struct smcd_dev *smcd, u64 dmb_tok,memcpy ((char *)rmb_node->cpu_addr + offset, data, size);read_unlock_bh (&ldev->dmb_ht_lock); +if (!sf) +return 0 ; + conn = smcd->conn[rmb_node->sba_idx];if (!conn || conn->killed)return -EPIPE ;
net/smc/smc_tx.c +3 -0
@@ -426,6 +426,9 @@ static int smcd_tx_rdma_writes(struct smc_connection *conn, size_t len,int srcchunk, dstchunk;int rc; +if (conn->sndbuf_desc->is_attached) +return 0 ; +for (dstchunk =0 ; dstchunk <2 ; dstchunk++) {for (srcchunk =0 ; srcchunk <2 ; srcchunk++) {void *data = conn->sndbuf_desc->cpu_addr + src_off;
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 3/14 dibs: Create drivers/dibs
In reply to Alexandra WinterCreate the file structure for a 'DIBS - Direct Internal Buffer Sharing' shim layer that will provide generic functionality and declarations for dibs device drivers and dibs clients.
Following patches will add functionality.
--- MAINTAINERS | 7 +++++++ drivers/Makefile | 1 + drivers/dibs/Kconfig | 12 ++++++++++++ drivers/dibs/Makefile | 7 +++++++ drivers/dibs/dibs_main.c | 37 +++++++++++++++++++++++++++++++++++ include/linux/dibs.h | 42 ++++++++++++++++++++++++++++++++++++++++ net/Kconfig | 1 + 7 files changed, 107 insertions(+) create mode 100644 drivers/dibs/Kconfig create mode 100644 drivers/dibs/Makefile create mode 100644 drivers/dibs/dibs_main.c create mode 100644 include/linux/dibs.h
MAINTAINERS +7 -0
@@ -7132,6 +7132,13 @@ L: [email protected] S: Maintained F: drivers/gpio/gpio-gpio-mm.c +DIBS (DIRECT INTERNAL BUFFER SHARING) +M: Alexandra Winter <[email protected]> +L: [email protected] +S: Supported +F: drivers/dibs/ +F: include/linux/dibs.h + DIGITEQ AUTOMOTIVE MGB4 V4L2 DRIVER M: Martin Tuma <[email protected]> L: [email protected]
drivers/Makefile +1 -0
@@ -195,4 +195,5 @@ obj-$(CONFIG_DRM_ACCEL) += accel/ obj-$(CONFIG_CDX_BUS) += cdx/ obj-$(CONFIG_DPLL) += dpll/ +obj-$(CONFIG_DIBS) += dibs/ obj-$(CONFIG_S390) += s390/
drivers/dibs/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0 +config DIBS + tristate "DIBS support" + default n + help + Direct Internal Buffer Sharing (DIBS) + A communication method that uses common physical (internal) memory + for synchronous direct access into a remote buffer. + + Select this option to provide the abstraction layer between + dibs devices and dibs clients like the SMC protocol. + The module name is dibs.
drivers/dibs/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# DIBS class module +# + +dibs-y += dibs_main.o +obj-$(CONFIG_DIBS) += dibs.o
drivers/dibs/dibs_main.c new file +37 -0
@@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* DIBS - Direct Internal Buffer Sharing +* +* Implementation of the DIBS class module +* +* Copyright IBM Corp. 2025 +*/ +#define KMSG_COMPONENT "dibs" +#define pr_fmt (fmt) KMSG_COMPONENT ": " fmt + +#include <linux/module.h> +#include <linux/types.h> +#include <linux/err.h> +#include <linux/dibs.h> + +MODULE_DESCRIPTION ("Direct Internal Buffer Sharing class" ); +MODULE_LICENSE ("GPL" ); + +/* use an array rather a list for fast mapping: */ +static struct dibs_client *clients[MAX_DIBS_CLIENTS ]; +static u8 max_client; + +static int __init dibs_init (void ) +{ +memset (clients,0 ,sizeof (clients)); + max_client =0 ; + +return 0 ; +} + +static void __exit dibs_exit(void) +{ +} + +module_init (dibs_init); +module_exit (dibs_exit);
include/linux/dibs.h new file +42 -0
42 lines not on this page · raw message
net/Kconfig +1 -0
@@ -87,6 +87,7 @@ source "net/tls/Kconfig" source "net/xfrm/Kconfig" source "net/iucv/Kconfig" source "net/smc/Kconfig" +source "drivers/dibs/Kconfig" source "net/xdp/Kconfig" config NET_HANDSHAKE
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 4/14 dibs: Register smc as dibs_client
In reply to Alexandra WinterFormally register smc as dibs client. Functionality will be moved by follow-on patches from ism_client to dibs_client until eventually ism_client can be removed.
As DIBS is only a shim layer without any dependencies, we can depend SMC on DIBS without adding indirect dependencies. A follow-on patch will remove dependency of SMC on ISM.
--- arch/s390/configs/debug_defconfig | 1 + arch/s390/configs/defconfig | 1 + drivers/dibs/dibs_main.c | 35 +++++++++++++++++++++++++++++++ include/linux/dibs.h | 23 ++++++++++++++++++++ net/smc/Kconfig | 2 +- net/smc/smc_ism.c | 6 ++++++ 6 files changed, 67 insertions(+), 1 deletion(-)
arch/s390/configs/debug_defconfig +1 -0
@@ -120,6 +120,7 @@ CONFIG_UNIX=y CONFIG_UNIX_DIAG=m CONFIG_XFRM_USER=m CONFIG_NET_KEY=m +CONFIG_DIBS=y CONFIG_SMC_DIAG=m CONFIG_SMC_LO=y CONFIG_INET=y
arch/s390/configs/defconfig +1 -0
@@ -111,6 +111,7 @@ CONFIG_UNIX=y CONFIG_UNIX_DIAG=m CONFIG_XFRM_USER=m CONFIG_NET_KEY=m +CONFIG_DIBS=y CONFIG_SMC_DIAG=m CONFIG_SMC_LO=y CONFIG_INET=y
drivers/dibs/dibs_main.c +35 -0
@@ -20,6 +20,41 @@ MODULE_LICENSE("GPL");/* use an array rather a list for fast mapping: */ static struct dibs_client *clients[MAX_DIBS_CLIENTS ];static u8 max_client; +static DEFINE_MUTEX (clients_lock); + +int dibs_register_client (struct dibs_client *client) +{ +int i, rc = -ENOSPC ; + +mutex_lock (&clients_lock); +for (i =0 ; i <MAX_DIBS_CLIENTS ; ++i) { +if (!clients[i]) { + clients[i] = client; + client->id = i; +if (i == max_client) + max_client++; + rc =0 ; +break ; + } + } +mutex_unlock (&clients_lock); + +return rc; +} +EXPORT_SYMBOL_GPL (dibs_register_client); + +int dibs_unregister_client (struct dibs_client *client) +{ +int rc =0 ; + +mutex_lock (&clients_lock); + clients[client->id] =NULL ; +if (client->id +1 == max_client) + max_client--; +mutex_unlock (&clients_lock); +return rc; +} +EXPORT_SYMBOL_GPL (dibs_unregister_client);static int __init dibs_init (void ) {
include/linux/dibs.h +23 -0
@@ -33,10 +33,33 @@* clients. */ +/* DIBS client +* ----------- +*/ #define MAX_DIBS_CLIENTS 8struct dibs_client { +/* client name for logging and debugging purposes */ const char *name; +/* client index - provided and used by dibs layer */ +u8 id; }; +/* Functions to be called by dibs clients: +*/ +/** +* dibs_register_client() - register a client with dibs layer +* @client: this client +* +* Return: zero on success. +*/ +int dibs_register_client (struct dibs_client *client); +/** +* dibs_unregister_client() - unregister a client with dibs layer +* @client: this client +* +* Return: zero on success. +*/ +int dibs_unregister_client (struct dibs_client *client); +#endif /* _DIBS_H */
net/smc/Kconfig +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config SMC tristate "SMC socket protocol family" - depends on INET && INFINIBAND + depends on INET && INFINIBAND && DIBS depends on m || ISM != m help SMC-R provides a "sockets over RDMA" solution making use of
net/smc/smc_ism.c +6 -0
@@ -18,6 +18,7 @@#include "smc_pnet.h" #include "smc_netlink.h" #include "linux/ism.h" +#include "linux/dibs.h" struct smcd_dev_list smcd_dev_list = { .list =LIST_HEAD_INIT (smcd_dev_list.list),
@@ -42,6 +43,9 @@ static struct ism_client smc_ism_client = { .handle_irq = smcd_handle_irq, };#endif +static struct dibs_client smc_dibs_client = { + .name ="SMC-D" , +};static void smc_ism_create_system_eid (void ) {
@@ -623,11 +627,13 @@ int smc_ism_init(void)#if IS_ENABLED (CONFIG_ISM ) rc =ism_register_client (&smc_ism_client);#endif + rc =dibs_register_client (&smc_dibs_client);return rc; }void smc_ism_exit (void ) { +dibs_unregister_client (&smc_dibs_client);#if IS_ENABLED (CONFIG_ISM )ism_unregister_client (&smc_ism_client);#endif
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 5/14 dibs: Register ism as dibs device
In reply to Alexandra WinterRegister ism devices with the dibs layer. Follow-on patches will move functionality to the dibs layer.
As DIBS is only a shim layer without any dependencies, we can depend ISM on DIBS without adding indirect dependencies. A follow-on patch will remove implication of SMC by ISM.
Define struct dibs_dev. Follow-on patches will move more content into dibs_dev. The goal of follow-on patches is that ism_dev will only contain fields that are special for this device driver. The same concept will apply to other dibs device drivers.
Define dibs_dev_alloc(), dibs_dev_add() and dibs_dev_del() to be called by dibs device drivers and call them from ism_drv.c
Use ism_dev.dibs for a pointer to dibs_dev.
--- drivers/dibs/dibs_main.c | 38 +++++++++++++++++ drivers/s390/net/Kconfig | 2 +- drivers/s390/net/ism.h | 1 + drivers/s390/net/ism_drv.c | 83 ++++++++++++++++++++++++-------------- include/linux/dibs.h | 38 +++++++++++++++++ include/linux/ism.h | 1 + 6 files changed, 131 insertions(+), 32 deletions(-)
drivers/dibs/dibs_main.c +38 -0
@@ -11,6 +11,7 @@#include <linux/module.h> #include <linux/types.h> +#include <linux/slab.h> #include <linux/err.h> #include <linux/dibs.h>
@@ -21,6 +22,15 @@ MODULE_LICENSE("GPL");static struct dibs_client *clients[MAX_DIBS_CLIENTS ];static u8 max_client;static DEFINE_MUTEX (clients_lock); +struct dibs_dev_list { +struct list_head list; +struct mutex mutex;/* protects dibs device list */ +}; + +static struct dibs_dev_list dibs_dev_list = { + .list =LIST_HEAD_INIT (dibs_dev_list.list), + .mutex =__MUTEX_INITIALIZER (dibs_dev_list.mutex), +};int dibs_register_client (struct dibs_client *client) {
@@ -56,6 +66,34 @@ int dibs_unregister_client(struct dibs_client *client) }EXPORT_SYMBOL_GPL (dibs_unregister_client); +struct dibs_dev *dibs_dev_alloc (void ) +{ +struct dibs_dev *dibs; + + dibs =kzalloc (sizeof (*dibs),GFP_KERNEL ); + +return dibs; +} +EXPORT_SYMBOL_GPL (dibs_dev_alloc); + +int dibs_dev_add (struct dibs_dev *dibs) +{ +mutex_lock (&dibs_dev_list.mutex); +list_add (&dibs->list, &dibs_dev_list.list); +mutex_unlock (&dibs_dev_list.mutex); + +return 0 ; +} +EXPORT_SYMBOL_GPL (dibs_dev_add); + +void dibs_dev_del (struct dibs_dev *dibs) +{ +mutex_lock (&dibs_dev_list.mutex); +list_del_init (&dibs->list); +mutex_unlock (&dibs_dev_list.mutex); +} +EXPORT_SYMBOL_GPL (dibs_dev_del); +static int __init dibs_init (void ) {memset (clients,0 ,sizeof (clients));
drivers/s390/net/Kconfig +1 -1
@@ -81,7 +81,7 @@ config CCWGROUP config ISM tristate "Support for ISM vPCI Adapter" - depends on PCI + depends on PCI && DIBS imply SMC default n help
drivers/s390/net/ism.h +1 -0
@@ -5,6 +5,7 @@#include <linux/spinlock.h> #include <linux/types.h> #include <linux/pci.h> +#include <linux/dibs.h> #include <linux/ism.h> #include <net/smc.h> #include <asm/pci_insn.h>
drivers/s390/net/ism_drv.c +52 -31
113 lines not on this page · raw message
include/linux/dibs.h +38 -0
@@ -9,6 +9,7 @@#ifndef _DIBS_H#define _DIBS_H +#include <linux/device.h> /* DIBS - Direct Internal Buffer Sharing - concept * ----------------------------------------------- * In the case of multiple system sharing the same hardware, dibs fabrics can
@@ -62,4 +63,41 @@ int dibs_register_client(struct dibs_client *client);*/ int dibs_unregister_client (struct dibs_client *client); +/* DIBS devices +* ------------ +*/ +struct dibs_dev { +struct list_head list; +}; + +/* ------- End of client-only functions ----------- */ + +/* +* Functions to be called by dibs device drivers: +*/ +/** +* dibs_dev_alloc() - allocate and reference device structure +* +* The following fields will be valid upon successful return: dev +* NOTE: Use put_device(dibs_get_dev(@dibs)) to give up your reference instead +* of freeing @dibs @dev directly once you have successfully called this +* function. +* Return: Pointer to dibs device structure +*/ +struct dibs_dev *dibs_dev_alloc (void ); +/** +* dibs_dev_add() - register with dibs layer and all clients +* @dibs: dibs device +* +* The following fields must be valid upon entry: dev, ops, drv_priv +* All fields will be valid upon successful return. +* Return: zero on success +*/ +int dibs_dev_add (struct dibs_dev *dibs); +/** +* dibs_dev_del() - unregister from dibs layer and all clients +* @dibs: dibs device +*/ +void dibs_dev_del (struct dibs_dev *dibs); +#endif /* _DIBS_H */
include/linux/ism.h +1 -0
@@ -30,6 +30,7 @@ struct ism_dev {spinlock_t lock;/* protects the ism device */ spinlock_t cmd_lock;/* serializes cmds */ struct list_head list; +struct dibs_dev *dibs;struct pci_dev *pdev;struct ism_sba *sba;
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 6/14 dibs: Define dibs loopback
In reply to Alexandra WinterThe first stage of loopback-ism was implemented as part of the SMC module [1]. Now that we have the dibs layer, provide access to a dibs_loopback device to all dibs clients.
This is the first step of moving loopback-ism from net/smc/smc_loopback.* to drivers/dibs/dibs_loopback.*. One global structure lo_dev is allocated and added to the dibs devices. Follow-on patches will move functionality.
Same as smc_loopback, dibs_loopback is provided by a config option. Note that there is no way to dynamically add or remove the loopback device. That could be a future improvement.
When moving code to drivers/dibs, replace ism_ prefix with dibs_ prefix. As this is mostly a move of existing code, copyright and authors are unchanged.
--- arch/s390/configs/debug_defconfig | 1 + arch/s390/configs/defconfig | 1 + drivers/dibs/Kconfig | 11 +++++ drivers/dibs/Makefile | 1 + drivers/dibs/dibs_loopback.c | 78 +++++++++++++++++++++++++++++++ drivers/dibs/dibs_loopback.h | 38 +++++++++++++++ drivers/dibs/dibs_main.c | 11 ++++- 7 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 drivers/dibs/dibs_loopback.c create mode 100644 drivers/dibs/dibs_loopback.h
arch/s390/configs/debug_defconfig +1 -0
@@ -121,6 +121,7 @@ CONFIG_UNIX_DIAG=m CONFIG_XFRM_USER=m CONFIG_NET_KEY=m CONFIG_DIBS=y +CONFIG_DIBS_LO=y CONFIG_SMC_DIAG=m CONFIG_SMC_LO=y CONFIG_INET=y
arch/s390/configs/defconfig +1 -0
@@ -112,6 +112,7 @@ CONFIG_UNIX_DIAG=m CONFIG_XFRM_USER=m CONFIG_NET_KEY=m CONFIG_DIBS=y +CONFIG_DIBS_LO=y CONFIG_SMC_DIAG=m CONFIG_SMC_LO=y CONFIG_INET=y
drivers/dibs/Kconfig +11 -0
@@ -10,3 +10,14 @@ config DIBS Select this option to provide the abstraction layer between dibs devices and dibs clients like the SMC protocol. The module name is dibs. + +config DIBS_LO + bool "intra-OS shortcut with dibs loopback" + depends on DIBS + default n + help + DIBS_LO enables the creation of an software-emulated dibs device + named lo which can be used for transferring data when communication + occurs within the same OS. This helps in convenient testing of + dibs clients, since dibs loopback is independent of architecture or + hardware.
drivers/dibs/Makefile +1 -0
@@ -5,3 +5,4 @@ dibs-y += dibs_main.o obj-$(CONFIG_DIBS) += dibs.o +dibs-$(CONFIG_DIBS_LO) += dibs_loopback.o
drivers/dibs/dibs_loopback.c new file +78 -0
78 lines not on this page · raw message
drivers/dibs/dibs_loopback.h new file +38 -0
@@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* dibs loopback (aka loopback-ism) device structure definitions. +* +* Copyright (c) 2024, Alibaba Inc. +* +* Author: Wen Gu <[email protected]> +* Tony Lu <[email protected]> +* +*/ + +#ifndef _DIBS_LOOPBACK_H +#define _DIBS_LOOPBACK_H + +#include <linux/dibs.h> +#include <linux/types.h> +#include <linux/wait.h> + +#if IS_ENABLED (CONFIG_DIBS_LO ) + +struct dibs_lo_dev { +struct dibs_dev *dibs; +}; + +int dibs_loopback_init (void ); +void dibs_loopback_exit (void ); +#else +static inline int dibs_loopback_init (void ) +{ +return 0 ; +} + +static inline void dibs_loopback_exit (void ) +{ +} +#endif + +#endif /* _DIBS_LOOPBACK_H */
drivers/dibs/dibs_main.c +10 -1
@@ -15,6 +15,8 @@#include <linux/err.h> #include <linux/dibs.h> +#include "dibs_loopback.h" +MODULE_DESCRIPTION ("Direct Internal Buffer Sharing class" );MODULE_LICENSE ("GPL" );
@@ -96,14 +98,21 @@ EXPORT_SYMBOL_GPL(dibs_dev_del);static int __init dibs_init (void ) { +int rc; +memset (clients,0 ,sizeof (clients)); max_client =0 ; -return 0 ; + rc =dibs_loopback_init (); +if (rc) +pr_err ("%s fails with %d\n" , __func__, rc); + +return rc; } static void __exit dibs_exit(void) { +dibs_loopback_exit (); }module_init (dibs_init);
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 7/14 dibs: Define dibs_client_ops and dibs_dev_ops
In reply to Alexandra WinterMove the device add() and remove() functions from ism_client to dibs_client_ops and call add_dev()/del_dev() for ism devices and dibs_loopback devices. dibs_client_ops->add_dev() = smcd_register_dev() for the smc_dibs_client. This is the first step to handle ism and loopback devices alike (as dibs devices) in the smc dibs client.
Define dibs_dev->ops and move smcd_ops->get_chid to dibs_dev_ops->get_fabric_id() for ism and loopback devices. See below for why this needs to be in the same patch as dibs_client_ops->add_dev().
The following changes contain intermediate steps, that will be obsoleted by follow-on patches, once more functionality has been moved to dibs:
Use different smcd_ops and max_dmbs for ism and loopback. Follow-on patches will change SMC-D to directly use dibs_ops instead of smcd_ops.
In smcd_register_dev() it is now necessary to identify a dibs_loopback device before smcd_dev and smcd_ops->get_chid() are available. So provide dibs_dev_ops->get_fabric_id() in this patch and evaluate it in smc_ism_is_loopback().
Call smc_loopback_init() in smcd_register_dev() and call smc_loopback_exit() in smcd_unregister_dev() to handle the functionality that is still in smc_loopback. Follow-on patches will move all smc_loopback code to dibs_loopback.
In smcd_[un]register_dev() use only ism device name, this will be replaced by dibs device name by a follow-on patch.
End of changes with intermediate parts.
Allocate an smcd event workqueue for all dibs devices, although dibs_loopback does not generate events.
Use kernel memory instead of devres memory for smcd_dev and smcd->conn. Since commit a72178cfe855 ("net/smc: Fix dependency of SMC on ISM") an ism device and its driver can have a longer lifetime than the smc module, so smc should not rely on devres to free its resources [1]. It is now the responsibility of the smc client to free smcd and smcd->conn for all dibs devices, ism devices as well as loopback. Call client->ops->del_dev() for all existing dibs devices in dibs_unregister_client(), so all device related structures can be freed in the client.
When dibs_unregister_client() is called in the context of smc_exit() or smc_core_reboot_event(), these functions have already called smc_lgrs_shutdown() which calls smc_smcd_terminate_all(smcd) and sets going_away. This is done a second time in smcd_unregister_dev(). This is analogous to how smcr is handled in these functions, by calling first smc_lgrs_shutdown() and then smc_ib_unregister_client() > smc_ib_remove_dev(), so leave it that way. It may be worth investigating, whether smc_lgrs_shutdown() is still required or useful.
Remove CONFIG_SMC_LO. CONFIG_DIBS_LO now controls whether a dibs loopback device exists or not.
--- arch/s390/configs/debug_defconfig | 1 - arch/s390/configs/defconfig | 1 - drivers/dibs/dibs_loopback.c | 11 +++ drivers/dibs/dibs_main.c | 36 ++++++++ drivers/s390/net/ism_drv.c | 43 +++++----- include/linux/dibs.h | 89 +++++++++++++++++++- include/linux/ism.h | 2 - include/net/smc.h | 3 +- net/smc/Kconfig | 13 --- net/smc/Makefile | 2 +- net/smc/af_smc.c | 12 +-- net/smc/smc_ism.c | 132 +++++++++++++++++++++--------- net/smc/smc_ism.h | 7 +- net/smc/smc_loopback.c | 94 ++++----------------- net/smc/smc_loopback.h | 17 +--- 15 files changed, 270 insertions(+), 193 deletions(-)
arch/s390/configs/debug_defconfig +0 -1
@@ -123,7 +123,6 @@ CONFIG_NET_KEY=m CONFIG_DIBS=y CONFIG_DIBS_LO=y CONFIG_SMC_DIAG=m -CONFIG_SMC_LO=y CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y
arch/s390/configs/defconfig +0 -1
@@ -114,7 +114,6 @@ CONFIG_NET_KEY=m CONFIG_DIBS=y CONFIG_DIBS_LO=y CONFIG_SMC_DIAG=m -CONFIG_SMC_LO=y CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_IP_ADVANCED_ROUTER=y
drivers/dibs/dibs_loopback.c +11 -0
@@ -18,6 +18,15 @@/* global loopback device */ static struct dibs_lo_dev *lo_dev; +static u16 dibs_lo_get_fabric_id (struct dibs_dev *dibs) +{ +return DIBS_LOOPBACK_FABRIC ; +} + +static const struct dibs_dev_ops dibs_lo_ops = { + .get_fabric_id = dibs_lo_get_fabric_id, +}; +static void dibs_lo_dev_exit (struct dibs_lo_dev *ldev) {dibs_dev_del (ldev->dibs);
@@ -40,6 +49,8 @@ static int dibs_lo_dev_probe(void) } ldev->dibs = dibs; + dibs->drv_priv = ldev; + dibs->ops = &dibs_lo_ops; ret =dibs_dev_add (dibs);if (ret)
drivers/dibs/dibs_main.c +36 -0
@@ -36,8 +36,10 @@ static struct dibs_dev_list dibs_dev_list = {int dibs_register_client (struct dibs_client *client) { +struct dibs_dev *dibs;int i, rc = -ENOSPC ; +mutex_lock (&dibs_dev_list.mutex);mutex_lock (&clients_lock);for (i =0 ; i <MAX_DIBS_CLIENTS ; ++i) {if (!clients[i]) {
@@ -51,19 +53,37 @@ int dibs_register_client(struct dibs_client *client) }mutex_unlock (&clients_lock); +if (i <MAX_DIBS_CLIENTS ) { +/* initialize with all devices that we got so far */ +list_for_each_entry (dibs, &dibs_dev_list.list, list) { + dibs->priv[i] =NULL ; + client->ops->add_dev (dibs); + } + } +mutex_unlock (&dibs_dev_list.mutex); +return rc; }EXPORT_SYMBOL_GPL (dibs_register_client);int dibs_unregister_client (struct dibs_client *client) { +struct dibs_dev *dibs;int rc =0 ; +mutex_lock (&dibs_dev_list.mutex); +list_for_each_entry (dibs, &dibs_dev_list.list, list) { + clients[client->id]->ops->del_dev (dibs); + dibs->priv[client->id] =NULL ; + } +mutex_lock (&clients_lock); clients[client->id] =NULL ;if (client->id +1 == max_client) max_client--;mutex_unlock (&clients_lock); + +mutex_unlock (&dibs_dev_list.mutex);return rc; }EXPORT_SYMBOL_GPL (dibs_unregister_client);
@@ -80,7 +100,15 @@ EXPORT_SYMBOL_GPL(dibs_dev_alloc);int dibs_dev_add (struct dibs_dev *dibs) { +int i; +mutex_lock (&dibs_dev_list.mutex); +mutex_lock (&clients_lock); +for (i =0 ; i < max_client; ++i) { +if (clients[i]) + clients[i]->ops->add_dev (dibs); + } +mutex_unlock (&clients_lock);list_add (&dibs->list, &dibs_dev_list.list);mutex_unlock (&dibs_dev_list.mutex);
@@ -90,7 +118,15 @@ EXPORT_SYMBOL_GPL(dibs_dev_add);void dibs_dev_del (struct dibs_dev *dibs) { +int i; +mutex_lock (&dibs_dev_list.mutex); +mutex_lock (&clients_lock); +for (i =0 ; i < max_client; ++i) { +if (clients[i]) + clients[i]->ops->del_dev (dibs); + } +mutex_unlock (&clients_lock);list_del_init (&dibs->list);mutex_unlock (&dibs_dev_list.mutex); }
drivers/s390/net/ism_drv.c +19 -24
103 lines not on this page · raw message
include/linux/dibs.h +87 -2
128 lines not on this page · raw message
include/linux/ism.h +0 -2
@@ -59,8 +59,6 @@ struct ism_event {struct ism_client {const char *name; -void (*add)(struct ism_dev *dev); -void (*remove)(struct ism_dev *dev);void (*handle_event)(struct ism_dev *dev,struct ism_event *event);/* Parameter dmbemask contains a bit vector with updated DMBEs, if sent * via ism_move_data(). Callback function must handle all active bits
include/net/smc.h +2 -1
@@ -15,6 +15,7 @@#include <linux/spinlock.h> #include <linux/types.h> #include <linux/wait.h> +#include <linux/dibs.h> #include "linux/ism.h" struct sock ;
@@ -62,7 +63,6 @@ struct smcd_ops { unsigned int size);int (*supports_v2)(void );void (*get_local_gid)(struct smcd_dev *dev,struct smcd_gid *gid); -u16 (*get_chid)(struct smcd_dev *dev);struct device * (*get_dev)(struct smcd_dev *dev);/* optional operations */
@@ -81,6 +81,7 @@ struct smcd_dev {const struct smcd_ops *ops;void *priv;void *client; +struct dibs_dev *dibs;struct list_head list;spinlock_t lock;struct smc_connection **conn;
net/smc/Kconfig +0 -13
@@ -20,16 +20,3 @@ config SMC_DIAG smcss. if unsure, say Y. - -config SMC_LO - bool "SMC intra-OS shortcut with loopback-ism" - depends on SMC - default n - help - SMC_LO enables the creation of an Emulated-ISM device named - loopback-ism in SMC and makes use of it for transferring data - when communication occurs within the same OS. This helps in - convenient testing of SMC-D since loopback-ism is independent - of architecture or hardware. - - if unsure, say N.
net/smc/Makefile +1 -1
@@ -6,4 +6,4 @@ smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o smc-y += smc_cdc.o smc_tx.o smc_rx.o smc_close.o smc_ism.o smc_netlink.o smc_stats.o smc-y += smc_tracepoint.o smc_inet.o smc-$(CONFIG_SYSCTL) += smc_sysctl.o -smc-$(CONFIG_SMC_LO) += smc_loopback.o +smc-y += smc_loopback.o
net/smc/af_smc.c +1 -11
@@ -57,7 +57,6 @@#include "smc_stats.h" #include "smc_tracepoint.h" #include "smc_sysctl.h" -#include "smc_loopback.h" #include "smc_inet.h" static DEFINE_MUTEX (smc_server_lgr_pending);/* serialize link group
@@ -3591,16 +3590,10 @@ static int __init smc_init(void) goto out_sock; } - rc =smc_loopback_init (); -if (rc) { -pr_err ("%s: smc_loopback_init fails with %d\n" , __func__, rc); - goto out_ib; - } - rc =tcp_register_ulp (&smc_ulp_ops);if (rc) {pr_err ("%s: tcp_ulp_register fails with %d\n" , __func__, rc); - goto out_lo; + goto out_ib; } rc =smc_inet_init ();if (rc) {
@@ -3611,8 +3604,6 @@ static int __init smc_init(void)return 0 ; out_ulp:tcp_unregister_ulp (&smc_ulp_ops); -out_lo: -smc_loopback_exit (); out_ib:smc_ib_unregister_client (); out_sock:
@@ -3651,7 +3642,6 @@ static void __exit smc_exit(void)tcp_unregister_ulp (&smc_ulp_ops);sock_unregister (PF_SMC );smc_core_exit (); -smc_loopback_exit ();smc_ib_unregister_client ();smc_ism_exit ();destroy_workqueue (smc_close_wq);
net/smc/smc_ism.c +92 -40
232 lines not on this page · raw message
net/smc/smc_ism.h +4 -3
@@ -12,6 +12,7 @@#include <linux/uio.h> #include <linux/types.h> #include <linux/mutex.h> +#include <linux/dibs.h> #include "smc.h"
@@ -85,14 +86,14 @@ static inline bool __smc_ism_is_emulated(u16 chid)static inline bool smc_ism_is_emulated (struct smcd_dev *smcd) { -u16 chid = smcd->ops->get_chid (smcd); +u16 chid = smcd->dibs->ops->get_fabric_id (smcd->dibs);return __smc_ism_is_emulated (chid); } -static inline bool smc_ism_is_loopback (struct smcd_dev *smcd) +static inline bool smc_ism_is_loopback (struct dibs_dev *dibs) { -return (smcd->ops->get_chid (smcd) ==0xFFFF ); +return (dibs->ops->get_fabric_id (dibs) ==DIBS_LOOPBACK_FABRIC ); }#endif
net/smc/smc_loopback.c +14 -80
152 lines not on this page · raw message
net/smc/smc_loopback.h +3 -14
@@ -17,10 +17,8 @@#include <linux/device.h> #include <net/smc.h> -#if IS_ENABLED(CONFIG_SMC_LO)#define SMC_LO_MAX_DMBS 5000#define SMC_LO_DMBS_HASH_BITS 12 -#define SMC_LO_RESERVED_CHID 0xFFFFstruct smc_lo_dmb_node {struct hlist_node list;
@@ -35,7 +33,6 @@ struct smc_lo_dmb_node {struct smc_lo_dev {struct smcd_dev *smcd;struct device dev; -u16 chid;struct smcd_gid local_gid;atomic_t dmb_cnt;rwlock_t dmb_ht_lock;
@@ -44,17 +41,9 @@ struct smc_lo_dev { wait_queue_head_t ldev_release; }; -int smc_loopback_init (void ); +const struct smcd_ops *smc_lo_get_smcd_ops (void ); + +int smc_loopback_init (struct smc_lo_dev **smc_lb);void smc_loopback_exit (void ); -#else -static inline int smc_loopback_init (void ) -{ -return 0 ; -} - -static inline void smc_loopback_exit (void ) -{ -} -#endif #endif /* _SMC_LOOPBACK_H */
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 8/14 dibs: Move struct device to dibs_dev
In reply to Alexandra WinterFrom: Julian Ruess <[email protected]>
Move struct device from ism_dev and smc_lo_dev to dibs_dev, and define a corresponding release function. Free ism_dev in ism_remove() and smc_lo_dev in smc_lo_dev_remove().
Replace smcd->ops->get_dev(smcd) by using dibs->dev directly.
An alternative design would be to embed dibs_dev as a field in ism_dev and do the same for other dibs device driver specific structs. However that would have the disadvantage that each dibs device driver needs to allocate dibs_dev and each dibs device driver needs a different device release function. The advantage would be that ism_dev and other device driver specific structs would be covered by device reference counts.
--- drivers/dibs/dibs_loopback.c | 15 ++++++------ drivers/dibs/dibs_main.c | 21 +++++++++++++++- drivers/s390/net/ism_drv.c | 40 +++++++------------------------ include/linux/dibs.h | 1 + include/linux/ism.h | 1 - include/net/smc.h | 1 - net/smc/smc_core.c | 4 ++-- net/smc/smc_ism.c | 46 +++++++++++++++--------------------- net/smc/smc_loopback.c | 21 +--------------- net/smc/smc_loopback.h | 1 - net/smc/smc_pnet.c | 13 ++++------ 11 files changed, 63 insertions(+), 101 deletions(-)
drivers/dibs/dibs_loopback.c +7 -8
@@ -15,6 +15,7 @@#include "dibs_loopback.h" +static const char dibs_lo_dev_name[] ="lo" ;/* global loopback device */ static struct dibs_lo_dev *lo_dev;
@@ -27,11 +28,6 @@ static const struct dibs_dev_ops dibs_lo_ops = { .get_fabric_id = dibs_lo_get_fabric_id, }; -static void dibs_lo_dev_exit (struct dibs_lo_dev *ldev) -{ -dibs_dev_del (ldev->dibs); -} -static int dibs_lo_dev_probe (void ) {struct dibs_lo_dev *ldev;
@@ -52,6 +48,9 @@ static int dibs_lo_dev_probe(void) dibs->drv_priv = ldev; dibs->ops = &dibs_lo_ops; + dibs->dev.parent =NULL ; +dev_set_name (&dibs->dev,"%s" , dibs_lo_dev_name); + ret =dibs_dev_add (dibs);if (ret) goto err_reg;
@@ -60,7 +59,7 @@ static int dibs_lo_dev_probe(void) err_reg:/* pairs with dibs_dev_alloc() */ -kfree (dibs); +put_device (&dibs->dev);kfree (ldev);return ret;
@@ -71,9 +70,9 @@ static void dibs_lo_dev_remove(void)if (!lo_dev)return ; -dibs_lo_dev_exit (lo_dev); +dibs_dev_del (lo_dev->dibs);/* pairs with dibs_dev_alloc() */ -kfree (lo_dev->dibs); +put_device (&lo_dev->dibs->dev);kfree (lo_dev); lo_dev =NULL ; }
drivers/dibs/dibs_main.c +20 -1
@@ -88,11 +88,24 @@ int dibs_unregister_client(struct dibs_client *client) }EXPORT_SYMBOL_GPL (dibs_unregister_client); +static void dibs_dev_release (struct device *dev) +{ +struct dibs_dev *dibs; + + dibs = container_of(dev, struct dibs_dev, dev); + +kfree (dibs); +} +struct dibs_dev *dibs_dev_alloc (void ) {struct dibs_dev *dibs; dibs =kzalloc (sizeof (*dibs),GFP_KERNEL ); +if (!dibs) +return dibs; + dibs->dev.release = dibs_dev_release; +device_initialize (&dibs->dev);return dibs; }
@@ -100,7 +113,11 @@ EXPORT_SYMBOL_GPL(dibs_dev_alloc);int dibs_dev_add (struct dibs_dev *dibs) { -int i; +int i, ret; + + ret =device_add (&dibs->dev); +if (ret) +return ret;mutex_lock (&dibs_dev_list.mutex);mutex_lock (&clients_lock);
@@ -129,6 +146,8 @@ void dibs_dev_del(struct dibs_dev *dibs)mutex_unlock (&clients_lock);list_del_init (&dibs->list);mutex_unlock (&dibs_dev_list.mutex); + +device_del (&dibs->dev); }EXPORT_SYMBOL_GPL (dibs_dev_del);
drivers/s390/net/ism_drv.c +8 -32
@@ -602,15 +602,6 @@ static int ism_dev_init(struct ism_dev *ism)return ret; } -static void ism_dev_release (struct device *dev) -{ -struct ism_dev *ism; - - ism = container_of(dev, struct ism_dev, dev); - -kfree (ism); -} -static void ism_dev_exit (struct ism_dev *ism) {struct pci_dev *pdev = ism->pdev;
@@ -649,17 +640,10 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)spin_lock_init (&ism->cmd_lock);dev_set_drvdata (&pdev->dev, ism); ism->pdev = pdev; - ism->dev.parent = &pdev->dev; - ism->dev.release = ism_dev_release; -device_initialize (&ism->dev); -dev_set_name (&ism->dev,"%s" ,dev_name (&pdev->dev)); - ret =device_add (&ism->dev); -if (ret) - goto err_dev; ret =pci_enable_device_mem (pdev);if (ret) - goto err; + goto err_dev; ret =pci_request_mem_regions (pdev,DRV_NAME );if (ret)
@@ -687,6 +671,9 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret) goto err_dibs; + dibs->dev.parent = &pdev->dev; +dev_set_name (&dibs->dev,"%s" ,dev_name (&pdev->dev)); + ret =dibs_dev_add (dibs);if (ret) goto err_ism;
@@ -697,16 +684,14 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)ism_dev_exit (ism); err_dibs:/* pairs with dibs_dev_alloc() */ -kfree (dibs); +put_device (&dibs->dev); err_resource:pci_release_mem_regions (pdev); err_disable:pci_disable_device (pdev); -err: -device_del (&ism->dev); err_dev:dev_set_drvdata (&pdev->dev,NULL ); -put_device (&ism->dev); +kfree (ism);return ret; }
@@ -719,13 +704,12 @@ static void ism_remove(struct pci_dev *pdev)dibs_dev_del (dibs);ism_dev_exit (ism);/* pairs with dibs_dev_alloc() */ -kfree (dibs); +put_device (&dibs->dev);pci_release_mem_regions (pdev);pci_disable_device (pdev); -device_del (&ism->dev);dev_set_drvdata (&pdev->dev,NULL ); -put_device (&ism->dev); +kfree (ism); }static struct pci_driver ism_driver = {
@@ -866,13 +850,6 @@ static void smcd_get_local_gid(struct smcd_dev *smcd, smcd_gid->gid_ext =0 ; } -static inline struct device *smcd_get_dev (struct smcd_dev *dev) -{ -struct ism_dev *ism = dev->priv; - -return &ism->dev; -} -static const struct smcd_ops ism_smcd_ops = { .query_remote_gid = smcd_query_rgid, .register_dmb = smcd_register_dmb,
@@ -885,7 +862,6 @@ static const struct smcd_ops ism_smcd_ops = { .move_data = smcd_move, .supports_v2 = smcd_supports_v2, .get_local_gid = smcd_get_local_gid, - .get_dev = smcd_get_dev, };const struct smcd_ops *ism_get_smcd_ops (void )
include/linux/dibs.h +1 -0
@@ -135,6 +135,7 @@ struct dibs_dev_ops {struct dibs_dev {struct list_head list; +struct device dev;/* To be filled by device driver, before calling dibs_dev_add(): */ const struct dibs_dev_ops *ops;/* priv pointer for device driver */
include/linux/ism.h +0 -1
@@ -42,7 +42,6 @@ struct ism_dev {struct ism_eq *ieq;dma_addr_t ieq_dma_addr; -struct device dev;u64 local_gid;int ieq_idx;
include/net/smc.h +0 -1
@@ -63,7 +63,6 @@ struct smcd_ops { unsigned int size);int (*supports_v2)(void );void (*get_local_gid)(struct smcd_dev *dev,struct smcd_gid *gid); -struct device * (*get_dev)(struct smcd_dev *dev);/* optional operations */ int (*add_vlan_id)(struct smcd_dev *dev,u64 vlan_id);
net/smc/smc_core.c +2 -2
@@ -924,7 +924,7 @@ static int smc_lgr_create(struct smc_sock *smc, struct smc_init_info *ini)if (ini->is_smcd) {/* SMC-D specific settings */ smcd = ini->ism_dev[ini->ism_selected]; -get_device (smcd->ops->get_dev (smcd)); +get_device (&smcd->dibs->dev); lgr->peer_gid.gid = ini->ism_peer_gid[ini->ism_selected].gid; lgr->peer_gid.gid_ext =
@@ -1474,7 +1474,7 @@ static void smc_lgr_free(struct smc_link_group *lgr)destroy_workqueue (lgr->tx_wq);if (lgr->is_smcd) {smc_ism_put_vlan (lgr->smcd, lgr->vlan_id); -put_device (lgr->smcd->ops->get_dev (lgr->smcd)); +put_device (&lgr->smcd->dibs->dev); }smc_lgr_put (lgr);/* theoretically last lgr_put */ }
net/smc/smc_ism.c +19 -27
95 lines not on this page · raw message
net/smc/smc_loopback.c +1 -20
@@ -23,7 +23,6 @@#define SMC_LO_SUPPORT_NOCOPY 0x1#define SMC_DMA_ADDR_INVALID (~(dma_addr_t)0) -static const char smc_lo_dev_name[] ="loopback-ism" ;static struct smc_lo_dev *lo_dev;static void smc_lo_generate_ids (struct smc_lo_dev *ldev)
@@ -255,11 +254,6 @@ static void smc_lo_get_local_gid(struct smcd_dev *smcd, smcd_gid->gid_ext = ldev->local_gid.gid_ext; } -static struct device *smc_lo_get_dev (struct smcd_dev *smcd) -{ -return &((struct smc_lo_dev *)smcd->priv)->dev; -} -static const struct smcd_ops lo_ops = { .query_remote_gid = smc_lo_query_rgid, .register_dmb = smc_lo_register_dmb,
@@ -274,7 +268,6 @@ static const struct smcd_ops lo_ops = { .signal_event = NULL, .move_data = smc_lo_move_data, .get_local_gid = smc_lo_get_local_gid, - .get_dev = smc_lo_get_dev, };const struct smcd_ops *smc_lo_get_smcd_ops (void )
@@ -299,14 +292,6 @@ static void smc_lo_dev_exit(struct smc_lo_dev *ldev)wait_event (ldev->ldev_release, !atomic_read (&ldev->dmb_cnt)); } -static void smc_lo_dev_release (struct device *dev) -{ -struct smc_lo_dev *ldev = - container_of(dev, struct smc_lo_dev, dev); - -kfree (ldev); -} -static int smc_lo_dev_probe (void ) {struct smc_lo_dev *ldev;
@@ -315,10 +300,6 @@ static int smc_lo_dev_probe(void)if (!ldev)return -ENOMEM ; - ldev->dev.parent =NULL ; - ldev->dev.release = smc_lo_dev_release; -device_initialize (&ldev->dev); -dev_set_name (&ldev->dev, smc_lo_dev_name);smc_lo_dev_init (ldev); lo_dev = ldev;/* global loopback device */
@@ -332,7 +313,7 @@ static void smc_lo_dev_remove(void)return ;smc_lo_dev_exit (lo_dev); -put_device (&lo_dev->dev);/* device_initialize in smc_lo_dev_probe */ +kfree (lo_dev); lo_dev =NULL ; }
net/smc/smc_loopback.h +0 -1
@@ -32,7 +32,6 @@ struct smc_lo_dmb_node {struct smc_lo_dev {struct smcd_dev *smcd; -struct device dev;struct smcd_gid local_gid;atomic_t dmb_cnt;rwlock_t dmb_ht_lock;
net/smc/smc_pnet.c +5 -8
@@ -169,7 +169,7 @@ static int smc_pnet_remove_by_pnetid(struct net *net, char *pnet_name)pr_warn_ratelimited ("smc: smcd device %s " "erased user defined pnetid " "%.16s\n" , -dev_name (smcd->ops->get_dev (smcd)), +dev_name (&smcd->dibs->dev), smcd->pnetid);memset (smcd->pnetid,0 ,SMC_MAX_PNETID_LEN ); smcd->pnetid_by_user = false;
@@ -332,7 +332,7 @@ static struct smcd_dev *smc_pnet_find_smcd(char *smcd_name)mutex_lock (&smcd_dev_list.mutex);list_for_each_entry (smcd_dev, &smcd_dev_list.list, list) { -if (!strncmp (dev_name (smcd_dev->ops->get_dev (smcd_dev)), +if (!strncmp (dev_name (&smcd_dev->dibs->dev), smcd_name,IB_DEVICE_NAME_MAX -1 )) goto out; }
@@ -413,7 +413,6 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name,bool smcddev_applied = true;bool ibdev_applied = true;struct smcd_dev *smcd; -struct device *dev;bool new_ibdev;/* try to apply the pnetid to active devices */
@@ -431,10 +430,8 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name,if (smcd) { smcddev_applied =smc_pnet_apply_smcd (smcd, pnet_name);if (smcddev_applied) { - dev = smcd->ops->get_dev (smcd); -pr_warn_ratelimited ("smc: smcd device %s " -"applied user defined pnetid " -"%.16s\n" ,dev_name (dev), +pr_warn_ratelimited ("smc: smcd device %s applied user defined pnetid %.16s\n" , +dev_name (&smcd->dibs->dev), smcd->pnetid); } }
@@ -1193,7 +1190,7 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port)*/ int smc_pnetid_by_table_smcd (struct smcd_dev *smcddev) { -const char *ib_name =dev_name (smcddev->ops->get_dev (smcddev)); +const char *ib_name =dev_name (&smcddev->dibs->dev);struct smc_pnettable *pnettable;struct smc_pnetentry *tmp_pe;struct smc_net *sn;
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 9/14 dibs: Create class dibs
In reply to Alexandra WinterFrom: Julian Ruess <[email protected]>
Create '/sys/class/dibs' to represent multiple kinds of dibs devices in sysfs. Show s390/ism devices as well as dibs_loopback devices.
Show attribute fabric_id using dibs_ops.get_fabric_id(). This can help users understand which dibs devices are connected to the same fabric in different systems and which dibs devices are loopback devices (fabric_id 0xffff)
Instead of using the same name as the pci device, give the ism devices their own readable names based on uid or fid from the HW definition.
smc_loopback was never visible in sysfs. dibs_loopback is now represented as a virtual device.
For the SMC feature "software defined pnet-id" either the ib device name or the PCI-ID (actually the parent device name) can be used for SMC-R entries. Mimic this behaviour for SMC-D, and check the parent device name as well. So device name or PCI-ID can be used for ism and device name can be used for dibs-loopback. Note that this:IB_DEVICE_NAME_MAX - 1 == smc_pnet_policy.[SMC_PNETID_IBNAME].len is the length of smcd_name. Future SW-pnetid cleanup patches to could use a meaningful define, but that would touch too much unrelated code here.
Examples:
---------
ism before:
Quoted 1 line
ls /sys/bus/pci/devices/0000:00:00.0/0000:00:00.0
uevent
ism now:
Quoted 1 line
ls /sys/bus/pci/devices/0000:00:00.0/dibs/ism30
device -> ../../../0000:00:00.0/fabric_id
subsystem -> ../../../../../class/dibs/
uevent
dibs loopback:
Quoted 1 line
ls
/sys/devices/virtual/dibs/lo/
fabric_id
subsystem -> ../../../../class/dibs/
uevent
dibs class:
Quoted 1 line
ls -l
/sys/class/dibs/
ism30 -> ../../devices/pci0000:00/0000:00:00.0/dibs/ism30/ lo -> ../../devices/virtual/dibs/lo/
For comparison:
Quoted 1 line
ls -l
/sys/class/net/
enc8410 -> ../../devices/qeth/0.0.8410/net/enc8410/ ens1693 -> ../../devices/pci0001:00/0001:00:00.0/net/ens1693/ lo -> ../../devices/virtual/net/lo/
--- drivers/dibs/dibs_main.c | 40 ++++++++++++++++++++++++++++++++++++++ drivers/s390/net/ism_drv.c | 5 ++++- net/smc/smc_pnet.c | 16 +++++++++++---- 3 files changed, 56 insertions(+), 5 deletions(-)
drivers/dibs/dibs_main.c +40 -0
@@ -20,6 +20,8 @@MODULE_DESCRIPTION ("Direct Internal Buffer Sharing class" );MODULE_LICENSE ("GPL" ); +static struct class *dibs_class; +/* use an array rather a list for fast mapping: */ static struct dibs_client *clients[MAX_DIBS_CLIENTS ];static u8 max_client;
@@ -105,12 +107,35 @@ struct dibs_dev *dibs_dev_alloc(void)if (!dibs)return dibs; dibs->dev.release = dibs_dev_release; + dibs->dev.class = dibs_class;device_initialize (&dibs->dev);return dibs; }EXPORT_SYMBOL_GPL (dibs_dev_alloc); +static ssize_t fabric_id_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct dibs_dev *dibs; +u16 fabric_id; + + dibs = container_of(dev, struct dibs_dev, dev); + fabric_id = dibs->ops->get_fabric_id (dibs); + +return sysfs_emit (buf,"0x%04x\n" , fabric_id); +} +static DEVICE_ATTR_RO (fabric_id); + +static struct attribute *dibs_dev_attrs[] = { + &dev_attr_fabric_id.attr, +NULL , +}; + +static const struct attribute_group dibs_dev_attr_group = { + .attrs = dibs_dev_attrs, +}; +int dibs_dev_add (struct dibs_dev *dibs) {int i, ret;
@@ -119,6 +144,11 @@ int dibs_dev_add(struct dibs_dev *dibs)if (ret)return ret; + ret =sysfs_create_group (&dibs->dev.kobj, &dibs_dev_attr_group); +if (ret) { +dev_err (&dibs->dev,"sysfs_create_group failed for dibs_dev\n" ); + goto err_device_del; + }mutex_lock (&dibs_dev_list.mutex);mutex_lock (&clients_lock);for (i =0 ; i < max_client; ++i) {
@@ -130,6 +160,11 @@ int dibs_dev_add(struct dibs_dev *dibs)mutex_unlock (&dibs_dev_list.mutex);return 0 ; + +err_device_del: +device_del (&dibs->dev); +return ret; + }EXPORT_SYMBOL_GPL (dibs_dev_add);
@@ -158,6 +193,10 @@ static int __init dibs_init(void)memset (clients,0 ,sizeof (clients)); max_client =0 ; + dibs_class =class_create ("dibs" ); +if (IS_ERR (&dibs_class)) +return PTR_ERR (&dibs_class); + rc =dibs_loopback_init ();if (rc)pr_err ("%s fails with %d\n" , __func__, rc);
@@ -168,6 +207,7 @@ static int __init dibs_init(void) static void __exit dibs_exit(void) {dibs_loopback_exit (); +class_destroy (dibs_class); }module_init (dibs_init);
drivers/s390/net/ism_drv.c +4 -1
@@ -629,6 +629,7 @@ static void ism_dev_exit(struct ism_dev *ism)static int ism_probe (struct pci_dev *pdev,const struct pci_device_id *id) {struct dibs_dev *dibs; +struct zpci_dev *zdev;struct ism_dev *ism;int ret;
@@ -672,7 +673,9 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto err_dibs; dibs->dev.parent = &pdev->dev; -dev_set_name (&dibs->dev,"%s" ,dev_name (&pdev->dev)); + + zdev =to_zpci (pdev); +dev_set_name (&dibs->dev,"ism%x" , zdev->uid ? zdev->uid : zdev->fid); ret =dibs_dev_add (dibs);if (ret)
net/smc/smc_pnet.c +12 -4
@@ -332,8 +332,11 @@ static struct smcd_dev *smc_pnet_find_smcd(char *smcd_name)mutex_lock (&smcd_dev_list.mutex);list_for_each_entry (smcd_dev, &smcd_dev_list.list, list) { -if (!strncmp (dev_name (&smcd_dev->dibs->dev), - smcd_name,IB_DEVICE_NAME_MAX -1 )) +if (!strncmp (dev_name (&smcd_dev->dibs->dev), smcd_name, +IB_DEVICE_NAME_MAX -1 ) || + (smcd_dev->dibs->dev.parent && + !strncmp (dev_name (smcd_dev->dibs->dev.parent), smcd_name, +IB_DEVICE_NAME_MAX -1 ))) goto out; } smcd_dev =NULL ;
@@ -1190,7 +1193,6 @@ int smc_pnetid_by_table_ib(struct smc_ib_device *smcibdev, u8 ib_port)*/ int smc_pnetid_by_table_smcd (struct smcd_dev *smcddev) { -const char *ib_name =dev_name (&smcddev->dibs->dev);struct smc_pnettable *pnettable;struct smc_pnetentry *tmp_pe;struct smc_net *sn;
@@ -1203,7 +1205,13 @@ int smc_pnetid_by_table_smcd(struct smcd_dev *smcddev)mutex_lock (&pnettable->lock);list_for_each_entry (tmp_pe, &pnettable->pnetlist, list) {if (tmp_pe->type ==SMC_PNET_IB && - !strncmp (tmp_pe->ib_name, ib_name,IB_DEVICE_NAME_MAX )) { + (!strncmp (tmp_pe->ib_name, +dev_name (&smcddev->dibs->dev), +sizeof (tmp_pe->ib_name)) || + (smcddev->dibs->dev.parent && + !strncmp (tmp_pe->ib_name, +dev_name (smcddev->dibs->dev.parent), +sizeof (tmp_pe->ib_name))))) {smc_pnet_apply_smcd (smcddev, tmp_pe->pnet_name); rc =0 ;break ;
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 10/14 dibs: Local gid for dibs devices
In reply to Alexandra WinterDefine a uuid_t GID attribute to identify a dibs device.
SMC uses 64 Bit and 128 Bit Global Identifiers (GIDs) per device, that need to be sent via the SMC protocol. Because the smc code uses integers, network endianness and host endianness need to be considered. Avoid this in the dibs layer by using uuid_t byte arrays. Future patches could change SMC to use uuid_t. For now conversion helper functions are introduced.
ISM devices provide 64 Bit GIDs. Map them to dibs uuid_t GIDs like this:
_________________________________________
| 64 Bit ISM-vPCI GID | 00000000_00000000 |
-----------------------------------------
If interpreted as UUID [1], this would be interpreted as the UIID variant, that is reserved for NCS backward compatibility. So it will not collide with UUIDs that were generated according to the standard.
smc_loopback already uses version 4 UUIDs as 128 Bit GIDs, move that to dibs loopback. A temporary change to smc_lo_query_rgid() is required, that will be moved to dibs_loopback with a follow-on patch.
Provide gid of a dibs device as sysfs read-only attribute.
--- drivers/dibs/dibs_loopback.c | 1 + drivers/dibs/dibs_main.c | 12 ++++++++++++ drivers/s390/net/ism.h | 9 +++++++++ drivers/s390/net/ism_drv.c | 30 +++++++++--------------------- include/linux/dibs.h | 3 +++ include/linux/ism.h | 1 - include/net/smc.h | 1 - net/smc/smc_clc.c | 6 +++--- net/smc/smc_core.c | 2 +- net/smc/smc_diag.c | 2 +- net/smc/smc_ism.h | 22 ++++++++++++++++++++++ net/smc/smc_loopback.c | 29 ++++------------------------- net/smc/smc_loopback.h | 1 - 13 files changed, 65 insertions(+), 54 deletions(-)
drivers/dibs/dibs_loopback.c +1 -0
@@ -46,6 +46,7 @@ static int dibs_lo_dev_probe(void) ldev->dibs = dibs; dibs->drv_priv = ldev; +uuid_gen (&dibs->gid); dibs->ops = &dibs_lo_ops; dibs->dev.parent =NULL ;
drivers/dibs/dibs_main.c +12 -0
@@ -114,6 +114,17 @@ struct dibs_dev *dibs_dev_alloc(void) }EXPORT_SYMBOL_GPL (dibs_dev_alloc); +static ssize_t gid_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct dibs_dev *dibs; + + dibs = container_of(dev, struct dibs_dev, dev); + +return sysfs_emit (buf,"%pUb\n" , &dibs->gid); +} +static DEVICE_ATTR_RO (gid); +static ssize_t fabric_id_show (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -128,6 +139,7 @@ static ssize_t fabric_id_show(struct device *dev, struct device_attribute *attr,static DEVICE_ATTR_RO (fabric_id);static struct attribute *dibs_dev_attrs[] = { + &dev_attr_gid.attr, &dev_attr_fabric_id.attr,NULL , };
drivers/s390/net/ism.h +9 -0
@@ -67,6 +67,15 @@ union ism_reg_ieq { } response; }__aligned(16) ; +/* ISM-vPCI devices provide 64 Bit GIDs +* Map them to ISM UUID GIDs like this: +* _________________________________________ +* | 64 Bit ISM-vPCI GID | 00000000_00000000 | +* ----------------------------------------- +* This will be interpreted as a UIID variant, that is reserved +* for NCS backward compatibility. So it will not collide with +* proper UUIDs. +*/ union ism_read_gid { struct { struct ism_req_hdr hdr;
drivers/s390/net/ism_drv.c +9 -21
@@ -272,8 +272,9 @@ static int unregister_ieq(struct ism_dev *ism)return 0 ; } -static int ism_read_local_gid (struct ism_dev *ism) +static int ism_read_local_gid (struct dibs_dev *dibs) { +struct ism_dev *ism = dibs->drv_priv;union ism_read_gid cmd;int ret;
@@ -285,7 +286,8 @@ static int ism_read_local_gid(struct ism_dev *ism)if (ret) goto out; - ism->local_gid = cmd.response.gid; +memset (&dibs->gid,0 ,sizeof (dibs->gid)); +memcpy (&dibs->gid, &cmd.response.gid,sizeof (cmd.response.gid)); out:return ret; }
@@ -563,10 +565,6 @@ static int ism_dev_init(struct ism_dev *ism)if (ret) goto unreg_sba; - ret =ism_read_local_gid (ism); -if (ret) - goto unreg_ieq; -if (!ism_add_vlan_id (ism,ISM_RESERVED_VLANID ))/* hardware is V2 capable */ ism_v2_capable = true;
@@ -588,8 +586,6 @@ static int ism_dev_init(struct ism_dev *ism)query_info (ism);return 0 ; -unreg_ieq: -unregister_ieq (ism); unreg_sba:unregister_sba (ism); free_irq:
@@ -672,6 +668,11 @@ static int ism_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (ret) goto err_dibs; +/* after ism_dev_init() we can call ism function to set gid */ + ret =ism_read_local_gid (dibs); +if (ret) + goto err_ism; + dibs->dev.parent = &pdev->dev; zdev =to_zpci (pdev);
@@ -841,18 +842,6 @@ static int smcd_supports_v2(void)return ism_v2_capable; } -static u64 ism_get_local_gid (struct ism_dev *ism) -{ -return ism->local_gid; -} - -static void smcd_get_local_gid (struct smcd_dev *smcd, -struct smcd_gid *smcd_gid) -{ - smcd_gid->gid =ism_get_local_gid (smcd->priv); - smcd_gid->gid_ext =0 ; -} -static const struct smcd_ops ism_smcd_ops = { .query_remote_gid = smcd_query_rgid, .register_dmb = smcd_register_dmb,
@@ -864,7 +853,6 @@ static const struct smcd_ops ism_smcd_ops = { .signal_event = smcd_signal_ieq, .move_data = smcd_move, .supports_v2 = smcd_supports_v2, - .get_local_gid = smcd_get_local_gid, };const struct smcd_ops *ism_get_smcd_ops (void )
include/linux/dibs.h +3 -0
@@ -10,6 +10,8 @@#define _DIBS_H#include <linux/device.h> +#include <linux/uuid.h> +/* DIBS - Direct Internal Buffer Sharing - concept * ----------------------------------------------- * In the case of multiple system sharing the same hardware, dibs fabrics can
@@ -138,6 +140,7 @@ struct dibs_dev {struct device dev;/* To be filled by device driver, before calling dibs_dev_add(): */ const struct dibs_dev_ops *ops; +uuid_t gid;/* priv pointer for device driver */ void *drv_priv;
include/linux/ism.h +0 -1
@@ -42,7 +42,6 @@ struct ism_dev {struct ism_eq *ieq;dma_addr_t ieq_dma_addr; -u64 local_gid;int ieq_idx;struct ism_client *subs[MAX_CLIENTS ];
include/net/smc.h +0 -1
@@ -62,7 +62,6 @@ struct smcd_ops { bool sf, unsigned int offset, void *data, unsigned int size);int (*supports_v2)(void ); -void (*get_local_gid)(struct smcd_dev *dev,struct smcd_gid *gid);/* optional operations */ int (*add_vlan_id)(struct smcd_dev *dev,u64 vlan_id);
net/smc/smc_clc.c +3 -3
@@ -916,7 +916,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)/* add SMC-D specifics */ if (ini->ism_dev[0 ]) { smcd = ini->ism_dev[0 ]; - smcd->ops->get_local_gid (smcd, &smcd_gid); +copy_to_smcdgid (&smcd_gid, &smcd->dibs->gid); pclc_smcd->ism.gid =htonll (smcd_gid.gid); pclc_smcd->ism.chid =htons (smc_ism_get_chid (ini->ism_dev[0 ]));
@@ -966,7 +966,7 @@ int smc_clc_send_proposal(struct smc_sock *smc, struct smc_init_info *ini)if (ini->ism_offered_cnt) {for (i =1 ; i <= ini->ism_offered_cnt; i++) { smcd = ini->ism_dev[i]; - smcd->ops->get_local_gid (smcd, &smcd_gid); +copy_to_smcdgid (&smcd_gid, &smcd->dibs->gid); gidchids[entry].chid =htons (smc_ism_get_chid (ini->ism_dev[i])); gidchids[entry].gid =htonll (smcd_gid.gid);
@@ -1059,7 +1059,7 @@ smcd_clc_prep_confirm_accept(struct smc_connection *conn,/* SMC-D specific settings */ memcpy (clc->hdr.eyecatcher,SMCD_EYECATCHER ,sizeof (SMCD_EYECATCHER )); - smcd->ops->get_local_gid (smcd, &smcd_gid); +copy_to_smcdgid (&smcd_gid, &smcd->dibs->gid); clc->hdr.typev1 =SMC_TYPE_D ; clc->d0.gid =htonll (smcd_gid.gid); clc->d0.token =htonll (conn->rmb_desc->token);
net/smc/smc_core.c +1 -1
@@ -555,7 +555,7 @@ static int smc_nl_fill_smcd_lgr(struct smc_link_group *lgr,if (nla_put_u32 (skb,SMC_NLA_LGR_D_ID , *((u32 *)&lgr->id))) goto errattr; - smcd->ops->get_local_gid (smcd, &smcd_gid); +copy_to_smcdgid (&smcd_gid, &smcd->dibs->gid);if (nla_put_u64_64bit (skb,SMC_NLA_LGR_D_GID , smcd_gid.gid,SMC_NLA_LGR_D_PAD )) goto errattr;
net/smc/smc_diag.c +1 -1
@@ -175,7 +175,7 @@ static int __smc_diag_dump(struct sock *sk, struct sk_buff *skb, dinfo.linkid = *((u32 *)conn->lgr->id); dinfo.peer_gid = conn->lgr->peer_gid.gid; dinfo.peer_gid_ext = conn->lgr->peer_gid.gid_ext; - smcd->ops->get_local_gid (smcd, &smcd_gid); +copy_to_smcdgid (&smcd_gid, &smcd->dibs->gid); dinfo.my_gid = smcd_gid.gid; dinfo.my_gid_ext = smcd_gid.gid_ext; dinfo.token = conn->rmb_desc->token;
net/smc/smc_ism.h +22 -0
@@ -96,4 +96,26 @@ static inline bool smc_ism_is_loopback(struct dibs_dev *dibs)return (dibs->ops->get_fabric_id (dibs) ==DIBS_LOOPBACK_FABRIC ); } +static inline void copy_to_smcdgid (struct smcd_gid *sgid,uuid_t *dibs_gid) +{ +__be64 temp; + +memcpy (&temp, dibs_gid,sizeof (sgid->gid)); + sgid->gid =ntohll (temp); +memcpy (&temp, (uint8_t *)dibs_gid +sizeof (sgid->gid), +sizeof (sgid->gid_ext)); + sgid->gid_ext =ntohll (temp); +} + +static inline void copy_to_dibsgid (uuid_t *dibs_gid,struct smcd_gid *sgid) +{ +__be64 temp; + + temp =htonll (sgid->gid); +memcpy (dibs_gid, &temp,sizeof (sgid->gid)); + temp =htonll (sgid->gid_ext); +memcpy ((uint8_t *)dibs_gid +sizeof (sgid->gid), &temp, +sizeof (sgid->gid_ext)); +} +#endif
net/smc/smc_loopback.c +4 -25
@@ -13,6 +13,7 @@#include <linux/device.h> #include <linux/types.h> +#include <linux/dibs.h> #include <net/smc.h> #include "smc_cdc.h"
@@ -25,25 +26,14 @@static struct smc_lo_dev *lo_dev; -static void smc_lo_generate_ids (struct smc_lo_dev *ldev) -{ -struct smcd_gid *lgid = &ldev->local_gid; -uuid_t uuid; - -uuid_gen (&uuid); -memcpy (&lgid->gid, &uuid,sizeof (lgid->gid)); -memcpy (&lgid->gid_ext, (u8 *)&uuid +sizeof (lgid->gid), -sizeof (lgid->gid_ext)); -} -static int smc_lo_query_rgid (struct smcd_dev *smcd,struct smcd_gid *rgid,u32 vid_valid,u32 vid) { -struct smc_lo_dev *ldev = smcd->priv; +uuid_t temp; +copy_to_dibsgid (&temp, rgid);/* rgid should be the same as lgid */ -if (!ldev || rgid->gid != ldev->local_gid.gid || - rgid->gid_ext != ldev->local_gid.gid_ext) +if (!uuid_equal (&temp, &smcd->dibs->gid))return -ENETUNREACH ;return 0 ; }
@@ -245,15 +235,6 @@ static int smc_lo_move_data(struct smcd_dev *smcd, u64 dmb_tok,return 0 ; } -static void smc_lo_get_local_gid (struct smcd_dev *smcd, -struct smcd_gid *smcd_gid) -{ -struct smc_lo_dev *ldev = smcd->priv; - - smcd_gid->gid = ldev->local_gid.gid; - smcd_gid->gid_ext = ldev->local_gid.gid_ext; -} -static const struct smcd_ops lo_ops = { .query_remote_gid = smc_lo_query_rgid, .register_dmb = smc_lo_register_dmb,
@@ -267,7 +248,6 @@ static const struct smcd_ops lo_ops = { .reset_vlan_required = NULL, .signal_event = NULL, .move_data = smc_lo_move_data, - .get_local_gid = smc_lo_get_local_gid, };const struct smcd_ops *smc_lo_get_smcd_ops (void )
@@ -277,7 +257,6 @@ const struct smcd_ops *smc_lo_get_smcd_ops(void)static void smc_lo_dev_init (struct smc_lo_dev *ldev) { -smc_lo_generate_ids (ldev);rwlock_init (&ldev->dmb_ht_lock);hash_init (ldev->dmb_ht);atomic_set (&ldev->dmb_cnt,0 );
net/smc/smc_loopback.h +0 -1
@@ -32,7 +32,6 @@ struct smc_lo_dmb_node {struct smc_lo_dev {struct smcd_dev *smcd; -struct smcd_gid local_gid;atomic_t dmb_cnt;rwlock_t dmb_ht_lock; DECLARE_BITMAP(sba_idx_mask, SMC_LO_MAX_DMBS);
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 11/14 dibs: Move vlan support to dibs_dev_ops
In reply to Alexandra WinterIt 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.
--- drivers/s390/net/ism_drv.c | 47 +++++--------------------------------- include/linux/dibs.h | 19 +++++++++++++++ include/net/smc.h | 5 ---- net/smc/smc_ism.c | 14 ++++++++---- net/smc/smc_loopback.c | 5 ---- 5 files changed, 34 insertions(+), 56 deletions(-)
drivers/s390/net/ism_drv.c +6 -41
@@ -36,7 +36,6 @@ static struct ism_client *clients[MAX_CLIENTS]; /* use an array rather than *//* a list for fast mapping */ static u8 max_client;static DEFINE_MUTEX (clients_lock); -static bool ism_v2_capable;struct ism_dev_list {struct list_head list;struct mutex mutex;/* protects ism device list */
@@ -409,8 +408,9 @@ int ism_unregister_dmb(struct ism_dev *ism, struct ism_dmb *dmb) }EXPORT_SYMBOL_GPL (ism_unregister_dmb); -static int ism_add_vlan_id (struct ism_dev *ism,u64 vlan_id) +static int ism_add_vlan_id (struct dibs_dev *dibs,u64 vlan_id) { +struct ism_dev *ism = dibs->drv_priv;union ism_set_vlan_id cmd;memset (&cmd,0 ,sizeof (cmd));
@@ -422,8 +422,9 @@ static int ism_add_vlan_id(struct ism_dev *ism, u64 vlan_id)return ism_cmd (ism, &cmd); } -static int ism_del_vlan_id (struct ism_dev *ism,u64 vlan_id) +static int ism_del_vlan_id (struct dibs_dev *dibs,u64 vlan_id) { +struct ism_dev *ism = dibs->drv_priv;union ism_set_vlan_id cmd;memset (&cmd,0 ,sizeof (cmd));
@@ -536,6 +537,8 @@ static irqreturn_t ism_handle_irq(int irq, void *data)static const struct dibs_dev_ops ism_ops = { .get_fabric_id = ism_get_chid, + .add_vlan_id = ism_add_vlan_id, + .del_vlan_id = ism_del_vlan_id, };static int ism_dev_init (struct ism_dev *ism)
@@ -565,12 +568,6 @@ static int ism_dev_init(struct ism_dev *ism)if (ret) goto unreg_sba; -if (!ism_add_vlan_id (ism,ISM_RESERVED_VLANID )) -/* hardware is V2 capable */ - ism_v2_capable = true; -else - ism_v2_capable = false; -mutex_lock (&ism_dev_list.mutex);mutex_lock (&clients_lock);for (i =0 ; i < max_client; ++i) {
@@ -611,8 +608,6 @@ static void ism_dev_exit(struct ism_dev *ism)mutex_lock (&ism_dev_list.mutex); -if (ism_v2_capable) -ism_del_vlan_id (ism,ISM_RESERVED_VLANID );unregister_ieq (ism);unregister_sba (ism);free_irq (pci_irq_vector (pdev,0 ), ism);
@@ -786,26 +781,6 @@ static int smcd_unregister_dmb(struct smcd_dev *smcd, struct smcd_dmb *dmb)return ism_unregister_dmb (smcd->priv, (struct ism_dmb *)dmb); } -static int smcd_add_vlan_id (struct smcd_dev *smcd,u64 vlan_id) -{ -return ism_add_vlan_id (smcd->priv, vlan_id); -} - -static int smcd_del_vlan_id (struct smcd_dev *smcd,u64 vlan_id) -{ -return ism_del_vlan_id (smcd->priv, vlan_id); -} - -static int smcd_set_vlan_required (struct smcd_dev *smcd) -{ -return ism_cmd_simple (smcd->priv,ISM_SET_VLAN ); -} - -static int smcd_reset_vlan_required (struct smcd_dev *smcd) -{ -return ism_cmd_simple (smcd->priv,ISM_RESET_VLAN ); -} -static int ism_signal_ieq (struct ism_dev *ism,u64 rgid,u32 trigger_irq,u32 event_code,u64 info) {
@@ -837,22 +812,12 @@ static int smcd_move(struct smcd_dev *smcd, u64 dmb_tok, unsigned int idx,return ism_move (smcd->priv, dmb_tok, idx, sf, offset, data, size); } -static int smcd_supports_v2 (void ) -{ -return ism_v2_capable; -} -static const struct smcd_ops ism_smcd_ops = { .query_remote_gid = smcd_query_rgid, .register_dmb = smcd_register_dmb, .unregister_dmb = smcd_unregister_dmb, - .add_vlan_id = smcd_add_vlan_id, - .del_vlan_id = smcd_del_vlan_id, - .set_vlan_required = smcd_set_vlan_required, - .reset_vlan_required = smcd_reset_vlan_required, .signal_event = smcd_signal_ieq, .move_data = smcd_move, - .supports_v2 = smcd_supports_v2, };const struct smcd_ops *ism_get_smcd_ops (void )
include/linux/dibs.h +19 -0
@@ -133,6 +133,25 @@ struct dibs_dev_ops {* Return: 2 byte dibs fabric id */ u16 (*get_fabric_id)(struct dibs_dev *dev); +/** +* add_vlan_id() - add dibs device to vlan (optional, deprecated) +* @dev: dibs device +* @vlan_id: vlan id +* +* In order to write into a vlan-tagged dmb, the remote device needs +* to belong to the this vlan. A device can belong to more than 1 vlan. +* Any device can access an untagged dmb. +* Deprecated, only supported for backwards compatibility. +* Return: zero on success +*/ +int (*add_vlan_id)(struct dibs_dev *dev,u64 vlan_id); +/** +* del_vlan_id() - remove dibs device from vlan (optional, deprecated) +* @dev: dibs device +* @vlan_id: vlan id +* Return: zero on success +*/ +int (*del_vlan_id)(struct dibs_dev *dev,u64 vlan_id); };struct dibs_dev {
include/net/smc.h +0 -5
@@ -61,13 +61,8 @@ struct smcd_ops {int (*move_data)(struct smcd_dev *dev,u64 dmb_tok,unsigned int idx,bool sf,unsigned int offset,void *data,unsigned int size); -int (*supports_v2)(void );/* optional operations */ -int (*add_vlan_id)(struct smcd_dev *dev,u64 vlan_id); -int (*del_vlan_id)(struct smcd_dev *dev,u64 vlan_id); -int (*set_vlan_required)(struct smcd_dev *dev); -int (*reset_vlan_required)(struct smcd_dev *dev);int (*signal_event)(struct smcd_dev *dev,struct smcd_gid *rgid,u32 trigger_irq,u32 event_code,u64 info);int (*support_dmb_nocopy)(struct smcd_dev *dev);
net/smc/smc_ism.c +9 -5
@@ -140,7 +140,7 @@ int smc_ism_get_vlan(struct smcd_dev *smcd, unsigned short vlanid)if (!vlanid)/* No valid vlan id */ return -EINVAL ; -if (!smcd->ops->add_vlan_id) +if (!smcd->dibs->ops->add_vlan_id)return -EOPNOTSUPP ;/* create new vlan entry, in case we need it */
@@ -163,7 +163,7 @@ int smc_ism_get_vlan(struct smcd_dev *smcd, unsigned short vlanid)/* no existing entry found. * add new entry to device; might fail, e.g., if HW limit reached */ -if (smcd->ops->add_vlan_id (smcd, vlanid)) { +if (smcd->dibs->ops->add_vlan_id (smcd->dibs, vlanid)) {kfree (new_vlan); rc = -EIO ; goto out;
@@ -187,7 +187,7 @@ int smc_ism_put_vlan(struct smcd_dev *smcd, unsigned short vlanid)if (!vlanid)/* No valid vlan id */ return -EINVAL ; -if (!smcd->ops->del_vlan_id) +if (!smcd->dibs->ops->del_vlan_id)return -EOPNOTSUPP ;spin_lock_irqsave (&smcd->lock, flags);
@@ -205,7 +205,7 @@ int smc_ism_put_vlan(struct smcd_dev *smcd, unsigned short vlanid) }/* Found and the last reference just gone */ -if (smcd->ops->del_vlan_id (smcd, vlanid)) +if (smcd->dibs->ops->del_vlan_id (smcd->dibs, vlanid)) rc = -EIO ;list_del (&vlan->list);kfree (vlan);
@@ -539,8 +539,12 @@ static void smcd_register_dev(struct dibs_dev *dibs)if (smc_pnetid_by_dev_port (dibs->dev.parent,0 , smcd->pnetid))smc_pnetid_by_table_smcd (smcd); -if (smc_ism_is_loopback (dibs) || smcd->ops->supports_v2 ()) +if (smc_ism_is_loopback (dibs) || + (dibs->ops->add_vlan_id && + !dibs->ops->add_vlan_id (dibs,ISM_RESERVED_VLANID ))) {smc_ism_set_v2_capable (); + } +mutex_lock (&smcd_dev_list.mutex);/* sort list: * - devices without pnetid before devices with pnetid;
net/smc/smc_loopback.c +0 -5
@@ -20,7 +20,6 @@#include "smc_ism.h" #include "smc_loopback.h" -#define SMC_LO_V2_CAPABLE 0x1/* loopback-ism acts as ISMv2 */ #define SMC_LO_SUPPORT_NOCOPY 0x1#define SMC_DMA_ADDR_INVALID (~(dma_addr_t)0)
@@ -242,10 +241,6 @@ static const struct smcd_ops lo_ops = { .support_dmb_nocopy = smc_lo_support_dmb_nocopy, .attach_dmb = smc_lo_attach_dmb, .detach_dmb = smc_lo_detach_dmb, - .add_vlan_id = NULL, - .del_vlan_id = NULL, - .set_vlan_required = NULL, - .reset_vlan_required = NULL, .signal_event = NULL, .move_data = smc_lo_move_data, };
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 12/14 dibs: Move query_remote_gid() to dibs_dev_ops
In reply to Alexandra WinterProvide the dibs_dev_ops->query_remote_gid() in ism and dibs_loopback dibs_devices. And call it in smc dibs_client.
--- drivers/dibs/dibs_loopback.c | 10 +++++++++ drivers/s390/net/ism_drv.c | 41 ++++++++++++++++-------------------- include/linux/dibs.h | 14 ++++++++++++ include/net/smc.h | 2 -- net/smc/smc_ism.c | 8 +++++-- net/smc/smc_loopback.c | 13 ------------ 6 files changed, 48 insertions(+), 40 deletions(-)
drivers/dibs/dibs_loopback.c +10 -0
@@ -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 )
drivers/s390/net/ism_drv.c +18 -23
65 lines not on this page · raw message
include/linux/dibs.h +14 -0
@@ -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
include/net/smc.h +0 -2
@@ -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);
net/smc/smc_ism.c +6 -2
@@ -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)
net/smc/smc_loopback.c +0 -13
@@ -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,
Signature · 1 line
2.48.1
Alexandra Winter
maintainerPATCH v3 13/14 dibs: Move data path to dibs layer
In reply to Alexandra WinterUse struct dibs_dmb instead of struct smc_dmb and move the corresponding client tables to dibs_dev. Leave driver specific implementation details like sba in the device drivers.
Register and unregister dmbs via dibs_dev_ops. A dmb is dedicated to a single client, but a dibs device can have dmbs for more than one client.
Trigger dibs clients via dibs_client_ops->handle_irq(), when data is received into a dmb. For dibs_loopback replace scheduling an smcd receive tasklet with calling dibs_client_ops->handle_irq().
For loopback devices attach_dmb(), detach_dmb() and move_data() need to access the dmb tables, so move those to dibs_dev_ops in this patch as well.
Remove remaining definitions of smc_loopback as they are no longer required, now that everything is in dibs_loopback.
Note that struct ism_client and struct ism_dev are still required in smc until a follow-on patch moves event handling to dibs. (Loopback does not use events).
--- drivers/dibs/dibs_loopback.c | 257 ++++++++++++++++++++++++++++++ drivers/dibs/dibs_loopback.h | 19 +++ drivers/dibs/dibs_main.c | 56 ++++++- drivers/s390/net/ism_drv.c | 121 ++++++-------- include/linux/dibs.h | 177 +++++++++++++++++++++ include/linux/ism.h | 23 --- include/net/smc.h | 22 --- net/smc/Makefile | 1 - net/smc/smc_ism.c | 70 ++++----- net/smc/smc_ism.h | 4 +- net/smc/smc_loopback.c | 294 ----------------------------------- net/smc/smc_loopback.h | 47 ------ 12 files changed, 591 insertions(+), 500 deletions(-) delete mode 100644 net/smc/smc_loopback.c delete mode 100644 net/smc/smc_loopback.h
drivers/dibs/dibs_loopback.c +257 -0
@@ -9,12 +9,18 @@* */ +#include <linux/bitops.h> +#include <linux/device.h> #include <linux/dibs.h> #include <linux/slab.h> +#include <linux/spinlock.h> #include <linux/types.h> #include "dibs_loopback.h" +#define DIBS_LO_SUPPORT_NOCOPY 0x1 +#define DIBS_DMA_ADDR_INVALID (~(dma_addr_t)0) +static const char dibs_lo_dev_name[] ="lo" ;/* global loopback device */ static struct dibs_lo_dev *lo_dev;
@@ -33,11 +39,259 @@ static int dibs_lo_query_rgid(struct dibs_dev *dibs, const uuid_t *rgid,return 0 ; } +static int dibs_lo_max_dmbs (void ) +{ +return DIBS_LO_MAX_DMBS ; +} + +static int dibs_lo_register_dmb (struct dibs_dev *dibs,struct dibs_dmb *dmb, +struct dibs_client *client) +{ +struct dibs_lo_dmb_node *dmb_node, *tmp_node; +struct dibs_lo_dev *ldev; +unsigned long flags; +int sba_idx, rc; + + ldev = dibs->drv_priv; + sba_idx = dmb->idx; +/* check space for new dmb */ +for_each_clear_bit (sba_idx, ldev->sba_idx_mask,DIBS_LO_MAX_DMBS ) { +if (!test_and_set_bit (sba_idx, ldev->sba_idx_mask)) +break ; + } +if (sba_idx ==DIBS_LO_MAX_DMBS ) +return -ENOSPC ; + + dmb_node =kzalloc (sizeof (*dmb_node),GFP_KERNEL ); +if (!dmb_node) { + rc = -ENOMEM ; + goto err_bit; + } + + dmb_node->sba_idx = sba_idx; + dmb_node->len = dmb->dmb_len; + dmb_node->cpu_addr =kzalloc (dmb_node->len,GFP_KERNEL | + __GFP_NOWARN | __GFP_NORETRY | + __GFP_NOMEMALLOC); +if (!dmb_node->cpu_addr) { + rc = -ENOMEM ; + goto err_node; + } + dmb_node->dma_addr =DIBS_DMA_ADDR_INVALID ; +refcount_set (&dmb_node->refcnt,1 ); + +again: +/* add new dmb into hash table */ +get_random_bytes (&dmb_node->token,sizeof (dmb_node->token)); +write_lock_bh (&ldev->dmb_ht_lock); +hash_for_each_possible (ldev->dmb_ht, tmp_node, list, dmb_node->token) { +if (tmp_node->token == dmb_node->token) { +write_unlock_bh (&ldev->dmb_ht_lock); + goto again; + } + } +hash_add (ldev->dmb_ht, &dmb_node->list, dmb_node->token); +write_unlock_bh (&ldev->dmb_ht_lock); +atomic_inc (&ldev->dmb_cnt); + + dmb->idx = dmb_node->sba_idx; + dmb->dmb_tok = dmb_node->token; + dmb->cpu_addr = dmb_node->cpu_addr; + dmb->dma_addr = dmb_node->dma_addr; + dmb->dmb_len = dmb_node->len; + +spin_lock_irqsave (&dibs->lock, flags); + dibs->dmb_clientid_arr[sba_idx] = client->id; +spin_unlock_irqrestore (&dibs->lock, flags); + +return 0 ; + +err_node: +kfree (dmb_node); +err_bit: +clear_bit (sba_idx, ldev->sba_idx_mask); +return rc; +} + +static void __dibs_lo_unregister_dmb (struct dibs_lo_dev *ldev, +struct dibs_lo_dmb_node *dmb_node) +{ +/* remove dmb from hash table */ +write_lock_bh (&ldev->dmb_ht_lock); +hash_del (&dmb_node->list); +write_unlock_bh (&ldev->dmb_ht_lock); + +clear_bit (dmb_node->sba_idx, ldev->sba_idx_mask); +kfree (dmb_node->cpu_addr); +kfree (dmb_node); + +if (atomic_dec_and_test (&ldev->dmb_cnt)) +wake_up (&ldev->ldev_release); +} + +static int dibs_lo_unregister_dmb (struct dibs_dev *dibs,struct dibs_dmb *dmb) +{ +struct dibs_lo_dmb_node *dmb_node =NULL , *tmp_node; +struct dibs_lo_dev *ldev; +unsigned long flags; + + ldev = dibs->drv_priv; + +/* find dmb from hash table */ +read_lock_bh (&ldev->dmb_ht_lock); +hash_for_each_possible (ldev->dmb_ht, tmp_node, list, dmb->dmb_tok) { +if (tmp_node->token == dmb->dmb_tok) { + dmb_node = tmp_node; +break ; + } + } +read_unlock_bh (&ldev->dmb_ht_lock); +if (!dmb_node) +return -EINVAL ; + +if (refcount_dec_and_test (&dmb_node->refcnt)) { +spin_lock_irqsave (&dibs->lock, flags); + dibs->dmb_clientid_arr[dmb_node->sba_idx] =NO_DIBS_CLIENT ; +spin_unlock_irqrestore (&dibs->lock, flags); + +__dibs_lo_unregister_dmb (ldev, dmb_node); + } +return 0 ; +} + +static int dibs_lo_support_dmb_nocopy (struct dibs_dev *dibs) +{ +return DIBS_LO_SUPPORT_NOCOPY ; +} + +static int dibs_lo_attach_dmb (struct dibs_dev *dibs,struct dibs_dmb *dmb) +{ +struct dibs_lo_dmb_node *dmb_node =NULL , *tmp_node; +struct dibs_lo_dev *ldev; + + ldev = dibs->drv_priv; + +/* find dmb_node according to dmb->dmb_tok */ +read_lock_bh (&ldev->dmb_ht_lock); +hash_for_each_possible (ldev->dmb_ht, tmp_node, list, dmb->dmb_tok) { +if (tmp_node->token == dmb->dmb_tok) { + dmb_node = tmp_node; +break ; + } + } +if (!dmb_node) { +read_unlock_bh (&ldev->dmb_ht_lock); +return -EINVAL ; + } +read_unlock_bh (&ldev->dmb_ht_lock); + +if (!refcount_inc_not_zero (&dmb_node->refcnt)) +/* the dmb is being unregistered, but has +* not been removed from the hash table. +*/ +return -EINVAL ; + +/* provide dmb information */ + dmb->idx = dmb_node->sba_idx; + dmb->dmb_tok = dmb_node->token; + dmb->cpu_addr = dmb_node->cpu_addr; + dmb->dma_addr = dmb_node->dma_addr; + dmb->dmb_len = dmb_node->len; +return 0 ; +} + +static int dibs_lo_detach_dmb (struct dibs_dev *dibs,u64 token) +{ +struct dibs_lo_dmb_node *dmb_node =NULL , *tmp_node; +struct dibs_lo_dev *ldev; + + ldev = dibs->drv_priv; + +/* find dmb_node according to dmb->dmb_tok */ +read_lock_bh (&ldev->dmb_ht_lock); +hash_for_each_possible (ldev->dmb_ht, tmp_node, list, token) { +if (tmp_node->token == token) { + dmb_node = tmp_node; +break ; + } + } +if (!dmb_node) { +read_unlock_bh (&ldev->dmb_ht_lock); +return -EINVAL ; + } +read_unlock_bh (&ldev->dmb_ht_lock); + +if (refcount_dec_and_test (&dmb_node->refcnt)) +__dibs_lo_unregister_dmb (ldev, dmb_node); +return 0 ; +} + +static int dibs_lo_move_data (struct dibs_dev *dibs,u64 dmb_tok, +unsigned int idx,bool sf,unsigned int offset, +void *data,unsigned int size) +{ +struct dibs_lo_dmb_node *rmb_node =NULL , *tmp_node; +struct dibs_lo_dev *ldev; +u16 s_mask; +u8 client_id; +u32 sba_idx; + + ldev = dibs->drv_priv; + +read_lock_bh (&ldev->dmb_ht_lock); +hash_for_each_possible (ldev->dmb_ht, tmp_node, list, dmb_tok) { +if (tmp_node->token == dmb_tok) { + rmb_node = tmp_node; +break ; + } + } +if (!rmb_node) { +read_unlock_bh (&ldev->dmb_ht_lock); +return -EINVAL ; + } +memcpy ((char *)rmb_node->cpu_addr + offset, data, size); + sba_idx = rmb_node->sba_idx; +read_unlock_bh (&ldev->dmb_ht_lock); + +if (!sf) +return 0 ; + +spin_lock (&dibs->lock); + client_id = dibs->dmb_clientid_arr[sba_idx]; + s_mask =ror16 (0x1000 , idx); +if (likely (client_id !=NO_DIBS_CLIENT && dibs->subs[client_id])) + dibs->subs[client_id]->ops->handle_irq (dibs, sba_idx, s_mask); +spin_unlock (&dibs->lock); + +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, + .max_dmbs = dibs_lo_max_dmbs, + .register_dmb = dibs_lo_register_dmb, + .unregister_dmb = dibs_lo_unregister_dmb, + .move_data = dibs_lo_move_data, + .support_mmapped_rdmb = dibs_lo_support_dmb_nocopy, + .attach_dmb = dibs_lo_attach_dmb, + .detach_dmb = dibs_lo_detach_dmb, }; +static void dibs_lo_dev_init (struct dibs_lo_dev *ldev) +{ +rwlock_init (&ldev->dmb_ht_lock); +hash_init (ldev->dmb_ht); +atomic_set (&ldev->dmb_cnt,0 ); +init_waitqueue_head (&ldev->ldev_release); +} + +static void dibs_lo_dev_exit (struct dibs_lo_dev *ldev) +{ +if (atomic_read (&ldev->dmb_cnt)) +wait_event (ldev->ldev_release, !atomic_read (&ldev->dmb_cnt)); +} +static int dibs_lo_dev_probe (void ) {struct dibs_lo_dev *ldev;
@@ -56,6 +310,7 @@ static int dibs_lo_dev_probe(void) ldev->dibs = dibs; dibs->drv_priv = ldev; +dibs_lo_dev_init (ldev);uuid_gen (&dibs->gid); dibs->ops = &dibs_lo_ops;
@@ -69,6 +324,7 @@ static int dibs_lo_dev_probe(void)return 0 ; err_reg: +kfree (dibs->dmb_clientid_arr);/* pairs with dibs_dev_alloc() */ put_device (&dibs->dev);kfree (ldev);
@@ -82,6 +338,7 @@ static void dibs_lo_dev_remove(void)return ;dibs_dev_del (lo_dev->dibs); +dibs_lo_dev_exit (lo_dev);/* pairs with dibs_dev_alloc() */ put_device (&lo_dev->dibs->dev);kfree (lo_dev);
drivers/dibs/dibs_loopback.h +19 -0
@@ -13,13 +13,32 @@#define _DIBS_LOOPBACK_H#include <linux/dibs.h> +#include <linux/hashtable.h> +#include <linux/spinlock.h> #include <linux/types.h> #include <linux/wait.h> #if IS_ENABLED (CONFIG_DIBS_LO ) +#define DIBS_LO_DMBS_HASH_BITS 12 +#define DIBS_LO_MAX_DMBS 5000 + +struct dibs_lo_dmb_node { +struct hlist_node list; +u64 token; +u32 len; +u32 sba_idx; +void *cpu_addr; +dma_addr_t dma_addr; +refcount_t refcnt; +};struct dibs_lo_dev {struct dibs_dev *dibs; +atomic_t dmb_cnt; +rwlock_t dmb_ht_lock; + DECLARE_BITMAP(sba_idx_mask, DIBS_LO_MAX_DMBS); + DECLARE_HASHTABLE(dmb_ht, DIBS_LO_DMBS_HASH_BITS); +wait_queue_head_t ldev_release; };int dibs_loopback_init (void );
drivers/dibs/dibs_main.c +54 -2
121 lines not on this page · raw message
drivers/s390/net/ism_drv.c +49 -72
284 lines not on this page · raw message
include/linux/dibs.h +177 -0
213 lines not on this page · raw message
include/linux/ism.h +0 -23
@@ -11,17 +11,6 @@#include <linux/workqueue.h> -struct ism_dmb { -u64 dmb_tok; -u64 rgid; -u32 dmb_len; -u32 sba_idx; -u32 vlan_valid; -u32 vlan_id; -void *cpu_addr; -dma_addr_t dma_addr; -}; -/* Unless we gain unexpected popularity, this limit should hold for a while */ #define MAX_CLIENTS 8#define ISM_NR_DMBS 1920
@@ -36,7 +25,6 @@ struct ism_dev {struct ism_sba *sba;dma_addr_t sba_dma_addr;DECLARE_BITMAP (sba_bitmap,ISM_NR_DMBS ); -u8 *sba_client_arr;/* entries are indices into 'clients' array */ void *priv[MAX_CLIENTS ];struct ism_eq *ieq;
@@ -58,11 +46,6 @@ struct ism_event {struct ism_client {const char *name;void (*handle_event)(struct ism_dev *dev,struct ism_event *event); -/* Parameter dmbemask contains a bit vector with updated DMBEs, if sent -* via ism_move_data(). Callback function must handle all active bits -* indicated by dmbemask. -*/ -void (*handle_irq)(struct ism_dev *dev,unsigned int bit,u16 dmbemask);/* Private area - don't touch! */ u8 id; };
@@ -79,12 +62,6 @@ static inline void ism_set_priv(struct ism_dev *dev, struct ism_client *client, dev->priv[client->id] = priv; } -int ism_register_dmb (struct ism_dev *dev,struct ism_dmb *dmb, -struct ism_client *client); -int ism_unregister_dmb (struct ism_dev *dev,struct ism_dmb *dmb); -int ism_move (struct ism_dev *dev,u64 dmb_tok,unsigned int idx,bool sf, -unsigned int offset,void *data,unsigned int size); -const struct smcd_ops *ism_get_smcd_ops (void );#endif /* _ISM_H */
include/net/smc.h +0 -22
@@ -28,17 +28,6 @@ struct smc_hashinfo { };/* SMCD/ISM device driver interface */ -struct smcd_dmb { -u64 dmb_tok; -u64 rgid; -u32 dmb_len; -u32 sba_idx; -u32 vlan_valid; -u32 vlan_id; -void *cpu_addr; -dma_addr_t dma_addr; -}; -#define ISM_EVENT_DMB 0#define ISM_EVENT_GID 1#define ISM_EVENT_SWR 2
@@ -53,25 +42,14 @@ struct smcd_gid { };struct smcd_ops { -int (*register_dmb)(struct smcd_dev *dev,struct smcd_dmb *dmb, -void *client); -int (*unregister_dmb)(struct smcd_dev *dev,struct smcd_dmb *dmb); -int (*move_data)(struct smcd_dev *dev,u64 dmb_tok,unsigned int idx, -bool sf,unsigned int offset,void *data, -unsigned int size); -/* optional operations */ int (*signal_event)(struct smcd_dev *dev,struct smcd_gid *rgid,u32 trigger_irq,u32 event_code,u64 info); -int (*support_dmb_nocopy)(struct smcd_dev *dev); -int (*attach_dmb)(struct smcd_dev *dev,struct smcd_dmb *dmb); -int (*detach_dmb)(struct smcd_dev *dev,u64 token); };struct smcd_dev {const struct smcd_ops *ops;void *priv; -void *client;struct dibs_dev *dibs;struct list_head list;spinlock_t lock;
net/smc/Makefile +0 -1
@@ -6,4 +6,3 @@ smc-y := af_smc.o smc_pnet.o smc_ib.o smc_clc.o smc_core.o smc_wr.o smc_llc.o smc-y += smc_cdc.o smc_tx.o smc_rx.o smc_close.o smc_ism.o smc_netlink.o smc_stats.o smc-y += smc_tracepoint.o smc_inet.o smc-$(CONFIG_SYSCTL) += smc_sysctl.o -smc-y += smc_loopback.o
net/smc/smc_ism.c +32 -38
196 lines not on this page · raw message
net/smc/smc_ism.h +3 -1
@@ -69,7 +69,9 @@ static inline int smc_ism_write(struct smcd_dev *smcd, u64 dmb_tok, {int rc; - rc = smcd->ops->move_data (smcd, dmb_tok, idx, sf, offset, data, len); + rc = smcd->dibs->ops->move_data (smcd->dibs, dmb_tok, idx, sf, offset, + data, len); +return rc <0 ? rc :0 ; }
net/smc/smc_loopback.c deleted +0 -294
294 lines not on this page · raw message
net/smc/smc_loopback.h deleted +0 -47
47 lines not on this page · raw message
Signature · 1 line
2.48.1
Re: [PATCH net-next v3 13/14] dibs: Move data path to dibs layer: manual merge
Hi Alexandra, Sidraya,
Quoted 14 lines · Alexandra Winter
Use struct
dibs_dmbinstead of structsmc_dmband move the corresponding client tables todibs_dev. Leave driver specific implementation details like sba in the device drivers.Register and unregister dmbs via
dibs_dev_ops. A dmb is dedicated to a single client, but a dibs device can have dmbs for more than one client.Trigger dibs clients via
dibs_client_ops->handle_irq(), when data is received into a dmb. Fordibs_loopbackreplace scheduling an smcd receive tasklet with callingdibs_client_ops->handle_irq().For loopback devices
attach_dmb(),detach_dmb()andmove_data()need to access the dmb tables, so move those todibs_dev_opsin this patch as well.
Quoted 6 lines
Remove remaining definitions of
smc_loopbackas they are no longer required, now that everything is indibs_loopback.Note that struct
ism_clientand structism_devare still required in smc until a follow-on patch moves event handling to dibs. (Loopback does not use events).
FYI, we got a conflict when merging 'net' in 'net-next' in the MPTCP tree due to this patch applied in 'net':
a35c04de2565 ("net/smc: fix warning in smc_rx_splice() when callingget_page()")
and this one from 'net-next':
cc21191b584c ("dibs: Move data path to dibs layer")
----- Generic Message -----
The best is to avoid conflicts between 'net' and 'net-next' trees but if they cannot be avoided when preparing patches, a note about how to fix them is much appreciated.
The conflict has been resolved on our side[1] and the resolution we suggest is attached to this email. Please report any issues linked to this conflict resolution as it might be used by others. If you worked on the mentioned patches, don't hesitate to ACK this conflict resolution.
---------------------------
Regarding this conflict, I hope the resolution is correct. The patch from 'net' was modifying 'net/smc/smc_loopback.c' in smc_lo_register_dmb() and __smc_lo_unregister_dmb(). I applied the same modifications in 'drivers/dibs/dibs_loopback.c', in dibs_lo_register_dmb() and __dibs_lo_unregister_dmb(). In net-next, kfree(cpu_addr) was used instead of kvfree(cpu_addr), but this was done on purpose. Also, I had to include mm.h to be able to build this driver. I also attached a simple diff of the modifications I did.
Does that look OK to both of you?
Note: no rerere cache is available for this kind of conflicts.
Cheers,
Matt
[1] https://github.com/multipath-tcp/mptcp_net-next/commit/af2dbdbb0a91
Signature · 1 line
Sponsored by the NGI0 Core fund.
drivers/dibs/dibs_loopback.c +0 -0
mode 000000,100644..100644
--- a/drivers/dibs/dibs_loopback.c
+++ b/drivers/dibs/dibs_loopback.c
@@@ -1,0 -1,356 +1,361 @@@
+ // SPDX-License-Identifier: GPL-2.0
+ /*
+ * Functions for dibs loopback/loopback-ism device. + * + * Copyright (c) 2024, Alibaba Inc. + * + * Author: Wen Gu <[email protected]> + * Tony Lu <[email protected]> + * + */
+
+ #include <linux/bitops.h>
+ #include <linux/device.h>
+ #include <linux/dibs.h>
++#include <linux/mm.h>
+ #include <linux/slab.h>
+ #include <linux/spinlock.h>
+ #include <linux/types.h>
+
+ #include "dibs_loopback.h"
+
+ #define DIBS_LO_SUPPORT_NOCOPY 0x1
+ #define DIBS_DMA_ADDR_INVALID (~(dma_addr_t)0)
+
+ static const char dibs_lo_dev_name[] = "lo";
+ /* global loopback device */
+ static struct dibs_lo_dev *lo_dev;
+
+ 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 int dibs_lo_max_dmbs(void)
+ {
+ return DIBS_LO_MAX_DMBS;
+ }
+
+ static int dibs_lo_register_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb,
+ struct dibs_client *client)
+ {
+ struct dibs_lo_dmb_node *dmb_node, *tmp_node;
+ struct dibs_lo_dev *ldev;
++ struct folio *folio;
+ unsigned long flags;
+ int sba_idx, rc;
+
+ ldev = dibs->drv_priv;
+ sba_idx = dmb->idx;
+ /* check space for new dmb */
+ for_each_clear_bit(sba_idx, ldev->sba_idx_mask, DIBS_LO_MAX_DMBS) {
+ if (!test_and_set_bit(sba_idx, ldev->sba_idx_mask))
+ break;
+ }
+ if (sba_idx == DIBS_LO_MAX_DMBS)
+ return -ENOSPC;
+
+ dmb_node = kzalloc(sizeof(*dmb_node), GFP_KERNEL);
+ if (!dmb_node) {
+ rc = -ENOMEM;
+ goto err_bit;
+ }
+
+ dmb_node->sba_idx = sba_idx;
+ dmb_node->len = dmb->dmb_len;
- dmb_node->cpu_addr = kzalloc(dmb_node->len, GFP_KERNEL |
- __GFP_NOWARN | __GFP_NORETRY |
- __GFP_NOMEMALLOC);
- if (!dmb_node->cpu_addr) {
++
++ /* not critical; fail under memory pressure and fallback to TCP */
++ folio = folio_alloc(GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC |
++ __GFP_NORETRY | __GFP_ZERO,
++ get_order(dmb_node->len));
++ if (!folio) {
+ rc = -ENOMEM;
+ goto err_node;
+ }
++ dmb_node->cpu_addr = folio_address(folio);
+ dmb_node->dma_addr = DIBS_DMA_ADDR_INVALID;
+ refcount_set(&dmb_node->refcnt, 1);
+
+ again:
+ /* add new dmb into hash table */
+ get_random_bytes(&dmb_node->token, sizeof(dmb_node->token));
+ write_lock_bh(&ldev->dmb_ht_lock);
+ hash_for_each_possible(ldev->dmb_ht, tmp_node, list, dmb_node->token) {
+ if (tmp_node->token == dmb_node->token) {
+ write_unlock_bh(&ldev->dmb_ht_lock);
+ goto again;
+ }
+ }
+ hash_add(ldev->dmb_ht, &dmb_node->list, dmb_node->token);
+ write_unlock_bh(&ldev->dmb_ht_lock);
+ atomic_inc(&ldev->dmb_cnt);
+
+ dmb->idx = dmb_node->sba_idx;
+ dmb->dmb_tok = dmb_node->token;
+ dmb->cpu_addr = dmb_node->cpu_addr;
+ dmb->dma_addr = dmb_node->dma_addr;
+ dmb->dmb_len = dmb_node->len;
+
+ spin_lock_irqsave(&dibs->lock, flags);
+ dibs->dmb_clientid_arr[sba_idx] = client->id;
+ spin_unlock_irqrestore(&dibs->lock, flags);
+
+ return 0;
+
+ err_node:
+ kfree(dmb_node);
+ err_bit:
+ clear_bit(sba_idx, ldev->sba_idx_mask);
+ return rc;
+ }
+
+ static void __dibs_lo_unregister_dmb(struct dibs_lo_dev *ldev,
+ struct dibs_lo_dmb_node *dmb_node)
+ {
+ /* remove dmb from hash table */
+ write_lock_bh(&ldev->dmb_ht_lock);
+ hash_del(&dmb_node->list);
+ write_unlock_bh(&ldev->dmb_ht_lock);
+
+ clear_bit(dmb_node->sba_idx, ldev->sba_idx_mask);
- kfree(dmb_node->cpu_addr);
++ folio_put(virt_to_folio(dmb_node->cpu_addr));
+ kfree(dmb_node);
+
+ if (atomic_dec_and_test(&ldev->dmb_cnt))
+ wake_up(&ldev->ldev_release);
+ }
+
+ static int dibs_lo_unregister_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb)
+ {
+ struct dibs_lo_dmb_node *dmb_node = NULL, *tmp_node;
+ struct dibs_lo_dev *ldev;
+ unsigned long flags;
+
+ ldev = dibs->drv_priv;
+
+ /* find dmb from hash table */
+ read_lock_bh(&ldev->dmb_ht_lock);
+ hash_for_each_possible(ldev->dmb_ht, tmp_node, list, dmb->dmb_tok) {
+ if (tmp_node->token == dmb->dmb_tok) {
+ dmb_node = tmp_node;
+ break;
+ }
+ }
+ read_unlock_bh(&ldev->dmb_ht_lock);
+ if (!dmb_node)
+ return -EINVAL;
+
+ if (refcount_dec_and_test(&dmb_node->refcnt)) {
+ spin_lock_irqsave(&dibs->lock, flags);
+ dibs->dmb_clientid_arr[dmb_node->sba_idx] = NO_DIBS_CLIENT;
+ spin_unlock_irqrestore(&dibs->lock, flags);
+
+ __dibs_lo_unregister_dmb(ldev, dmb_node);
+ }
+ return 0;
+ }
+
+ static int dibs_lo_support_dmb_nocopy(struct dibs_dev *dibs)
+ {
+ return DIBS_LO_SUPPORT_NOCOPY;
+ }
+
+ static int dibs_lo_attach_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb)
+ {
+ struct dibs_lo_dmb_node *dmb_node = NULL, *tmp_node;
+ struct dibs_lo_dev *ldev;
+
+ ldev = dibs->drv_priv;
+
+ /* find dmb_node according to dmb->dmb_tok */
+ read_lock_bh(&ldev->dmb_ht_lock);
+ hash_for_each_possible(ldev->dmb_ht, tmp_node, list, dmb->dmb_tok) {
+ if (tmp_node->token == dmb->dmb_tok) {
+ dmb_node = tmp_node;
+ break;
+ }
+ }
+ if (!dmb_node) {
+ read_unlock_bh(&ldev->dmb_ht_lock);
+ return -EINVAL;
+ }
+ read_unlock_bh(&ldev->dmb_ht_lock);
+
+ if (!refcount_inc_not_zero(&dmb_node->refcnt))
+ /* the dmb is being unregistered, but has
+ * not been removed from the hash table.
+ */
+ return -EINVAL;
+
+ /* provide dmb information */
+ dmb->idx = dmb_node->sba_idx;
+ dmb->dmb_tok = dmb_node->token;
+ dmb->cpu_addr = dmb_node->cpu_addr;
+ dmb->dma_addr = dmb_node->dma_addr;
+ dmb->dmb_len = dmb_node->len;
+ return 0;
+ }
+
+ static int dibs_lo_detach_dmb(struct dibs_dev *dibs, u64 token)
+ {
+ struct dibs_lo_dmb_node *dmb_node = NULL, *tmp_node;
+ struct dibs_lo_dev *ldev;
+
+ ldev = dibs->drv_priv;
+
+ /* find dmb_node according to dmb->dmb_tok */
+ read_lock_bh(&ldev->dmb_ht_lock);
+ hash_for_each_possible(ldev->dmb_ht, tmp_node, list, token) {
+ if (tmp_node->token == token) {
+ dmb_node = tmp_node;
+ break;
+ }
+ }
+ if (!dmb_node) {
+ read_unlock_bh(&ldev->dmb_ht_lock);
+ return -EINVAL;
+ }
+ read_unlock_bh(&ldev->dmb_ht_lock);
+
+ if (refcount_dec_and_test(&dmb_node->refcnt))
+ __dibs_lo_unregister_dmb(ldev, dmb_node);
+ return 0;
+ }
+
+ static int dibs_lo_move_data(struct dibs_dev *dibs, u64 dmb_tok,
+ unsigned int idx, bool sf, unsigned int offset,
+ void *data, unsigned int size)
+ {
+ struct dibs_lo_dmb_node *rmb_node = NULL, *tmp_node;
+ struct dibs_lo_dev *ldev;
+ u16 s_mask;
+ u8 client_id;
+ u32 sba_idx;
+
+ ldev = dibs->drv_priv;
+
+ read_lock_bh(&ldev->dmb_ht_lock);
+ hash_for_each_possible(ldev->dmb_ht, tmp_node, list, dmb_tok) {
+ if (tmp_node->token == dmb_tok) {
+ rmb_node = tmp_node;
+ break;
+ }
+ }
+ if (!rmb_node) {
+ read_unlock_bh(&ldev->dmb_ht_lock);
+ return -EINVAL;
+ }
+ memcpy((char *)rmb_node->cpu_addr + offset, data, size);
+ sba_idx = rmb_node->sba_idx;
+ read_unlock_bh(&ldev->dmb_ht_lock);
+
+ if (!sf)
+ return 0;
+
+ spin_lock(&dibs->lock);
+ client_id = dibs->dmb_clientid_arr[sba_idx];
+ s_mask = ror16(0x1000, idx);
+ if (likely(client_id != NO_DIBS_CLIENT && dibs->subs[client_id]))
+ dibs->subs[client_id]->ops->handle_irq(dibs, sba_idx, s_mask);
+ spin_unlock(&dibs->lock);
+
+ 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,
+ .max_dmbs = dibs_lo_max_dmbs,
+ .register_dmb = dibs_lo_register_dmb,
+ .unregister_dmb = dibs_lo_unregister_dmb,
+ .move_data = dibs_lo_move_data,
+ .support_mmapped_rdmb = dibs_lo_support_dmb_nocopy,
+ .attach_dmb = dibs_lo_attach_dmb,
+ .detach_dmb = dibs_lo_detach_dmb,
+ };
+
+ static void dibs_lo_dev_init(struct dibs_lo_dev *ldev)
+ {
+ rwlock_init(&ldev->dmb_ht_lock);
+ hash_init(ldev->dmb_ht);
+ atomic_set(&ldev->dmb_cnt, 0);
+ init_waitqueue_head(&ldev->ldev_release);
+ }
+
+ static void dibs_lo_dev_exit(struct dibs_lo_dev *ldev)
+ {
+ if (atomic_read(&ldev->dmb_cnt))
+ wait_event(ldev->ldev_release, !atomic_read(&ldev->dmb_cnt));
+ }
+
+ static int dibs_lo_dev_probe(void)
+ {
+ struct dibs_lo_dev *ldev;
+ struct dibs_dev *dibs;
+ int ret;
+
+ ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
+ if (!ldev)
+ return -ENOMEM;
+
+ dibs = dibs_dev_alloc();
+ if (!dibs) {
+ kfree(ldev);
+ return -ENOMEM;
+ }
+
+ ldev->dibs = dibs;
+ dibs->drv_priv = ldev;
+ dibs_lo_dev_init(ldev);
+ uuid_gen(&dibs->gid);
+ dibs->ops = &dibs_lo_ops;
+
+ dibs->dev.parent = NULL;
+ dev_set_name(&dibs->dev, "%s", dibs_lo_dev_name);
+
+ ret = dibs_dev_add(dibs);
+ if (ret)
+ goto err_reg;
+ lo_dev = ldev;
+ return 0;
+
+ err_reg:
+ kfree(dibs->dmb_clientid_arr);
+ /* pairs with dibs_dev_alloc() */
+ put_device(&dibs->dev);
+ kfree(ldev);
+
+ return ret;
+ }
+
+ static void dibs_lo_dev_remove(void)
+ {
+ if (!lo_dev)
+ return;
+
+ dibs_dev_del(lo_dev->dibs);
+ dibs_lo_dev_exit(lo_dev);
+ /* pairs with dibs_dev_alloc() */
+ put_device(&lo_dev->dibs->dev);
+ kfree(lo_dev);
+ lo_dev = NULL;
+ }
+
+ int dibs_loopback_init(void)
+ {
+ return dibs_lo_dev_probe();
+ }
+
+ void dibs_loopback_exit(void)
+ {
+ dibs_lo_dev_remove();
+ }
drivers/dibs/dibs_loopback.c +10 -5
@@ -12,6 +12,7 @@#include <linux/bitops.h> #include <linux/device.h> #include <linux/dibs.h> +#include <linux/mm.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/types.h>
@@ -49,6 +50,7 @@ static int dibs_lo_register_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb, {struct dibs_lo_dmb_node *dmb_node, *tmp_node;struct dibs_lo_dev *ldev; +struct folio *folio;unsigned long flags;int sba_idx, rc;
@@ -70,13 +72,16 @@ static int dibs_lo_register_dmb(struct dibs_dev *dibs, struct dibs_dmb *dmb, dmb_node->sba_idx = sba_idx; dmb_node->len = dmb->dmb_len; - dmb_node->cpu_addr =kzalloc (dmb_node->len,GFP_KERNEL | - __GFP_NOWARN | __GFP_NORETRY | - __GFP_NOMEMALLOC); -if (!dmb_node->cpu_addr) { + +/* not critical; fail under memory pressure and fallback to TCP */ + folio =folio_alloc (GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | + __GFP_NORETRY | __GFP_ZERO, +get_order (dmb_node->len)); +if (!folio) { rc = -ENOMEM ; goto err_node; } + dmb_node->cpu_addr =folio_address (folio); dmb_node->dma_addr =DIBS_DMA_ADDR_INVALID ;refcount_set (&dmb_node->refcnt,1 );
@@ -122,7 +127,7 @@ static void __dibs_lo_unregister_dmb(struct dibs_lo_dev *ldev,write_unlock_bh (&ldev->dmb_ht_lock);clear_bit (dmb_node->sba_idx, ldev->sba_idx_mask); -kfree (dmb_node->cpu_addr); +folio_put (virt_to_folio (dmb_node->cpu_addr));kfree (dmb_node);if (atomic_dec_and_test (&ldev->dmb_cnt))
Re: [PATCH net-next v3 13/14] dibs: Move data path to dibs layer: manual merge
Quoted 53 lines · Matthieu Baerts
Hi Alexandra, Sidraya,
Quoted 14 lines · Alexandra Winter
Use struct
dibs_dmbinstead of structsmc_dmband move the corresponding client tables todibs_dev. Leave driver specific implementation details like sba in the device drivers.Register and unregister dmbs via
dibs_dev_ops. A dmb is dedicated to a single client, but a dibs device can have dmbs for more than one client.Trigger dibs clients via
dibs_client_ops->handle_irq(), when data is received into a dmb. Fordibs_loopbackreplace scheduling an smcd receive tasklet with callingdibs_client_ops->handle_irq().For loopback devices
attach_dmb(),detach_dmb()andmove_data()need to access the dmb tables, so move those todibs_dev_opsin this patch as well.Quoted 6 lines
Remove remaining definitions of
smc_loopbackas they are no longer required, now that everything is indibs_loopback.Note that struct
ism_clientand structism_devare still required in smc until a follow-on patch moves event handling to dibs. (Loopback does not use events).FYI, we got a conflict when merging 'net' in 'net-next' in the MPTCP tree due to this patch applied in 'net':
a35c04de2565("net/smc: fix warning insmc_rx_splice()when callingget_page()")and this one from 'net-next':
cc21191b584c("dibs: Move data path to dibs layer")----- Generic Message -----
The best is to avoid conflicts between 'net' and 'net-next' trees but if they cannot be avoided when preparing patches, a note about how to fix them is much appreciated.
The conflict has been resolved on our side[1] and the resolution we suggest is attached to this email. Please report any issues linked to this conflict resolution as it might be used by others. If you worked on the mentioned patches, don't hesitate to ACK this conflict resolution.
---------------------------Regarding this conflict, I hope the resolution is correct. The patch from 'net' was modifying '
net/smc/smc_loopback.c' insmc_lo_register_dmb()and__smc_lo_unregister_dmb(). I applied the same modifications in 'drivers/dibs/dibs_loopback.c', indibs_lo_register_dmb()and__dibs_lo_unregister_dmb(). In net-next,kfree(cpu_addr)was used instead ofkvfree(cpu_addr), but this was done on purpose. Also, I had to includemm.hto be able to build this driver. I also attached a simple diff of the modifications I did.
Quoted 8 lines
Does that look OK to both of you?
Note: no rerere cache is available for this kind of conflicts.
Cheers,
Matt[1] https://github.com/multipath-tcp/mptcp_net-next/commit/af2dbdbb0a91
LGTM, thank you very much Matthieu.
Re: [PATCH net-next v3 13/14] dibs: Move data path to dibs layer: manual merge
In reply to Matthieu BaertsQuoted 53 lines · Matthieu Baerts
Hi Alexandra, Sidraya,
Quoted 14 lines · Alexandra Winter
Use struct
dibs_dmbinstead of structsmc_dmband move the corresponding client tables todibs_dev. Leave driver specific implementation details like sba in the device drivers.Register and unregister dmbs via
dibs_dev_ops. A dmb is dedicated to a single client, but a dibs device can have dmbs for more than one client.Trigger dibs clients via
dibs_client_ops->handle_irq(), when data is received into a dmb. Fordibs_loopbackreplace scheduling an smcd receive tasklet with callingdibs_client_ops->handle_irq().For loopback devices
attach_dmb(),detach_dmb()andmove_data()need to access the dmb tables, so move those todibs_dev_opsin this patch as well.Quoted 6 lines
Remove remaining definitions of
smc_loopbackas they are no longer required, now that everything is indibs_loopback.Note that struct
ism_clientand structism_devare still required in smc until a follow-on patch moves event handling to dibs. (Loopback does not use events).FYI, we got a conflict when merging 'net' in 'net-next' in the MPTCP tree due to this patch applied in 'net':
a35c04de2565("net/smc: fix warning insmc_rx_splice()when callingget_page()")and this one from 'net-next':
cc21191b584c("dibs: Move data path to dibs layer")----- Generic Message -----
The best is to avoid conflicts between 'net' and 'net-next' trees but if they cannot be avoided when preparing patches, a note about how to fix them is much appreciated.
The conflict has been resolved on our side[1] and the resolution we suggest is attached to this email. Please report any issues linked to this conflict resolution as it might be used by others. If you worked on the mentioned patches, don't hesitate to ACK this conflict resolution.
---------------------------Regarding this conflict, I hope the resolution is correct. The patch from 'net' was modifying '
net/smc/smc_loopback.c' insmc_lo_register_dmb()and__smc_lo_unregister_dmb(). I applied the same modifications in 'drivers/dibs/dibs_loopback.c', indibs_lo_register_dmb()and__dibs_lo_unregister_dmb(). In net-next,kfree(cpu_addr)was used instead ofkvfree(cpu_addr), but this was done on purpose. Also, I had to includemm.hto be able to build this driver. I also attached a simple diff of the modifications I did.
Quoted 8 lines
Does that look OK to both of you?
Note: no rerere cache is available for this kind of conflicts.
Cheers,
Matt[1] https://github.com/multipath-tcp/mptcp_net-next/commit/af2dbdbb0a91
LGTM, thank you Matthieu.
Jakub Kicinski
maintainerRe: [PATCH net-next v3 13/14] dibs: Move data path to dibs layer: manual merge
In reply to Matthieu BaertsQuoted 8 lines · On Wed, 24 Sep 2025 10:07:35 +0100 Matthieu Baerts wrote:
Regarding this conflict, I hope the resolution is correct. The patch from 'net' was modifying '
net/smc/smc_loopback.c' insmc_lo_register_dmb()and__smc_lo_unregister_dmb(). I applied the same modifications in 'drivers/dibs/dibs_loopback.c', indibs_lo_register_dmb()and__dibs_lo_unregister_dmb(). In net-next,kfree(cpu_addr)was used instead ofkvfree(cpu_addr), but this was done on purpose. Also, I had to includemm.hto be able to build this driver. I also attached a simple diff of the modifications I did.
Thanks a lot for sharing the resolutions!
Quoted 1 line
Note: no rerere cache is available for this kind of conflicts.
BTW have you figured out how to resolve that automatically? NIPA does trusts rerere but because it didn't work we were running without net for the last few days (knowingly) :(
Re: [PATCH net-next v3 13/14] dibs: Move data path to dibs layer: manual merge
Hi Jakub,
(Sorry for the delay, I was travelling)
Quoted 11 lines · Jakub Kicinski
Quoted 8 lines · On Wed, 24 Sep 2025 10:07:35 +0100 Matthieu Baerts wrote:
Regarding this conflict, I hope the resolution is correct. The patch from 'net' was modifying '
net/smc/smc_loopback.c' insmc_lo_register_dmb()and__smc_lo_unregister_dmb(). I applied the same modifications in 'drivers/dibs/dibs_loopback.c', indibs_lo_register_dmb()and__dibs_lo_unregister_dmb(). In net-next,kfree(cpu_addr)was used instead ofkvfree(cpu_addr), but this was done on purpose. Also, I had to includemm.hto be able to build this driver. I also attached a simple diff of the modifications I did.Thanks a lot for sharing the resolutions!
You are very welcome!
Quoted 5 lines
Quoted 1 line
Note: no rerere cache is available for this kind of conflicts.
BTW have you figured out how to resolve that automatically? NIPA does trusts rerere but because it didn't work we were running without net for the last few days (knowingly) :(
When I was in charge of supporting MPTCP on top of a few old stable kernels, and keeping new features in sync on all these kernels, I ended up automating the resolution of such conflicts. In my case, I was cherry-picking patches, and I could then simply take a fingerprint based on the 'git diff' output without the index and lines numbers. With the hash of the diff, I could either create or get the corresponding '.patch' file can be automatically applied with the 'patch' command to resolve the conflicts.
In your case, you are merging trees that are regularly changing, if I'm not mistaken. In this case, the fingerprint should not be based on everything pending during the merge, but I guess it should be possible to get a fingerprint, e.g. a diff showing the conflicts.
Note that in the MPTCP tree, we use 'TopGit' [1], and our tree is regularly synced with 'net' and 'net-next'. When there are conflicts, I only have to fix them once, because TopGit merges multiple branches and keep a continuous history. That's another solution, but it might not be adapted to NIPA's needs.
[1] https://mackyle.github.io/topgit/
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Alexandra Winter
maintainerPATCH v3 14/14 dibs: Move event handling to dibs layer
In reply to Alexandra WinterFrom: Julian Ruess <[email protected]>
Add defines for all event types and subtypes an ism device is known to produce as it can be helpful for debugging purposes.
Introduces a generic 'struct dibs_event' and adopt ism device driver and smc-d client accordingly. Tolerate and ignore other type and subtype values to enable future device extensions.
SMC-D and ISM are now independent.
struct ism_dev can be moved to drivers/s390/net/ism.h.
Note that in smc, the term 'ism' is still used. Future patches could replace that with 'dibs' or 'smc-d' as appropriate.
--- MAINTAINERS | 2 - arch/s390/configs/debug_defconfig | 1 + arch/s390/configs/defconfig | 1 + drivers/dibs/dibs_main.c | 2 +- drivers/s390/net/Kconfig | 1 - drivers/s390/net/ism.h | 42 +++++- drivers/s390/net/ism_drv.c | 221 ++++++++++-------------------- include/linux/dibs.h | 62 +++++++++ include/net/smc.h | 15 -- net/smc/Kconfig | 1 - net/smc/smc_ism.c | 99 +++++-------- 11 files changed, 208 insertions(+), 239 deletions(-)
MAINTAINERS +0 -2
@@ -17576,7 +17576,6 @@ F: include/linux/fddidevice.h F: include/linux/hippidevice.h F: include/linux/if_* F: include/linux/inetdevice.h -F: include/linux/ism.h F: include/linux/netdev* F: include/linux/platform_data/wiznet.h F: include/uapi/linux/cn_proc.h
@@ -22233,7 +22232,6 @@ L: [email protected] L: [email protected] S: Supported F: drivers/s390/net/ -F: include/linux/ism.h S390 PCI SUBSYSTEM M: Niklas Schnelle <[email protected]>
arch/s390/configs/debug_defconfig +1 -0
@@ -122,6 +122,7 @@ CONFIG_XFRM_USER=m CONFIG_NET_KEY=m CONFIG_DIBS=y CONFIG_DIBS_LO=y +CONFIG_SMC=m CONFIG_SMC_DIAG=m CONFIG_INET=y CONFIG_IP_MULTICAST=y
arch/s390/configs/defconfig +1 -0
@@ -113,6 +113,7 @@ CONFIG_XFRM_USER=m CONFIG_NET_KEY=m CONFIG_DIBS=y CONFIG_DIBS_LO=y +CONFIG_SMC=m CONFIG_SMC_DIAG=m CONFIG_INET=y CONFIG_IP_MULTICAST=y
drivers/dibs/dibs_main.c +1 -1
@@ -98,7 +98,7 @@ int dibs_unregister_client(struct dibs_client *client) goto err_reg_dmb; } } -/* Stop forwarding IRQs */ +/* Stop forwarding IRQs and events */ dibs->subs[client->id] =NULL ;spin_unlock_irqrestore (&dibs->lock, flags); clients[client->id]->ops->del_dev (dibs);
drivers/s390/net/Kconfig +0 -1
@@ -82,7 +82,6 @@ config CCWGROUP config ISM tristate "Support for ISM vPCI Adapter" depends on PCI && DIBS - imply SMC default n help Select this option if you want to use the Internal Shared Memory
drivers/s390/net/ism.h +40 -2
71 lines not on this page · raw message
drivers/s390/net/ism_drv.c +71 -150
293 lines not on this page · raw message
include/linux/dibs.h +62 -0
80 lines not on this page · raw message
include/net/smc.h +0 -15
@@ -16,7 +16,6 @@#include <linux/types.h> #include <linux/wait.h> #include <linux/dibs.h> -#include "linux/ism.h" struct sock ;
@@ -28,28 +27,14 @@ struct smc_hashinfo { };/* SMCD/ISM device driver interface */ -#define ISM_EVENT_DMB 0 -#define ISM_EVENT_GID 1 -#define ISM_EVENT_SWR 2 -#define ISM_RESERVED_VLANID 0x1FFF -struct smcd_dev ; -struct smcd_gid {u64 gid;u64 gid_ext; }; -struct smcd_ops { -/* optional operations */ -int (*signal_event)(struct smcd_dev *dev,struct smcd_gid *rgid, -u32 trigger_irq,u32 event_code,u64 info); -}; -struct smcd_dev { -const struct smcd_ops *ops; -void *priv;struct dibs_dev *dibs;struct list_head list;spinlock_t lock;
net/smc/Kconfig +0 -1
@@ -2,7 +2,6 @@ config SMC tristate "SMC socket protocol family" depends on INET && INFINIBAND && DIBS - depends on m || ISM != m help SMC-R provides a "sockets over RDMA" solution making use of RDMA over Converged Ethernet (RoCE) technology to upgrade
net/smc/smc_ism.c +32 -67
226 lines not on this page · raw message
Signature · 1 line
2.48.1
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Thu, 18 Sep 2025 13:04:46 +0200 you wrote:
This series introduces a generic abstraction of existing components like:
- the s390 specific ISM device (Internal Shared Memory),
- the SMC-D loopback mechanism (Shared Memory Communication - Direct)
- the client interface of the SMC-D module to the transport devices This generic shim layer can be extended with more devices, more clients and more features in the future.[...]
Here is the summary with links:
- [net-next,v3,01/14] net/smc: Remove error handling of unregister_dmb()
https://git.kernel.org/netdev/net-next/c/884eee8e43f3 - [net-next,v3,02/14] net/smc: Decouple sf and attached send_buf in smc_loopback https://git.kernel.org/netdev/net-next/c/a4997e17d137 - [net-next,v3,03/14] dibs: Create drivers/dibs https://git.kernel.org/netdev/net-next/c/35758b0032c0 - [net-next,v3,04/14] dibs: Register smc as dibs_client https://git.kernel.org/netdev/net-next/c/d324a2ca3f8e - [net-next,v3,05/14] dibs: Register ism as dibs device https://git.kernel.org/netdev/net-next/c/269726968f95 - [net-next,v3,06/14] dibs: Define dibs loopback https://git.kernel.org/netdev/net-next/c/cb990a45d7f6 - [net-next,v3,07/14] dibs: Define dibs_client_ops and dibs_dev_ops https://git.kernel.org/netdev/net-next/c/69baaac9361e - [net-next,v3,08/14] dibs: Move struct device to dibs_dev https://git.kernel.org/netdev/net-next/c/845c334a0186 - [net-next,v3,09/14] dibs: Create class dibs https://git.kernel.org/netdev/net-next/c/804737349813 - [net-next,v3,10/14] dibs: Local gid for dibs devices https://git.kernel.org/netdev/net-next/c/05e68d8dedf3 - [net-next,v3,11/14] dibs: Move vlan support to dibs_dev_ops https://git.kernel.org/netdev/net-next/c/92a0f7bb081d - [net-next,v3,12/14] dibs: Move query_remote_gid() to dibs_dev_ops https://git.kernel.org/netdev/net-next/c/719c3b67bb7e - [net-next,v3,13/14] dibs: Move data path to dibs layer https://git.kernel.org/netdev/net-next/c/cc21191b584c - [net-next,v3,14/14] dibs: Move event handling to dibs layer https://git.kernel.org/netdev/net-next/c/a612dbe8d04d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html