From patchwork Sat Dec 22 09:50:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Apfelbaum X-Patchwork-Id: 1017811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::12; helo=lists.nongnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rtCq2QmT"; dkim-atps=neutral Received: from lists.nongnu.org (lists.nongnu.org [IPv6:2001:4830:134:3::12]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43MLX852skz9sPS for ; Sat, 22 Dec 2018 20:57:42 +1100 (AEDT) Received: from localhost ([::1]:45004 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gae2O-0002ed-3W for incoming@patchwork.ozlabs.org; Sat, 22 Dec 2018 04:57:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gadvt-0006BK-9Q for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:50:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gadvr-0006NK-EP for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:50:57 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:35987) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gadvr-0006Ga-5m for qemu-devel@nongnu.org; Sat, 22 Dec 2018 04:50:55 -0500 Received: by mail-wr1-x441.google.com with SMTP id u4so7504289wrp.3 for ; Sat, 22 Dec 2018 01:50:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eFP2KnZ6LP9cKtdVM0lvyx4YWm9nUuG0BkL3Nds+VSs=; b=rtCq2QmTb2pdEG+zV0BfPFW8ekXH8T2v7qIeRUsHWCk845ZGqe5uQg/EWlpx1rZLe2 2/ugBId67neE1gXSde6ftsb4D70jjMobUDb4VIGqLFNOHXr9yUnZVbJW6m9PUjWi1Rrw XI1i+g6vh6bzENohzxis4lcPg2SADgASs6uGLhiGQUMWmNQO9ubTcuvRvTvo1FEmLUgU 3clhtcpYCQoXKIGmggiSpgGrniWHlhPERHq6JrUZEV2o7VCIGNvbyLKaikzw0//slj8Q VfubmB6fD17c4EFR3OL4mU6+bU8fUNXETGjkHmjPhKf7c+1/Zj4RT+ZF2wccxPwfGkqH 27RQ== 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=eFP2KnZ6LP9cKtdVM0lvyx4YWm9nUuG0BkL3Nds+VSs=; b=VDmo8eeBR/ft10bwYCdEqCs2jc+xHdbAp1zxOhBTO08FfxP7pRncXc7qSkPu4E803h VCZ9z8tBs1Yfx/Xfbq1kGX3aPykNa1p8oN2mKjV8PczTjSk6uGH8t5BrAajdWJOMqDF/ 2ukBVi42g029FBmNpN0QtbZJMygY0vf2cmvBuxboLnRAU52L12UiV9BX8YHk2POInVv8 iINaV2fI3ryi2zbo2dr2SFYoy8QHQKlsDOmzQ/eeLoAenxN1i5z4E4ugNhTo/MSXOTTo o1MKGtM7YXDyzGy6g0VykrZ2Nf9AUZrxwOTUQs+3IlYNbzWFP+fKKlA8BYQ5GePr6Zuu /QQg== X-Gm-Message-State: AJcUukco+CLfsa1nUFv6+0eMFpggrbeDUChvJRVFU6q16qZWBPWeDYQI zM8Pe12opGFx3YLxj7dLY3VaKu77 X-Google-Smtp-Source: ALg8bN7iEHF7FiVORAf8NdWrw5aQRKBzYJJgoobhFqptDYzJJ6CLJJiRZDb+7eFB07pR2c+Ihgp/QA== X-Received: by 2002:adf:a452:: with SMTP id e18mr5933901wra.190.1545472244221; Sat, 22 Dec 2018 01:50:44 -0800 (PST) Received: from localhost.localdomain ([176.228.155.165]) by smtp.gmail.com with ESMTPSA id s3sm9557371wmj.23.2018.12.22.01.50.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Dec 2018 01:50:43 -0800 (PST) From: Marcel Apfelbaum To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Sat, 22 Dec 2018 11:50:08 +0200 Message-Id: <20181222095036.29743-4-marcel.apfelbaum@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181222095036.29743-1-marcel.apfelbaum@gmail.com> References: <20181222095036.29743-1-marcel.apfelbaum@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH PULL 03/31] hw/rdma: Add ability to force notification without re-arm X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: yuval.shaia@oracle.com, pjp@fedoraproject.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Yuval Shaia Upon completion of incoming packet the device pushes CQE to driver's RX ring and notify the driver (msix). While for data-path incoming packets the driver needs the ability to control whether it wished to receive interrupts or not, for control-path packets such as incoming MAD the driver needs to be notified anyway, it even do not need to re-arm the notification bit. Enhance the notification field to support this. Signed-off-by: Yuval Shaia Reviewed-by: Marcel Apfelbaum Signed-off-by: Marcel Apfelbaum --- hw/rdma/rdma_rm.c | 12 ++++++++++-- hw/rdma/rdma_rm_defs.h | 8 +++++++- hw/rdma/vmw/pvrdma_qp_ops.c | 6 ++++-- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/rdma/rdma_rm.c b/hw/rdma/rdma_rm.c index 8d59a42cd1..4f10fcabcc 100644 --- a/hw/rdma/rdma_rm.c +++ b/hw/rdma/rdma_rm.c @@ -263,7 +263,7 @@ int rdma_rm_alloc_cq(RdmaDeviceResources *dev_res, RdmaBackendDev *backend_dev, } cq->opaque = opaque; - cq->notify = false; + cq->notify = CNT_CLEAR; rc = rdma_backend_create_cq(backend_dev, &cq->backend_cq, cqe); if (rc) { @@ -291,7 +291,10 @@ void rdma_rm_req_notify_cq(RdmaDeviceResources *dev_res, uint32_t cq_handle, return; } - cq->notify = notify; + if (cq->notify != CNT_SET) { + cq->notify = notify ? CNT_ARM : CNT_CLEAR; + } + pr_dbg("notify=%d\n", cq->notify); } @@ -349,6 +352,11 @@ int rdma_rm_alloc_qp(RdmaDeviceResources *dev_res, uint32_t pd_handle, return -EINVAL; } + if (qp_type == IBV_QPT_GSI) { + scq->notify = CNT_SET; + rcq->notify = CNT_SET; + } + qp = res_tbl_alloc(&dev_res->qp_tbl, &rm_qpn); if (!qp) { return -ENOMEM; diff --git a/hw/rdma/rdma_rm_defs.h b/hw/rdma/rdma_rm_defs.h index 7228151239..9b399063d3 100644 --- a/hw/rdma/rdma_rm_defs.h +++ b/hw/rdma/rdma_rm_defs.h @@ -49,10 +49,16 @@ typedef struct RdmaRmPD { uint32_t ctx_handle; } RdmaRmPD; +typedef enum CQNotificationType { + CNT_CLEAR, + CNT_ARM, + CNT_SET, +} CQNotificationType; + typedef struct RdmaRmCQ { RdmaBackendCQ backend_cq; void *opaque; - bool notify; + CQNotificationType notify; } RdmaRmCQ; /* MR (DMA region) */ diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c index c668afd0ed..762700a205 100644 --- a/hw/rdma/vmw/pvrdma_qp_ops.c +++ b/hw/rdma/vmw/pvrdma_qp_ops.c @@ -89,8 +89,10 @@ static int pvrdma_post_cqe(PVRDMADev *dev, uint32_t cq_handle, pvrdma_ring_write_inc(&dev->dsr_info.cq); pr_dbg("cq->notify=%d\n", cq->notify); - if (cq->notify) { - cq->notify = false; + if (cq->notify != CNT_CLEAR) { + if (cq->notify == CNT_ARM) { + cq->notify = CNT_CLEAR; + } post_interrupt(dev, INTR_VEC_CMD_COMPLETION_Q); }