/* SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+
* Copyright 2008-2013 Freescale Semiconductor, Inc.
- * Copyright 2019-2021 NXP
+ * Copyright 2019-2022 NXP
*/
#ifndef __DESC_PDCP_H__
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_5:
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
- }
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
if (dir == OP_TYPE_ENCAP_PROTOCOL)
MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_5:
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
- }
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
-
- }
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
-
- }
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
if (dir == OP_TYPE_ENCAP_PROTOCOL)
MATHB(p, SEQINSZ, SUB, length, VSEQINSZ, 4, IMMED2);
(uint16_t)authdata->algtype);
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
-
- }
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
- }
pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
- }
pkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);
KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
cipherdata->keylen, INLINE_KEY(cipherdata));
(uint16_t)authdata->algtype);
return 0;
}
- /* Non-proto is supported only for 5bit cplane and 18bit uplane */
- switch (sn_size) {
- case PDCP_SN_SIZE_5:
- offset = 7;
- length = 1;
- sn_mask = (swap == false) ? PDCP_C_PLANE_SN_MASK :
- PDCP_C_PLANE_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_18:
- offset = 5;
- length = 3;
- sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
- PDCP_U_PLANE_18BIT_SN_MASK_BE;
- break;
- case PDCP_SN_SIZE_7:
- case PDCP_SN_SIZE_12:
- case PDCP_SN_SIZE_15:
- pr_err("Invalid sn_size for %s\n", __func__);
- return -ENOTSUP;
- }
+
+ /* sn_size is 18 */
+ offset = 5;
+ length = 3;
+ sn_mask = (swap == false) ? PDCP_U_PLANE_18BIT_SN_MASK :
+ PDCP_U_PLANE_18BIT_SN_MASK_BE;
SEQLOAD(p, MATH0, offset, length, 0);
JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright 2020-2021 NXP
+ * Copyright 2020-2022 NXP
*/
#ifndef __DESC_SDAP_H__
static inline int
rta_inline_pdcp_sdap_query(enum auth_type_pdcp auth_alg,
enum cipher_type_pdcp cipher_alg,
- enum pdcp_sn_size sn_size,
- int8_t hfn_ovd)
+ __rte_unused enum pdcp_sn_size sn_size,
+ __rte_unused int8_t hfn_ovd)
{
- int nb_key_to_inline = 0;
-
if ((cipher_alg != PDCP_CIPHER_TYPE_NULL) &&
(auth_alg != PDCP_AUTH_TYPE_NULL))
return 2;
else
return 0;
-
- /**
- * Shared Descriptors for some of the cases does not fit in the
- * MAX_DESC_SIZE of the descriptor
- * The cases which exceed are for RTA_SEC_ERA=8 and HFN override
- * enabled and 12/18 bit uplane and either of following Algo combo.
- * - AES-SNOW
- * - AES-ZUC
- * - SNOW-SNOW
- * - SNOW-ZUC
- * - ZUC-SNOW
- * - ZUC-SNOW
- *
- * We cannot make inline for all cases, as this will impact performance
- * due to extra memory accesses for the keys.
- */
-
- /* Inline only the cipher key */
- if ((rta_sec_era == RTA_SEC_ERA_8) && hfn_ovd &&
- ((sn_size == PDCP_SN_SIZE_12) ||
- (sn_size == PDCP_SN_SIZE_18)) &&
- (cipher_alg != PDCP_CIPHER_TYPE_NULL) &&
- ((auth_alg == PDCP_AUTH_TYPE_SNOW) ||
- (auth_alg == PDCP_AUTH_TYPE_ZUC))) {
-
- nb_key_to_inline++;
-
- /* Sub case where inlining another key is required */
- if ((cipher_alg == PDCP_CIPHER_TYPE_AES) &&
- (auth_alg == PDCP_AUTH_TYPE_SNOW))
- nb_key_to_inline++;
- }
-
- /* Inline both keys */
-
- return nb_key_to_inline;
}
static inline void key_loading_opti(struct program *p,