DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>, <dev@dpdk.org>
Cc: "Reshma Pattan" <reshma.pattan@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] pdump: use rte_pktmbuf_free bulk
Date: Tue, 29 Dec 2020 06:40:32 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35C6150C@smartserver.smartshare.dk> (raw)
In-Reply-To: <20201227033335.85145-2-stephen@networkplumber.org>

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Sunday, December 27, 2020 4:34 AM
> 
> Use rte_pktmbuf_free_bulk instead of loop when freeing
> packets.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  app/pdump/main.c             | 8 ++++----
>  lib/librte_pdump/rte_pdump.c | 6 +++---
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/app/pdump/main.c b/app/pdump/main.c
> index b34bf335317b..f986c7e9d67e 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -477,10 +477,10 @@ pdump_rxtx(struct rte_ring *ring, uint16_t
> vdev_id, struct pdump_stats *stats)
>  		stats->tx_pkts += nb_in_txd;
> 
>  		if (unlikely(nb_in_txd < nb_in_deq)) {
> -			do {
> -				rte_pktmbuf_free(rxtx_bufs[nb_in_txd]);
> -				stats->freed_pkts++;
> -			} while (++nb_in_txd < nb_in_deq);
> +			unsigned int drops = nb_in_deq - nb_in_txd;
> +
> +			rte_pktmbuf_free_bulk(&rxtx_bufs[nb_in_txd], drops);
> +			stats->freed_pkts += drops;;

One semicolon should be enough.

And shouldn't checkpatch find typos like this?

>  		}
>  	}
>  }
> diff --git a/lib/librte_pdump/rte_pdump.c
> b/lib/librte_pdump/rte_pdump.c
> index b3c8d5ce4384..3c11bd795bc1 100644
> --- a/lib/librte_pdump/rte_pdump.c
> +++ b/lib/librte_pdump/rte_pdump.c
> @@ -93,11 +93,11 @@ pdump_copy(struct rte_mbuf **pkts, uint16_t
> nb_pkts, void *user_params)
> 
>  	ring_enq = rte_ring_enqueue_burst(ring, (void *)dup_bufs, d_pkts,
> NULL);
>  	if (unlikely(ring_enq < d_pkts)) {
> +		unsigned int drops = d_pkts - ring_enq;
> +
>  		PDUMP_LOG(DEBUG,
>  			"only %d of packets enqueued to ring\n", ring_enq);
> -		do {
> -			rte_pktmbuf_free(dup_bufs[ring_enq]);
> -		} while (++ring_enq < d_pkts);
> +		rte_pktmbuf_free_bulk(&dup_bufs[ring_enq], drops);
>  	}
>  }
> 
> --
> 2.29.2
> 

Acked-by: Morten Brørup <mb@smartsharesystems.com>


  reply	other threads:[~2020-12-29  5:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-27  3:33 [dpdk-dev] [PATCH 0/2] pdump: small enhancements Stephen Hemminger
2020-12-27  3:33 ` [dpdk-dev] [PATCH 1/2] pdump: use rte_pktmbuf_free bulk Stephen Hemminger
2020-12-29  5:40   ` Morten Brørup [this message]
2020-12-27  3:33 ` [dpdk-dev] [PATCH 2/2] pdump: replace DEVICE_ID_SIZE with RTE_DEV_NAME_MAX_LEN Stephen Hemminger
2020-12-29 20:08 ` [dpdk-dev] [PATCH v2 0/3] pdump: small enhancements Stephen Hemminger
2020-12-29 20:08   ` [dpdk-dev] [PATCH v2 1/3] pdump: use rte_pktmbuf_free bulk Stephen Hemminger
2020-12-29 20:09   ` [dpdk-dev] [PATCH v2 2/3] pdump: replace DEVICE_ID_SIZE with RTE_DEV_NAME_MAX_LEN Stephen Hemminger
2020-12-29 20:09   ` [dpdk-dev] [PATCH v2 3/3] pdump: cleanup checkpatch warnings Stephen Hemminger
2021-01-19 14:25   ` [dpdk-dev] [PATCH v2 0/3] pdump: small enhancements Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98CBD80474FA8B44BF855DF32C47DC35C6150C@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=dev@dpdk.org \
    --cc=reshma.pattan@intel.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).