/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2008-2016 Freescale Semiconductor Inc.
- * Copyright 2016,2019 NXP
+ * Copyright 2016,2019-2020 NXP
*
*/
/* IPSec ESP Decap PDB options */
+/**
+ * PDBOPTS_ESP_ARS_MASK_ERA10 - antireplay window mask
+ * for SEC_ERA >= 10
+ */
+#define PDBOPTS_ESP_ARS_MASK_ERA10 0xc8
+
/**
* PDBOPTS_ESP_ARS_MASK - antireplay window mask
+ * for SEC_ERA < 10
*/
#define PDBOPTS_ESP_ARS_MASK 0xc0
*/
#define PDBOPTS_ESP_ARS128 0x80
+/**
+ * PDBOPTS_ESP_ARS256 - 256-entry antireplay window
+ *
+ * Valid only for IPsec new mode.
+ */
+#define PDBOPTS_ESP_ARS256 0x08
+
+/**
+ * PDBOPTS_ESP_ARS512 - 512-entry antireplay window
+ *
+ * Valid only for IPsec new mode.
+ */
+#define PDBOPTS_ESP_ARS512 0x48
+
+/**
+ * PDBOPTS_ESP_ARS1024 - 1024-entry antireplay window
+ *
+ * Valid only for IPsec new mode.
+ */
+#define PDBOPTS_ESP_ARS1024 0x88
+
/**
* PDBOPTS_ESP_ARS32 - 32-entry antireplay window
*/
};
uint32_t seq_num_ext_hi;
uint32_t seq_num;
- uint32_t anti_replay[4];
+ uint32_t anti_replay[32];
};
static inline unsigned int
{
unsigned int start_pc = program->current_pc;
unsigned int i, ars;
+ uint8_t mask;
__rta_out32(program, pdb->options);
__rta_out32(program, pdb->seq_num_ext_hi);
__rta_out32(program, pdb->seq_num);
- switch (pdb->options & PDBOPTS_ESP_ARS_MASK) {
+ if (rta_sec_era < RTA_SEC_ERA_10)
+ mask = PDBOPTS_ESP_ARS_MASK;
+ else
+ mask = PDBOPTS_ESP_ARS_MASK_ERA10;
+ switch (pdb->options & mask) {
+ case PDBOPTS_ESP_ARS1024:
+ ars = 32;
+ break;
+ case PDBOPTS_ESP_ARS512:
+ ars = 16;
+ break;
+ case PDBOPTS_ESP_ARS256:
+ ars = 8;
+ break;
case PDBOPTS_ESP_ARS128:
ars = 4;
break;
uint32_t win_sz;
win_sz = rte_align32pow2(ipsec_xform->replay_win_sz);
+ if (rta_sec_era < RTA_SEC_ERA_10 && win_sz > 128) {
+ DPAA2_SEC_INFO("Max Anti replay Win sz = 128");
+ win_sz = 128;
+ }
switch (win_sz) {
case 1:
case 2:
case 64:
decap_pdb.options |= PDBOPTS_ESP_ARS64;
break;
+ case 256:
+ decap_pdb.options |= PDBOPTS_ESP_ARS256;
+ break;
+ case 512:
+ decap_pdb.options |= PDBOPTS_ESP_ARS512;
+ break;
+ case 1024:
+ decap_pdb.options |= PDBOPTS_ESP_ARS1024;
+ break;
+ case 128:
default:
decap_pdb.options |= PDBOPTS_ESP_ARS128;
}