From patchwork Sun Nov 15 11:30:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haggai Abramonvsky X-Patchwork-Id: 7618721 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 26E799F731 for ; Sun, 15 Nov 2015 11:31:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23E77205DA for ; Sun, 15 Nov 2015 11:31:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BC5B205DB for ; Sun, 15 Nov 2015 11:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751319AbbKOLbk (ORCPT ); Sun, 15 Nov 2015 06:31:40 -0500 Received: from [193.47.165.129] ([193.47.165.129]:43616 "EHLO mellanox.co.il" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751159AbbKOLbj (ORCPT ); Sun, 15 Nov 2015 06:31:39 -0500 Received: from Internal Mail-Server by MTLPINE1 (envelope-from hagaya@mellanox.com) with ESMTPS (AES256-SHA encrypted); 15 Nov 2015 13:31:14 +0200 Received: from dev-l-vrt-198-005.mtl.labs.mlnx (dev-l-vrt-198-005.mtl.labs.mlnx [10.134.198.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id tAFBVE2v030267; Sun, 15 Nov 2015 13:31:14 +0200 Received: from dev-l-vrt-198-005.mtl.labs.mlnx (localhost [127.0.0.1]) by dev-l-vrt-198-005.mtl.labs.mlnx (8.14.7/8.14.7) with ESMTP id tAFBVEta026765; Sun, 15 Nov 2015 13:31:14 +0200 Received: (from hagaya@localhost) by dev-l-vrt-198-005.mtl.labs.mlnx (8.14.7/8.14.7/Submit) id tAFBVEZ1026764; Sun, 15 Nov 2015 13:31:14 +0200 From: Hagay Abramovsky To: Eli Cohen Cc: linux-rdma@vger.kernel.org, Haggai Abramonvsky Subject: [PATCH libmlx5 v1 1/5] libmlx5: Add infrastructure for resource identification Date: Sun, 15 Nov 2015 13:30:55 +0200 Message-Id: <1447587059-26725-2-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1447587059-26725-1-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> References: <1447587059-26725-1-git-send-email-hagaya@dev-l-vrt-198-005.mtl.labs.mlnx> 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 Abramonvsky 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. Change-Id: Id7d1356cc866fa0aa06d256df9f3612dc1988e6a 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)