From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8E561A0547; Mon, 24 May 2021 21:00:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EF46641109; Mon, 24 May 2021 21:00:20 +0200 (CEST) Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by mails.dpdk.org (Postfix) with ESMTP id F1823410FE for ; Mon, 24 May 2021 21:00:19 +0200 (CEST) Received: by mail-pl1-f176.google.com with SMTP id b7so10939434plg.0 for ; Mon, 24 May 2021 12:00:19 -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 :mime-version; bh=2T25zHICG7eQeieMi/2cMn7A6yxZPv8YBbpL+DAvDVg=; b=VdG5PoaGsRohR7feD8GkmkIgqbEjmT5X/ehX9nbm19Bh7bQX7DgUtxvQDVRhtL+kVz zeFmFq8IiTMfvWnPITsBCVds2Iqhns+rFFvsMxBUhSfknmFm37xgqbtNlF5evc1EW5gn cECM0sGCsxM+8nPVxkrzo2y+hjOFpoPW8jnCE= 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:mime-version; bh=2T25zHICG7eQeieMi/2cMn7A6yxZPv8YBbpL+DAvDVg=; b=lCKw37oX26xQxG7f5k5RIc3L5A+RK7BELQroz2tq8/m2pcBEE+SD4Q+9kMn7IBiB4a 7+rMEosirGydFCbqGg2hPG/UoGnES+PBy+RJwoLwou17jyeq3/ZgBawajJ2siJy/cAiq 7scGrY4SdC5ee3FVlMND/QGquB35hbTJ6tLhR4sbEbsxm1kHd8TEQN7ff2Nvc3T4cRY1 dH9yYLWbRKmO9t8KgQIbMgm+Se122S+mep+yChlGygg3PY5ZdorbW1kW7dkp383Oy1R0 FuO6d21QuwdT6S3p0s0kYPYehqoR4QSemf54rLvoxg5wcTxlQYNVuRN8cXb5B56eBbJh 4O1A== X-Gm-Message-State: AOAM533DY6IEnHIngWbbuKGE+MxHjoMEnfQJ47AU/3p9N7S160edUO8N hErqYB/5D0BvrTA/uSDB+L7DTA== X-Google-Smtp-Source: ABdhPJzCa7gn5SQBmiPUdKiwW9lFi0k7AxPkoMf2mwcgfZB512v6GvcfyY4AjKBIc8lMRhiYRN6wHQ== X-Received: by 2002:a17:903:31d3:b029:ee:bccd:e686 with SMTP id v19-20020a17090331d3b02900eebccde686mr27151688ple.1.1621882818982; Mon, 24 May 2021 12:00:18 -0700 (PDT) Received: from localhost.localdomain ([192.19.231.250]) by smtp.gmail.com with ESMTPSA id g4sm12239049pgu.46.2021.05.24.12.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 May 2021 12:00:18 -0700 (PDT) From: Lance Richardson To: Jerin Jacob , Ruifeng Wang , Ajit Khaparde , Somnath Kotur , Bruce Richardson , Konstantin Ananyev Cc: dev@dpdk.org, stable@dpdk.org Date: Mon, 24 May 2021 14:59:50 -0400 Message-Id: <20210524185952.673258-3-lance.richardson@broadcom.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210524185952.673258-1-lance.richardson@broadcom.com> References: <20210524185952.673258-1-lance.richardson@broadcom.com> MIME-Version: 1.0 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="000000000000505a7505c31805de" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [dpdk-dev] [PATCH 2/3] net/bnxt: fix Rx burst size constraint 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 Sender: "dev" --000000000000505a7505c31805de Content-Transfer-Encoding: 8bit The burst receive function should return all packets currently present in the receive ring up to the requested burst size, update vector mode receive functions accordingly. Fixes: 398358341419 ("net/bnxt: support NEON") Fixes: bc4a000f2f53 ("net/bnxt: implement SSE vector mode") Cc: stable@dpdk.org Signed-off-by: Lance Richardson Reviewed-by: Ajit Kumar Khaparde --- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 29 +++++++++++++++++++++------ drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 29 +++++++++++++++++++++------ 2 files changed, 46 insertions(+), 12 deletions(-) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c index a6fbc0b0bf..a6e630ea5e 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c @@ -158,9 +158,8 @@ descs_to_mbufs(uint32x4_t mm_rxcmp[4], uint32x4_t mm_rxcmp1[4], vst1q_u32((uint32_t *)&mbuf[3]->rx_descriptor_fields1, tmp); } -uint16_t -bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +static uint16_t +recv_burst_vec_neon(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct bnxt_rx_queue *rxq = rx_queue; struct bnxt_cp_ring_info *cpr = rxq->cp_ring; @@ -185,9 +184,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, if (rxq->rxrearm_nb >= rxq->rx_free_thresh) bnxt_rxq_rearm(rxq, rxr); - /* Return no more than RTE_BNXT_MAX_RX_BURST per call. */ - nb_pkts = RTE_MIN(nb_pkts, RTE_BNXT_MAX_RX_BURST); - cons = raw_cons & (cp_ring_size - 1); mbcons = (raw_cons / 2) & (rx_ring_size - 1); @@ -305,6 +301,27 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, return nb_rx_pkts; } +uint16_t +bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) +{ + uint16_t cnt = 0; + + while (nb_pkts > RTE_BNXT_MAX_RX_BURST) { + uint16_t burst; + + burst = recv_burst_vec_neon(rx_queue, rx_pkts + cnt, + RTE_BNXT_MAX_RX_BURST); + + cnt += burst; + nb_pkts -= burst; + + if (burst < RTE_BNXT_MAX_RX_BURST) + return cnt; + } + + return cnt + recv_burst_vec_neon(rx_queue, rx_pkts + cnt, nb_pkts); +} + static void bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) { diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 6dd18a0077..fe074f82cf 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -149,9 +149,8 @@ descs_to_mbufs(__m128i mm_rxcmp[4], __m128i mm_rxcmp1[4], _mm_store_si128((void *)&mbuf[3]->rx_descriptor_fields1, t0); } -uint16_t -bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts) +static uint16_t +recv_burst_vec_sse(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) { struct bnxt_rx_queue *rxq = rx_queue; const __m128i mbuf_init = _mm_set_epi64x(0, rxq->mbuf_initializer); @@ -176,9 +175,6 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, if (rxq->rxrearm_nb >= rxq->rx_free_thresh) bnxt_rxq_rearm(rxq, rxr); - /* Return no more than RTE_BNXT_MAX_RX_BURST per call. */ - nb_pkts = RTE_MIN(nb_pkts, RTE_BNXT_MAX_RX_BURST); - cons = raw_cons & (cp_ring_size - 1); mbcons = (raw_cons / 2) & (rx_ring_size - 1); @@ -286,6 +282,27 @@ bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, return nb_rx_pkts; } +uint16_t +bnxt_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) +{ + uint16_t cnt = 0; + + while (nb_pkts > RTE_BNXT_MAX_RX_BURST) { + uint16_t burst; + + burst = recv_burst_vec_sse(rx_queue, rx_pkts + cnt, + RTE_BNXT_MAX_RX_BURST); + + cnt += burst; + nb_pkts -= burst; + + if (burst < RTE_BNXT_MAX_RX_BURST) + return cnt; + } + + return cnt + recv_burst_vec_sse(rx_queue, rx_pkts + cnt, nb_pkts); +} + static void bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) { -- 2.25.1 --000000000000505a7505c31805de--