From patchwork Fri Aug 30 20:52:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lance Richardson X-Patchwork-Id: 58327 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 419C91EA7D; Fri, 30 Aug 2019 22:53:11 +0200 (CEST) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by dpdk.org (Postfix) with ESMTP id C1CF81EA4A for ; Fri, 30 Aug 2019 22:53:05 +0200 (CEST) Received: by mail-pf1-f195.google.com with SMTP id w26so5354287pfq.12 for ; Fri, 30 Aug 2019 13:53:05 -0700 (PDT) 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=85x7vnVNVUNvGglsLikIjABTc6BmhWB8Z2Btc4WadC0=; b=I/X/O14O/W8dcdpIoQjKjvrYsl0O6l5HPgitm8naMVhiVDcv+L4ECwb6/8JmJymKEO BYLGk02geiYfNNQjP7zFp5gkuDSWRKF+mDmyBibYiGrkGDIHsE9iIunUj9UX4V6TWWEF aDap0DRvP6J0L5IO0sj6QibyI/Z6HVRIQ+9Gg= 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=85x7vnVNVUNvGglsLikIjABTc6BmhWB8Z2Btc4WadC0=; b=HPlhWROj5ERrgqNbj8lv2QNoj71ojVMXmKlotTktIiUSc3ZdxrFwExyYO0rc2ryiRM wl4Ioki6pXtgcHwODhJMzyQ9VaAgzsMnbpO5lMiN3CfZOXs0PSNnwOF9mlWMnysWzK1E 2CaLmWTxn7682WtuYY3xKT3m+kZjRPPH+uV7rHrpDYqOuJorFsw60VWa5uqWZ01tsfzR pSbWYmM6/Pn7d3az432Sj1VXmPdmcoXrRYTn/mIgn0BfTH33Aa2xAYsBASUTmekpKx7t k27foTX8ql8M0xpO0ksiWAt4//JSC1P+nZ274sn9BYo+uygsCPYQJMsGCyHC1FhPIhph r+ew== X-Gm-Message-State: APjAAAXaKn1P8jh1sEu8ODK5WOK2MR7oZx6/9hCWS6zzW9WNHhZZLsU1 8xbVSY4F4OZDT6GJr/BkPJOg1yd6dNHQneMhbf7o4MWnJEfUoUMTK+eYQ07fOS4NqemXyvUN0GS 7FWFda4otXMjB3GFy6SdeZ0D0/KGL9tgmjLub7LNFT8+JeZwt8a39AlkufeMGsAqH X-Google-Smtp-Source: APXvYqxI+4ZCFZSp0woNbbsygoPHlfLFquvP+VLSkYkKmzvnYBfLuGRkEh7ijKeHpqNODH6Q8ArcUg== X-Received: by 2002:a62:ac0d:: with SMTP id v13mr19931081pfe.129.1567198384856; Fri, 30 Aug 2019 13:53:04 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id i14sm3761369pfo.158.2019.08.30.13.53.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2019 13:53:04 -0700 (PDT) From: Lance Richardson To: dev@dpdk.org Cc: ajit.khaparde@broadcom.com, ferruh.yigit@intel.com, Lance Richardson Date: Fri, 30 Aug 2019 16:52:01 -0400 Message-Id: <20190830205201.26644-8-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190830205201.26644-1-lance.richardson@broadcom.com> References: <20190830205201.26644-1-lance.richardson@broadcom.com> Subject: [dpdk-dev] [PATCH 7/7] net/bnxt: improve CPR handling in vector PMD X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Reduce overhead of CPR descriptor validity checking in vector receive and transmit functions. Preserve raw cpr consumer index in vector transmit completion function. Remove an unneeded prefetch (per benchmarking) from vector transmit completion function. Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode") Signed-off-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 2e6e83c94..980fddb1f 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -245,10 +245,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, if (!CMP_VALID(rxcmp, raw_cons, cpr->cp_ring_struct)) break; - cpr->valid = FLIP_VALID(cons, - cpr->cp_ring_struct->ring_mask, - cpr->valid); - if (likely(CMP_TYPE(rxcmp) == RX_PKT_CMPL_TYPE_RX_L2)) { struct rx_pkt_cmpl_hi *rxcmp1; uint32_t tmp_raw_cons; @@ -272,10 +268,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, rte_prefetch0(mbuf); rxr->rx_buf_ring[cons].mbuf = NULL; - cpr->valid = FLIP_VALID(cp_cons, - cpr->cp_ring_struct->ring_mask, - cpr->valid); - /* Set constant fields from mbuf initializer. */ _mm_store_si128((__m128i *)&mbuf->rearm_data, mbuf_init); @@ -318,22 +310,13 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, rxq->rxrearm_nb += nb_rx_pkts; cpr->cp_raw_cons = raw_cons; + cpr->valid = !!(cpr->cp_raw_cons & cpr->cp_ring_struct->ring_size); if (nb_rx_pkts || evt) bnxt_db_cq(cpr); return nb_rx_pkts; } -static inline void bnxt_next_cmpl(struct bnxt_cp_ring_info *cpr, uint32_t *idx, - bool *v, uint32_t inc) -{ - *idx += inc; - if (unlikely(*idx == cpr->cp_ring_struct->ring_size)) { - *v = !*v; - *idx = 0; - } -} - static void bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts) { @@ -379,10 +362,8 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) cons = RING_CMPL(ring_mask, raw_cons); txcmp = (struct tx_cmpl *)&cp_desc_ring[cons]; - if (!CMPL_VALID(txcmp, cpr->valid)) + if (!CMP_VALID(txcmp, raw_cons, cp_ring_struct)) break; - bnxt_next_cmpl(cpr, &cons, &cpr->valid, 1); - rte_prefetch0(&cp_desc_ring[cons]); if (likely(CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)) nb_tx_pkts += txcmp->opaque; @@ -390,9 +371,10 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) RTE_LOG_DP(ERR, PMD, "Unhandled CMP type %02x\n", CMP_TYPE(txcmp)); - raw_cons = cons; + raw_cons = NEXT_RAW_CMP(raw_cons); } while (nb_tx_pkts < ring_mask); + cpr->valid = !!(raw_cons & cp_ring_struct->ring_size); if (nb_tx_pkts) { bnxt_tx_cmp_vec(txq, nb_tx_pkts); cpr->cp_raw_cons = raw_cons;