Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/139421/?format=api
http://patches.dpdk.org/api/patches/139421/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240416152124.69590-3-stephen@networkplumber.org/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20240416152124.69590-3-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20240416152124.69590-3-stephen@networkplumber.org", "date": "2024-04-16T15:19:28", "name": "[2/5] app: use RTE_DIM", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "6e86973cefe56bae896ad3d771a638a4568562f9", "submitter": { "id": 27, "url": "http://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20240416152124.69590-3-stephen@networkplumber.org/mbox/", "series": [ { "id": 31757, "url": "http://patches.dpdk.org/api/series/31757/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=31757", "date": "2024-04-16T15:19:26", "name": "use RTE_DIM where possible", "version": 1, "mbox": "http://patches.dpdk.org/series/31757/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/139421/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/139421/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 8A5FB43E83;\n\tTue, 16 Apr 2024 17:21:47 +0200 (CEST)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3DD614067E;\n\tTue, 16 Apr 2024 17:21:33 +0200 (CEST)", "from mail-pl1-f170.google.com (mail-pl1-f170.google.com\n [209.85.214.170])\n by mails.dpdk.org (Postfix) with ESMTP id 0AE3F4028B\n for <dev@dpdk.org>; Tue, 16 Apr 2024 17:21:30 +0200 (CEST)", "by mail-pl1-f170.google.com with SMTP id\n d9443c01a7336-1e36b7e7dd2so36423785ad.1\n for <dev@dpdk.org>; Tue, 16 Apr 2024 08:21:29 -0700 (PDT)", "from hermes.lan (204-195-96-226.wavecable.com. [204.195.96.226])\n by smtp.gmail.com with ESMTPSA id\n l17-20020a170903245100b001e80154a400sm213348pls.126.2024.04.16.08.21.27\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 16 Apr 2024 08:21:28 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1713280889;\n x=1713885689; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=SXf8rsNlxTg2W7+ABh5D0c+4+ybfcOuKiyiT8vTpnzs=;\n b=KdvOpikWXenNLfG42RXHFtDv/xH1qwf1/JVnyL1J6LOlvKWt2ORI6SbGXPUNZejr5G\n ZeF//l5FKBByskKTPMy9P8rDmaQ8RJL5LTaPt3BwWRJALN+y37D0hpeC7vNOw0G4EPBc\n mrRnYnbvf/XMRGATf5KoXFkfcWzV+vrzLrH7DfRvoN6/Xqp3IRLpJJngyW69AEwEdAR8\n tlcXlp74d/L04lfXznJcjZyMdZ4U+s8tD17yg3sXlQ9gXlqCUDAIysx0Rc5zei/qfPZr\n XYWqXJI1YNigsf+GwCROIzXvEyYl++28U9DalvBrVC0QaCBQ7g0BuArgAVao76sKcdqP\n 1H5Q==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1713280889; x=1713885689;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=SXf8rsNlxTg2W7+ABh5D0c+4+ybfcOuKiyiT8vTpnzs=;\n b=gJFTPDh7rdiOQZv/atMzlgoIvjorAtjR13e8GCdVl9dim7nX0rEpK3snBr2l1e2pm0\n bgu34/w/0II5WWYp+/vGiWkVw4MLoqsNszMNRRP+x+Os5qxL7oE6r5j2xYXvKNhFu2rA\n vxPa9qfs+LfRjpvkRXp7CnwJA/n6w1Wg66zqc+lTJMlIuITqzEMyPMZgJjTpzKKXqOP6\n rUCxoeb5XiYT6FHxSOLtzI9NoaEBwGgjqM6GfUBT8O/95bQN7lGTF8sj5aREu0k4HUVA\n SwTgIP+1rXyCPgHSiEZIgwIAQKMy+jaGt37NZCvPekYpCVSv2hDDsVopGXdMAZ7a368D\n t6zw==", "X-Gm-Message-State": "AOJu0YyqUHLaPfZtQSkjeCOBNVRS7CidGh9/neet3o3YP9ePxH1uneoA\n 5PdD9qLbC6hVoQYoL4+y0QopW8hTRUuBnWGlMyy1Vj2AIhs3G/vjDs0RfXD0paps6pC+U8Bvo0e\n N", "X-Google-Smtp-Source": "\n AGHT+IEmu1MPAYs31frjDXDcqX7oeXbghW4k2rZFPUqk+Tl8kcKlei7pwxzjYSu96mnorR2oqgC7gA==", "X-Received": "by 2002:a17:902:d50a:b0:1e5:b82:3c24 with SMTP id\n b10-20020a170902d50a00b001e50b823c24mr13677225plg.53.1713280889183;\n Tue, 16 Apr 2024 08:21:29 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "dev@dpdk.org", "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n Wisam Jaddo <wisamm@nvidia.com>, Thomas Monjalon <thomas@monjalon.net>,\n Ferruh Yigit <ferruh.yigit@amd.com>,\n Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,\n Akhil Goyal <gakhil@marvell.com>, Anoob Joseph <anoobj@marvell.com>", "Subject": "[PATCH 2/5] app: use RTE_DIM", "Date": "Tue, 16 Apr 2024 08:19:28 -0700", "Message-ID": "<20240416152124.69590-3-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20240416152124.69590-1-stephen@networkplumber.org>", "References": "<20240416152124.69590-1-stephen@networkplumber.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Use RTE_DIM instead of computing directly with sizeof.\nPatch automatically generated via cocci/rte_dim.cocci.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n app/test-flow-perf/main.c | 4 +--\n app/test/test_ethdev_link.c | 3 +-\n app/test/test_security_inline_macsec.c | 47 +++++++++++++-------------\n 3 files changed, 25 insertions(+), 29 deletions(-)", "diff": "diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c\nindex e224ef6798..e9ef1ae04c 100644\n--- a/app/test-flow-perf/main.c\n+++ b/app/test-flow-perf/main.c\n@@ -965,9 +965,7 @@ args_parse(int argc, char **argv)\n \t\t\t\t\t\t\"meter-profile\") == 0) {\n \t\t\t\ti = 0;\n \t\t\t\ttoken = strsep(&optarg, \",\\0\");\n-\t\t\t\twhile (token != NULL && i < sizeof(\n-\t\t\t\t\t\tmeter_profile_values) /\n-\t\t\t\t\t\tsizeof(uint64_t)) {\n+\t\t\t\twhile (token != NULL && i < RTE_DIM(meter_profile_values)) {\n \t\t\t\t\tmeter_profile_values[i++] = atol(token);\n \t\t\t\t\ttoken = strsep(&optarg, \",\\0\");\n \t\t\t\t}\ndiff --git a/app/test/test_ethdev_link.c b/app/test/test_ethdev_link.c\nindex f063a5fe26..e305df71be 100644\n--- a/app/test/test_ethdev_link.c\n+++ b/app/test/test_ethdev_link.c\n@@ -135,8 +135,7 @@ test_link_speed_all_values(void)\n \t\t{ \"Invalid\", 50505 }\n \t};\n \n-\tfor (i = 0; i < sizeof(speed_str_map) / sizeof(struct link_speed_t);\n-\t\t\ti++) {\n+\tfor (i = 0; i < RTE_DIM(speed_str_map); i++) {\n \t\tspeed = rte_eth_link_speed_to_str(speed_str_map[i].link_speed);\n \t\tTEST_ASSERT_BUFFERS_ARE_EQUAL(speed_str_map[i].value,\n \t\t\tspeed, strlen(speed_str_map[i].value),\ndiff --git a/app/test/test_security_inline_macsec.c b/app/test/test_security_inline_macsec.c\nindex f11e9da8c3..26f7504dc2 100644\n--- a/app/test/test_security_inline_macsec.c\n+++ b/app/test/test_security_inline_macsec.c\n@@ -1294,7 +1294,7 @@ test_inline_macsec_encap_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n \t\terr = test_macsec(&cur_td, MCS_ENCAP, &opts);\n@@ -1332,7 +1332,7 @@ test_inline_macsec_decap_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n \t\terr = test_macsec(&cur_td, MCS_DECAP, &opts);\n@@ -1371,7 +1371,7 @@ test_inline_macsec_auth_only_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -1410,7 +1410,7 @@ test_inline_macsec_verify_only_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -1451,7 +1451,7 @@ test_inline_macsec_encap_decap_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n@@ -1492,7 +1492,7 @@ test_inline_macsec_auth_verify_all(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -1578,7 +1578,7 @@ test_inline_macsec_with_vlan(void)\n \topts.nb_td = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_vlan_vectors) / sizeof((list_mcs_vlan_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_vlan_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_vlan_vectors[i];\n@@ -1653,7 +1653,7 @@ test_inline_macsec_pkt_drop(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_err_cipher_vectors) / sizeof((list_mcs_err_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_err_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_err_cipher_vectors[i];\n@@ -1693,8 +1693,7 @@ test_inline_macsec_untagged_rx(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_untagged_rx = 1;\n \n-\tsize = (sizeof(list_mcs_untagged_cipher_vectors) /\n-\t\tsizeof((list_mcs_untagged_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_untagged_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_untagged_cipher_vectors[i];\n@@ -1747,7 +1746,7 @@ test_inline_macsec_bad_tag_rx(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_bad_tag_cnt = 1;\n \n-\tsize = (sizeof(list_mcs_bad_tag_vectors) / sizeof((list_mcs_bad_tag_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_bad_tag_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_bad_tag_vectors[i];\n@@ -1786,7 +1785,7 @@ test_inline_macsec_sa_not_in_use(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_sa_not_in_use = 1;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n@@ -1825,7 +1824,7 @@ test_inline_macsec_decap_stats(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_decap_stats = 1;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n@@ -1866,7 +1865,7 @@ test_inline_macsec_verify_only_stats(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_verify_only_stats = 1;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -1906,7 +1905,7 @@ test_inline_macsec_pkts_invalid_stats(void)\n \topts.sectag_insert_mode = 1;\n \topts.mtu = RTE_ETHER_MTU;\n \n-\tsize = (sizeof(list_mcs_err_cipher_vectors) / sizeof((list_mcs_err_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_err_cipher_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_err_cipher_vectors[i];\n@@ -1943,7 +1942,7 @@ test_inline_macsec_pkts_unchecked_stats(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_pkts_unchecked_stats = 1;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -1982,7 +1981,7 @@ test_inline_macsec_out_pkts_untagged(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_out_pkts_untagged = 1;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n \t\terr = test_macsec(&cur_td, MCS_ENCAP, &opts);\n@@ -2020,7 +2019,7 @@ test_inline_macsec_out_pkts_toolong(void)\n \topts.mtu = 50;\n \topts.check_out_pkts_toolong = 1;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n \t\terr = test_macsec(&cur_td, MCS_ENCAP, &opts);\n@@ -2058,7 +2057,7 @@ test_inline_macsec_encap_stats(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_encap_stats = 1;\n \n-\tsize = (sizeof(list_mcs_cipher_vectors) / sizeof((list_mcs_cipher_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_cipher_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_cipher_vectors[i];\n \t\terr = test_macsec(&cur_td, MCS_ENCAP, &opts);\n@@ -2095,7 +2094,7 @@ test_inline_macsec_auth_only_stats(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.check_auth_only_stats = 1;\n \n-\tsize = (sizeof(list_mcs_integrity_vectors) / sizeof((list_mcs_integrity_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_integrity_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_integrity_vectors[i];\n@@ -2146,7 +2145,7 @@ test_inline_macsec_interrupts_all(void)\n \trte_eth_dev_callback_register(port_id, RTE_ETH_EVENT_MACSEC,\n \t\t\ttest_macsec_event_callback, &err_vector);\n \n-\tsize = (sizeof(list_mcs_intr_test_vectors) / sizeof((list_mcs_intr_test_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_intr_test_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_intr_test_vectors[i];\n@@ -2194,7 +2193,7 @@ test_inline_macsec_rekey_tx(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.rekey_en = 1;\n \n-\tsize = (sizeof(list_mcs_rekey_vectors) / sizeof((list_mcs_rekey_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_rekey_vectors);\n \n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_rekey_vectors[i];\n@@ -2236,7 +2235,7 @@ test_inline_macsec_rekey_rx(void)\n \topts.mtu = RTE_ETHER_MTU;\n \topts.rekey_en = 1;\n \n-\tsize = (sizeof(list_mcs_rekey_vectors) / sizeof((list_mcs_rekey_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_rekey_vectors);\n \tfor (i = 0; i < size; i++) {\n \t\tcur_td = &list_mcs_rekey_vectors[i];\n \t\topts.rekey_td = &list_mcs_rekey_vectors[++i];\n@@ -2277,7 +2276,7 @@ test_inline_macsec_anti_replay(void)\n \topts.sectag_insert_mode = 1;\n \topts.replay_protect = 1;\n \n-\tsize = (sizeof(list_mcs_anti_replay_vectors) / sizeof((list_mcs_anti_replay_vectors)[0]));\n+\tsize = RTE_DIM(list_mcs_anti_replay_vectors);\n \n \tfor (j = 0; j < 2; j++) {\n \t\topts.replay_win_sz = replay_win_sz[j];\n", "prefixes": [ "2/5" ] }{ "id": 139421, "url": "