public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Gerd Bayer <gbayer@linux.ibm.com>
To: Wen Gu <guwen@linux.alibaba.com>,
	wintera@linux.ibm.com, twinkler@linux.ibm.com, hca@linux.ibm.com,
	gor@linux.ibm.com, agordeev@linux.ibm.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	wenjia@linux.ibm.com, jaka@linux.ibm.com
Cc: borntraeger@linux.ibm.com, svens@linux.ibm.com,
	alibuda@linux.alibaba.com, tonylu@linux.alibaba.com,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [RFC PATCH net-next v5 02/11] net/smc: introduce loopback-ism for SMC intra-OS shortcut
Date: Wed, 03 Apr 2024 13:27:54 +0200	[thread overview]
Message-ID: <a9e1cdfba05279c36b7b85f327af66cf497d42b9.camel@linux.ibm.com> (raw)
In-Reply-To: <20240324135522.108564-3-guwen@linux.alibaba.com>

On Sun, 2024-03-24 at 21:55 +0800, Wen Gu wrote:
> Configuration of this feature is managed through the config SMC_LO.

Hi Wen,

you could omit building smc_loopback.o if CONFIG_SMC_LO was not set if
you included the following fixup-patch. I think it's cleaner to put a
few parts of net/smc/af_smc.c under conditional compile rather than
have most of the contents of net/smc/smc_loopback.c under #ifdef.

From 11a9cfce550f0c4df10eafdd30aa4226d4d522a8 Mon Sep 17 00:00:00 2001
From: Gerd Bayer <gbayer@linux.ibm.com>
Date: Wed, 3 Apr 2024 11:43:36 +0200
Subject: [PATCH] fixup! net/smc: introduce loopback-ism for SMC intra-
OS
 shortcut

---
 net/smc/Makefile       | 5 +++--
 net/smc/af_smc.c       | 6 ++++++
 net/smc/smc_loopback.c | 8 --------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/net/smc/Makefile b/net/smc/Makefile
index a8c37111abe1..3b73c9d561bb 100644
--- a/net/smc/Makefile
+++ b/net/smc/Makefile
@@ -4,5 +4,6 @@ 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_loopback.o
-smc-$(CONFIG_SYSCTL) += smc_sysctl.o
+smc-y += smc_tracepoint.o
+smc-$(CONFIG_SMC_LO)	+= smc_loopback.o
+smc-$(CONFIG_SYSCTL)	+= smc_sysctl.o
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index fce7a5b2ce5c..bcbf600cd271 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -3574,11 +3574,13 @@ static int __init smc_init(void)
 		goto out_sock;
 	}
 
+#if IS_ENABLED(CONFIG_SMC_LO)
 	rc = smc_loopback_init();
 	if (rc) {
 		pr_err("%s: smc_loopback_init fails with %d\n",
__func__, rc);
 		goto out_ib;
 	}
+#endif
 
 	rc = tcp_register_ulp(&smc_ulp_ops);
 	if (rc) {
@@ -3590,8 +3592,10 @@ static int __init smc_init(void)
 	return 0;
 
 out_lo:
+#if IS_ENABLED(CONFIG_SMC_LO)
 	smc_loopback_exit();
 out_ib:
+#endif
 	smc_ib_unregister_client();
 out_sock:
 	sock_unregister(PF_SMC);
@@ -3628,7 +3632,9 @@ static void __exit smc_exit(void)
 	tcp_unregister_ulp(&smc_ulp_ops);
 	sock_unregister(PF_SMC);
 	smc_core_exit();
+#if IS_ENABLED(CONFIG_SMC_LO)
 	smc_loopback_exit();
+#endif
 	smc_ib_unregister_client();
 	smc_ism_exit();
 	destroy_workqueue(smc_close_wq);
diff --git a/net/smc/smc_loopback.c b/net/smc/smc_loopback.c
index 994fe39930ad..8d0181635ded 100644
--- a/net/smc/smc_loopback.c
+++ b/net/smc/smc_loopback.c
@@ -19,7 +19,6 @@
 #include "smc_ism.h"
 #include "smc_loopback.h"
 
-#if IS_ENABLED(CONFIG_SMC_LO)
 #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)
@@ -442,20 +441,13 @@ static void smc_lo_dev_remove(void)
 	smc_lo_dev_exit(lo_dev);
 	put_device(&lo_dev->dev); /* device_initialize in
smc_lo_dev_probe */
 }
-#endif
 
 int smc_loopback_init(void)
 {
-#if IS_ENABLED(CONFIG_SMC_LO)
 	return smc_lo_dev_probe();
-#else
-	return 0;
-#endif
 }
 
 void smc_loopback_exit(void)
 {
-#if IS_ENABLED(CONFIG_SMC_LO)
 	smc_lo_dev_remove();
-#endif
 }
-- 
2.40.1


Even nicer would be, if smc_loopback_init() and smc_loopback_exit()
would have an NO-OP implementation { } straight in
net/smc/smc_loopback.h if CONFIG_SMC_LO was not enabled. That way, one
could leave out the #if ENABLED's in net/smc/af_smc.c entirely.

I think that's more kernel-style like...
Gerd

  reply	other threads:[~2024-04-03 11:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-24 13:55 [RFC PATCH net-next v5 00/11] net/smc: SMC intra-OS shortcut with loopback-ism Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 01/11] net/smc: decouple ism_client from SMC-D DMB registration Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 02/11] net/smc: introduce loopback-ism for SMC intra-OS shortcut Wen Gu
2024-04-03 11:27   ` Gerd Bayer [this message]
2024-04-04  8:46     ` Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 03/11] net/smc: implement ID-related operations of loopback-ism Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 04/11] net/smc: implement some unsupported " Wen Gu
2024-04-03 16:25   ` Gerd Bayer
2024-04-04  9:32     ` Wen Gu
2024-04-04 11:42       ` Niklas Schnelle
2024-04-04 13:12         ` Wen Gu
2024-04-04 15:15           ` Niklas Schnelle
2024-04-09  1:44             ` Wen Gu
2024-04-11 11:12               ` Alexandra Winter
2024-04-12  2:02                 ` Wen Gu
2024-04-12 12:20                   ` Wenjia Zhang
2024-04-12 14:58                   ` Alexandra Winter
2024-03-24 13:55 ` [RFC PATCH net-next v5 05/11] net/smc: implement DMB-related " Wen Gu
2024-04-03 17:20   ` Gerd Bayer
2024-04-04 10:20     ` Wen Gu
2024-04-04 11:27       ` Niklas Schnelle
2024-04-04 13:44         ` Wen Gu
2024-04-04 15:24           ` Niklas Schnelle
2024-03-24 13:55 ` [RFC PATCH net-next v5 06/11] net/smc: ignore loopback-ism when dumping SMC-D devices Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 07/11] net/smc: register loopback-ism into SMC-D device list Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 08/11] net/smc: add operations to merge sndbuf with peer DMB Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 09/11] net/smc: {at|de}tach sndbuf to peer DMB if supported Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 10/11] net/smc: adapt cursor update when sndbuf and peer DMB are merged Wen Gu
2024-03-24 13:55 ` [RFC PATCH net-next v5 11/11] net/smc: implement DMB-merged operations of loopback-ism Wen Gu
2024-04-03  6:35 ` [RFC PATCH net-next v5 00/11] net/smc: SMC intra-OS shortcut with loopback-ism Wen Gu
2024-04-03 11:10   ` Gerd Bayer
2024-04-04 10:27     ` Wen Gu
2024-04-11  7:45     ` Wen Gu
2024-04-11  9:32       ` Wenjia Zhang
2024-04-11  9:56         ` 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=a9e1cdfba05279c36b7b85f327af66cf497d42b9.camel@linux.ibm.com \
    --to=gbayer@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gor@linux.ibm.com \
    --cc=guwen@linux.alibaba.com \
    --cc=hca@linux.ibm.com \
    --cc=jaka@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=svens@linux.ibm.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=twinkler@linux.ibm.com \
    --cc=wenjia@linux.ibm.com \
    --cc=wintera@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