From: Simon Horman <simon.horman@corigine.com>
To: Wen Gu <guwen@linux.alibaba.com>
Cc: kgraul@linux.ibm.com, wenjia@linux.ibm.com, jaka@linux.ibm.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-s390@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH net-next v5 4/9] net/smc: Introduce SMC-D loopback device
Date: Fri, 28 Apr 2023 16:45:03 +0200 [thread overview]
Message-ID: <ZEvb7wYWoTySzU9O@corigine.com> (raw)
In-Reply-To: <1682252271-2544-5-git-send-email-guwen@linux.alibaba.com>
On Sun, Apr 23, 2023 at 08:17:46PM +0800, Wen Gu wrote:
> This patch introduces a kind of loopback device for SMC-D, thus
> enabling the SMC communication between two local sockets within
> one OS instance.
>
> The loopback device supports basic capabilities defined by SMC-D
> options, and exposed as an SMC-D v2 device.
>
> The GID of loopback device is random generated, CHID is 0xFFFF
> and SEID is SMCD_DEFAULT_V2_SEID.
>
> TODO:
> - The hierarchy preference of coexistent SMC-D devices.
>
> Signed-off-by: Wen Gu <guwen@linux.alibaba.com>
> ---
> include/net/smc.h | 6 +
> net/smc/Makefile | 2 +-
> net/smc/af_smc.c | 12 +-
> net/smc/smc_cdc.c | 9 +-
> net/smc/smc_cdc.h | 1 +
> net/smc/smc_ism.h | 2 +
> net/smc/smc_loopback.c | 406 +++++++++++++++++++++++++++++++++++++++++++++++++
> net/smc/smc_loopback.h | 51 +++++++
> 8 files changed, 486 insertions(+), 3 deletions(-)
> create mode 100644 net/smc/smc_loopback.c
> create mode 100644 net/smc/smc_loopback.h
>
> diff --git a/include/net/smc.h b/include/net/smc.h
> index 26206d2..021ca42 100644
> --- a/include/net/smc.h
> +++ b/include/net/smc.h
> @@ -41,6 +41,12 @@ struct smcd_dmb {
> dma_addr_t dma_addr;
> };
>
> +struct smcd_seid {
> + u8 seid_string[24];
> + u8 serial_number[4];
> + u8 type[4];
> +};
> +
> #define ISM_EVENT_DMB 0
> #define ISM_EVENT_GID 1
> #define ISM_EVENT_SWR 2
> diff --git a/net/smc/Makefile b/net/smc/Makefile
> index 875efcd..a8c3711 100644
> --- a/net/smc/Makefile
> +++ b/net/smc/Makefile
> @@ -4,5 +4,5 @@ obj-$(CONFIG_SMC) += smc.o
> obj-$(CONFIG_SMC_DIAG) += smc_diag.o
> 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-y += smc_tracepoint.o smc_loopback.o
> smc-$(CONFIG_SYSCTL) += smc_sysctl.o
> diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
> index 50c38b6..3230309 100644
> --- a/net/smc/af_smc.c
> +++ b/net/smc/af_smc.c
> @@ -53,6 +53,7 @@
> #include "smc_stats.h"
> #include "smc_tracepoint.h"
> #include "smc_sysctl.h"
> +#include "smc_loopback.h"
>
> static DEFINE_MUTEX(smc_server_lgr_pending); /* serialize link group
> * creation on server
> @@ -3482,15 +3483,23 @@ 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_ib;
> + goto out_lo;
> }
>
> static_branch_enable(&tcp_have_smc);
> return 0;
>
> +out_lo:
> + smc_loopback_exit();
> out_ib:
> smc_ib_unregister_client();
> out_sock:
> @@ -3528,6 +3537,7 @@ 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);
> diff --git a/net/smc/smc_cdc.c b/net/smc/smc_cdc.c
> index 89105e9..2f79bac 100644
> --- a/net/smc/smc_cdc.c
> +++ b/net/smc/smc_cdc.c
> @@ -410,7 +410,14 @@ static void smc_cdc_msg_recv(struct smc_sock *smc, struct smc_cdc_msg *cdc)
> */
> static void smcd_cdc_rx_tsklet(struct tasklet_struct *t)
> {
> - struct smc_connection *conn = from_tasklet(conn, t, rx_tsklet);
> + struct smc_connection *conn =
> + from_tasklet(conn, t, rx_tsklet);
nit: I think the above can be on one line, as it was before this patch.
> +
> + smcd_cdc_rx_handler(conn);
> +}
> +
> +void smcd_cdc_rx_handler(struct smc_connection *conn)
> +{
> struct smcd_cdc_msg *data_cdc;
> struct smcd_cdc_msg cdc;
> struct smc_sock *smc;
> diff --git a/net/smc/smc_cdc.h b/net/smc/smc_cdc.h
> index 696cc11..11559d4 100644
> --- a/net/smc/smc_cdc.h
> +++ b/net/smc/smc_cdc.h
> @@ -301,5 +301,6 @@ int smcr_cdc_msg_send_validation(struct smc_connection *conn,
> struct smc_wr_buf *wr_buf);
> int smc_cdc_init(void) __init;
> void smcd_cdc_rx_init(struct smc_connection *conn);
> +void smcd_cdc_rx_handler(struct smc_connection *conn);
>
> #endif /* SMC_CDC_H */
> diff --git a/net/smc/smc_ism.h b/net/smc/smc_ism.h
> index 14d2e77..d18c50a 100644
> --- a/net/smc/smc_ism.h
> +++ b/net/smc/smc_ism.h
> @@ -15,6 +15,8 @@
>
> #include "smc.h"
>
> +#define S390_ISM_IDENT_MASK 0x00FFFF
nit: I think GENMASK is appropriate here.
> +
> struct smcd_dev_list { /* List of SMCD devices */
> struct list_head list;
> struct mutex mutex; /* Protects list of devices */
...
next prev parent reply other threads:[~2023-04-28 14:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 12:17 [RFC PATCH net-next v5 0/9] net/smc: Introduce SMC-D-based OS internal communication acceleration Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 1/9] net/smc: Decouple ism_dev from SMC-D device dump Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 2/9] net/smc: Decouple ism_dev from SMC-D DMB registration Wen Gu
2023-04-28 14:40 ` Simon Horman
2023-05-04 6:22 ` Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 3/9] net/smc: Extract v2 check helper from SMC-D device registration Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 4/9] net/smc: Introduce SMC-D loopback device Wen Gu
2023-04-28 14:45 ` Simon Horman [this message]
2023-04-23 12:17 ` [RFC PATCH net-next v5 5/9] net/smc: Introduce an interface for getting DMB attribute Wen Gu
2023-04-28 15:08 ` Simon Horman
2023-04-23 12:17 ` [RFC PATCH net-next v5 6/9] net/smc: Introudce interfaces for DMB attach and detach Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 7/9] net/smc: Avoid data copy from sndbuf to peer RMB in SMC-D Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 8/9] net/smc: Modify cursor update logic when using mappable DMB Wen Gu
2023-04-23 12:17 ` [RFC PATCH net-next v5 9/9] net/smc: Add interface implementation of loopback device Wen Gu
2023-05-10 2:02 ` [RFC PATCH net-next v5 0/9] net/smc: Introduce SMC-D-based OS internal communication acceleration Wen Gu
2023-05-10 9:56 ` Jan Karcher
2023-05-10 11:59 ` Wen Gu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEvb7wYWoTySzU9O@corigine.com \
--to=simon.horman@corigine.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=guwen@linux.alibaba.com \
--cc=jaka@linux.ibm.com \
--cc=kgraul@linux.ibm.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=wenjia@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).