From patchwork Fri Feb 10 11:19:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 9566589 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 A476F60216 for ; Fri, 10 Feb 2017 11:29:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90BDB2853D for ; Fri, 10 Feb 2017 11:29:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83F2E2855E; Fri, 10 Feb 2017 11:29:02 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 EECE52853D for ; Fri, 10 Feb 2017 11:29:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753096AbdBJL27 (ORCPT ); Fri, 10 Feb 2017 06:28:59 -0500 Received: from mail-qk0-f181.google.com ([209.85.220.181]:36023 "EHLO mail-qk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753075AbdBJL25 (ORCPT ); Fri, 10 Feb 2017 06:28:57 -0500 Received: by mail-qk0-f181.google.com with SMTP id 11so35319436qkl.3 for ; Fri, 10 Feb 2017 03:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=INPlLpbWYR+MRCTNtkeemUL9YDBiBcpqo/XTY6VnNYI=; b=GiUcgQr4siDo3Fmr8ZWzWETPpHx+e1gH6Arvk6tiiRN+1SG83w0lOztHeKY05IXljo iGSfFKeBGqJerDD2MCUflcUmJjexe61XsH5Uk2h+Bf0RK7A4MC2xCUrNErmioLcGG44S jrx2Ntn6qzirkZmUzdXKvsa3O9Xvpf7Iks9LM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=INPlLpbWYR+MRCTNtkeemUL9YDBiBcpqo/XTY6VnNYI=; b=orr0Dkhj/hZzY+FI4rdWRYh8NoqGXdczx3efyvbCHaxgkVBWy2qBXiRJGRj5klc0Ei QRJ6J3oF6RHhUz40WyNFVUyNbjSxg2Pumfw7IX09YVZfMSnBhlXFfOOeQ4kE3ICNqyQS epdUiUMcQhEoBxyszW3vGRDc9Pc0EUOOUHWbmnoqvn54W9ZAlBXCoovkKSZZBMK6/02N xrk4nSFHhJ6fW6KeYOrMuYE0JRzjF/JSPeLuqBKcbpuSIXfHMDro2+2Jv5RBvTvCOzoU MWHsXLs2UGvGnw007egD3iOQft4uxNsjX7N2Q1EevLFtLzepNEf6THlbB6pZoWh2qHjf JImA== X-Gm-Message-State: AMke39knVo/mGsL1Mctma2MTdYZeIQBvezrveBMM0zpwQXtKo/RxwvqzzOPRrMmiW8cVdhqE X-Received: by 10.55.101.206 with SMTP id z197mr7777797qkb.117.1486725687966; Fri, 10 Feb 2017 03:21:27 -0800 (PST) Received: from dhcp-10-192-206-197.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id z23sm1211412qkb.30.2017.02.10.03.21.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Feb 2017 03:21:27 -0800 (PST) From: Selvin Xavier To: dledford@redhat.com, linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org, Selvin Xavier , Eddie Wai , Devesh Sharma , Somnath Kotur , Sriharsha Basavapatna Subject: [PATCH V5 for-next 20/21] RDMA/bnxt_re: Add QP event handling Date: Fri, 10 Feb 2017 03:19:52 -0800 Message-Id: <1486725593-9872-21-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1486725593-9872-1-git-send-email-selvin.xavier@broadcom.com> References: <1486725593-9872-1-git-send-email-selvin.xavier@broadcom.com> 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 Implements callback handler for processing Async events related to a QP. This patch also implements the control path command completion handling. v3: Removes unwanted braces v5: Added a debug print QP error notification Signed-off-by: Eddie Wai Signed-off-by: Devesh Sharma Signed-off-by: Somnath Kotur Signed-off-by: Sriharsha Basavapatna Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 49 ++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c index 6040786..23fb726 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c @@ -257,6 +257,46 @@ static int bnxt_qplib_process_func_event(struct bnxt_qplib_rcfw *rcfw, return 0; } +static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, + struct creq_qp_event *qp_event) +{ + struct bnxt_qplib_crsq *crsq = &rcfw->crsq; + struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq; + struct bnxt_qplib_crsqe *crsqe; + u16 cbit, cookie, blocked = 0; + unsigned long flags; + u32 sw_cons; + + switch (qp_event->event) { + case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION: + dev_dbg(&rcfw->pdev->dev, + "QPLIB: Received QP error notification"); + break; + default: + /* Command Response */ + spin_lock_irqsave(&cmdq->lock, flags); + sw_cons = HWQ_CMP(crsq->cons, crsq); + crsqe = &crsq->crsq[sw_cons]; + crsq->cons++; + memcpy(&crsqe->qp_event, qp_event, sizeof(crsqe->qp_event)); + + cookie = le16_to_cpu(crsqe->qp_event.cookie); + blocked = cookie & RCFW_CMD_IS_BLOCKING; + cookie &= RCFW_MAX_COOKIE_VALUE; + cbit = cookie % RCFW_MAX_OUTSTANDING_CMD; + if (!test_and_clear_bit(cbit, rcfw->cmdq_bitmap)) + dev_warn(&rcfw->pdev->dev, + "QPLIB: CMD bit %d was not requested", cbit); + + cmdq->cons += crsqe->req_size; + spin_unlock_irqrestore(&cmdq->lock, flags); + if (!blocked) + wake_up(&rcfw->waitq); + break; + } + return 0; +} + /* SP - CREQ Completion handlers */ static void bnxt_qplib_service_creq(unsigned long data) { @@ -280,6 +320,15 @@ static void bnxt_qplib_service_creq(unsigned long data) type = creqe->type & CREQ_BASE_TYPE_MASK; switch (type) { case CREQ_BASE_TYPE_QP_EVENT: + if (!bnxt_qplib_process_qp_event + (rcfw, (struct creq_qp_event *)creqe)) + rcfw->creq_qp_event_processed++; + else { + dev_warn(&rcfw->pdev->dev, "QPLIB: crsqe with"); + dev_warn(&rcfw->pdev->dev, + "QPLIB: type = 0x%x not handled", + type); + } break; case CREQ_BASE_TYPE_FUNC_EVENT: if (!bnxt_qplib_process_func_event