public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Ratheesh Kannoth <rkannoth@marvell.com>
To: "D. Wythe" <alibuda@linux.alibaba.com>
Cc: <kgraul@linux.ibm.com>, <wenjia@linux.ibm.com>,
	<jaka@linux.ibm.com>, <wintera@linux.ibm.com>,
	<guwen@linux.alibaba.com>, <kuba@kernel.org>,
	<davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-s390@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
	<tonylu@linux.alibaba.com>, <pabeni@redhat.com>,
	<edumazet@google.com>
Subject: Re: [PATCH net-next v5 3/3] net/smc: Introduce IPPROTO_SMC
Date: Mon, 3 Jun 2024 09:19:01 +0530	[thread overview]
Message-ID: <20240603034901.GA3254291@maili.marvell.com> (raw)
In-Reply-To: <1717061440-59937-4-git-send-email-alibuda@linux.alibaba.com>

On 2024-05-30 at 15:00:40, D. Wythe (alibuda@linux.alibaba.com) wrote:
> From: "D. Wythe" <alibuda@linux.alibaba.com>
>
> +
> +int __init smc_inet_init(void)
> +{
> +	int rc;
> +
> +	rc = proto_register(&smc_inet_prot, 1);
> +	if (rc) {
> +		pr_err("%s: proto_register smc_inet_prot fails with %d\n", __func__, rc);
> +		return rc;
> +	}
> +	/* no return value */
> +	inet_register_protosw(&smc_inet_protosw);
> +
> +#if IS_ENABLED(CONFIG_IPV6)
> +	rc = proto_register(&smc_inet6_prot, 1);
> +	if (rc) {
> +		pr_err("%s: proto_register smc_inet6_prot fails with %d\n", __func__, rc);
> +		goto out_inet6_prot;
> +	}
> +	rc = inet6_register_protosw(&smc_inet6_protosw);
> +	if (rc) {
> +		pr_err("%s: inet6_register_protosw smc_inet6_protosw fails with %d\n",
> +		       __func__, rc);
> +		goto out_inet6_protosw;
> +	}
> +#endif /* CONFIG_IPV6 */
> +
> +	return rc;
> +#if IS_ENABLED(CONFIG_IPV6)
Can you combine this #if with above one ? Any way you need this only in case of ipv6.
Error handling with #if is an hindrance to a good readability.

> +out_inet6_protosw:
> +	proto_unregister(&smc_inet6_prot);
> +out_inet6_prot:
> +	inet_unregister_protosw(&smc_inet_protosw);
> +	proto_unregister(&smc_inet_prot);
> +	return rc;
> +#endif /* CONFIG_IPV6 */
> +}
> +
> +void smc_inet_exit(void)
> +{
> +#if IS_ENABLED(CONFIG_IPV6)
> +	inet6_unregister_protosw(&smc_inet6_protosw);
> +	proto_unregister(&smc_inet6_prot);
> +#endif /* CONFIG_IPV6 */
> +	inet_unregister_protosw(&smc_inet_protosw);
> +	proto_unregister(&smc_inet_prot);
> +}
> diff --git a/net/smc/smc_inet.h b/net/smc/smc_inet.h
> new file mode 100644
> index 00000000..a489c8a
> --- /dev/null
> +++ b/net/smc/smc_inet.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + *  Shared Memory Communications over RDMA (SMC-R) and RoCE
> + *
> + *  Definitions for the IPPROTO_SMC (socket related)
> +
> + *  Copyright IBM Corp. 2016
> + *  Copyright (c) 2024, Alibaba Inc.
> + *
> + *  Author: D. Wythe <alibuda@linux.alibaba.com>
> + */
> +#ifndef __INET_SMC
> +#define __INET_SMC
> +
> +/* Initialize protocol registration on IPPROTO_SMC,
> + * @return 0 on success
> + */
> +int smc_inet_init(void);
> +
> +void smc_inet_exit(void);
> +
> +#endif /* __INET_SMC */
> --
> 1.8.3.1
>

  reply	other threads:[~2024-06-03  3:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30  9:30 [PATCH net-next v5 0/3] Introduce IPPROTO_SMC D. Wythe
2024-05-30  9:30 ` [PATCH net-next v5 1/3] net/smc: refactoring initialization of smc sock D. Wythe
2024-05-30  9:30 ` [PATCH net-next v5 2/3] net/smc: expose smc proto operations D. Wythe
2024-05-30  9:30 ` [PATCH net-next v5 3/3] net/smc: Introduce IPPROTO_SMC D. Wythe
2024-06-03  3:49   ` Ratheesh Kannoth [this message]
2024-06-03 14:43     ` D. Wythe
2024-05-30 10:14 ` [PATCH net-next v5 0/3] " D. Wythe
2024-05-31  8:06   ` Wenjia Zhang
2024-06-03  3:01     ` D. Wythe
2024-06-03  7:48   ` Niklas Schnelle
2024-06-03 15:07     ` D. Wythe
2024-06-04 11:32       ` Niklas Schnelle

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=20240603034901.GA3254291@maili.marvell.com \
    --to=rkannoth@marvell.com \
    --cc=alibuda@linux.alibaba.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-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tonylu@linux.alibaba.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