浏览代码

IB/core: Add OPA MAD core capability flag

Add OPA MAD support flags to the core capability immutable flags.  In addition
add the rdma_cap_opa_mad helper function for core functions to use to detect
OPA MAD support.

OPA MADs share a common header with IBTA MADs but with some differences for
increased performance.

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.

OPA MADs differ in the following ways:

	1) MADs are variable size up to 2K
	   IBTA defined MADs remain fixed at 256 bytes
	2) OPA SMPs must carry valid PKeys
	3) OPA SMP packets are a different format

The MAD stack will use this new functionality to determine if OPA MAD
processing should occur on individual device ports.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Ira Weiny 10 年之前
父节点
当前提交
65995fee84
共有 1 个文件被更改,包括 28 次插入0 次删除
  1. 28 0
      include/rdma/ib_verbs.h

+ 28 - 0
include/rdma/ib_verbs.h

@@ -374,6 +374,7 @@ union rdma_protocol_stats {
 #define RDMA_CORE_CAP_IB_CM             0x00000004
 #define RDMA_CORE_CAP_IB_CM             0x00000004
 #define RDMA_CORE_CAP_IW_CM             0x00000008
 #define RDMA_CORE_CAP_IW_CM             0x00000008
 #define RDMA_CORE_CAP_IB_SA             0x00000010
 #define RDMA_CORE_CAP_IB_SA             0x00000010
+#define RDMA_CORE_CAP_OPA_MAD           0x00000020
 
 
 /* Address format                       0x000FF000 */
 /* Address format                       0x000FF000 */
 #define RDMA_CORE_CAP_AF_IB             0x00001000
 #define RDMA_CORE_CAP_AF_IB             0x00001000
@@ -397,6 +398,8 @@ union rdma_protocol_stats {
 					| RDMA_CORE_CAP_ETH_AH)
 					| RDMA_CORE_CAP_ETH_AH)
 #define RDMA_CORE_PORT_IWARP           (RDMA_CORE_CAP_PROT_IWARP \
 #define RDMA_CORE_PORT_IWARP           (RDMA_CORE_CAP_PROT_IWARP \
 					| RDMA_CORE_CAP_IW_CM)
 					| RDMA_CORE_CAP_IW_CM)
+#define RDMA_CORE_PORT_INTEL_OPA       (RDMA_CORE_PORT_IBA_IB  \
+					| RDMA_CORE_CAP_OPA_MAD)
 
 
 struct ib_port_attr {
 struct ib_port_attr {
 	enum ib_port_state	state;
 	enum ib_port_state	state;
@@ -1885,6 +1888,31 @@ static inline bool rdma_cap_ib_mad(const struct ib_device *device, u8 port_num)
 	return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_MAD;
 	return device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_IB_MAD;
 }
 }
 
 
+/**
+ * rdma_cap_opa_mad - Check if the port of device provides support for OPA
+ * Management Datagrams.
+ * @device: Device to check
+ * @port_num: Port number to check
+ *
+ * Intel OmniPath devices extend and/or replace the InfiniBand Management
+ * datagrams with their own versions.  These OPA MADs share many but not all of
+ * the characteristics of InfiniBand MADs.
+ *
+ * OPA MADs differ in the following ways:
+ *
+ *    1) MADs are variable size up to 2K
+ *       IBTA defined MADs remain fixed at 256 bytes
+ *    2) OPA SMPs must carry valid PKeys
+ *    3) OPA SMP packets are a different format
+ *
+ * Return: true if the port supports OPA MAD packet formats.
+ */
+static inline bool rdma_cap_opa_mad(struct ib_device *device, u8 port_num)
+{
+	return (device->port_immutable[port_num].core_cap_flags & RDMA_CORE_CAP_OPA_MAD)
+		== RDMA_CORE_CAP_OPA_MAD;
+}
+
 /**
 /**
  * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband
  * rdma_cap_ib_smi - Check if the port of a device provides an Infiniband
  * Subnet Management Agent (SMA) on the Subnet Management Interface (SMI).
  * Subnet Management Agent (SMA) on the Subnet Management Interface (SMI).