From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CC4F8A00BE; Thu, 17 Feb 2022 14:55:16 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 573A740150; Thu, 17 Feb 2022 14:55:16 +0100 (CET) Received: from mail-il1-f175.google.com (mail-il1-f175.google.com [209.85.166.175]) by mails.dpdk.org (Postfix) with ESMTP id 444C440042 for ; Thu, 17 Feb 2022 14:55:15 +0100 (CET) Received: by mail-il1-f175.google.com with SMTP id d7so2291599ilf.8 for ; Thu, 17 Feb 2022 05:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VgD6nlut0uJ028I7Nrhb24Qmbmrm7YWTEMM1P2p7Y0s=; b=Kr5xPNKY8uNQ3uv4jEjPDI+JkLtVEVdN5CBmtT8UnnDMAvJObXLB5Ihk6700bO1HFk XKjU7ls5JXMIGjr7IIxh5TM+W+r0jNk+ni4GGyBzBnjOEYhNEyX2rsJ/l6NxGvWL/Shw JSmw1tGHUm8EuVvONuFvZWuy0w+/p6QhLMBRE+FxfWyxXX2bv3HmhlZweQzBvj7HJ4vS ODLAnZe7c5ej6MEh6hd90IEM3kJiMMHH1hK6mEnbJ1fsvlkKX+oXyqvWTgWzXjdnfuCm JEJyKfYmpniN5f4+tlLAKH6Tv8OkoRuYYSr6CMI/NgrAj+rylLVHVxWcCkdsFxPM5WBi 4u4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VgD6nlut0uJ028I7Nrhb24Qmbmrm7YWTEMM1P2p7Y0s=; b=HZCbtt6itSKYFPPDdkX71lvaHcxezBggvIu/J8VT/5eae3DwyxKVB8xDrF2wRK+4J/ UEiUW96pUKiHvG2EBSZN2rjV9LNz/OQ7Epr1ERI70soBfdNCfK4s7b1Ydc0xapGaU1ZP MQ3Mfmi20GME08lFFfBTg9Zj+6oksY3TmwT2zEBncdf8Yf36qOVwWUf6+vZTYqAtmh7y uWfDNE25ZQ6BmPvjAr4DKS8jsnjgd88CKWyvlggBeWBXqHVuW5l5L+2rQ+KmIhvWSs4t E0D3RNywbDrdMTstjNxe+EEj/PS4uVFKkPjyg1b5dM1FtrmGIOXlbUVU2Lmxcq2BCbcf 6tWg== X-Gm-Message-State: AOAM530y37R1eJ7xmqaT731LAup+JNNgjThvCFosgjblY0qWJEv7FqNZ UB4Vzcqq8vaXwScsd0wvHckHeoiOk8FErvII00HudgFkDWw= X-Google-Smtp-Source: ABdhPJxC0aJ5f3O71e0J3BfcrAHB6yrqOR5EWJrWNDzV12Aa9Ur7Uc9y48iUaKo6JXNYyEOTIieDoQm5B/z+ZtkDktE= X-Received: by 2002:a92:2603:0:b0:2bf:86bc:f860 with SMTP id n3-20020a922603000000b002bf86bcf860mr2133137ile.75.1645106114350; Thu, 17 Feb 2022 05:55:14 -0800 (PST) MIME-Version: 1.0 References: <20220207072932.22409-1-ndabilpuram@marvell.com> <20220207072932.22409-20-ndabilpuram@marvell.com> In-Reply-To: <20220207072932.22409-20-ndabilpuram@marvell.com> From: Jerin Jacob Date: Thu, 17 Feb 2022 19:24:48 +0530 Message-ID: Subject: Re: [PATCH 20/20] net/cnxk: add option to override outbound inline sa iv To: Nithin Dabilpuram Cc: Jerin Jacob , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , dpdk-dev Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Mon, Feb 7, 2022 at 1:02 PM Nithin Dabilpuram wrote: > > Add option to override outbound inline sa iv for debug sa -> SA IV -> IV Please check the subject too > purposes via environment variable. User can set env variable as: > export CN10K_ETH_SEC_IV_OVR="0x0, 0x0,..." Please add a table for environment variables and usage in doc/guides/platform/cnxk.rst for the following ones as a separate patch and extended the new one there. rivers/common/cnxk/roc_bphy_irq.c: env = getenv("BPHY_INTR_MLOCK_DISABLE"); drivers/common/cnxk/roc_mbox.c: var = getenv("ROC_CN10K_MBOX_TIMEOUT"); drivers/common/cnxk/roc_mbox.c: var_to = getenv("ROC_MBOX_TIMEOUT"); > > Signed-off-by: Nithin Dabilpuram > --- > drivers/net/cnxk/cn10k_ethdev_sec.c | 62 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 62 insertions(+) > > diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c > index a2a53c1..a514345 100644 > --- a/drivers/net/cnxk/cn10k_ethdev_sec.c > +++ b/drivers/net/cnxk/cn10k_ethdev_sec.c > @@ -252,6 +252,63 @@ cn10k_eth_sec_sso_work_cb(uint64_t *gw, void *args) > cnxk_pktmbuf_free_no_cache(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.enc_type == ROC_IE_OT_SA_ENC_AES_CTR || > + outb_sa->w2.s.enc_type == ROC_IE_OT_SA_ENC_AES_CCM || > + outb_sa->w2.s.auth_type == ROC_IE_OT_SA_AUTH_AES_GMAC) { > + memset(outb_sa->iv.s.iv_dbg1, 0, sizeof(outb_sa->iv.s.iv_dbg1)); > + memset(outb_sa->iv.s.iv_dbg2, 0, sizeof(outb_sa->iv.s.iv_dbg2)); > + > + iv_dbg = outb_sa->iv.s.iv_dbg1; > + for (i = 0; i < 4; i++) { > + iv_b = strtok_r(i ? NULL : iv_str, ",", &save); > + if (!iv_b) > + break; > + iv_dbg[i] = strtoul(iv_b, NULL, 0); > + } > + *(uint32_t *)iv_dbg = rte_be_to_cpu_32(*(uint32_t *)iv_dbg); > + > + iv_dbg = outb_sa->iv.s.iv_dbg2; > + for (i = 0; i < 4; i++) { > + iv_b = strtok_r(NULL, ",", &save); > + if (!iv_b) > + break; > + iv_dbg[i] = strtoul(iv_b, NULL, 0); > + } > + *(uint32_t *)iv_dbg = rte_be_to_cpu_32(*(uint32_t *)iv_dbg); > + > + } else { > + iv_dbg = outb_sa->iv.iv_dbg; > + memset(iv_dbg, 0, 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); > + } > + *(uint64_t *)iv_dbg = rte_be_to_cpu_64(*(uint64_t *)iv_dbg); > + *(uint64_t *)&iv_dbg[8] = > + rte_be_to_cpu_64(*(uint64_t *)&iv_dbg[8]); > + } > + > + /* 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, > @@ -390,6 +447,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) < > @@ -416,6 +474,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.8.4 >