On Wed Jan 15, 2025 at 8:55 PM CET, Alexandra Winter wrote: > The first stage of ism_loopback was implemented as part of the > SMC module [1]. Now that we have the ism layer, provide > access to the ism_loopback device to all ism clients. > > Move ism_loopback.* from net/smc to net/ism. > The following changes are required to ism_loopback.c: > - Change ism_lo_move_data() to no longer schedule an smcd receive tasklet, > but instead call ism_client->handle_irq(). > Note: In this RFC patch ism_loppback is not fully generic. > The smc-d client uses attached buffers, for moves without signalling. > and not-attached buffers for moves with signalling. > ism_lo_move_data() must not rely on that assumption. > ism_lo_move_data() must be able to handle more than one ism client. > > In addition the following changes are required to unify ism_loopback and > ism_vp: > > In ism layer and ism_vpci: > ism_loopback is not backed by a pci device, so use dev instead of pdev in > ism_dev. > > In smc-d: > in smcd_alloc_dev(): > - use kernel memory instead of device memory for smcd_dev and smcd->conn. > An alternative would be to ask device to alloc the memory. > - use different smcd_ops and max_dmbs for ism_vp and ism_loopback. > A future patch can change smc-d to directly use ism_ops instead of > smcd_ops. > - use ism dev_name instead of pci dev name for ism_evt_wq name > - allocate an event workqueue for ism_loopback, although it currently does > not generate events. > > Link: https://lore.kernel.org/linux-kernel//20240428060738.60843-1-guwen@xxxxxxxxxxxxxxxxx/ [1] > > Signed-off-by: Alexandra Winter <wintera@xxxxxxxxxxxxx> > --- > drivers/s390/net/ism.h | 6 +- > drivers/s390/net/ism_drv.c | 31 ++- > include/linux/ism.h | 59 +++++ > include/net/smc.h | 4 +- > net/ism/Kconfig | 13 ++ > net/ism/Makefile | 1 + > net/ism/ism_loopback.c | 366 +++++++++++++++++++++++++++++++ > net/ism/ism_loopback.h | 59 +++++ > net/ism/ism_main.c | 11 +- > net/smc/Kconfig | 13 -- > net/smc/Makefile | 1 - > net/smc/af_smc.c | 12 +- > net/smc/smc_ism.c | 108 +++++++--- > net/smc/smc_loopback.c | 427 ------------------------------------- > net/smc/smc_loopback.h | 60 ------ > 15 files changed, 606 insertions(+), 565 deletions(-) > create mode 100644 net/ism/ism_loopback.c > create mode 100644 net/ism/ism_loopback.h > delete mode 100644 net/smc/smc_loopback.c > delete mode 100644 net/smc/smc_loopback.h > ... > diff --git a/net/ism/ism_loopback.c b/net/ism/ism_loopback.c > new file mode 100644 > index 000000000000..47e5ef355dd7 > --- /dev/null > +++ b/net/ism/ism_loopback.c > @@ -0,0 +1,366 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Functions for loopback-ism device. > + * > + * Copyright (c) 2024, Alibaba Inc. > + * > + * Author: Wen Gu <guwen@xxxxxxxxxxxxxxxxx> > + * Tony Lu <tonylu@xxxxxxxxxxxxxxxxx> > + * > + */ > + > +#include <linux/bitops.h> > +#include <linux/device.h> > +#include <linux/ism.h> > +#include <linux/spinlock.h> > +#include <linux/types.h> > + > +#include "ism_loopback.h" > + > +#define ISM_LO_V2_CAPABLE 0x1 /* loopback-ism acts as ISMv2 */ > +#define ISM_LO_SUPPORT_NOCOPY 0x1 > +#define ISM_DMA_ADDR_INVALID (~(dma_addr_t)0) > + > +static const char ism_lo_dev_name[] = "loopback-ism"; > +/* global loopback device */ > +static struct ism_lo_dev *lo_dev; > + > +static int ism_lo_query_rgid(struct ism_dev *ism, uuid_t *rgid, > + u32 vid_valid, u32 vid) > +{ > + /* rgid should be the same as lgid; vlan is not supported */ > + if (!vid_valid && uuid_equal(rgid, &ism->gid)) > + return 0; > + return -ENETUNREACH; > +} This vid_valid check breaks ism-loopback for me.