From patchwork Sun Sep 4 19:15:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roland Dreier X-Patchwork-Id: 9312755 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 57D11600CA for ; Sun, 4 Sep 2016 19:21:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4705F287FA for ; Sun, 4 Sep 2016 19:21:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B1A0287FF; Sun, 4 Sep 2016 19:21:59 +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=-5.0 required=2.0 tests=BAYES_00,MISSING_MIMEOLE, RCVD_IN_DNSWL_HI 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 251AC287FA for ; Sun, 4 Sep 2016 19:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753449AbcIDTVu (ORCPT ); Sun, 4 Sep 2016 15:21:50 -0400 Received: from resqmta-po-06v.sys.comcast.net ([96.114.154.165]:54087 "EHLO resqmta-po-06v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752962AbcIDTVu (ORCPT ); Sun, 4 Sep 2016 15:21:50 -0400 X-Greylist: delayed 356 seconds by postgrey-1.27 at vger.kernel.org; Sun, 04 Sep 2016 15:21:50 EDT Received: from resomta-po-05v.sys.comcast.net ([96.114.154.229]) by resqmta-po-06v.sys.comcast.net with SMTP id gcstb92JejWBpgctVbVmgP; Sun, 04 Sep 2016 19:15:53 +0000 Received: from shaolin.home.digitalvampire.org ([IPv6:2001:470:1f05:221:6e0b:84ff:fe3e:a479]) by resomta-po-05v.sys.comcast.net with SMTP id gctHbdzWg1Br4gctNbPY6W; Sun, 04 Sep 2016 19:15:51 +0000 Received: by shaolin.home.digitalvampire.org (Postfix, from userid 1000) id 890EF9160364; Sun, 4 Sep 2016 12:15:39 -0700 (PDT) From: Roland Dreier To: Yishai Hadas Cc: linux-rdma@vger.kernel.org Subject: [PATCH/libmlx4] Return failure if asked to resize CQ to fewer than outstanding entries X-Message-Flag: Warning: May contain useful information X-Priority: 1 X-MSMail-Priority: High Date: Sun, 04 Sep 2016 12:15:39 -0700 Message-ID: <87wpirxyqs.fsf@digitalvampire.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-CMAE-Envelope: MS4wfBpZifZtNc1dKGuhwh+lJdxr2aQfdVuRBI0A0A3mDsKOsztIgYeA6hjyzxq3y+emcVfEDZYmQ7CvMFTsWY3osnn7A9dPpoPKEv3k5xpZIcxkKmjFZqPb SvoRLHWQj7Y1gXeravrACrORTg2zAaRm8byJiG2/skF3z7uu+GtbPzwaQ6xs1fJnQKuydD0ZBzRXOBoSxIz+z39thHtlaHWGHKwNUwTmBavcAX309UXDA+nV 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: Roland Dreier Don't silently return 0 (success) but not resize the CQ when the number of outstanding entries is smaller than the size requested. Instead return EINVAL so the consumer knows the CQ wasn't resized. This is one of the fixes in kernel commit 8ab9406a41c8 ("IB/mlx4: Bug fixes in mlx4_ib_resize_cq") from Majd Dibbiny . Signed-off-by: Roland Dreier --- src/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/verbs.c b/src/verbs.c index 43853c0c6532..5cc82cf38763 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -392,7 +392,7 @@ int mlx4_resize_cq(struct ibv_cq *ibcq, int cqe) /* Can't be smaller then the number of outstanding CQEs */ outst_cqe = mlx4_get_outstanding_cqes(cq); if (cqe < outst_cqe + 1) { - ret = 0; + ret = EINVAL; goto out; }