From patchwork Thu Jun 15 23:27:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: longli@linuxonhyperv.com X-Patchwork-Id: 108759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp983568vqr; Thu, 15 Jun 2023 16:48:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ677jG9WHLHVCJeG2nZHTFFwaSWWEWd//ZoTAShX7+W+cRAyv2PupRmAuQvdgWAaFtKGrbn X-Received: by 2002:a05:6a20:3d1d:b0:104:ffd0:232a with SMTP id y29-20020a056a203d1d00b00104ffd0232amr8664310pzi.8.1686872914346; Thu, 15 Jun 2023 16:48:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686872914; cv=none; d=google.com; s=arc-20160816; b=z/61b79HTMvIzZgzgPmp/5P6ax4s/lZWSPqHwANb+Q6xhPoQ+H5TMHg4M1g29w5++C cTLySrtAMcJXEPLi02koAKQb1MAwB9DAQCXQbLK+BLpHg6Byc13mPQpboZxDCREvyY45 5NG0z+w9BNMDa22sI7t/XPSeZTNC9WTHzJNqAKYraR5VNnmj4kLTppEgQbaZRfd+/DA/ wolo9Ld5IxsfEaYRBIYWuKC3sY3x2tZYbriUTQ1iNylbnyptLm02YnR5VsXXbYLm2q+K Etv/nnYrzQBw27Pb/eANvQcAKqfH3JmtbLqAj/fqYkEeA/RMLmBAVNXWMzGQEbrIe0j1 G/bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=y5V7yYuG8e/yBxteubjXicX8w1FBL0ThXqAOOQJhXdo=; b=eikEjdtGXxO+3dhka+zAfy6U2xZTxQ/0wy3f5Vl9AJpXe/2YfRzeGXN05Q9p9uijM1 UFm16w9YtoWvuAJ7Rc/iQuQJpQ0f/3ARXD2q8jfzjDHqMxF4Kiz/WesW9d8UlimWDqv5 Usf9l3RUiwicVfDScL/525/Z73vX6/UDGkvovw8FzSjlepV1GcufL1+95l92b6rhO+TR E8O1FrhwjiTnjfBlcc9VB18ZXaLU6bOC/1XG7rNsAT/oXAMYT2zmcpyUK3/MEisbtWUj CFf4UQcNJFdv/r+n3Q1Xao0gDI4aKwSEaiE+6iT1EN+/nRewzacjdTuFuOy6mZbnweTw qHvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=stBKByQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a7-20020a637f07000000b0053f32b910c1si10142955pgd.700.2023.06.15.16.48.21; Thu, 15 Jun 2023 16:48:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxonhyperv.com header.s=default header.b=stBKByQK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxonhyperv.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238150AbjFOX2d (ORCPT + 99 others); Thu, 15 Jun 2023 19:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239978AbjFOX23 (ORCPT ); Thu, 15 Jun 2023 19:28:29 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B26392D57; Thu, 15 Jun 2023 16:28:02 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1004) id CFA5B20FEB80; Thu, 15 Jun 2023 16:28:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CFA5B20FEB80 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1686871681; bh=y5V7yYuG8e/yBxteubjXicX8w1FBL0ThXqAOOQJhXdo=; h=From:To:Cc:Subject:Date:From; b=stBKByQKzI7m1IOjy7UOte9NtqAsQw8X/9BlGGKRqWUrmNT1ZSKuLJ9p/BJg1bM+u V5C+XxZgkJCn/ZxEjfBMWsN+dQ0x2O4bL7+9G7KDE7LdBG5sXSuRcDD8jS0wxL3fMn KuuCL9G9EV8bUR4NuI65/AdC4J5fayC1KWKp90QU= From: longli@linuxonhyperv.com To: "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Leon Romanovsky , Shradha Gupta , Ajay Sharma , Shachar Raindel , Stephen Hemminger , linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-rdma@vger.kernel.org, Long Li , stable@vger.kernel.org Subject: [PATCH] net: mana: Batch ringing RX queue doorbell on receiving packets Date: Thu, 15 Jun 2023 16:27:51 -0700 Message-Id: <1686871671-31110-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768814453060948946?= X-GMAIL-MSGID: =?utf-8?q?1768814453060948946?= From: Long Li It's inefficient to ring the doorbell page every time a WQE is posted to the received queue. Move the code for ringing doorbell page to where after we have posted all WQEs to the receive queue during a callback from napi_poll(). Tests showed no regression in network latency benchmarks. Cc: stable@vger.kernel.org Fixes: ca9c54d2d6a5 ("net: mana: Add a driver for Microsoft Azure Network Adapter (MANA)") Signed-off-by: Long Li Reviewed-by: Haiyang Zhang --- drivers/net/ethernet/microsoft/mana/mana_en.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c index cd4d5ceb9f2d..ef1f0ce8e44d 100644 --- a/drivers/net/ethernet/microsoft/mana/mana_en.c +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c @@ -1383,8 +1383,8 @@ static void mana_post_pkt_rxq(struct mana_rxq *rxq) recv_buf_oob = &rxq->rx_oobs[curr_index]; - err = mana_gd_post_and_ring(rxq->gdma_rq, &recv_buf_oob->wqe_req, - &recv_buf_oob->wqe_inf); + err = mana_gd_post_work_request(rxq->gdma_rq, &recv_buf_oob->wqe_req, + &recv_buf_oob->wqe_inf); if (WARN_ON_ONCE(err)) return; @@ -1654,6 +1654,12 @@ static void mana_poll_rx_cq(struct mana_cq *cq) mana_process_rx_cqe(rxq, cq, &comp[i]); } + if (comp_read) { + struct gdma_context *gc = rxq->gdma_rq->gdma_dev->gdma_context; + + mana_gd_wq_ring_doorbell(gc, rxq->gdma_rq); + } + if (rxq->xdp_flush) xdp_do_flush(); }