From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5812A2F63 for ; Fri, 4 Oct 2019 05:54:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 943191C1D3; Fri, 4 Oct 2019 05:49:29 +0200 (CEST) Received: from rnd-relay.smtp.broadcom.com (unknown [192.19.229.170]) by dpdk.org (Postfix) with ESMTP id 7959A1C121 for ; Fri, 4 Oct 2019 05:49:13 +0200 (CEST) Received: from mail-irv-17.broadcom.com (mail-irv-17.lvn.broadcom.net [10.75.242.48]) by rnd-relay.smtp.broadcom.com (Postfix) with ESMTP id 0EB3C30C2B5; Thu, 3 Oct 2019 20:47:54 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 rnd-relay.smtp.broadcom.com 0EB3C30C2B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1570160874; bh=ys+goBf7lkWI66Au+Y3mvsHtyKF24a5i/MAhYVj3zwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VZpGQ6s1lQEkvzDPLM4/7bcBaE/8vP28abn2EKoU0cbWaxmWTBZ7eMFGIGG2sMOat rNQ6pUr/ecBkbvYuyEzp+dYygOzhGR5QV6WdHyWBYUHQblxrR/zIzRsZVu9QO+dr1y OKA/k2LOHC8lD824of0S2mpX6qCR+eCKiZFdtnvg= Received: from localhost.localdomain (unknown [10.230.30.225]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 8A819140069; Thu, 3 Oct 2019 20:49:09 -0700 (PDT) From: Ajit Khaparde To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Lance Richardson , Ajit Kumar Khaparde Date: Thu, 3 Oct 2019 20:49:03 -0700 Message-Id: <20191004034903.85233-10-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20191004034903.85233-1-ajit.khaparde@broadcom.com> References: <20191004034903.85233-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 9/9] 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" From: Lance Richardson 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 029053e305..22d9f9e84a 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; -- 2.20.1 (Apple Git-117)