[v5,04/16] test/crypto: limit number of sessions
Checks
Commit Message
Instead of using the maximum number of sessions
allowed by the PMDs (which will change to unlimited most
of the PMDs), limit the number to a small sufficient amount.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
---
test/test/test_cryptodev.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
Comments
>-----Original Message-----
>From: Pablo de Lara [mailto:pablo.de.lara.guarch@intel.com]
>Sent: 05 July 2018 07:38
>To: declan.doherty@intel.com; akhil.goyal@nxp.com; Verma, Shally <Shally.Verma@cavium.com>; ravi1.kumar@amd.com; Jacob,
>Jerin <Jerin.JacobKollanukkaran@cavium.com>; roy.fan.zhang@intel.com; fiona.trahe@intel.com; tdu@semihalf.com;
>jianjay.zhou@huawei.com
>Cc: dev@dpdk.org; Pablo de Lara <pablo.de.lara.guarch@intel.com>
>Subject: [PATCH v5 04/16] test/crypto: limit number of sessions
>
>External Email
>
>Instead of using the maximum number of sessions
>allowed by the PMDs (which will change to unlimited most
>of the PMDs), limit the number to a small sufficient amount.
>
>Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
>---
> test/test/test_cryptodev.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
>diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
>index 389f79677..5c906cfae 100644
>--- a/test/test/test_cryptodev.c
>+++ b/test/test/test_cryptodev.c
>@@ -39,6 +39,7 @@
> #include "test_cryptodev_hmac_test_vectors.h"
>
> #define VDEV_ARGS_SIZE 100
>+#define MAX_NB_SESSIONS 4
>
> static int gbl_driver_id;
>
>@@ -435,9 +436,16 @@ testsuite_setup(void)
> * Create mempool with maximum number of sessions * 2,
> * to include the session headers
> */
>+ if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
>+ RTE_LOG(ERR, USER1, "Device does not support "
>+ "at least %u sessions\n",
>+ MAX_NB_SESSIONS);
>+ return TEST_FAILED;
>+ }
>+
If info.sym.max_nb_sessions = 0, won't it fail from here?
Thanks
Shally
> ts_params->session_mpool = rte_mempool_create(
> "test_sess_mp",
>- info.sym.max_nb_sessions * 2,
>+ MAX_NB_SESSIONS * 2,
> session_size,
> 0, 0, NULL, NULL, NULL,
> NULL, SOCKET_ID_ANY,
>@@ -6499,10 +6507,10 @@ test_multi_session(void)
>
> sessions = rte_malloc(NULL,
> (sizeof(struct rte_cryptodev_sym_session *) *
>- dev_info.sym.max_nb_sessions) + 1, 0);
>+ MAX_NB_SESSIONS) + 1, 0);
>
> /* Create multiple crypto sessions*/
>- for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
>+ for (i = 0; i < MAX_NB_SESSIONS; i++) {
>
> sessions[i] = rte_cryptodev_sym_session_create(
> ts_params->session_mpool);
>@@ -6551,7 +6559,7 @@ test_multi_session(void)
> TEST_ASSERT_NULL(sessions[i],
> "Session creation succeeded unexpectedly!");
>
>- for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
>+ for (i = 0; i < MAX_NB_SESSIONS; i++) {
> rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
> sessions[i]);
> rte_cryptodev_sym_session_free(sessions[i]);
>@@ -6610,7 +6618,7 @@ test_multi_session_random_usage(void)
>
> sessions = rte_malloc(NULL,
> (sizeof(struct rte_cryptodev_sym_session *)
>- * dev_info.sym.max_nb_sessions) + 1, 0);
>+ * MAX_NB_SESSIONS) + 1, 0);
>
> for (i = 0; i < MB_SESSION_NUMBER; i++) {
> sessions[i] = rte_cryptodev_sym_session_create(
>@@ -8538,6 +8546,13 @@ test_scheduler_attach_slave_op(void)
> unsigned int session_size =
> rte_cryptodev_sym_get_private_session_size(i);
>
>+ if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
>+ RTE_LOG(ERR, USER1,
>+ "Device does not support "
>+ "at least %u sessions\n",
>+ MAX_NB_SESSIONS);
>+ return TEST_FAILED;
>+ }
> /*
> * Create mempool with maximum number of sessions * 2,
> * to include the session headers
>@@ -8545,7 +8560,7 @@ test_scheduler_attach_slave_op(void)
> if (ts_params->session_mpool == NULL) {
> ts_params->session_mpool = rte_mempool_create(
> "test_sess_mp",
>- info.sym.max_nb_sessions * 2,
>+ MAX_NB_SESSIONS * 2,
> session_size,
> 0, 0, NULL, NULL, NULL,
> NULL, SOCKET_ID_ANY,
>--
>2.14.4
Hi Shally,
On 7/5/2018 4:57 PM, Verma, Shally wrote:
>
>> -----Original Message-----
>> From: Pablo de Lara [mailto:pablo.de.lara.guarch@intel.com]
>> Sent: 05 July 2018 07:38
>> To: declan.doherty@intel.com; akhil.goyal@nxp.com; Verma, Shally <Shally.Verma@cavium.com>; ravi1.kumar@amd.com; Jacob,
>> Jerin <Jerin.JacobKollanukkaran@cavium.com>; roy.fan.zhang@intel.com; fiona.trahe@intel.com; tdu@semihalf.com;
>> jianjay.zhou@huawei.com
>> Cc: dev@dpdk.org; Pablo de Lara <pablo.de.lara.guarch@intel.com>
>> Subject: [PATCH v5 04/16] test/crypto: limit number of sessions
>>
>> External Email
>>
>> Instead of using the maximum number of sessions
>> allowed by the PMDs (which will change to unlimited most
>> of the PMDs), limit the number to a small sufficient amount.
>>
>> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
>> Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
>> ---
>> test/test/test_cryptodev.c | 27 +++++++++++++++++++++------
>> 1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/test/test/test_cryptodev.c b/test/test/test_cryptodev.c
>> index 389f79677..5c906cfae 100644
>> --- a/test/test/test_cryptodev.c
>> +++ b/test/test/test_cryptodev.c
>> @@ -39,6 +39,7 @@
>> #include "test_cryptodev_hmac_test_vectors.h"
>>
>> #define VDEV_ARGS_SIZE 100
>> +#define MAX_NB_SESSIONS 4
>>
>> static int gbl_driver_id;
>>
>> @@ -435,9 +436,16 @@ testsuite_setup(void)
>> * Create mempool with maximum number of sessions * 2,
>> * to include the session headers
>> */
>> + if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
>> + RTE_LOG(ERR, USER1, "Device does not support "
>> + "at least %u sessions\n",
>> + MAX_NB_SESSIONS);
>> + return TEST_FAILED;
>> + }
>> +
> If info.sym.max_nb_sessions = 0, won't it fail from here?
It is added in 8/16 of this series. Till this patch 0 is not a valid value.
> Thanks
> Shally
>
@@ -39,6 +39,7 @@
#include "test_cryptodev_hmac_test_vectors.h"
#define VDEV_ARGS_SIZE 100
+#define MAX_NB_SESSIONS 4
static int gbl_driver_id;
@@ -435,9 +436,16 @@ testsuite_setup(void)
* Create mempool with maximum number of sessions * 2,
* to include the session headers
*/
+ if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
+ RTE_LOG(ERR, USER1, "Device does not support "
+ "at least %u sessions\n",
+ MAX_NB_SESSIONS);
+ return TEST_FAILED;
+ }
+
ts_params->session_mpool = rte_mempool_create(
"test_sess_mp",
- info.sym.max_nb_sessions * 2,
+ MAX_NB_SESSIONS * 2,
session_size,
0, 0, NULL, NULL, NULL,
NULL, SOCKET_ID_ANY,
@@ -6499,10 +6507,10 @@ test_multi_session(void)
sessions = rte_malloc(NULL,
(sizeof(struct rte_cryptodev_sym_session *) *
- dev_info.sym.max_nb_sessions) + 1, 0);
+ MAX_NB_SESSIONS) + 1, 0);
/* Create multiple crypto sessions*/
- for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
+ for (i = 0; i < MAX_NB_SESSIONS; i++) {
sessions[i] = rte_cryptodev_sym_session_create(
ts_params->session_mpool);
@@ -6551,7 +6559,7 @@ test_multi_session(void)
TEST_ASSERT_NULL(sessions[i],
"Session creation succeeded unexpectedly!");
- for (i = 0; i < dev_info.sym.max_nb_sessions; i++) {
+ for (i = 0; i < MAX_NB_SESSIONS; i++) {
rte_cryptodev_sym_session_clear(ts_params->valid_devs[0],
sessions[i]);
rte_cryptodev_sym_session_free(sessions[i]);
@@ -6610,7 +6618,7 @@ test_multi_session_random_usage(void)
sessions = rte_malloc(NULL,
(sizeof(struct rte_cryptodev_sym_session *)
- * dev_info.sym.max_nb_sessions) + 1, 0);
+ * MAX_NB_SESSIONS) + 1, 0);
for (i = 0; i < MB_SESSION_NUMBER; i++) {
sessions[i] = rte_cryptodev_sym_session_create(
@@ -8538,6 +8546,13 @@ test_scheduler_attach_slave_op(void)
unsigned int session_size =
rte_cryptodev_sym_get_private_session_size(i);
+ if (info.sym.max_nb_sessions < MAX_NB_SESSIONS) {
+ RTE_LOG(ERR, USER1,
+ "Device does not support "
+ "at least %u sessions\n",
+ MAX_NB_SESSIONS);
+ return TEST_FAILED;
+ }
/*
* Create mempool with maximum number of sessions * 2,
* to include the session headers
@@ -8545,7 +8560,7 @@ test_scheduler_attach_slave_op(void)
if (ts_params->session_mpool == NULL) {
ts_params->session_mpool = rte_mempool_create(
"test_sess_mp",
- info.sym.max_nb_sessions * 2,
+ MAX_NB_SESSIONS * 2,
session_size,
0, 0, NULL, NULL, NULL,
NULL, SOCKET_ID_ANY,