Skip to contentSkip to conversation

Add Core Capability Bits to use in Management helpers

RFC PATCH In review [email protected] 7 participants 50 messages May 4, 2015 – May 13, 2015 36 messages not in the archive

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover Add Core Capability Bits to use in Management helpers

From: Ira Weiny <[email protected]>

The following 5 patches use new Core Capability bits to signal core capabilities rather than inferring these capabilities based on the protocols.

The first 3 are the beginning of converting Michaels patches over to a bit mask. Before converting all the functions I wanted to get consensus with a smaller patch series.

In addition I have included the additional OPA flags which will be needed for the OPA series to show how new support can be communicated. If we are in agreement then I can complete the series with an official submission.

Ira Weiny (5):
IB/core: Add Core Capability flags to ib_device
IB/core: Replace query_protocol callback with Core Capability flags
check
IB/core: Convert cap_ib_mad to core_cap_flags bit mask IB/core: Add rdma_dev_max_mad_size call
IB/core: Add cap_opa_mad helper using RDMA_CORE_CAP_OPA_MAD flag

 drivers/infiniband/core/device.c             |   42 +++++++++++++++-
 drivers/infiniband/core/mad.c                |    4 ++
 drivers/infiniband/hw/amso1100/c2_provider.c |    8 +---
 drivers/infiniband/hw/amso1100/c2_rnic.c     |    1 +
 drivers/infiniband/hw/cxgb3/iwch_provider.c  |    9 +---
 drivers/infiniband/hw/cxgb4/provider.c       |    9 +---
 drivers/infiniband/hw/ehca/ehca_hca.c        |   11 ++--
 drivers/infiniband/hw/ehca/ehca_main.c       |    1 -
 drivers/infiniband/hw/ipath/ipath_verbs.c    |    9 +---
 drivers/infiniband/hw/mlx4/main.c            |   14 ++----
 drivers/infiniband/hw/mlx5/main.c            |   10 +---
 drivers/infiniband/hw/mthca/mthca_provider.c |   10 +---
 drivers/infiniband/hw/nes/nes_verbs.c        |    9 +---
 drivers/infiniband/hw/ocrdma/ocrdma_main.c   |    1 -
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |    8 +--
 drivers/infiniband/hw/qib/qib_verbs.c        |    9 +---
 drivers/infiniband/hw/usnic/usnic_ib_main.c  |    1 -
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c |    9 +--
 include/rdma/ib_mad.h                        |    1 +
 include/rdma/ib_verbs.h                      |   72 +++++++++++++++++++++++---
 20 files changed, 142 insertions(+), 96 deletions(-)

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

A message that is not in the archive (sent off-list or not yet received): 1430720099-32512-1-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw

RFC PATCH 1/5 IB/core: Add Core Capability flags to ib_device

From: Ira Weiny <[email protected]>

Add Core capability flags to each port attribute and read those into ib_device upon registration for each port.

---
 drivers/infiniband/core/device.c |   41 ++++++++++++++++++++++++++++++++++++++
 include/rdma/ib_verbs.h          |   22 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
drivers/infiniband/core/device.c +41 -0
index b360350..6a37255 100644
@@ -262,6 +262,37 @@ out:
 	return ret;
 }
 
+static int read_core_cap_flags(struct ib_device *device)
+{
+	struct ib_port_attr tprops;
+	int num_ports, ret = -ENOMEM;
+	u8 port_index;
+
+	num_ports = device->phys_port_cnt;
+
+	device->core_cap_flags = kzalloc(sizeof(*device->core_cap_flags)
+						* (num_ports+1),
+					 GFP_KERNEL);
+	if (!device->core_cap_flags)
+		return -ENOMEM;
+
+	for (port_index = 0; port_index <= num_ports; ++port_index) {
+		if ((port_index == 0 && device->node_type != RDMA_NODE_IB_SWITCH))
+			continue;
+
+		ret = ib_query_port(device, port_index, &tprops);
+		if (ret)
+			goto err;
+
+		device->core_cap_flags[port_index] = tprops.core_cap_flags;
+	}
+
+	return 0;
+err:
+	kfree(device->core_cap_flags);
+	return ret;
+}
+
 /**
  * ib_register_device - Register an IB device with IB core
  * @device:Device to register
@@ -302,12 +333,21 @@ int ib_register_device(struct ib_device *device,
 		goto out;
 	}
 
+	ret = read_core_cap_flags(device);
+	if (ret) {
+		dev_err(&device->dev, "Couldn't create Core Capability flags\n");
+		kfree(device->gid_tbl_len);
+		kfree(device->pkey_tbl_len);
+		goto out;
+	}
+
 	ret = ib_device_register_sysfs(device, port_callback);
 	if (ret) {
 		printk(KERN_WARNING "Couldn't register device %s with driver model\n",
 		       device->name);
 		kfree(device->gid_tbl_len);
 		kfree(device->pkey_tbl_len);
+		kfree(device->core_cap_flags);
 		goto out;
 	}
 
@@ -351,6 +391,7 @@ void ib_unregister_device(struct ib_device *device)
 
 	kfree(device->gid_tbl_len);
 	kfree(device->pkey_tbl_len);
+	kfree(device->core_cap_flags);
 
 	mutex_unlock(&device_mutex);
 
include/rdma/ib_verbs.h +22 -0
index c724114..4de2758 100644
@@ -353,11 +353,32 @@ union rdma_protocol_stats {
 	struct iw_protocol_stats	iw;
 };
 
+/* Define bits for the various functionality this port needs to be supported by
+ * the core.
+ */
+/* Management                           0x00000000FFFFFFFF */
+#define RDMA_CORE_CAP_IB_MAD		0x0000000000000001ULL
+#define RDMA_CORE_CAP_IB_SMI		0x0000000000000002ULL
+#define RDMA_CORE_CAP_IB_CM		0x0000000000000004ULL
+#define RDMA_CORE_CAP_IW_CM		0x0000000000000008ULL
+#define RDMA_CORE_CAP_IB_SA		0x0000000000000010ULL
+
+/* Address format                       0x0000FFFF00000000 */
+#define RDMA_CORE_CAP_AF_IB		0x0000000100000000ULL
+#define RDMA_CORE_CAP_ETH_AH		0x0000000200000000ULL
+
+/* Protocol                             0xFFFF000000000000 */
+#define RDMA_CORE_CAP_PROT_IB		0x0001000000000000ULL
+#define RDMA_CORE_CAP_PROT_IBOE		0x0002000000000000ULL
+#define RDMA_CORE_CAP_PROT_IWARP	0x0004000000000000ULL
+#define RDMA_CORE_CAP_PROT_USNIC_UDP	0x0008000000000000ULL
+
 struct ib_port_attr {
 	enum ib_port_state	state;
 	enum ib_mtu		max_mtu;
 	enum ib_mtu		active_mtu;
 	int			gid_tbl_len;
+	u64                     core_cap_flags;
 	u32			port_cap_flags;
 	u32			max_msg_sz;
 	u32			bad_pkey_cntr;
@@ -1684,6 +1705,7 @@ struct ib_device {
 	u32			     local_dma_lkey;
 	u8                           node_type;
 	u8                           phys_port_cnt;
+	u64                         *core_cap_flags; /* Per port core capability flags */
 };
 
 struct ib_client {
Signature · 6 lines
1.7.1

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

A message that is not in the archive (sent off-list or not yet received): 1430720099-32512-2-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 100 lines · On Mon, 2015-05-04 at 02:14 -0400, [email protected]…

From: Ira Weiny <[email protected]>

Add Core capability flags to each port attribute and read those into ib_device upon registration for each port.

---
 drivers/infiniband/core/device.c |   41 ++++++++++++++++++++++++++++++++++++++
 include/rdma/ib_verbs.h          |   22 ++++++++++++++++++++
 2 files changed, 63 insertions(+), 0 deletions(-)
drivers/infiniband/core/device.c +41 -0
index b360350..6a37255 100644
@@ -262,6 +262,37 @@ out:
 	return ret;
 }
 
+static int read_core_cap_flags(struct ib_device *device)
+{
+	struct ib_port_attr tprops;
+	int num_ports, ret = -ENOMEM;
+	u8 port_index;
+
+	num_ports = device->phys_port_cnt;
+
+	device->core_cap_flags = kzalloc(sizeof(*device->core_cap_flags)
+						* (num_ports+1),
+					 GFP_KERNEL);
+	if (!device->core_cap_flags)
+		return -ENOMEM;
+
+	for (port_index = 0; port_index <= num_ports; ++port_index) {
+		if ((port_index == 0 && device->node_type != RDMA_NODE_IB_SWITCH))
+			continue;
+
+		ret = ib_query_port(device, port_index, &tprops);
+		if (ret)
+			goto err;
+
+		device->core_cap_flags[port_index] = tprops.core_cap_flags;
+	}
+
+	return 0;
+err:
+	kfree(device->core_cap_flags);
+	return ret;
+}
+
 /**
  * ib_register_device - Register an IB device with IB core
  * @device:Device to register
@@ -302,12 +333,21 @@ int ib_register_device(struct ib_device *device,
 		goto out;
 	}
 
+	ret = read_core_cap_flags(device);
+	if (ret) {
+		dev_err(&device->dev, "Couldn't create Core Capability flags\n");
+		kfree(device->gid_tbl_len);
+		kfree(device->pkey_tbl_len);
+		goto out;
+	}
+
 	ret = ib_device_register_sysfs(device, port_callback);
 	if (ret) {
 		printk(KERN_WARNING "Couldn't register device %s with driver model\n",
 		       device->name);
 		kfree(device->gid_tbl_len);
 		kfree(device->pkey_tbl_len);
+		kfree(device->core_cap_flags);
 		goto out;
 	}
 
@@ -351,6 +391,7 @@ void ib_unregister_device(struct ib_device *device)
 
 	kfree(device->gid_tbl_len);
 	kfree(device->pkey_tbl_len);
+	kfree(device->core_cap_flags);
 
 	mutex_unlock(&device_mutex);
 
include/rdma/ib_verbs.h +9 -0
index c724114..4de2758 100644
@@ -353,11 +353,32 @@ union rdma_protocol_stats {
 	struct iw_protocol_stats	iw;
 };
 
+/* Define bits for the various functionality this port needs to be supported by
+ * the core.
+ */
+/* Management                           0x00000000FFFFFFFF */
+#define RDMA_CORE_CAP_IB_MAD		0x0000000000000001ULL
+#define RDMA_CORE_CAP_IB_SMI		0x0000000000000002ULL
+#define RDMA_CORE_CAP_IB_CM		0x0000000000000004ULL
+#define RDMA_CORE_CAP_IW_CM		0x0000000000000008ULL
+#define RDMA_CORE_CAP_IB_SA		0x0000000000000010ULL

include/rdma/ib_verbs.h union rdma_protocol_stats { · line 374

Quoted 10 lines
include/rdma/ib_verbs.h +10 -0
+
+/* Address format                       0x0000FFFF00000000 */
+#define RDMA_CORE_CAP_AF_IB		0x0000000100000000ULL
+#define RDMA_CORE_CAP_ETH_AH		0x0000000200000000ULL
+
+/* Protocol                             0xFFFF000000000000 */
+#define RDMA_CORE_CAP_PROT_IB		0x0001000000000000ULL
+#define RDMA_CORE_CAP_PROT_IBOE		0x0002000000000000ULL
+#define RDMA_CORE_CAP_PROT_IWARP	0x0004000000000000ULL
+#define RDMA_CORE_CAP_PROT_USNIC_UDP	0x0008000000000000ULL

In accordance with what we've been talking about, drop IBOE for ROCE.

Drop the UDP off of USNIC, then define a bit for CAP_PROT_UDP_ENCAP. USNIC will be just USNIC, USNIC_UDP will be USNIC | UDP_ENCAP, ROCE v1 will be ROCE, and ROCEv2 will be ROCE | UDP_ENCAP.

include/rdma/ib_verbs.h union rdma_protocol_stats { · line 381

Quoted 7 lines
include/rdma/ib_verbs.h +2 -0
+
 struct ib_port_attr {
 	enum ib_port_state	state;
 	enum ib_mtu		max_mtu;
 	enum ib_mtu		active_mtu;
 	int			gid_tbl_len;
+	u64                     core_cap_flags;

I think u32 should be enough here, and will help keep our footprint smaller.

include/rdma/ib_verbs.h struct ib_device { · line 1708

Quoted 8 lines
include/rdma/ib_verbs.h +1 -0
 	u32			port_cap_flags;
 	u32			max_msg_sz;
 	u32			bad_pkey_cntr;
@@ -1684,6 +1705,7 @@ struct ib_device {
 	u32			     local_dma_lkey;
 	u8                           node_type;
 	u8                           phys_port_cnt;
+	u64                         *core_cap_flags; /* Per port core capability flags */

Ditto.

Quoted 3 lines
include/rdma/ib_verbs.h +0 -0
 };
 
 struct ib_client {
Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiA+ICsvKiBQcm90b2NvbCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgMHhGRkZGMDAwMDAw MDAwMDAwICovDQo+ID4gKyNkZWZpbmUgUkRNQV9DT1JFX0NBUF9QUk9UX0lCCQkweDAwMDEwMDAw MDAwMDAwMDBVTEwNCj4gPiArI2RlZmluZSBSRE1BX0NPUkVfQ0FQX1BST1RfSUJPRQkJMHgwMDAy MDAwMDAwMDAwMDAwVUxMDQo+ID4gKyNkZWZpbmUgUkRNQV9DT1JFX0NBUF9QUk9UX0lXQVJQCTB4 MDAwNDAwMDAwMDAwMDAwMFVMTA0KPiA+ICsjZGVmaW5lIFJETUFfQ09SRV9DQVBfUFJPVF9VU05J Q19VRFAJMHgwMDA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kIHdvcmsgZmluZSBvdmVyIGFueSBsaW5rLiAgQW5kIHRoZSBjb3JlIGxheWVyIHNob3Vs ZCBub3QgYXNzdW1lIHRoYXQgYSBkZXZpY2UgaXMgbGltaXRlZCB0byBzdXBwb3J0aW5nIG9ubHkg b25lIHByb3RvY29sLCBlc3BlY2lhbGx5IGF0IHRoZSBuZXR3b3JrIGFuZCB0cmFuc3BvcnQgbGV2 ZWxzLiAgSSB2b3RlIGZvciBkZXByZWNhdGluZyB0aGUgcHJvdG9jb2wgZ29vZmluZXNzLg0KDQot IFNlYW4NCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCA17C-P5GAC/[email protected]

#8 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 8 lines · Sean
Quoted 8 lines

include/rdma/ib_verbs.h union rdma_protocol_stats { · line 374

Quoted 5 lines
include/rdma/ib_verbs.h +5 -0
+/* Protocol                             0xFFFF000000000000 */
+#define RDMA_CORE_CAP_PROT_IB		0x0001000000000000ULL
+#define RDMA_CORE_CAP_PROT_IBOE		0x0002000000000000ULL
+#define RDMA_CORE_CAP_PROT_IWARP	0x0004000000000000ULL
+#define RDMA_CORE_CAP_PROT_USNIC_UDP	0x0008000000000000ULL

In accordance with what we've been talking about, drop IBOE for ROCE.

Quoted 5 lines
Quoted 3 lines

Drop the UDP off of USNIC, then define a bit for CAP_PROT_UDP_ENCAP. USNIC will be just USNIC, USNIC_UDP will be USNIC | UDP_ENCAP, ROCE v1 will be ROCE, and ROCEv2 will be ROCE | UDP_ENCAP.

USNIC_UDP is just UDP. I don't understand why we would want 'USNIC | UDP_ENCAP', or what UDP_ENCAP is intended to convey. Nothing is being encapsulated.

I thought USNIC_UDP had an embedded USNIC protocol header inside the UDP header. That would make it a UDP_ENCAP protocol.

Quoted 1 line

RoCEv2 is IB transport over UDP.

Right, ROCE (or IB, whichever you prefer) encapsulated in UDP.

Quoted 1 line

I'm not sure what the protocol field is intended to imply.

There is still information in those bits that we can't get elsewhere. For instance, even though this patch replaces the CAP_* stuff with bits, if you took away the CAP_PROT_* entries, then there would be no entry to identify USNIC at all.

Right now, you could infer iWARP from CAP_IW_CM.
You could infer InfiniBand from any of the CAP_IB_* (but later will need a way to differentiate between IB and OPA)
You could infer ROCE from CAP_ETH_AH (but later will need a way to differentiate between ROCE and ROCEv2)
The only way to differentiate USNIC at the moment, is that the CAPS would be all 0. That's not the sort of positive identification I would prefer.

So you *could* reduce this to just one bit for USNIC.

And if you then add a UDP_ENCAP bit, then that single bit can do double duty in telling apart USNIC and USNIC_UDP and ROCE and ROCEv2.

Quoted 10 lines

If we want
to expose the link, network, transport, and RDMA protocols in use, shouldn't these be separate fields or bits? And even then, I'm not sure what use this has for the ULPs. iWarp does not require Ethernet or TCP. RoCEv2 would work fine over any link.

And the core layer
should not assume that a device is limited to supporting only one protocol, especially at the network and transport levels.

Given that this is a per port thing, there is no assumption about a device only supporting a single protocol.

Quoted 2 lines

I vote for
deprecating the protocol goofiness.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiBJIHRob3VnaHQgVVNOSUNfVURQIGhhZCBhbiBlbWJlZGRlZCBVU05JQyBwcm90b2NvbCBoZWFk ZXIgaW5zaWRlIHRoZSBVRFANCj4gaGVhZGVyLiAgVGhhdCB3b3VsZCBtYWtlIGl0IGEgVURQX0VO Q0FQIHByb3RvY29sLg0KDQpTb21lb25lIGZyb20gQ2lzY28gY2FuIGNvcnJlY3QgbWUsIGJ1dCBV U05JQyBzdXBwb3J0cyAyIHByb3RvY29scy4gIEp1c3QgcGxhaW4gVURQLCBhbmQgYSBwcm9wcmll dGFyeSBwcm90b2NvbCB0aG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MuICAoSSdkIGFjdHVhbGx5IGJlIHN1cnByaXNl ZCBpZiBubyBkZXZpY2VzIGhhdmUgdGhpcyBjYXBhYmlsaXR5LCBpZiBmb3IgZGVidWdnaW5nIGNh cGFiaWxpdGllcywgZXZlbiBpZiBmb3Igbm90aGluZyBlbHNlLikgIFdoYXQgYXJlIHdlIGdvaW5n IHRvIGRvIGlmIHRoZXJlJ3MgYSBkZXZpY2UgdGhhdCBzdXBwb3J0cyBib3RoIGlXYXJwIGFuZCBS b0NFdjI/ICBUaGF0J3MgZWFzaWx5IGRvYWJsZSB0b2RheSB0aHJvdWdoIHNvZnR3YXJlLg0KDQpC YXNpY2FsbHksIEkgcXVlc3Rpb24gaG93IHByb3RvY29sIGlzIGRlZmluZWQgYW5kIHdoYXQgaXQg bWVhbnMgdG8gZXhwb3NlIGl0IGFzIGEgZGV2aWNlIGF0dHJpYnV0ZS4gIFNob3VsZCBpdCBpbnN0 ZWFkIGJlIG5lZ290aWF0ZWQgKGkuZS4gbW9yZSBsaWtlIHNvY2tldHMpPyAgSWYgYW4gYXBwIG5l ZWRzIGEgc3BlY2lmaWMgIlJETUEgcHJvdG9jb2wiIChJQiBvciBpV2FycCkgb3IgImFwcGxpY2F0 aW9uIHByb3RvY29sIiAoSUIgb3IgaVdhcnAgb3IgVURQIG9yIE1BRHM/KSwgdGhleSBjYW4gcmVx dWVzdCBpdC4gIE90aGVyd2lzZSwgdGhlIGFwcCBnZXRzIGFzc2lnbmVkIHNvbWUgcHJvdG9jb2wu ICBBbmQgdGhlIHByb3RvY29sIHNob3VsZCByZWFsbHkgYmUgYXNzb2NpYXRlZCB3aXRoIGEgUVAs IHJhdGhlciB0aGFuIGEgcG9ydC4NCg0KLSBTZWFuIA0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCA2F1-P5GAC/[email protected]

#12 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 4 lines · Sean
Quoted 2 lines

Given that this is a per port thing, there is no assumption about a device only supporting a single protocol.

Device, no, but we are assuming this per port.

At a high level, there are certain things that will be per port because they are tied to the link layer in question (you won't have a port with IB_SA that doesn't have IB_SA on all its queue pairs on that port).

Quoted 2 lines

I don't think this is
true for USNIC.

I can't speak for USNIC, I haven't read the driver for it closely enough.

Quoted 2 lines

For that matter, it's entirely possible for a RoCEv2
device to expose UDP directly to user space, same as USNIC.

I'm not sure I'm following what you are saying here. USNIC is unique in that it presents a NIC to the application that it has exclusive control over.

Quoted 5 lines

(I'd
actually be surprised if no devices have this capability, if for debugging capabilities, even if for nothing else.) What are we going to do if there's a device that supports both iWarp and RoCEv2? That's easily doable today through software.

It's doable, but nobody is actually doing it.

Quoted 7 lines

Basically, I question how protocol is defined and what it means to expose it as a device attribute. Should it instead be negotiated (i.e. more like sockets)? If an app needs a specific "RDMA protocol" (IB or iWarp) or "application protocol" (IB or iWarp or UDP or MADs?), they can request it. Otherwise, the app gets assigned some protocol. And the protocol should really be associated with a QP, rather than a port.

If you're going down to that level (which we will when the RoCEv2 patches are integrated), then it doesn't quite map to QPs. Since a UD QP may need to talk to both RoCEv1 and RoCEv2 hosts, it's at the AH level for RoCE.

To a certain extent you are right. RoCE, RoCEv2, iWARP, and USNIC could all reside on a single port by virtue of them all sharing an Ethernet link layer. IB link layer (and associated attributes) and OPA link layer are the outliers in this method of thinking in that their ports will only support their own transport. So if we were to actually be forward thinking about this, then the link layer is the important bit you need to capture on a per port basis, not the transport technology. We would have to modify lots of the stack to support per QP or per AH transport settings though.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): 1430768425.2407.143.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#14 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 4 lines · Doug Ledford

So if we were to actually be forward thinking about this, then the link layer is the important bit you need to capture on a per port basis, not the transport technology. We would have to modify lots of the stack to support per QP or per AH transport settings though.

We are going to have to do this, at least in the kernel side, the idea that the port can imply the one and only address family of the QP is certainly antiquated now. I think the roceev2 patches will require this work.

As far as this patch series goes, I actually don't think the bits matter one bit - the intent is to optimize the cap tests, so a one cap test-one-bit method is fine. Don't add extra we don't need right now.

As an optimization, be aware of some of the restrictions, it is actually pretty expensive on some arch's to load large 32 or 64 bit numbers, smaller numbers are better, single bit test is better.

If this is combined with my thought to use a #define for all the common driver cases then we can trivially rework the bit-field to future needs. No reason to over architect something here.

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

A message that is not in the archive (sent off-list or not yet received): 20150504210741.GA20839-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#16 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 12 lines

From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Jason Gunthorpe

Quoted 4 lines

So if we were to actually be forward thinking about this, then the link layer is the important bit you need to capture on a per port basis, not the transport technology. We would have to modify lots of the stack to support per QP or per AH transport settings though.

We are going to have to do this, at least in the kernel side, the idea that the port can imply the one and only address family of the QP is certainly antiquated now. I think the roceev2 patches will require this work.

I second that the link layer should not be used for this purpose. RDMA devices can and will advertise multiple rdma 'protocols', such as ROCE devices that support both ROCE_V1 and ROCE_V2.

--Liran

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

#17 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive
Quoted 4 lines · Sean
Quoted 2 lines

I thought USNIC_UDP had an embedded USNIC protocol header inside the UDP header. That would make it a UDP_ENCAP protocol.

Someone from Cisco can correct me, but USNIC supports 2 protocols. Just plain UDP, and a proprietary protocol that runs over Ethernet, but uses the same EtherType as RoCE. I thought these could both be active on the same port at the same time.

Sean's statements above are correct. "USNIC_UDP" in today's code really is plain-old-UDP (over IP over Ethernet).

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

And the core layer
should not assume that a device is limited to supporting only one protocol, especially at the network and transport levels.

Given that this is a per port thing, there is no assumption about a device only supporting a single protocol.

Device, no, but we are assuming this per port. I don't think this is true for USNIC.

Correct, usNIC devices and ports can speak either format concurrently, IIRC even for different QPs in the same context/PD/etc.

Incidentally, usNIC devices only ever have a single port right now, but there's no reason that has to remain true.

Quoted 1 line

For that matter, it's entirely possible for a RoCEv2 device to expose UDP directly to user space, same as USNIC. (I'd actually be surprised if no devices have this capability, if for debugging capabilities, even if for nothing else.) What are we going to do if there's a device that supports both iWarp and RoCEv2? That's easily doable today through software.

+1

-Dave

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

#18 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive

PiBGcm9tOiBsaW51eC1yZG1hLW93bmVyQHZnZXIua2VybmVsLm9yZyBbbWFpbHRvOmxpbnV4LXJk bWEtDQo+IG93bmVyQHZnZXIua2VybmVsLm9yZ10gT24gQmVoYWxmIE9mIEhlZnR5LCBTZWFuDQoN Cj4gPiBJIHRob3VnaHQgVVNOSUNfVURQIGhhZCBhbiBlbWJlZGRlZCBVU05JQyBwcm90b2NvbCBo ZWFkZXIgaW5zaWRlIHRoZQ0KPiA+IFVEUCBoZWFkZXIuICBUaGF0IHdvdWxkIG1ha2UgaXQgYSBV RFBfRU5DQVAgcHJvdG9jb2wuDQo+IA0KPiBTb21lb25lIGZyb20gQ2lzY28gY2FuIGNvcnJlY3Qg bWUsIGJ1dCBVU05JQyBzdXBwb3J0cyAyIHByb3RvY29scy4gIEp1c3QNCj4gcGxhaW4gVURQLCBh bmQgYSBwcm9wcml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MgZG8ganVzdCB0aGF0OiBhZHZlcnRpc2UgY2FwYWJpbGl0aWVzLg0KVGhlIGFj dHVhbCBwcm90b2NvbCBzZWxlY3Rpb24gZm9yIGVhY2ggdHJhbnNwb3J0IGVudGl0eSBoYXBwZW5z IGxhdGVyLg0KDQpGb3IgUk9DRSBSQyBRUHMsIGZvciBleGFtcGxlLCB0aGlzIG9jY3VycyB3aGls ZSBtb2RpZnlpbmcgdGhlIFFQIHRvIHJlZmVyDQp0byB0aGUgZGVzaXJlZCBHSUQgaW5kZXguDQoN Ci0tTGlyYW4NCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): HE1PR05MB1418DF0669B6E6CABE1D9F1EB1D10-eBadYZ65MZ87O8BmmlM1zNqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#20 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 12 lines · Liran Liss
Quoted 11 lines

From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Hefty, Sean

Quoted 2 lines

I thought USNIC_UDP had an embedded USNIC protocol header inside the UDP header. That would make it a UDP_ENCAP protocol.

Someone from Cisco can correct me, but USNIC supports 2 protocols. Just plain UDP, and a proprietary protocol that runs over Ethernet, but uses the same EtherType as RoCE. I thought these could both be active on the same port at the same time.

Quoted 6 lines

'protocol' refers to what your device generates when you do a post_send() on some QP.
In the RoCE case, it is IBTA transport headers + payload over UDP encapsulation over IP. In the USNIC case, you might want the protocol to refer to addition information the distinguishes this wire protocol rather than just "I am sending UDP packets"...

In the case that usNIC is operating in UDP mode (which is the overwhelming majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

[^^^^^ there continues to be confusion about this for some reason, but I don't know why]

Quoted 3 lines

In other words, I think that 'protocol' should uniquely distinguish interoperable peers at the Verbs API level. We are *not* trying to describe a certain header, but rather a stack of protocols.

Any non-UDP "protocol" that might currently be in use over usNIC is an entirely application-level protocol outside of the view of the Verbs API level.

-Dave

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

A message that is not in the archive (sent off-list or not yet received): 20BA79B2-9DA5-49B3-8455-BD4021CB882C-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org

#22 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 9 lines
Quoted 1 line

In other words, I think that 'protocol' should uniquely distinguish

interoperable

Quoted 1 line

peers at the Verbs API level. We are *not* trying to describe a certain

header,

Quoted 1 line

but rather a stack of protocols.

Any non-UDP "protocol" that might currently be in use over usNIC is an entirely application-level protocol outside of the view of the Verbs API level.

I agree with this for usNIC. For other technologies, the definition isn't even this simple. UD QPs and RC QPs cannot interoperate, yet are treated as the same 'protocol'. Just defining protocol as a 'stack of protocols' shows how broken the approach is. And we haven't even tried to incorporate other 'protocols' needed to make this work, such as the CM or management protocols. --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCAEFD-P5GAC/[email protected]

#24 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 14 lines

From: Hefty, Sean [mailto:[email protected]]
Sent: Tuesday, May 05, 2015 11:29 PM

Quoted 10 lines
Quoted 1 line

In other words, I think that 'protocol' should uniquely distinguish

interoperable

Quoted 2 lines

peers at the Verbs API level. We are *not* trying to describe a certain

header,

Quoted 1 line

but rather a stack of protocols.

Any non-UDP "protocol" that might currently be in use over usNIC is an entirely application-level protocol outside of the view of the Verbs API level.

Fine. Then we can add a 'udp/ip' protocol for usNIC.
Similarly, 'raw Ethernet' can designate the ability to inject of all headers starting from L2.

Quoted 6 lines

I agree with this for usNIC. For other technologies, the definition isn't even this simple. UD QPs and RC QPs cannot interoperate, yet are treated as the same 'protocol'. Just defining protocol as a 'stack of protocols' shows how broken the approach is. And we haven't even tried to incorporate other 'protocols' needed to make this work, such as the CM or management protocols.

The interoperability between different transport objects depends on the technology. I don't think that we should even attempt to describe these dependencies in any abstract way. RTFM...

However, users should have a way of knowing what transports and what wire protocol stacks a certain rdma device supports.

No one using IB or RoCE would think that UD and RC interoperate. (If someone tries it, he would be disappointed 'gracefully'...) But people that use RoCE would like to know which devices they can use to send RoCE packets (or select a device that supports a certain RoCE version).

--Liran

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

#25 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive
Quoted 28 lines · Dave Goodell (dgoodell)
Quoted 12 lines · Liran Liss
Quoted 11 lines

From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Hefty, Sean

Quoted 2 lines

I thought USNIC_UDP had an embedded USNIC protocol header inside the UDP header. That would make it a UDP_ENCAP protocol.

Someone from Cisco can correct me, but USNIC supports 2 protocols. Just plain UDP, and a proprietary protocol that runs over Ethernet, but uses the same EtherType as RoCE. I thought these could both be active on the same port at the same time.

Quoted 6 lines

'protocol' refers to what your device generates when you do a post_send() on some QP.
In the RoCE case, it is IBTA transport headers + payload over UDP encapsulation over IP. In the USNIC case, you might want the protocol to refer to addition information the distinguishes this wire protocol rather than just "I am sending UDP packets"...

In the case that usNIC is operating in UDP mode (which is the overwhelming majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

Quoted 2 lines

[^^^^^ there continues to be confusion about this for some reason, but I don't know why]

I really need to just sit down and read your driver front to back. The confusion probably comes from people (such as myself) that first think about this and go "Well, if you have multiple queue pairs, and UDP, then you need a header to tell what QP a packet goes to" (which assumes a RoCE like usage of UDP where all packets go to the same UDP address) where your actual usage is probably more iWARP like in that the IP/UDP SRC/DST combo maps to a specific QP, right?

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): 1431142328.2407.488.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#27 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 9 lines · Doug Ledford
Quoted 8 lines · Dave Goodell (dgoodell)

In the case that usNIC is operating in UDP mode (which is the overwhelming majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

Quoted 4 lines
Quoted 2 lines

[^^^^^ there continues to be confusion about this for some reason, but I don't know why]

I really need to just sit down and read your driver front to back.

Feel free to ping me off-list if you want any explanation about what's going on in the usnic_verbs module. I'm happy to help.

Quoted 7 lines

The
confusion probably comes from people (such as myself) that first think about this and go "Well, if you have multiple queue pairs, and UDP, then you need a header to tell what QP a packet goes to" (which assumes a RoCE like usage of UDP where all packets go to the same UDP address) where your actual usage is probably more iWARP like in that the IP/UDP SRC/DST combo maps to a specific QP, right?

I don't know much about the details of iWARP, but yes, a UDP/IP src/dst port combo maps to a specific QP when using USNIC_UDP QPs. We do _not_ use a single well-known port.

-Dave

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

A message that is not in the archive (sent off-list or not yet received): CCC397F5-31B6-4A35-94E0-7EAAE6C4803F-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org

#29 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 4 lines · Dave Goodell (dgoodell)
Quoted 1 line

I really need to just sit down and read your driver front to back.

Feel free to ping me off-list if you want any explanation about what's going on in the usnic_verbs module. I'm happy to help.

So, I look at this:

int usnic_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
struct ib_send_wr **bad_wr)

{
        usnic_dbg("\n");
        return -EINVAL;
}

And conclude that usnic doesn't actually provide any RDMA services to in-kernel users, correct?

I'd then guess the entire point of this is to hack some non-RDMA device to export it's interface via uverbs? Presumably because someone nack'd using your own char device or whatever?

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

A message that is not in the archive (sent off-list or not yet received): 20150511223930.GA15628-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#31 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 11 lines · Jason Gunthorpe

So, I look at this:

int usnic_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
struct ib_send_wr **bad_wr)

{
       usnic_dbg("\n");
       return -EINVAL;
}

And conclude that usnic doesn't actually provide any RDMA services to in-kernel users, correct?

Correct.

Quoted 2 lines

I'd then guess the entire point of this is to hack some non-RDMA device to export it's interface via uverbs?

If by "non-RDMA", you mean "does not currently support hardware offload of direct data placement", then yes. There are a couple of things to keep in mind:

1) usNIC is UD-only at this time. Are there any kernel clients that make use of UD without also requiring RC? (this is a genuine question)

2) When using UDP, usNIC deposits 42-byte UDP/IP/Ethernet headers into the start of the recv buffer, not a 40-byte GRH. Unfortunately, the current verbs stack has no way to indicate the device's/port's/QP's header size, let alone format, to any client. So clients must be aware they are using a usNIC device under the hood.

Quoted 2 lines

Presumably because someone
nack'd using your own char device or whatever?

I wasn't participating on the kernel side of the usNIC project at the time that some of the early decisions were made, but to my knowledge the uverbs stack was selected as the most appropriate way to expose this technology to users after evaluation of several approaches. I don't think that any other approach was previously submitted and NACK-ed.

-Dave

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

A message that is not in the archive (sent off-list or not yet received): DC760F33-F704-4763-AEA3-6DE9016D0687-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org

#33 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 6 lines · Dave Goodell (dgoodell)
Quoted 2 lines

I'd then guess the entire point of this is to hack some non-RDMA device to export it's interface via uverbs?

If by "non-RDMA", you mean "does not currently support hardware offload of direct data placement", then yes. There are a couple of things to keep in mind:

I actually mean 'does not provide RDMA services to the kernel'.

What actually happens if you, for instance, load the iser module and try and use it with usnic?

What parts of the RDMA core code does usnic actually use beyond command marshaling through uverbs?

Would things be easier for you if usnic lived within DPDK?

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

author
#34 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive
Quoted 21 lines · Dave Goodell (dgoodell)
Quoted 12 lines · Liran Liss
Quoted 11 lines

From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Hefty, Sean

Quoted 2 lines

I thought USNIC_UDP had an embedded USNIC protocol header inside the UDP header. That would make it a UDP_ENCAP protocol.

Someone from Cisco can correct me, but USNIC supports 2 protocols. Just plain UDP, and a proprietary protocol that runs over Ethernet, but uses the same EtherType as RoCE. I thought these could both be active on the same port at the same time.

Quoted 6 lines

'protocol' refers to what your device generates when you do a post_send() on some QP.
In the RoCE case, it is IBTA transport headers + payload over UDP encapsulation over IP. In the USNIC case, you might want the protocol to refer to addition information the distinguishes this wire protocol rather than just "I am sending UDP packets"...

Quoted 3 lines

In the case that usNIC is operating in UDP mode (which is the overwhelming majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

[^^^^^ there continues to be confusion about this for some reason, but I don't know why]

So what is this patch for?

commit 248567f79304b953ea492fb92ade097b62ed09b2

Author: Upinder Malhi <[email protected]>
Date:   Thu Jan 9 14:48:19 2014 -0800

IB/core: Add RDMA_TRANSPORT_USNIC_UDP

Add RDMA_TRANSPORT_USNIC_UDP which will be used by usNIC.

This is probably where a lot of the confusion is coming from.

Ira

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

A message that is not in the archive (sent off-list or not yet received): 20150511064232.GA3042-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org

#36 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 7 lines · ira.weiny
Quoted 4 lines · Dave Goodell (dgoodell)

In the case that usNIC is operating in UDP mode (which is the overwhelming majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

[^^^^^ there continues to be confusion about this for some reason, but I don't know why]

So what is this patch for?

Does my earlier email clarify the situation any? http://marc.info/?l=linux-rdma&m=142972178630720&w=2

Quoted 4 lines

commit 248567f79304b953ea492fb92ade097b62ed09b2

Author: Upinder Malhi <[email protected]>
Date:   Thu Jan 9 14:48:19 2014 -0800
Quoted 8 lines

IB/core: Add RDMA_TRANSPORT_USNIC_UDP

Add RDMA_TRANSPORT_USNIC_UDP which will be used by usNIC.

This is probably where a lot of the confusion is coming from.

Arguably RDMA_TRANSPORT_USNIC_UDP could/should have simply been named RDMA_TRANSPORT_UDP.

-Dave

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

A message that is not in the archive (sent off-list or not yet received): D72B89F6-B333-4DC2-9BA7-CB45EBC31843-FYB4Gu1CFyUAvxtiuMwx3w@public.gmane.org

author
#38 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 11 lines · ira.weiny
Quoted 4 lines · Dave Goodell (dgoodell)
Quoted 2 lines

In the case that usNIC is operating in UDP mode (which is the overwhelming

majority of the cases), there is absolutely no additional protocol that ends up on the wire or headers in the user buffers besides UDP/IP/Ethernet. They are 100% plain UDP packets, they just happen to be sent via OS-bypass queues instead of traveling through the kernel networking stack.

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 1 line
Quoted 1 line

[^^^^^ there continues to be confusion about this for some reason, but I

don't know why]

Quoted 2 lines

So what is this patch for?

Does my earlier email clarify the situation any? http://marc.info/?l=linux-
rdma&m=142972178630720&w=2

Somewhat, is there any reason applications need to distinguish between the " The legacy RDMA_TRANSPORT_USNIC type" and " The current RDMA_TRANSPORT_USNIC_UDP type"?

Or does the former no longer exist?

Quoted 9 lines
Quoted 9 lines

commit 248567f79304b953ea492fb92ade097b62ed09b2

Author: Upinder Malhi <[email protected]>
Date:   Thu Jan 9 14:48:19 2014 -0800

IB/core: Add RDMA_TRANSPORT_USNIC_UDP

Add RDMA_TRANSPORT_USNIC_UDP which will be used by usNIC.

Quoted 7 lines
Quoted 4 lines

This is probably where a lot of the confusion is coming from.

Arguably RDMA_TRANSPORT_USNIC_UDP could/should have simply been named RDMA_TRANSPORT_UDP.

I guess I'm wondering if there needs to be an RDMA_TRANSPORT_USNIC to represent the " The legacy RDMA_TRANSPORT_USNIC type" you mention in the link above.

Ira

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

A message that is not in the archive (sent off-list or not yet received): 2807E5FD2F6FDA4886F6618EAC48510E1107C20E-8k97q/[email protected]

#40 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 4 lines · Ira
Quoted 2 lines

Does my earlier email clarify the situation any? http://marc.info/?l=linux-
rdma&m=142972178630720&w=2

Somewhat, is there any reason applications need to distinguish between the " The legacy RDMA_TRANSPORT_USNIC type" and " The current RDMA_TRANSPORT_USNIC_UDP type"?

Addressing is different between the two (Ethernet_MAC+QP# vs. IP+UDP_port, respectively).

Also, the received UD header format and size are different between them (40-byte synthetic GRH vs. 42-byte UDP/IP/Ethernet header).

Quoted 1 line

Or does the former no longer exist?

The former is no longer being deployed and should be rare to find in the wild at this point, though I do not know precisely how many customers may be using it still. It is definitely legacy at this point.

Quoted 4 lines
Quoted 2 lines

Arguably RDMA_TRANSPORT_USNIC_UDP could/should have simply been named RDMA_TRANSPORT_UDP.

I guess I'm wondering if there needs to be an RDMA_TRANSPORT_USNIC to represent the " The legacy RDMA_TRANSPORT_USNIC type" you mention in the link above.

It probably needs to exist for a little while still.

-Dave

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

#41 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive

PiBGcm9tOiBsaW51eC1yZG1hLW93bmVyQHZnZXIua2VybmVsLm9yZyBbbWFpbHRvOmxpbnV4LXJk bWEtDQoNCj4gb3duZXJAdmdlci5rZXJuZWwub3JnXSBPbiBCZWhhbGYgT2YgSGVmdHksIFNlYW4N Cj4gPg0KPiA+IEluIGFjY29yZGFuY2Ugd2l0aCB3aGF0IHdlJ3ZlIGJlZW4gdGFsa2luZyBhYm91 dCwgZHJvcCBJQk9FIGZvciBST0NFLg0KPiA+DQo+ID4gRHJvcCB0aGUgVURQIG9mZiBvZiBVU05J QywgdGhlbiBkZWZpbmUgYSBiaXQgZm9yIENBUF9QUk9UX1VEUF9FTkNBUC4NCj4gPiBVU05JQyB3 aWxsIGJlIGp1c3QgVVNOSUMsIFVTTklDX1VEUCB3aWxsIGJlIFVTTklDIHwgVURQX0VOQ0FQLCBS T0NFIHYxDQo+ID4gd2lsbCBiZSBST0NFLCBhbmQgUk9DRXYyIHdpbGwgYmUgUk9DRSB8IFVEUF9F TkNBUC4NCj4gDQo+IFVTTkl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b3RlIGZvciBkZXByZWNhdGluZyB0aGUgcHJvdG9jb2wgZ29vZmluZXNzLg0KPiANCj4g LSBTZWFuDQoNClRoZSBwcm90b2NvbCBub3Rpb24gbWlnaHQgbm90IGhhdmUgYW55IHZhbHVlIGZv ciBVTFBzLCBidXQgaXQgaXMgdXNlZnVsIGZvciBjb3JlDQptYW5hZ2VtZW50IGNvZGUuIEFsc28s IHdoZW4gd2UgZXh0ZW5kIHRoZXNlIG5vdGlvbnMgdG8gdXNlci1zcGFjZSwgYWRtaW5zIHdpbGwN CmFjdHVhbGx5IHdhbnQgdG8ga25vdyB3aGF0IHdpcmUgcHJvdG9jb2xzIGEgY2VydGFpbiBkZXZp Y2UgY2FuIHN1cHBvcnQsIGV2ZW4NCmp1c3QgZm9yIHRoZSBzYWtlIG9mIGludGVyb3BlcmFiaWxp dHkuDQoNCi0tTGlyYW4NCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): HE1PR05MB1418E58A6EB92D92B78C76A0B1D10-eBadYZ65MZ87O8BmmlM1zNqRiQSDpxhJvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#43 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 28 lines · Liran Liss
Quoted 6 lines

From: [email protected] [mailto:linux-rdma-

[email protected]] On Behalf Of Hefty, Sean

Quoted 3 lines

In accordance with what we've been talking about, drop IBOE for ROCE.

Quoted 8 lines
Quoted 3 lines

Drop the UDP off of USNIC, then define a bit for CAP_PROT_UDP_ENCAP. USNIC will be just USNIC, USNIC_UDP will be USNIC | UDP_ENCAP, ROCE v1 will be ROCE, and ROCEv2 will be ROCE | UDP_ENCAP.

USNIC_UDP is just UDP. I don't understand why we would want 'USNIC | UDP_ENCAP', or what UDP_ENCAP is intended to convey. Nothing is being encapsulated.

I agree that the UDP_ENCAP notion is confusing.
We should stick to ROCE_V1 and ROCE_V2.

Quoted 10 lines

RoCEv2 is IB transport over UDP.

I'm not sure what the protocol field is intended to imply. If we want to expose the link, network, transport, and RDMA protocols in use, shouldn't these be separate fields or bits? And even then, I'm not sure what use this has for the ULPs. iWarp does not require Ethernet or TCP. RoCEv2 would work fine over any link. And the core layer should not assume that a device is limited to supporting only one protocol, especially at the network and transport levels. I vote for deprecating the protocol goofiness.

Quoted 6 lines
Quoted 1 line

- Sean

The protocol notion might not have any value for ULPs, but it is useful for core management code. Also, when we extend these notions to user-space, admins will actually want to know what wire protocols a certain device can support, even just for the sake of interoperability.

So I've been thinking a bit more about the overall architecture of the underlying patch set from Michael. The structure of that patch set is to a certain extent dictating this follow on patch set and so any problems in it end up being transmitted here as well.

Sean's comments about transports I think were spot on, and they got me doing a little thought exercise in my head.

Theoretically, if we were to take the SoftiWARP and SoftRoCE drivers, we could merge them down to one driver that supported both iWARP and RoCE (and we could add USNIC too I suspect). Because all of these things work on an Ethernet link layer, there is no reason they couldn't all be presented on the same device. So if you had a single verbs device that could support all of these things, where would you need to capture and store the relevant information?

This is what I have so far:

On a per device basis: not much to be honest, node_type IB_CA/RNIC for back compatibility and that's pretty much it

On a per port basis: link layer (Ethernet, IB, or OPA). Notice that I didn't include the transport here. Two of the above link layers strictly imply their transport. The third link layer could have multiple transports. Which brings me to my next level...

On a per queue pair basis: if (link_layer == Ethernet) iWARP/RoCE/USNIC

                         if (qp_type == RoCE && qp != UD) RoCEv1/RoCEv2

On a per ah basis: if (qp_type == RoCE && qp = UD) RoCEv1/RoCEv2

Michael's patch set was intended to give us a framework within which we can start cleaning things up. Once we get to cleaning things up, I think the above is where we should target storing the relevant information.

Thoughts?

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): 1431111412.2407.463.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#45 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiBUaGl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Cj4gdGhpbmsgdGhlIGFib3ZlIGlzIHdoZXJlIHdlIHNob3VsZCB0YXJnZXQgc3Rv cmluZyB0aGUgcmVsZXZhbnQNCj4gaW5mb3JtYXRpb24uDQo+IA0KPiBUaG91Z2h0cz8NCg0KSSdt IG5vdCBmb2xsb3dpbmcgeW91ciBpbnRlbnQgaGVyZS4NCg0KVGhlIHFwX3R5cGUgdmFsdWVzIGFy ZSBjdXJyZW50bHkgZGVmaW5lZCBhcyBSQywgVUMsIFVELCBYUkMsIHBsdXMgc29tZSB3ZWlyZG5l c3MgbGlrZSBTTUksIEdTSS4gIEFyZSB5b3Ugc3VnZ2VzdGluZyB0aGF0IHdlIHN0b3JlIHRoZSBy ZWxldmFudCBpbmZvcm1hdGlvbiBhcyBwYXJ0IG9mIHRoZSBxcF90eXBlLCBvciB0aGF0IHdlIGtl ZXAgdGhlIHFwX3R5cGUgYXMtaXM/DQogDQpPbmNlIE1pY2hhZWwncyBwYXRjaGVzIGFyZSBpbnRl Z3JhdGVkLCBkbyBhcHBzIG5lZWQgYW55dGhpbmcgZWxzZSBiZXlvbmQgdGhlIHFwIHR5cGUgYXMg Y3VycmVudGx5IGRlZmluZWQ/DQoNCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCD719-P5GAC/[email protected]

#47 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 20 lines · Sean
Quoted 20 lines

This is what I have so far:

On a per device basis: not much to be honest, node_type IB_CA/RNIC for back compatibility and that's pretty much it

On a per port basis: link layer (Ethernet, IB, or OPA). Notice that I didn't include the transport here. Two of the above link layers strictly imply their transport. The third link layer could have multiple transports. Which brings me to my next level...

On a per queue pair basis: if (link_layer == Ethernet) iWARP/RoCE/USNIC

                         if (qp_type == RoCE && qp != UD) RoCEv1/RoCEv2

On a per ah basis: if (qp_type == RoCE && qp = UD) RoCEv1/RoCEv2

Michael's patch set was intended to give us a framework within which we can start cleaning things up. Once we get to cleaning things up, I think the above is where we should target storing the relevant information.

Quoted 7 lines
Quoted 1 line

Thoughts?

I'm not following your intent here.

The qp_type values are currently defined as RC, UC, UD, XRC, plus some weirdness like SMI, GSI. Are you suggesting that we store the relevant information as part of the qp_type, or that we keep the qp_type as-is?

Well, you note I wrote qp != UD, where as that's really the qp_type, so the above was psuedo code at best. I was necessarily suggesting where in the qp data struct to store it, just that even though there isn't hardware that does this (yet), there's no reason hardware couldn't be designed to support both iWARP and RoCE and USNIC over the same Ethernet link layer, and merging the SoftRoCE and SoftiWARP drivers would make a proof of concept, and so we would *have* to store that information on a per QP basis.

Quoted 2 lines

Once Michael's patches are integrated, do apps need anything else
beyond the qp type as currently defined?

If you had a device that supported iWARP and RoCE on the same physical link layer, then yes, the app would need a means of saying which transport to use in addition to the type of QP to establish.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): 1431117051.2407.468.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#49 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiBXZWxsLCB5b3Ugbm90ZSBJIHdyb3RlIHFwICE9IFVELCB3aGVyZSBhcyB0aGF0J3MgcmVhbGx5 IHRoZSBxcF90eXBlLCBzbw0KPiB0aGUgYWJvdmUgd2FzIHBzdWVkbyBjb2RlIGF0IGJlc3QuICBJ IHdhcyBuZWNlc3NhcmlseSBzdWdnZXN0aW5nIHdoZXJlDQo+IGluIHRoZSBxcCBkYXRhIHN0cnVj dCB0byBzdG9yZSBpdCwganVzdCB0aGF0IGV2ZW4gdGhvdWdoIHRoZXJlIGlzbid0DQo+IGhhcmR3 YXJlIHRoYXQgZG9lcyB0aGlzICh5ZXQpLCB0aGVyZSdzIG5vIHJlYXNvbiBoYXJkd2FyZSBjb3Vs ZG4ndCBiZQ0KPiBkZXNpZ25lZCB0byBzdXBwb3J0IGJvdGggaVdBUlAgYW5kIFJvQ0UgYW5kIFVT TklDIG92ZXIgdGhlIHNhbWUgRXRoZXJuZXQNCj4gbGluayBsYXllciwgYW5kIG1lcmdpbmcgdGhl IFNvZnRSb0NFIGFuZCBTb2Z0aVdBUlAgZHJpdmVycyB3b3VsZCBtYWtlIGENCj4gcHJvb2Ygb2Yg Y29uY2VwdCwgYW5kIHNvIHdlIHdvdWxkICpoYXZlKiB0byBzdG9yZSB0aGF0IGluZm9ybWF0aW9u IG9uIGENCj4gcGVyIFFQIGJhc2lzLg0KPiANCj4gPg0KPiAgT25jZSBNaWNoYWVsJ3MgcGF0Y2hl cyBhcmUgaW50ZWdyYXRlZCwgZG8gYXBwcyBuZWVkIGFueXRoaW5nIGVsc2UNCj4gPiBiZXlvbmQg dGhlIHFwIHR5cGUgYXMgY3VycmVudGx5IGRlZmluZWQ/DQo+IA0KPiBJZiB5b3UgaGFkIGEgZGV2 aWNlIHRoYXQgc3VwcG9ydGVkIGlXQVJQIGFuZCBSb0NFIG9uIHRoZSBzYW1lIHBoeXNpY2FsDQo+ IGxpbmsgbGF5ZXIsIHRoZW4geWVzLCB0aGUgYXBwIHdvdWxkIG5lZWQgYSBtZWFucyBvZiBzYXlp bmcgd2hpY2gNCj4gdHJhbnNwb3J0IHRvIHVzZSBpbiBhZGRpdGlvbiB0byB0aGUgdHlwZSBvZiBR UCB0byBlc3RhYmxpc2guDQoNCkFoIC0gZ290IGl0IG5vdy4gIEFuZCBJIGFncmVlLCB0aGVyZSBz aG91bGQgYmUgc29tZSB3YXkgdG8gc3BlY2lmeSB0aGlzIGF0IHRoZSBRUCBsZXZlbC4gDQo= --
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCD78C-P5GAC/[email protected]

#51 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 6 lines · Sean
Quoted 3 lines

If you had a device that supported iWARP and RoCE on the same physical link layer, then yes, the app would need a means of saying which transport to use in addition to the type of QP to establish.

Ah - got it now. And I agree, there should be some way to specify this at the QP level.

Yes, the only way out is to specify on a per QP basis the addressing and protocol/transport/whatever thing. Socket uses the AF,SOCK,PROTO tuple to specify this information. We can probably productively use a similar breakdown:

AF_IB,SOCK_RC,PROTO_IBA // InfiniBand
AF_OPA,SOCK_RC,PROTO_IBA // Future 32 bit LID OPB 'InfiniBand' AF_ETH,SOCK_RC,PROTO_IBA // RoCEv1
AF_INET,SOCK_RC,PROTO_IBA // InfiniBand or RoCEv2, depending on the Link Layer AF_ETH,SOCK_RC,PROTO_USNIC
AF_INET,SOCK_RC,PROTO_USNIC
AF_INET,SOCK_RC,PROTO_IWARP

The expectation would be that any SOCK,PROTO combination can 'interoperate' with any AF combination - which is true with the above examples, ie with the right magic NAT hardware RoCEv2/v1/IB/(OPA?) can all interwork at the BTH layer.

Which is to also say, it also unambiguously implies which standard defines the subtle verbs varietions that the app has to cope with.

Incompatible AH's can not be used with the wrong type of QP, the CM layers would auto create QPs with the correct type to reflect how the CM process was run, etc.

But Michael's patches are still an improvement, ie a RoCE + iWarp port would still have the cap_mad as true and would still have to create a QP1 interface, which I think is captured OK. The CM side probably explodes if a port is both iWarp and RoCE, but that is alot of work to fix anyhow..

I think we have to tackle the addressing problem as part of the RoCEv2 stuff, just burying all this in a qp index is really horrible.

Realistically, today, if a RoCE/iWarp driver appeared then it would have to present to the system as two RDMA devices.

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

A message that is not in the archive (sent off-list or not yet received): 20150508214855.GA3917-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#53 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 8 lines

From: Jason Gunthorpe [mailto:jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org]

Quoted 6 lines
Quoted 3 lines

If you had a device that supported iWARP and RoCE on the same physical link layer, then yes, the app would need a means of saying which transport to use in addition to the type of QP to establish.

Ah - got it now. And I agree, there should be some way to specify this at the QP level.

Supporting iWARP and RoCE over the same RDMA device makes no sense. First of all, it is confusing to the user. It's like supporting SRP and iSCSI using the same SCSI device instance...

Second, different technologies affect much more than the QP.
A technology determines the format and semantics of the whole interface. For example, AHs, memory windows, atomics, CQE formats are different as well. Just thinking of how to abstract all these in single device is mind-boggling.

Finally, there is no sane way to describe device capabilities. There is no single set of capabilities that applies to all of these technologies consistently.

Quoted 5 lines

Yes, the only way out is to specify on a per QP basis the addressing and protocol/transport/whatever thing. Socket uses the AF,SOCK,PROTO tuple to specify this information. We can probably productively use a similar breakdown:

We might consider such abstractions at the CMA layer, not at the device level. Essentially, this is what the CMA was intended for.

Quoted 3 lines

AF_IB,SOCK_RC,PROTO_IBA // InfiniBand AF_OPA,SOCK_RC,PROTO_IBA // Future 32 bit LID OPB 'InfiniBand'

This is not PROTO_IBA.

Quoted 5 lines

AF_ETH,SOCK_RC,PROTO_IBA // RoCEv1
AF_INET,SOCK_RC,PROTO_IBA // InfiniBand or RoCEv2, depending on the Link Layer AF_ETH,SOCK_RC,PROTO_USNIC AF_INET,SOCK_RC,PROTO_USNIC AF_INET,SOCK_RC,PROTO_IWARP

[snip]

Quoted 5 lines

Realistically, today, if a RoCE/iWarp driver appeared then it would have to present to the system as two RDMA devices.

Exactly!
--Liran
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#54 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive
Quoted 11 lines
drivers/infiniband/core/device.c +6 -0
@@ -302,12 +333,21 @@ int ib_register_device(struct ib_device *device,
 		goto out;
 	}
 
+	ret = read_core_cap_flags(device);
+	if (ret) {
+		dev_err(&device->dev, "Couldn't create Core Capability
 flags\n");
+		kfree(device->gid_tbl_len);
+		kfree(device->pkey_tbl_len);
+		goto out;

drivers/infiniband/core/device.c int ib_register_device(struct ib_device *device, · line 352

Quoted 10 lines
drivers/infiniband/core/device.c +3 -0
+	}
+
 	ret = ib_device_register_sysfs(device, port_callback);
 	if (ret) {
 		printk(KERN_WARNING "Couldn't register device %s with driver
 model\n",
 		       device->name);
 		kfree(device->gid_tbl_len);
 		kfree(device->pkey_tbl_len);
+		kfree(device->core_cap_flags);

Use a common exit location to avoid duplicating the kfree's on errors.

Quoted 54 lines
(quoted diff) +0 -0
 		goto out;
drivers/infiniband/core/device.c +1 -0
 	}
@@ -351,6 +391,7 @@ void ib_unregister_device(struct ib_device *device)
 
 	kfree(device->gid_tbl_len);
 	kfree(device->pkey_tbl_len);
+	kfree(device->core_cap_flags);
 
 	mutex_unlock(&device_mutex);
 
include/rdma/ib_verbs.h +1 -0
index c724114..4de2758 100644
@@ -353,11 +353,32 @@ union rdma_protocol_stats {
 	struct iw_protocol_stats	iw;
 };
 
+/* Define bits for the various functionality this port needs to be

supported by
+ * the core.
+ */

include/rdma/ib_verbs.h +19 -0
+/* Management                           0x00000000FFFFFFFF */
+#define RDMA_CORE_CAP_IB_MAD		0x0000000000000001ULL
+#define RDMA_CORE_CAP_IB_SMI		0x0000000000000002ULL
+#define RDMA_CORE_CAP_IB_CM		0x0000000000000004ULL
+#define RDMA_CORE_CAP_IW_CM		0x0000000000000008ULL
+#define RDMA_CORE_CAP_IB_SA		0x0000000000000010ULL
+
+/* Address format                       0x0000FFFF00000000 */
+#define RDMA_CORE_CAP_AF_IB		0x0000000100000000ULL
+#define RDMA_CORE_CAP_ETH_AH		0x0000000200000000ULL
+
+/* Protocol                             0xFFFF000000000000 */
+#define RDMA_CORE_CAP_PROT_IB		0x0001000000000000ULL
+#define RDMA_CORE_CAP_PROT_IBOE		0x0002000000000000ULL
+#define RDMA_CORE_CAP_PROT_IWARP	0x0004000000000000ULL
+#define RDMA_CORE_CAP_PROT_USNIC_UDP	0x0008000000000000ULL
+
 struct ib_port_attr {
 	enum ib_port_state	state;
 	enum ib_mtu		max_mtu;
 	enum ib_mtu		active_mtu;
 	int			gid_tbl_len;
+	u64                     core_cap_flags;
 	u32			port_cap_flags;
 	u32			max_msg_sz;
 	u32			bad_pkey_cntr;
@@ -1684,6 +1705,7 @@ struct ib_device {
 	u32			     local_dma_lkey;
 	u8                           node_type;
 	u8                           phys_port_cnt;
+	u64                         *core_cap_flags; /* Per port core
Quoted 1 line

capability flags */

Why are the core_cap_flags duplicated in the struct and in port attributes?

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

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCA192-P5GAC/[email protected]

#56 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 9 lines · Sean
Quoted 9 lines

struct ib_port_attr {

include/rdma/ib_verbs.h +1 -0
 	enum ib_port_state	state;
 	enum ib_mtu		max_mtu;
 	enum ib_mtu		active_mtu;
 	int			gid_tbl_len;
+	u64                     core_cap_flags;
 	u32			port_cap_flags;
 	u32			max_msg_sz;
 	u32			bad_pkey_cntr;
Quoted 8 lines
Quoted 6 lines
include/rdma/ib_verbs.h +1 -0
@@ -1684,6 +1705,7 @@ struct ib_device {
 	u32			     local_dma_lkey;
 	u8                           node_type;
 	u8                           phys_port_cnt;
+	u64                         *core_cap_flags; /* Per port core

capability flags */

Why are the core_cap_flags duplicated in the struct and in port attributes?

Because the per port ib_port_attr struct is not visible to the core code, it must call ib_query_port each time it wants to see it. In order to make the helpers avoid a call, you have to stash the cap_flags into the ib_device struct. In the past, the only thing there was the node_type, and it was per device and not per node. In order to make all of this work and not require calls into the driver all the time, that has to change to a per-port array. Eventually we could get rid of the node_type element once everything is in place.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): [email protected]

#58 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiA+ID4gIHN0cnVjdCBpYl9wb3J0X2F0dHIgew0KPiA+ID4gIAllbnVtIGliX3BvcnRfc3RhdGUJ c3RhdGU7DQo+ID4gPiAgCWVudW0gaWJfbXR1CQltYXhfbXR1Ow0KPiA+ID4gIAllbnVtIGliX210 dQkJYWN0aXZlX210dTsNCj4gPiA+ICAJaW50CQkJZ2lkX3RibF9sZW47DQo+ID4gPiArCXU2NCAg ICAgICAgICAgICAgICAgICAgIGNvcmVfY2FwX2ZsYWdzOw0KPiA+ID4gIAl1MzIJCQlwb3J0X2Nh cF9mbGFnczsNCj4gPiA+ICAJdTMyCQkJbWF4X21zZ19zejsNCj4gPiA+ICAJdTMyCQkJYmFkX3Br ZXlfY250cjsNCj4gPiA+IEBAIC0xNjg0LDYgKzE3MDUsNyBAQCBzdHJ1Y3QgaWJfZGV2aWNlIHsN Cj4gPiA+ICAJdTMyCQkJICAgICBsb2NhbF9kbWFfbGtleTsNCj4gPiA+ICAJdTggICAgICAgICAg ICAgICAgICAgICAgICAgICBub2RlX3R5cGU7DQo+ID4gPiAgCXU4ICAgICAgICAgICAgICAgICAg ICAgICAgICAgcGh5c19wb3J0X2NudDsNCj4gPiA+ICsJdTY0ICAgICAgICAgICAgICAgICAgICAg ICAgICpjb3JlX2NhcF9mbGFnczsgLyogUGVyIHBvcnQgY29yZQ0KPiA+ID4gY2FwYWJpbGl0eSBm bGFncyAqLw0KPiA+DQo+ID4gV2h5IGFyZSB0aGUgY29yZV9jYXBfZmxhZ3MgZHVwbGljYXRlZCBp biB0aGUgc3RydWN0IGFuZCBpbiBwb3J0DQo+IGF0dHJpYnV0ZXM/DQo+IA0KPiBCZWNhdXNlIHRo ZSBwZXIgcG9ydCBpYl9wb3J0X2F0dHIgc3RydWN0IGlzIG5vdCB2aXNpYmxlIHRvIHRoZSBjb3Jl DQo+IGNvZGUsIGl0IG11c3QgY2FsbCBpYl9xdWVyeV9wb3J0IGVhY2ggdGltZSBpdCB3YW50cyB0 byBzZWUgaXQuICBJbiBvcmRlcg0KPiB0byBtYWtlIHRoZSBoZWxwZXJzIGF2b2lkIGEgY2FsbCwg eW91IGhhdmUgdG8gc3Rhc2ggdGhlIGNhcF9mbGFncyBpbnRvDQo+IHRoZSBpYl9kZXZpY2Ugc3Ry dWN0LiAgSW4gdGhlIHBhc3QsIHRoZSBvbmx5IHRoaW5nIHRoZXJlIHdhcyB0aGUNCj4gbm9kZV90 eXBlLCBhbmQgaXQgd2FzIHBlciBkZXZpY2UgYW5kIG5vdCBwZXIgbm9kZS4gIEluIG9yZGVyIHRv IG1ha2UgYWxsDQo+IG9mIHRoaXMgd29yayBhbmQgbm90IHJlcXVpcmUgY2FsbHMgaW50byB0aGUg ZHJpdmVyIGFsbCB0aGUgdGltZSwgdGhhdA0KPiBoYXMgdG8gY2hhbmdlIHRvIGEgcGVyLXBvcnQg YXJyYXkuICBFdmVudHVhbGx5IHdlIGNvdWxkIGdldCByaWQgb2YgdGhlDQo+IG5vZGVfdHlwZSBl bGVtZW50IG9uY2UgZXZlcnl0aGluZyBpcyBpbiBwbGFjZS4NCg0KSSB1bmRlcnN0YW5kIHdoeSB0 aGV5IGFyZSBpbiBzdHJ1Y3QgaWJfZGV2aWNlLCBidXQgd2h5IGFyZSB0aGV5IGR1cGxpY2F0ZWQg aW4gc3RydWN0IGliX3BvcnRfYXR0cj8NCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCA1D9-P5GAC/[email protected]

#60 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 28 lines · Sean
Quoted 19 lines
Quoted 9 lines
Quoted 9 lines

struct ib_port_attr {

(quoted diff) +1 -0
 	enum ib_port_state	state;
 	enum ib_mtu		max_mtu;
 	enum ib_mtu		active_mtu;
 	int			gid_tbl_len;
+	u64                     core_cap_flags;
 	u32			port_cap_flags;
 	u32			max_msg_sz;
 	u32			bad_pkey_cntr;
Quoted 8 lines
Quoted 6 lines
(quoted diff) +1 -0
@@ -1684,6 +1705,7 @@ struct ib_device {
 	u32			     local_dma_lkey;
 	u8                           node_type;
 	u8                           phys_port_cnt;
+	u64                         *core_cap_flags; /* Per port core

capability flags */

Why are the core_cap_flags duplicated in the struct and in port

attributes?

Quoted 8 lines

Because the per port ib_port_attr struct is not visible to the core code, it must call ib_query_port each time it wants to see it. In order to make the helpers avoid a call, you have to stash the cap_flags into the ib_device struct. In the past, the only thing there was the node_type, and it was per device and not per node. In order to make all of this work and not require calls into the driver all the time, that has to change to a per-port array. Eventually we could get rid of the node_type element once everything is in place.

Quoted 1 line

I understand why they are in struct ib_device, but why are they duplicated in struct ib_port_attr?

Because ib_query_port returns a struct, so this must be an element of that struct or it can't be returned (without adding a new, single use driver upcall).

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD

A message that is not in the archive (sent off-list or not yet received): [email protected]

#62 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiBCZWNhdXNlIGliX3F1ZXJ5X3BvcnQgcmV0dXJucyBhIHN0cnVjdCwgc28gdGhpcyBtdXN0IGJl IGFuIGVsZW1lbnQgb2YNCj4gdGhhdCBzdHJ1Y3Qgb3IgaXQgY2FuJ3QgYmUgcmV0dXJuZWQgKHdp dGhvdXQgYWRkaW5nIGEgbmV3LCBzaW5nbGUgdXNlDQo+IGRyaXZlciB1cGNhbGwpLg0KDQpObSAt IFRoaXMgY291bGQgYmUgY2xlYXJlciBpZiB0aGUgZnVuY3Rpb25hbGl0eSB3ZXJlIGZvbGRlZCBp bnRvIHRoZSAncmVhZF9wb3J0X3RhYmxlX2xlbmd0aHMnIGZ1bmN0aW9uLg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373A8FCA217-P5GAC/[email protected]

author
#64 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiANCj4gPiBCZWNhdXNlIGliX3F1ZXJ5X3BvcnQgcmV0dXJucyBhIHN0cnVjdCwgc28gdGhpcyBt dXN0IGJlIGFuIGVsZW1lbnQgb2YNCj4gPiB0aGF0IHN0cnVjdCBvciBpdCBjYW4ndCBiZSByZXR1 cm5lZCAod2l0aG91dCBhZGRpbmcgYSBuZXcsIHNpbmdsZSB1c2UNCj4gPiBkcml2ZXIgdXBjYWxs KS4NCj4gDQo+IE5tIC0gVGhpcyBjb3VsZCBiZSBjbGVhcmVyIGlmIHRoZSBmdW5jdGlvbmFsaXR5 IHdlcmUgZm9sZGVkIGludG8gdGhlDQo+ICdyZWFkX3BvcnRfdGFibGVfbGVuZ3RocycgZnVuY3Rp b24uDQoNCkkgdGhvdWdodCBvZiBkb2luZyB0aGF0IGJ1dCB0aGVuIHRoZSBmdW5jdGlvbiBuYW1l IG5vIGxvbmdlciBtYXRjaGVzIHRoZSBmdW5jdGlvbmFsaXR5Lg0KDQpJIGNvdWxkIGNoYW5nZSBp dCB0bzoNCg0KcmVhZF9wZXJfcG9ydF9pbmZvKC4uLikNCg0KQW5kIGFkZCB0aGUgYml0cyB0aGVy ZS4NCg0KSXJhDQoNCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 2807E5FD2F6FDA4886F6618EAC48510E11069818-8k97q/[email protected]

#66 lore raw

RE: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

PiA+IE5tIC0gVGhpcyBjb3VsZCBiZSBjbGVhcmVyIGlmIHRoZSBmdW5jdGlvbmFsaXR5IHdlcmUg Zm9sZGVkIGludG8gdGhlDQo+ID4gJ3JlYWRfcG9ydF90YWJsZV9sZW5ndGhzJyBmdW5jdGlvbi4N Cj4gDQo+IEkgdGhvdWdodCBvZiBkb2luZyB0aGF0IGJ1dCB0aGVuIHRoZSBmdW5jdGlvbiBuYW1l IG5vIGxvbmdlciBtYXRjaGVzIHRoZQ0KPiBmdW5jdGlvbmFsaXR5Lg0KPiANCj4gSSBjb3VsZCBj aGFuZ2UgaXQgdG86DQo+IA0KPiByZWFkX3Blcl9wb3J0X2luZm8oLi4uKQ0KDQpUaGF0IG1ha2Vz IHNlbnNlLiANCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#67 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

In reply to a message not in the archive
Quoted 4 lines · On Mon, May 04, 2015 at 02:14:55AM -0400…

From: Ira Weiny <[email protected]>

Add Core capability flags to each port attribute and read those into ib_device upon registration for each port.

+1 on adding it to read_port_table_lengths

But this whole thing is starting to get goofy, 3rd add gets the work to fix it up I guess.

Pull pkey_tbl_len, gid_tbl_len and your new thing into a single struct and allocate an array of them.

Actually, why not just allocate an array of ib_port_attrs and fill that? Then you can use it for the mad size too.

Not in your patch, but why does read_port_table_lengths use a kmalloc for what should be a stack allocation? Yuk.

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

A message that is not in the archive (sent off-list or not yet received): 20150504183657.GA20586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

author
#69 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 10 lines · Jason Gunthorpe
Quoted 4 lines · On Mon, May 04, 2015 at 02:14:55AM -0400…

From: Ira Weiny <[email protected]>

Add Core capability flags to each port attribute and read those into ib_device upon registration for each port.

+1 on adding it to read_port_table_lengths

But this whole thing is starting to get goofy,

<quote>

Quoted 2 lines

3rd add gets the work
to fix it up I guess.

</quote>

I don't understand this comment?

Quoted 6 lines

Pull pkey_tbl_len, gid_tbl_len and your new thing into a single struct and allocate an array of them.

Actually, why not just allocate an array of ib_port_attrs and fill that? Then you can use it for the mad size too.

That was debated before and I was hoping to leave that for another day.

It does make some sense to roll it in here.

Quoted 3 lines

Not in your patch, but why does read_port_table_lengths use a kmalloc for what should be a stack allocation? Yuk.

I don't know. I almost submitted a separate patch for that. I will clean it up when I combine the functions.

I also don't like the way the arrays in read_port_table_lengths are handled. This requires a start_port call when comparing bits. It is easier to just make the array 1 based with index 0 valid only for switches.

This is part of the reason there is a separate function and array.

Ira

Quoted 2 lines

Jason

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

A message that is not in the archive (sent off-list or not yet received): 20150504223234.GB10115-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org

author
#71 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 9 lines
Quoted 5 lines

Pull pkey_tbl_len, gid_tbl_len and your new thing into a single struct and allocate an array of them.

Actually, why not just allocate an array of ib_port_attrs and fill that? Then you can use it for the mad size too.

That was debated before and I was hoping to leave that for another day.

It does make some sense to roll it in here.

I remember more details now...

This came up in my original OPA patch series when Sean objected to me calling the port attributes "cached_port_attr".

There are a number of values in the ib_port_attr structure which are not fixed (state, active_mtu, lid, sm_lid, etc...)

Putting another copy of this data in the device will be confusing to know which of these one can count on for the correct data.

I did not write the table length code so I am assuming that data is immutable. As is the max MAD size, and these new capability bits. But storing the entire ib_port_attr structure is probably going to mislead someone.

Do we still think this is a good idea? I think putting in a single struct with the proper immutable data is the proper way to go.

Ira

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

A message that is not in the archive (sent off-list or not yet received): 20150504231622.GE10115-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org

#73 lore raw

Re: [RFC PATCH 1/5] IB/core: Add Core Capability flags to ib_device

Quoted 6 lines · ira.weiny
Quoted 6 lines
Quoted 5 lines

Pull pkey_tbl_len, gid_tbl_len and your new thing into a single struct and allocate an array of them.

Actually, why not just allocate an array of ib_port_attrs and fill that? Then you can use it for the mad size too.

Quoted 8 lines
Quoted 3 lines

That was debated before and I was hoping to leave that for another day.

It does make some sense to roll it in here.

I remember more details now...

This came up in my original OPA patch series when Sean objected to me calling the port attributes "cached_port_attr".

Yeah, not a great name for storing immutable values. port_properties or something.

Quoted 2 lines

There are a number of values in the ib_port_attr structure which are not fixed (state, active_mtu, lid, sm_lid, etc...)

Yes, there are alot of those..

So, a new struct is better, and this has just gotten so messy.

- Update ib_alloc_device to accept a num_ports argument and create the port-port array at that point
- Have the drivers fill in their per port values before calling ib_register. Delete read_port_table_lengths
- Get ib_dealloc_device to free the list instead of unregister, feels like keeping that memory around for the duration of the kref is smarter..
- Drop gid_tbl_len and pkey_tbl_len for the new scheme
- Mark all the old immutable attrs in ib_port_attrs as deprecated and if any are easy to remove then do so..
- Don't add the caps or the max mad size immutables to port_attrs

Quoted 5 lines

<quote>

Quoted 2 lines

3rd add gets the work
to fix it up I guess.

</quote>
I don't understand this comment?

gid_tbl_len, pkey_tbl_len were the first two to use a 'shortcut' here, your caps and/or max mad size are the third to take the 'shortcut'.

Rule of threes: The third person to extend the same badly designed widget gets to fix it properly.

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

#74 lore raw

RFC PATCH 2/5 IB/core: Replace query_protocol callback with Core Capability flags check

In reply to a message not in the archive

From: Ira Weiny <[email protected]>

Replace the query_protocol with a check against the Core Capabilities Flags. This is more efficient than a function call.

---
 drivers/infiniband/core/device.c             |    1 -
 drivers/infiniband/hw/amso1100/c2_provider.c |    8 +-------
 drivers/infiniband/hw/cxgb3/iwch_provider.c  |    8 +-------
 drivers/infiniband/hw/cxgb4/provider.c       |    8 +-------
 drivers/infiniband/hw/ehca/ehca_hca.c        |    8 ++------
 drivers/infiniband/hw/ehca/ehca_main.c       |    1 -
 drivers/infiniband/hw/ipath/ipath_verbs.c    |    8 +-------
 drivers/infiniband/hw/mlx4/main.c            |   13 +++----------
 drivers/infiniband/hw/mlx5/main.c            |    9 ++-------
 drivers/infiniband/hw/mthca/mthca_provider.c |    8 +-------
 drivers/infiniband/hw/nes/nes_verbs.c        |    8 +-------
 drivers/infiniband/hw/ocrdma/ocrdma_main.c   |    1 -
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |    7 +------
 drivers/infiniband/hw/qib/qib_verbs.c        |    8 +-------
 drivers/infiniband/hw/usnic/usnic_ib_main.c  |    1 -
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c |    7 +------
 include/rdma/ib_verbs.h                      |   13 ++++++-------
 17 files changed, 22 insertions(+), 95 deletions(-)
drivers/infiniband/core/device.c +0 -1
index 6a37255..fd8961a 100644
@@ -76,7 +76,6 @@ static int ib_device_check_mandatory(struct ib_device *device)
 	} mandatory_table[] = {
 		IB_MANDATORY_FUNC(query_device),
 		IB_MANDATORY_FUNC(query_port),
-		IB_MANDATORY_FUNC(query_protocol),
 		IB_MANDATORY_FUNC(query_pkey),
 		IB_MANDATORY_FUNC(query_gid),
 		IB_MANDATORY_FUNC(alloc_pd),
drivers/infiniband/hw/amso1100/c2_provider.c +1 -7
index 6fe329a..b9300db 100644
@@ -95,16 +95,11 @@ static int c2_query_port(struct ib_device *ibdev,
 	props->qkey_viol_cntr = 0;
 	props->active_width = 1;
 	props->active_speed = IB_SPEED_SDR;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IWARP;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-c2_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IWARP;
-}
-
 static int c2_query_pkey(struct ib_device *ibdev,
 			 u8 port, u16 index, u16 * pkey)
 {
@@ -807,7 +802,6 @@ int c2_register_device(struct c2_dev *dev)
 	dev->ibdev.dma_device = &dev->pcidev->dev;
 	dev->ibdev.query_device = c2_query_device;
 	dev->ibdev.query_port = c2_query_port;
-	dev->ibdev.query_protocol = c2_query_protocol;
 	dev->ibdev.query_pkey = c2_query_pkey;
 	dev->ibdev.query_gid = c2_query_gid;
 	dev->ibdev.alloc_ucontext = c2_alloc_ucontext;
drivers/infiniband/hw/cxgb3/iwch_provider.c +1 -7
index 298d1ca..e270846 100644
@@ -1228,16 +1228,11 @@ static int iwch_query_port(struct ib_device *ibdev,
 	props->active_width = 2;
 	props->active_speed = IB_SPEED_DDR;
 	props->max_msg_sz = -1;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IWARP;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-iwch_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IWARP;
-}
-
 static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
 			char *buf)
 {
@@ -1391,7 +1386,6 @@ int iwch_register_device(struct iwch_dev *dev)
 	dev->ibdev.dma_device = &(dev->rdev.rnic_info.pdev->dev);
 	dev->ibdev.query_device = iwch_query_device;
 	dev->ibdev.query_port = iwch_query_port;
-	dev->ibdev.query_protocol = iwch_query_protocol;
 	dev->ibdev.query_pkey = iwch_query_pkey;
 	dev->ibdev.query_gid = iwch_query_gid;
 	dev->ibdev.alloc_ucontext = iwch_alloc_ucontext;
drivers/infiniband/hw/cxgb4/provider.c +1 -7
index f52ee63..ff63344 100644
@@ -386,16 +386,11 @@ static int c4iw_query_port(struct ib_device *ibdev, u8 port,
 	props->active_width = 2;
 	props->active_speed = IB_SPEED_DDR;
 	props->max_msg_sz = -1;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IWARP;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-c4iw_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IWARP;
-}
-
 static ssize_t show_rev(struct device *dev, struct device_attribute *attr,
 			char *buf)
 {
@@ -512,7 +507,6 @@ int c4iw_register_device(struct c4iw_dev *dev)
 	dev->ibdev.dma_device = &(dev->rdev.lldi.pdev->dev);
 	dev->ibdev.query_device = c4iw_query_device;
 	dev->ibdev.query_port = c4iw_query_port;
-	dev->ibdev.query_protocol = c4iw_query_protocol;
 	dev->ibdev.query_pkey = c4iw_query_pkey;
 	dev->ibdev.query_gid = c4iw_query_gid;
 	dev->ibdev.alloc_ucontext = c4iw_alloc_ucontext;
drivers/infiniband/hw/ehca/ehca_hca.c +2 -6
index 1f4dc9c..75f5353 100644
@@ -236,18 +236,14 @@ int ehca_query_port(struct ib_device *ibdev,
 		props->active_speed    = IB_SPEED_SDR;
 	}
 
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+
 query_port1:
 	ehca_free_fw_ctrlblock(rblock);
 
 	return ret;
 }
 
-enum rdma_protocol_type
-ehca_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IB;
-}
-
 int ehca_query_sma_attr(struct ehca_shca *shca,
 			u8 port, struct ehca_sma_attr *attr)
 {
drivers/infiniband/hw/ehca/ehca_main.c +0 -1
index 321545b..cd8d290 100644
@@ -467,7 +467,6 @@ static int ehca_init_device(struct ehca_shca *shca)
 	shca->ib_device.dma_device          = &shca->ofdev->dev;
 	shca->ib_device.query_device        = ehca_query_device;
 	shca->ib_device.query_port          = ehca_query_port;
-	shca->ib_device.query_protocol      = ehca_query_protocol;
 	shca->ib_device.query_gid           = ehca_query_gid;
 	shca->ib_device.query_pkey          = ehca_query_pkey;
 	/* shca->in_device.modify_device    = ehca_modify_device    */
drivers/infiniband/hw/ipath/ipath_verbs.c +1 -7
index 34b94c3..94a03eb 100644
@@ -1634,16 +1634,11 @@ static int ipath_query_port(struct ib_device *ibdev,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = dev->subnet_timeout;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-ipath_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IB;
-}
-
 static int ipath_modify_device(struct ib_device *device,
 			       int device_modify_mask,
 			       struct ib_device_modify *device_modify)
@@ -2146,7 +2141,6 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
 	dev->query_device = ipath_query_device;
 	dev->modify_device = ipath_modify_device;
 	dev->query_port = ipath_query_port;
-	dev->query_protocol = ipath_query_protocol;
 	dev->modify_port = ipath_modify_port;
 	dev->query_pkey = ipath_query_pkey;
 	dev->query_gid = ipath_query_gid;
drivers/infiniband/hw/mlx4/main.c +3 -10
index 26678d2..fa4e45c 100644
@@ -330,6 +330,8 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
 	if (props->state == IB_PORT_DOWN)
 		 props->active_speed = IB_SPEED_SDR;
 
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+
 out:
 	kfree(in_mad);
 	kfree(out_mad);
@@ -390,6 +392,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
 	props->state		= (netif_running(ndev) && netif_carrier_ok(ndev)) ?
 					IB_PORT_ACTIVE : IB_PORT_DOWN;
 	props->phys_state	= state_to_phys_state(props->state);
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IBOE;
 out_unlock:
 	spin_unlock_bh(&iboe->lock);
 	if (is_bonded)
@@ -420,15 +423,6 @@ static int mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
 	return __mlx4_ib_query_port(ibdev, port, props, 0);
 }
 
-static enum rdma_protocol_type
-mlx4_ib_query_protocol(struct ib_device *device, u8 port_num)
-{
-	struct mlx4_dev *dev = to_mdev(device)->dev;
-
-	return dev->caps.port_mask[port_num] == MLX4_PORT_TYPE_IB ?
-		RDMA_PROTOCOL_IB : RDMA_PROTOCOL_IBOE;
-}
-
 int __mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
 			union ib_gid *gid, int netw_view)
 {
@@ -2211,7 +2205,6 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
 
 	ibdev->ib_dev.query_device	= mlx4_ib_query_device;
 	ibdev->ib_dev.query_port	= mlx4_ib_query_port;
-	ibdev->ib_dev.query_protocol	= mlx4_ib_query_protocol;
 	ibdev->ib_dev.get_link_layer	= mlx4_ib_port_link_layer;
 	ibdev->ib_dev.query_gid		= mlx4_ib_query_gid;
 	ibdev->ib_dev.query_pkey	= mlx4_ib_query_pkey;
drivers/infiniband/hw/mlx5/main.c +2 -7
index 8dec380..e3cdc17 100644
@@ -255,6 +255,8 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port,
 		}
 	}
 
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IB;
+
 out:
 	kfree(in_mad);
 	kfree(out_mad);
@@ -262,12 +264,6 @@ out:
 	return err;
 }
 
-static enum rdma_protocol_type
-mlx5_ib_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IB;
-}
-
 static int mlx5_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
 			     union ib_gid *gid)
 {
@@ -1250,7 +1246,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
 
 	dev->ib_dev.query_device	= mlx5_ib_query_device;
 	dev->ib_dev.query_port		= mlx5_ib_query_port;
-	dev->ib_dev.query_protocol	= mlx5_ib_query_protocol;
 	dev->ib_dev.query_gid		= mlx5_ib_query_gid;
 	dev->ib_dev.query_pkey		= mlx5_ib_query_pkey;
 	dev->ib_dev.modify_device	= mlx5_ib_modify_device;
drivers/infiniband/hw/mthca/mthca_provider.c +1 -7
index ad1cca3..e49aece 100644
@@ -172,6 +172,7 @@ static int mthca_query_port(struct ib_device *ibdev,
 	props->subnet_timeout    = out_mad->data[51] & 0x1f;
 	props->max_vl_num        = out_mad->data[37] >> 4;
 	props->init_type_reply   = out_mad->data[41] >> 4;
+	props->core_cap_flags    = RDMA_CORE_CAP_PROT_IB;
 
  out:
 	kfree(in_mad);
@@ -179,12 +180,6 @@ static int mthca_query_port(struct ib_device *ibdev,
 	return err;
 }
 
-static enum rdma_protocol_type
-mthca_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IB;
-}
-
 static int mthca_modify_device(struct ib_device *ibdev,
 			       int mask,
 			       struct ib_device_modify *props)
@@ -1287,7 +1282,6 @@ int mthca_register_device(struct mthca_dev *dev)
 	dev->ib_dev.dma_device           = &dev->pdev->dev;
 	dev->ib_dev.query_device         = mthca_query_device;
 	dev->ib_dev.query_port           = mthca_query_port;
-	dev->ib_dev.query_protocol       = mthca_query_protocol;
 	dev->ib_dev.modify_device        = mthca_modify_device;
 	dev->ib_dev.modify_port          = mthca_modify_port;
 	dev->ib_dev.query_pkey           = mthca_query_pkey;
drivers/infiniband/hw/nes/nes_verbs.c +1 -7
index 027f6d1..187eda6 100644
@@ -602,16 +602,11 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
 	props->active_width = IB_WIDTH_4X;
 	props->active_speed = IB_SPEED_SDR;
 	props->max_msg_sz = 0x80000000;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IWARP;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-nes_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IWARP;
-}
-
 /**
  * nes_query_pkey
  */
@@ -3884,7 +3879,6 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev)
 	nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev;
 	nesibdev->ibdev.query_device = nes_query_device;
 	nesibdev->ibdev.query_port = nes_query_port;
-	nesibdev->ibdev.query_protocol = nes_query_protocol;
 	nesibdev->ibdev.query_pkey = nes_query_pkey;
 	nesibdev->ibdev.query_gid = nes_query_gid;
 	nesibdev->ibdev.alloc_ucontext = nes_alloc_ucontext;
drivers/infiniband/hw/ocrdma/ocrdma_main.c +0 -1
index 85d99e9..7a2b59a 100644
@@ -244,7 +244,6 @@ static int ocrdma_register_device(struct ocrdma_dev *dev)
 	/* mandatory verbs. */
 	dev->ibdev.query_device = ocrdma_query_device;
 	dev->ibdev.query_port = ocrdma_query_port;
-	dev->ibdev.query_protocol = ocrdma_query_protocol;
 	dev->ibdev.modify_port = ocrdma_modify_port;
 	dev->ibdev.query_gid = ocrdma_query_gid;
 	dev->ibdev.get_link_layer = ocrdma_link_layer;
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +1 -6
index 3e98360..4b8f8e6 100644
@@ -184,15 +184,10 @@ int ocrdma_query_port(struct ib_device *ibdev,
 				 &props->active_width);
 	props->max_msg_sz = 0x80000000;
 	props->max_vl_num = 4;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IBOE;
 	return 0;
 }
 
-enum rdma_protocol_type
-ocrdma_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IBOE;
-}
-
 int ocrdma_modify_port(struct ib_device *ibdev, u8 port, int mask,
 		       struct ib_port_modify *props)
 {
drivers/infiniband/hw/qib/qib_verbs.c +1 -7
index 9fd4b28..6e52946 100644
@@ -1646,16 +1646,11 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = ibp->subnet_timeout;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
 
 	return 0;
 }
 
-static enum rdma_protocol_type
-qib_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_IB;
-}
-
 static int qib_modify_device(struct ib_device *device,
 			     int device_modify_mask,
 			     struct ib_device_modify *device_modify)
@@ -2190,7 +2185,6 @@ int qib_register_ib_device(struct qib_devdata *dd)
 	ibdev->query_device = qib_query_device;
 	ibdev->modify_device = qib_modify_device;
 	ibdev->query_port = qib_query_port;
-	ibdev->query_protocol = qib_query_protocol;
 	ibdev->modify_port = qib_modify_port;
 	ibdev->query_pkey = qib_query_pkey;
 	ibdev->query_gid = qib_query_gid;
drivers/infiniband/hw/usnic/usnic_ib_main.c +0 -1
index bd9f364..0d0f986 100644
@@ -360,7 +360,6 @@ static void *usnic_ib_device_add(struct pci_dev *dev)
 
 	us_ibdev->ib_dev.query_device = usnic_ib_query_device;
 	us_ibdev->ib_dev.query_port = usnic_ib_query_port;
-	us_ibdev->ib_dev.query_protocol = usnic_ib_query_protocol;
 	us_ibdev->ib_dev.query_pkey = usnic_ib_query_pkey;
 	us_ibdev->ib_dev.query_gid = usnic_ib_query_gid;
 	us_ibdev->ib_dev.get_link_layer = usnic_ib_port_link_layer;
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +1 -6
index 732b5c5..83c61ef 100644
@@ -344,16 +344,11 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
 	props->max_msg_sz = us_ibdev->ufdev->mtu;
 	props->max_vl_num = 1;
 	mutex_unlock(&us_ibdev->usdev_lock);
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_USNIC_UDP;
 
 	return 0;
 }
 
-enum rdma_protocol_type
-usnic_ib_query_protocol(struct ib_device *device, u8 port_num)
-{
-	return RDMA_PROTOCOL_USNIC_UDP;
-}
-
 int usnic_ib_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
 				int qp_attr_mask,
 				struct ib_qp_init_attr *qp_init_attr)
include/rdma/ib_verbs.h +6 -7
index 4de2758..dcaee4f 100644
@@ -1529,8 +1529,6 @@ struct ib_device {
 	int		           (*query_port)(struct ib_device *device,
 						 u8 port_num,
 						 struct ib_port_attr *port_attr);
-	enum rdma_protocol_type    (*query_protocol)(struct ib_device *device,
-						     u8 port_num);
 	enum rdma_link_layer	   (*get_link_layer)(struct ib_device *device,
 						     u8 port_num);
 	int		           (*query_gid)(struct ib_device *device,
@@ -1776,24 +1774,25 @@ enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
 
 static inline int rdma_protocol_ib(struct ib_device *device, u8 port_num)
 {
-	return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IB;
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_PROT_IB);
 }
 
 static inline int rdma_protocol_iboe(struct ib_device *device, u8 port_num)
 {
-	return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IBOE;
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_PROT_IBOE);
 }
 
 static inline int rdma_protocol_iwarp(struct ib_device *device, u8 port_num)
 {
-	return device->query_protocol(device, port_num) == RDMA_PROTOCOL_IWARP;
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_PROT_IWARP);
 }
 
 static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num)
 {
-	enum rdma_protocol_type pt = device->query_protocol(device, port_num);
+	u64 flags = device->core_cap_flags[port_num];
 
-	return (pt == RDMA_PROTOCOL_IB || pt == RDMA_PROTOCOL_IBOE);
+	return (!!(flags & RDMA_CORE_CAP_PROT_IB) ||
+		!!(flags & RDMA_CORE_CAP_PROT_IBOE));
 }
 
 /**
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#75 lore raw

RFC PATCH 3/5 IB/core: Convert cap_ib_mad to core_cap_flags bit mask

In reply to a message not in the archive

From: Ira Weiny <[email protected]>

Use the new Core Capability bits instead of inferring this support from the protocol.

---
 drivers/infiniband/hw/ehca/ehca_hca.c        |    2 +-
 drivers/infiniband/hw/ipath/ipath_verbs.c    |    2 +-
 drivers/infiniband/hw/mlx4/main.c            |    4 ++--
 drivers/infiniband/hw/mlx5/main.c            |    2 +-
 drivers/infiniband/hw/mthca/mthca_provider.c |    2 +-
 drivers/infiniband/hw/qib/qib_verbs.c        |    2 +-
 include/rdma/ib_verbs.h                      |    2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)
drivers/infiniband/hw/ehca/ehca_hca.c +1 -1
index 75f5353..a06eadd 100644
@@ -236,7 +236,7 @@ int ehca_query_port(struct ib_device *ibdev,
 		props->active_speed    = IB_SPEED_SDR;
 	}
 
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 query_port1:
 	ehca_free_fw_ctrlblock(rblock);
drivers/infiniband/hw/ipath/ipath_verbs.c +1 -1
index 94a03eb..bb66aa7 100644
@@ -1634,7 +1634,7 @@ static int ipath_query_port(struct ib_device *ibdev,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = dev->subnet_timeout;
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 	return 0;
 }
drivers/infiniband/hw/mlx4/main.c +2 -2
index fa4e45c..9db5fdc 100644
@@ -330,7 +330,7 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
 	if (props->state == IB_PORT_DOWN)
 		 props->active_speed = IB_SPEED_SDR;
 
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 out:
 	kfree(in_mad);
@@ -392,7 +392,7 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
 	props->state		= (netif_running(ndev) && netif_carrier_ok(ndev)) ?
 					IB_PORT_ACTIVE : IB_PORT_DOWN;
 	props->phys_state	= state_to_phys_state(props->state);
-	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IBOE;
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IBOE | RDMA_CORE_CAP_IB_MAD;
 out_unlock:
 	spin_unlock_bh(&iboe->lock);
 	if (is_bonded)
drivers/infiniband/hw/mlx5/main.c +1 -1
index e3cdc17..4b8ef01 100644
@@ -255,7 +255,7 @@ int mlx5_ib_query_port(struct ib_device *ibdev, u8 port,
 		}
 	}
 
-	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags   = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 out:
 	kfree(in_mad);
drivers/infiniband/hw/mthca/mthca_provider.c +1 -1
index e49aece..60fcc02 100644
@@ -172,7 +172,7 @@ static int mthca_query_port(struct ib_device *ibdev,
 	props->subnet_timeout    = out_mad->data[51] & 0x1f;
 	props->max_vl_num        = out_mad->data[37] >> 4;
 	props->init_type_reply   = out_mad->data[41] >> 4;
-	props->core_cap_flags    = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags    = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
  out:
 	kfree(in_mad);
drivers/infiniband/hw/qib/qib_verbs.c +1 -1
index 6e52946..6975528 100644
@@ -1646,7 +1646,7 @@ static int qib_query_port(struct ib_device *ibdev, u8 port,
 	}
 	props->active_mtu = mtu;
 	props->subnet_timeout = ibp->subnet_timeout;
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;
 
 	return 0;
 }
include/rdma/ib_verbs.h +1 -1
index dcaee4f..6c2b0e5 100644
@@ -1807,7 +1807,7 @@ static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num)
  */
 static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
 {
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);
 }
 
 /**
Signature · 6 lines
1.7.1

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

A message that is not in the archive (sent off-list or not yet received): 1430720099-32512-4-git-send-email-ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#77 lore raw

RE: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

Quoted 8 lines

Subject: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

From: Ira Weiny <[email protected]>

Use the new Core Capability bits instead of inferring this support from the
protocol.

It would help if the patch description defined what this bit meant. E.g. why aren't more specific definitions (SMI, CM, GSI, PM, etc.) less desirable than just 'MAD'?

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

#78 lore raw

Re: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

In reply to a message not in the archive
Quoted 2 lines · On Mon, May 04, 2015 at 02:14:57AM -0400…

Use the new Core Capability bits instead of inferring this support from the protocol.

Does this really need to be a seperate patch? At least for the core_cap_flags parts it makes no sense to change those lines twice

Review

Quoted 2 lines
(quoted diff) +1 -1
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;

Hurm,

Maybe add some macros to help this out, document the standard that the port implements:

#define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD) #define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
#define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

include/rdma/ib_verbs.h static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num) · line 1810

Quoted 4 lines

static inline int cap_ib_mad(struct ib_device *device, u8 port_num) {

include/rdma/ib_verbs.h +1 -1
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);

'bool' is OK in the kernel, just use that instead of !! - in fact all of thse cap returns should return bool. Michael should fix that in his series too.

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

A message that is not in the archive (sent off-list or not yet received): 20150504184610.GB20586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

author
#80 lore raw

Re: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

Quoted 7 lines · Jason Gunthorpe
Quoted 2 lines · On Mon, May 04, 2015 at 02:14:57AM -0400…

Use the new Core Capability bits instead of inferring this support from the protocol.

Does this really need to be a seperate patch? At least for the core_cap_flags parts it makes no sense to change those lines twice

Only to show the progression and for me to test as I went. I think a squash is good. I just was taking my testing slowly to make sure I did not do something stupid... ;-)

Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;

Hurm,

Quoted 6 lines

Maybe add some macros to help this out, document the standard that the port implements:

#define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD) #define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
#define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

Good idea.

Quoted 10 lines

include/rdma/ib_verbs.h static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num) · line 1810

Quoted 5 lines

static inline int cap_ib_mad(struct ib_device *device, u8 port_num) {

include/rdma/ib_verbs.h +1 -1
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);

'bool' is OK in the kernel, just use that instead of !! - in fact all of thse cap returns should return bool. Michael should fix that in his series too.

Michael?

Ira

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

A message that is not in the archive (sent off-list or not yet received): 20150504224342.GD10115-W4f6Xiosr+yv7QzWx2u06xL4W9x8LtSr@public.gmane.org

#82 lore raw

Re: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

On 05/05/2015 12:43 AM, ira.weiny wrote:
[snip]

Quoted 12 lines
Quoted 11 lines

include/rdma/ib_verbs.h static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num) · line 1810

Quoted 6 lines

static inline int cap_ib_mad(struct ib_device *device, u8 port_num) {

include/rdma/ib_verbs.h +1 -1
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);

'bool' is OK in the kernel, just use that instead of !! - in fact all of thse cap returns should return bool. Michael should fix that in his series too.

Quoted 1 line

Michael?

Ok, I will use bool in next version :-)

Regards,
Michael Wang

Quoted 3 lines

Ira

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

#83 lore raw

Re: [RFC PATCH 3/5] IB/core: Convert cap_ib_mad to core_cap_flags bit mask

In reply to a message not in the archive
Quoted 7 lines · Jason Gunthorpe
Quoted 2 lines · On Mon, May 04, 2015 at 02:14:57AM -0400…

Use the new Core Capability bits instead of inferring this support from the protocol.

Does this really need to be a seperate patch? At least for the core_cap_flags parts it makes no sense to change those lines twice

I think I missed this patch series, and I can't find all the 5 patch in archive too...

If there are not much argument on this proposal, then we can include the changes and make them one patch set.

Regards,
Michael Wang

Quoted 23 lines

Review

Quoted 3 lines
(quoted diff) +1 -1
-	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB;
+	props->core_cap_flags = RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD;

Hurm,

Maybe add some macros to help this out, document the standard that the port implements:

#define RDMA_CORE_PORT_IB_IBA_v1_2 (RDMA_CORE_CAP_PROT_IB | RDMA_CORE_CAP_IB_MAD) #define RDMA_CORE_PORT_ROCEE_IBA_v1_2_A15 ..
#define RDMA_CORE_PORT_ROCEE_IBA_v1_3_A16 ..

include/rdma/ib_verbs.h static inline int rdma_ib_or_iboe(struct ib_device *device, u8 port_num) · line 1810

Quoted 4 lines

static inline int cap_ib_mad(struct ib_device *device, u8 port_num) {

include/rdma/ib_verbs.h +1 -1
-	return rdma_ib_or_iboe(device, port_num);
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_IB_MAD);

'bool' is OK in the kernel, just use that instead of !! - in fact all of thse cap returns should return bool. Michael should fix that in his series too.

Quoted 2 lines

Jason

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

#84 lore raw

RFC PATCH 4/5 IB/core: Add rdma_dev_max_mad_size call

In reply to a message not in the archive

From: Ira Weiny <[email protected]>

Change all IB drivers to report their max MAD size through the rdma_dev_max_mad_size helper function.

Set all current devices to the IB_MGMT_MAD_SIZE and add check to verify that all devices support at least IB_MGMT_MAD_SIZE

---

Changes from the original OPA series V4:
Change MAD size error message to a WARN_ON Remove reference to cached_dev_attr Add rdma_dev_max_mad_size

 drivers/infiniband/core/mad.c                |    4 ++++
 drivers/infiniband/hw/amso1100/c2_rnic.c     |    1 +
 drivers/infiniband/hw/cxgb3/iwch_provider.c  |    1 +
 drivers/infiniband/hw/cxgb4/provider.c       |    1 +
 drivers/infiniband/hw/ehca/ehca_hca.c        |    3 +++
 drivers/infiniband/hw/ipath/ipath_verbs.c    |    1 +
 drivers/infiniband/hw/mlx4/main.c            |    1 +
 drivers/infiniband/hw/mlx5/main.c            |    1 +
 drivers/infiniband/hw/mthca/mthca_provider.c |    2 ++
 drivers/infiniband/hw/nes/nes_verbs.c        |    1 +
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c  |    1 +
 drivers/infiniband/hw/qib/qib_verbs.c        |    1 +
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c |    2 ++
 include/rdma/ib_mad.h                        |    1 +
 include/rdma/ib_verbs.h                      |   19 +++++++++++++++++++
 15 files changed, 40 insertions(+), 0 deletions(-)
drivers/infiniband/core/mad.c +4 -0
index 0749d7b..09578a6 100644
@@ -2923,6 +2923,10 @@ static int ib_mad_port_open(struct ib_device *device,
 	unsigned long flags;
 	char name[sizeof "ib_mad123"];
 	int has_smi;
+	size_t max_mad_size = rdma_dev_max_mad_size(device, port_num);
+
+	if (WARN_ON(max_mad_size < IB_MGMT_MAD_SIZE))
+		return -EFAULT;
 
 	/* Create new device info */
 	port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
drivers/infiniband/hw/amso1100/c2_rnic.c +1 -0
index d2a6d96..63322c0 100644
@@ -197,6 +197,7 @@ static int c2_rnic_query(struct c2_dev *c2dev, struct ib_device_attr *props)
 	props->max_srq_sge         = 0;
 	props->max_pkeys           = 0;
 	props->local_ca_ack_delay  = 0;
+	props->max_mad_size        = IB_MGMT_MAD_SIZE;
 
  bail2:
 	vq_repbuf_free(c2dev, reply);
drivers/infiniband/hw/cxgb3/iwch_provider.c +1 -0
index e270846..714afdc 100644
@@ -1174,6 +1174,7 @@ static int iwch_query_device(struct ib_device *ibdev,
 	props->max_pd = dev->attr.max_pds;
 	props->local_ca_ack_delay = 0;
 	props->max_fast_reg_page_list_len = T3_MAX_FASTREG_DEPTH;
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
drivers/infiniband/hw/cxgb4/provider.c +1 -0
index ff63344..8261b11 100644
@@ -332,6 +332,7 @@ static int c4iw_query_device(struct ib_device *ibdev,
 	props->max_pd = T4_MAX_NUM_PD;
 	props->local_ca_ack_delay = 0;
 	props->max_fast_reg_page_list_len = t4_max_fr_depth(use_dsgl);
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
drivers/infiniband/hw/ehca/ehca_hca.c +3 -0
index a06eadd..8ed3472 100644
@@ -40,6 +40,7 @@
  */
 
 #include <linux/gfp.h>
+#include <rdma/ib_mad.h>
 
 #include "ehca_tools.h"
 #include "ehca_iverbs.h"
@@ -133,6 +134,8 @@ int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
 		if (rblock->hca_cap_indicators & cap_mapping[i + 1])
 			props->device_cap_flags |= cap_mapping[i];
 
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
+
 query_device1:
 	ehca_free_fw_ctrlblock(rblock);
 
drivers/infiniband/hw/ipath/ipath_verbs.c +1 -0
index bb66aa7..85b8ad1 100644
@@ -1538,6 +1538,7 @@ static int ipath_query_device(struct ib_device *ibdev,
 	props->max_mcast_qp_attach = ib_ipath_max_mcast_qp_attached;
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 		props->max_mcast_grp;
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
drivers/infiniband/hw/mlx4/main.c +1 -0
index 9db5fdc..881dcd7 100644
@@ -229,6 +229,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 					   props->max_mcast_grp;
 	props->max_map_per_fmr = dev->dev->caps.max_fmr_maps;
+	props->max_mad_size        = IB_MGMT_MAD_SIZE;
 
 out:
 	kfree(in_mad);
drivers/infiniband/hw/mlx5/main.c +1 -0
index 4b8ef01..68f2d2c 100644
@@ -154,6 +154,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 					   props->max_mcast_grp;
 	props->max_map_per_fmr = INT_MAX; /* no limit in ConnectIB */
+	props->max_mad_size        = IB_MGMT_MAD_SIZE;
 
 #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
 	if (dev->mdev->caps.gen.flags & MLX5_DEV_CAP_FLAG_ON_DMND_PG)
drivers/infiniband/hw/mthca/mthca_provider.c +2 -0
index 60fcc02..811e3dd 100644
@@ -123,6 +123,8 @@ static int mthca_query_device(struct ib_device *ibdev,
 		props->max_map_per_fmr =
 			(1 << (32 - ilog2(mdev->limits.num_mpts))) - 1;
 
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
+
 	err = 0;
  out:
 	kfree(in_mad);
drivers/infiniband/hw/nes/nes_verbs.c +1 -0
index 187eda6..d16fdd5 100644
@@ -555,6 +555,7 @@ static int nes_query_device(struct ib_device *ibdev, struct ib_device_attr *prop
 	props->max_qp_init_rd_atom = props->max_qp_rd_atom;
 	props->atomic_cap = IB_ATOMIC_NONE;
 	props->max_map_per_fmr = 1;
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +1 -0
index 4b8f8e6..8d18053 100644
@@ -103,6 +103,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
 	attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay;
 	attr->max_fast_reg_page_list_len = dev->attr.max_pages_per_frmr;
 	attr->max_pkeys = 1;
+	attr->max_mad_size = IB_MGMT_MAD_SIZE;
 	return 0;
 }
 
drivers/infiniband/hw/qib/qib_verbs.c +1 -0
index 6975528..b95d14a 100644
@@ -1592,6 +1592,7 @@ static int qib_query_device(struct ib_device *ibdev,
 	props->max_mcast_qp_attach = ib_qib_max_mcast_qp_attached;
 	props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
 		props->max_mcast_grp;
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 
 	return 0;
 }
drivers/infiniband/hw/usnic/usnic_ib_verbs.c +2 -0
index 83c61ef..be04372 100644
@@ -22,6 +22,7 @@
 
 #include <rdma/ib_user_verbs.h>
 #include <rdma/ib_addr.h>
+#include <rdma/ib_mad.h>
 
 #include "usnic_abi.h"
 #include "usnic_ib.h"
@@ -296,6 +297,7 @@ int usnic_ib_query_device(struct ib_device *ibdev,
 	props->max_mcast_qp_attach = 0;
 	props->max_total_mcast_qp_attach = 0;
 	props->max_map_per_fmr = 0;
+	props->max_mad_size = IB_MGMT_MAD_SIZE;
 	/* Owned by Userspace
 	 * max_qp_wr, max_sge, max_sge_rd, max_cqe */
 	mutex_unlock(&us_ibdev->usdev_lock);
include/rdma/ib_mad.h +1 -0
index 9c89939..5823016 100644
@@ -135,6 +135,7 @@ enum {
 	IB_MGMT_SA_DATA = 200,
 	IB_MGMT_DEVICE_HDR = 64,
 	IB_MGMT_DEVICE_DATA = 192,
+	IB_MGMT_MAD_SIZE = IB_MGMT_MAD_HDR + IB_MGMT_MAD_DATA,
 };
 
 struct ib_mad_hdr {
include/rdma/ib_verbs.h +19 -0
index 6c2b0e5..01bdf12 100644
@@ -217,6 +217,7 @@ struct ib_device_attr {
 	int			sig_prot_cap;
 	int			sig_guard_cap;
 	struct ib_odp_caps	odp_caps;
+	u32			max_mad_size;
 };
 
 enum ib_mtu {
@@ -1930,6 +1931,24 @@ static inline int cap_read_multi_sge(struct ib_device *device, u8 port_num)
 	return !rdma_protocol_iwarp(device, port_num);
 }
 
+/**
+ * rdma_dev_max_mad_size - Return the max MAD size required by this RDMA Port.
+ *
+ * @device: Device
+ * @port_num: Port number
+ *
+ * Return the max MAD size required by the Port.  May return 0 if the port does
+ * not support MADs
+ */
+static inline size_t rdma_dev_max_mad_size(struct ib_device *device,
+					   u8 port_num)
+{
+	struct ib_device_attr attr;
+
+	device->query_device(device, &attr);
+	return attr.max_mad_size;
+}
+
 int ib_query_gid(struct ib_device *device,
 		 u8 port_num, int index, union ib_gid *gid);
 
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#85 lore raw

RFC PATCH 5/5 IB/core: Add cap_opa_mad helper using RDMA_CORE_CAP_OPA_MAD flag

In reply to a message not in the archive

From: Ira Weiny <[email protected]>

OPA MADs share a common header with IBTA MADs but with a different base version and an extended length. These MADs increase the performance of management traffic on OPA devices.

Sharing a common header with IBTA MADs allows us to share most of the MAD processing code when dealing with OPA MADs in addition to supporting some IBTA MADs on OPA devices.

---
Changes from the OPA series v4:
Use new cap_opa_mad and RDMA_CORE_CAP_OPA_MAD flag

 include/rdma/ib_verbs.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
include/rdma/ib_verbs.h +16 -0
index 01bdf12..31f1ff9 100644
@@ -363,6 +363,7 @@ union rdma_protocol_stats {
 #define RDMA_CORE_CAP_IB_CM		0x0000000000000004ULL
 #define RDMA_CORE_CAP_IW_CM		0x0000000000000008ULL
 #define RDMA_CORE_CAP_IB_SA		0x0000000000000010ULL
+#define RDMA_CORE_CAP_OPA_MAD		0x0000000000000020ULL
 
 /* Address format                       0x0000FFFF00000000 */
 #define RDMA_CORE_CAP_AF_IB		0x0000000100000000ULL
@@ -1812,6 +1813,21 @@ static inline int cap_ib_mad(struct ib_device *device, u8 port_num)
 }
 
 /**
+ * cap_opa_mad - Check if the port of device supports OPA defined
+ * Management Datagrams.
+ *
+ * @device: Device to be checked
+ * @port_num: Port number of the device
+ *
+ * Return 0 when port of the device does not support OPA
+ * Management Datagrams.
+ */
+static inline int cap_opa_mad(struct ib_device *device, u8 port_num)
+{
+	return !!(device->core_cap_flags[port_num] & RDMA_CORE_CAP_OPA_MAD);
+}
+
+/**
  * cap_ib_smi - Check if the port of device has the capability Infiniband
  * Subnet Management Interface.
  *
Signature · 6 lines
1.7.1

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