ethdev: use rte_pktmbuf_free_bulk()

Message ID 20200930212718.19276-1-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series ethdev: use rte_pktmbuf_free_bulk() |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Stephen Hemminger Sept. 30, 2020, 9:27 p.m. UTC
  The mbuf library now has routine to free multiple buffers.
Loop is no longer needed.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/librte_ethdev/rte_ethdev.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Comments

Andrew Rybchenko Oct. 1, 2020, 11:14 a.m. UTC | #1
On 10/1/20 12:27 AM, Stephen Hemminger wrote:
> The mbuf library now has routine to free multiple buffers.
> Loop is no longer needed.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>

Thanks, Stephen

Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
  
Ferruh Yigit Oct. 1, 2020, 1:02 p.m. UTC | #2
On 10/1/2020 12:14 PM, Andrew Rybchenko wrote:
> On 10/1/20 12:27 AM, Stephen Hemminger wrote:
>> The mbuf library now has routine to free multiple buffers.
>> Loop is no longer needed.
>>
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> Thanks, Stephen
> 
> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
> 

Applied to dpdk-next-net/main, thanks.
  
Morten Brørup Oct. 7, 2020, 7:30 a.m. UTC | #3
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Wednesday, September 30, 2020 11:27 PM
> 
> The mbuf library now has routine to free multiple buffers.
> Loop is no longer needed.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  lib/librte_ethdev/rte_ethdev.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c
> b/lib/librte_ethdev/rte_ethdev.c
> index dfe5c1b488a0..307fbeb3a798 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -2179,10 +2179,7 @@ void
>  rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t
> unsent,
>  		void *userdata __rte_unused)
>  {
> -	unsigned i;
> -
> -	for (i = 0; i < unsent; i++)
> -		rte_pktmbuf_free(pkts[i]);
> +	rte_pktmbuf_free_bulk(pkts, unsent);
>  }
> 
>  void
> @@ -2190,11 +2187,8 @@ rte_eth_tx_buffer_count_callback(struct rte_mbuf
> **pkts, uint16_t unsent,
>  		void *userdata)
>  {
>  	uint64_t *count = userdata;
> -	unsigned i;
> -
> -	for (i = 0; i < unsent; i++)
> -		rte_pktmbuf_free(pkts[i]);
> 
> +	rte_pktmbuf_free_bulk(pkts, unsent);
>  	*count += unsent;
>  }
> 
> --
> 2.27.0
> 

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

Patch

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index dfe5c1b488a0..307fbeb3a798 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -2179,10 +2179,7 @@  void
 rte_eth_tx_buffer_drop_callback(struct rte_mbuf **pkts, uint16_t unsent,
 		void *userdata __rte_unused)
 {
-	unsigned i;
-
-	for (i = 0; i < unsent; i++)
-		rte_pktmbuf_free(pkts[i]);
+	rte_pktmbuf_free_bulk(pkts, unsent);
 }
 
 void
@@ -2190,11 +2187,8 @@  rte_eth_tx_buffer_count_callback(struct rte_mbuf **pkts, uint16_t unsent,
 		void *userdata)
 {
 	uint64_t *count = userdata;
-	unsigned i;
-
-	for (i = 0; i < unsent; i++)
-		rte_pktmbuf_free(pkts[i]);
 
+	rte_pktmbuf_free_bulk(pkts, unsent);
 	*count += unsent;
 }