From patchwork Wed Jul 13 09:33:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 9227287 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 3B9006075D for ; Wed, 13 Jul 2016 09:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CD3824DA1 for ; Wed, 13 Jul 2016 09:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 215F127D85; Wed, 13 Jul 2016 09:34:32 +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 9132D24DA1 for ; Wed, 13 Jul 2016 09:34:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750883AbcGMJea (ORCPT ); Wed, 13 Jul 2016 05:34:30 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:16495 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbcGMJe2 (ORCPT ); Wed, 13 Jul 2016 05:34:28 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u6D9Xxi0011941 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Jul 2016 09:34:00 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id u6D9XwRJ004407 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Jul 2016 09:33:59 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u6D9Xv1g010056; Wed, 13 Jul 2016 09:33:58 GMT Received: from yuval-net-srv-ca.us.oracle.com (/10.211.3.71) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Jul 2016 02:33:57 -0700 From: Yuval Shaia To: linux-rdma@vger.kernel.org, dledford@redhat.com, sean.hefty@intel.com, hal.rosenstock@gmail.com Subject: [PATCH] IB/ipoib: Skip napi_schedule if ib_poll_cq fails Date: Wed, 13 Jul 2016 02:33:56 -0700 Message-Id: <1468402436-25053-1-git-send-email-yuval.shaia@oracle.com> X-Mailer: git-send-email 1.7.1 X-Source-IP: aserv0021.oracle.com [141.146.126.233] 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 To avoid entering into endless loop when device can't poll CQE from CQ driver should not reschedule if error is not -EAGAIN. Signed-off-by: Yuval Shaia --- drivers/infiniband/ulp/ipoib/ipoib.h | 5 +++++ drivers/infiniband/ulp/ipoib/ipoib_ib.c | 10 ++++++++++ drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 1 + 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h index 4f7d9b4..1946149 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib.h +++ b/drivers/infiniband/ulp/ipoib/ipoib.h @@ -116,6 +116,8 @@ enum { IPOIB_NON_CHILD = 0, IPOIB_LEGACY_CHILD = 1, IPOIB_RTNL_CHILD = 2, + + IPOIB_MAX_CONSEQ_CQ_ERR = 10, }; #define IPOIB_OP_RECV (1ul << 31) @@ -347,6 +349,7 @@ struct ipoib_dev_priv { u16 pkey_index; struct ib_pd *pd; struct ib_cq *recv_cq; + int recv_conseq_cq_errs; struct ib_cq *send_cq; struct ib_qp *qp; u32 qkey; @@ -772,6 +775,8 @@ static inline void ipoib_unregister_debugfs(void) { } printk(level "%s: " format, ((struct ipoib_dev_priv *) priv)->dev->name , ## arg) #define ipoib_warn(priv, format, arg...) \ ipoib_printk(KERN_WARNING, priv, format , ## arg) +#define ipoib_crit(priv, format, arg...) \ + ipoib_printk(KERN_CRIT, priv, format , ## arg) extern int ipoib_sendq_size; extern int ipoib_recvq_size; diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c index dc6d241..171a425 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c @@ -475,6 +475,16 @@ poll_more: break; } + if (unlikely(n < 0) && (n != -EAGAIN)) { + if (priv->recv_conseq_cq_errs++ >= IPOIB_MAX_CONSEQ_CQ_ERR) { + ipoib_crit(priv, + "Too many poll_cq errors, last error: %d\n", + n); + return done; + } + } else + priv->recv_conseq_cq_errs = 0; + if (done < budget) { napi_complete(napi); if (unlikely(ib_req_notify_cq(priv->recv_cq, diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c index 1e7cbba..6ca8bdd 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c @@ -181,6 +181,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca) printk(KERN_WARNING "%s: failed to create receive CQ\n", ca->name); goto out_cm_dev_cleanup; } + priv->recv_conseq_cq_errs = 0; cq_attr.cqe = ipoib_sendq_size; priv->send_cq = ib_create_cq(priv->ca, ipoib_send_comp_handler, NULL,