netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Talpey <tom@talpey.com>
To: Chuck Lever <cel@kernel.org>, jgg@nvidia.com
Cc: Chuck Lever <chuck.lever@oracle.com>,
	linux-rdma@vger.kernel.org, BMT@zurich.ibm.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH RFC] RDMA/core: Handle ARPHRD_NONE devices
Date: Fri, 2 Jun 2023 18:18:52 -0400	[thread overview]
Message-ID: <783511ce-8950-c52c-2351-eef8841c67da@talpey.com> (raw)
In-Reply-To: <168573386075.5660.5037682341906748826.stgit@oracle-102.nfsv4bat.org>

On 6/2/2023 3:24 PM, Chuck Lever wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> We would like to enable the use of siw on top of a VPN that is
> constructed and managed via a tun device. That hasn't worked up
> until now because ARPHRD_NONE devices (such as tun devices) have
> no GID for the RDMA/core to look up.
> 
> But it turns out that the egress device has already been picked for
> us. addr_handler() just has to do the right thing with it.
> 
> Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>   drivers/infiniband/core/cma.c |    4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 56e568fcd32b..3351dc5afa17 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -704,11 +704,15 @@ cma_validate_port(struct ib_device *device, u32 port,
>   		ndev = dev_get_by_index(dev_addr->net, bound_if_index);
>   		if (!ndev)
>   			return ERR_PTR(-ENODEV);
> +	} else if (dev_type == ARPHRD_NONE) {
> +		sgid_attr = rdma_get_gid_attr(device, port, 0);
> +		goto out;
>   	} else {
>   		gid_type = IB_GID_TYPE_IB;
>   	}
>   
>   	sgid_attr = rdma_find_gid_by_port(device, gid, gid_type, port, ndev);
> +out:
>   	dev_put(ndev);
>   	return sgid_attr;
>   }

I like it, but doesn't this test in siw_main.c also need to change?

static struct siw_device *siw_device_create(struct net_device *netdev)
{
...
-->	if (netdev->type != ARPHRD_LOOPBACK && netdev->type != ARPHRD_NONE) {
		addrconf_addr_eui48((unsigned char *)&base_dev->node_guid,
				    netdev->dev_addr);
	} else {
		/*
		 * This device does not have a HW address,
		 * but connection mangagement lib expects gid != 0
		 */
		size_t len = min_t(size_t, strlen(base_dev->name), 6);
		char addr[6] = { };

		memcpy(addr, base_dev->name, len);
		addrconf_addr_eui48((unsigned char *)&base_dev->node_guid,
				    addr);
	}


Tom.

  reply	other threads:[~2023-06-02 22:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-02 19:24 [PATCH RFC] RDMA/core: Handle ARPHRD_NONE devices Chuck Lever
2023-06-02 22:18 ` Tom Talpey [this message]
2023-06-03  0:33   ` Chuck Lever III
2023-06-03 13:51     ` Bernard Metzler
2023-06-03 13:53       ` Chuck Lever III
2023-06-03 13:55         ` Bernard Metzler
2023-06-05 19:05       ` Jason Gunthorpe
2023-06-06 15:48 ` Jason Gunthorpe
2023-06-06 20:15   ` Chuck Lever III
2023-06-06 23:17     ` Jason Gunthorpe
2023-06-07 14:48       ` Chuck Lever III

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=783511ce-8950-c52c-2351-eef8841c67da@talpey.com \
    --to=tom@talpey.com \
    --cc=BMT@zurich.ibm.com \
    --cc=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jgg@nvidia.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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).