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 9F4F8A04BC; Fri, 9 Oct 2020 21:49:39 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B9DCB1D454; Fri, 9 Oct 2020 21:49:37 +0200 (CEST) Received: from mail-oo1-f66.google.com (mail-oo1-f66.google.com [209.85.161.66]) by dpdk.org (Postfix) with ESMTP id 624291D445 for ; Fri, 9 Oct 2020 21:49:36 +0200 (CEST) Received: by mail-oo1-f66.google.com with SMTP id w7so2639356oow.7 for ; Fri, 09 Oct 2020 12:49:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=npNHBML43tUfy6Y+kgovTdcVvtAofi4x0uCkT0BfQVQ=; b=Fgy71Hjq5/bvRscXvnG2qXXdHM+K2VdjVsYeRJunb2+ndamEbfPE3Z0chbdtplRX3R GFn/fRhnkyu3kwDd5pNoj6hMwhEoAa3itfdLOhu6Yzsa7AQVPYgAv8/zj8S5dectz/eO xv5vGEb1afeziTCPg2NB0WhXUqV9GptdazTz8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=npNHBML43tUfy6Y+kgovTdcVvtAofi4x0uCkT0BfQVQ=; b=RlQiHNeCOzw0F/SjqKhcvplFmFLjn4i00Q3HNLinhBRKhl/Y8+CkOSKh5RgR3uCyti 0fALIx20aUCzjPxA1lo253ob70jDewG8KxZrb5IIGxWOtxmtg2npLSn+OJmUAtSx+FRm oLyN35J/ouNyodneM9ywCHsIxKZSOyfgsxMm5Jqg1bcipiSXV+uA4Y+3pbSUuTC9ouT2 ULzUlfUytvF7PTKQkNRbZsfaHbdMjqaxCQQVwxIqLXIxHFQ2N2c+sXnu6/t6+LrKzh7c Aa/VUs4/6omuBoq5fVLA9jJmEVsjuoBeLCwJ/SG9MDSTy0+jmbDWuoKoc1mZiYvru+6c PYfw== X-Gm-Message-State: AOAM532iStAFPuam1/S6Bsv/LfL4PVzBYEdEgeZgZtob1NAAOZucaIc8 KIp1nZ9o/2iQ/wSG1oU0peU5K5IG9ICqgCGCLMn4yA== X-Google-Smtp-Source: ABdhPJxIuXprkvO1FwxWGJ4q87arRjNbmHmE96Bxq7MOsKElJh0HEzcNAc5adUCyAznWfZfHLcxzZPwRrEkFb+Z4qrA= X-Received: by 2002:a4a:9e87:: with SMTP id u7mr10558019ook.15.1602272974383; Fri, 09 Oct 2020 12:49:34 -0700 (PDT) MIME-Version: 1.0 References: <20201009163642.126939-1-lance.richardson@broadcom.com> In-Reply-To: <20201009163642.126939-1-lance.richardson@broadcom.com> From: Ajit Khaparde Date: Fri, 9 Oct 2020 12:49:18 -0700 Message-ID: To: Lance Richardson Cc: Somnath Kotur , dpdk-dev Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH] net/bnxt: fix non-vector fast mbuf free offload 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" On Fri, Oct 9, 2020 at 9:36 AM Lance Richardson wrote: > > The fast mbuf free offload for non-vector mode requires > additional checks in order to handle long tx buffer > descriptors, so dedicated functions are needed for > vector- and non-vector-modes. > > Fixes: 103169df2880 ("net/bnxt: support fast mbuf free") > Signed-off-by: Lance Richardson > Reviewed-by: Ajit Kumar Khaparde Patch applied to dpdk-next-net-brcm/for-next-net with updated the commit id. > --- > drivers/net/bnxt/bnxt_rxtx_vec_common.h | 27 ++++++++++++++++++++ > drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 2 +- > drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 2 +- > drivers/net/bnxt/bnxt_txr.c | 34 +++++++++++++++++++++++++ > drivers/net/bnxt/bnxt_txr.h | 27 -------------------- > 5 files changed, 63 insertions(+), 29 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_common.h b/drivers/net/bnxt/bnxt_rxtx_vec_common.h > index 33ac53568..d540e9eee 100644 > --- a/drivers/net/bnxt/bnxt_rxtx_vec_common.h > +++ b/drivers/net/bnxt/bnxt_rxtx_vec_common.h > @@ -95,6 +95,33 @@ bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr) > rxq->rxrearm_nb -= nb; > } > > +/* > + * Transmit completion function for use when DEV_TX_OFFLOAD_MBUF_FAST_FREE > + * is enabled. > + */ > +static inline void > +bnxt_tx_cmp_vec_fast(struct bnxt_tx_queue *txq, int nr_pkts) > +{ > + struct bnxt_tx_ring_info *txr = txq->tx_ring; > + uint32_t ring_mask = txr->tx_ring_struct->ring_mask; > + struct rte_mbuf **free = txq->free; > + uint16_t cons = txr->tx_cons; > + unsigned int blk = 0; > + > + while (nr_pkts--) { > + struct bnxt_sw_tx_bd *tx_buf; > + > + tx_buf = &txr->tx_buf_ring[cons]; > + cons = (cons + 1) & ring_mask; > + free[blk++] = tx_buf->mbuf; > + tx_buf->mbuf = NULL; > + } > + if (blk) > + rte_mempool_put_bulk(free[0]->pool, (void **)free, blk); > + > + txr->tx_cons = cons; > +} > + > static inline void > bnxt_tx_cmp_vec(struct bnxt_tx_queue *txq, int nr_pkts) > { > diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c > index 4c04cc43a..f49e29ccb 100644 > --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c > +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c > @@ -369,7 +369,7 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) > cpr->valid = !!(raw_cons & cp_ring_struct->ring_size); > if (nb_tx_pkts) { > if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) > - bnxt_tx_cmp_fast(txq, nb_tx_pkts); > + bnxt_tx_cmp_vec_fast(txq, nb_tx_pkts); > else > bnxt_tx_cmp_vec(txq, nb_tx_pkts); > cpr->cp_raw_cons = raw_cons; > diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c > index f71f46985..e4ba63551 100644 > --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c > +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c > @@ -340,7 +340,7 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) > cpr->valid = !!(raw_cons & cp_ring_struct->ring_size); > if (nb_tx_pkts) { > if (txq->offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE) > - bnxt_tx_cmp_fast(txq, nb_tx_pkts); > + bnxt_tx_cmp_vec_fast(txq, nb_tx_pkts); > else > bnxt_tx_cmp_vec(txq, nb_tx_pkts); > cpr->cp_raw_cons = raw_cons; > diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c > index 125ac8341..fb358d6f1 100644 > --- a/drivers/net/bnxt/bnxt_txr.c > +++ b/drivers/net/bnxt/bnxt_txr.c > @@ -337,6 +337,40 @@ static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, > return 0; > } > > +/* > + * Transmit completion function for use when DEV_TX_OFFLOAD_MBUF_FAST_FREE > + * is enabled. > + */ > +static void bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts) > +{ > + struct bnxt_tx_ring_info *txr = txq->tx_ring; > + struct rte_mbuf **free = txq->free; > + uint16_t cons = txr->tx_cons; > + unsigned int blk = 0; > + int i, j; > + > + for (i = 0; i < nr_pkts; i++) { > + struct bnxt_sw_tx_bd *tx_buf; > + unsigned short nr_bds; > + > + tx_buf = &txr->tx_buf_ring[cons]; > + nr_bds = tx_buf->nr_bds; > + for (j = 0; j < nr_bds; j++) { > + if (tx_buf->mbuf) { > + /* Add mbuf to the bulk free array */ > + free[blk++] = tx_buf->mbuf; > + tx_buf->mbuf = NULL; > + } > + cons = RING_NEXT(txr->tx_ring_struct, cons); > + tx_buf = &txr->tx_buf_ring[cons]; > + } > + } > + if (blk) > + rte_mempool_put_bulk(free[0]->pool, (void *)free, blk); > + > + txr->tx_cons = cons; > +} > + > static void bnxt_tx_cmp(struct bnxt_tx_queue *txq, int nr_pkts) > { > struct bnxt_tx_ring_info *txr = txq->tx_ring; > diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h > index c0b1fde22..d241227d4 100644 > --- a/drivers/net/bnxt/bnxt_txr.h > +++ b/drivers/net/bnxt/bnxt_txr.h > @@ -44,33 +44,6 @@ static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq) > bnxt_tx_bds_in_hw(txq)) - 1); > } > > -/* > - * Transmit completion function for use when DEV_TX_OFFLOAD_MBUF_FAST_FREE > - * is enabled. > - */ > -static inline void > -bnxt_tx_cmp_fast(struct bnxt_tx_queue *txq, int nr_pkts) > -{ > - struct bnxt_tx_ring_info *txr = txq->tx_ring; > - uint32_t ring_mask = txr->tx_ring_struct->ring_mask; > - struct rte_mbuf **free = txq->free; > - uint16_t cons = txr->tx_cons; > - unsigned int blk = 0; > - > - while (nr_pkts--) { > - struct bnxt_sw_tx_bd *tx_buf; > - > - tx_buf = &txr->tx_buf_ring[cons]; > - cons = (cons + 1) & ring_mask; > - free[blk++] = tx_buf->mbuf; > - tx_buf->mbuf = NULL; > - } > - if (blk) > - rte_mempool_put_bulk(free[0]->pool, (void **)free, blk); > - > - txr->tx_cons = cons; > -} > - > void bnxt_free_tx_rings(struct bnxt *bp); > int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); > int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id); > -- > 2.25.1 >