From patchwork Thu Jun 29 11:47:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 9816503 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 92A6A6020A for ; Thu, 29 Jun 2017 11:47:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 866DE27031 for ; Thu, 29 Jun 2017 11:47:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7AA1227F54; Thu, 29 Jun 2017 11:47:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C79027031 for ; Thu, 29 Jun 2017 11:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbdF2Lrx (ORCPT ); Thu, 29 Jun 2017 07:47:53 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:60613 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752682AbdF2Lru (ORCPT ); Thu, 29 Jun 2017 07:47:50 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 29 Jun 2017 14:47:19 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v5TBlJCc017944; Thu, 29 Jun 2017 14:47:19 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id v5TBlJKu017931; Thu, 29 Jun 2017 14:47:19 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id v5TBlJAB017930; Thu, 29 Jun 2017 14:47:19 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: dledford@redhat.com, yishaih@mellanox.com, maorg@mellanox.com, majd@mellanox.com Subject: [PATCH rdma-core 2/7] mlx4: Add CQE fields Date: Thu, 29 Jun 2017 14:47:03 +0300 Message-Id: <1498736828-17875-3-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1498736828-17875-1-git-send-email-yishaih@mellanox.com> References: <1498736828-17875-1-git-send-email-yishaih@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Maor Gottlieb Introduce inline calls to get/set for most commonly used CQE data path fields. Signed-off-by: Maor Gottlieb Reviewed-by: Yishai Hadas --- providers/mlx4/mlx4dv.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/providers/mlx4/mlx4dv.h b/providers/mlx4/mlx4dv.h index 86b4e13..e677fe1 100644 --- a/providers/mlx4/mlx4dv.h +++ b/providers/mlx4/mlx4dv.h @@ -37,6 +37,13 @@ #include #include +/* Always inline the functions */ +#ifdef __GNUC__ +#define MLX4DV_ALWAYS_INLINE inline __attribute__((always_inline)) +#else +#define MLX4DV_ALWAYS_INLINE inline +#endif + enum { MLX4_OPCODE_NOP = 0x00, MLX4_OPCODE_SEND_INVAL = 0x01, @@ -219,6 +226,25 @@ enum mlx4dv_obj_type { */ int mlx4dv_init_obj(struct mlx4dv_obj *obj, uint64_t obj_type); +static MLX4DV_ALWAYS_INLINE +uint8_t mlx4dv_get_cqe_owner(struct mlx4_cqe *cqe) +{ + return cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK; +} + +static MLX4DV_ALWAYS_INLINE +void mlx4dv_set_cqe_owner(struct mlx4_cqe *cqe, uint8_t val) +{ + cqe->owner_sr_opcode = (val & MLX4_CQE_OWNER_MASK) | + (cqe->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK); +} + +static MLX4DV_ALWAYS_INLINE +uint8_t mlx4dv_get_cqe_opcode(struct mlx4_cqe *cqe) +{ + return cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK; +} + /* * WQE related part */