From patchwork Tue Dec 20 09:13:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 9481303 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 90C96600CA for ; Tue, 20 Dec 2016 09:15:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B8F5283E5 for ; Tue, 20 Dec 2016 09:15:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F9EC2846A; Tue, 20 Dec 2016 09:15:54 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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 EB1EA283E5 for ; Tue, 20 Dec 2016 09:15:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933860AbcLTJPj (ORCPT ); Tue, 20 Dec 2016 04:15:39 -0500 Received: from mail-qk0-f169.google.com ([209.85.220.169]:34105 "EHLO mail-qk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933844AbcLTJPL (ORCPT ); Tue, 20 Dec 2016 04:15:11 -0500 Received: by mail-qk0-f169.google.com with SMTP id q68so42223027qki.1 for ; Tue, 20 Dec 2016 01:15:11 -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=R4+71Vw0QJNBtn0VL9Ep4u0RAEfNFYuYMI0xTIafGmc=; b=T2E1b0e2PUA9N0E4xgZv2hAmbJ4v05Qs0fdIgUeBWNVsByCqCXoFSsgMc32Cn8WCao sgvjZa48Jm9C84dHn0FqaSEBX+Fbs+jBhnV5beasqEWVcrBwyL/aCovKAXjKYMhfCom5 r3bt3fW/a3VeX6xKCucMgc1ux9tolb1T1eGM8= 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=R4+71Vw0QJNBtn0VL9Ep4u0RAEfNFYuYMI0xTIafGmc=; b=LGYJLeNDWY4/vj11IFQNcElY/LW3bZTd9yxuTwuRK8OlqfM+nraHOtpWws5IyTHvE0 hRHyRh1b3UawZ2EYkYUAd+9vUxgNN6QqBENaHl8MxaP91kT2kUsqiRl81cEb4Teplrlp HlmvYN1oLRZWr8bNxcs70QOVngGjnt/vEeYmOpgjhxS7sURZhimvOk77v4zvG1ZBy5vc WOI9GOyeoJpiH8NnInlETM1jcqPmQoy37BMKbRMr0MDwRkuT4Ib8Nrks279SJ5B0p1ye 9X+8qAWqcV50W6GvYO0FftCILATSyeothOlMAPG9eDaumT7EJx1BQBpzdIbL5QQZQdtS qXSg== X-Gm-Message-State: AIkVDXIt0kHsmx9H8nVxjtH+v4h+OOltEaqzliRPlhSYeoJRNFcW9icJZq61tpkva1KlSTNX X-Received: by 10.55.203.74 with SMTP id d71mr3998284qkj.269.1482225310670; Tue, 20 Dec 2016 01:15:10 -0800 (PST) Received: from dhcp-10-192-206-197.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id b63sm12494452qka.39.2016.12.20.01.15.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Dec 2016 01:15:10 -0800 (PST) From: Selvin Xavier To: dledford@redhat.com, linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org, michael.chan@broadcom.com, Selvin Xavier , Eddie Wai , Devesh Sharma , Somnath Kotur , Sriharsha Basavapatna Subject: [PATCH for bnxt_re V3 20/21] bnxt_re: Add QP event handling Date: Tue, 20 Dec 2016 01:13:30 -0800 Message-Id: <1482225211-22423-21-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1482225211-22423-1-git-send-email-selvin.xavier@broadcom.com> References: <1482225211-22423-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 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/bnxtre/bnxt_qplib_rcfw.c | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c b/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c index 488c26f..761d32a 100644 --- a/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c +++ b/drivers/infiniband/hw/bnxtre/bnxt_qplib_rcfw.c @@ -257,6 +257,44 @@ 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: + 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 +318,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