From patchwork Tue Jul 19 09:28:42 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Or Gerlitz X-Patchwork-Id: 988462 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6J9QHn5032209 for ; Tue, 19 Jul 2011 09:29:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752726Ab1GSJ3A (ORCPT ); Tue, 19 Jul 2011 05:29:00 -0400 Received: from mail.mellanox.co.il ([194.90.237.43]:36343 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752419Ab1GSJ3A (ORCPT ); Tue, 19 Jul 2011 05:29:00 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from ogerlitz@mellanox.com) with SMTP; 19 Jul 2011 12:28:57 +0300 Received: from MTRCASDAG01.mtl.com (172.25.0.174) by MTLCAS01.mtl.com (10.0.8.71) with Microsoft SMTP Server (TLS) id 14.1.289.1; Tue, 19 Jul 2011 12:28:57 +0300 Received: from host217 (172.25.5.217) by MTRCASDAG01.mtl.com (172.25.0.174) with Microsoft SMTP Server (TLS) id 14.1.289.1; Tue, 19 Jul 2011 12:28:57 +0300 Date: Tue, 19 Jul 2011 12:28:42 +0300 From: Or Gerlitz X-X-Sender: ogerlitz@ogerlitz.voltaire.com To: Roland Dreier CC: linux-rdma Subject: [PATCH 2/7] libibverbs: change kernel API to accept link layer In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LRH 1167 2008-08-23) MIME-Version: 1.0 X-Originating-IP: [172.25.5.217] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 19 Jul 2011 09:29:22 +0000 (UTC) Modify the code to allow passing the link layer of a port from the kernel to the library. The new field does not change the size of struct ibv_query_port_resp as it replaces a reserved field. As such binary compatibility between the kernel to the library is kept, since old kernel running below new library will not touch that field so it will be resolved as unspecified, and old library running over new kernel will ignore the setting done by the kernel. The solution was suggested by: Roland Dreier and Jason Gunthorpe Signed-off-by: Or Gerlitz Signed-off-by: Eli Cohen --- include/infiniband/kern-abi.h | 3 ++- src/cmd.c | 1 + 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/include/infiniband/kern-abi.h b/include/infiniband/kern-abi.h index 0db083a..619ea7e 100644 --- a/include/infiniband/kern-abi.h +++ b/include/infiniband/kern-abi.h @@ -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 { diff --git a/src/cmd.c b/src/cmd.c index cbd5288..39af833 100644 --- 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; }