From patchwork Tue Dec 29 14:41:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 7930171 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 19941BEEE5 for ; Tue, 29 Dec 2015 14:41:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 095D620225 for ; Tue, 29 Dec 2015 14:41:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E95F2201B4 for ; Tue, 29 Dec 2015 14:41:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753524AbbL2Olt (ORCPT ); Tue, 29 Dec 2015 09:41:49 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:35244 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753591AbbL2Olp (ORCPT ); Tue, 29 Dec 2015 09:41:45 -0500 Received: by mail-wm0-f43.google.com with SMTP id f206so11966491wmf.0 for ; Tue, 29 Dec 2015 06:41:44 -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=P8Q+y161JCWxhUYcx06zzyF2c6OR3fl8jQkcrCJ+JxI=; b=s9scTqYJz8E/U9r1CBVJOEa8ekPLhz6lCu9QYq4Uap4YKiKzHaAA4gFnlFjMbgKAbD XZLRBcUjXluEB7M53sHgK6MaZ8P648q23R8NJzsE/GcaIZ46KXyy13O4keYFvZO/GR3P JsaLgTQ7EjRn3NgY3QakpmjQZYgMsy/zgDTOh87T2IthmAKhA6fqxZmp1D1Lwh9lUffc GNZB6ZNwdxqm8trmmnHJnhFnJwopTYs1KXpRCt8X7rBU6ayBVPN25QA7YZM4ACmUtYFv y3BVsf55aeTrxtdgaeMIjUVCGaISDHEo/c5omm8B6TKxIhH6wWdqKwSqQvWWXnWfWTcs X2Pw== 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=P8Q+y161JCWxhUYcx06zzyF2c6OR3fl8jQkcrCJ+JxI=; b=DdcWaYu7ZuOcYWXDtLwcnXHWQFoewPX+2OTkOwzqey2UdfTvowRm3Tt5cKbi8xTQ1y 38/bmUpeHE1fzlbYltUWV0f6WN98OhD7d4Jf0QgEU0el3W59elKhLHhLZnUKwzm2BphL 6j8IGY/29/64CerEw5UgE1nqalCUpgMbGkwezv/lmAT4bC43UXrn5Etil4JIR1xTUS3+ 5OsOyAWDss5I6glGQMZ4Mwfu7MiMefZXpBVZdnl+TomEFW4EfxUExRx6ccu0OjiLU4/a Ei7eDSd9f1D9hQemermcPu6B1j2CzhqKqGTLMZgt/ldnEYue93oQr+qNFvh4DXEQPuBF XOGA== X-Gm-Message-State: ALoCoQldWo8RPIPVHuUPGAOaa5Wdwzhzu5JCPwwkmm+YFPMg8moSiP8X0NSkw3o8L+1HLQACc7LOlFLTK1zk2r/M2vzLXPUQfg== X-Received: by 10.194.58.165 with SMTP id s5mr69230443wjq.70.1451400104203; Tue, 29 Dec 2015 06:41:44 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id wf8sm29171974wjb.45.2015.12.29.06.41.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2015 06:41:43 -0800 (PST) From: Leon Romanovsky To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Leon Romanovsky Subject: [PATCH V2] IB/mlx5: Unify CQ create flags check Date: Tue, 29 Dec 2015 16:41:37 +0200 Message-Id: <1451400097-17252-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") --- Changes from v1: * Remove links to linux-rdma from commit message * Placed change log under git comment section (---) Changes from v0: * Add Fixes tag Signed-off-by: Leon Romanovsky --- 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 */