diff mbox series

[v3,06/10] common/dpaax: caamflib do not clear DPOVRD

Message ID 20210907083953.8948-6-hemant.agrawal@nxp.com
State Superseded
Headers show
Series [v3,01/10] crypto/dpaa_sec: support DES-CBC | expand

Commit Message

Hemant Agrawal Sept. 7, 2021, 8:39 a.m. UTC
From: Franck LENORMAND <franck.lenormand@nxp.com>


For SDAP, we are not using the protocol operation to perform
4G/LTE operation so the DPOVRD option is not used.

Removing it save some space in the descriptor buffer and
execution time.

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>

---
 drivers/common/dpaax/caamflib/desc/pdcp.h | 14 ++++++++------
 drivers/common/dpaax/caamflib/desc/sdap.h |  2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

-- 
2.17.1
diff mbox series

Patch

diff --git a/drivers/common/dpaax/caamflib/desc/pdcp.h b/drivers/common/dpaax/caamflib/desc/pdcp.h
index e97d58cbc1..5b3d846099 100644
--- a/drivers/common/dpaax/caamflib/desc/pdcp.h
+++ b/drivers/common/dpaax/caamflib/desc/pdcp.h
@@ -2546,7 +2546,8 @@  static inline int
 insert_hfn_ov_op(struct program *p,
 		 uint32_t shift,
 		 enum pdb_type_e pdb_type,
-		 unsigned char era_2_sw_hfn_ovrd)
+		 unsigned char era_2_sw_hfn_ovrd,
+		 bool clear_dpovrd_at_end)
 {
 	uint32_t imm = PDCP_DPOVRD_HFN_OV_EN;
 	uint16_t hfn_pdb_offset;
@@ -2597,13 +2598,14 @@  insert_hfn_ov_op(struct program *p,
 	MATHB(p, MATH0, SHLD, MATH0, MATH0, 8, 0);
 	MOVE(p, MATH0, 0, DESCBUF, hfn_pdb_offset, 4, IMMED);
 
-	if (rta_sec_era >= RTA_SEC_ERA_8)
+	if (clear_dpovrd_at_end && (rta_sec_era >= RTA_SEC_ERA_8)) {
 		/*
 		 * For ERA8, DPOVRD could be handled by the PROTOCOL command
 		 * itself. For now, this is not done. Thus, clear DPOVRD here
 		 * to alleviate any side-effects.
 		 */
 		MATHB(p, DPOVRD, AND, ZERO, DPOVRD, 4, STL);
+	}
 
 	SET_LABEL(p, keyjump);
 	PATCH_JUMP(p, pkeyjump, keyjump);
@@ -2989,7 +2991,7 @@  cnstr_shdsc_pdcp_c_plane_encap(uint32_t *descbuf,
 	SET_LABEL(p, pdb_end);
 
 	err = insert_hfn_ov_op(p, sn_size, pdb_type,
-			       era_2_sw_hfn_ovrd);
+			       era_2_sw_hfn_ovrd, true);
 	if (err)
 		return err;
 
@@ -3143,7 +3145,7 @@  cnstr_shdsc_pdcp_c_plane_decap(uint32_t *descbuf,
 	SET_LABEL(p, pdb_end);
 
 	err = insert_hfn_ov_op(p, sn_size, pdb_type,
-			       era_2_sw_hfn_ovrd);
+			       era_2_sw_hfn_ovrd, true);
 	if (err)
 		return err;
 
@@ -3319,7 +3321,7 @@  cnstr_shdsc_pdcp_u_plane_encap(uint32_t *descbuf,
 	}
 	SET_LABEL(p, pdb_end);
 
-	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd);
+	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);
 	if (err)
 		return err;
 
@@ -3523,7 +3525,7 @@  cnstr_shdsc_pdcp_u_plane_decap(uint32_t *descbuf,
 	}
 	SET_LABEL(p, pdb_end);
 
-	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd);
+	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd, true);
 	if (err)
 		return err;
 
diff --git a/drivers/common/dpaax/caamflib/desc/sdap.h b/drivers/common/dpaax/caamflib/desc/sdap.h
index f1c49ea3e6..d5d5850b4f 100644
--- a/drivers/common/dpaax/caamflib/desc/sdap.h
+++ b/drivers/common/dpaax/caamflib/desc/sdap.h
@@ -990,7 +990,7 @@  cnstr_shdsc_pdcp_sdap_u_plane(uint32_t *descbuf,
 	SET_LABEL(p, pdb_end);
 
 	/* Inser the HFN override operation */
-	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd);
+	err = insert_hfn_ov_op(p, sn_size, pdb_type, era_2_sw_hfn_ovrd, false);
 	if (err)
 		return err;