* [rdma-next 1/8] RDMA/mlx4: Properly annotate link layer variable
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 2/8] RDMA/core: Export device capabilities flags Leon Romanovsky
` (7 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
The rdma_port_get_link_layer() returns enum rdma_link_layer as
a return value, hence it is better to store the return value in
specially annotated variable and not in int.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/mlx4/qp.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 2874d8790570..8c6ccc392d87 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -2732,19 +2732,17 @@ enum {
static int _mlx4_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
int attr_mask, struct ib_udata *udata)
{
+ enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED;
struct mlx4_ib_dev *dev = to_mdev(ibqp->device);
struct mlx4_ib_qp *qp = to_mqp(ibqp);
enum ib_qp_state cur_state, new_state;
int err = -EINVAL;
- int ll;
mutex_lock(&qp->mutex);
cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state;
new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state;
- if (cur_state == new_state && cur_state == IB_QPS_RESET) {
- ll = IB_LINK_LAYER_UNSPECIFIED;
- } else {
+ if (cur_state != new_state || cur_state != IB_QPS_RESET) {
int port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
ll = rdma_port_get_link_layer(&dev->ib_dev, port);
}
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 2/8] RDMA/core: Export device capabilities flags
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-08-15 9:14 ` [rdma-next 1/8] RDMA/mlx4: Properly annotate link layer variable Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 3/8] RDMA/core: Provide node type flags Leon Romanovsky
` (6 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Provide to the user space application the ability
to understand device capabilities.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
include/rdma/ib_verbs.h | 68 ++++++++++++------------
include/uapi/rdma/ib_user_verbs.h | 1 +
include/uapi/rdma/rdma.h | 106 ++++++++++++++++++++++++++++++++++++++
3 files changed, 140 insertions(+), 35 deletions(-)
create mode 100644 include/uapi/rdma/rdma.h
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 80ede01d2237..bfedcda04ef7 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -157,22 +157,21 @@ enum rdma_link_layer {
};
enum ib_device_cap_flags {
- IB_DEVICE_RESIZE_MAX_WR = (1 << 0),
- IB_DEVICE_BAD_PKEY_CNTR = (1 << 1),
- IB_DEVICE_BAD_QKEY_CNTR = (1 << 2),
- IB_DEVICE_RAW_MULTI = (1 << 3),
- IB_DEVICE_AUTO_PATH_MIG = (1 << 4),
- IB_DEVICE_CHANGE_PHY_PORT = (1 << 5),
- IB_DEVICE_UD_AV_PORT_ENFORCE = (1 << 6),
- IB_DEVICE_CURR_QP_STATE_MOD = (1 << 7),
- IB_DEVICE_SHUTDOWN_PORT = (1 << 8),
+ IB_DEVICE_RESIZE_MAX_WR = RDMA_DEV_RESIZE_MAX_WR,
+ IB_DEVICE_BAD_PKEY_CNTR = RDMA_DEV_BAD_PKEY_CNTR,
+ IB_DEVICE_BAD_QKEY_CNTR = RDMA_DEV_BAD_QKEY_CNTR,
+ IB_DEVICE_RAW_MULTI = RDMA_DEV_RAW_MULTI,
+ IB_DEVICE_AUTO_PATH_MIG = RDMA_DEV_AUTO_PATH_MIG,
+ IB_DEVICE_CHANGE_PHY_PORT = RDMA_DEV_CHANGE_PHY_PORT,
+ IB_DEVICE_UD_AV_PORT_ENFORCE = RDMA_DEV_UD_AV_PORT_ENFORCE,
+ IB_DEVICE_CURR_QP_STATE_MOD = RDMA_DEV_CURR_QP_STATE_MOD,
+ IB_DEVICE_SHUTDOWN_PORT = RDMA_DEV_SHUTDOWN_PORT,
/* Not in use, former INIT_TYPE = (1 << 9),*/
- IB_DEVICE_PORT_ACTIVE_EVENT = (1 << 10),
- IB_DEVICE_SYS_IMAGE_GUID = (1 << 11),
- IB_DEVICE_RC_RNR_NAK_GEN = (1 << 12),
- IB_DEVICE_SRQ_RESIZE = (1 << 13),
- IB_DEVICE_N_NOTIFY_CQ = (1 << 14),
-
+ IB_DEVICE_PORT_ACTIVE_EVENT = RDMA_DEV_PORT_ACTIVE_EVENT,
+ IB_DEVICE_SYS_IMAGE_GUID = RDMA_DEV_SYS_IMAGE_GUID,
+ IB_DEVICE_RC_RNR_NAK_GEN = RDMA_DEV_RC_RNR_NAK_GEN,
+ IB_DEVICE_SRQ_RESIZE = RDMA_DEV_SRQ_RESIZE,
+ IB_DEVICE_N_NOTIFY_CQ = RDMA_DEV_N_NOTIFY_CQ,
/*
* This device supports a per-device lkey or stag that can be
* used without performing a memory registration for the local
@@ -180,9 +179,9 @@ enum ib_device_cap_flags {
* instead of use the local_dma_lkey flag in the ib_pd structure,
* which will always contain a usable lkey.
*/
- IB_DEVICE_LOCAL_DMA_LKEY = (1 << 15),
+ IB_DEVICE_LOCAL_DMA_LKEY = RDMA_DEV_LOCAL_DMA_LKEY,
/* Reserved, old SEND_W_INV = (1 << 16),*/
- IB_DEVICE_MEM_WINDOW = (1 << 17),
+ IB_DEVICE_MEM_WINDOW = RDMA_DEV_MEM_WINDOW,
/*
* Devices should set IB_DEVICE_UD_IP_SUM if they support
* insertion of UDP and TCP checksum on outgoing UD IPoIB
@@ -190,10 +189,9 @@ enum ib_device_cap_flags {
* incoming messages. Setting this flag implies that the
* IPoIB driver may set NETIF_F_IP_CSUM for datagram mode.
*/
- IB_DEVICE_UD_IP_CSUM = (1 << 18),
- IB_DEVICE_UD_TSO = (1 << 19),
- IB_DEVICE_XRC = (1 << 20),
-
+ IB_DEVICE_UD_IP_CSUM = RDMA_DEV_UD_IP_CSUM,
+ IB_DEVICE_UD_TSO = RDMA_DEV_UD_TSO,
+ IB_DEVICE_XRC = RDMA_DEV_XRC,
/*
* This device supports the IB "base memory management extension",
* which includes support for fast registrations (IB_WR_REG_MR,
@@ -203,28 +201,28 @@ enum ib_device_cap_flags {
* IB_WR_RDMA_READ_WITH_INV verb for RDMA READs that invalidate the
* stag.
*/
- IB_DEVICE_MEM_MGT_EXTENSIONS = (1 << 21),
- IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1 << 22),
- IB_DEVICE_MEM_WINDOW_TYPE_2A = (1 << 23),
- IB_DEVICE_MEM_WINDOW_TYPE_2B = (1 << 24),
- IB_DEVICE_RC_IP_CSUM = (1 << 25),
+ IB_DEVICE_MEM_MGT_EXTENSIONS = RDMA_DEV_MEM_MGT_EXTENSIONS,
+ IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = RDMA_DEV_BLOCK_MULTICAST_LOOPBACK,
+ IB_DEVICE_MEM_WINDOW_TYPE_2A = RDMA_DEV_MEM_WINDOW_TYPE_2A,
+ IB_DEVICE_MEM_WINDOW_TYPE_2B = RDMA_DEV_MEM_WINDOW_TYPE_2B,
+ IB_DEVICE_RC_IP_CSUM = RDMA_DEV_RC_IP_CSUM,
/* Deprecated. Please use IB_RAW_PACKET_CAP_IP_CSUM. */
- IB_DEVICE_RAW_IP_CSUM = (1 << 26),
+ IB_DEVICE_RAW_IP_CSUM = RDMA_DEV_RAW_IP_CSUM,
/*
* Devices should set IB_DEVICE_CROSS_CHANNEL if they
* support execution of WQEs that involve synchronization
* of I/O operations with single completion queue managed
* by hardware.
*/
- IB_DEVICE_CROSS_CHANNEL = (1 << 27),
- IB_DEVICE_MANAGED_FLOW_STEERING = (1 << 29),
- IB_DEVICE_SIGNATURE_HANDOVER = (1 << 30),
- IB_DEVICE_ON_DEMAND_PAGING = (1ULL << 31),
- IB_DEVICE_SG_GAPS_REG = (1ULL << 32),
- IB_DEVICE_VIRTUAL_FUNCTION = (1ULL << 33),
+ IB_DEVICE_CROSS_CHANNEL = RDMA_DEV_CROSS_CHANNEL,
+ IB_DEVICE_MANAGED_FLOW_STEERING = RDMA_DEV_MANAGED_FLOW_STEERING,
+ IB_DEVICE_SIGNATURE_HANDOVER = RDMA_DEV_SIGNATURE_HANDOVER,
+ IB_DEVICE_ON_DEMAND_PAGING = RDMA_DEV_ON_DEMAND_PAGING,
+ IB_DEVICE_SG_GAPS_REG = RDMA_DEV_SG_GAPS_REG,
+ IB_DEVICE_VIRTUAL_FUNCTION = RDMA_DEV_VIRTUAL_FUNCTION,
/* Deprecated. Please use IB_RAW_PACKET_CAP_SCATTER_FCS. */
- IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34),
- IB_DEVICE_RDMA_NETDEV_OPA_VNIC = (1ULL << 35),
+ IB_DEVICE_RAW_SCATTER_FCS = RDMA_DEV_RAW_SCATTER_FCS,
+ IB_DEVICE_RDMA_NETDEV_OPA_VNIC = RDMA_DEV_RDMA_NETDEV_OPA_VNIC,
};
enum ib_signature_prot_cap {
diff --git a/include/uapi/rdma/ib_user_verbs.h b/include/uapi/rdma/ib_user_verbs.h
index 9a0b6479fe0c..803106ffa93c 100644
--- a/include/uapi/rdma/ib_user_verbs.h
+++ b/include/uapi/rdma/ib_user_verbs.h
@@ -37,6 +37,7 @@
#define IB_USER_VERBS_H
#include <linux/types.h>
+#include <rdma/rdma.h>
/*
* Increment this value if any changes that break userspace ABI
diff --git a/include/uapi/rdma/rdma.h b/include/uapi/rdma/rdma.h
new file mode 100644
index 000000000000..dcdf61474118
--- /dev/null
+++ b/include/uapi/rdma/rdma.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
+ *
+ * This software is available to you under a choice of one of two
+ * licenses. You may choose to be licensed under the terms of the GNU
+ * General Public License (GPL) Version 2, available from the file
+ * COPYING in the main directory of this source tree, or the
+ * OpenIB.org BSD license below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef _RDMA_H
+#define _RDMA_H
+
+enum rdma_dev_cap {
+ RDMA_DEV_RESIZE_MAX_WR = (1 << 0),
+ RDMA_DEV_BAD_PKEY_CNTR = (1 << 1),
+ RDMA_DEV_BAD_QKEY_CNTR = (1 << 2),
+ RDMA_DEV_RAW_MULTI = (1 << 3),
+ RDMA_DEV_AUTO_PATH_MIG = (1 << 4),
+ RDMA_DEV_CHANGE_PHY_PORT = (1 << 5),
+ RDMA_DEV_UD_AV_PORT_ENFORCE = (1 << 6),
+ RDMA_DEV_CURR_QP_STATE_MOD = (1 << 7),
+ RDMA_DEV_SHUTDOWN_PORT = (1 << 8),
+ /* Not in use, former INIT_TYPE = (1 << 9),*/
+ RDMA_DEV_PORT_ACTIVE_EVENT = (1 << 10),
+ RDMA_DEV_SYS_IMAGE_GUID = (1 << 11),
+ RDMA_DEV_RC_RNR_NAK_GEN = (1 << 12),
+ RDMA_DEV_SRQ_RESIZE = (1 << 13),
+ RDMA_DEV_N_NOTIFY_CQ = (1 << 14),
+
+ /*
+ * This device supports a per-device lkey or stag that can be
+ * used without performing a memory registration for the local
+ * memory. Note that ULPs should never check this flag, but
+ * instead of use the local_dma_lkey flag in the ib_pd structure,
+ * which will always contain a usable lkey.
+ */
+ RDMA_DEV_LOCAL_DMA_LKEY = (1 << 15),
+ /* Reserved, old SEND_W_INV = (1 << 16),*/
+ RDMA_DEV_MEM_WINDOW = (1 << 17),
+ /*
+ * Devices should set RDMA_DEV_UD_IP_SUM if they support
+ * insertion of UDP and TCP checksum on outgoing UD IPoIB
+ * messages and can verify the validity of checksum for
+ * incoming messages. Setting this flag implies that the
+ * IPoIB driver may set NETIF_F_IP_CSUM for datagram mode.
+ */
+ RDMA_DEV_UD_IP_CSUM = (1 << 18),
+ RDMA_DEV_UD_TSO = (1 << 19),
+ RDMA_DEV_XRC = (1 << 20),
+
+ /*
+ * This device supports the IB "base memory management extension",
+ * which includes support for fast registrations (IB_WR_REG_MR,
+ * IB_WR_LOCAL_INV and IB_WR_SEND_WITH_INV verbs). This flag should
+ * also be set by any iWarp device which must support FRs to comply
+ * to the iWarp verbs spec. iWarp devices also support the
+ * IB_WR_RDMA_READ_WITH_INV verb for RDMA READs that invalidate the
+ * stag.
+ */
+ RDMA_DEV_MEM_MGT_EXTENSIONS = (1 << 21),
+ RDMA_DEV_BLOCK_MULTICAST_LOOPBACK = (1 << 22),
+ RDMA_DEV_MEM_WINDOW_TYPE_2A = (1 << 23),
+ RDMA_DEV_MEM_WINDOW_TYPE_2B = (1 << 24),
+ RDMA_DEV_RC_IP_CSUM = (1 << 25),
+ /* Deprecated. Please use IB_RAW_PACKET_CAP_IP_CSUM. */
+ RDMA_DEV_RAW_IP_CSUM = (1 << 26),
+ /*
+ * Devices should set RDMA_DEV_CROSS_CHANNEL if they
+ * support execution of WQEs that involve synchronization
+ * of I/O operations with single completion queue managed
+ * by hardware.
+ */
+ RDMA_DEV_CROSS_CHANNEL = (1 << 27),
+ RDMA_DEV_MANAGED_FLOW_STEERING = (1 << 29),
+ RDMA_DEV_SIGNATURE_HANDOVER = (1 << 30),
+ RDMA_DEV_ON_DEMAND_PAGING = (1ULL << 31),
+ RDMA_DEV_SG_GAPS_REG = (1ULL << 32),
+ RDMA_DEV_VIRTUAL_FUNCTION = (1ULL << 33),
+ /* Deprecated. Please use IB_RAW_PACKET_CAP_SCATTER_FCS. */
+ RDMA_DEV_RAW_SCATTER_FCS = (1ULL << 34),
+ RDMA_DEV_RDMA_NETDEV_OPA_VNIC = (1ULL << 35),
+};
+#endif /* _RDMA_H */
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 3/8] RDMA/core: Provide node type flags
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-08-15 9:14 ` [rdma-next 1/8] RDMA/mlx4: Properly annotate link layer variable Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 2/8] RDMA/core: Export device capabilities flags Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 4/8] RDMA/core: Move port capabilities to UAPI Leon Romanovsky
` (5 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Expose node types for the user space applications.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
include/rdma/ib_verbs.h | 7 -------
include/uapi/rdma/rdma.h | 7 +++++++
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index bfedcda04ef7..0aced267cc53 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -93,13 +93,6 @@ struct ib_gid_attr {
struct net_device *ndev;
};
-enum rdma_node_type {
- /* IB values map to NodeInfo:NodeType. */
- RDMA_NODE_IB_CA = 1,
- RDMA_NODE_RNIC = 4,
- RDMA_NODE_USNIC_UDP = 6,
-};
-
enum {
/* set the local administered indication */
IB_SA_WELL_KNOWN_GUID = BIT_ULL(57) | 2,
diff --git a/include/uapi/rdma/rdma.h b/include/uapi/rdma/rdma.h
index dcdf61474118..75c1baad313b 100644
--- a/include/uapi/rdma/rdma.h
+++ b/include/uapi/rdma/rdma.h
@@ -103,4 +103,11 @@ enum rdma_dev_cap {
RDMA_DEV_RAW_SCATTER_FCS = (1ULL << 34),
RDMA_DEV_RDMA_NETDEV_OPA_VNIC = (1ULL << 35),
};
+
+enum rdma_node_type {
+ /* IB values map to NodeInfo:NodeType. */
+ RDMA_NODE_IB_CA = 1,
+ RDMA_NODE_RNIC = 4,
+ RDMA_NODE_USNIC_UDP = 6,
+};
#endif /* _RDMA_H */
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 4/8] RDMA/core: Move port capabilities to UAPI
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (2 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 3/8] RDMA/core: Provide node type flags Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 5/8] RDMA/core: Move port state to UAPI and rename it to be link Leon Romanovsky
` (4 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Provide to user space applications ability to reuse kernel
port capabilities enum.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
include/rdma/ib_verbs.h | 48 ++++++++++++++++++++++++------------------------
include/uapi/rdma/rdma.h | 33 +++++++++++++++++++++++++++++++++
2 files changed, 57 insertions(+), 24 deletions(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 0aced267cc53..a7cd54061f48 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -392,30 +392,30 @@ enum ib_port_state {
};
enum ib_port_cap_flags {
- IB_PORT_SM = 1 << 1,
- IB_PORT_NOTICE_SUP = 1 << 2,
- IB_PORT_TRAP_SUP = 1 << 3,
- IB_PORT_OPT_IPD_SUP = 1 << 4,
- IB_PORT_AUTO_MIGR_SUP = 1 << 5,
- IB_PORT_SL_MAP_SUP = 1 << 6,
- IB_PORT_MKEY_NVRAM = 1 << 7,
- IB_PORT_PKEY_NVRAM = 1 << 8,
- IB_PORT_LED_INFO_SUP = 1 << 9,
- IB_PORT_SM_DISABLED = 1 << 10,
- IB_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
- IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
- IB_PORT_EXTENDED_SPEEDS_SUP = 1 << 14,
- IB_PORT_CM_SUP = 1 << 16,
- IB_PORT_SNMP_TUNNEL_SUP = 1 << 17,
- IB_PORT_REINIT_SUP = 1 << 18,
- IB_PORT_DEVICE_MGMT_SUP = 1 << 19,
- IB_PORT_VENDOR_CLASS_SUP = 1 << 20,
- IB_PORT_DR_NOTICE_SUP = 1 << 21,
- IB_PORT_CAP_MASK_NOTICE_SUP = 1 << 22,
- IB_PORT_BOOT_MGMT_SUP = 1 << 23,
- IB_PORT_LINK_LATENCY_SUP = 1 << 24,
- IB_PORT_CLIENT_REG_SUP = 1 << 25,
- IB_PORT_IP_BASED_GIDS = 1 << 26,
+ IB_PORT_SM = RDMA_PORT_SM,
+ IB_PORT_NOTICE_SUP = RDMA_PORT_NOTICE,
+ IB_PORT_TRAP_SUP = RDMA_PORT_TRAP,
+ IB_PORT_OPT_IPD_SUP = RDMA_PORT_OPT_IPD,
+ IB_PORT_AUTO_MIGR_SUP = RDMA_PORT_AUTO_MIGR,
+ IB_PORT_SL_MAP_SUP = RDMA_PORT_SL_MAP,
+ IB_PORT_MKEY_NVRAM = RDMA_PORT_MKEY_NVRAM,
+ IB_PORT_PKEY_NVRAM = RDMA_PORT_PKEY_NVRAM,
+ IB_PORT_LED_INFO_SUP = RDMA_PORT_LED_INFO,
+ IB_PORT_SM_DISABLED = RDMA_PORT_SM_DISABLED,
+ IB_PORT_SYS_IMAGE_GUID_SUP = RDMA_PORT_SYS_IMAGE_GUID,
+ IB_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = RDMA_PORT_PKEY_SW_EXT_PORT_TRAP,
+ IB_PORT_EXTENDED_SPEEDS_SUP = RDMA_PORT_EXTENDED_SPEEDS,
+ IB_PORT_CM_SUP = RDMA_PORT_CM,
+ IB_PORT_SNMP_TUNNEL_SUP = RDMA_PORT_SNMP_TUNNEL,
+ IB_PORT_REINIT_SUP = RDMA_PORT_REINIT,
+ IB_PORT_DEVICE_MGMT_SUP = RDMA_PORT_DEVICE_MGMT,
+ IB_PORT_VENDOR_CLASS_SUP = RDMA_PORT_VENDOR_CLASS,
+ IB_PORT_DR_NOTICE_SUP = RDMA_PORT_DR_NOTICE,
+ IB_PORT_CAP_MASK_NOTICE_SUP = RDMA_PORT_CAP_MASK_NOTICE,
+ IB_PORT_BOOT_MGMT_SUP = RDMA_PORT_BOOT_MGMT,
+ IB_PORT_LINK_LATENCY_SUP = RDMA_PORT_LINK_LATENCY,
+ IB_PORT_CLIENT_REG_SUP = RDMA_PORT_CLIENT_REG,
+ IB_PORT_IP_BASED_GIDS = RDMA_PORT_IP_BASED_GIDS,
};
enum ib_port_width {
diff --git a/include/uapi/rdma/rdma.h b/include/uapi/rdma/rdma.h
index 75c1baad313b..397796e63a3a 100644
--- a/include/uapi/rdma/rdma.h
+++ b/include/uapi/rdma/rdma.h
@@ -110,4 +110,37 @@ enum rdma_node_type {
RDMA_NODE_RNIC = 4,
RDMA_NODE_USNIC_UDP = 6,
};
+
+/*
+ * This capability flags are taken from
+ * InfiniBandTM Architecture Specification Volume 1, Revision 1.3
+ * 14.2.5.6 PORTINFO - CapabilityMask
+ *
+ */
+enum rdma_port_cap {
+ RDMA_PORT_SM = 1 << 1,
+ RDMA_PORT_NOTICE = 1 << 2,
+ RDMA_PORT_TRAP = 1 << 3,
+ RDMA_PORT_OPT_IPD = 1 << 4,
+ RDMA_PORT_AUTO_MIGR = 1 << 5,
+ RDMA_PORT_SL_MAP = 1 << 6,
+ RDMA_PORT_MKEY_NVRAM = 1 << 7,
+ RDMA_PORT_PKEY_NVRAM = 1 << 8,
+ RDMA_PORT_LED_INFO = 1 << 9,
+ RDMA_PORT_SM_DISABLED = 1 << 10,
+ RDMA_PORT_SYS_IMAGE_GUID = 1 << 11,
+ RDMA_PORT_PKEY_SW_EXT_PORT_TRAP = 1 << 12,
+ RDMA_PORT_EXTENDED_SPEEDS = 1 << 14,
+ RDMA_PORT_CM = 1 << 16,
+ RDMA_PORT_SNMP_TUNNEL = 1 << 17,
+ RDMA_PORT_REINIT = 1 << 18,
+ RDMA_PORT_DEVICE_MGMT = 1 << 19,
+ RDMA_PORT_VENDOR_CLASS = 1 << 20,
+ RDMA_PORT_DR_NOTICE = 1 << 21,
+ RDMA_PORT_CAP_MASK_NOTICE = 1 << 22,
+ RDMA_PORT_BOOT_MGMT = 1 << 23,
+ RDMA_PORT_LINK_LATENCY = 1 << 24,
+ RDMA_PORT_CLIENT_REG = 1 << 25,
+ RDMA_PORT_IP_BASED_GIDS = 1 << 26,
+};
#endif /* _RDMA_H */
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 5/8] RDMA/core: Move port state to UAPI and rename it to be link
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (3 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 4/8] RDMA/core: Move port capabilities to UAPI Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 6/8] RDMA/core: Add physical link state information to the UAPI Leon Romanovsky
` (3 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Provide to user space applications ability to reuse kernel
link state enum.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
include/rdma/ib_verbs.h | 12 ++++++------
include/uapi/rdma/rdma.h | 10 ++++++++++
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index a7cd54061f48..7e9940244e38 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -383,12 +383,12 @@ static inline enum ib_mtu ib_mtu_int_to_enum(int mtu)
}
enum ib_port_state {
- IB_PORT_NOP = 0,
- IB_PORT_DOWN = 1,
- IB_PORT_INIT = 2,
- IB_PORT_ARMED = 3,
- IB_PORT_ACTIVE = 4,
- IB_PORT_ACTIVE_DEFER = 5
+ IB_PORT_NOP = RDMA_LINK_STATE_NOP,
+ IB_PORT_DOWN = RDMA_LINK_STATE_DOWN,
+ IB_PORT_INIT = RDMA_LINK_STATE_INIT,
+ IB_PORT_ARMED = RDMA_LINK_STATE_ARMED,
+ IB_PORT_ACTIVE = RDMA_LINK_STATE_ACTIVE,
+ IB_PORT_ACTIVE_DEFER = RDMA_LINK_STATE_ACTIVE_DEFER
};
enum ib_port_cap_flags {
diff --git a/include/uapi/rdma/rdma.h b/include/uapi/rdma/rdma.h
index 397796e63a3a..5f4019e2c5d4 100644
--- a/include/uapi/rdma/rdma.h
+++ b/include/uapi/rdma/rdma.h
@@ -143,4 +143,14 @@ enum rdma_port_cap {
RDMA_PORT_CLIENT_REG = 1 << 25,
RDMA_PORT_IP_BASED_GIDS = 1 << 26,
};
+
+enum rdma_link_state {
+ RDMA_LINK_STATE_NOP,
+ RDMA_LINK_STATE_DOWN,
+ RDMA_LINK_STATE_INIT,
+ RDMA_LINK_STATE_ARMED,
+ RDMA_LINK_STATE_ACTIVE,
+ RDMA_LINK_STATE_ACTIVE_DEFER,
+};
+};
#endif /* _RDMA_H */
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 6/8] RDMA/core: Add physical link state information to the UAPI
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (4 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 5/8] RDMA/core: Move port state to UAPI and rename it to be link Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 7/8] RDMA/nes: Remove zeroed parameter from port query callback Leon Romanovsky
` (2 subsequent siblings)
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Add physical link state information to the UAPI and convert hardcoded
values to use the exported enum.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/core/sysfs.c | 24 ++++++++++++++++--------
include/uapi/rdma/rdma.h | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index c43280f8d5b3..913919c6822b 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -284,14 +284,22 @@ static ssize_t phys_state_show(struct ib_port *p, struct port_attribute *unused,
return ret;
switch (attr.phys_state) {
- case 1: return sprintf(buf, "1: Sleep\n");
- case 2: return sprintf(buf, "2: Polling\n");
- case 3: return sprintf(buf, "3: Disabled\n");
- case 4: return sprintf(buf, "4: PortConfigurationTraining\n");
- case 5: return sprintf(buf, "5: LinkUp\n");
- case 6: return sprintf(buf, "6: LinkErrorRecovery\n");
- case 7: return sprintf(buf, "7: Phy Test\n");
- default: return sprintf(buf, "%d: <unknown>\n", attr.phys_state);
+ case RDMA_LINK_PHYS_STATE_SLEEP:
+ return sprintf(buf, "1: Sleep\n");
+ case RDMA_LINK_PHYS_STATE_POLLING:
+ return sprintf(buf, "2: Polling\n");
+ case RDMA_LINK_PHYS_STATE_DISABLED:
+ return sprintf(buf, "3: Disabled\n");
+ case RDMA_LINK_PHYS_STATE_PORT_CONFIGURATION_TRAINING:
+ return sprintf(buf, "4: PortConfigurationTraining\n");
+ case RDMA_LINK_PHYS_STATE_LINK_UP:
+ return sprintf(buf, "5: LinkUp\n");
+ case RDMA_LINK_PHYS_STATE_LINK_ERROR_RECOVER:
+ return sprintf(buf, "6: LinkErrorRecovery\n");
+ case RDMA_LINK_PHYS_STATE_LINK_PHY_TEST:
+ return sprintf(buf, "7: Phy Test\n");
+ default:
+ return sprintf(buf, "%d: <unknown>\n", attr.phys_state);
}
}
diff --git a/include/uapi/rdma/rdma.h b/include/uapi/rdma/rdma.h
index 5f4019e2c5d4..42af3fe57b5a 100644
--- a/include/uapi/rdma/rdma.h
+++ b/include/uapi/rdma/rdma.h
@@ -152,5 +152,45 @@ enum rdma_link_state {
RDMA_LINK_STATE_ACTIVE,
RDMA_LINK_STATE_ACTIVE_DEFER,
};
+
+/*
+ * When writing this field, only values 0, 1, 2, and 3
+ * are valid. Other values are ignored. See InfiniBand Architecture
+ * Specification Volume 2, Link/Phy Interface chapter.
+ */
+enum rdma_link_phys_state {
+ /*
+ * 0 - 7 are according to the IB specification
+ * 8 - 15 - Reserved and ignored in IB, but partially
+ * in use by OmniPath
+ */
+ RDMA_LINK_PHYS_STATE_NOP,
+ RDMA_LINK_PHYS_STATE_SLEEP,
+ RDMA_LINK_PHYS_STATE_POLLING,
+ RDMA_LINK_PHYS_STATE_DISABLED,
+ RDMA_LINK_PHYS_STATE_PORT_CONFIGURATION_TRAINING,
+ RDMA_LINK_PHYS_STATE_LINK_UP,
+ RDMA_LINK_PHYS_STATE_LINK_ERROR_RECOVER,
+ RDMA_LINK_PHYS_STATE_LINK_PHY_TEST,
+
+ /* 8 is reserved in OPA */
+
+ /*
+ * Offline: Port is quiet (transmitters disabled) due to lack of
+ * physical media, unsupported media, or transition between link up
+ * and next link up attempt
+ */
+ RDMA_LINK_PHYS_STATE_OFFLINE = 9,
+
+ /* 10 is reserved in OPA */
+
+ /*
+ * Phy_Test: Specific test patterns are transmitted, and receiver BER
+ * can be monitored. This facilitates signal integrity testing for the
+ * physical layer of the port.
+ */
+ RDMA_LINK_PHYS_STATE_TEST = 11,
+
+ /* values 12-15 are reserved/ignored */
};
#endif /* _RDMA_H */
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 7/8] RDMA/nes: Remove zeroed parameter from port query callback
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (5 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 6/8] RDMA/core: Add physical link state information to the UAPI Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
2017-08-15 9:14 ` [rdma-next 8/8] RDMA: Use defines instead of hard coded value for phys_state Leon Romanovsky
2017-08-23 16:27 ` [pull request][rdma-next 0/8] Export device and port properties Leon Romanovsky
8 siblings, 0 replies; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
There is no need to explicitly zero parameters, because
the structure requested to be filled already initialized to zeros.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/nes/nes_verbs.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index c2943e39d2f9..f0dc5f4aa177 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -481,21 +481,16 @@ static int nes_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr
props->active_mtu = ib_mtu_int_to_enum(netdev->mtu);
props->lid = 1;
- props->lmc = 0;
- props->sm_lid = 0;
- props->sm_sl = 0;
if (netif_queue_stopped(netdev))
props->state = IB_PORT_DOWN;
else if (nesvnic->linkup)
props->state = IB_PORT_ACTIVE;
else
props->state = IB_PORT_DOWN;
- props->phys_state = 0;
props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_REINIT_SUP |
IB_PORT_VENDOR_CLASS_SUP | IB_PORT_BOOT_MGMT_SUP;
props->gid_tbl_len = 1;
props->pkey_tbl_len = 1;
- props->qkey_viol_cntr = 0;
props->active_width = IB_WIDTH_4X;
props->active_speed = IB_SPEED_SDR;
props->max_msg_sz = 0x80000000;
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* [rdma-next 8/8] RDMA: Use defines instead of hard coded value for phys_state
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (6 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 7/8] RDMA/nes: Remove zeroed parameter from port query callback Leon Romanovsky
@ 2017-08-15 9:14 ` Leon Romanovsky
[not found] ` <20170815091431.12822-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-08-23 16:27 ` [pull request][rdma-next 0/8] Export device and port properties Leon Romanovsky
8 siblings, 1 reply; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-15 9:14 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Leon Romanovsky,
Dennis Dalessandro, Jason Gunthorpe, Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
There are new defines to express the physical state of the link, so
let's reuse them instead hard-coded values.
Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++--
drivers/infiniband/hw/hfi1/opa_compat.h | 30 +++++++++++++++++-----------
drivers/infiniband/hw/hns/hns_roce_main.c | 4 +++-
drivers/infiniband/hw/mlx4/main.c | 4 +++-
drivers/infiniband/hw/mlx5/main.c | 4 ++--
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 ++--
drivers/infiniband/hw/qedr/verbs.c | 4 ++--
drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 6 +++---
drivers/infiniband/sw/rxe/rxe_param.h | 2 +-
9 files changed, 36 insertions(+), 26 deletions(-)
diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
index d78fedc654d0..9bc28c756210 100644
--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
@@ -234,10 +234,10 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num,
if (netif_running(rdev->netdev) && netif_carrier_ok(rdev->netdev)) {
port_attr->state = IB_PORT_ACTIVE;
- port_attr->phys_state = 5;
+ port_attr->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
} else {
port_attr->state = IB_PORT_DOWN;
- port_attr->phys_state = 3;
+ port_attr->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
}
port_attr->max_mtu = IB_MTU_4096;
port_attr->active_mtu = iboe_get_mtu(rdev->netdev->mtu);
diff --git a/drivers/infiniband/hw/hfi1/opa_compat.h b/drivers/infiniband/hw/hfi1/opa_compat.h
index 6ef3c1cbdcd7..011ea5c89e25 100644
--- a/drivers/infiniband/hw/hfi1/opa_compat.h
+++ b/drivers/infiniband/hw/hfi1/opa_compat.h
@@ -92,20 +92,26 @@ static inline u8 port_states_to_phys_state(struct opa_port_states *ps)
* Returned by the ibphys_portstate() routine.
*/
enum opa_port_phys_state {
- IB_PORTPHYSSTATE_NOP = 0,
+ IB_PORTPHYSSTATE_NOP = RDMA_LINK_PHYS_STATE_NOP,
+
/* 1 is reserved */
- IB_PORTPHYSSTATE_POLLING = 2,
- IB_PORTPHYSSTATE_DISABLED = 3,
- IB_PORTPHYSSTATE_TRAINING = 4,
- IB_PORTPHYSSTATE_LINKUP = 5,
- IB_PORTPHYSSTATE_LINK_ERROR_RECOVERY = 6,
- IB_PORTPHYSSTATE_PHY_TEST = 7,
+
+ IB_PORTPHYSSTATE_POLLING = RDMA_LINK_PHYS_STATE_POLLING,
+ IB_PORTPHYSSTATE_DISABLED = RDMA_LINK_PHYS_STATE_DISABLED,
+ IB_PORTPHYSSTATE_TRAINING = RDMA_LINK_PHYS_STATE_PORT_CONFIGURATION_TRAINING,
+ IB_PORTPHYSSTATE_LINKUP = RDMA_LINK_PHYS_STATE_LINK_UP,
+ IB_PORTPHYSSTATE_LINK_ERROR_RECOVERY = RDMA_LINK_PHYS_STATE_LINK_ERROR_RECOVER,
+ IB_PORTPHYSSTATE_PHY_TEST = RDMA_LINK_PHYS_STATE_LINK_PHY_TEST,
+
/* 8 is reserved */
- OPA_PORTPHYSSTATE_OFFLINE = 9,
- OPA_PORTPHYSSTATE_GANGED = 10,
- OPA_PORTPHYSSTATE_TEST = 11,
- OPA_PORTPHYSSTATE_MAX = 11,
+
+ OPA_PORTPHYSSTATE_OFFLINE = RDMA_LINK_PHYS_STATE_OFFLINE,
+
+ /* 10 is reserved */
+
+ OPA_PORTPHYSSTATE_TEST = RDMA_LINK_PHYS_STATE_TEST,
+ OPA_PORTPHYSSTATE_MAX = OPA_PORTPHYSSTATE_TEST,
+
/* values 12-15 are reserved/ignored */
};
-
#endif /* _LINUX_H */
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index d9777b662eba..48e88357d1c4 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -272,7 +272,9 @@ static int hns_roce_query_port(struct ib_device *ib_dev, u8 port_num,
props->active_mtu = mtu ? min(props->max_mtu, mtu) : IB_MTU_256;
props->state = (netif_running(net_dev) && netif_carrier_ok(net_dev)) ?
IB_PORT_ACTIVE : IB_PORT_DOWN;
- props->phys_state = (props->state == IB_PORT_ACTIVE) ? 5 : 3;
+ props->phys_state = (props->state == IB_PORT_ACTIVE) ?
+ RDMA_LINK_PHYS_STATE_LINK_UP :
+ RDMA_LINK_PHYS_STATE_DISABLED;
spin_unlock_irqrestore(&hr_dev->iboe.lock, flags);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index c636842c5be0..d1598ef15406 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -694,7 +694,9 @@ static int ib_link_query_port(struct ib_device *ibdev, u8 port,
static u8 state_to_phys_state(enum ib_port_state state)
{
- return state == IB_PORT_ACTIVE ? 5 : 3;
+ return state == IB_PORT_ACTIVE ?
+ RDMA_LINK_PHYS_STATE_LINK_UP :
+ RDMA_LINK_PHYS_STATE_DISABLED;
}
static int eth_link_query_port(struct ib_device *ibdev, u8 port,
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 894aec4a7c9d..8b3f19060a67 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -282,7 +282,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg);
props->pkey_tbl_len = 1;
props->state = IB_PORT_DOWN;
- props->phys_state = 3;
+ props->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev, &qkey_viol_cntr);
props->qkey_viol_cntr = qkey_viol_cntr;
@@ -304,7 +304,7 @@ static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
if (netif_running(ndev) && netif_carrier_ok(ndev)) {
props->state = IB_PORT_ACTIVE;
- props->phys_state = 5;
+ props->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
}
ndev_ib_mtu = iboe_get_mtu(ndev->mtu);
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 27d5e8d9f08d..32e7a04b027f 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -220,10 +220,10 @@ int ocrdma_query_port(struct ib_device *ibdev,
netdev = dev->nic_info.netdev;
if (netif_running(netdev) && netif_oper_up(netdev)) {
port_state = IB_PORT_ACTIVE;
- props->phys_state = 5;
+ props->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
} else {
port_state = IB_PORT_DOWN;
- props->phys_state = 3;
+ props->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
}
props->max_mtu = IB_MTU_4096;
props->active_mtu = iboe_get_mtu(netdev->mtu);
diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 9ee2dce3e5bb..724921aad51b 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -251,10 +251,10 @@ int qedr_query_port(struct ib_device *ibdev, u8 port, struct ib_port_attr *attr)
/* *attr being zeroed by the caller, avoid zeroing it here */
if (rdma_port->port_state == QED_RDMA_PORT_UP) {
attr->state = IB_PORT_ACTIVE;
- attr->phys_state = 5;
+ attr->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
} else {
attr->state = IB_PORT_DOWN;
- attr->phys_state = 3;
+ attr->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
}
attr->max_mtu = IB_MTU_4096;
attr->active_mtu = iboe_get_mtu(dev->ndev->mtu);
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index e5f57dd49980..8889b549a6bc 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -324,13 +324,13 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port,
if (!us_ibdev->ufdev->link_up) {
props->state = IB_PORT_DOWN;
- props->phys_state = 3;
+ props->phys_state = RDMA_LINK_PHYS_STATE_DISABLED;
} else if (!us_ibdev->ufdev->inaddr) {
props->state = IB_PORT_INIT;
- props->phys_state = 4;
+ props->phys_state = RDMA_LINK_PHYS_STATE_PORT_CONFIGURATION_TRAINING;
} else {
props->state = IB_PORT_ACTIVE;
- props->phys_state = 5;
+ props->phys_state = RDMA_LINK_PHYS_STATE_LINK_UP;
}
props->port_cap_flags = 0;
diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h
index 1b596fbbe251..475767262102 100644
--- a/drivers/infiniband/sw/rxe/rxe_param.h
+++ b/drivers/infiniband/sw/rxe/rxe_param.h
@@ -157,7 +157,7 @@ enum rxe_port_param {
RXE_PORT_ACTIVE_WIDTH = IB_WIDTH_1X,
RXE_PORT_ACTIVE_SPEED = 1,
RXE_PORT_PKEY_TBL_LEN = 64,
- RXE_PORT_PHYS_STATE = 2,
+ RXE_PORT_PHYS_STATE = RDMA_LINK_PHYS_STATE_POLLING,
RXE_PORT_SUBNET_PREFIX = 0xfe80000000000000ULL,
};
--
2.14.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [pull request][rdma-next 0/8] Export device and port properties
[not found] ` <20170815091431.12822-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
` (7 preceding siblings ...)
2017-08-15 9:14 ` [rdma-next 8/8] RDMA: Use defines instead of hard coded value for phys_state Leon Romanovsky
@ 2017-08-23 16:27 ` Leon Romanovsky
[not found] ` <20170823162718.GS1724-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
8 siblings, 1 reply; 15+ messages in thread
From: Leon Romanovsky @ 2017-08-23 16:27 UTC (permalink / raw)
To: Doug Ledford
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dennis Dalessandro,
Jason Gunthorpe
[-- Attachment #1: Type: text/plain, Size: 772 bytes --]
On Tue, Aug 15, 2017 at 12:14:23PM +0300, Leon Romanovsky wrote:
> Hi,
>
> This is the third part of RDMAtool infrastructure changes. In this series,
> I'm exporting various device and port properties which are parsed in
> RDMAtool.
>
> Due to the fact, that the "IB/hfi1: Document phys port state bits not
> used in IB", I embed its content into the actual patches.
>
> As part of this series, I performed small code cleanup to improve our
> static checker situation.
>
> Thanks
>
> Cc: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Cc: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> ----------------------------------------------------------------
Doug,
To be clear, this PR is not needed.
Thanks,
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread