diff options
-rw-r--r-- | drivers/infiniband/core/verbs.c | 16 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 11 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index e0fa22238715..af7a8b08b2e9 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -94,6 +94,22 @@ rdma_node_get_transport(enum rdma_node_type node_type) | |||
94 | } | 94 | } |
95 | EXPORT_SYMBOL(rdma_node_get_transport); | 95 | EXPORT_SYMBOL(rdma_node_get_transport); |
96 | 96 | ||
97 | enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, u8 port_num) | ||
98 | { | ||
99 | if (device->get_link_layer) | ||
100 | return device->get_link_layer(device, port_num); | ||
101 | |||
102 | switch (rdma_node_get_transport(device->node_type)) { | ||
103 | case RDMA_TRANSPORT_IB: | ||
104 | return IB_LINK_LAYER_INFINIBAND; | ||
105 | case RDMA_TRANSPORT_IWARP: | ||
106 | return IB_LINK_LAYER_ETHERNET; | ||
107 | default: | ||
108 | return IB_LINK_LAYER_UNSPECIFIED; | ||
109 | } | ||
110 | } | ||
111 | EXPORT_SYMBOL(rdma_port_get_link_layer); | ||
112 | |||
97 | /* Protection domains */ | 113 | /* Protection domains */ |
98 | 114 | ||
99 | struct ib_pd *ib_alloc_pd(struct ib_device *device) | 115 | 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 857b3b9cf120..e04c4888d1fd 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -75,6 +75,12 @@ enum rdma_transport_type { | |||
75 | enum rdma_transport_type | 75 | enum rdma_transport_type |
76 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; | 76 | rdma_node_get_transport(enum rdma_node_type node_type) __attribute_const__; |
77 | 77 | ||
78 | enum rdma_link_layer { | ||
79 | IB_LINK_LAYER_UNSPECIFIED, | ||
80 | IB_LINK_LAYER_INFINIBAND, | ||
81 | IB_LINK_LAYER_ETHERNET, | ||
82 | }; | ||
83 | |||
78 | enum ib_device_cap_flags { | 84 | enum ib_device_cap_flags { |
79 | IB_DEVICE_RESIZE_MAX_WR = 1, | 85 | IB_DEVICE_RESIZE_MAX_WR = 1, |
80 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), | 86 | IB_DEVICE_BAD_PKEY_CNTR = (1<<1), |
@@ -1010,6 +1016,8 @@ struct ib_device { | |||
1010 | int (*query_port)(struct ib_device *device, | 1016 | int (*query_port)(struct ib_device *device, |
1011 | u8 port_num, | 1017 | u8 port_num, |
1012 | struct ib_port_attr *port_attr); | 1018 | struct ib_port_attr *port_attr); |
1019 | enum rdma_link_layer (*get_link_layer)(struct ib_device *device, | ||
1020 | u8 port_num); | ||
1013 | int (*query_gid)(struct ib_device *device, | 1021 | int (*query_gid)(struct ib_device *device, |
1014 | u8 port_num, int index, | 1022 | u8 port_num, int index, |
1015 | union ib_gid *gid); | 1023 | union ib_gid *gid); |
@@ -1222,6 +1230,9 @@ int ib_query_device(struct ib_device *device, | |||
1222 | int ib_query_port(struct ib_device *device, | 1230 | int ib_query_port(struct ib_device *device, |
1223 | u8 port_num, struct ib_port_attr *port_attr); | 1231 | u8 port_num, struct ib_port_attr *port_attr); |
1224 | 1232 | ||
1233 | enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device, | ||
1234 | u8 port_num); | ||
1235 | |||
1225 | int ib_query_gid(struct ib_device *device, | 1236 | int ib_query_gid(struct ib_device *device, |
1226 | u8 port_num, int index, union ib_gid *gid); | 1237 | u8 port_num, int index, union ib_gid *gid); |
1227 | 1238 | ||