common/dpaax: remove unnecessary jump for PDCP
authorAkhil Goyal <akhil.goyal@nxp.com>
Tue, 10 Dec 2019 12:50:33 +0000 (18:20 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 8 Jul 2020 16:16:17 +0000 (18:16 +0200)
In case of LX2160, PROTOCOL command can be used in some of the PDCP
cases, in those the jump command prior to KEY command may not be
required.

The issue observed due to these JUMP command on LX2160 is that,
the CAAM gets stuck and the processing never get completed. The
system becomes unusable.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/common/dpaax/caamflib/desc/pdcp.h

index 4761153..95d1416 100644 (file)
@@ -1887,17 +1887,13 @@ pdcp_insert_cplane_snow_zuc_op(struct program *p,
                return -ENOTSUP;
        }
 
-       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));
-       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
-           INLINE_KEY(authdata));
-
-       SET_LABEL(p, keyjump);
-
        if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
                (rta_sec_era == RTA_SEC_ERA_10)) {
                int pclid;
+               KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
+                   cipherdata->keylen, INLINE_KEY(cipherdata));
+               KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+                   INLINE_KEY(authdata));
 
                if (sn_size == PDCP_SN_SIZE_5)
                        pclid = OP_PCLID_LTE_PDCP_CTRL_MIXED;
@@ -1931,6 +1927,13 @@ pdcp_insert_cplane_snow_zuc_op(struct program *p,
 
        }
 
+       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));
+       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+           INLINE_KEY(authdata));
+
+       SET_LABEL(p, keyjump);
        SEQLOAD(p, MATH0, offset, length, 0);
        JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
        MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
@@ -2008,15 +2011,13 @@ pdcp_insert_cplane_aes_zuc_op(struct program *p,
                return -ENOTSUP;
        }
 
-       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));
-       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
-           INLINE_KEY(authdata));
-
        if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
                (rta_sec_era == RTA_SEC_ERA_10)) {
                int pclid;
+               KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
+                   cipherdata->keylen, INLINE_KEY(cipherdata));
+               KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+                   INLINE_KEY(authdata));
 
                if (sn_size == PDCP_SN_SIZE_5)
                        pclid = OP_PCLID_LTE_PDCP_CTRL_MIXED;
@@ -2050,8 +2051,14 @@ pdcp_insert_cplane_aes_zuc_op(struct program *p,
                return -ENOTSUP;
 
        }
+       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));
+       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+           INLINE_KEY(authdata));
 
        SET_LABEL(p, keyjump);
+
        SEQLOAD(p, MATH0, offset, length, 0);
        JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);
        MOVEB(p, MATH0, offset, IFIFOAB2, 0, length, IMMED);
@@ -2132,15 +2139,13 @@ pdcp_insert_cplane_zuc_snow_op(struct program *p,
                return -ENOTSUP;
        }
 
-       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));
-       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
-           INLINE_KEY(authdata));
-
        if ((rta_sec_era >= RTA_SEC_ERA_8 && sn_size != PDCP_SN_SIZE_18) ||
                (rta_sec_era == RTA_SEC_ERA_10)) {
                int pclid;
+               KEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,
+                   cipherdata->keylen, INLINE_KEY(cipherdata));
+               KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+                   INLINE_KEY(authdata));
 
                if (sn_size == PDCP_SN_SIZE_5)
                        pclid = OP_PCLID_LTE_PDCP_CTRL_MIXED;
@@ -2174,6 +2179,12 @@ pdcp_insert_cplane_zuc_snow_op(struct program *p,
                return -ENOTSUP;
 
        }
+       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));
+       KEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,
+           INLINE_KEY(authdata));
+
        SET_LABEL(p, keyjump);
        SEQLOAD(p, MATH0, offset, length, 0);
        JUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);