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 1FABF429AD; Fri, 21 Apr 2023 15:13:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E08DC42D4B; Fri, 21 Apr 2023 15:12:42 +0200 (CEST) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3A11A42D46 for ; Fri, 21 Apr 2023 15:12:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682082761; x=1713618761; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OgCScGtFuz71/3Qht5eQDAua9COPw/fee0oDkhqgRok=; b=Gy03Q6aphRBp829YVFH+czoDfzjgE1/swG+9+ZbWtmAUuDyMMlHdm0Yn jFhADhqz26dvdQ6lxTS15H1chCIvUMRSRRHxArehaNohvYVwo7pRRmhSK I1VLzaUWuAyEbRKBIKj7Z5D1G8xJ66MhlO1xxJC6Cgk5/EZYHDD6Yc2rf /MrZMNgCI15bJi4N2LxkdpkADTy8sJLwBR9/EPtYaGQX491BSC43ZZKYA LLu9J7LvwH5GAesDtQs3yAjb14Zl1h2ERlMSxV+1moQir/JKnrpAhpTt8 xlOPt/v/lQ2ayX9RGrxQ5fEpa5nkpNCtcm9+FFffDPZn/CNSbR+iebQ4c Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="408927732" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="408927732" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Apr 2023 06:12:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10686"; a="724817416" X-IronPort-AV: E=Sophos;i="5.99,214,1677571200"; d="scan'208";a="724817416" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by orsmga001.jf.intel.com with ESMTP; 21 Apr 2023 06:12:39 -0700 From: Ciara Power To: dev@dpdk.org Cc: kai.ji@intel.com, Pablo de Lara , Ciara Power Subject: [PATCH 8/8] crypto/ipsec_mb: set and use session ID Date: Fri, 21 Apr 2023 13:12:20 +0000 Message-Id: <20230421131221.1732314-9-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230421131221.1732314-1-ciara.power@intel.com> References: <20230421131221.1732314-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Pablo de Lara When creating a session, get the session ID that defines the fixed session parameters and store it in the private data. When retrieving IMB_JOB's, if their internal session ID matches the one in the private session data, these fixed session parameters do not need to be filled again. Signed-off-by: Pablo de Lara Signed-off-by: Ciara Power --- drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 22 ++++++++++++++++++++- drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h | 2 ++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c index f23016c9c3..8600f41897 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb.c +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb.c @@ -845,6 +845,10 @@ aesni_mb_session_configure(IMB_MGR *mb_mgr, } } +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + sess->session_id = imb_set_session(mb_mgr, &sess->template_job); +#endif + return 0; } @@ -977,6 +981,10 @@ aesni_mb_set_docsis_sec_session_parameters( goto error_exit; } +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + ipsec_sess->session_id = imb_set_session(mb_mgr, &ipsec_sess->template_job); +#endif + error_exit: free_mb_mgr(mb_mgr); return ret; @@ -1386,6 +1394,9 @@ set_gcm_job(IMB_MGR *mb_mgr, IMB_JOB *job, const uint8_t sgl, job->msg_len_to_hash_in_bytes = 0; job->msg_len_to_cipher_in_bytes = 0; job->cipher_start_src_offset_in_bytes = 0; +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + imb_set_session(mb_mgr, job); +#endif } else { job->hash_start_src_offset_in_bytes = op->sym->aead.data.offset; @@ -1470,7 +1481,10 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, const IMB_CIPHER_MODE cipher_mode = session->template_job.cipher_mode; - memcpy(job, &session->template_job, sizeof(IMB_JOB)); +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + if (job->session_id != session->session_id) +#endif + memcpy(job, &session->template_job, sizeof(IMB_JOB)); if (!op->sym->m_dst) { /* in-place operation */ @@ -1510,6 +1524,9 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->u.GCM.ctx = &qp_data->gcm_sgl_ctx; job->cipher_mode = IMB_CIPHER_GCM_SGL; job->hash_alg = IMB_AUTH_GCM_SGL; +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + imb_set_session(mb_mgr, job); +#endif } break; case IMB_AUTH_AES_GMAC_128: @@ -1534,6 +1551,9 @@ set_mb_job_params(IMB_JOB *job, struct ipsec_mb_qp *qp, job->u.CHACHA20_POLY1305.ctx = &qp_data->chacha_sgl_ctx; job->cipher_mode = IMB_CIPHER_CHACHA20_POLY1305_SGL; job->hash_alg = IMB_AUTH_CHACHA20_POLY1305_SGL; +#if IMB_VERSION(1, 3, 0) < IMB_VERSION_NUM + imb_set_session(mb_mgr, job); +#endif } break; default: diff --git a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h index ce9a6e4886..9b7c9edb6d 100644 --- a/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h +++ b/drivers/crypto/ipsec_mb/pmd_aesni_mb_priv.h @@ -854,6 +854,8 @@ get_digest_byte_length(IMB_HASH_ALG algo) struct aesni_mb_session { IMB_JOB template_job; /*< Template job structure */ + uint32_t session_id; + /*< IPSec MB session ID */ struct { uint16_t offset; } iv; -- 2.25.1