[openib-general] [PATCH][UVERBS][RFC] Exporting device node_type to user mode
Tom Tucker
tom at opengridcomputing.com
Thu Apr 20 14:05:17 PDT 2006
In order to support transport independent behavior for user-mode
RDMA CMA clients we need to export the node_type to the user mode
device attributes structure. The reason for this is that the
user-mode CMA needs to behave differently for iWARP vs. IB
transports when migrating QP state at connection setup and tear
down.
This patch adds the node_type to the device attributes structure
for user-mode clients. Please have a look-see and let me know if
this seems like a reasonable approach.
Signed-off-by: Tom Tucker <tom at opengridcomputing.com>
Index: userspace/libibverbs/include/infiniband/verbs.h
===================================================================
--- userspace/libibverbs/include/infiniband/verbs.h (revision 6536)
+++ userspace/libibverbs/include/infiniband/verbs.h (working copy)
@@ -70,9 +70,30 @@
enum ibv_node_type {
IBV_NODE_CA = 1,
IBV_NODE_SWITCH,
- IBV_NODE_ROUTER
+ IBV_NODE_ROUTER,
+ IBV_NODE_RNIC
};
+enum ibv_transport_type {
+ IBV_TRANSPORT_IB=1,
+ IBV_TRANSPORT_IWARP=2
+};
+
+static inline enum ibv_transport_type
+ibv_node_get_transport(enum ibv_node_type node_type)
+{
+ switch (node_type) {
+ case IBV_NODE_CA:
+ case IBV_NODE_SWITCH:
+ case IBV_NODE_ROUTER:
+ return IBV_TRANSPORT_IB;
+ case IBV_NODE_RNIC:
+ return IBV_TRANSPORT_IWARP;
+ default:
+ return 0;
+ }
+}
+
enum ibv_device_cap_flags {
IBV_DEVICE_RESIZE_MAX_WR = 1,
IBV_DEVICE_BAD_PKEY_CNTR = 1 << 1,
@@ -138,6 +159,7 @@
uint16_t max_pkeys;
uint8_t local_ca_ack_delay;
uint8_t phys_port_cnt;
+ uint8_t node_type;
};
enum ibv_mtu {
Index: userspace/libibverbs/include/infiniband/kern-abi.h
===================================================================
--- userspace/libibverbs/include/infiniband/kern-abi.h (revision 6536)
+++ userspace/libibverbs/include/infiniband/kern-abi.h (working copy)
@@ -192,7 +192,8 @@
__u16 max_pkeys;
__u8 local_ca_ack_delay;
__u8 phys_port_cnt;
- __u8 reserved[4];
+ __u8 node_type;
+ __u8 reserved[3];
};
struct ibv_query_port {
Index: userspace/libibverbs/src/cmd.c
===================================================================
--- userspace/libibverbs/src/cmd.c (revision 6536)
+++ userspace/libibverbs/src/cmd.c (working copy)
@@ -151,6 +151,7 @@
device_attr->max_pkeys = resp.max_pkeys;
device_attr->local_ca_ack_delay = resp.local_ca_ack_delay;
device_attr->phys_port_cnt = resp.phys_port_cnt;
+ device_attr->node_type = resp.node_type;
return 0;
}
Index: linux-kernel/infiniband/include/rdma/ib_user_verbs.h
===================================================================
--- linux-kernel/infiniband/include/rdma/ib_user_verbs.h (revision 6536)
+++ linux-kernel/infiniband/include/rdma/ib_user_verbs.h (working copy)
@@ -177,7 +177,9 @@
__u16 max_pkeys;
__u8 local_ca_ack_delay;
__u8 phys_port_cnt;
- __u8 reserved[4];
+ __u8 node_type;
+ __u8 reserved[3];
};
struct ib_uverbs_query_port {
Index: linux-kernel/infiniband/core/uverbs_cmd.c
===================================================================
--- linux-kernel/infiniband/core/uverbs_cmd.c (revision 6536)
+++ linux-kernel/infiniband/core/uverbs_cmd.c (working copy)
@@ -197,6 +197,7 @@
resp.max_pkeys = attr.max_pkeys;
resp.local_ca_ack_delay = attr.local_ca_ack_delay;
resp.phys_port_cnt = file->device->ib_dev->phys_port_cnt;
+ resp.node_type = file->device->ib_dev->node_type;
if (copy_to_user((void __user *) (unsigned long) cmd.response,
&resp, sizeof resp))
More information about the general
mailing list