linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Zhu Yanjun <yanjun.zhu@intel.com>
Cc: zyjzyj2000@gmail.com, dledford@redhat.com, jgg@ziepe.ca,
	linux-rdma@vger.kernel.org, Yi Zhang <yi.zhang@redhat.com>
Subject: Re: [PATCHv5 for-next 1/1] RDMA/rxe: Disable ipv6 features when ipv6.disable in cmdline
Date: Tue, 13 Apr 2021 13:48:55 +0300	[thread overview]
Message-ID: <YHV3F9gBeLnLvzn+@unreal> (raw)
In-Reply-To: <20210413234252.12209-1-yanjun.zhu@intel.com>

On Tue, Apr 13, 2021 at 07:42:52PM -0400, Zhu Yanjun wrote:
> From: Zhu Yanjun <zyjzyj2000@gmail.com>
> 
> When ipv6.disable=1 is set in cmdline, ipv6 is actually disabled
> in the stack. As such, the operations of ipv6 in RXE will fail.
> So ipv6 features in RXE should also be disabled in RXE.
> 
> Link: https://lore.kernel.org/linux-rdma/880d7b59-4b17-a44f-1a91-88257bfc3aaa@redhat.com/T/#t
> Fixes: 8700e3e7c4857 ("Soft RoCE driver")
> Reported-by: Yi Zhang <yi.zhang@redhat.com>
> Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
> ---
> V4->V5: Clean up signature block and remove error message
> V3->V4: Check the returned value instead of ipv6 module
> V2->V3: Remove print message
> V1->V2: Modify the pr_info messages
> ---
>  drivers/infiniband/sw/rxe/rxe_net.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c
> index 01662727dca0..984c3ac449bd 100644
> --- a/drivers/infiniband/sw/rxe/rxe_net.c
> +++ b/drivers/infiniband/sw/rxe/rxe_net.c
> @@ -208,7 +208,13 @@ static struct socket *rxe_setup_udp_tunnel(struct net *net, __be16 port,
>  	/* Create UDP socket */
>  	err = udp_sock_create(net, &udp_cfg, &sock);
>  	if (err < 0) {
> -		pr_err("failed to create udp socket. err = %d\n", err);
> +		/* If UDP tunnel over ipv6 fails with -EAFNOSUPPORT, the tunnel
> +		 * over ipv4 still works. This error message will not pop out.
> +		 * If UDP tunnle over ipv4 fails or other errors with ipv6
> +		 * tunnel, this error should pop out.
> +		 */
> +		if (!((err == -EAFNOSUPPORT) && (ipv6)))

You have too much brackets.

if (err != -EAFNOSUPPORT || !ipv6)))

> +			pr_err("failed to create udp socket. err = %d\n", err);
>  		return ERR_PTR(err);
>  	}
>  
> @@ -620,6 +626,11 @@ static int rxe_net_ipv6_init(void)
>  	recv_sockets.sk6 = rxe_setup_udp_tunnel(&init_net,
>  						htons(ROCE_V2_UDP_DPORT), true);
>  	if (IS_ERR(recv_sockets.sk6)) {
> +		/* Though IPv6 is not supported, IPv4 still needs to continue
> +		 */
> +		if (PTR_ERR(recv_sockets.sk6) == -EAFNOSUPPORT)
> +			return 0;
> +
>  		recv_sockets.sk6 = NULL;
>  		pr_err("Failed to create IPv6 UDP tunnel\n");
>  		return -1;
> -- 
> 2.27.0
> 

  reply	other threads:[~2021-04-13 10:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 23:42 [PATCHv5 for-next 1/1] RDMA/rxe: Disable ipv6 features when ipv6.disable in cmdline Zhu Yanjun
2021-04-13 10:48 ` Leon Romanovsky [this message]
2021-04-14  3:46   ` Zhu Yanjun
2021-04-13 13:56 ` Kamal Heib
2021-04-13 14:39   ` Leon Romanovsky
2021-04-13 19:34     ` Kamal Heib
2021-04-15 14:53       ` Zhu Yanjun

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=YHV3F9gBeLnLvzn+@unreal \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=yanjun.zhu@intel.com \
    --cc=yi.zhang@redhat.com \
    --cc=zyjzyj2000@gmail.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).