[2/2] examples/ipsec-secgw: update stats when freeing packets

Message ID 20231219052923.196-2-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/2] examples/ipsec-secgw: fix width of variables |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-unit-arm64-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Anoob Joseph Dec. 19, 2023, 5:29 a.m. UTC
  Instead of freeing directly, use commonly used function which also
updates stats.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 examples/ipsec-secgw/ipsec_process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Stephen Hemminger Dec. 19, 2023, 5:18 p.m. UTC | #1
On Tue, 19 Dec 2023 10:59:23 +0530
Anoob Joseph <anoobj@marvell.com> wrote:

> Instead of freeing directly, use commonly used function which also
> updates stats.
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> ---
>  examples/ipsec-secgw/ipsec_process.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c
> index b0cece3ad1..ddbe30745b 100644
> --- a/examples/ipsec-secgw/ipsec_process.c
> +++ b/examples/ipsec-secgw/ipsec_process.c
> @@ -22,7 +22,7 @@ free_cops(struct rte_crypto_op *cop[], uint32_t n)
>  	uint32_t i;
>  
>  	for (i = 0; i != n; i++)
> -		rte_pktmbuf_free(cop[i]->sym->m_src);
> +		free_pkts(&cop[i]->sym->m_src, 1);

Also, free_pkts is using a loop and should be using rte_pktmbuf_free_bulk() instead.
  
Anoob Joseph Dec. 20, 2023, 1:10 p.m. UTC | #2
Hi Stephen,

Please see inline.

Thanks,
Anoob

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: Tuesday, December 19, 2023 10:49 PM
> To: Anoob Joseph <anoobj@marvell.com>
> Cc: Radu Nicolau <radu.nicolau@intel.com>; Akhil Goyal
> <gakhil@marvell.com>; Konstantin Ananyev
> <konstantin.v.ananyev@yandex.ru>; Jerin Jacob Kollanukkaran
> <jerinj@marvell.com>; dev@dpdk.org
> Subject: [EXT] Re: [PATCH 2/2] examples/ipsec-secgw: update stats when
> freeing packets
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Tue, 19 Dec 2023 10:59:23 +0530
> Anoob Joseph <anoobj@marvell.com> wrote:
> 
> > Instead of freeing directly, use commonly used function which also
> > updates stats.
> >
> > Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> > ---
> >  examples/ipsec-secgw/ipsec_process.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/examples/ipsec-secgw/ipsec_process.c
> > b/examples/ipsec-secgw/ipsec_process.c
> > index b0cece3ad1..ddbe30745b 100644
> > --- a/examples/ipsec-secgw/ipsec_process.c
> > +++ b/examples/ipsec-secgw/ipsec_process.c
> > @@ -22,7 +22,7 @@ free_cops(struct rte_crypto_op *cop[], uint32_t n)
> >  	uint32_t i;
> >
> >  	for (i = 0; i != n; i++)
> > -		rte_pktmbuf_free(cop[i]->sym->m_src);
> > +		free_pkts(&cop[i]->sym->m_src, 1);
> 
> Also, free_pkts is using a loop and should be using rte_pktmbuf_free_bulk()
> instead.

[Anoob] Indeed. Will push a separate patch for addressing the same. Thanks for pointing out.
  

Patch

diff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c
index b0cece3ad1..ddbe30745b 100644
--- a/examples/ipsec-secgw/ipsec_process.c
+++ b/examples/ipsec-secgw/ipsec_process.c
@@ -22,7 +22,7 @@  free_cops(struct rte_crypto_op *cop[], uint32_t n)
 	uint32_t i;
 
 	for (i = 0; i != n; i++)
-		rte_pktmbuf_free(cop[i]->sym->m_src);
+		free_pkts(&cop[i]->sym->m_src, 1);
 }
 
 /* helper routine to enqueue bulk of crypto ops */