[ofa-general] [PATCH 1/9] ib_core: Add API to query port link type
Eli Cohen
eli at mellanox.co.il
Mon Jun 15 00:34:19 PDT 2009
This allows to get the type of a port to be either Ethernet or IB which is
required by following patches for implementing RDMA over Ethernet - RDMAoE.
Signed-off-by: Eli Cohen <eli at mellanox.co.il>
---
drivers/infiniband/core/verbs.c | 7 +++++++
include/rdma/ib_verbs.h | 11 +++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index a7da9be..18631b1 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -94,6 +94,13 @@ rdma_node_get_transport(enum rdma_node_type node_type)
}
EXPORT_SYMBOL(rdma_node_get_transport);
+enum ib_port_link_type ib_get_port_link_type(struct ib_device *device, u8 port_num)
+{
+ return device->get_port_link_type ?
+ device->get_port_link_type(device, port_num) : PORT_LINK_IB;
+}
+EXPORT_SYMBOL(ib_get_port_link_type);
+
/* Protection domains */
struct ib_pd *ib_alloc_pd(struct ib_device *device)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c179318..8f98c8f 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -72,6 +72,11 @@ enum rdma_transport_type {
RDMA_TRANSPORT_IWARP
};
+enum ib_port_link_type {
+ PORT_LINK_IB,
+ PORT_LINK_ETH
+};
+
enum rdma_transport_type
rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__;
@@ -298,6 +303,7 @@ struct ib_port_attr {
u8 active_width;
u8 active_speed;
u8 phys_state;
+ enum ib_port_link_type link_type;
};
enum ib_device_modify_flags {
@@ -1003,6 +1009,8 @@ struct ib_device {
int (*query_port)(struct ib_device *device,
u8 port_num,
struct ib_port_attr *port_attr);
+ enum ib_port_link_type (*get_port_link_type)(struct ib_device *device,
+ u8 port_num);
int (*query_gid)(struct ib_device *device,
u8 port_num, int index,
union ib_gid *gid);
@@ -1213,6 +1221,9 @@ int ib_query_device(struct ib_device *device,
int ib_query_port(struct ib_device *device,
u8 port_num, struct ib_port_attr *port_attr);
+enum ib_port_link_type ib_get_port_link_type(struct ib_device *device,
+ u8 port_num);
+
int ib_query_gid(struct ib_device *device,
u8 port_num, int index, union ib_gid *gid);
--
1.6.3.1
More information about the general
mailing list