From patchwork Tue Dec 29 15:01:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 7930201 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 391529F318 for ; Tue, 29 Dec 2015 15:01:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 48B4920225 for ; Tue, 29 Dec 2015 15:01:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6E34201B4 for ; Tue, 29 Dec 2015 15:01:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753474AbbL2PBq (ORCPT ); Tue, 29 Dec 2015 10:01:46 -0500 Received: from mail-wm0-f50.google.com ([74.125.82.50]:36952 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752868AbbL2PBq (ORCPT ); Tue, 29 Dec 2015 10:01:46 -0500 Received: by mail-wm0-f50.google.com with SMTP id f206so45067943wmf.0 for ; Tue, 29 Dec 2015 07:01:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leon-nu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=8iFttNyMfaVqF/IvwAbCmXUJXWGGAiVTVSIbbkeHm9A=; b=nUCfD44wImKWLaqpRj8rIt7B12cdY6jXXdjGnagzUsgV3USDzRMBYaDxF3E1vCGBaK w2/GbCE+UTL1F54nl1CyLo/FA89jGH1ul6zz4ZjfJdLFPuv1NO6V2RlubmvSGXZFxJB1 U/nWYwXGNvkvQEsbwuFDMeRIQhcRIKtWXv9koUw11kN21BcpQHZ5ExIn0Ls+Ws/l5H3T 6tSv2we4q5Br4zvpIHMNeRUKJDadc4EkCPaS1ZvqsKf/fhvOOuqVrvTLD7bQnQ+TeURT bjYkTHmZHYtM4OCAPhCEbXiLsMyP08abPvEUWsZL6aTaTWZXUum+LjbIMerQCYhz5qSv azOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8iFttNyMfaVqF/IvwAbCmXUJXWGGAiVTVSIbbkeHm9A=; b=QvmiT2gMWiMFZ4BKoDLaeUMPOBlTxSDrxFYJ5eKfK+ZKtjRPsq4Z8rOIGJawV+hrOp 7bHiUOIsr+dOk6TgUxF9Dg7bahnJ170sdSJlQYgE9JPbbY/nsrmfn0DATJ/MpJKTsP8U wUY9xYm0J8N9+yVnx/rcb8L/8cfH0Epyrrt1Xj2ZVHQruAv8RpNoZLyqV/+/NUM0q9CS UDiPhW3EkUD4tkbV8SZFwMy/fiQLfMeBH1Dfm9cL3ED+Vss1jQCh1x3nKF9AdcxMv584 4zRcWqUKV57pcPIu9dPrsFIO7SAfEm1JsccAvJStVbCsQGkNY4EaR76rsNA+pjo7vAQz LhvA== X-Gm-Message-State: ALoCoQk+pzN4f8zXiw4whb8yjYdGQQkjvs4/PDaPKwUnFsm8/Qf+JSK0aekh7SgC7Bt9xHL3pNQamGPm5hQNMM4+r6TW4457jQ== X-Received: by 10.28.18.21 with SMTP id 21mr11590490wms.11.1451401305105; Tue, 29 Dec 2015 07:01:45 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id x10sm27128571wjx.8.2015.12.29.07.01.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2015 07:01:37 -0800 (PST) From: Leon Romanovsky To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH V3] IB/mlx5: Unify CQ create flags check Date: Tue, 29 Dec 2015 17:01:30 +0200 Message-Id: <1451401290-18224-1-git-send-email-leon@leon.nu> X-Mailer: git-send-email 2.1.4 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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: Leon Romanovsky The create_cq() can receive creation flags which were used differently by two commits which added create_cq extended command and cross-channel. The merged code caused to not accept any flags at all. This patch unifies the check into one function and one return error code. Fixes: 972ecb821379 ("IB/mlx5: Add create_cq extended command") Fixes: 051f263098a9 ("IB/mlx5: Add driver cross-channel support") Signed-off-by: Leon Romanovsky --- Changes from v2: * Remove blank line after Fixes * Place changes below Signed-off-by Changes from v1: * Remove links to linux-rdma from commit message * Placed change log under git comment section (---) Changes from v0: * Add Fixes tag drivers/infiniband/hw/mlx5/cq.c | 9 +-------- drivers/infiniband/hw/mlx5/mlx5_ib.h | 3 ++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/cq.c b/drivers/infiniband/hw/mlx5/cq.c index b14316603e44..7ddc790b1819 100644 --- a/drivers/infiniband/hw/mlx5/cq.c +++ b/drivers/infiniband/hw/mlx5/cq.c @@ -757,10 +757,6 @@ static void destroy_cq_kernel(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq) mlx5_db_free(dev->mdev, &cq->db); } -enum { - CQ_CREATE_FLAGS_SUPPORTED = IB_CQ_FLAGS_TIMESTAMP_COMPLETION -}; - struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, const struct ib_cq_init_attr *attr, struct ib_ucontext *context, @@ -778,13 +774,10 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int eqn; int err; - if (check_cq_create_flags(attr->flags)) - return ERR_PTR(-EINVAL); - if (entries < 0) return ERR_PTR(-EINVAL); - if (attr->flags & ~CQ_CREATE_FLAGS_SUPPORTED) + if (check_cq_create_flags(attr->flags)) return ERR_PTR(-EOPNOTSUPP); entries = roundup_pow_of_two(entries + 1); diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h index d4b227126265..fbf14a768105 100644 --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h @@ -692,6 +692,7 @@ static inline u32 check_cq_create_flags(u32 flags) * It returns non-zero value for unsupported CQ * create flags, otherwise it returns zero. */ - return (flags & ~IB_CQ_FLAGS_IGNORE_OVERRUN); + return (flags & ~(IB_CQ_FLAGS_IGNORE_OVERRUN | + IB_CQ_FLAGS_TIMESTAMP_COMPLETION)); } #endif /* MLX5_IB_H */