From patchwork Tue Nov 17 21:52:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haggai Abramonvsky X-Patchwork-Id: 7642501 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6B6D4C05CA for ; Tue, 17 Nov 2015 21:52:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F85B20523 for ; Tue, 17 Nov 2015 21:52:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9FA8A20513 for ; Tue, 17 Nov 2015 21:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754810AbbKQVwx (ORCPT ); Tue, 17 Nov 2015 16:52:53 -0500 Received: from [193.47.165.129] ([193.47.165.129]:38640 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754860AbbKQVww (ORCPT ); Tue, 17 Nov 2015 16:52:52 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from hagaya@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 Nov 2015 23:52:27 +0200 Received: from dev-l-vrt-194.mtl.labs.mlnx (dev-l-vrt-194.mtl.labs.mlnx [10.134.194.1]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id tAHLqRGv017329; Tue, 17 Nov 2015 23:52:27 +0200 From: Haggai Abramonvsky To: Eli Cohen Cc: linux-rdma@vger.kernel.org, Haggai Abramovsky Subject: [PATCH libmlx5 v2 1/5] libmlx5: Add infrastructure for resource identification Date: Tue, 17 Nov 2015 23:52:18 +0200 Message-Id: <1447797142-24149-2-git-send-email-hagaya@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1447797142-24149-1-git-send-email-hagaya@mellanox.com> References: <1447797142-24149-1-git-send-email-hagaya@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Haggai Abramovsky Add new struct member, mlx5_resource, for each tracked object, mlx5_srq and mlx5_qp, to allow retrieving the object in the poll_cq once we need it. Signed-off-by: Haggai Abramovsky --- src/mlx5.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mlx5.h b/src/mlx5.h index 92ef33d..d8ce908 100644 --- a/src/mlx5.h +++ b/src/mlx5.h @@ -228,6 +228,18 @@ enum mlx5_alloc_type { MLX5_ALLOC_TYPE_ALL }; +enum mlx5_rsc_type { + MLX5_RSC_TYPE_QP, + MLX5_RSC_TYPE_XSRQ, + MLX5_RSC_TYPE_SRQ, + MLX5_RSC_TYPE_INVAL, +}; + +struct mlx5_resource { + enum mlx5_rsc_type type; + uint32_t rsn; +}; + struct mlx5_device { struct verbs_device verbs_dev; int page_size; @@ -341,6 +353,7 @@ struct mlx5_cq { }; struct mlx5_srq { + struct mlx5_resource rsc; /* This struct must be first */ struct verbs_srq vsrq; struct mlx5_buf buf; struct mlx5_spinlock lock; @@ -392,6 +405,7 @@ struct mlx5_mr { }; struct mlx5_qp { + struct mlx5_resource rsc; /* This struct must be first */ struct verbs_qp verbs_qp; struct ibv_qp ibv_qp; struct mlx5_buf buf; @@ -491,7 +505,9 @@ static inline struct mlx5_cq *to_mcq(struct ibv_cq *ibcq) static inline struct mlx5_srq *to_msrq(struct ibv_srq *ibsrq) { - return (struct mlx5_srq *)ibsrq; + struct verbs_srq *vsrq = (struct verbs_srq *)ibsrq; + + return container_of(vsrq, struct mlx5_srq, vsrq); } static inline struct mlx5_qp *to_mqp(struct ibv_qp *ibqp)