test/crypto: update PDCP HFN scenarios

As per current framework of PDCP testing, app can only support
either HFN override or fixed session HFN values but not both.
Now to enable both, either we duplicate all PDCP cases(>100)
for both override and fixed HFN. It will look clumsy as the
number of cases will be very high without much value addition.

Now to overcome this, we can do HFN override for Downlink cases
and fixed HFN for uplink cases. This way we will not loose the
test coverage and there will not be duplicacy in the test cases.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Akhil Goyal 2020-07-06 10:30:23 +05:30 committed by Thomas Monjalon
parent f6ab96f13d
commit d3be77833f

View File

@ -7161,7 +7161,9 @@ test_pdcp_proto(int i, int oop,
ut_params->cipher_xform.cipher.key.data = pdcp_test_crypto_key[i]; ut_params->cipher_xform.cipher.key.data = pdcp_test_crypto_key[i];
ut_params->cipher_xform.cipher.key.length = ut_params->cipher_xform.cipher.key.length =
pdcp_test_params[i].cipher_key_len; pdcp_test_params[i].cipher_key_len;
ut_params->cipher_xform.cipher.iv.length = 0; ut_params->cipher_xform.cipher.iv.length =
pdcp_test_packet_direction[i] ? 4 : 0;
ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET;
/* Setup HMAC Parameters if ICV header is required */ /* Setup HMAC Parameters if ICV header is required */
if (pdcp_test_params[i].auth_alg != 0) { if (pdcp_test_params[i].auth_alg != 0) {
@ -7186,8 +7188,18 @@ test_pdcp_proto(int i, int oop,
.domain = pdcp_test_params[i].domain, .domain = pdcp_test_params[i].domain,
.pkt_dir = pdcp_test_packet_direction[i], .pkt_dir = pdcp_test_packet_direction[i],
.sn_size = pdcp_test_data_sn_size[i], .sn_size = pdcp_test_data_sn_size[i],
.hfn = pdcp_test_hfn[i], .hfn = pdcp_test_packet_direction[i] ?
0 : pdcp_test_hfn[i],
/**
* hfn can be set as pdcp_test_hfn[i]
* if hfn_ovrd is not set. Here, PDCP
* packet direction is just used to
* run half of the cases with session
* HFN and other half with per packet
* HFN.
*/
.hfn_threshold = pdcp_test_hfn_threshold[i], .hfn_threshold = pdcp_test_hfn_threshold[i],
.hfn_ovrd = pdcp_test_packet_direction[i] ? 1 : 0,
} }, } },
.crypto_xform = &ut_params->cipher_xform .crypto_xform = &ut_params->cipher_xform
}; };
@ -7214,6 +7226,10 @@ test_pdcp_proto(int i, int oop,
goto on_err; goto on_err;
} }
uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ut_params->op,
uint32_t *, IV_OFFSET);
*per_pkt_hfn = pdcp_test_packet_direction[i] ? pdcp_test_hfn[i] : 0;
rte_security_attach_session(ut_params->op, ut_params->sec_session); rte_security_attach_session(ut_params->op, ut_params->sec_session);
/* set crypto operation source mbuf */ /* set crypto operation source mbuf */
@ -7445,6 +7461,7 @@ test_pdcp_proto_SGL(int i, int oop,
.sn_size = pdcp_test_data_sn_size[i], .sn_size = pdcp_test_data_sn_size[i],
.hfn = pdcp_test_hfn[i], .hfn = pdcp_test_hfn[i],
.hfn_threshold = pdcp_test_hfn_threshold[i], .hfn_threshold = pdcp_test_hfn_threshold[i],
.hfn_ovrd = 0,
} }, } },
.crypto_xform = &ut_params->cipher_xform .crypto_xform = &ut_params->cipher_xform
}; };