From patchwork Mon Nov 15 18:24:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Richardson X-Patchwork-Id: 104342 X-Patchwork-Delegate: ajit.khaparde@broadcom.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D41FDA0032; Mon, 15 Nov 2021 19:24:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B482041152; Mon, 15 Nov 2021 19:24:18 +0100 (CET) Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by mails.dpdk.org (Postfix) with ESMTP id C0A004114F for ; Mon, 15 Nov 2021 19:24:17 +0100 (CET) Received: by mail-pf1-f178.google.com with SMTP id m14so15754981pfc.9 for ; Mon, 15 Nov 2021 10:24:17 -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 :mime-version; bh=v6QfqQD6OmCHVD7l1hFU2CJbXmJfj33POfFv8M0pdvE=; b=ZfTK5drSI7ZRCqQ7K6oNX1W/XLEBB3/Wenk8xLHBBEHb83q1WEtXsl4xjjol5QsIke cWzRUJ4rLn+SzZ1QgITJWjN3xOfHcNXeps+LYrFdj5Xad4nfFNHjre6SCbgEyzpngk2f cNs5Ij8qQa7S/2x1XTXIhuMnDO3DYfwxdCOYQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version; bh=v6QfqQD6OmCHVD7l1hFU2CJbXmJfj33POfFv8M0pdvE=; b=glhUSxtgqBiqWizRYu4n0hvAqiuDmlHIk6YQF6H88MivzWMDHG+Tvp94KaCShEjRoj wwAzKK59NoXfc903LZ76O1lskiOw+qydLSgR4kliFKFSECumZvhVMVtAlyLGqYIRvJ/8 64pPZ/hJTTC/Uyygs+5Aw2Mmev4GS4kWOJSLQzYkGfrBzKwkBC9ndTb+tIJnKOAfppkl RkVF0JCFci0quTGQ+DwOs/avaVEG2orjiC9ga3hyEeoXkZlg9RaA7TacSWjj6Vw7qRy8 vSmzvgNZkuMWSmQyXVYSqVaJbpKYjNnXDgyDqgcU3NGSVdt4ZS4hskfzkAD/kjGcfKxE 2EXA== X-Gm-Message-State: AOAM532K2yvYF6y0YMAkZVpmPXDF1Mw6K7WSS6wvnF6juRPE2ZRBwIbA cPSQN4zexBN8RFwNI2L4yV6Arg== X-Google-Smtp-Source: ABdhPJx0sGVtDD80cDhtuJPVMKxLhsAcjeaX82cu+0ZebtazsfhlcYHIXxl77GzDhHDZKdrFyg4B/w== X-Received: by 2002:a63:d00c:: with SMTP id z12mr615839pgf.334.1637000657006; Mon, 15 Nov 2021 10:24:17 -0800 (PST) Received: from lrichardson-VirtualBox.dhcp.broadcom.net ([192.19.11.250]) by smtp.gmail.com with ESMTPSA id w7sm12419785pgo.56.2021.11.15.10.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 10:24:16 -0800 (PST) From: Lance Richardson To: Bruce Richardson , Konstantin Ananyev , Ajit Khaparde , Somnath Kotur Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH 1/2] net/bnxt: avoid unnecessary work in AVX2 Rx path Date: Mon, 15 Nov 2021 13:24:09 -0500 Message-Id: <20211115182410.5545-2-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211115182410.5545-1-lance.richardson@broadcom.com> References: <20211115182410.5545-1-lance.richardson@broadcom.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Each call to the AVX2 vector burst receive function makes at least one pass through the function's inner loop, loading 256 bytes of completion descriptors and copying 8 rte_mbuf pointers regardless of whether there are any packets to be received. Unidirectional forwarding performance is improved by about 3-4% if we ensure that at least one packet can be received before entering the inner loop. Fixes: c4e4c18963b0 ("net/bnxt: add AVX2 RX/Tx") Cc: stable@dpdk.org Signed-off-by: Lance Richardson --- drivers/net/bnxt/bnxt_rxtx_vec_avx2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c index e4905b4fd1..54e3af22ac 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c @@ -98,6 +98,10 @@ recv_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rte_prefetch0(&cp_desc_ring[cons + 8]); rte_prefetch0(&cp_desc_ring[cons + 12]); + /* Return immediately if there is not at least one completed packet. */ + if (!bnxt_cpr_cmp_valid(&cp_desc_ring[cons], raw_cons, cp_ring_size)) + return 0; + /* Ensure that we do not go past the ends of the rings. */ nb_pkts = RTE_MIN(nb_pkts, RTE_MIN(rx_ring_size - mbcons, (cp_ring_size - cons) / 2));