diff mbox

[v3,25/28] IB/Verbs: Use management helper cap_af_ib()

Message ID 552BB801.2010506@profitbricks.com (mailing list archive)
State Rejected
Headers show

Commit Message

Michael Wang April 13, 2015, 12:35 p.m. UTC
Introduce helper cap_af_ib() to help us check if the port of an
IB device support Native Infiniband Address.

Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Tom Talpey <tom@talpey.com>
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/cma.c |  2 +-
 include/rdma/ib_verbs.h       | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

Comments

Or Gerlitz April 16, 2015, 1:57 p.m. UTC | #1
On Mon, Apr 13, 2015 at 3:35 PM, Michael Wang <yun.wang@profitbricks.com> wrote:
>
> Introduce helper cap_af_ib() to help us check if the port of an
> IB device support Native Infiniband Address.
>
> Cc: Steve Wise <swise@opengridcomputing.com>
> Cc: Tom Talpey <tom@talpey.com>
> 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/cma.c |  2 +-
>  include/rdma/ib_verbs.h       | 15 +++++++++++++++
>  2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 65e41f4..7f5815d 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -470,7 +470,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
>
>         list_for_each_entry(cur_dev, &dev_list, list) {
>                 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
> -                       if (!rdma_ib_or_iboe(cur_dev->device, p))
> +                       if (!cap_af_ib(cur_dev->device, p))
>                                 continue;
>
>                         if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index))
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 29ddd14..dfe33f3 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -1879,6 +1879,21 @@ static inline int cap_ipoib(struct ib_device *device, u8 port_num)
>  }
>
>  /**
> + * cap_af_ib - Check if the port of device has the capability
> + * Native Infiniband Address.
> + *
> + * @device: Device to be checked
> + * @port_num: Port number of the device
> + *
> + * Return 0 when port of the device don't support
> + * Native Infiniband Address.
> + */
> +static inline int cap_af_ib(struct ib_device *device, u8 port_num)
> +{
> +       return rdma_ib_or_iboe(device, port_num);
> +}

Sean, can you please put a precise writeup what does it take to
support AF_IB... I am a bit
confused here and wasn't sure if this can be supported with RoCE.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hal Rosenstock April 16, 2015, 2:16 p.m. UTC | #2
On 4/16/2015 9:57 AM, Or Gerlitz wrote:
> On Mon, Apr 13, 2015 at 3:35 PM, Michael Wang <yun.wang@profitbricks.com> wrote:
>>
>> Introduce helper cap_af_ib() to help us check if the port of an
>> IB device support Native Infiniband Address.
>>
>> Cc: Steve Wise <swise@opengridcomputing.com>
>> Cc: Tom Talpey <tom@talpey.com>
>> 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/cma.c |  2 +-
>>  include/rdma/ib_verbs.h       | 15 +++++++++++++++
>>  2 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
>> index 65e41f4..7f5815d 100644
>> --- a/drivers/infiniband/core/cma.c
>> +++ b/drivers/infiniband/core/cma.c
>> @@ -470,7 +470,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
>>
>>         list_for_each_entry(cur_dev, &dev_list, list) {
>>                 for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
>> -                       if (!rdma_ib_or_iboe(cur_dev->device, p))
>> +                       if (!cap_af_ib(cur_dev->device, p))
>>                                 continue;
>>
>>                         if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index))
>> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
>> index 29ddd14..dfe33f3 100644
>> --- a/include/rdma/ib_verbs.h
>> +++ b/include/rdma/ib_verbs.h
>> @@ -1879,6 +1879,21 @@ static inline int cap_ipoib(struct ib_device *device, u8 port_num)
>>  }
>>
>>  /**
>> + * cap_af_ib - Check if the port of device has the capability
>> + * Native Infiniband Address.
>> + *
>> + * @device: Device to be checked
>> + * @port_num: Port number of the device
>> + *
>> + * Return 0 when port of the device don't support
>> + * Native Infiniband Address.
>> + */
>> +static inline int cap_af_ib(struct ib_device *device, u8 port_num)
>> +{
>> +       return rdma_ib_or_iboe(device, port_num);
>> +}
> 
> Sean, can you please put a precise writeup what does it take to
> support AF_IB... I am a bit
> confused here and wasn't sure if this can be supported with RoCE.

I think this means IB GID addressing is checked (Native Infiniband
Address) and not AF_IB (which is socket address/protocol family like
INET and INET6).

I think this naming is confusing and maybe cap_ib_gid is better ?

-- Hal

> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hefty, Sean April 16, 2015, 3:09 p.m.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VwcG9ydCBBRl9JQi4uLiBJIGFtIGEg
Yml0DQo+ID4gY29uZnVzZWQgaGVyZSBhbmQgd2Fzbid0IHN1cmUgaWYgdGhpcyBjYW4gYmUgc3Vw
cG9ydGVkIHdpdGggUm9DRS4NCj4gDQo+IEkgdGhpbmsgdGhpcyBtZWFucyBJQiBHSUQgYWRkcmVz
c2luZyBpcyBjaGVja2VkIChOYXRpdmUgSW5maW5pYmFuZA0KPiBBZGRyZXNzKSBhbmQgbm90IEFG
X0lCICh3aGljaCBpcyBzb2NrZXQgYWRkcmVzcy9wcm90b2NvbCBmYW1pbHkgbGlrZQ0KPiBJTkVU
IGFuZCBJTkVUNikuDQo+IA0KPiBJIHRoaW5rIHRoaXMgbmFtaW5nIGlzIGNvbmZ1c2luZyBhbmQg
bWF5YmUgY2FwX2liX2dpZCBpcyBiZXR0ZXIgPw0KDQpJIG5lZWQgdG8gdHJhY2UgYmFjayB0aHJv
dWdoIHRoZSBjb2RlIHRvIHNlZSB3aGVyZSB0aGlzIGlzIHVzZWQsIGJ1dCBJIHRob3VnaHQgdGhl
IGNoZWNrIHdhcyBkZXRlcm1pbmluZyBpZiBhbiBhZGRyZXNzIGNvbnZleWVkIHVzaW5nIHNvY2th
ZGRyX2liIGFwcGxpZWQgdG8gdGhlIHBvcnQuICBTb2NrYWRkcl9pYiB3YXMgaW50ZW5kZWQgdG8g
dGFyZ2V0IElCLWNsYXNzaWMgc3BlY2lmaWNhbGx5LiAgSXQgc2hvdWxkIGFwcGx5IHRvIFJvQ0Uv
SUJvRSBhcyB3ZWxsLiAgSSBkb24ndCB0aGluayBpdCBhcHBsaWVzIHRvIFJvQ0V2Mi9JQm9VRFAg
d2l0aG91dCBhIHRyYW5zbGF0aW9uLg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michael Wang April 16, 2015, 3:28 p.m. UTC | #4
On 04/16/2015 05:09 PM, Hefty, Sean wrote:
[snip]
>>> Sean, can you please put a precise writeup what does it take to
>>> support AF_IB... I am a bit
>>> confused here and wasn't sure if this can be supported with RoCE.
>>
>> I think this means IB GID addressing is checked (Native Infiniband
>> Address) and not AF_IB (which is socket address/protocol family like
>> INET and INET6).
>>
>> I think this naming is confusing and maybe cap_ib_gid is better ?
> 
> I need to trace back through the code to see where this is used, but I thought the check was determining if an address conveyed using sockaddr_ib applied to the port.  Sockaddr_ib was intended to target IB-classic specifically.  It should apply to RoCE/IBoE as well.  I don't think it applies to RoCEv2/IBoUDP without a translation.

The usage is:

	rdma_resolve_addr
	{
		...
                if dst_addr->sa_family == AF_IB                                       
                        cma_resolve_ib_addr --> cma_resolve_ib_dev                             
                else                                                                  
                        rdma_resolve_ip
		...
	}

So I guess IBoE using ib address rather than ip?

Regards,
Michael Wang

> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 65e41f4..7f5815d 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -470,7 +470,7 @@  static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)
 
 	list_for_each_entry(cur_dev, &dev_list, list) {
 		for (p = 1; p <= cur_dev->device->phys_port_cnt; ++p) {
-			if (!rdma_ib_or_iboe(cur_dev->device, p))
+			if (!cap_af_ib(cur_dev->device, p))
 				continue;
 
 			if (ib_find_cached_pkey(cur_dev->device, p, pkey, &index))
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 29ddd14..dfe33f3 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1879,6 +1879,21 @@  static inline int cap_ipoib(struct ib_device *device, u8 port_num)
 }
 
 /**
+ * cap_af_ib - Check if the port of device has the capability
+ * Native Infiniband Address.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device don't support
+ * Native Infiniband Address.
+ */
+static inline int cap_af_ib(struct ib_device *device, u8 port_num)
+{
+	return rdma_ib_or_iboe(device, port_num);
+}
+
+/**
  * cap_read_multi_sge - Check if the port of device has the capability
  * RDMA Read Multiple Scatter-Gather Entries.
  *