diff mbox series

[rdma-core,4/6] verbs: Expose port_cap_mask2 in ibv_query_port

Message ID 1545585297-6677-5-git-send-email-yishaih@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series verbs: Expose the IBTA port CapabilityMask2 | expand

Commit Message

Yishai Hadas Dec. 23, 2018, 5:14 p.m. UTC
From: Michael Guralnik <michaelgur@mellanox.com>

New port_cap_flags2 is derived from IB spec PortInfo CapabilityMask2.
The field is added to ibv_port_attr and a new flag in port_cap_flags for
port_cap_flags2 support is added.

In addition, a print of port_cap_flags2 was added to devinfo.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
---
 libibverbs/cmd_device.c         |  1 +
 libibverbs/examples/devinfo.c   |  1 +
 libibverbs/man/ibv_query_port.3 |  1 +
 libibverbs/verbs.h              | 11 +++++++++++
 4 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/libibverbs/cmd_device.c b/libibverbs/cmd_device.c
index 803d33d..d806351 100644
--- a/libibverbs/cmd_device.c
+++ b/libibverbs/cmd_device.c
@@ -90,6 +90,7 @@  int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num,
 	case SUCCESS:
 		copy_query_port_resp_to_port_attr(port_attr,
 						  &resp_ex.legacy_resp);
+		port_attr->port_cap_flags2 = resp_ex.port_cap_flags2;
 		break;
 	default:
 		return ret;
diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c
index dee74b8..5bbe936 100644
--- a/libibverbs/examples/devinfo.c
+++ b/libibverbs/examples/devinfo.c
@@ -584,6 +584,7 @@  static int print_hca_cap(struct ibv_device *ib_dev, uint8_t ib_port)
 		if (verbose) {
 			printf("\t\t\tmax_msg_sz:\t\t0x%x\n", port_attr.max_msg_sz);
 			printf("\t\t\tport_cap_flags:\t\t0x%08x\n", port_attr.port_cap_flags);
+			printf("\t\t\tport_cap_flags2:\t0x%04x\n", port_attr.port_cap_flags2);
 			printf("\t\t\tmax_vl_num:\t\t%s (%d)\n",
 			       vl_str(port_attr.max_vl_num), port_attr.max_vl_num);
 			printf("\t\t\tbad_pkey_cntr:\t\t0x%x\n", port_attr.bad_pkey_cntr);
diff --git a/libibverbs/man/ibv_query_port.3 b/libibverbs/man/ibv_query_port.3
index b1f490a..6d077a3 100644
--- a/libibverbs/man/ibv_query_port.3
+++ b/libibverbs/man/ibv_query_port.3
@@ -47,6 +47,7 @@  uint8_t                 active_speed;   /* Currently active link speed */
 uint8_t                 phys_state;     /* Physical port state */
 uint8_t                 link_layer;     /* link layer protocol of the port */
 uint8_t                 flags;          /* Port flags */
+uint16_t                port_cap_flags2;/* Port capabilities */
 .in -8
 };
 .sp
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 4851c72..40a7280 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -346,6 +346,7 @@  enum ibv_port_cap_flags {
 	IBV_PORT_SYS_IMAGE_GUID_SUP		= 1 << 11,
 	IBV_PORT_PKEY_SW_EXT_PORT_TRAP_SUP	= 1 << 12,
 	IBV_PORT_EXTENDED_SPEEDS_SUP		= 1 << 14,
+	IBV_PORT_CAP_MASK2_SUP			= 1 << 15,
 	IBV_PORT_CM_SUP				= 1 << 16,
 	IBV_PORT_SNMP_TUNNEL_SUP		= 1 << 17,
 	IBV_PORT_REINIT_SUP			= 1 << 18,
@@ -359,6 +360,15 @@  enum ibv_port_cap_flags {
 	IBV_PORT_IP_BASED_GIDS			= 1 << 26
 };
 
+enum ibv_port_cap_flags2 {
+	IBV_PORT_SET_NODE_DESC_SUP		= 1 << 0,
+	IBV_PORT_INFO_EXT_SUP			= 1 << 1,
+	IBV_PORT_VIRT_SUP			= 1 << 2,
+	IBV_PORT_SWITCH_PORT_STATE_TABLE_SUP	= 1 << 3,
+	IBV_PORT_LINK_WIDTH_2X_SUP		= 1 << 4,
+	IBV_PORT_LINK_SPEED_HDR_SUP		= 1 << 5,
+};
+
 struct ibv_port_attr {
 	enum ibv_port_state	state;
 	enum ibv_mtu		max_mtu;
@@ -381,6 +391,7 @@  struct ibv_port_attr {
 	uint8_t			phys_state;
 	uint8_t			link_layer;
 	uint8_t			flags;
+	uint16_t		port_cap_flags2;
 };
 
 enum ibv_event_type {