From: Andre Muezerie <andremue@linux.microsoft.com>
To: stephen@networkplumber.org
Cc: aman.deep.singh@intel.com, anatoly.burakov@intel.com,
andrew.rybchenko@oktetlabs.ru, bruce.richardson@intel.com,
dev@dpdk.org, dmitry.kozliuk@gmail.com, dsosnowski@nvidia.com,
fanzhang.oss@gmail.com, fengchengwen@huawei.com,
ferruh.yigit@amd.com, gakhil@marvell.com,
harry.van.haaren@intel.com, hkalra@marvell.com,
honnappa.nagarahalli@arm.com, hujiayu.hu@foxmail.com,
jingjing.wu@intel.com, kevin.laatz@intel.com,
konstantin.v.ananyev@yandex.ru, matan@nvidia.com,
mb@smartsharesystems.com, orika@nvidia.com,
pallavi.kadam@intel.com, reshma.pattan@intel.com,
roretzla@linux.microsoft.com, sameh.gobriel@intel.com,
suanmingm@nvidia.com, thomas@monjalon.net, vfialko@marvell.com,
viacheslavo@nvidia.com, vladimir.medvedkin@intel.com,
yipeng1.wang@intel.com
Subject: [PATCH v4 10/19] test: remove use of VLAs for Windows built code
Date: Mon, 4 Nov 2024 19:15:44 -0800 [thread overview]
Message-ID: <1730776553-31277-11-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1730776553-31277-1-git-send-email-andremue@linux.microsoft.com>
From: Tyler Retzlaff <roretzla@linux.microsoft.com>
MSVC does not support VLAs, replace VLAs with standard C arrays
or alloca(). alloca() is available for all toolchain/platform
combinations officially supported by DPDK.
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
app/test/test.c | 2 +-
app/test/test_cmdline_string.c | 2 +-
app/test/test_cryptodev.c | 34 +++++++++----------
app/test/test_cryptodev_blockcipher.c | 4 +--
app/test/test_cryptodev_crosscheck.c | 2 +-
app/test/test_dmadev.c | 9 +++--
app/test/test_hash.c | 14 ++++----
app/test/test_mempool.c | 25 +++++++-------
app/test/test_reorder.c | 48 +++++++++++++++------------
app/test/test_service_cores.c | 9 +++--
app/test/test_thash.c | 7 ++--
11 files changed, 82 insertions(+), 74 deletions(-)
diff --git a/app/test/test.c b/app/test/test.c
index 680351f6a3..fd653cbbfd 100644
--- a/app/test/test.c
+++ b/app/test/test.c
@@ -105,7 +105,7 @@ int
main(int argc, char **argv)
{
struct cmdline *cl;
- char *tests[argc]; /* store an array of tests to run */
+ char **tests = alloca(sizeof(char *) * argc); /* store an array of tests to run */
int test_count = 0;
int i;
char *extra_args;
diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c
index 97516c9400..e1cf86020f 100644
--- a/app/test/test_cmdline_string.c
+++ b/app/test/test_cmdline_string.c
@@ -40,7 +40,7 @@ struct string_elt_str string_elt_strs[] = {
#if (CMDLINE_TEST_BUFSIZE < STR_TOKEN_SIZE) \
|| (CMDLINE_TEST_BUFSIZE < STR_MULTI_TOKEN_SIZE)
#undef CMDLINE_TEST_BUFSIZE
-#define CMDLINE_TEST_BUFSIZE RTE_MAX(STR_TOKEN_SIZE, STR_MULTI_TOKEN_SIZE)
+#define CMDLINE_TEST_BUFSIZE RTE_MAX_T(STR_TOKEN_SIZE, STR_MULTI_TOKEN_SIZE, size_t)
#endif
struct string_nb_str {
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 25eef342b0..888a3bfa21 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -2885,7 +2885,7 @@ create_wireless_algo_hash_session(uint8_t dev_id,
enum rte_crypto_auth_operation op,
enum rte_crypto_auth_algorithm algo)
{
- uint8_t hash_key[key_len];
+ uint8_t *hash_key = alloca(key_len);
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -2921,7 +2921,7 @@ create_wireless_algo_cipher_session(uint8_t dev_id,
const uint8_t *key, const uint8_t key_len,
uint8_t iv_len)
{
- uint8_t cipher_key[key_len];
+ uint8_t *cipher_key = alloca(key_len);
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -3073,7 +3073,7 @@ create_wireless_cipher_auth_session(uint8_t dev_id,
const struct wireless_test_data *tdata)
{
const uint8_t key_len = tdata->key.len;
- uint8_t cipher_auth_key[key_len];
+ uint8_t *cipher_auth_key = alloca(key_len);
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -9077,7 +9077,7 @@ create_aead_session(uint8_t dev_id, enum rte_crypto_aead_algorithm algo,
const uint16_t aad_len, const uint8_t auth_len,
uint8_t iv_len)
{
- uint8_t aead_key[key_len];
+ uint8_t *aead_key = alloca(key_len);
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -12991,7 +12991,7 @@ test_cryptodev_error_recover_helper(uint8_t dev_id, const void *test_data, bool
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
const struct blockcipher_test_data *tdata = test_data;
- uint8_t cipher_key[tdata->cipher_key.len];
+ uint8_t *cipher_key = alloca(tdata->cipher_key.len);
struct rte_crypto_sym_op *sym_op = NULL;
struct rte_crypto_op *op = NULL;
char *dst;
@@ -13345,7 +13345,7 @@ static int
test_AES_GCM_auth_encryption_fail_aad_corrupt(void)
{
struct aead_test_data tdata;
- uint8_t aad[gcm_test_case_7.aad.len];
+ uint8_t *aad = alloca(gcm_test_case_7.aad.len);
int res;
RTE_LOG(INFO, USER1, "This is a negative test, errors are expected\n");
@@ -13734,7 +13734,7 @@ static int
test_AES_GCM_auth_decryption_fail_aad_corrupt(void)
{
struct aead_test_data tdata;
- uint8_t aad[gcm_test_case_7.aad.len];
+ uint8_t *aad = alloca(gcm_test_case_7.aad.len);
int res;
memcpy(&tdata, &gcm_test_case_7, sizeof(struct aead_test_data));
@@ -13986,7 +13986,7 @@ test_authenticated_encryption_sessionless(
int retval;
uint8_t *ciphertext, *auth_tag;
uint16_t plaintext_pad_len;
- uint8_t key[tdata->key.len + 1];
+ uint8_t *key = alloca(tdata->key.len + 1);
struct rte_cryptodev_info dev_info;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -14088,7 +14088,7 @@ test_authenticated_decryption_sessionless(
int retval;
uint8_t *plaintext;
- uint8_t key[tdata->key.len + 1];
+ uint8_t *key = alloca(tdata->key.len + 1);
struct rte_cryptodev_info dev_info;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -15473,7 +15473,7 @@ static int create_gmac_session(uint8_t dev_id,
const struct gmac_test_data *tdata,
enum rte_crypto_auth_operation auth_op)
{
- uint8_t auth_key[tdata->key.len];
+ uint8_t *auth_key = alloca(tdata->key.len);
struct crypto_testsuite_params *ts_params = &testsuite_params;
struct crypto_unittest_params *ut_params = &unittest_params;
@@ -16130,7 +16130,7 @@ create_auth_session(struct crypto_unittest_params *ut_params,
enum rte_crypto_auth_operation auth_op)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
- uint8_t auth_key[reference->auth_key.len + 1];
+ uint8_t *auth_key = alloca(reference->auth_key.len + 1);
memcpy(auth_key, reference->auth_key.data, reference->auth_key.len);
@@ -16161,8 +16161,8 @@ create_auth_cipher_session(struct crypto_unittest_params *ut_params,
enum rte_crypto_cipher_operation cipher_op)
{
struct crypto_testsuite_params *ts_params = &testsuite_params;
- uint8_t cipher_key[reference->cipher_key.len + 1];
- uint8_t auth_key[reference->auth_key.len + 1];
+ uint8_t *cipher_key = alloca(reference->cipher_key.len + 1);
+ uint8_t *auth_key = alloca(reference->auth_key.len + 1);
memcpy(cipher_key, reference->cipher_key.data,
reference->cipher_key.len);
@@ -16662,8 +16662,8 @@ test_authenticated_encrypt_with_esn(
uint8_t *authciphertext, *plaintext, *auth_tag;
uint16_t plaintext_pad_len;
- uint8_t cipher_key[reference->cipher_key.len + 1];
- uint8_t auth_key[reference->auth_key.len + 1];
+ uint8_t *cipher_key = alloca(reference->cipher_key.len + 1);
+ uint8_t *auth_key = alloca(reference->auth_key.len + 1);
struct rte_cryptodev_info dev_info;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
@@ -16794,8 +16794,8 @@ test_authenticated_decrypt_with_esn(
int retval;
uint8_t *ciphertext;
- uint8_t cipher_key[reference->cipher_key.len + 1];
- uint8_t auth_key[reference->auth_key.len + 1];
+ uint8_t *cipher_key = alloca(reference->cipher_key.len + 1);
+ uint8_t *auth_key = alloca(reference->auth_key.len + 1);
struct rte_cryptodev_info dev_info;
rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
diff --git a/app/test/test_cryptodev_blockcipher.c b/app/test/test_cryptodev_blockcipher.c
index 8e13cdfc7a..5a124bbb5e 100644
--- a/app/test/test_cryptodev_blockcipher.c
+++ b/app/test/test_cryptodev_blockcipher.c
@@ -85,8 +85,8 @@ test_blockcipher_one_case(const struct blockcipher_test_case *t,
int status = TEST_SUCCESS;
const struct blockcipher_test_data *tdata = t->test_data;
- uint8_t cipher_key[tdata->cipher_key.len];
- uint8_t auth_key[tdata->auth_key.len];
+ uint8_t *cipher_key = alloca(tdata->cipher_key.len);
+ uint8_t *auth_key = alloca(tdata->auth_key.len);
uint32_t buf_len = tdata->ciphertext.len;
uint32_t digest_len = tdata->digest.len;
char *buf_p = NULL;
diff --git a/app/test/test_cryptodev_crosscheck.c b/app/test/test_cryptodev_crosscheck.c
index c29b19cf6b..b9a53a430c 100644
--- a/app/test/test_cryptodev_crosscheck.c
+++ b/app/test/test_cryptodev_crosscheck.c
@@ -894,7 +894,7 @@ static int
crosscheck_with_profile_run(const struct crosscheck_test_profile *profile)
{
struct crosscheck_testsuite_params *ts_params = &testsuite_params;
- uint8_t input_text[profile->input_buf_len];
+ uint8_t *input_text = alloca(profile->input_buf_len);
uint16_t output_len, encrypted_len;
uint8_t encrypted_text[MBUF_SIZE];
uint8_t output_text[MBUF_SIZE];
diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 143e1bcd68..9cbb9a6552 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -417,9 +417,12 @@ test_enqueue_sg_copies(int16_t dev_id, uint16_t vchan)
dst_len = len / n_dst;
src_len = len / n_src;
- struct rte_dma_sge sg_src[n_sge], sg_dst[n_sge];
- struct rte_mbuf *src[n_sge], *dst[n_sge];
- char *src_data[n_sge], *dst_data[n_sge];
+ struct rte_dma_sge *sg_src = alloca(sizeof(struct rte_dma_sge) * n_sge);
+ struct rte_dma_sge *sg_dst = alloca(sizeof(struct rte_dma_sge) * n_sge);
+ struct rte_mbuf **src = alloca(sizeof(struct rte_mbuf *) * n_sge);
+ struct rte_mbuf **dst = alloca(sizeof(struct rte_mbuf *) * n_sge);
+ char **src_data = alloca(sizeof(char *) * n_sge);
+ char **dst_data = alloca(sizeof(char *) * n_sge);
for (i = 0 ; i < len; i++)
orig_src[i] = rte_rand() & 0xFF;
diff --git a/app/test/test_hash.c b/app/test/test_hash.c
index 65b9cad93c..16e63d2926 100644
--- a/app/test/test_hash.c
+++ b/app/test/test_hash.c
@@ -1947,6 +1947,8 @@ test_hash_rcu_qsbr_add(void)
return 0;
}
+#define HASH_RCU_QSBR_MAX_TOTAL_ENTRIES 9
+
/*
* rte_hash_rcu_qsbr_add DQ mode functional test.
* Reader and writer are in the same thread in this test.
@@ -1966,7 +1968,7 @@ test_hash_rcu_qsbr_add(void)
static int
test_hash_rcu_qsbr_dq_mode(uint8_t ext_bkt)
{
- uint32_t total_entries = (ext_bkt == 0) ? 8 : 9;
+ const uint32_t total_entries = (ext_bkt == 0) ? 8 : HASH_RCU_QSBR_MAX_TOTAL_ENTRIES;
uint8_t hash_extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF;
@@ -1982,8 +1984,8 @@ test_hash_rcu_qsbr_dq_mode(uint8_t ext_bkt)
.socket_id = 0,
.extra_flag = hash_extra_flag,
};
- int pos[total_entries];
- int expected_pos[total_entries];
+ int pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES];
+ int expected_pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES];
unsigned int i;
size_t sz;
int32_t status;
@@ -2136,7 +2138,7 @@ test_hash_rcu_qsbr_reader(void *arg)
static int
test_hash_rcu_qsbr_sync_mode(uint8_t ext_bkt)
{
- uint32_t total_entries = (ext_bkt == 0) ? 8 : 9;
+ const uint32_t total_entries = (ext_bkt == 0) ? 8 : HASH_RCU_QSBR_MAX_TOTAL_ENTRIES;
uint8_t hash_extra_flag = RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF;
@@ -2152,8 +2154,8 @@ test_hash_rcu_qsbr_sync_mode(uint8_t ext_bkt)
.socket_id = 0,
.extra_flag = hash_extra_flag,
};
- int pos[total_entries];
- int expected_pos[total_entries];
+ int pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES];
+ int expected_pos[HASH_RCU_QSBR_MAX_TOTAL_ENTRIES];
unsigned int i;
size_t sz;
int32_t status;
diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c
index 3f7ba5872d..61385e096e 100644
--- a/app/test/test_mempool.c
+++ b/app/test/test_mempool.c
@@ -515,19 +515,20 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
#undef RTE_TEST_TRACE_FAILURE
#define RTE_TEST_TRACE_FAILURE(...) do { goto fail; } while (0)
- static const size_t callback_num = 3;
- static const size_t mempool_num = 2;
+#define CALLBACK_NUM 3u
+#define MEMPOOL_NUM 2u
+
static const unsigned int mempool_elt_size = 64;
static const unsigned int mempool_size = 64;
- struct test_mempool_events_data data[callback_num];
- struct rte_mempool *mp[mempool_num], *freed;
+ struct test_mempool_events_data data[CALLBACK_NUM];
+ struct rte_mempool *mp[MEMPOOL_NUM], *freed;
char name[RTE_MEMPOOL_NAMESIZE];
size_t i, j;
int ret;
memset(mp, 0, sizeof(mp));
- for (i = 0; i < callback_num; i++) {
+ for (i = 0; i < CALLBACK_NUM; i++) {
ret = rte_mempool_event_callback_register
(test_mempool_events_cb, &data[i]);
RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to register the callback %zu: %s",
@@ -548,7 +549,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
SOCKET_ID_ANY, 0);
RTE_TEST_ASSERT_NOT_NULL(mp[0], "Cannot create mempool %s: %s",
name, rte_strerror(rte_errno));
- for (j = 0; j < callback_num; j++)
+ for (j = 0; j < CALLBACK_NUM; j++)
RTE_TEST_ASSERT_EQUAL(data[j].invoked, false,
"Callback %zu invoked on %s mempool creation",
j, name);
@@ -557,7 +558,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
ret = populate(mp[0]);
RTE_TEST_ASSERT_EQUAL(ret, (int)mp[0]->size, "Failed to populate mempool %s: %s",
name, rte_strerror(-ret));
- for (j = 0; j < callback_num; j++) {
+ for (j = 0; j < CALLBACK_NUM; j++) {
RTE_TEST_ASSERT_EQUAL(data[j].invoked, true,
"Callback %zu not invoked on mempool %s population",
j, name);
@@ -589,7 +590,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
"Unregistered callback 0 invoked on %s mempool populaton",
name);
- for (i = 0; i < mempool_num; i++) {
+ for (i = 0; i < MEMPOOL_NUM; i++) {
memset(&data, 0, sizeof(data));
sprintf(name, "empty%zu", i);
rte_mempool_free(mp[i]);
@@ -599,7 +600,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
*/
freed = mp[i];
mp[i] = NULL;
- for (j = 1; j < callback_num; j++) {
+ for (j = 1; j < CALLBACK_NUM; j++) {
RTE_TEST_ASSERT_EQUAL(data[j].invoked, true,
"Callback %zu not invoked on mempool %s destruction",
j, name);
@@ -615,7 +616,7 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
name);
}
- for (j = 1; j < callback_num; j++) {
+ for (j = 1; j < CALLBACK_NUM; j++) {
ret = rte_mempool_event_callback_unregister
(test_mempool_events_cb, &data[j]);
RTE_TEST_ASSERT_EQUAL(ret, 0, "Failed to unregister the callback %zu: %s",
@@ -624,10 +625,10 @@ test_mempool_events(int (*populate)(struct rte_mempool *mp))
return TEST_SUCCESS;
fail:
- for (j = 0; j < callback_num; j++)
+ for (j = 0; j < CALLBACK_NUM; j++)
rte_mempool_event_callback_unregister
(test_mempool_events_cb, &data[j]);
- for (i = 0; i < mempool_num; i++)
+ for (i = 0; i < MEMPOOL_NUM; i++)
rte_mempool_free(mp[i]);
return TEST_FAILED;
diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
index 501780cb26..aaa2c57086 100644
--- a/app/test/test_reorder.c
+++ b/app/test/test_reorder.c
@@ -130,11 +130,12 @@ test_reorder_free(void)
static int
test_reorder_insert(void)
{
+#define INSERT_NUM_BUFS 7u
+
struct rte_reorder_buffer *b = NULL;
struct rte_mempool *p = test_params->p;
const unsigned int size = 4;
- const unsigned int num_bufs = 7;
- struct rte_mbuf *bufs[num_bufs];
+ struct rte_mbuf *bufs[INSERT_NUM_BUFS];
int ret = 0;
unsigned i;
@@ -146,7 +147,7 @@ test_reorder_insert(void)
b = rte_reorder_create("test_insert", rte_socket_id(), size);
TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer");
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < INSERT_NUM_BUFS; i++) {
bufs[i] = rte_pktmbuf_alloc(p);
TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n");
*rte_reorder_seqn(bufs[i]) = i;
@@ -207,26 +208,27 @@ test_reorder_insert(void)
ret = 0;
exit:
rte_reorder_free(b);
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < INSERT_NUM_BUFS; i++)
rte_pktmbuf_free(bufs[i]);
- }
+
return ret;
}
static int
test_reorder_drain(void)
{
+#define DRAIN_NUM_BUFS 8u
+
struct rte_reorder_buffer *b = NULL;
struct rte_mempool *p = test_params->p;
const unsigned int size = 4;
- const unsigned int num_bufs = 8;
- struct rte_mbuf *bufs[num_bufs];
- struct rte_mbuf *robufs[num_bufs];
+ struct rte_mbuf *bufs[DRAIN_NUM_BUFS];
+ struct rte_mbuf *robufs[DRAIN_NUM_BUFS];
int ret = 0;
unsigned i, cnt;
/* initialize all robufs to NULL */
- for (i = 0; i < num_bufs; i++)
+ for (i = 0; i < DRAIN_NUM_BUFS; i++)
robufs[i] = NULL;
/* This would create a reorder buffer instance consisting of:
@@ -246,7 +248,7 @@ test_reorder_drain(void)
goto exit;
}
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < DRAIN_NUM_BUFS; i++) {
bufs[i] = rte_pktmbuf_alloc(p);
TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n");
*rte_reorder_seqn(bufs[i]) = i;
@@ -320,7 +322,7 @@ test_reorder_drain(void)
ret = 0;
exit:
rte_reorder_free(b);
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < DRAIN_NUM_BUFS; i++) {
rte_pktmbuf_free(bufs[i]);
rte_pktmbuf_free(robufs[i]);
}
@@ -337,15 +339,16 @@ buffer_to_reorder_move(struct rte_mbuf **mbuf, struct rte_reorder_buffer *b)
static int
test_reorder_drain_up_to_seqn(void)
{
+#define DRAIN_TO_NUM_BUFS 10u
+
struct rte_mempool *p = test_params->p;
struct rte_reorder_buffer *b = NULL;
- const unsigned int num_bufs = 10;
const unsigned int size = 4;
unsigned int i, cnt;
int ret = 0;
- struct rte_mbuf *bufs[num_bufs];
- struct rte_mbuf *robufs[num_bufs];
+ struct rte_mbuf *bufs[DRAIN_TO_NUM_BUFS];
+ struct rte_mbuf *robufs[DRAIN_TO_NUM_BUFS];
/* initialize all robufs to NULL */
memset(robufs, 0, sizeof(robufs));
@@ -358,7 +361,7 @@ test_reorder_drain_up_to_seqn(void)
b = rte_reorder_create("test_drain_up_to_seqn", rte_socket_id(), size);
TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer");
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < DRAIN_TO_NUM_BUFS; i++) {
bufs[i] = rte_pktmbuf_alloc(p);
TEST_ASSERT_NOT_NULL(bufs[i], "Packet allocation failed\n");
*rte_reorder_seqn(bufs[i]) = i;
@@ -372,7 +375,7 @@ test_reorder_drain_up_to_seqn(void)
buffer_to_reorder_move(&bufs[2], b);
buffer_to_reorder_move(&bufs[3], b);
/* Draining 1, 2 */
- cnt = rte_reorder_drain_up_to_seqn(b, robufs, num_bufs, 3);
+ cnt = rte_reorder_drain_up_to_seqn(b, robufs, DRAIN_TO_NUM_BUFS, 3);
if (cnt != 2) {
printf("%s:%d:%d: number of expected packets not drained\n",
__func__, __LINE__, cnt);
@@ -396,7 +399,7 @@ test_reorder_drain_up_to_seqn(void)
buffer_to_reorder_move(&bufs[8], b);
/* Drain 3 and 5 */
- cnt = rte_reorder_drain_up_to_seqn(b, robufs, num_bufs, 6);
+ cnt = rte_reorder_drain_up_to_seqn(b, robufs, DRAIN_TO_NUM_BUFS, 6);
if (cnt != 2) {
printf("%s:%d:%d: number of expected packets not drained\n",
__func__, __LINE__, cnt);
@@ -410,7 +413,7 @@ test_reorder_drain_up_to_seqn(void)
ret = 0;
exit:
rte_reorder_free(b);
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < DRAIN_TO_NUM_BUFS; i++) {
rte_pktmbuf_free(bufs[i]);
rte_pktmbuf_free(robufs[i]);
}
@@ -420,14 +423,15 @@ test_reorder_drain_up_to_seqn(void)
static int
test_reorder_set_seqn(void)
{
+#define SET_SEQN_NUM_BUFS 7u
+
struct rte_mempool *p = test_params->p;
struct rte_reorder_buffer *b = NULL;
- const unsigned int num_bufs = 7;
const unsigned int size = 4;
unsigned int i;
int ret = 0;
- struct rte_mbuf *bufs[num_bufs];
+ struct rte_mbuf *bufs[SET_SEQN_NUM_BUFS];
/* This would create a reorder buffer instance consisting of:
* reorder_seq = 0
@@ -437,7 +441,7 @@ test_reorder_set_seqn(void)
b = rte_reorder_create("test_min_seqn_set", rte_socket_id(), size);
TEST_ASSERT_NOT_NULL(b, "Failed to create reorder buffer");
- for (i = 0; i < num_bufs; i++) {
+ for (i = 0; i < SET_SEQN_NUM_BUFS; i++) {
bufs[i] = rte_pktmbuf_alloc(p);
if (bufs[i] == NULL) {
printf("Packet allocation failed\n");
@@ -479,7 +483,7 @@ test_reorder_set_seqn(void)
ret = 0;
exit:
rte_reorder_free(b);
- for (i = 0; i < num_bufs; i++)
+ for (i = 0; i < SET_SEQN_NUM_BUFS; i++)
rte_pktmbuf_free(bufs[i]);
return ret;
diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c
index 46ed9a1868..d95a71f80b 100644
--- a/app/test/test_service_cores.c
+++ b/app/test/test_service_cores.c
@@ -603,9 +603,8 @@ service_lcore_add_del(void)
"Service core count not equal to one");
/* retrieve core list, checking lcore ids */
- const uint32_t size = 4;
- uint32_t service_core_ids[size];
- int32_t n = rte_service_lcore_list(service_core_ids, size);
+ uint32_t service_core_ids[4];
+ int32_t n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids));
TEST_ASSERT_EQUAL(1, n, "Service core list return should equal 1");
TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
"Service core list lcore must equal slcore_id");
@@ -631,7 +630,7 @@ service_lcore_add_del(void)
cores_at_this_point);
/* check longer service core list */
- n = rte_service_lcore_list(service_core_ids, size);
+ n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids));
TEST_ASSERT_EQUAL(3, n, "Service core list return should equal 3");
TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
"Service core list[0] lcore must equal 1");
@@ -649,7 +648,7 @@ service_lcore_add_del(void)
"Service core add did not return zero");
TEST_ASSERT_EQUAL(1, rte_service_lcore_count(),
"Service core count not equal to one");
- n = rte_service_lcore_list(service_core_ids, size);
+ n = rte_service_lcore_list(service_core_ids, RTE_DIM(service_core_ids));
TEST_ASSERT_EQUAL(1, n, "Service core list return should equal one");
TEST_ASSERT_EQUAL(slcore_id, service_core_ids[0],
"Service core list[0] lcore must equal %d",
diff --git a/app/test/test_thash.c b/app/test/test_thash.c
index 0ad6943cf8..d2f0c252ca 100644
--- a/app/test/test_thash.c
+++ b/app/test/test_thash.c
@@ -564,9 +564,8 @@ test_predictable_rss_min_seq(void)
{
struct rte_thash_ctx *ctx;
struct rte_thash_subtuple_helper *h;
- const int key_len = 40;
int reta_sz = 6;
- uint8_t initial_key[key_len];
+ uint8_t initial_key[40];
const uint8_t *new_key;
int ret;
union rte_thash_tuple tuple;
@@ -574,9 +573,9 @@ test_predictable_rss_min_seq(void)
unsigned int desired_value = 27 & HASH_MSK(reta_sz);
uint16_t port_value = 22;
- memset(initial_key, 0, key_len);
+ memset(initial_key, 0, RTE_DIM(initial_key));
- ctx = rte_thash_init_ctx("test", key_len, reta_sz, initial_key,
+ ctx = rte_thash_init_ctx("test", RTE_DIM(initial_key), reta_sz, initial_key,
RTE_THASH_MINIMAL_SEQ);
RTE_TEST_ASSERT(ctx != NULL, "can not create thash ctx\n");
--
2.34.1
next prev parent reply other threads:[~2024-11-05 3:18 UTC|newest]
Thread overview: 127+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 23:41 [PATCH 00/16] " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 01/16] eal: include header required for alloca Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 02/16] hash: remove use of VLAs for Windows built code Tyler Retzlaff
2024-04-18 6:45 ` Morten Brørup
2024-04-17 23:41 ` [PATCH 03/16] ethdev: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 04/16] gro: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 05/16] latencystats: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 06/16] lpm: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 07/16] rcu: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 08/16] app/testpmd: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 09/16] test: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 10/16] common/idpf: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 11/16] net/i40e: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 12/16] net/ice: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 13/16] net/ixgbe: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 14/16] common/mlx5: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 15/16] net/mlx5: " Tyler Retzlaff
2024-04-17 23:41 ` [PATCH 16/16] build: enable vla warnings on " Tyler Retzlaff
2024-04-18 6:48 ` Morten Brørup
2024-04-18 15:12 ` Tyler Retzlaff
2024-04-18 15:23 ` Bruce Richardson
2024-04-18 19:22 ` Morten Brørup
2024-04-18 6:49 ` [PATCH 00/16] remove use of VLAs for " Morten Brørup
2024-04-18 12:11 ` Konstantin Ananyev
2024-04-18 15:15 ` Tyler Retzlaff
2024-04-18 15:35 ` Konstantin Ananyev
2024-04-18 20:02 ` [PATCH v2 00/19] remove use of VLAs for Windows Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 01/19] eal: include header required for alloca Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 02/19] eal/linux: remove use of VLAs Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 03/19] eal/common: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 04/19] ethdev: remove use of VLAs for Windows built code Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 05/19] hash: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 06/19] hash/thash: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 07/19] rcu: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 08/19] gro: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 09/19] latencystats: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 10/19] lpm: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 11/19] app/testpmd: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 12/19] test: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 13/19] common/idpf: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 14/19] net/i40e: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 15/19] net/ice: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 16/19] net/ixgbe: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 17/19] common/mlx5: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 18/19] net/mlx5: " Tyler Retzlaff
2024-04-18 20:02 ` [PATCH v2 19/19] build: enable vla warnings on " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 00/19] remove use of VLAs for Windows Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 01/19] eal: include header required for alloca Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 02/19] eal/linux: remove use of VLAs Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 03/19] eal/common: " Tyler Retzlaff
2024-05-07 0:42 ` Stephen Hemminger
2024-05-06 18:18 ` [PATCH v3 04/19] ethdev: remove use of VLAs for Windows built code Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 05/19] hash: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 06/19] hash/thash: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 07/19] rcu: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 08/19] gro: " Tyler Retzlaff
2024-05-07 0:47 ` Stephen Hemminger
2024-05-06 18:18 ` [PATCH v3 09/19] latencystats: " Tyler Retzlaff
2024-05-07 0:47 ` Stephen Hemminger
2024-05-06 18:18 ` [PATCH v3 10/19] lpm: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 11/19] app/testpmd: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 12/19] test: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 13/19] common/idpf: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 14/19] net/i40e: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 15/19] net/ice: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 16/19] net/ixgbe: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 17/19] common/mlx5: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 18/19] net/mlx5: " Tyler Retzlaff
2024-05-06 18:18 ` [PATCH v3 19/19] build: enable vla warnings on " Tyler Retzlaff
2024-05-07 2:53 ` [PATCH 1/2] lpm: remove unnecessary temporary VLA Stephen Hemminger
2024-05-07 2:53 ` [PATCH 2/2] latencystats: replace use of VLA Stephen Hemminger
2024-07-09 8:06 ` David Marchand
2024-05-07 7:51 ` [PATCH 1/2] lpm: remove unnecessary temporary VLA Bruce Richardson
2024-07-09 8:26 ` [PATCH v3 00/19] remove use of VLAs for Windows David Marchand
2024-10-07 17:15 ` [PATCH 00/16] remove use of VLAs for Windows built code Stephen Hemminger
2024-11-01 18:06 ` Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 00/19] remove use of VLAs for Windows Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 01/19] eal: include header required for alloca Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 02/19] eal/linux: remove use of VLAs Andre Muezerie
2024-11-05 8:19 ` David Marchand
2024-11-06 2:02 ` Andre Muezerie
2024-11-08 13:44 ` Konstantin Ananyev
2024-11-05 3:15 ` [PATCH v4 03/19] eal/common: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 04/19] ethdev: remove use of VLAs for Windows built code Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 05/19] hash: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 06/19] hash/thash: remove use of VLAs for Windows built Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 07/19] rcu: remove use of VLAs for Windows built code Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 08/19] gro: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 09/19] app/testpmd: remove use of VLAs for Windows built Andre Muezerie
2024-11-05 3:15 ` Andre Muezerie [this message]
2024-11-05 3:15 ` [PATCH v4 11/19] common/idpf: remove use of VLAs for Windows built code Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 12/19] net/i40e: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 13/19] net/ice: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 14/19] net/ixgbe: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 15/19] common/mlx5: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 16/19] net/mlx5: " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 17/19] build: enable vla warnings on " Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 18/19] test: remove use of VLAs for Windows built code in bitset tests Andre Muezerie
2024-11-05 8:32 ` David Marchand
2024-11-06 2:06 ` Andre Muezerie
2024-11-05 3:15 ` [PATCH v4 19/19] app/testpmd: remove use of VLAs for Windows built code in shared_rxq_fwd Andre Muezerie
2024-11-05 9:37 ` [PATCH v4 00/19] remove use of VLAs for Windows Konstantin Ananyev
2024-11-08 0:44 ` [PATCH v5 00/20] " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 01/20] eal: include header required for alloca Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 02/20] eal/linux: remove use of VLAs Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 03/20] eal/common: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 04/20] ethdev: remove use of VLAs for Windows built code Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 05/20] hash: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 06/20] hash/thash: remove use of VLAs for Windows built Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 07/20] rcu: remove use of VLAs for Windows built code Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 08/20] net/ice: " Andre Muezerie
2024-11-08 8:51 ` Bruce Richardson
2024-11-08 10:18 ` Konstantin Ananyev
2024-11-08 0:44 ` [PATCH v5 09/20] gro: remove use of VLAs Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 10/20] net/ixgbe: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 11/20] net/ice: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 12/20] app/testpmd: remove use of VLAs for Windows built Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 13/20] test: remove use of VLAs for Windows built code Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 14/20] common/idpf: " Andre Muezerie
2024-11-08 8:47 ` Bruce Richardson
2024-11-08 0:44 ` [PATCH v5 15/20] net/i40e: " Andre Muezerie
2024-11-08 8:45 ` Bruce Richardson
2024-11-08 0:44 ` [PATCH v5 16/20] common/mlx5: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 17/20] net/mlx5: " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 18/20] build: enable vla warnings on " Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 19/20] test: remove use of VLAs for Windows built code in bitset tests Andre Muezerie
2024-11-08 0:44 ` [PATCH v5 20/20] app/testpmd: remove use of VLAs for Windows built code in shared_rxq_fwd Andre Muezerie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1730776553-31277-11-git-send-email-andremue@linux.microsoft.com \
--to=andremue@linux.microsoft.com \
--cc=aman.deep.singh@intel.com \
--cc=anatoly.burakov@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=dsosnowski@nvidia.com \
--cc=fanzhang.oss@gmail.com \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=gakhil@marvell.com \
--cc=harry.van.haaren@intel.com \
--cc=hkalra@marvell.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=hujiayu.hu@foxmail.com \
--cc=jingjing.wu@intel.com \
--cc=kevin.laatz@intel.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=matan@nvidia.com \
--cc=mb@smartsharesystems.com \
--cc=orika@nvidia.com \
--cc=pallavi.kadam@intel.com \
--cc=reshma.pattan@intel.com \
--cc=roretzla@linux.microsoft.com \
--cc=sameh.gobriel@intel.com \
--cc=stephen@networkplumber.org \
--cc=suanmingm@nvidia.com \
--cc=thomas@monjalon.net \
--cc=vfialko@marvell.com \
--cc=viacheslavo@nvidia.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).