From: "ira.weiny" <ira.weiny@intel•com>
To: Michael Wang <yun.wang@profitbricks•com>
Cc: Roland Dreier <roland@kernel•org>,
Sean Hefty <sean.hefty@intel•com>,
Hal Rosenstock <hal.rosenstock@gmail•com>,
linux-rdma@vger•kernel.org, linux-kernel@vger•kernel.org,
linux-nfs@vger•kernel.org, netdev@vger•kernel.org,
"J. Bruce Fields" <bfields@fieldses•org>,
Trond Myklebust <trond.myklebust@primarydata•com>,
"David S. Miller" <davem@davemloft•net>,
Or Gerlitz <ogerlitz@mellanox•com>,
Moni Shoua <monis@mellanox•com>,
PJ Waskiewicz <pj.waskiewicz@solidfire•com>,
Tatyana Nikolova <Tatyana.E.Nikolova@intel•com>,
Yan Burman <yanb@mellanox•com>,
Jack Morgenstein <jackm@dev•mellanox.co.il>,
Bart Van Assche <bvanassche@acm•org>,
Yann Droneaud <ydroneaud@opteya•com>,
Colin Ian King <colin.king@canonical•com>,
Majd Dibbiny <majd@mellanox•com>, Jiri Kosina <jkosina@suse•cz>,
Matan Barak <matanb@mellanox•com>,
Alex Estrin <alex.estrin@intel•com>, Doug Ledford <dledford@
Subject: Re: [RFC PATCH 06/11] IB/Verbs: Use management helper has_sa() and cap_sa(), for sa-check
Date: Fri, 27 Mar 2015 12:47:56 -0400 [thread overview]
Message-ID: <20150327164756.GA27862@phlsvsds.ph.intel.com> (raw)
In-Reply-To: <55157B43.6060507@profitbricks.com>
On Fri, Mar 27, 2015 at 04:46:11PM +0100, Michael Wang wrote:
>
> Introduce helper has_sa() and cap_sa() to help us check if an IB device
> or it's port support Subnet Administrator.
I think these 2 should be combined. The question is if a port requires the use
of the SA depending on the network it is connected to.
Aren't some dual port Mellanox cards capable of doing IB on 1 port and Eth on
the other? Do they show up as 2 devices?
Regardless I think we should define the SA access on a per port basis.
>
> Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch•com>
> Cc: Doug Ledford <dledford@redhat•com>
> Cc: Ira Weiny <ira.weiny@intel•com>
> Cc: Sean Hefty <sean.hefty@intel•com>
> Signed-off-by: Michael Wang <yun.wang@profitbricks•com>
> ---
> drivers/infiniband/core/sa_query.c | 12 ++++++------
> include/rdma/ib_verbs.h | 28 ++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
> index d95d25f..89c27da 100644
> --- a/drivers/infiniband/core/sa_query.c
> +++ b/drivers/infiniband/core/sa_query.c
> @@ -450,7 +450,7 @@ static void ib_sa_event(struct ib_event_handler *handler, struct ib_event *event
> struct ib_sa_port *port =
> &sa_dev->port[event->element.port_num - sa_dev->start_port];
>
> - if (!rdma_port_ll_is_ib(handler->device, port->port_num))
> + if (!cap_sa(handler->device, port->port_num))
> return;
>
> spin_lock_irqsave(&port->ah_lock, flags);
> @@ -1154,7 +1154,7 @@ static void ib_sa_add_one(struct ib_device *device)
> struct ib_sa_device *sa_dev;
> int s, e, i;
>
> - if (!rdma_transport_is_ib(device))
> + if (!has_sa(device))
The logic here should be:
if (no ports of this device need sa access)
return;
So why not eliminate this check and allow the cap_sa(s) to handle the support?
-- Ira
> return;
>
> if (device->node_type == RDMA_NODE_IB_SWITCH)
> @@ -1175,7 +1175,7 @@ static void ib_sa_add_one(struct ib_device *device)
>
> for (i = 0; i <= e - s; ++i) {
> spin_lock_init(&sa_dev->port[i].ah_lock);
> - if (!rdma_port_ll_is_ib(device, i + 1))
> + if (!cap_sa(device, i + 1))
> continue;
>
> sa_dev->port[i].sm_ah = NULL;
> @@ -1205,14 +1205,14 @@ static void ib_sa_add_one(struct ib_device *device)
> goto err;
>
> for (i = 0; i <= e - s; ++i)
> - if (rdma_port_ll_is_ib(device, i + 1))
> + if (cap_sa(device, i + 1))
> update_sm_ah(&sa_dev->port[i].update_task);
>
> return;
>
> err:
> while (--i >= 0)
> - if (rdma_port_ll_is_ib(device, i + 1))
> + if (cap_sa(device, i + 1))
> ib_unregister_mad_agent(sa_dev->port[i].agent);
>
> kfree(sa_dev);
> @@ -1233,7 +1233,7 @@ static void ib_sa_remove_one(struct ib_device *device)
> flush_workqueue(ib_wq);
>
> for (i = 0; i <= sa_dev->end_port - sa_dev->start_port; ++i) {
> - if (rdma_port_ll_is_ib(device, i + 1)) {
> + if (cap_sa(device, i + 1)) {
> ib_unregister_mad_agent(sa_dev->port[i].agent);
> if (sa_dev->port[i].sm_ah)
> kref_put(&sa_dev->port[i].sm_ah->ref, free_sm_ah);
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index c0a63f8..fa8ffa3 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -1810,6 +1810,19 @@ static inline int has_cm(struct ib_device *device)
> }
>
> /**
> + * has_sa - Check if a device support Subnet Administrator.
> + *
> + * @device: Device to be checked
> + *
> + * Return 0 when a device has none port to support
> + * Subnet Administrator.
> + */
> +static inline int has_sa(struct ib_device *device)
> +{
> + return rdma_transport_is_ib(device);
> +}
> +
> +/**
> * cap_smi - Check if the port of device has the capability
> * Subnet Management Interface.
> *
> @@ -1824,6 +1837,21 @@ static inline int cap_smi(struct ib_device *device, u8 port_num)
> return rdma_port_ll_is_ib(device, port_num);
> }
>
> +/**
> + * cap_sa - Check if the port of device has the capability
> + * Subnet Administrator.
> + *
> + * @device: Device to be checked
> + * @port_num: Port number of the device
> + *
> + * Return 0 when port of the device don't support
> + * Subnet Administrator.
> + */
> +static inline int cap_sa(struct ib_device *device, u8 port_num)
> +{
> + return rdma_port_ll_is_ib(device, port_num);
> +}
> +
> int ib_query_gid(struct ib_device *device,
> u8 port_num, int index, union ib_gid *gid);
>
> --
> 2.1.0
>
next prev parent reply other threads:[~2015-03-27 16:47 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-27 15:39 [RFC PATCH 00/11] IB/Verbs: IB Management Helpers Michael Wang
2015-03-27 15:42 ` [RFC PATCH 02/11] IB/Verbs: Use management helper tech_iboe() for iboe-check Michael Wang
2015-03-30 16:17 ` Doug Ledford
[not found] ` <1427732250.21101.202.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-30 16:23 ` Michael Wang
2015-03-27 15:43 ` [RFC PATCH 03/11] IB/Verbs: Use management helper has_mad() for mad-check Michael Wang
2015-03-27 15:44 ` [RFC PATCH 04/11] IB/Verbs: Use management helper cap_smi() for smi-check Michael Wang
[not found] ` <55157AEB.7020705-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-27 16:32 ` Jason Gunthorpe
[not found] ` <20150327163219.GD28412-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-27 16:59 ` Yun Wang
2015-03-27 15:45 ` [RFC PATCH 05/11] IB/Verbs: Use management helper has_cm() for cm-check Michael Wang
[not found] ` <551579CA.4030901-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-27 15:40 ` [PATCH 01/11] IB/Verbs: Use helpers to check transport and link layer Michael Wang
2015-03-30 15:56 ` Doug Ledford
[not found] ` <1427730964.21101.195.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-30 16:14 ` Michael Wang
2015-03-30 16:22 ` Doug Ledford
[not found] ` <1427732576.21101.205.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-30 17:04 ` Michael Wang
2015-03-27 15:46 ` [RFC PATCH 06/11] IB/Verbs: Use management helper has_sa() and cap_sa(), for sa-check Michael Wang
2015-03-27 16:47 ` ira.weiny [this message]
2015-03-27 17:13 ` Yun Wang
2015-03-27 19:49 ` Doug Ledford
[not found] ` <55157B43.6060507-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-30 16:16 ` Doug Ledford
2015-03-30 16:42 ` Michael Wang
2015-03-30 17:02 ` Doug Ledford
[not found] ` <1427734923.21101.227.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-31 13:22 ` Michael Wang
2015-03-31 23:12 ` Jason Gunthorpe
[not found] ` <20150331231202.GA20094-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-04-01 0:51 ` ira.weiny
[not found] ` <20150401005113.GA15327-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-04-01 1:31 ` Jason Gunthorpe
2015-03-27 15:46 ` [RFC PATCH 07/11] IB/Verbs: Use management helper has_mcast() and, cap_mcast() for mcast-check Michael Wang
[not found] ` <55157B71.6040505-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-27 16:28 ` Jason Gunthorpe
2015-03-27 17:05 ` ira.weiny
[not found] ` <20150327170508.GB27862-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-03-27 17:31 ` Yun Wang
2015-03-27 17:49 ` Jason Gunthorpe
2015-03-27 18:09 ` Yun Wang
2015-03-27 17:47 ` Jason Gunthorpe
[not found] ` <20150327174727.GB28901-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-30 8:30 ` Michael Wang
[not found] ` <551909AC.2030304-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-30 22:33 ` Jason Gunthorpe
2015-03-30 16:11 ` Doug Ledford
2015-03-30 16:20 ` Michael Wang
2015-03-30 23:47 ` ira.weiny
[not found] ` <20150330234717.GA28446-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org>
2015-03-31 7:25 ` Michael Wang
2015-03-27 15:47 ` [RFC PATCH 08/11] IB/Verbs: Use management helper has_iwarp() for, iwarp-check Michael Wang
2015-03-27 16:13 ` Jason Gunthorpe
[not found] ` <20150327161319.GB28412-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-27 16:17 ` Michael Wang
2015-03-27 17:16 ` ira.weiny
2015-03-27 17:29 ` Jason Gunthorpe
[not found] ` <20150327172912.GA28901-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-30 15:10 ` Michael Wang
[not found] ` <55196754.5010600-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-30 22:35 ` Jason Gunthorpe
[not found] ` <20150330223528.GB27728-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-31 7:39 ` Michael Wang
[not found] ` <551A4F24.6090405-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-31 11:19 ` Tom Talpey
2015-03-31 11:41 ` Michael Wang
[not found] ` <551A87D3.2070306-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2015-03-31 13:56 ` Tom Talpey
2015-03-31 13:58 ` Michael Wang
2015-03-27 17:35 ` Yun Wang
2015-03-30 16:13 ` Doug Ledford
[not found] ` <1427731980.21101.199.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-30 16:21 ` Michael Wang
2015-03-31 23:20 ` Jason Gunthorpe
2015-03-27 15:48 ` [RFC PATCH 09/11] IB/Verbs: Use management helper has_ipoib() and, cap_ipoib() for ipoib-check Michael Wang
2015-03-27 16:06 ` Jason Gunthorpe
[not found] ` <20150327160616.GA28412-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-03-27 16:15 ` Michael Wang
2015-03-27 16:38 ` Jason Gunthorpe
2015-03-27 15:49 ` [RFC PATCH 10/11] IB/Verbs: Use management helper cap_ib() for ib-check Michael Wang
2015-03-27 15:49 ` [RFC PATCH 11/11] IB/Verbs: Use management helper cap_eth() for eth-check Michael Wang
2015-04-06 20:22 ` [RFC PATCH 00/11] IB/Verbs: IB Management Helpers ira.weiny
2015-04-07 7:31 ` Michael Wang
2015-04-07 12:48 ` Michael Wang
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=20150327164756.GA27862@phlsvsds.ph.intel.com \
--to=ira.weiny@intel$(echo .)com \
--cc=Tatyana.E.Nikolova@intel$(echo .)com \
--cc=alex.estrin@intel$(echo .)com \
--cc=bfields@fieldses$(echo .)org \
--cc=bvanassche@acm$(echo .)org \
--cc=colin.king@canonical$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=hal.rosenstock@gmail$(echo .)com \
--cc=jackm@dev$(echo .)mellanox.co.il \
--cc=jkosina@suse$(echo .)cz \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-nfs@vger$(echo .)kernel.org \
--cc=linux-rdma@vger$(echo .)kernel.org \
--cc=majd@mellanox$(echo .)com \
--cc=matanb@mellanox$(echo .)com \
--cc=monis@mellanox$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=ogerlitz@mellanox$(echo .)com \
--cc=pj.waskiewicz@solidfire$(echo .)com \
--cc=roland@kernel$(echo .)org \
--cc=sean.hefty@intel$(echo .)com \
--cc=trond.myklebust@primarydata$(echo .)com \
--cc=yanb@mellanox$(echo .)com \
--cc=ydroneaud@opteya$(echo .)com \
--cc=yun.wang@profitbricks$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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