From patchwork Tue Feb 2 19:29:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Majd Dibbiny X-Patchwork-Id: 8194821 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 CA987BEEE5 for ; Tue, 2 Feb 2016 19:30:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED87020253 for ; Tue, 2 Feb 2016 19:30:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2DD972012E for ; Tue, 2 Feb 2016 19:30:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753613AbcBBTaf (ORCPT ); Tue, 2 Feb 2016 14:30:35 -0500 Received: from [193.47.165.129] ([193.47.165.129]:53980 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S965014AbcBBTac (ORCPT ); Tue, 2 Feb 2016 14:30:32 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from majd@mellanox.com) with ESMTPS (AES256-SHA encrypted); 2 Feb 2016 21:29:55 +0200 Received: from vnc21.mtl.labs.mlnx (vnc21.mtl.labs.mlnx [10.7.2.21]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id u12JTs7t006743; Tue, 2 Feb 2016 21:29:54 +0200 From: Majd Dibbiny To: yishaih@mellanox.com Cc: linux-rdma@vger.kernel.org, matanb@mellanox.com, talal@mellanox.com, majd@mellanox.com, cl@linux.com, Haggai Abramovsky Subject: [PATCH libmlx5 v2 1/7] Add infrastructure for resource identification Date: Tue, 2 Feb 2016 21:29:45 +0200 Message-Id: <1454441391-30494-2-git-send-email-majd@mellanox.com> X-Mailer: git-send-email 1.7.11.1 In-Reply-To: <1454441391-30494-1-git-send-email-majd@mellanox.com> References: <1454441391-30494-1-git-send-email-majd@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.3 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. Reviewed-by:: Yishai Hadas Signed-off-by: Haggai Abramovsky Signed-off-by: Majd Dibbiny --- src/mlx5.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mlx5.h b/src/mlx5.h index 9181ec5..a930bac 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)