DPAA2_SET_FD_LEN(fd, ip_fle->length);
DPAA2_SET_FLE_FIN(ip_fle);
-#ifdef ENABLE_HFN_OVERRIDE
+ /* In case of PDCP, per packet HFN is stored in
+ * mbuf priv after sym_op.
+ */
if (sess->ctxt_type == DPAA2_SEC_PDCP && sess->pdcp.hfn_ovd) {
+ uint32_t hfn_ovd = *((uint8_t *)op + sess->pdcp.hfn_ovd_offset);
/*enable HFN override override */
- DPAA2_SET_FLE_INTERNAL_JD(ip_fle, sess->pdcp.hfn_ovd);
- DPAA2_SET_FLE_INTERNAL_JD(op_fle, sess->pdcp.hfn_ovd);
- DPAA2_SET_FD_INTERNAL_JD(fd, sess->pdcp.hfn_ovd);
+ DPAA2_SET_FLE_INTERNAL_JD(ip_fle, hfn_ovd);
+ DPAA2_SET_FLE_INTERNAL_JD(op_fle, hfn_ovd);
+ DPAA2_SET_FD_INTERNAL_JD(fd, hfn_ovd);
}
-#endif
return 0;
session->pdcp.bearer = pdcp_xform->bearer;
session->pdcp.pkt_dir = pdcp_xform->pkt_dir;
session->pdcp.sn_size = pdcp_xform->sn_size;
-#ifdef ENABLE_HFN_OVERRIDE
- session->pdcp.hfn_ovd = pdcp_xform->hfn_ovd;
-#endif
session->pdcp.hfn = pdcp_xform->hfn;
session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold;
+ session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;
+ /* hfv ovd offset location is stored in iv.offset value*/
+ session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
cipherdata.key = (size_t)session->cipher_key.data;
cipherdata.keylen = session->cipher_key.length;
int8_t bearer; /*!< PDCP bearer ID */
int8_t pkt_dir;/*!< PDCP Frame Direction 0:UL 1:DL*/
int8_t hfn_ovd;/*!< Overwrite HFN per packet*/
+ uint8_t sn_size; /*!< Sequence number size, 5/7/12/15/18 */
+ uint32_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which
+ * per packet hfn is stored
+ */
uint32_t hfn; /*!< Hyper Frame Number */
uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */
- uint8_t sn_size; /*!< Sequence number size, 7/12/15 */
};
typedef struct dpaa2_sec_session_entry {
if (auth_only_len)
fd->cmd = 0x80000000 | auth_only_len;
+ /* In case of PDCP, per packet HFN is stored in
+ * mbuf priv after sym_op.
+ */
+ if (is_proto_pdcp(ses) && ses->pdcp.hfn_ovd) {
+ fd->cmd = 0x80000000 |
+ *((uint32_t *)((uint8_t *)op +
+ ses->pdcp.hfn_ovd_offset));
+ DPAA_SEC_DP_DEBUG("Per packet HFN: %x, ovd:%u,%u\n",
+ *((uint32_t *)((uint8_t *)op +
+ ses->pdcp.hfn_ovd_offset)),
+ ses->pdcp.hfn_ovd,
+ is_proto_pdcp(ses));
+ }
+
}
send_pkts:
loop = 0;
session->pdcp.bearer = pdcp_xform->bearer;
session->pdcp.pkt_dir = pdcp_xform->pkt_dir;
session->pdcp.sn_size = pdcp_xform->sn_size;
-#ifdef ENABLE_HFN_OVERRIDE
- session->pdcp.hfn_ovd = pdcp_xform->hfn_ovd;
-#endif
session->pdcp.hfn = pdcp_xform->hfn;
session->pdcp.hfn_threshold = pdcp_xform->hfn_threshold;
+ session->pdcp.hfn_ovd = pdcp_xform->hfn_ovrd;
+ session->pdcp.hfn_ovd_offset = cipher_xform->iv.offset;
session->ctx_pool = dev_priv->ctx_pool;
rte_spinlock_lock(&dev_priv->lock);
int8_t bearer; /*!< PDCP bearer ID */
int8_t pkt_dir;/*!< PDCP Frame Direction 0:UL 1:DL*/
int8_t hfn_ovd;/*!< Overwrite HFN per packet*/
+ uint8_t sn_size; /*!< Sequence number size, 5/7/12/15/18 */
+ uint32_t hfn_ovd_offset;/*!< offset from rte_crypto_op at which
+ * per packet hfn is stored
+ */
uint32_t hfn; /*!< Hyper Frame Number */
uint32_t hfn_threshold; /*!< HFN Threashold for key renegotiation */
- uint8_t sn_size; /*!< Sequence number size, 7/12/15 */
};
typedef struct dpaa_sec_session_entry {