DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Rahul Bhansali <rbhansali@marvell.com>
Cc: <dev@dpdk.org>, Akhil Goyal <gakhil@marvell.com>,
	Anoob Joseph <anoobj@marvell.com>
Subject: Re: [PATCH] test/security: add inline IPsec Rx inject test
Date: Fri, 19 Jan 2024 08:56:22 -0800	[thread overview]
Message-ID: <20240119085622.02717d9b@hermes.local> (raw)
In-Reply-To: <20240119061220.1751531-1-rbhansali@marvell.com>

On Fri, 19 Jan 2024 11:42:20 +0530
Rahul Bhansali <rbhansali@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 *

> +	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

  reply	other threads:[~2024-01-19 16:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19  6:12 Rahul Bhansali
2024-01-19 16:56 ` Stephen Hemminger [this message]
2024-02-01  9:16   ` [EXT] " Rahul Bhansali
2024-02-01 10:07 ` [PATCH v2] " Rahul Bhansali
2024-02-29 18:16   ` Akhil Goyal

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=20240119085622.02717d9b@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=gakhil@marvell.com \
    --cc=rbhansali@marvell.com \
    /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).