From patchwork Tue Dec 29 11:34:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leon Romanovsky X-Patchwork-Id: 7929781 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 0D7CD9F350 for ; Tue, 29 Dec 2015 11:35:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F0E0201EC for ; Tue, 29 Dec 2015 11:35:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 083252015A for ; Tue, 29 Dec 2015 11:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751538AbbL2LfA (ORCPT ); Tue, 29 Dec 2015 06:35:00 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:38302 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbbL2Le7 (ORCPT ); Tue, 29 Dec 2015 06:34:59 -0500 Received: by mail-wm0-f45.google.com with SMTP id b14so9975770wmb.1 for ; Tue, 29 Dec 2015 03:34:59 -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=p/8/Tznbg1euV2jHGt1G44ZwAZ3JtiIVtNPHwOwjUwk=; b=2Bncrl13ILj53SgtktNVt6CnIhm4AmN72mAkBjnnV5R/s1ZtYm4xpKKjJaDen4fo/m yan5+xnRtViMKC/OKf625/Zz5S5glW8ZnFJPSizLWF1nYHxdv0DSAAvu6xkEGp1Da6vd YlCChDUrEb6lb+CN6ZwKDc+XTRPQifVVRDDbmPumDRyzAIGAXba3EsKfogKydwKaPOSa 4Rle4XHxRu+oWJ0MA4LkbIBYLKKAeRiQubKJY15R8sybatpTOG/l/peOgGwHdOT6ZsmI Z0elNT5jwQaQs5A9ZNoZ95A4fOL9IFEpMQPkjO1Tu/GrSxzs+WgDOJRQVUVnSfZqLKW3 v6ww== 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=p/8/Tznbg1euV2jHGt1G44ZwAZ3JtiIVtNPHwOwjUwk=; b=ZGWr7V95uekLadvfiqTqiWk2G8ol/1HMXwdTIKkIR11hmzOc48XtPhZXNqGkUzhuhW /0bft8ktoGspZdXbOudCNd/Bp8e5l515JQ+AXYbPL7FVnJDd7o4tSEMnxwQLSuyPqXFH pg1CcUBIoBu9oZJXkulVTI4qWfawfIu9QZgOiWHFYEwJGkoZ+ZD5IRUG5uVuHMcx5t77 esZEbBBlECdhKoqf3l4VKeBW8JV26c6NrjzZ81Iz9aUh+edDKzBc4QI072XvCHQrb81Q 8a/IZ8jrmg9O+LBTzFUeiE8hLXmAQ4su3TaXFk3TmgXCaMZ/7TrGGKwg1HbwbGiHQnbD VZEg== X-Gm-Message-State: ALoCoQnDiSkizq6kW+Kof0znM6XXbWcy4WuwxdZ02mVPSHXN1zd07zCvJoEDBvvslTvGDRJvdjri7v26gQ11DOKUn6e0+Uf+pQ== X-Received: by 10.28.148.82 with SMTP id w79mr58685567wmd.71.1451388898308; Tue, 29 Dec 2015 03:34:58 -0800 (PST) Received: from localhost ([213.57.247.249]) by smtp.gmail.com with ESMTPSA id i3sm16769837wja.47.2015.12.29.03.34.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Dec 2015 03:34:57 -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 13:34:44 +0200 Message-Id: <1451388884-11673-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 following commits [1] and [2]. The current 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") [1] http://www.spinics.net/lists/linux-rdma/msg31430.html [2] http://www.spinics.net/lists/linux-rdma/msg31658.html 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 */