]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Update kernel API header to include link_layer
authorOr Gerlitz <ogerlitz@mellanox.com>
Tue, 19 Jul 2011 09:28:42 +0000 (09:28 +0000)
committerRoland Dreier <roland@purestorage.com>
Tue, 26 Jul 2011 20:15:33 +0000 (13:15 -0700)
Modify the code to handle returning the link layer of a port from the
kernel to the library.  The kernel has done this since commit
2420b60b1dc4 ("IB/uverbs: Return link layer type to userspace for
query port operation"), merged in 2.6.37-rc1.

The new field does not change the size of struct ibv_query_port_resp
as it replaces a reserved field.  Binary compatibility between the
kernel to the library is kept, since old kernels running below new
library will not zero that field, so it will be read as "unspecified,"
while an old library running over new kernel will ignore the value
returned by the kernel.

The solution was suggested by Roland Dreier <roland@purestorage.com>
and Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.co.il>
Signed-off-by: Eli Cohen <eli@mellanox.co.il>
include/infiniband/kern-abi.h
src/cmd.c

index 0db083a5869d8a19e884f40b3f546c713b9e9391..619ea7e5d04d187ca2d02b99c0a7b334b4d9171f 100644 (file)
@@ -223,7 +223,8 @@ struct ibv_query_port_resp {
        __u8  active_width;
        __u8  active_speed;
        __u8  phys_state;
-       __u8  reserved[3];
+       __u8  link_layer;
+       __u8  reserved[2];
 };
 
 struct ibv_alloc_pd {
index cbd528846710fbd0d805e5b54c0476588813292c..39af833b3abace439b70d581c8dc211befdce05a 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -196,6 +196,7 @@ int ibv_cmd_query_port(struct ibv_context *context, uint8_t port_num,
        port_attr->active_width    = resp.active_width;
        port_attr->active_speed    = resp.active_speed;
        port_attr->phys_state      = resp.phys_state;
+       port_attr->link_layer      = resp.link_layer;
 
        return 0;
 }