1 [PATCHv7 1/4] libibverbs: Add link layer field to ibv_port_attr
3 This field can have one of the values - IBV_LINK_LAYER_UNSPECIFIED,
4 IBV_LINK_LAYER_INFINIBAND, IBV_LINK_LAYER_ETHERNET. It can be used by
5 applications to know the link layer used by the port, which can be either
6 Infiniband or Ethernet. The addition of the new field does not change the size
7 of struct ibv_port_attr due to alignment of the preceding field. Binary
8 compatibility is not compromised either since new apps with old libraries will
9 determine the link layer as IB while old applications with new a new library do
12 Solution suggested by:
13 Roland Dreier <rolandd@cisco.com>
14 Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
15 Signed-off-by: Eli Cohen <eli@mellanox.co.il>
17 include/infiniband/verbs.h | 21 +++++++++++++++++++++
18 1 files changed, 21 insertions(+), 0 deletions(-)
20 Index: libibverbs/include/infiniband/verbs.h
21 ===================================================================
22 --- libibverbs.orig/include/infiniband/verbs.h 2010-06-08 11:00:05.575721000 +0300
23 +++ libibverbs/include/infiniband/verbs.h 2010-06-08 11:00:39.442737000 +0300
24 @@ -162,6 +162,12 @@ enum ibv_port_state {
25 IBV_PORT_ACTIVE_DEFER = 5
29 + IBV_LINK_LAYER_UNSPECIFIED,
30 + IBV_LINK_LAYER_INFINIBAND,
31 + IBV_LINK_LAYER_ETHERNET,
34 struct ibv_port_attr {
35 enum ibv_port_state state;
37 @@ -182,6 +188,8 @@ struct ibv_port_attr {
46 @@ -743,6 +751,16 @@ struct ibv_context {
47 struct ibv_more_ops *more_ops;
50 +static inline int ___ibv_query_port(struct ibv_context *context,
52 + struct ibv_port_attr *port_attr)
54 + port_attr->link_layer = IBV_LINK_LAYER_UNSPECIFIED;
57 + return context->ops.query_port(context, port_num, port_attr);
61 * ibv_get_device_list - Get list of IB devices currently available
62 * @num_devices: optional. if non-NULL, set to the number of devices
63 @@ -1304,4 +1322,7 @@ END_C_DECLS
65 # undef __attribute_const
67 +#define ibv_query_port(context, port_num, port_attr) \
68 + ___ibv_query_port(context, port_num, port_attr)
70 #endif /* INFINIBAND_VERBS_H */