From: Leon Romanovsky <leon@kernel.org>
To: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next] RDMA/core: Add rdma_dev_to_netns()
Date: Wed, 7 Oct 2020 14:14:03 +0300 [thread overview]
Message-ID: <20201007111403.GC3678159@unreal> (raw)
In-Reply-To: <20201007090355.1101408-1-ka-cheong.poon@oracle.com>
On Wed, Oct 07, 2020 at 02:03:55AM -0700, Ka-Cheong Poon wrote:
> This function returns the namespace of a struct ib_device if the RDMA
> subsystem is in exclusive network namespace mode. If the subsystem is
> in shared namespace mode, this function returns NULL.
>
> Signed-off-by: Ka-Cheong Poon <ka-cheong.poon@oracle.com>
> ---
> drivers/infiniband/core/device.c | 16 ++++++++++++++++
> include/rdma/ib_verbs.h | 1 +
> 2 files changed, 17 insertions(+)
We don't merge functions without users.
Thanks
>
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index c36b4d2b61e0..a3dd95bf3050 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -144,6 +144,22 @@ bool rdma_dev_access_netns(const struct ib_device *dev, const struct net *net)
> }
> EXPORT_SYMBOL(rdma_dev_access_netns);
>
> +/**
> + * rdma_dev_to_netns() - Return the net namespace of a given device if the
> + * RDMA subsystem is in exclusive network namespace
> + * mode. If it is in shared namespace mode, this
> + * function returns NULL. Caller can use it to
> + * differentiate the two modes of the RDMA subsystem.
> + *
> + * @device: Pointer to rdma device to get the namespace
> + */
> +struct net *rdma_dev_to_netns(const struct ib_device *device)
> +{
> + return ib_devices_shared_netns ? NULL :
> + read_pnet(&device->coredev.rdma_net);
> +}
> +EXPORT_SYMBOL(rdma_dev_to_netns);
> +
> /*
> * xarray has this behavior where it won't iterate over NULL values stored in
> * allocated arrays. So we need our own iterator to see all values stored in
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index c0b2fa7e9b95..aeced1a3324f 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -4715,6 +4715,7 @@ static inline struct ib_device *rdma_device_to_ibdev(struct device *device)
>
> bool rdma_dev_access_netns(const struct ib_device *device,
> const struct net *net);
> +struct net *rdma_dev_to_netns(const struct ib_device *device);
>
> #define IB_ROCE_UDP_ENCAP_VALID_PORT_MIN (0xC000)
> #define IB_GRH_FLOWLABEL_MASK (0x000FFFFF)
> --
> 2.18.4
>
prev parent reply other threads:[~2020-10-07 11:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-07 9:03 [PATCH rdma-next] RDMA/core: Add rdma_dev_to_netns() Ka-Cheong Poon
2020-10-07 11:14 ` Leon Romanovsky [this message]
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=20201007111403.GC3678159@unreal \
--to=leon@kernel.org \
--cc=ka-cheong.poon@oracle.com \
--cc=linux-rdma@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.