DPDK patches and discussions
 help / color / mirror / Atom feed
From: Akhil Goyal <gakhil@marvell.com>
To: <dev@dpdk.org>
Cc: <anoobj@marvell.com>, <thomas@monjalon.net>,
	<ferruh.yigit@intel.com>, <andrew.rybchenko@oktetlabs.ru>,
	<olivier.matz@6wind.com>, <rosen.xu@intel.com>,
	<jerinj@marvell.com>, <vvelumuri@marvell.com>,
	<ndabilpuram@marvell.com>
Subject: [PATCH 5/5] net/cnxk: add option to override outbound inline sa iv
Date: Mon, 3 Jan 2022 21:31:49 +0530	[thread overview]
Message-ID: <20220103160149.1715058-6-gakhil@marvell.com> (raw)
In-Reply-To: <20220103160149.1715058-1-gakhil@marvell.com>

From: Nithin Dabilpuram <ndabilpuram@marvell.com>

Add option to override outbound inline sa iv for debug
purposes via environment variable. User can set env variable as:
export CN10K_ETH_SEC_IV_OVR="0x0, 0x0,..."

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 drivers/net/cnxk/cn10k_ethdev_sec.c | 35 +++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c
index 854498ef46..04ae300497 100644
--- a/drivers/net/cnxk/cn10k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn10k_ethdev_sec.c
@@ -225,6 +225,36 @@ cn10k_eth_sec_sso_work_cb(uint64_t *gw, void *args)
 	rte_pktmbuf_free(mbuf);
 }
 
+static void
+outb_dbg_iv_update(struct roc_ot_ipsec_outb_sa *outb_sa, const char *__iv_str)
+{
+	uint8_t *iv_dbg = outb_sa->iv.iv_dbg;
+	char *iv_str = strdup(__iv_str);
+	char *iv_b = NULL, len = 16;
+	char *save;
+	int i;
+
+	if (!iv_str)
+		return;
+
+	if (outb_sa->w2.s.enc_type == ROC_IE_OT_SA_ENC_AES_GCM ||
+	    outb_sa->w2.s.auth_type == ROC_IE_OT_SA_AUTH_AES_GMAC)
+		len = 8;
+
+	memset(iv_dbg, len, sizeof(outb_sa->iv.iv_dbg));
+
+	for (i = 0; i < len; i++) {
+		iv_b = strtok_r(i ? NULL : iv_str, ",", &save);
+		if (!iv_b)
+			break;
+		iv_dbg[i] = strtoul(iv_b, NULL, 0);
+	}
+
+	/* Update source of IV */
+	outb_sa->w2.s.iv_src = ROC_IE_OT_SA_IV_SRC_FROM_SA;
+	free(iv_str);
+}
+
 static int
 cn10k_eth_sec_session_create(void *device,
 			     struct rte_security_session_conf *conf,
@@ -359,6 +389,7 @@ cn10k_eth_sec_session_create(void *device,
 		struct cn10k_outb_priv_data *outb_priv;
 		struct cnxk_ipsec_outb_rlens *rlens;
 		uint64_t sa_base = dev->outb.sa_base;
+		const char *iv_str;
 		uint32_t sa_idx;
 
 		PLT_STATIC_ASSERT(sizeof(struct cn10k_outb_priv_data) <
@@ -384,6 +415,10 @@ cn10k_eth_sec_session_create(void *device,
 			goto mempool_put;
 		}
 
+		iv_str = getenv("CN10K_ETH_SEC_IV_OVR");
+		if (iv_str)
+			outb_dbg_iv_update(outb_sa_dptr, iv_str);
+
 		/* Save userdata */
 		outb_priv->userdata = conf->userdata;
 		outb_priv->sa_idx = sa_idx;
-- 
2.25.1


  parent reply	other threads:[~2022-01-03 16:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03 16:01 [PATCH 0/5] net/cnxk: support IP reassembly offload Akhil Goyal
2022-01-03 16:01 ` [PATCH 1/5] common/cnxk: configure reassembly specific params Akhil Goyal
2022-01-03 16:01 ` [PATCH 2/5] net/cnxk: reassembly support Akhil Goyal
2022-01-03 16:01 ` [PATCH 3/5] net/cnxk: support IP reassembly mbuf dynfield Akhil Goyal
2022-01-03 16:01 ` [PATCH 4/5] net/cnxk: add dev args for min-max spi Akhil Goyal
2022-01-03 16:01 ` Akhil Goyal [this message]
2022-01-20 16:53 ` [PATCH v2 0/4] net/cnxk: support IP reassembly offload Akhil Goyal
2022-01-20 16:53   ` [PATCH v2 1/4] common/cnxk: configure reassembly specific params Akhil Goyal
2022-01-20 16:53   ` [PATCH v2 2/4] net/cnxk: support IP reassembly Akhil Goyal
2022-01-20 16:53   ` [PATCH v2 3/4] net/cnxk: add dev args for min-max spi Akhil Goyal
2022-01-20 16:53   ` [PATCH v2 4/4] net/cnxk: add option to override outbound inline sa iv Akhil Goyal
2022-02-23 12:28   ` [PATCH v3 0/2] net/cnxk: support IP reassembly offload Akhil Goyal
2022-02-23 12:28     ` [PATCH v3 1/2] common/cnxk: configure reassembly specific params Akhil Goyal
2022-02-23 16:51       ` Jerin Jacob
2022-02-23 12:28     ` [PATCH v3 2/2] net/cnxk: support IP reassembly Akhil Goyal
2022-02-23 16:57       ` Jerin Jacob
2022-02-24 17:28     ` [PATCH v4 0/2] net/cnxk: support IP reassembly offload Akhil Goyal
2022-02-24 17:28       ` [PATCH v4 1/2] common/cnxk: configure reassembly specific params Akhil Goyal
2022-02-24 17:28       ` [PATCH v4 2/2] net/cnxk: support IP reassembly Akhil Goyal
2022-02-24 17:41         ` Jerin Jacob
2022-02-24 18:28       ` [PATCH v5 0/2] net/cnxk: support IP reassembly offload Akhil Goyal
2022-02-24 18:29         ` [PATCH v5 1/2] common/cnxk: configure reassembly specific params Akhil Goyal
2022-02-24 18:29         ` [PATCH v5 2/2] net/cnxk: support IP reassembly Akhil Goyal
2022-02-24 20:40         ` [PATCH v5 0/2] net/cnxk: support IP reassembly offload Jerin Jacob

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=20220103160149.1715058-6-gakhil@marvell.com \
    --to=gakhil@marvell.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=olivier.matz@6wind.com \
    --cc=rosen.xu@intel.com \
    --cc=thomas@monjalon.net \
    --cc=vvelumuri@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).