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)); From patchwork Mon Nov 15 18:24:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Richardson X-Patchwork-Id: 104343 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 F2D1AA0032; Mon, 15 Nov 2021 19:24:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3861D4117E; Mon, 15 Nov 2021 19:24:21 +0100 (CET) Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by mails.dpdk.org (Postfix) with ESMTP id 8D2A24117D for ; Mon, 15 Nov 2021 19:24:20 +0100 (CET) Received: by mail-pg1-f170.google.com with SMTP id m15so11409987pgu.11 for ; Mon, 15 Nov 2021 10:24:20 -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=4z78BEUHprTIJauQLdIJQtGM1CwYvEfzSt4dC6O3sBk=; b=bwT3CYRxRhym4XIOKwC573OE2QnQyTuO79CoYSK+G6F9o1uTYSe3T4cemdRwwEBXzY Yh2pCzppwKOD89kSmV4onYcBsyiRM9Vg4Dp1RK1nHfSD8hnY9we5kcDeR3T+I0Rn64ff Ozudrn3m3Pag3+nes1wA9LuLNIovDk9DU8+48= 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=4z78BEUHprTIJauQLdIJQtGM1CwYvEfzSt4dC6O3sBk=; b=h2cXoAo+jY0plbOg+jIy3po6Du+sf5ugFopNv/3tKpDue7rQRngfq7jwjT6wxttIoG GVyyqHOc/8lcQ2lIB+Qveav0CftXblHqGH3CGIwNDRBaL+9/eZuJWk+LUpUDyLOSMjN0 TEG4rJY4t6avl1LmNyhx7+cc1BXCY4zEjy9AfQJtss4V1JyXM3hgwET3z7ZvMifIgjQ+ ZLjSrJnQuRzS7wfCLhrTJCWnTDMotAu3kYGjl65SImrWz1jFrzYEQIVARg4G4jlrH/B7 efL4ZRHMxun9kZFgqOrvSjMh9S8B+WrDztMEjcupYbx0lxF+sAbP82MHBGpuMOUCj2Vy Tmww== X-Gm-Message-State: AOAM5321pmf5tgmyG7WfmfR5vnoVrOteD4QG3WW8mUYndPxbBSebj2lj /llm0TCzat5UenZ4AbcyZR4Brkj44IbbQQ== X-Google-Smtp-Source: ABdhPJyZUach79fosLsgwCHRDrtlE/inBzLgH1+SyUUhN2zniOrS8LryTHdKLID0ulzBYhp6QVDvYA== X-Received: by 2002:a05:6a00:2496:b0:49f:eba0:6575 with SMTP id c22-20020a056a00249600b0049feba06575mr34863006pfv.78.1637000659734; Mon, 15 Nov 2021 10:24:19 -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.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 10:24:19 -0800 (PST) From: Lance Richardson To: Bruce Richardson , Konstantin Ananyev , Ajit Khaparde , Somnath Kotur Cc: dev@dpdk.org, stable@dpdk.org Subject: [PATCH 2/2] net/bnxt: remove software prefetches from AVX2 Rx path Date: Mon, 15 Nov 2021 13:24:10 -0500 Message-Id: <20211115182410.5545-3-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 Testing has shown no performance benefit from software prefetching of receive completion descriptors in the AVX2 burst receive path, and slightly better performance without them on some CPU families, so this patch removes them. 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 | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c index 54e3af22ac..34bd22edf0 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_avx2.c @@ -92,12 +92,6 @@ recv_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) cons = raw_cons & (cp_ring_size - 1); mbcons = (raw_cons / 2) & (rx_ring_size - 1); - /* Prefetch first four descriptor pairs. */ - rte_prefetch0(&cp_desc_ring[cons + 0]); - rte_prefetch0(&cp_desc_ring[cons + 4]); - 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; @@ -136,14 +130,6 @@ recv_burst_vec_avx2(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) _mm256_storeu_si256((void *)&rx_pkts[i + 4], t0); #endif - /* Prefetch eight descriptor pairs for next iteration. */ - if (i + BNXT_RX_DESCS_PER_LOOP_VEC256 < nb_pkts) { - rte_prefetch0(&cp_desc_ring[cons + 16]); - rte_prefetch0(&cp_desc_ring[cons + 20]); - rte_prefetch0(&cp_desc_ring[cons + 24]); - rte_prefetch0(&cp_desc_ring[cons + 28]); - } - /* * Load eight receive completion descriptors into 256-bit * registers. Loads are issued in reverse order in order to