[EXT] Re: [PATCH] test/security: add inline IPsec Rx inject test

Rahul Bhansali rbhansali at marvell.com
Thu Feb 1 10:16:10 CET 2024



> -----Original Message-----
> From: Stephen Hemminger <stephen at networkplumber.org>
> Sent: Friday, January 19, 2024 10:26 PM
> To: Rahul Bhansali <rbhansali at marvell.com>
> Cc: dev at dpdk.org; Akhil Goyal <gakhil at marvell.com>; Anoob Joseph
> <anoobj at marvell.com>
> Subject: [EXT] Re: [PATCH] test/security: add inline IPsec Rx inject test
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Fri, 19 Jan 2024 11:42:20 +0530
> Rahul Bhansali <rbhansali at marvell.com> wrote:
> 
> > +static int
> > +test_ipsec_with_rx_inject(struct ip_pkt_vector *vector, const struct
> > +ipsec_test_flags *flags) {
> > +	struct rte_security_session_conf sess_conf_out = {0};
> > +	struct rte_security_session_conf sess_conf_in = {0};
> > +	uint32_t nb_tx, burst_sz, nb_sent = 0, nb_inj = 0;
> > +	void *out_ses[ENCAP_DECAP_BURST_SZ] = {0};
> > +	void *in_ses[ENCAP_DECAP_BURST_SZ] = {0};
> > +	struct rte_crypto_sym_xform cipher_out = {0};
> > +	struct rte_crypto_sym_xform cipher_in = {0};
> > +	struct rte_crypto_sym_xform auth_out = {0};
> > +	struct rte_crypto_sym_xform aead_out = {0};
> > +	struct rte_crypto_sym_xform auth_in = {0};
> > +	struct rte_crypto_sym_xform aead_in = {0};
> > +	uint32_t i, j, nb_rx = 0, nb_inj_rx = 0;
> > +	struct rte_mbuf **inj_pkts_burst;
> > +	struct ipsec_test_data sa_data;
> > +	uint32_t ol_flags;
> > +	bool outer_ipv4;
> > +	int ret = 0;
> > +	void *ctx;
> > +
> > +	inj_pkts_burst = (struct rte_mbuf **)rte_calloc("inj_buff",
> > +			MAX_TRAFFIC_BURST,
> > +			sizeof(void *),
> > +			RTE_CACHE_LINE_SIZE);
> 
> Why use rte_calloc(), instead of calloc() this is a test and the buffer does not need
> to be shared it is on stack.
> 
> Cast is not necessary here, calloc and rte_calloc return void *
> 
Ack, will send v2.
> > +	if (!inj_pkts_burst)
> > +		return TEST_FAILED;
> > +
> > +	burst_sz = vector->burst ? ENCAP_DECAP_BURST_SZ : 1;
> > +	nb_tx = burst_sz;
> > +
> > +	memset(tx_pkts_burst, 0, sizeof(tx_pkts_burst[0]) * nb_tx);
> > +	memset(rx_pkts_burst, 0, sizeof(rx_pkts_burst[0]) * nb_tx);
> > +	memset(inj_pkts_burst, 0, sizeof(inj_pkts_burst[0]) * nb_tx);
> 
> calloc routines return already zero'd buffer


More information about the dev mailing list