* [PATCH 0/2] uuid: enhancements and tests @ 2024-04-03 16:32 Stephen Hemminger 2024-04-03 16:32 ` [PATCH 1/2] eal: add functions to generate uuid values Stephen Hemminger ` (6 more replies) 0 siblings, 7 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 16:32 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The DPDK version of uuid was missing tests and a way to generate uuid's. Add both. Stephen Hemminger (2): eal: add functions to generate uuid values test: add functional test for uuid app/test/meson.build | 1 + app/test/test_uuid.c | 135 +++++++++++++++++++++++++++++++ lib/eal/common/eal_common_uuid.c | 56 +++++++++++++ lib/eal/include/rte_uuid.h | 22 ++++- lib/eal/version.map | 2 + 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 app/test/test_uuid.c -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH 1/2] eal: add functions to generate uuid values 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger @ 2024-04-03 16:32 ` Stephen Hemminger 2024-04-04 16:11 ` Tyler Retzlaff 2024-04-03 16:32 ` [PATCH 2/2] test: add functional test for uuid Stephen Hemminger ` (5 subsequent siblings) 6 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 16:32 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Useful to be able to generate uuid values for tests or for interaction with other subsystems as magic cookie. Naming and overall algorithm come from libuuid which is used by permission of original author. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ lib/eal/include/rte_uuid.h | 22 ++++++++++++- lib/eal/version.map | 2 ++ 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c index 0a80bfbb38..fc8f58e8a4 100644 --- a/lib/eal/common/eal_common_uuid.c +++ b/lib/eal/common/eal_common_uuid.c @@ -7,7 +7,12 @@ #include <stdint.h> #include <stdlib.h> #include <ctype.h> +#include <time.h> +#include <rte_atomic.h> +#include <rte_common.h> +#include <rte_random.h> +#include <rte_time.h> #include <rte_uuid.h> /* UUID packed form */ @@ -165,3 +170,54 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) uuid.node[0], uuid.node[1], uuid.node[2], uuid.node[3], uuid.node[4], uuid.node[5]); } + +void rte_uuid_generate_random(rte_uuid_t out) +{ + union { + uint64_t words[2]; + rte_uuid_t uuid; + } buf; + struct uuid uu; + + /* UUID is 128 bit */ + buf.words[0] = rte_rand(); + buf.words[1] = rte_rand(); + + /* Mark these random bytes a version 4 random uuid */ + uuid_unpack(buf.uuid, &uu); + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uuid_pack(&uu, out); +} + +void rte_uuid_generate_time(rte_uuid_t out) +{ + struct uuid uu; + struct timespec ts; + uint64_t ns, rnd; + static uint16_t sequence; + + /* The time value for UUID is 100ns since 15 October 1582 */ + clock_gettime(CLOCK_REALTIME, &ts); + + ns = ts.tv_nsec / 100; + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; + + uu.time_low = (uint32_t) ns; + uu.time_mid = (uint16_t) (ns >> 32); + uu.time_hi_and_version = (uint16_t) (ns >> 48); + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, + rte_memory_order_relaxed); + + rnd = rte_rand(); + memcpy(uu.node, &rnd, 6); + /* + * What libuuid does set multicast bit. + * This avoids conflicts with network cards. + */ + uu.node[0] |= 0x1; + + uuid_pack(&uu, out); +} diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h index cfefd4308a..052b78a812 100644 --- a/lib/eal/include/rte_uuid.h +++ b/lib/eal/include/rte_uuid.h @@ -18,6 +18,8 @@ extern "C" { #include <stddef.h> #include <string.h> +#include <rte_compat.h> + /** * Struct describing a Universal Unique Identifier */ @@ -94,12 +96,30 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); * @param uu * UUID to format * @param out - * Resulting string buffer + * Resulting string bufferm * @param len * Sizeof the available string buffer */ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); +/** + * Generate a random uuid + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_random(rte_uuid_t uu); + +/** + * Generate a uuid based on time stamp. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_time(rte_uuid_t uu); + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 3df50c3fbb..5a8aa67244 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -396,6 +396,8 @@ EXPERIMENTAL { # added in 24.03 rte_vfio_get_device_info; # WINDOWS_NO_EXPORT + rte_uuid_generate_random; + rte_uuid_generate_time; }; INTERNAL { -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH 1/2] eal: add functions to generate uuid values 2024-04-03 16:32 ` [PATCH 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-04 16:11 ` Tyler Retzlaff 0 siblings, 0 replies; 88+ messages in thread From: Tyler Retzlaff @ 2024-04-04 16:11 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Wed, Apr 03, 2024 at 09:32:29AM -0700, Stephen Hemminger wrote: > Useful to be able to generate uuid values for tests or > for interaction with other subsystems as magic cookie. > Naming and overall algorithm come from libuuid which is used > by permission of original author. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ > lib/eal/include/rte_uuid.h | 22 ++++++++++++- > lib/eal/version.map | 2 ++ > 3 files changed, 79 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c > index 0a80bfbb38..fc8f58e8a4 100644 > --- a/lib/eal/common/eal_common_uuid.c > +++ b/lib/eal/common/eal_common_uuid.c > @@ -7,7 +7,12 @@ > #include <stdint.h> > #include <stdlib.h> > #include <ctype.h> > +#include <time.h> > > +#include <rte_atomic.h> i guess this should be rte_stdatomic.h > +#include <rte_common.h> > +#include <rte_random.h> > +#include <rte_time.h> > #include <rte_uuid.h> > > /* UUID packed form */ > @@ -165,3 +170,54 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) > uuid.node[0], uuid.node[1], uuid.node[2], > uuid.node[3], uuid.node[4], uuid.node[5]); > } > + > +void rte_uuid_generate_random(rte_uuid_t out) > +{ > + union { > + uint64_t words[2]; > + rte_uuid_t uuid; > + } buf; > + struct uuid uu; > + > + /* UUID is 128 bit */ > + buf.words[0] = rte_rand(); > + buf.words[1] = rte_rand(); > + > + /* Mark these random bytes a version 4 random uuid */ > + uuid_unpack(buf.uuid, &uu); > + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; > + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; > + uuid_pack(&uu, out); > +} > + > +void rte_uuid_generate_time(rte_uuid_t out) > +{ > + struct uuid uu; > + struct timespec ts; > + uint64_t ns, rnd; > + static uint16_t sequence; sequence will need to be RTE_ATOMIC(uint16_t) if you build with clang and you -Denable_stdatomic=true clang enforces the use of atomic types and build would have failed at the rte_atomic_fetch_add_explicit below. the CI probably already told you this. > + > + /* The time value for UUID is 100ns since 15 October 1582 */ > + clock_gettime(CLOCK_REALTIME, &ts); > + > + ns = ts.tv_nsec / 100; > + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); > + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; > + > + uu.time_low = (uint32_t) ns; > + uu.time_mid = (uint16_t) (ns >> 32); > + uu.time_hi_and_version = (uint16_t) (ns >> 48); > + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; > + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, > + rte_memory_order_relaxed); > + > + rnd = rte_rand(); > + memcpy(uu.node, &rnd, 6); > + /* > + * What libuuid does set multicast bit. > + * This avoids conflicts with network cards. > + */ > + uu.node[0] |= 0x1; > + > + uuid_pack(&uu, out); > +} > diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h > index cfefd4308a..052b78a812 100644 > --- a/lib/eal/include/rte_uuid.h > +++ b/lib/eal/include/rte_uuid.h > @@ -18,6 +18,8 @@ extern "C" { > #include <stddef.h> > #include <string.h> > > +#include <rte_compat.h> > + > /** > * Struct describing a Universal Unique Identifier > */ > @@ -94,12 +96,30 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); > * @param uu > * UUID to format > * @param out > - * Resulting string buffer > + * Resulting string bufferm buffer -> bufferm intentional? > * @param len > * Sizeof the available string buffer > */ > void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); > > +/** > + * Generate a random uuid > + * > + * @param uu > + * Resulting UUID > + */ > +__rte_experimental > +void rte_uuid_generate_random(rte_uuid_t uu); > + > +/** > + * Generate a uuid based on time stamp. > + * > + * @param uu > + * Resulting UUID > + */ > +__rte_experimental > +void rte_uuid_generate_time(rte_uuid_t uu); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eal/version.map b/lib/eal/version.map > index 3df50c3fbb..5a8aa67244 100644 > --- a/lib/eal/version.map > +++ b/lib/eal/version.map > @@ -396,6 +396,8 @@ EXPERIMENTAL { > > # added in 24.03 i guess 24.07 now > rte_vfio_get_device_info; # WINDOWS_NO_EXPORT > + rte_uuid_generate_random; > + rte_uuid_generate_time; > }; > > INTERNAL { > -- > 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH 2/2] test: add functional test for uuid 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger 2024-04-03 16:32 ` [PATCH 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-03 16:32 ` Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 0/2] uuid: add generate functions and tests Stephen Hemminger ` (4 subsequent siblings) 6 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 16:32 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The uuid functions in EAL were not covered by any current functional tests. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/meson.build | 1 + app/test/test_uuid.c | 135 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 app/test/test_uuid.c diff --git a/app/test/meson.build b/app/test/meson.build index 7d909039ae..11fb7dbffa 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -198,6 +198,7 @@ source_file_deps = { 'test_trace.c': [], 'test_trace_perf.c': [], 'test_trace_register.c': [], + 'test_uuid.c' : [], 'test_vdev.c': ['kvargs', 'bus_vdev'], 'test_version.c': [], } diff --git a/app/test/test_uuid.c b/app/test/test_uuid.c new file mode 100644 index 0000000000..669ed82243 --- /dev/null +++ b/app/test/test_uuid.c @@ -0,0 +1,135 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Stephen Hemminger + */ + +#include <rte_uuid.h> + +#include "test.h" + +#define NROUNDS 100 + +static int +check_duplicate_uuid(rte_uuid_t uids[]) +{ + int i, j; + char out[256]; + + for (i = 0; i < NROUNDS - 1; i++) { + for (j = i + 1; j < NROUNDS; j++) { + if (rte_uuid_compare(uids[i], uids[j]) == 0) { + rte_uuid_unparse(uids[i], out, sizeof(out)); + printf("Generated duplicate random uuids %d == %d : %s\n", + i, j, out); + return TEST_FAILED; + } + } + } + return TEST_SUCCESS; +} + + +static const struct uuid_case { + const char *in; + rte_uuid_t result; +} good_cases[] = { + { "02ce8e94-5b84-47fc-8f86-72633c5b5061", RTE_UUID_INIT(0x02ce8e94, 0x5b84, 0x47fc, 0x8f86, 0x72633c5b5061) }, + { "2c72af87-d220-4931-98ec-45c8520c94e1", RTE_UUID_INIT(0x2c72af87, 0xd220, 0x4931, 0x98ec, 0x45c8520c94e1) }, + { "441edca1-0942-4ccd-9b33-233e0454fe5b", RTE_UUID_INIT(0x441edca1, 0x0942, 0x4ccd, 0x9b33, 0x233e0454fe5b) }, +}; + +static const char * const bad_cases[] = { + "", /* empty */ + "41edca1-0942-4ccd-9b33-233e0454fe5b", /* too short */ + "d5cecbac-531b-4527-b0629-2bc3011dc9c", /* hyphen in wrong place */ + "db318745-1347-4f5e-m142-d86dc41172b2", /* bad hex */ +}; + +static int +test_uuid(void) +{ + rte_uuid_t uids[NROUNDS] = { }; + rte_uuid_t clone[NROUNDS] = { }; + unsigned int i; + int ret; + + /* Test generate random uuid */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(uids[i])) { + printf("Zero'd uuid %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_generate_random(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + ret = check_duplicate_uuid(uids); + if (ret != TEST_SUCCESS) + return ret; + + /* Test generate time */ + for (i = 0; i < NROUNDS; i++) { + rte_uuid_generate_time(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + + /* Test that copy works */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(clone[i])) { + printf("Zero'd clone %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_copy(clone[i], uids[i]); + + if (rte_uuid_compare(uids[i], clone[i]) != 0) { + printf("Copied uuid does not match\n"); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(good_cases); i++) { + const struct uuid_case *c = &good_cases[i]; + char out[37]; + rte_uuid_t uu; + + if (rte_uuid_parse(c->in, uu) != 0) { + printf("Failed to parse '%s'\n", c->in); + return TEST_FAILED; + } + if (rte_uuid_compare(uu, c->result) != 0) { + printf("Parse mismatch for '%s'\n", c->in); + return TEST_FAILED; + } + + rte_uuid_unparse(uu, out, sizeof(out)); + if (strcmp(out, c->in) != 0) { + printf("Parse/unparse mismatch (%s != %s)\n", + out, c->in); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(bad_cases); i++) { + const char *s = bad_cases[i]; + rte_uuid_t uu; + + if (rte_uuid_parse(s, uu) == 0) { + printf("Accepted parse of '%s'\n", s); + return TEST_FAILED; + } + } + return TEST_SUCCESS; +} + + +REGISTER_FAST_TEST(uuid_autotest, true, true, test_uuid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v2 0/2] uuid: add generate functions and tests 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger 2024-04-03 16:32 ` [PATCH 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-03 16:32 ` [PATCH 2/2] test: add functional test for uuid Stephen Hemminger @ 2024-04-03 22:11 ` Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 2/2] test: add functional test for uuid Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 0/2] uuid: add generate functions and tests Stephen Hemminger ` (3 subsequent siblings) 6 siblings, 2 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 22:11 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The DPDK version of uuid was missing tests and a way to generate uuid's. Add both. v2 - use RTE_ATOMIC to get _Atomic in clang Stephen Hemminger (2): eal: add functions to generate uuid values test: add functional test for uuid app/test/meson.build | 1 + app/test/test_uuid.c | 135 +++++++++++++++++++++++++++++++ lib/eal/common/eal_common_uuid.c | 56 +++++++++++++ lib/eal/include/rte_uuid.h | 22 ++++- lib/eal/version.map | 2 + 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 app/test/test_uuid.c -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v2 1/2] eal: add functions to generate uuid values 2024-04-03 22:11 ` [PATCH v2 0/2] uuid: add generate functions and tests Stephen Hemminger @ 2024-04-03 22:11 ` Stephen Hemminger 2024-04-04 16:16 ` Tyler Retzlaff 2024-04-03 22:11 ` [PATCH v2 2/2] test: add functional test for uuid Stephen Hemminger 1 sibling, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 22:11 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Useful to be able to generate uuid values for tests or for interaction with other subsystems as magic cookie. Naming and overall algorithm come from libuuid which is used by permission of original author. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ lib/eal/include/rte_uuid.h | 22 ++++++++++++- lib/eal/version.map | 2 ++ 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c index 0a80bfbb38..fc8f58e8a4 100644 --- a/lib/eal/common/eal_common_uuid.c +++ b/lib/eal/common/eal_common_uuid.c @@ -7,7 +7,12 @@ #include <stdint.h> #include <stdlib.h> #include <ctype.h> +#include <time.h> +#include <rte_atomic.h> +#include <rte_common.h> +#include <rte_random.h> +#include <rte_time.h> #include <rte_uuid.h> /* UUID packed form */ @@ -165,3 +170,54 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) uuid.node[0], uuid.node[1], uuid.node[2], uuid.node[3], uuid.node[4], uuid.node[5]); } + +void rte_uuid_generate_random(rte_uuid_t out) +{ + union { + uint64_t words[2]; + rte_uuid_t uuid; + } buf; + struct uuid uu; + + /* UUID is 128 bit */ + buf.words[0] = rte_rand(); + buf.words[1] = rte_rand(); + + /* Mark these random bytes a version 4 random uuid */ + uuid_unpack(buf.uuid, &uu); + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uuid_pack(&uu, out); +} + +void rte_uuid_generate_time(rte_uuid_t out) +{ + struct uuid uu; + struct timespec ts; + uint64_t ns, rnd; + static uint16_t sequence; + + /* The time value for UUID is 100ns since 15 October 1582 */ + clock_gettime(CLOCK_REALTIME, &ts); + + ns = ts.tv_nsec / 100; + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; + + uu.time_low = (uint32_t) ns; + uu.time_mid = (uint16_t) (ns >> 32); + uu.time_hi_and_version = (uint16_t) (ns >> 48); + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, + rte_memory_order_relaxed); + + rnd = rte_rand(); + memcpy(uu.node, &rnd, 6); + /* + * What libuuid does set multicast bit. + * This avoids conflicts with network cards. + */ + uu.node[0] |= 0x1; + + uuid_pack(&uu, out); +} diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h index cfefd4308a..052b78a812 100644 --- a/lib/eal/include/rte_uuid.h +++ b/lib/eal/include/rte_uuid.h @@ -18,6 +18,8 @@ extern "C" { #include <stddef.h> #include <string.h> +#include <rte_compat.h> + /** * Struct describing a Universal Unique Identifier */ @@ -94,12 +96,30 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); * @param uu * UUID to format * @param out - * Resulting string buffer + * Resulting string bufferm * @param len * Sizeof the available string buffer */ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); +/** + * Generate a random uuid + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_random(rte_uuid_t uu); + +/** + * Generate a uuid based on time stamp. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_time(rte_uuid_t uu); + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 3df50c3fbb..5a8aa67244 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -396,6 +396,8 @@ EXPERIMENTAL { # added in 24.03 rte_vfio_get_device_info; # WINDOWS_NO_EXPORT + rte_uuid_generate_random; + rte_uuid_generate_time; }; INTERNAL { -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH v2 1/2] eal: add functions to generate uuid values 2024-04-03 22:11 ` [PATCH v2 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-04 16:16 ` Tyler Retzlaff 0 siblings, 0 replies; 88+ messages in thread From: Tyler Retzlaff @ 2024-04-04 16:16 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Wed, Apr 03, 2024 at 03:11:07PM -0700, Stephen Hemminger wrote: > Useful to be able to generate uuid values for tests or > for interaction with other subsystems as magic cookie. > Naming and overall algorithm come from libuuid which is used > by permission of original author. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ > lib/eal/include/rte_uuid.h | 22 ++++++++++++- > lib/eal/version.map | 2 ++ > 3 files changed, 79 insertions(+), 1 deletion(-) > > diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c > index 0a80bfbb38..fc8f58e8a4 100644 > --- a/lib/eal/common/eal_common_uuid.c > +++ b/lib/eal/common/eal_common_uuid.c > @@ -7,7 +7,12 @@ > #include <stdint.h> > #include <stdlib.h> > #include <ctype.h> > +#include <time.h> > > +#include <rte_atomic.h> should be rte_stdatomic.h > +#include <rte_common.h> > +#include <rte_random.h> > +#include <rte_time.h> > #include <rte_uuid.h> > > /* UUID packed form */ > @@ -165,3 +170,54 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) > uuid.node[0], uuid.node[1], uuid.node[2], > uuid.node[3], uuid.node[4], uuid.node[5]); > } > + > +void rte_uuid_generate_random(rte_uuid_t out) > +{ > + union { > + uint64_t words[2]; > + rte_uuid_t uuid; > + } buf; > + struct uuid uu; > + > + /* UUID is 128 bit */ > + buf.words[0] = rte_rand(); > + buf.words[1] = rte_rand(); > + > + /* Mark these random bytes a version 4 random uuid */ > + uuid_unpack(buf.uuid, &uu); > + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; > + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; > + uuid_pack(&uu, out); > +} > + > +void rte_uuid_generate_time(rte_uuid_t out) > +{ > + struct uuid uu; > + struct timespec ts; > + uint64_t ns, rnd; > + static uint16_t sequence; should be ``static RTE_ATOMIC(uint16_t) sequence;`` > + > + /* The time value for UUID is 100ns since 15 October 1582 */ > + clock_gettime(CLOCK_REALTIME, &ts); > + > + ns = ts.tv_nsec / 100; > + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); > + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; > + > + uu.time_low = (uint32_t) ns; > + uu.time_mid = (uint16_t) (ns >> 32); > + uu.time_hi_and_version = (uint16_t) (ns >> 48); > + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; > + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, > + rte_memory_order_relaxed); > + > + rnd = rte_rand(); > + memcpy(uu.node, &rnd, 6); > + /* > + * What libuuid does set multicast bit. > + * This avoids conflicts with network cards. > + */ > + uu.node[0] |= 0x1; > + > + uuid_pack(&uu, out); > +} > diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h > index cfefd4308a..052b78a812 100644 > --- a/lib/eal/include/rte_uuid.h > +++ b/lib/eal/include/rte_uuid.h > @@ -18,6 +18,8 @@ extern "C" { > #include <stddef.h> > #include <string.h> > > +#include <rte_compat.h> > + > /** > * Struct describing a Universal Unique Identifier > */ > @@ -94,12 +96,30 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); > * @param uu > * UUID to format > * @param out > - * Resulting string buffer > + * Resulting string bufferm intentional change buffer -> bufferm? > * @param len > * Sizeof the available string buffer > */ > void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); > > +/** > + * Generate a random uuid > + * > + * @param uu > + * Resulting UUID > + */ > +__rte_experimental > +void rte_uuid_generate_random(rte_uuid_t uu); > + > +/** > + * Generate a uuid based on time stamp. > + * > + * @param uu > + * Resulting UUID > + */ > +__rte_experimental > +void rte_uuid_generate_time(rte_uuid_t uu); > + > #ifdef __cplusplus > } > #endif > diff --git a/lib/eal/version.map b/lib/eal/version.map > index 3df50c3fbb..5a8aa67244 100644 > --- a/lib/eal/version.map > +++ b/lib/eal/version.map > @@ -396,6 +396,8 @@ EXPERIMENTAL { > > # added in 24.03 > rte_vfio_get_device_info; # WINDOWS_NO_EXPORT # added in 24.07 > + rte_uuid_generate_random; > + rte_uuid_generate_time; > }; > > INTERNAL { > -- i actually didn't see the RTE_ATOMIC get added in v2 as per cover letter, so i'm thinking maybe the v1 series was re-submitted as v2? > 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v2 2/2] test: add functional test for uuid 2024-04-03 22:11 ` [PATCH v2 0/2] uuid: add generate functions and tests Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-03 22:11 ` Stephen Hemminger 2024-04-04 16:18 ` Tyler Retzlaff 1 sibling, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-03 22:11 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The uuid functions in EAL were not covered by existing functional tests. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/meson.build | 1 + app/test/test_uuid.c | 135 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 app/test/test_uuid.c diff --git a/app/test/meson.build b/app/test/meson.build index 7d909039ae..11fb7dbffa 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -198,6 +198,7 @@ source_file_deps = { 'test_trace.c': [], 'test_trace_perf.c': [], 'test_trace_register.c': [], + 'test_uuid.c' : [], 'test_vdev.c': ['kvargs', 'bus_vdev'], 'test_version.c': [], } diff --git a/app/test/test_uuid.c b/app/test/test_uuid.c new file mode 100644 index 0000000000..669ed82243 --- /dev/null +++ b/app/test/test_uuid.c @@ -0,0 +1,135 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Stephen Hemminger + */ + +#include <rte_uuid.h> + +#include "test.h" + +#define NROUNDS 100 + +static int +check_duplicate_uuid(rte_uuid_t uids[]) +{ + int i, j; + char out[256]; + + for (i = 0; i < NROUNDS - 1; i++) { + for (j = i + 1; j < NROUNDS; j++) { + if (rte_uuid_compare(uids[i], uids[j]) == 0) { + rte_uuid_unparse(uids[i], out, sizeof(out)); + printf("Generated duplicate random uuids %d == %d : %s\n", + i, j, out); + return TEST_FAILED; + } + } + } + return TEST_SUCCESS; +} + + +static const struct uuid_case { + const char *in; + rte_uuid_t result; +} good_cases[] = { + { "02ce8e94-5b84-47fc-8f86-72633c5b5061", RTE_UUID_INIT(0x02ce8e94, 0x5b84, 0x47fc, 0x8f86, 0x72633c5b5061) }, + { "2c72af87-d220-4931-98ec-45c8520c94e1", RTE_UUID_INIT(0x2c72af87, 0xd220, 0x4931, 0x98ec, 0x45c8520c94e1) }, + { "441edca1-0942-4ccd-9b33-233e0454fe5b", RTE_UUID_INIT(0x441edca1, 0x0942, 0x4ccd, 0x9b33, 0x233e0454fe5b) }, +}; + +static const char * const bad_cases[] = { + "", /* empty */ + "41edca1-0942-4ccd-9b33-233e0454fe5b", /* too short */ + "d5cecbac-531b-4527-b0629-2bc3011dc9c", /* hyphen in wrong place */ + "db318745-1347-4f5e-m142-d86dc41172b2", /* bad hex */ +}; + +static int +test_uuid(void) +{ + rte_uuid_t uids[NROUNDS] = { }; + rte_uuid_t clone[NROUNDS] = { }; + unsigned int i; + int ret; + + /* Test generate random uuid */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(uids[i])) { + printf("Zero'd uuid %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_generate_random(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + ret = check_duplicate_uuid(uids); + if (ret != TEST_SUCCESS) + return ret; + + /* Test generate time */ + for (i = 0; i < NROUNDS; i++) { + rte_uuid_generate_time(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + + /* Test that copy works */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(clone[i])) { + printf("Zero'd clone %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_copy(clone[i], uids[i]); + + if (rte_uuid_compare(uids[i], clone[i]) != 0) { + printf("Copied uuid does not match\n"); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(good_cases); i++) { + const struct uuid_case *c = &good_cases[i]; + char out[37]; + rte_uuid_t uu; + + if (rte_uuid_parse(c->in, uu) != 0) { + printf("Failed to parse '%s'\n", c->in); + return TEST_FAILED; + } + if (rte_uuid_compare(uu, c->result) != 0) { + printf("Parse mismatch for '%s'\n", c->in); + return TEST_FAILED; + } + + rte_uuid_unparse(uu, out, sizeof(out)); + if (strcmp(out, c->in) != 0) { + printf("Parse/unparse mismatch (%s != %s)\n", + out, c->in); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(bad_cases); i++) { + const char *s = bad_cases[i]; + rte_uuid_t uu; + + if (rte_uuid_parse(s, uu) == 0) { + printf("Accepted parse of '%s'\n", s); + return TEST_FAILED; + } + } + return TEST_SUCCESS; +} + + +REGISTER_FAST_TEST(uuid_autotest, true, true, test_uuid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH v2 2/2] test: add functional test for uuid 2024-04-03 22:11 ` [PATCH v2 2/2] test: add functional test for uuid Stephen Hemminger @ 2024-04-04 16:18 ` Tyler Retzlaff 0 siblings, 0 replies; 88+ messages in thread From: Tyler Retzlaff @ 2024-04-04 16:18 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On Wed, Apr 03, 2024 at 03:11:08PM -0700, Stephen Hemminger wrote: > The uuid functions in EAL were not covered by existing functional > tests. > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com> ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v3 0/2] uuid: add generate functions and tests 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger ` (2 preceding siblings ...) 2024-04-03 22:11 ` [PATCH v2 0/2] uuid: add generate functions and tests Stephen Hemminger @ 2024-04-04 16:22 ` Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 2/2] test: add functional test for uuid Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (2 subsequent siblings) 6 siblings, 2 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-04 16:22 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger While looking at using uuid's in some logging cases, discovered that the existing uuid support in EAL was missing some functions add in later versions of libuuid. Add functions to generate Uuid values, and add missing functional tests for uuid's. Stephen Hemminger (2): eal: add functions to generate uuid values test: add functional test for uuid app/test/meson.build | 1 + app/test/test_uuid.c | 138 +++++++++++++++++++++++++++++++ lib/eal/common/eal_common_uuid.c | 56 +++++++++++++ lib/eal/include/rte_uuid.h | 28 ++++++- lib/eal/version.map | 2 + 5 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 app/test/test_uuid.c -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v3 1/2] eal: add functions to generate uuid values 2024-04-04 16:22 ` [PATCH v3 0/2] uuid: add generate functions and tests Stephen Hemminger @ 2024-04-04 16:22 ` Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 2/2] test: add functional test for uuid Stephen Hemminger 1 sibling, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-04 16:22 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Useful to be able to generate uuid values for tests or for interaction with other subsystems as magic cookie. Naming and overall algorithm come from libuuid which is used by permission of original author. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ lib/eal/include/rte_uuid.h | 28 +++++++++++++++- lib/eal/version.map | 2 ++ 3 files changed, 85 insertions(+), 1 deletion(-) diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c index 0a80bfbb38..dfc7c75813 100644 --- a/lib/eal/common/eal_common_uuid.c +++ b/lib/eal/common/eal_common_uuid.c @@ -3,12 +3,18 @@ */ #include <stdio.h> +#include <stdbool.h> #include <string.h> #include <stdint.h> #include <stdlib.h> #include <ctype.h> +#include <time.h> +#include <rte_stdatomic.h> +#include <rte_random.h> +#include <rte_time.h> #include <rte_uuid.h> +#include <rte_os_shim.h> /* UUID packed form */ struct uuid { @@ -165,3 +171,53 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) uuid.node[0], uuid.node[1], uuid.node[2], uuid.node[3], uuid.node[4], uuid.node[5]); } + +void rte_uuid_generate_random(rte_uuid_t out) +{ + union { + uint64_t words[2]; + rte_uuid_t uuid; + } buf; + struct uuid uu; + + /* UUID is 128 bit */ + buf.words[0] = rte_rand(); + buf.words[1] = rte_rand(); + + /* Mark these random bytes a version 4 random uuid */ + uuid_unpack(buf.uuid, &uu); + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uuid_pack(&uu, out); +} + +void rte_uuid_generate_time(rte_uuid_t out) +{ + struct uuid uu; + struct timespec ts; + uint64_t ns, rnd; + static RTE_ATOMIC(uint16_t) sequence; + + /* The time value for UUID is 100ns since 15 October 1582 */ + clock_gettime(CLOCK_REALTIME, &ts); + + ns = ts.tv_nsec / 100; + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; + + uu.time_low = (uint32_t) ns; + uu.time_mid = (uint16_t) (ns >> 32); + uu.time_hi_and_version = (uint16_t) (ns >> 48); + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, rte_memory_order_relaxed); + + rnd = rte_rand(); + memcpy(uu.node, &rnd, 6); + /* + * Follow the convention so that random node part will not + * not match a valid MAC address, + */ + uu.node[0] |= 0x1; + + uuid_pack(&uu, out); +} diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h index cfefd4308a..928a8312d9 100644 --- a/lib/eal/include/rte_uuid.h +++ b/lib/eal/include/rte_uuid.h @@ -18,6 +18,8 @@ extern "C" { #include <stddef.h> #include <string.h> +#include <rte_compat.h> + /** * Struct describing a Universal Unique Identifier */ @@ -94,12 +96,36 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); * @param uu * UUID to format * @param out - * Resulting string buffer + * Resulting string bufferm * @param len * Sizeof the available string buffer */ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); +/** + * Generate a random uuid + * + * Uses high quality pseudo-random generator rte_rand() to generate a universal + * unique identifier. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_random(rte_uuid_t uu); + +/** + * Generate a uuid based on time stamp. + * + * Uses the current time and a random Ethernet MAC address to generate a + * universal unique identifier. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_time(rte_uuid_t uu); + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 3df50c3fbb..5a8aa67244 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -396,6 +396,8 @@ EXPERIMENTAL { # added in 24.03 rte_vfio_get_device_info; # WINDOWS_NO_EXPORT + rte_uuid_generate_random; + rte_uuid_generate_time; }; INTERNAL { -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v3 2/2] test: add functional test for uuid 2024-04-04 16:22 ` [PATCH v3 0/2] uuid: add generate functions and tests Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-04 16:22 ` Stephen Hemminger 1 sibling, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-04 16:22 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The uuid functions in EAL were not covered by existing functional tests. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/meson.build | 1 + app/test/test_uuid.c | 138 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 app/test/test_uuid.c diff --git a/app/test/meson.build b/app/test/meson.build index 7d909039ae..11fb7dbffa 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -198,6 +198,7 @@ source_file_deps = { 'test_trace.c': [], 'test_trace_perf.c': [], 'test_trace_register.c': [], + 'test_uuid.c' : [], 'test_vdev.c': ['kvargs', 'bus_vdev'], 'test_version.c': [], } diff --git a/app/test/test_uuid.c b/app/test/test_uuid.c new file mode 100644 index 0000000000..a4b1b34786 --- /dev/null +++ b/app/test/test_uuid.c @@ -0,0 +1,138 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Stephen Hemminger + */ + +#include <rte_uuid.h> + +#include "test.h" + +#define NROUNDS 100 + +static int +check_duplicate_uuid(rte_uuid_t uids[]) +{ + int i, j; + char out[256]; + + for (i = 0; i < NROUNDS - 1; i++) { + for (j = i + 1; j < NROUNDS; j++) { + if (rte_uuid_compare(uids[i], uids[j]) == 0) { + rte_uuid_unparse(uids[i], out, sizeof(out)); + printf("Generated duplicate random uuids %d == %d : %s\n", + i, j, out); + return TEST_FAILED; + } + } + } + return TEST_SUCCESS; +} + + +static const struct uuid_case { + const char *in; + rte_uuid_t result; +} good_cases[] = { + { "02ce8e94-5b84-47fc-8f86-72633c5b5061", + RTE_UUID_INIT(0x02ce8e94, 0x5b84, 0x47fc, 0x8f86, 0x72633c5b5061) }, + { "2c72af87-d220-4931-98ec-45c8520c94e1", + RTE_UUID_INIT(0x2c72af87, 0xd220, 0x4931, 0x98ec, 0x45c8520c94e1) }, + { "441edca1-0942-4ccd-9b33-233e0454fe5b", + RTE_UUID_INIT(0x441edca1, 0x0942, 0x4ccd, 0x9b33, 0x233e0454fe5b) }, +}; + +static const char * const bad_cases[] = { + "", /* empty */ + "41edca1-0942-4ccd-9b33-233e0454fe5b", /* too short */ + "d5cecbac-531b-4527-b0629-2bc3011dc9c", /* hyphen in wrong place */ + "db318745-1347-4f5e-m142-d86dc41172b2", /* bad hex */ +}; + +static int +test_uuid(void) +{ + rte_uuid_t uids[NROUNDS] = { }; + rte_uuid_t clone[NROUNDS] = { }; + unsigned int i; + int ret; + + /* Test generate random uuid */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(uids[i])) { + printf("Zero'd uuid %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_generate_random(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + ret = check_duplicate_uuid(uids); + if (ret != TEST_SUCCESS) + return ret; + + /* Test generate time */ + for (i = 0; i < NROUNDS; i++) { + rte_uuid_generate_time(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + + /* Test that copy works */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(clone[i])) { + printf("Zero'd clone %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_copy(clone[i], uids[i]); + + if (rte_uuid_compare(uids[i], clone[i]) != 0) { + printf("Copied uuid does not match\n"); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(good_cases); i++) { + const struct uuid_case *c = &good_cases[i]; + char out[37]; + rte_uuid_t uu; + + if (rte_uuid_parse(c->in, uu) != 0) { + printf("Failed to parse '%s'\n", c->in); + return TEST_FAILED; + } + if (rte_uuid_compare(uu, c->result) != 0) { + printf("Parse mismatch for '%s'\n", c->in); + return TEST_FAILED; + } + + rte_uuid_unparse(uu, out, sizeof(out)); + if (strcmp(out, c->in) != 0) { + printf("Parse/unparse mismatch (%s != %s)\n", + out, c->in); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(bad_cases); i++) { + const char *s = bad_cases[i]; + rte_uuid_t uu; + + if (rte_uuid_parse(s, uu) == 0) { + printf("Accepted parse of '%s'\n", s); + return TEST_FAILED; + } + } + return TEST_SUCCESS; +} + + +REGISTER_FAST_TEST(uuid_autotest, true, true, test_uuid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger ` (3 preceding siblings ...) 2024-04-04 16:22 ` [PATCH v3 0/2] uuid: add generate functions and tests Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger ` (29 more replies) 2024-04-09 17:05 ` [PATCH v4 0/2] uuid: generator functions and unit test Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger 6 siblings, 30 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The DPDK has a lot of unnecessary usage of rte_memcpy. This patch set replaces cases where rte_memcpy is used with a fixed size constant size. Typical example is: rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); which can be replaced with: memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); This does not change the resulting binary on almost all architectures because x86 version of intrisics and glibc are the same, and other architectures were using __builtin_constant_p(). The main benefit is that analysis tools like fortify, Coverity, and ASAN analyzers can check these memcpy's. The first patch is a simple coccinelle script to do the replacement and the rest are the results broken out by module. The script can be used again to make sure more bad usage doesn't creep in with new drivers. v4 - replace other unnecessary rte_memcpy in ethdev. replace memcpy with structure assignment where possible. fixup formatting in a couple places. v3 - rebase and rerun coccinelle script on 24.03 - consolidate patches by subtree - remove inclusion of rte_memcpy.h when no longer used. Stephen Hemminger (30): cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy eal: replace use of fixed size rte_memcpy ethdev: replace uses of rte_memcpy eventdev: replace use of fixed size rte_memcpy cryptodev: replace use of fixed size rte_memcpy ip_frag: replace use of fixed size rte_memcpy net: replace use of fixed size rte_memcpy lpm: replace use of fixed size rte_memcpy node: replace use of fixed size rte_memcpy pdcp: replace use of fixed size rte_memcpy pipeline: replace use of fixed size rte_memcpy rib: replace use of fixed size rte_memcpy security: replace use of fixed size rte_memcpy bus: remove unneeded rte_memcpy.h include net: replace use of fixed size rte_memcpy raw: replace use of fixed size rte_memcpy baseband: replace use of fixed size rte_memcpy common: replace use of fixed size rte_memcpy crypto: replace use of fixed size rte_memcpy crypto: replace use of fixed size rte_memcpy event: replace use of fixed size rte_memcpy mempool: replace use of fixed size rte_memcpy ml/cnxk: replace use of fixed size rte_memcpy app/test-pmd: replace use of fixed size rte_memcpy app/graph: replace use of fixed size rte_memcpy app/test-eventdev: replace use of fixed size rte_memcpy app/test: replace use of fixed size rte_memcpy app/test-pipeline: remove unused rte_memcpy.h include app/test-bbdev: remove unnecessary include of rte_memcpy.h examples: replace use of fixed size rte_memcpy app/graph/neigh.c | 8 +- app/test-bbdev/test_bbdev.c | 1 - app/test-eventdev/test_pipeline_common.c | 19 ++- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - app/test-pmd/cmdline.c | 48 ++++---- app/test-pmd/cmdline_flow.c | 24 ++-- app/test-pmd/config.c | 8 +- app/test-pmd/csumonly.c | 1 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/noisy_vnf.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/testpmd.c | 1 - app/test/commands.c | 1 - app/test/packet_burst_generator.c | 4 +- app/test/test_crc.c | 5 +- app/test/test_cryptodev.c | 18 ++- app/test/test_cryptodev_asym.c | 1 - app/test/test_cryptodev_security_pdcp.c | 1 - app/test/test_efd.c | 1 - app/test/test_efd_perf.c | 1 - app/test/test_event_crypto_adapter.c | 12 +- app/test/test_event_dma_adapter.c | 4 +- app/test/test_eventdev.c | 1 - app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 8 +- app/test/test_mbuf.c | 1 - app/test/test_member.c | 1 - app/test/test_member_perf.c | 1 - app/test/test_rawdev.c | 1 - app/test/test_security_inline_proto.c | 36 +++--- app/test/test_service_cores.c | 1 - app/test/virtual_pmd.c | 3 +- devtools/cocci/rte_memcpy.cocci | 11 ++ drivers/baseband/acc/rte_acc100_pmd.c | 16 ++- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++-- drivers/baseband/la12xx/bbdev_la12xx.c | 4 +- drivers/bus/auxiliary/linux/auxiliary.c | 1 - drivers/bus/fslmc/fslmc_bus.c | 1 - drivers/bus/fslmc/fslmc_vfio.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - drivers/common/idpf/idpf_common_device.c | 4 +- drivers/common/idpf/idpf_common_virtchnl.c | 10 +- drivers/common/qat/qat_qp.c | 10 +- drivers/compress/qat/qat_comp.c | 8 +- drivers/crypto/ccp/ccp_crypto.c | 14 +-- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- drivers/crypto/qat/qat_sym_session.c | 52 ++++----- .../scheduler/rte_cryptodev_scheduler.c | 6 +- drivers/crypto/scheduler/scheduler_failover.c | 12 +- drivers/event/cnxk/cnxk_eventdev_selftest.c | 1 - drivers/event/cnxk/cnxk_tim_evdev.c | 4 +- drivers/event/dlb2/dlb2.c | 4 +- drivers/event/dpaa/dpaa_eventdev.c | 1 - drivers/event/dpaa2/dpaa2_eventdev.c | 7 +- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 - drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - drivers/event/octeontx/timvf_evdev.c | 4 +- drivers/mempool/dpaa/dpaa_mempool.c | 4 +- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 +- drivers/ml/cnxk/cn10k_ml_model.c | 8 +- drivers/ml/cnxk/cn10k_ml_ops.c | 11 +- drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- drivers/ml/cnxk/mvtvm_ml_model.c | 8 +- drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/avp/avp_ethdev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x.c | 32 +++-- drivers/net/bnxt/bnxt_flow.c | 34 +++--- drivers/net/bonding/rte_eth_bond_8023ad.c | 4 +- drivers/net/bonding/rte_eth_bond_flow.c | 2 +- drivers/net/cnxk/cnxk_eswitch_devargs.c | 3 +- drivers/net/cnxk/cnxk_ethdev_ops.c | 2 +- drivers/net/cnxk/cnxk_rep.c | 3 +- drivers/net/cnxk/cnxk_rep_flow.c | 6 +- drivers/net/cnxk/cnxk_rep_msg.c | 8 +- drivers/net/cnxk/cnxk_rep_ops.c | 2 +- drivers/net/cnxk/cnxk_tm.c | 5 +- drivers/net/cpfl/cpfl_ethdev.c | 3 +- drivers/net/cpfl/cpfl_vchnl.c | 4 +- drivers/net/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/cxgbe_filter.c | 8 +- drivers/net/cxgbe/l2t.c | 4 +- drivers/net/cxgbe/smt.c | 20 ++-- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_recycle.c | 1 - drivers/net/dpaa2/dpaa2_rxtx.c | 1 - drivers/net/dpaa2/dpaa2_sparser.c | 1 - drivers/net/dpaa2/dpaa2_tm.c | 2 +- drivers/net/e1000/em_rxtx.c | 1 - drivers/net/e1000/igb_flow.c | 22 ++-- drivers/net/e1000/igb_pf.c | 7 +- drivers/net/e1000/igb_rxtx.c | 1 - drivers/net/enic/enic_main.c | 8 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/gve/base/gve_adminq.c | 2 +- drivers/net/hinic/hinic_pmd_ethdev.c | 1 - drivers/net/hinic/hinic_pmd_flow.c | 40 +++---- drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_flow.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 109 ++++++++---------- drivers/net/i40e/i40e_fdir.c | 28 +++-- drivers/net/i40e/i40e_flow.c | 56 +++++---- drivers/net/i40e/i40e_pf.c | 3 +- drivers/net/i40e/i40e_tm.c | 11 +- drivers/net/i40e/rte_pmd_i40e.c | 34 +++--- drivers/net/iavf/iavf_fdir.c | 93 +++++++-------- drivers/net/iavf/iavf_fsub.c | 50 ++++---- drivers/net/iavf/iavf_generic_flow.c | 2 +- drivers/net/iavf/iavf_tm.c | 11 +- drivers/net/iavf/iavf_vchnl.c | 9 +- drivers/net/ice/ice_dcf.c | 5 +- drivers/net/ice/ice_dcf_parent.c | 2 +- drivers/net/ice/ice_dcf_sched.c | 11 +- drivers/net/ice/ice_diagnose.c | 4 +- drivers/net/ice/ice_ethdev.c | 14 +-- drivers/net/ice/ice_fdir_filter.c | 37 +++--- drivers/net/ice/ice_generic_flow.c | 2 +- drivers/net/ice/ice_hash.c | 2 +- drivers/net/ice/ice_tm.c | 11 +- drivers/net/idpf/idpf_ethdev.c | 7 +- drivers/net/idpf/idpf_rxtx.c | 10 +- drivers/net/ipn3ke/ipn3ke_flow.c | 32 +++-- drivers/net/ipn3ke/ipn3ke_representor.c | 16 +-- drivers/net/ipn3ke/ipn3ke_tm.c | 6 +- drivers/net/ixgbe/ixgbe_ethdev.c | 9 +- drivers/net/ixgbe/ixgbe_fdir.c | 7 +- drivers/net/ixgbe/ixgbe_flow.c | 65 +++++------ drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_tm.c | 11 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_flow.c | 38 +++--- drivers/net/mlx5/mlx5_flow_aso.c | 6 +- drivers/net/mlx5/mlx5_flow_hw.c | 27 ++--- drivers/net/mlx5/mlx5_rx.c | 6 +- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +- drivers/net/mvpp2/mrvl_tm.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 1 - drivers/net/nfp/flower/nfp_conntrack.c | 2 +- drivers/net/nfp/flower/nfp_flower_flow.c | 16 +-- .../net/nfp/flower/nfp_flower_representor.c | 2 +- drivers/net/nfp/nfp_mtr.c | 10 +- drivers/net/ngbe/ngbe_pf.c | 4 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/pcap/pcap_ethdev.c | 2 +- drivers/net/pcap/pcap_osdep_freebsd.c | 3 +- drivers/net/pcap/pcap_osdep_linux.c | 3 +- drivers/net/qede/qede_main.c | 2 +- drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc.c | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 2 +- drivers/net/sfc/sfc_ethdev.c | 11 +- drivers/net/sfc/sfc_flow.c | 20 ++-- drivers/net/sfc/sfc_flow_rss.c | 2 +- drivers/net/sfc/sfc_mae.c | 2 +- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_tso.c | 2 +- drivers/net/sfc/sfc_tso.h | 9 +- drivers/net/tap/rte_eth_tap.c | 14 +-- drivers/net/txgbe/txgbe_ethdev.c | 9 +- drivers/net/txgbe/txgbe_fdir.c | 6 +- drivers/net/txgbe/txgbe_flow.c | 65 +++++------ drivers/net/txgbe/txgbe_ipsec.c | 8 +- drivers/net/txgbe/txgbe_pf.c | 5 +- drivers/net/txgbe/txgbe_tm.c | 11 +- drivers/net/vhost/rte_eth_vhost.c | 1 - drivers/net/virtio/virtio_ethdev.c | 1 - drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +- drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +- drivers/raw/ifpga/afu_pmd_n3000.c | 8 +- drivers/raw/ifpga/ifpga_rawdev.c | 11 +- drivers/raw/skeleton/skeleton_rawdev.c | 8 +- drivers/raw/skeleton/skeleton_rawdev_test.c | 1 - examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 1 - examples/ip_fragmentation/main.c | 1 - examples/ip_reassembly/main.c | 1 - examples/ipv4_multicast/main.c | 1 - examples/l2fwd-cat/cat.c | 4 +- examples/l2fwd-jobstats/main.c | 1 - examples/l2fwd-keepalive/main.c | 1 - examples/l2fwd-macsec/main.c | 1 - examples/l2fwd/main.c | 1 - examples/l3fwd-power/main.c | 1 - examples/l3fwd/main.c | 1 - examples/link_status_interrupt/main.c | 1 - .../client_server_mp/mp_server/init.c | 1 - .../client_server_mp/mp_server/main.c | 1 - examples/multi_process/symmetric_mp/main.c | 1 - examples/ptpclient/ptpclient.c | 11 +- examples/qos_sched/app_thread.c | 1 - examples/qos_sched/main.c | 1 - examples/server_node_efd/efd_server/init.c | 1 - examples/server_node_efd/efd_server/main.c | 1 - examples/vhost/main.c | 6 +- examples/vmdq/main.c | 7 +- examples/vmdq_dcb/main.c | 15 +-- lib/cryptodev/rte_cryptodev.c | 2 +- lib/eal/common/eal_common_options.c | 7 +- lib/ethdev/rte_ethdev.c | 12 +- lib/ethdev/rte_flow.c | 101 ++++++++-------- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/eventdev/rte_event_dma_adapter.c | 4 +- lib/eventdev/rte_event_timer_adapter.c | 2 +- lib/fib/trie.c | 2 +- lib/ip_frag/rte_ipv6_fragmentation.c | 4 +- lib/ip_frag/rte_ipv6_reassembly.c | 6 +- lib/lpm/rte_lpm6.c | 3 +- lib/net/rte_ether.c | 2 +- lib/node/ip6_lookup.c | 8 +- lib/pdcp/pdcp_process.c | 36 +++--- lib/pipeline/rte_table_action.c | 8 +- lib/rib/rte_rib6.h | 5 +- lib/security/rte_security.c | 4 +- 232 files changed, 936 insertions(+), 1100 deletions(-) create mode 100644 devtools/cocci/rte_memcpy.cocci -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-06 9:01 ` Morten Brørup 2024-04-05 16:53 ` [PATCH v4 02/30] eal: replace use of " Stephen Hemminger ` (28 subsequent siblings) 29 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Rte_memcpy should not be used for the simple case of copying a fix size structure because it is slower and will hide problems from code analysis tools. Coverity, fortify and other analyzers special case memcpy(). Gcc (and Clang) are smart enough to inline copies which will be faster. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- devtools/cocci/rte_memcpy.cocci | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 devtools/cocci/rte_memcpy.cocci diff --git a/devtools/cocci/rte_memcpy.cocci b/devtools/cocci/rte_memcpy.cocci new file mode 100644 index 0000000000..fa1038fc06 --- /dev/null +++ b/devtools/cocci/rte_memcpy.cocci @@ -0,0 +1,11 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst; constant size; +@@ +( +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +) -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger @ 2024-04-06 9:01 ` Morten Brørup 0 siblings, 0 replies; 88+ messages in thread From: Morten Brørup @ 2024-04-06 9:01 UTC (permalink / raw) To: Stephen Hemminger, dev > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, 5 April 2024 18.53 > > Rte_memcpy should not be used for the simple case of copying > a fix size structure because it is slower and will hide problems "it is slower"... not always true. Perhaps: "it is not faster than memcpy". > from code analysis tools. Coverity, fortify and other analyzers > special case memcpy(). > > Gcc (and Clang) are smart enough to inline copies which > will be faster. "faster" -> "just as fast". > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- With the updated description, For the series, Acked-by: Morten Brørup <mb@smartsharesystems.com> ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 02/30] eal: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 03/30] ethdev: replace uses of rte_memcpy Stephen Hemminger ` (27 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_options.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index e541f07939..07bfaffdac 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -30,7 +30,6 @@ #include <rte_tailq.h> #include <rte_version.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif @@ -1253,7 +1252,7 @@ eal_parse_lcores(const char *lcores) /* without '@', by default using lcore_set as cpuset */ if (*lcores != '@') - rte_memcpy(&cpuset, &lcore_set, sizeof(cpuset)); + memcpy(&cpuset, &lcore_set, sizeof(cpuset)); set_count = CPU_COUNT(&lcore_set); /* start to update lcore_set */ @@ -1275,8 +1274,8 @@ eal_parse_lcores(const char *lcores) if (check_cpuset(&cpuset) < 0) goto err; - rte_memcpy(&lcore_config[idx].cpuset, &cpuset, - sizeof(rte_cpuset_t)); + memcpy(&lcore_config[idx].cpuset, &cpuset, + sizeof(rte_cpuset_t)); } /* some cores from the lcore_set can't be handled by EAL */ -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 03/30] ethdev: replace uses of rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 02/30] eal: replace use of " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 04/30] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger ` (26 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam Replace use of rte_memcpy in ethdev. Most of these were fixed size, and the others were not in the fast path. Where possible replace memcpy() with structure assignment which has same effect is type safe. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> ethdev: struct assign --- lib/ethdev/rte_ethdev.c | 12 ++--- lib/ethdev/rte_flow.c | 101 +++++++++++++++++++--------------------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f1c658f49e..27d2416466 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -15,7 +15,6 @@ #include <rte_log.h> #include <rte_interrupts.h> #include <rte_kvargs.h> -#include <rte_memcpy.h> #include <rte_common.h> #include <rte_mempool.h> #include <rte_malloc.h> @@ -618,7 +617,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) rte_spinlock_lock(rte_mcfg_ethdev_get_lock()); if (eth_dev_shared_data_prepare() != NULL) { - rte_memcpy(owner, ðdev->data->owner, sizeof(*owner)); + *owner = ethdev->data->owner; ret = 0; } else { ret = -ENOMEM; @@ -1316,15 +1315,14 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, dev->data->dev_configured = 0; /* Store original config, as rollback required on failure */ - memcpy(&orig_conf, &dev->data->dev_conf, sizeof(dev->data->dev_conf)); + orig_conf = dev->data->dev_conf; /* * Copy the dev_conf parameter into the dev structure. * rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get */ if (dev_conf != &dev->data->dev_conf) - memcpy(&dev->data->dev_conf, dev_conf, - sizeof(dev->data->dev_conf)); + dev->data->dev_conf = *dev_conf; /* Backup mtu for rollback */ old_mtu = dev->data->mtu; @@ -1601,7 +1599,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, eth_dev_rx_queue_config(dev, 0); eth_dev_tx_queue_config(dev, 0); rollback: - memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf)); + dev->data->dev_conf = orig_conf; if (old_mtu != dev->data->mtu) dev->data->mtu = old_mtu; @@ -3843,7 +3841,7 @@ rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf) return -EINVAL; } - memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf)); + *dev_conf = dev->data->dev_conf; rte_ethdev_trace_conf_get(port_id, dev_conf); diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7ab1100ea0..776352b984 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -62,7 +62,8 @@ rte_flow_conv_copy(void *buf, const void *data, const size_t size, size_t sz = rte_type ? desc[type].size : sizeof(void *); if (buf == NULL || data == NULL) return 0; - rte_memcpy(buf, data, (size > sz ? sz : size)); + + memcpy(buf, data, (size > sz ? sz : size)); if (rte_type && desc[type].desc_fn) sz += desc[type].desc_fn(size > 0 ? buf : NULL, data); return sz; @@ -73,11 +74,10 @@ rte_flow_item_flex_conv(void *buf, const void *data) { struct rte_flow_item_flex *dst = buf; const struct rte_flow_item_flex *src = data; - if (buf) { - dst->pattern = rte_memcpy - ((void *)((uintptr_t)(dst + 1)), src->pattern, - src->length); - } + + if (buf) + dst->pattern = memcpy((void *)((uintptr_t)(dst + 1)), + src->pattern, src->length); return src->length; } @@ -643,16 +643,18 @@ rte_flow_conv_item_spec(void *buf, const size_t size, mask.raw = item->mask ? item->mask : &rte_flow_item_raw_mask; src.raw = data; dst.raw = buf; - rte_memcpy(dst.raw, - (&(struct rte_flow_item_raw){ - .relative = src.raw->relative, - .search = src.raw->search, - .reserved = src.raw->reserved, - .offset = src.raw->offset, - .limit = src.raw->limit, - .length = src.raw->length, - }), - size > sizeof(*dst.raw) ? sizeof(*dst.raw) : size); + + memcpy(dst.raw, + (&(struct rte_flow_item_raw){ + .relative = src.raw->relative, + .search = src.raw->search, + .reserved = src.raw->reserved, + .offset = src.raw->offset, + .limit = src.raw->limit, + .length = src.raw->length, + }), + size > sizeof(*dst.raw) ? sizeof(*dst.raw) : size); + off = sizeof(*dst.raw); if (type == RTE_FLOW_CONV_ITEM_SPEC || (type == RTE_FLOW_CONV_ITEM_MASK && @@ -664,9 +666,8 @@ rte_flow_conv_item_spec(void *buf, const size_t size, if (tmp) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.raw->pattern)); if (size >= off + tmp) - dst.raw->pattern = rte_memcpy - ((void *)((uintptr_t)dst.raw + off), - src.raw->pattern, tmp); + dst.raw->pattern = memcpy((void *)((uintptr_t)dst.raw + off), + src.raw->pattern, tmp); off += tmp; } break; @@ -716,32 +717,31 @@ rte_flow_conv_action_conf(void *buf, const size_t size, case RTE_FLOW_ACTION_TYPE_RSS: src.rss = action->conf; dst.rss = buf; - rte_memcpy(dst.rss, - (&(struct rte_flow_action_rss){ - .func = src.rss->func, - .level = src.rss->level, - .types = src.rss->types, - .key_len = src.rss->key_len, - .queue_num = src.rss->queue_num, - }), - size > sizeof(*dst.rss) ? sizeof(*dst.rss) : size); + memcpy(dst.rss, + (&(struct rte_flow_action_rss){ + .func = src.rss->func, + .level = src.rss->level, + .types = src.rss->types, + .key_len = src.rss->key_len, + .queue_num = src.rss->queue_num, + }), + size > sizeof(*dst.rss) ? sizeof(*dst.rss) : size); + off = sizeof(*dst.rss); if (src.rss->key_len && src.rss->key) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->key)); tmp = sizeof(*src.rss->key) * src.rss->key_len; if (size >= (uint64_t)off + (uint64_t)tmp) - dst.rss->key = rte_memcpy - ((void *)((uintptr_t)dst.rss + off), - src.rss->key, tmp); + dst.rss->key = memcpy((void *)((uintptr_t)dst.rss + off), + src.rss->key, tmp); off += tmp; } if (src.rss->queue_num) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->queue)); tmp = sizeof(*src.rss->queue) * src.rss->queue_num; if (size >= (uint64_t)off + (uint64_t)tmp) - dst.rss->queue = rte_memcpy - ((void *)((uintptr_t)dst.rss + off), - src.rss->queue, tmp); + dst.rss->queue = memcpy((void *)((uintptr_t)dst.rss + off), + src.rss->queue, tmp); off += tmp; } break; @@ -983,20 +983,15 @@ rte_flow_conv_rule(struct rte_flow_conv_rule *dst, size_t off; int ret; - rte_memcpy(dst, - (&(struct rte_flow_conv_rule){ - .attr = NULL, - .pattern = NULL, - .actions = NULL, - }), - size > sizeof(*dst) ? sizeof(*dst) : size); + memcpy(dst, &(struct rte_flow_conv_rule) { }, + size > sizeof(*dst) ? sizeof(*dst) : size); + off = sizeof(*dst); if (src->attr_ro) { off = RTE_ALIGN_CEIL(off, sizeof(double)); if (size && size >= off + sizeof(*dst->attr)) - dst->attr = rte_memcpy - ((void *)((uintptr_t)dst + off), - src->attr_ro, sizeof(*dst->attr)); + dst->attr = memcpy((void *)((uintptr_t)dst + off), + src->attr_ro, sizeof(*dst->attr)); off += sizeof(*dst->attr); } if (src->pattern_ro) { @@ -1098,7 +1093,7 @@ rte_flow_conv(enum rte_flow_conv_op op, attr = src; if (size > sizeof(*attr)) size = sizeof(*attr); - rte_memcpy(dst, attr, size); + memcpy(dst, attr, size); ret = sizeof(*attr); break; case RTE_FLOW_CONV_OP_ITEM: @@ -1180,14 +1175,14 @@ rte_flow_copy(struct rte_flow_desc *desc, size_t len, if (ret < 0) return 0; ret += sizeof(*desc) - sizeof(*dst); - rte_memcpy(desc, - (&(struct rte_flow_desc){ - .size = ret, - .attr = *attr, - .items = dst_size ? dst->pattern : NULL, - .actions = dst_size ? dst->actions : NULL, - }), - len > sizeof(*desc) ? sizeof(*desc) : len); + memcpy(desc, + (&(struct rte_flow_desc){ + .size = ret, + .attr = *attr, + .items = dst_size ? dst->pattern : NULL, + .actions = dst_size ? dst->actions : NULL, + }), + len > sizeof(*desc) ? sizeof(*desc) : len); rte_flow_trace_copy(desc, len, attr, items, actions, ret); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 04/30] eventdev: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (2 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 03/30] ethdev: replace uses of rte_memcpy Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 05/30] cryptodev: " Stephen Hemminger ` (25 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Abhinandan Gujjar, Jerin Jacob, Amit Prakash Shukla, Erik Gabriel Carrillo Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/eventdev/rte_event_dma_adapter.c | 4 ++-- lib/eventdev/rte_event_timer_adapter.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index db1c7f3906..e2fff2ecc9 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -655,7 +655,7 @@ eca_ops_enqueue_burst(struct event_crypto_adapter *adapter, continue; } - rte_memcpy(ev, &m_data->response_info, sizeof(*ev)); + memcpy(ev, &m_data->response_info, sizeof(*ev)); ev->event_ptr = ops[i]; ev->event_type = RTE_EVENT_TYPE_CRYPTODEV; if (adapter->implicit_release_disabled) diff --git a/lib/eventdev/rte_event_dma_adapter.c b/lib/eventdev/rte_event_dma_adapter.c index 24dff556db..6784c562b0 100644 --- a/lib/eventdev/rte_event_dma_adapter.c +++ b/lib/eventdev/rte_event_dma_adapter.c @@ -447,7 +447,7 @@ rte_event_dma_adapter_create(uint8_t id, uint8_t evdev_id, struct rte_event_port if (pc == NULL) return -ENOMEM; - rte_memcpy(pc, port_config, sizeof(struct rte_event_port_conf)); + memcpy(pc, port_config, sizeof(struct rte_event_port_conf)); ret = rte_event_dma_adapter_create_ext(id, evdev_id, edma_default_config_cb, mode, pc); if (ret != 0) rte_free(pc); @@ -668,7 +668,7 @@ edma_ops_enqueue_burst(struct event_dma_adapter *adapter, struct rte_event_dma_a continue; } - rte_memcpy(ev, response_info, sizeof(struct rte_event)); + memcpy(ev, response_info, sizeof(struct rte_event)); ev->event_ptr = ops[i]; ev->event_type = RTE_EVENT_TYPE_DMADEV; if (adapter->implicit_release_disabled) diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index 5886965d14..9ca52cc6de 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -549,7 +549,7 @@ event_buffer_add(struct event_buffer *bufp, struct rte_event *eventp) /* Instead of modulus, bitwise AND with mask to get head_idx. */ head_idx = bufp->head & EVENT_BUFFER_MASK; buf_eventp = &bufp->events[head_idx]; - rte_memcpy(buf_eventp, eventp, sizeof(struct rte_event)); + memcpy(buf_eventp, eventp, sizeof(struct rte_event)); /* Wrap automatically when overflow occurs. */ bufp->head++; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 05/30] cryptodev: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (3 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 04/30] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-10 15:40 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 06/30] ip_frag: " Stephen Hemminger ` (24 subsequent siblings) 29 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Fan Zhang Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/cryptodev/rte_cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 886eb7adc4..1377777525 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -2854,7 +2854,7 @@ crypto_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < CRYPTO_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [EXTERNAL] [PATCH v4 05/30] cryptodev: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 05/30] cryptodev: " Stephen Hemminger @ 2024-04-10 15:40 ` Akhil Goyal 0 siblings, 0 replies; 88+ messages in thread From: Akhil Goyal @ 2024-04-10 15:40 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Fan Zhang > Automatically generated by devtools/cocci/rte_memcpy.cocci > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > lib/cryptodev/rte_cryptodev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 06/30] ip_frag: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (4 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 05/30] cryptodev: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 07/30] net: " Stephen Hemminger ` (23 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/ip_frag/rte_ipv6_fragmentation.c | 4 +--- lib/ip_frag/rte_ipv6_reassembly.c | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/ip_frag/rte_ipv6_fragmentation.c b/lib/ip_frag/rte_ipv6_fragmentation.c index 56696f32f8..72ce6501c8 100644 --- a/lib/ip_frag/rte_ipv6_fragmentation.c +++ b/lib/ip_frag/rte_ipv6_fragmentation.c @@ -5,8 +5,6 @@ #include <stddef.h> #include <errno.h> -#include <rte_memcpy.h> - #include "ip_frag_common.h" /** @@ -23,7 +21,7 @@ __fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, { struct rte_ipv6_fragment_ext *fh; - rte_memcpy(dst, src, sizeof(*dst)); + memcpy(dst, src, sizeof(*dst)); dst->payload_len = rte_cpu_to_be_16(len); dst->proto = IPPROTO_FRAGMENT; diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c index 88863a98d1..663b1737a6 100644 --- a/lib/ip_frag/rte_ipv6_reassembly.c +++ b/lib/ip_frag/rte_ipv6_reassembly.c @@ -4,8 +4,6 @@ #include <stddef.h> -#include <rte_memcpy.h> - #include "ip_frag_common.h" /** @@ -143,8 +141,8 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; int32_t trim; - rte_memcpy(&key.src_dst[0], ip_hdr->src_addr, 16); - rte_memcpy(&key.src_dst[2], ip_hdr->dst_addr, 16); + memcpy(&key.src_dst[0], ip_hdr->src_addr, 16); + memcpy(&key.src_dst[2], ip_hdr->dst_addr, 16); key.id = frag_hdr->id; key.key_len = IPV6_KEYLEN; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 07/30] net: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (5 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 06/30] ip_frag: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 08/30] lpm: " Stephen Hemminger ` (22 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/net/rte_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/rte_ether.c b/lib/net/rte_ether.c index f59c20289d..761b38f805 100644 --- a/lib/net/rte_ether.c +++ b/lib/net/rte_ether.c @@ -13,7 +13,7 @@ rte_eth_random_addr(uint8_t *addr) uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; - rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN); + memcpy(addr, p, RTE_ETHER_ADDR_LEN); addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR; /* clear multicast bit */ addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 08/30] lpm: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (6 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 07/30] net: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 09/30] node: " Stephen Hemminger ` (21 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Bruce Richardson, Vladimir Medvedkin Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/lpm/rte_lpm6.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c index 46d8f71a2d..242695dd4d 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -11,7 +11,6 @@ #include <rte_log.h> #include <rte_common.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_eal_memconfig.h> #include <rte_string_fns.h> #include <rte_errno.h> @@ -139,7 +138,7 @@ ip6_mask_addr(uint8_t *ip, uint8_t depth) static inline void ip6_copy_addr(uint8_t *dst, const uint8_t *src) { - rte_memcpy(dst, src, RTE_LPM6_IPV6_ADDR_SIZE); + memcpy(dst, src, RTE_LPM6_IPV6_ADDR_SIZE); } /* -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 09/30] node: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (7 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 08/30] lpm: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 10/30] pdcp: " Stephen Hemminger ` (20 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nithin Dabilpuram, Pavan Nikhilesh Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/node/ip6_lookup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node/ip6_lookup.c b/lib/node/ip6_lookup.c index 309964f60f..b8e567ccd9 100644 --- a/lib/node/ip6_lookup.c +++ b/lib/node/ip6_lookup.c @@ -112,28 +112,28 @@ ip6_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[0], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[0], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf1 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf1, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[1], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[1], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf2 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf2, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[2], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[2], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf3 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf3, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[3], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[3], ipv6_hdr->dst_addr, 16); rte_lpm6_lookup_bulk_func(lpm6, ip_batch, next_hop, 4); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 10/30] pdcp: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (8 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 09/30] node: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 11/30] pipeline: " Stephen Hemminger ` (19 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Anoob Joseph, Volodymyr Fialko Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pdcp/pdcp_process.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c index 9b9b881124..6c0693f666 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -60,7 +60,7 @@ pdcp_iv_gen_null_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv *e m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -72,10 +72,10 @@ pdcp_iv_gen_null_zs(struct rte_crypto_op *cop, const struct entity_priv *en_priv iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static void @@ -89,7 +89,7 @@ pdcp_iv_gen_aes_ctr_null(struct rte_crypto_op *cop, const struct entity_priv *en iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, 16); + memcpy(iv, iv_u64, 16); } static void @@ -101,8 +101,8 @@ pdcp_iv_gen_zs_null(struct rte_crypto_op *cop, const struct entity_priv *en_priv iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64 = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64, 8); - rte_memcpy(iv + 8, &iv_u64, 8); + memcpy(iv, &iv_u64, 8); + memcpy(iv + 8, &iv_u64, 8); } static void @@ -115,17 +115,17 @@ pdcp_iv_gen_zs_zs(struct rte_crypto_op *cop, const struct entity_priv *en_priv, /* Generating cipher IV */ iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); - rte_memcpy(iv + 8, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); + memcpy(iv + 8, &iv_u64[0], 8); iv += PDCP_IV_LEN; /* Generating auth IV */ iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static void @@ -140,12 +140,12 @@ pdcp_iv_gen_zs_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv *en_ iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); - rte_memcpy(iv + 8, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); + memcpy(iv + 8, &iv_u64[0], 8); m_ptr = (uint8_t *)rte_pktmbuf_prepend(mb, 8); m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -162,11 +162,11 @@ pdcp_iv_gen_aes_ctr_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, PDCP_IV_LEN); + memcpy(iv, iv_u64, PDCP_IV_LEN); m_ptr = (uint8_t *)rte_pktmbuf_prepend(mb, 8); m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -179,15 +179,15 @@ pdcp_iv_gen_aes_ctr_zs(struct rte_crypto_op *cop, const struct entity_priv *en_p iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, PDCP_IV_LEN); + memcpy(iv, iv_u64, PDCP_IV_LEN); iv += PDCP_IV_LEN; iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static int -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 11/30] pipeline: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (9 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 10/30] pdcp: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 12/30] rib: " Stephen Hemminger ` (18 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pipeline/rte_table_action.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c index 87c3e0e2c9..aec84deed5 100644 --- a/lib/pipeline/rte_table_action.c +++ b/lib/pipeline/rte_table_action.c @@ -1441,7 +1441,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port, data->port); - rte_memcpy(ip->src_addr, data->addr, 16); + memcpy(ip->src_addr, data->addr, 16); tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { @@ -1454,7 +1454,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, udp->src_port, data->port); - rte_memcpy(ip->src_addr, data->addr, 16); + memcpy(ip->src_addr, data->addr, 16); udp->src_port = data->port; udp->dgram_cksum = udp_cksum; } @@ -1469,7 +1469,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port, data->port); - rte_memcpy(ip->dst_addr, data->addr, 16); + memcpy(ip->dst_addr, data->addr, 16); tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { @@ -1482,7 +1482,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, udp->dst_port, data->port); - rte_memcpy(ip->dst_addr, data->addr, 16); + memcpy(ip->dst_addr, data->addr, 16); udp->dst_port = data->port; udp->dgram_cksum = udp_cksum; } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 12/30] rib: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (10 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 11/30] pipeline: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 13/30] security: " Stephen Hemminger ` (17 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Vladimir Medvedkin Mostly automatically generated by devtools/cocci/rte_memcpy.cocci The fib/trie.c was relying on headers rte_rib6 -> rte_memcpy -> rte_vect since rib6 is no longer using rte_memcpy need to get rte_vect.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/fib/trie.c | 2 +- lib/rib/rte_rib6.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/fib/trie.c b/lib/fib/trie.c index 09470e7287..a77f6c758b 100644 --- a/lib/fib/trie.c +++ b/lib/fib/trie.c @@ -9,7 +9,7 @@ #include <rte_debug.h> #include <rte_malloc.h> #include <rte_errno.h> - +#include <rte_vect.h> #include <rte_rib6.h> #include <rte_fib6.h> #include "trie.h" diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h index 775286f965..f366d3d197 100644 --- a/lib/rib/rte_rib6.h +++ b/lib/rib/rte_rib6.h @@ -14,7 +14,8 @@ * Level compressed tree implementation for IPv6 Longest Prefix Match */ -#include <rte_memcpy.h> +#include <string.h> + #include <rte_common.h> #ifdef __cplusplus @@ -61,7 +62,7 @@ rte_rib6_copy_addr(uint8_t *dst, const uint8_t *src) { if ((dst == NULL) || (src == NULL)) return; - rte_memcpy(dst, src, RTE_RIB6_IPV6_ADDR_SIZE); + memcpy(dst, src, RTE_RIB6_IPV6_ADDR_SIZE); } /** -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 13/30] security: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (11 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 12/30] rib: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-10 15:40 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 14/30] bus: remove unneeded rte_memcpy.h include Stephen Hemminger ` (16 subsequent siblings) 29 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Anoob Joseph Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/security/rte_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c index e5c862f5f5..28d59ef388 100644 --- a/lib/security/rte_security.c +++ b/lib/security/rte_security.c @@ -384,7 +384,7 @@ crypto_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < CRYPTO_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } @@ -409,7 +409,7 @@ sec_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->action != RTE_SECURITY_ACTION_TYPE_NONE) { memset(&caps_val, 0, SEC_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < SEC_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [EXTERNAL] [PATCH v4 13/30] security: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 13/30] security: " Stephen Hemminger @ 2024-04-10 15:40 ` Akhil Goyal 0 siblings, 0 replies; 88+ messages in thread From: Akhil Goyal @ 2024-04-10 15:40 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Anoob Joseph > Automatically generated by devtools/cocci/rte_memcpy.cocci > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 14/30] bus: remove unneeded rte_memcpy.h include 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (12 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 13/30] security: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 15/30] net: replace use of fixed size rte_memcpy Stephen Hemminger ` (15 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena, Chenbo Xia, Nipun Gupta Included here but never used. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/bus/auxiliary/linux/auxiliary.c | 1 - drivers/bus/fslmc/fslmc_bus.c | 1 - drivers/bus/fslmc/fslmc_vfio.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - 7 files changed, 7 deletions(-) diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c index 02fc9285dc..011278d79b 100644 --- a/drivers/bus/auxiliary/linux/auxiliary.c +++ b/drivers/bus/auxiliary/linux/auxiliary.c @@ -8,7 +8,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <eal_filesystem.h> #include "../private.h" diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index c155f4a2fd..6696aa2575 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -13,7 +13,6 @@ #include <bus_driver.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <ethdev_driver.h> #include <rte_mbuf_dyn.h> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 5966776a85..2011cd6e77 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -24,7 +24,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c index d7f6e45b7d..cc4d51c7f2 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -14,7 +14,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index 07256ed7ec..5ff98b2176 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -13,7 +13,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 4aec7b2cd8..bb8efc1871 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -26,7 +26,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 3d237398d9..12e58735b7 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -10,7 +10,6 @@ #include <rte_bus_pci.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <rte_vfio.h> #include "eal_filesystem.h" -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 15/30] net: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (13 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 14/30] bus: remove unneeded rte_memcpy.h include Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 16/30] raw: " Stephen Hemminger ` (14 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Viacheslav Ovsiienko, Ciara Loftus, Steven Webster, Matt Peters, Selwin Sebastian, Julien Aube, Ajit Khaparde, Somnath Kotur, Chas Williams, Min Hu (Connor), Nithin Dabilpuram, Kiran Kumar K, Sunil Kumar Kori, Satha Rao, Harman Kalra, Yuying Zhang, Rahul Lakkireddy, Hemant Agrawal, Sachin Saxena, John Daley, Hyong Youb Kim, Gaetan Rivet, Jeroen de Borst, Rushil Gupta, Joshua Washington, Ziyang Xuan, Xiaoyun Wang, Guoyang Zhou, Jie Hai, Yisen Zhuang, Jingjing Wu, Rosen Xu, Jakub Grajciar, Dariusz Sosnowski, Ori Kam, Suanming Mou, Matan Azrad, Liron Himi, Long Li, Chaoyong He, Jiawen Wu, Tetsuya Mukawa, Devendra Singh Rawat, Alok Prasad, Bruce Richardson, Andrew Rybchenko, Jian Wang, Maxime Coquelin, Chenbo Xia Automatically generated by devtools/cocci/rte_memcpy.cocci Also remove unnecessary includes of rte_memcpy.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/avp/avp_ethdev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x.c | 32 +++-- drivers/net/bnxt/bnxt_flow.c | 34 +++--- drivers/net/bonding/rte_eth_bond_8023ad.c | 4 +- drivers/net/bonding/rte_eth_bond_flow.c | 2 +- drivers/net/cnxk/cnxk_eswitch_devargs.c | 3 +- drivers/net/cnxk/cnxk_ethdev_ops.c | 2 +- drivers/net/cnxk/cnxk_rep.c | 3 +- drivers/net/cnxk/cnxk_rep_flow.c | 6 +- drivers/net/cnxk/cnxk_rep_msg.c | 8 +- drivers/net/cnxk/cnxk_rep_ops.c | 2 +- drivers/net/cnxk/cnxk_tm.c | 5 +- drivers/net/cpfl/cpfl_ethdev.c | 3 +- drivers/net/cpfl/cpfl_vchnl.c | 4 +- drivers/net/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/cxgbe_filter.c | 8 +- drivers/net/cxgbe/l2t.c | 4 +- drivers/net/cxgbe/smt.c | 20 ++-- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_recycle.c | 1 - drivers/net/dpaa2/dpaa2_rxtx.c | 1 - drivers/net/dpaa2/dpaa2_sparser.c | 1 - drivers/net/dpaa2/dpaa2_tm.c | 2 +- drivers/net/e1000/em_rxtx.c | 1 - drivers/net/e1000/igb_flow.c | 22 ++-- drivers/net/e1000/igb_pf.c | 7 +- drivers/net/e1000/igb_rxtx.c | 1 - drivers/net/enic/enic_main.c | 8 +- drivers/net/failsafe/failsafe_ops.c | 6 +- drivers/net/gve/base/gve_adminq.c | 2 +- drivers/net/hinic/hinic_pmd_ethdev.c | 1 - drivers/net/hinic/hinic_pmd_flow.c | 40 +++---- drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_flow.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 109 ++++++++---------- drivers/net/i40e/i40e_fdir.c | 28 +++-- drivers/net/i40e/i40e_flow.c | 56 +++++---- drivers/net/i40e/i40e_pf.c | 3 +- drivers/net/i40e/i40e_tm.c | 11 +- drivers/net/i40e/rte_pmd_i40e.c | 34 +++--- drivers/net/iavf/iavf_fdir.c | 93 +++++++-------- drivers/net/iavf/iavf_fsub.c | 50 ++++---- drivers/net/iavf/iavf_generic_flow.c | 2 +- drivers/net/iavf/iavf_tm.c | 11 +- drivers/net/iavf/iavf_vchnl.c | 9 +- drivers/net/ice/ice_dcf.c | 5 +- drivers/net/ice/ice_dcf_parent.c | 2 +- drivers/net/ice/ice_dcf_sched.c | 11 +- drivers/net/ice/ice_diagnose.c | 4 +- drivers/net/ice/ice_ethdev.c | 14 +-- drivers/net/ice/ice_fdir_filter.c | 37 +++--- drivers/net/ice/ice_generic_flow.c | 2 +- drivers/net/ice/ice_hash.c | 2 +- drivers/net/ice/ice_tm.c | 11 +- drivers/net/idpf/idpf_ethdev.c | 7 +- drivers/net/idpf/idpf_rxtx.c | 10 +- drivers/net/ipn3ke/ipn3ke_flow.c | 32 +++-- drivers/net/ipn3ke/ipn3ke_representor.c | 16 +-- drivers/net/ipn3ke/ipn3ke_tm.c | 6 +- drivers/net/ixgbe/ixgbe_ethdev.c | 9 +- drivers/net/ixgbe/ixgbe_fdir.c | 7 +- drivers/net/ixgbe/ixgbe_flow.c | 65 +++++------ drivers/net/ixgbe/ixgbe_ipsec.c | 8 +- drivers/net/ixgbe/ixgbe_pf.c | 5 +- drivers/net/ixgbe/ixgbe_tm.c | 11 +- drivers/net/ixgbe/rte_pmd_ixgbe.c | 4 +- drivers/net/memif/memif_socket.c | 4 +- drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_flow.c | 38 +++--- drivers/net/mlx5/mlx5_flow_aso.c | 6 +- drivers/net/mlx5/mlx5_flow_hw.c | 27 ++--- drivers/net/mlx5/mlx5_rx.c | 6 +- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +- drivers/net/mvpp2/mrvl_tm.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 1 - drivers/net/nfp/flower/nfp_conntrack.c | 2 +- drivers/net/nfp/flower/nfp_flower_flow.c | 16 +-- .../net/nfp/flower/nfp_flower_representor.c | 2 +- drivers/net/nfp/nfp_mtr.c | 10 +- drivers/net/ngbe/ngbe_pf.c | 4 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/pcap/pcap_ethdev.c | 2 +- drivers/net/pcap/pcap_osdep_freebsd.c | 3 +- drivers/net/pcap/pcap_osdep_linux.c | 3 +- drivers/net/qede/qede_main.c | 2 +- drivers/net/ring/rte_eth_ring.c | 1 - drivers/net/sfc/sfc.c | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 2 +- drivers/net/sfc/sfc_ethdev.c | 11 +- drivers/net/sfc/sfc_flow.c | 20 ++-- drivers/net/sfc/sfc_flow_rss.c | 2 +- drivers/net/sfc/sfc_mae.c | 2 +- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_tso.c | 2 +- drivers/net/sfc/sfc_tso.h | 9 +- drivers/net/tap/rte_eth_tap.c | 14 +-- drivers/net/txgbe/txgbe_ethdev.c | 9 +- drivers/net/txgbe/txgbe_fdir.c | 6 +- drivers/net/txgbe/txgbe_flow.c | 65 +++++------ drivers/net/txgbe/txgbe_ipsec.c | 8 +- drivers/net/txgbe/txgbe_pf.c | 5 +- drivers/net/txgbe/txgbe_tm.c | 11 +- drivers/net/vhost/rte_eth_vhost.c | 1 - drivers/net/virtio/virtio_ethdev.c | 1 - 107 files changed, 582 insertions(+), 664 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 268a130c49..6977516613 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -2094,7 +2094,7 @@ get_iface_info(const char *if_name, if (ioctl(sock, SIOCGIFHWADDR, &ifr)) goto error; - rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); + memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(sock); return 0; diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 53d9e38c93..9bd0530172 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -248,7 +248,7 @@ avp_dev_process_request(struct avp_dev *avp, struct rte_avp_request *request) while (avp_fifo_get(avp->resp_q, (void **)&resp_addr, 1)) PMD_DRV_LOG(DEBUG, "Discarding stale response\n"); - rte_memcpy(avp->sync_addr, request, sizeof(*request)); + memcpy(avp->sync_addr, request, sizeof(*request)); count = avp_fifo_put(avp->req_q, &avp->host_sync_addr, 1); if (count < 1) { PMD_DRV_LOG(ERR, "Cannot send request %u to host\n", @@ -285,7 +285,7 @@ avp_dev_process_request(struct avp_dev *avp, struct rte_avp_request *request) } /* copy to user buffer */ - rte_memcpy(request, avp->sync_addr, sizeof(*request)); + memcpy(request, avp->sync_addr, sizeof(*request)); ret = 0; PMD_DRV_LOG(DEBUG, "Result %d received for request %u\n", diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c index dd681f15a0..7ac30106e3 100644 --- a/drivers/net/axgbe/axgbe_ethdev.c +++ b/drivers/net/axgbe/axgbe_ethdev.c @@ -594,7 +594,7 @@ axgbe_dev_rss_hash_update(struct rte_eth_dev *dev, if (rss_conf->rss_key != NULL && rss_conf->rss_key_len == AXGBE_RSS_HASH_KEY_SIZE) { - rte_memcpy(pdata->rss_key, rss_conf->rss_key, + memcpy(pdata->rss_key, rss_conf->rss_key, AXGBE_RSS_HASH_KEY_SIZE); /* Program the hash key */ ret = axgbe_write_rss_hash_key(pdata); @@ -637,7 +637,7 @@ axgbe_dev_rss_hash_conf_get(struct rte_eth_dev *dev, if (rss_conf->rss_key != NULL && rss_conf->rss_key_len >= AXGBE_RSS_HASH_KEY_SIZE) { - rte_memcpy(rss_conf->rss_key, pdata->rss_key, + memcpy(rss_conf->rss_key, pdata->rss_key, AXGBE_RSS_HASH_KEY_SIZE); } rss_conf->rss_key_len = AXGBE_RSS_HASH_KEY_SIZE; diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c index 597ee43359..16a9ff7f8c 100644 --- a/drivers/net/bnx2x/bnx2x.c +++ b/drivers/net/bnx2x/bnx2x.c @@ -2242,18 +2242,18 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_parse_bd->parsing_data = (mac_type << ETH_TX_PARSE_BD_E2_ETH_ADDR_TYPE_SHIFT); - rte_memcpy(&tx_parse_bd->data.mac_addr.dst_hi, - &eh->dst_addr.addr_bytes[0], 2); - rte_memcpy(&tx_parse_bd->data.mac_addr.dst_mid, - &eh->dst_addr.addr_bytes[2], 2); - rte_memcpy(&tx_parse_bd->data.mac_addr.dst_lo, - &eh->dst_addr.addr_bytes[4], 2); - rte_memcpy(&tx_parse_bd->data.mac_addr.src_hi, - &eh->src_addr.addr_bytes[0], 2); - rte_memcpy(&tx_parse_bd->data.mac_addr.src_mid, - &eh->src_addr.addr_bytes[2], 2); - rte_memcpy(&tx_parse_bd->data.mac_addr.src_lo, - &eh->src_addr.addr_bytes[4], 2); + memcpy(&tx_parse_bd->data.mac_addr.dst_hi, + &eh->dst_addr.addr_bytes[0], 2); + memcpy(&tx_parse_bd->data.mac_addr.dst_mid, + &eh->dst_addr.addr_bytes[2], 2); + memcpy(&tx_parse_bd->data.mac_addr.dst_lo, + &eh->dst_addr.addr_bytes[4], 2); + memcpy(&tx_parse_bd->data.mac_addr.src_hi, + &eh->src_addr.addr_bytes[0], 2); + memcpy(&tx_parse_bd->data.mac_addr.src_mid, + &eh->src_addr.addr_bytes[2], 2); + memcpy(&tx_parse_bd->data.mac_addr.src_lo, + &eh->src_addr.addr_bytes[4], 2); tx_parse_bd->data.mac_addr.dst_hi = rte_cpu_to_be_16(tx_parse_bd->data.mac_addr.dst_hi); @@ -6675,8 +6675,7 @@ bnx2x_config_rss_pf(struct bnx2x_softc *sc, struct ecore_rss_config_obj *rss_obj /* Hash bits */ params.rss_result_mask = MULTI_MASK; - rte_memcpy(params.ind_table, rss_obj->ind_table, - sizeof(params.ind_table)); + memcpy(params.ind_table, rss_obj->ind_table, sizeof(params.ind_table)); if (config_hash) { /* RSS keys */ @@ -6742,8 +6741,7 @@ bnx2x_set_mac_one(struct bnx2x_softc *sc, uint8_t * mac, /* fill a user request section if needed */ if (!rte_bit_relaxed_get32(RAMROD_CONT, ramrod_flags)) { - rte_memcpy(ramrod_param.user_req.u.mac.mac, mac, - ETH_ALEN); + memcpy(ramrod_param.user_req.u.mac.mac, mac, ETH_ALEN); rte_bit_relaxed_set32(mac_type, &ramrod_param.user_req.vlan_mac_flags); @@ -6958,7 +6956,7 @@ static void bnx2x_link_report_locked(struct bnx2x_softc *sc) ELINK_DEBUG_P1(sc, "link status change count = %x", sc->link_cnt); /* report new link params and remember the state for the next time */ - rte_memcpy(&sc->last_reported_link, &cur_data, sizeof(cur_data)); + memcpy(&sc->last_reported_link, &cur_data, sizeof(cur_data)); if (rte_bit_relaxed_get32(BNX2X_LINK_REPORT_LINK_DOWN, &cur_data.link_report_flags)) { diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index f25bc6ff78..6466aa394a 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -233,8 +233,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "DMAC is invalid!\n"); return -rte_errno; } - rte_memcpy(filter->dst_macaddr, - ð_spec->hdr.dst_addr, RTE_ETHER_ADDR_LEN); + memcpy(filter->dst_macaddr, + ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); en |= use_ntuple ? NTUPLE_FLTR_ALLOC_INPUT_EN_DST_MACADDR : EM_FLOW_ALLOC_INPUT_EN_DST_MACADDR; @@ -257,8 +258,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "SMAC is invalid!\n"); return -rte_errno; } - rte_memcpy(filter->src_macaddr, - ð_spec->hdr.src_addr, RTE_ETHER_ADDR_LEN); + memcpy(filter->src_macaddr, + ð_spec->hdr.src_addr, + RTE_ETHER_ADDR_LEN); en |= use_ntuple ? NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_MACADDR : EM_FLOW_ALLOC_INPUT_EN_SRC_MACADDR; @@ -423,23 +425,23 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, en |= EM_FLOW_ALLOC_INPUT_EN_SRC_IPADDR | EM_FLOW_ALLOC_INPUT_EN_DST_IPADDR; - rte_memcpy(filter->src_ipaddr, - ipv6_spec->hdr.src_addr, 16); - rte_memcpy(filter->dst_ipaddr, - ipv6_spec->hdr.dst_addr, 16); + memcpy(filter->src_ipaddr, ipv6_spec->hdr.src_addr, + 16); + memcpy(filter->dst_ipaddr, ipv6_spec->hdr.dst_addr, + 16); if (!bnxt_check_zero_bytes(ipv6_mask->hdr.src_addr, 16)) { - rte_memcpy(filter->src_ipaddr_mask, - ipv6_mask->hdr.src_addr, 16); + memcpy(filter->src_ipaddr_mask, + ipv6_mask->hdr.src_addr, 16); en |= !use_ntuple ? 0 : NTUPLE_FLTR_ALLOC_INPUT_EN_SRC_IPADDR_MASK; } if (!bnxt_check_zero_bytes(ipv6_mask->hdr.dst_addr, 16)) { - rte_memcpy(filter->dst_ipaddr_mask, - ipv6_mask->hdr.dst_addr, 16); + memcpy(filter->dst_ipaddr_mask, + ipv6_mask->hdr.dst_addr, 16); en |= !use_ntuple ? 0 : NTUPLE_FLTR_ALLOC_INPUT_EN_DST_IPADDR_MASK; } @@ -591,8 +593,8 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, return -rte_errno; } - rte_memcpy(((uint8_t *)&tenant_id_be + 1), - vxlan_spec->hdr.vni, 3); + memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->hdr.vni, 3); filter->vni = rte_be_to_cpu_32(tenant_id_be); filter->tunnel_type = @@ -645,8 +647,8 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "Invalid TNI mask"); return -rte_errno; } - rte_memcpy(((uint8_t *)&tenant_id_be + 1), - nvgre_spec->tni, 3); + memcpy(((uint8_t *)&tenant_id_be + 1), + nvgre_spec->tni, 3); filter->vni = rte_be_to_cpu_32(tenant_id_be); filter->tunnel_type = diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 79f1b3f1a0..8ddf5dc80a 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -1539,10 +1539,10 @@ rte_eth_bond_8023ad_member_info(uint16_t port_id, uint16_t member_id, info->selected = port->selected; info->actor_state = port->actor_state; - rte_memcpy(&info->actor, &port->actor, sizeof(port->actor)); + memcpy(&info->actor, &port->actor, sizeof(port->actor)); info->partner_state = port->partner_state; - rte_memcpy(&info->partner, &port->partner, sizeof(port->partner)); + memcpy(&info->partner, &port->partner, sizeof(port->partner)); info->agg_port_id = port->aggregator_port_id; return 0; diff --git a/drivers/net/bonding/rte_eth_bond_flow.c b/drivers/net/bonding/rte_eth_bond_flow.c index 5d0be5caf5..bb9d347e2b 100644 --- a/drivers/net/bonding/rte_eth_bond_flow.c +++ b/drivers/net/bonding/rte_eth_bond_flow.c @@ -182,7 +182,7 @@ bond_flow_query_count(struct rte_eth_dev *dev, struct rte_flow *flow, count->hits = 0; count->bytes_set = 0; count->hits_set = 0; - rte_memcpy(&member_count, count, sizeof(member_count)); + memcpy(&member_count, count, sizeof(member_count)); for (i = 0; i < internals->member_count; i++) { ret = rte_flow_query(internals->members[i].port_id, flow->flows[i], action, diff --git a/drivers/net/cnxk/cnxk_eswitch_devargs.c b/drivers/net/cnxk/cnxk_eswitch_devargs.c index 8167ce673a..70045c58c1 100644 --- a/drivers/net/cnxk/cnxk_eswitch_devargs.c +++ b/drivers/net/cnxk/cnxk_eswitch_devargs.c @@ -112,7 +112,8 @@ cnxk_eswitch_repr_devargs(struct rte_pci_device *pci_dev, struct cnxk_eswitch_de goto fail; } - rte_memcpy(&eswitch_dev->esw_da[j].da, ð_da[i], sizeof(struct rte_eth_devargs)); + memcpy(&eswitch_dev->esw_da[j].da, ð_da[i], + sizeof(struct rte_eth_devargs)); /* No of representor ports to be created */ eswitch_dev->repr_cnt.nb_repr_created += eswitch_dev->esw_da[j].nb_repr_ports; j++; diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index c8260fcb9c..4366ef44d2 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -454,7 +454,7 @@ cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr) } /* Update mac address to cnxk ethernet device */ - rte_memcpy(dev->mac_addr, addr->addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(dev->mac_addr, addr->addr_bytes, RTE_ETHER_ADDR_LEN); exit: return rc; diff --git a/drivers/net/cnxk/cnxk_rep.c b/drivers/net/cnxk/cnxk_rep.c index ca0637bde5..35f6be63a6 100644 --- a/drivers/net/cnxk/cnxk_rep.c +++ b/drivers/net/cnxk/cnxk_rep.c @@ -383,7 +383,8 @@ cnxk_representee_notification(void *roc_nix, struct roc_eswitch_repte_notify_msg goto done; } - rte_memcpy(msg->notify_msg, notify_msg, sizeof(struct roc_eswitch_repte_notify_msg)); + memcpy(msg->notify_msg, notify_msg, + sizeof(struct roc_eswitch_repte_notify_msg)); plt_rep_dbg("Pushing new notification : msg type %d", msg->notify_msg->type); pthread_mutex_lock(&eswitch_dev->repte_msg_proc.mutex); TAILQ_INSERT_TAIL(&repte_msg_proc->msg_list, msg, next); diff --git a/drivers/net/cnxk/cnxk_rep_flow.c b/drivers/net/cnxk/cnxk_rep_flow.c index d26f5aa12c..9f09e6a7f0 100644 --- a/drivers/net/cnxk/cnxk_rep_flow.c +++ b/drivers/net/cnxk/cnxk_rep_flow.c @@ -81,7 +81,8 @@ prepare_pattern_data(const struct rte_flow_item *pattern, uint16_t nb_pattern, hdr.mask_sz = term[pattern->type].item_size; } - rte_memcpy(RTE_PTR_ADD(pattern_data, len), &hdr, sizeof(cnxk_pattern_hdr_t)); + memcpy(RTE_PTR_ADD(pattern_data, len), &hdr, + sizeof(cnxk_pattern_hdr_t)); len += sizeof(cnxk_pattern_hdr_t); /* Copy pattern spec data */ @@ -228,7 +229,8 @@ prepare_action_data(const struct rte_flow_action *action, uint16_t nb_action, ui hdr.type = action->type; hdr.conf_sz = sz; - rte_memcpy(RTE_PTR_ADD(action_data, len), &hdr, sizeof(cnxk_action_hdr_t)); + memcpy(RTE_PTR_ADD(action_data, len), &hdr, + sizeof(cnxk_action_hdr_t)); len += sizeof(cnxk_action_hdr_t); /* Copy action conf data */ diff --git a/drivers/net/cnxk/cnxk_rep_msg.c b/drivers/net/cnxk/cnxk_rep_msg.c index f3a62a805e..76f07a51de 100644 --- a/drivers/net/cnxk/cnxk_rep_msg.c +++ b/drivers/net/cnxk/cnxk_rep_msg.c @@ -58,7 +58,7 @@ receive_control_message(int socketfd, void *data, uint32_t len) if (cmsg->cmsg_type == SCM_CREDENTIALS) { cr = (struct ucred *)CMSG_DATA(cmsg); } else if (cmsg->cmsg_type == SCM_RIGHTS) { - rte_memcpy(&afd, CMSG_DATA(cmsg), sizeof(int)); + memcpy(&afd, CMSG_DATA(cmsg), sizeof(int)); plt_rep_dbg("afd %d", afd); } } @@ -90,7 +90,7 @@ send_message_on_socket(int socketfd, void *data, uint32_t len, int afd) cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - rte_memcpy(CMSG_DATA(cmsg), &afd, sizeof(int)); + memcpy(CMSG_DATA(cmsg), &afd, sizeof(int)); } size = sendmsg(socketfd, &mh, MSG_DONTWAIT); @@ -198,7 +198,7 @@ cnxk_rep_msg_populate_type(void *buffer, uint32_t *length, cnxk_type_t type, uin data.length = sz; /* Populate the type data */ - rte_memcpy(RTE_PTR_ADD(buffer, len), &data, sizeof(cnxk_type_data_t)); + memcpy(RTE_PTR_ADD(buffer, len), &data, sizeof(cnxk_type_data_t)); len += sizeof(cnxk_type_data_t); *length = len; @@ -218,7 +218,7 @@ cnxk_rep_msg_populate_header(void *buffer, uint32_t *length) hdr.signature = CTRL_MSG_SIGNATURE; /* Populate header data */ - rte_memcpy(RTE_PTR_ADD(buffer, len), &hdr, sizeof(cnxk_header_t)); + memcpy(RTE_PTR_ADD(buffer, len), &hdr, sizeof(cnxk_header_t)); len += sizeof(cnxk_header_t); *length = len; diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c index 8bcb689468..cd9ae52f99 100644 --- a/drivers/net/cnxk/cnxk_rep_ops.c +++ b/drivers/net/cnxk/cnxk_rep_ops.c @@ -677,7 +677,7 @@ cnxk_rep_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr) cnxk_rep_msg_populate_header(buffer, &len); msg_sm_meta.portid = rep_dev->rep_id; - rte_memcpy(&msg_sm_meta.addr_bytes, addr->addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(&msg_sm_meta.addr_bytes, addr->addr_bytes, RTE_ETHER_ADDR_LEN); cnxk_rep_msg_populate_command_meta(buffer, &len, &msg_sm_meta, sizeof(cnxk_rep_msg_eth_set_mac_meta_t), CNXK_REP_MSG_ETH_SET_MAC); diff --git a/drivers/net/cnxk/cnxk_tm.c b/drivers/net/cnxk/cnxk_tm.c index c799193cb8..5c8b0997ca 100644 --- a/drivers/net/cnxk/cnxk_tm.c +++ b/drivers/net/cnxk/cnxk_tm.c @@ -300,8 +300,7 @@ cnxk_nix_tm_shaper_profile_add(struct rte_eth_dev *eth_dev, uint32_t id, profile->profile.pkt_len_adj = params->pkt_length_adjust; profile->profile.pkt_mode = params->packet_mode; profile->profile.free_fn = rte_free; - rte_memcpy(&profile->params, params, - sizeof(struct rte_tm_shaper_params)); + memcpy(&profile->params, params, sizeof(struct rte_tm_shaper_params)); rc = roc_nix_tm_shaper_profile_add(nix, &profile->profile); @@ -373,7 +372,7 @@ cnxk_nix_tm_node_add(struct rte_eth_dev *eth_dev, uint32_t node_id, if (!node) return -ENOMEM; - rte_memcpy(&node->params, params, sizeof(struct rte_tm_node_params)); + memcpy(&node->params, params, sizeof(struct rte_tm_node_params)); node->nix_node.id = node_id; node->nix_node.parent_id = parent_node_id; diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c index ef19aa1b6a..1037aec68d 100644 --- a/drivers/net/cpfl/cpfl_ethdev.c +++ b/drivers/net/cpfl/cpfl_ethdev.c @@ -2292,7 +2292,8 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE); - rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities)); + memcpy(&base->caps, &req_caps, + sizeof(struct virtchnl2_get_capabilities)); ret = idpf_adapter_init(base); if (ret != 0) { diff --git a/drivers/net/cpfl/cpfl_vchnl.c b/drivers/net/cpfl/cpfl_vchnl.c index 7d277a0e8e..e914014d8a 100644 --- a/drivers/net/cpfl/cpfl_vchnl.c +++ b/drivers/net/cpfl/cpfl_vchnl.c @@ -32,7 +32,7 @@ cpfl_cc_vport_list_get(struct cpfl_adapter_ext *adapter, return err; } - rte_memcpy(response, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(response, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); return 0; } @@ -66,7 +66,7 @@ cpfl_cc_vport_info_get(struct cpfl_adapter_ext *adapter, return err; } - rte_memcpy(response, args.out_buffer, sizeof(*response)); + memcpy(response, args.out_buffer, sizeof(*response)); return 0; } diff --git a/drivers/net/cxgbe/clip_tbl.c b/drivers/net/cxgbe/clip_tbl.c index b709e26f6a..d30fa6425f 100644 --- a/drivers/net/cxgbe/clip_tbl.c +++ b/drivers/net/cxgbe/clip_tbl.c @@ -115,7 +115,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev, if (ce) { t4_os_lock(&ce->lock); if (__atomic_load_n(&ce->refcnt, __ATOMIC_RELAXED) == 0) { - rte_memcpy(ce->addr, lip, sizeof(ce->addr)); + memcpy(ce->addr, lip, sizeof(ce->addr)); if (v6) { ce->type = FILTER_TYPE_IPV6; __atomic_store_n(&ce->refcnt, 1, diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c index 5a7efe7a73..3d1d087ec2 100644 --- a/drivers/net/cxgbe/cxgbe_filter.c +++ b/drivers/net/cxgbe/cxgbe_filter.c @@ -851,10 +851,10 @@ static int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx) fwr->ivlanm = cpu_to_be16(f->fs.mask.ivlan); fwr->ovlan = cpu_to_be16(f->fs.val.ovlan); fwr->ovlanm = cpu_to_be16(f->fs.mask.ovlan); - rte_memcpy(fwr->lip, f->fs.val.lip, sizeof(fwr->lip)); - rte_memcpy(fwr->lipm, f->fs.mask.lip, sizeof(fwr->lipm)); - rte_memcpy(fwr->fip, f->fs.val.fip, sizeof(fwr->fip)); - rte_memcpy(fwr->fipm, f->fs.mask.fip, sizeof(fwr->fipm)); + memcpy(fwr->lip, f->fs.val.lip, sizeof(fwr->lip)); + memcpy(fwr->lipm, f->fs.mask.lip, sizeof(fwr->lipm)); + memcpy(fwr->fip, f->fs.val.fip, sizeof(fwr->fip)); + memcpy(fwr->fipm, f->fs.mask.fip, sizeof(fwr->fipm)); fwr->lp = cpu_to_be16(f->fs.val.lport); fwr->lpm = cpu_to_be16(f->fs.mask.lport); fwr->fp = cpu_to_be16(f->fs.val.fport); diff --git a/drivers/net/cxgbe/l2t.c b/drivers/net/cxgbe/l2t.c index 21f4019ae6..7721c7953e 100644 --- a/drivers/net/cxgbe/l2t.c +++ b/drivers/net/cxgbe/l2t.c @@ -82,7 +82,7 @@ static int write_l2e(struct rte_eth_dev *dev, struct l2t_entry *e, int sync, V_L2T_W_NOREPLY(!sync)); req->l2t_idx = cpu_to_be16(l2t_idx); req->vlan = cpu_to_be16(e->vlan); - rte_memcpy(req->dst_mac, e->dmac, RTE_ETHER_ADDR_LEN); + memcpy(req->dst_mac, e->dmac, RTE_ETHER_ADDR_LEN); if (loopback) memset(req->dst_mac, 0, RTE_ETHER_ADDR_LEN); @@ -155,7 +155,7 @@ static struct l2t_entry *t4_l2t_alloc_switching(struct rte_eth_dev *dev, e->state = L2T_STATE_SWITCHING; e->vlan = vlan; e->lport = port; - rte_memcpy(e->dmac, eth_addr, RTE_ETHER_ADDR_LEN); + memcpy(e->dmac, eth_addr, RTE_ETHER_ADDR_LEN); __atomic_store_n(&e->refcnt, 1, __ATOMIC_RELAXED); ret = write_l2e(dev, e, 0, !L2T_LPBK, !L2T_ARPMISS); if (ret < 0) diff --git a/drivers/net/cxgbe/smt.c b/drivers/net/cxgbe/smt.c index 4e14a73753..a74b2e0794 100644 --- a/drivers/net/cxgbe/smt.c +++ b/drivers/net/cxgbe/smt.c @@ -55,26 +55,24 @@ static int write_smt_entry(struct rte_eth_dev *dev, struct smt_entry *e) */ if (e->idx & 1) { req->pfvf1 = 0x0; - rte_memcpy(req->src_mac1, e->src_mac, - RTE_ETHER_ADDR_LEN); + memcpy(req->src_mac1, e->src_mac, RTE_ETHER_ADDR_LEN); /* fill pfvf0/src_mac0 with entry * at prev index from smt-tab. */ req->pfvf0 = 0x0; - rte_memcpy(req->src_mac0, s->smtab[e->idx - 1].src_mac, - RTE_ETHER_ADDR_LEN); + memcpy(req->src_mac0, s->smtab[e->idx - 1].src_mac, + RTE_ETHER_ADDR_LEN); } else { req->pfvf0 = 0x0; - rte_memcpy(req->src_mac0, e->src_mac, - RTE_ETHER_ADDR_LEN); + memcpy(req->src_mac0, e->src_mac, RTE_ETHER_ADDR_LEN); /* fill pfvf1/src_mac1 with entry * at next index from smt-tab */ req->pfvf1 = 0x0; - rte_memcpy(req->src_mac1, s->smtab[e->idx + 1].src_mac, - RTE_ETHER_ADDR_LEN); + memcpy(req->src_mac1, s->smtab[e->idx + 1].src_mac, + RTE_ETHER_ADDR_LEN); } row = (e->hw_idx >> 1); } else { @@ -87,8 +85,8 @@ static int write_smt_entry(struct rte_eth_dev *dev, struct smt_entry *e) /* fill pfvf0/src_mac0 from smt-tab */ t6req->pfvf0 = 0x0; - rte_memcpy(t6req->src_mac0, s->smtab[e->idx].src_mac, - RTE_ETHER_ADDR_LEN); + memcpy(t6req->src_mac0, s->smtab[e->idx].src_mac, + RTE_ETHER_ADDR_LEN); row = e->hw_idx; req = (struct cpl_smt_write_req *)t6req; } @@ -158,7 +156,7 @@ static struct smt_entry *t4_smt_alloc_switching(struct rte_eth_dev *dev, t4_os_lock(&e->lock); if (__atomic_load_n(&e->refcnt, __ATOMIC_RELAXED) == 0) { e->pfvf = pfvf; - rte_memcpy(e->src_mac, smac, RTE_ETHER_ADDR_LEN); + memcpy(e->src_mac, smac, RTE_ETHER_ADDR_LEN); ret = write_smt_entry(dev, e); if (ret) { e->pfvf = 0; diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c index 4d33b51fea..747fa40532 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c @@ -11,7 +11,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 97edc00420..5799770fde 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -11,7 +11,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/net/dpaa2/dpaa2_recycle.c b/drivers/net/dpaa2/dpaa2_recycle.c index fbfdf360d1..cda08a6cee 100644 --- a/drivers/net/dpaa2/dpaa2_recycle.c +++ b/drivers/net/dpaa2/dpaa2_recycle.c @@ -10,7 +10,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 23f7c4132d..b83015a94c 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -11,7 +11,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <dev_driver.h> #include <rte_hexdump.h> diff --git a/drivers/net/dpaa2/dpaa2_sparser.c b/drivers/net/dpaa2/dpaa2_sparser.c index 36a14526a5..e2976282bf 100644 --- a/drivers/net/dpaa2/dpaa2_sparser.c +++ b/drivers/net/dpaa2/dpaa2_sparser.c @@ -5,7 +5,6 @@ #include <rte_mbuf.h> #include <rte_ethdev.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <dev_driver.h> diff --git a/drivers/net/dpaa2/dpaa2_tm.c b/drivers/net/dpaa2/dpaa2_tm.c index 8fe5bfa013..1749b1be22 100644 --- a/drivers/net/dpaa2/dpaa2_tm.c +++ b/drivers/net/dpaa2/dpaa2_tm.c @@ -324,7 +324,7 @@ dpaa2_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, NULL, NULL); profile->id = shaper_profile_id; - rte_memcpy(&profile->params, params, sizeof(profile->params)); + memcpy(&profile->params, params, sizeof(profile->params)); LIST_INSERT_HEAD(&priv->shaper_profiles, profile, next); diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index df5fbb7823..3a069ce33e 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -20,7 +20,6 @@ #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index ea9b290e1c..8bca484960 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -1484,9 +1484,9 @@ igb_flow_create(struct rte_eth_dev *dev, goto out; } - rte_memcpy(&ntuple_filter_ptr->filter_info, - &ntuple_filter, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter_ptr->filter_info, + &ntuple_filter, + sizeof(struct rte_eth_ntuple_filter)); TAILQ_INSERT_TAIL(&igb_filter_ntuple_list, ntuple_filter_ptr, entries); flow->rule = ntuple_filter_ptr; @@ -1511,9 +1511,9 @@ igb_flow_create(struct rte_eth_dev *dev, goto out; } - rte_memcpy(ðertype_filter_ptr->filter_info, - ðertype_filter, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter_ptr->filter_info, + ðertype_filter, + sizeof(struct rte_eth_ethertype_filter)); TAILQ_INSERT_TAIL(&igb_filter_ethertype_list, ethertype_filter_ptr, entries); flow->rule = ethertype_filter_ptr; @@ -1536,9 +1536,8 @@ igb_flow_create(struct rte_eth_dev *dev, goto out; } - rte_memcpy(&syn_filter_ptr->filter_info, - &syn_filter, - sizeof(struct rte_eth_syn_filter)); + memcpy(&syn_filter_ptr->filter_info, &syn_filter, + sizeof(struct rte_eth_syn_filter)); TAILQ_INSERT_TAIL(&igb_filter_syn_list, syn_filter_ptr, entries); @@ -1562,9 +1561,8 @@ igb_flow_create(struct rte_eth_dev *dev, goto out; } - rte_memcpy(&flex_filter_ptr->filter_info, - &flex_filter, - sizeof(struct igb_flex_filter)); + memcpy(&flex_filter_ptr->filter_info, &flex_filter, + sizeof(struct igb_flex_filter)); TAILQ_INSERT_TAIL(&igb_filter_flex_list, flex_filter_ptr, entries); flow->rule = flex_filter_ptr; diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c index c7588ea57e..efb806af56 100644 --- a/drivers/net/e1000/igb_pf.c +++ b/drivers/net/e1000/igb_pf.c @@ -17,7 +17,6 @@ #include <rte_eal.h> #include <rte_ether.h> #include <ethdev_driver.h> -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_random.h> @@ -290,7 +289,7 @@ igb_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); + memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); e1000_write_mbx(hw, msgbuf, 3, vf); return 0; @@ -308,8 +307,8 @@ igb_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) if (rte_is_unicast_ether_addr((struct rte_ether_addr *)new_mac)) { if (!rte_is_zero_ether_addr((struct rte_ether_addr *)new_mac)) - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, - sizeof(vfinfo[vf].vf_mac_addresses)); + memcpy(vfinfo[vf].vf_mac_addresses, new_mac, + sizeof(vfinfo[vf].vf_mac_addresses)); hw->mac.ops.rar_set(hw, new_mac, rar_entry); rah = E1000_READ_REG(hw, E1000_RAH(rar_entry)); rah |= (0x1 << (E1000_RAH_POOLSEL_SHIFT + vf)); diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 5cafd6f1ce..4a41a3cea5 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_pci.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_eal.h> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index 2f681315b6..9e3e026856 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -1221,8 +1221,8 @@ static int enic_set_rsskey(struct enic *enic, uint8_t *user_key) /* Save for later queries */ if (!err) { - rte_memcpy(&enic->rss_key, rss_key_buf_va, - sizeof(union vnic_rss_key)); + memcpy(&enic->rss_key, rss_key_buf_va, + sizeof(union vnic_rss_key)); } enic_free_consistent(enic, sizeof(union vnic_rss_key), rss_key_buf_va, rss_key_buf_pa); @@ -1243,7 +1243,7 @@ int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu) if (!rss_cpu_buf_va) return -ENOMEM; - rte_memcpy(rss_cpu_buf_va, rss_cpu, sizeof(union vnic_rss_cpu)); + memcpy(rss_cpu_buf_va, rss_cpu, sizeof(union vnic_rss_cpu)); err = enic_set_rss_cpu(enic, rss_cpu_buf_pa, @@ -1254,7 +1254,7 @@ int enic_set_rss_reta(struct enic *enic, union vnic_rss_cpu *rss_cpu) /* Save for later queries */ if (!err) - rte_memcpy(&enic->rss_cpu, rss_cpu, sizeof(union vnic_rss_cpu)); + memcpy(&enic->rss_cpu, rss_cpu, sizeof(union vnic_rss_cpu)); return err; } diff --git a/drivers/net/failsafe/failsafe_ops.c b/drivers/net/failsafe/failsafe_ops.c index 9c013e0419..47d453ef80 100644 --- a/drivers/net/failsafe/failsafe_ops.c +++ b/drivers/net/failsafe/failsafe_ops.c @@ -902,16 +902,16 @@ fs_stats_get(struct rte_eth_dev *dev, ret = fs_lock(dev, 0); if (ret != 0) return ret; - rte_memcpy(stats, &PRIV(dev)->stats_accumulator, sizeof(*stats)); + memcpy(stats, &PRIV(dev)->stats_accumulator, sizeof(*stats)); FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_ACTIVE) { struct rte_eth_stats *snapshot = &sdev->stats_snapshot.stats; uint64_t *timestamp = &sdev->stats_snapshot.timestamp; - rte_memcpy(&backup, snapshot, sizeof(backup)); + memcpy(&backup, snapshot, sizeof(backup)); ret = rte_eth_stats_get(PORT_ID(sdev), snapshot); if (ret) { if (!fs_err(sdev, ret)) { - rte_memcpy(snapshot, &backup, sizeof(backup)); + memcpy(snapshot, &backup, sizeof(backup)); goto inc; } ERROR("Operation rte_eth_stats_get failed for sub_device %d with error %d", diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c index 629d15cfbe..24b00a1fbf 100644 --- a/drivers/net/gve/base/gve_adminq.c +++ b/drivers/net/gve/base/gve_adminq.c @@ -785,7 +785,7 @@ int gve_adminq_describe_device(struct gve_priv *priv) } priv->max_mtu = mtu; priv->num_event_counters = be16_to_cpu(descriptor->counters); - rte_memcpy(priv->dev_addr.addr_bytes, descriptor->mac, ETH_ALEN); + memcpy(priv->dev_addr.addr_bytes, descriptor->mac, ETH_ALEN); PMD_DRV_LOG(INFO, "MAC addr: " RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(&priv->dev_addr)); priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl); diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index d4978e0649..65ae92b1ff 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -7,7 +7,6 @@ #include <ethdev_pci.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_errno.h> #include <rte_ether.h> diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c index d1a564a163..cb61c989fd 100644 --- a/drivers/net/hinic/hinic_pmd_flow.c +++ b/drivers/net/hinic/hinic_pmd_flow.c @@ -983,8 +983,7 @@ static int hinic_normal_item_check_ip(const struct rte_flow_item **in_out_item, } ipv6_spec = (const struct rte_flow_item_ipv6 *)item->spec; - rte_memcpy(rule->hinic_fdir.dst_ipv6, - ipv6_spec->hdr.dst_addr, 16); + memcpy(rule->hinic_fdir.dst_ipv6, ipv6_spec->hdr.dst_addr, 16); /* * Check if the next not void item is TCP or UDP or ICMP. @@ -2193,8 +2192,8 @@ static int hinic_add_del_ntuple_filter(struct rte_eth_dev *dev, sizeof(struct hinic_5tuple_filter), 0); if (filter == NULL) return -ENOMEM; - rte_memcpy(&filter->filter_info, &filter_5tuple, - sizeof(struct hinic_5tuple_filter_info)); + memcpy(&filter->filter_info, &filter_5tuple, + sizeof(struct hinic_5tuple_filter_info)); filter->queue = ntuple_filter->queue; filter_info->qid = ntuple_filter->queue; @@ -2912,8 +2911,7 @@ static int hinic_add_del_tcam_fdir_filter(struct rte_eth_dev *dev, sizeof(struct hinic_tcam_filter), 0); if (tcam_filter == NULL) return -ENOMEM; - (void)rte_memcpy(&tcam_filter->tcam_key, - &tcam_key, sizeof(struct tag_tcam_key)); + memcpy(&tcam_filter->tcam_key, &tcam_key, sizeof(struct tag_tcam_key)); tcam_filter->queue = fdir_tcam_rule.data.qid; ret = hinic_add_tcam_filter(dev, tcam_filter, &fdir_tcam_rule); @@ -2990,9 +2988,9 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, &ntuple_filter, FALSE); goto out; } - rte_memcpy(&ntuple_filter_ptr->filter_info, - &ntuple_filter, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter_ptr->filter_info, + &ntuple_filter, + sizeof(struct rte_eth_ntuple_filter)); TAILQ_INSERT_TAIL(&nic_dev->filter_ntuple_list, ntuple_filter_ptr, entries); flow->rule = ntuple_filter_ptr; @@ -3022,9 +3020,9 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, ðertype_filter, FALSE); goto out; } - rte_memcpy(ðertype_filter_ptr->filter_info, - ðertype_filter, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter_ptr->filter_info, + ðertype_filter, + sizeof(struct rte_eth_ethertype_filter)); TAILQ_INSERT_TAIL(&nic_dev->filter_ethertype_list, ethertype_filter_ptr, entries); flow->rule = ethertype_filter_ptr; @@ -3065,8 +3063,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev, goto out; } - rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule, - sizeof(struct hinic_fdir_rule)); + memcpy(&fdir_rule_ptr->filter_info, &fdir_rule, + sizeof(struct hinic_fdir_rule)); TAILQ_INSERT_TAIL(&nic_dev->filter_fdir_rule_list, fdir_rule_ptr, entries); flow->rule = fdir_rule_ptr; @@ -3109,8 +3107,8 @@ static int hinic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, case RTE_ETH_FILTER_NTUPLE: ntuple_filter_ptr = (struct hinic_ntuple_filter_ele *) pmd_flow->rule; - rte_memcpy(&ntuple_filter, &ntuple_filter_ptr->filter_info, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter, &ntuple_filter_ptr->filter_info, + sizeof(struct rte_eth_ntuple_filter)); ret = hinic_add_del_ntuple_filter(dev, &ntuple_filter, FALSE); if (!ret) { TAILQ_REMOVE(&nic_dev->filter_ntuple_list, @@ -3121,9 +3119,8 @@ static int hinic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, case RTE_ETH_FILTER_ETHERTYPE: ethertype_filter_ptr = (struct hinic_ethertype_filter_ele *) pmd_flow->rule; - rte_memcpy(ðertype_filter, - ðertype_filter_ptr->filter_info, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter, ðertype_filter_ptr->filter_info, + sizeof(struct rte_eth_ethertype_filter)); ret = hinic_add_del_ethertype_filter(dev, ðertype_filter, FALSE); if (!ret) { @@ -3134,9 +3131,8 @@ static int hinic_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, break; case RTE_ETH_FILTER_FDIR: fdir_rule_ptr = (struct hinic_fdir_rule_ele *)pmd_flow->rule; - rte_memcpy(&fdir_rule, - &fdir_rule_ptr->filter_info, - sizeof(struct hinic_fdir_rule)); + memcpy(&fdir_rule, &fdir_rule_ptr->filter_info, + sizeof(struct hinic_fdir_rule)); if (fdir_rule.mode == HINIC_FDIR_MODE_NORMAL) { ret = hinic_add_del_fdir_filter(dev, &fdir_rule, FALSE); } else if (fdir_rule.mode == HINIC_FDIR_MODE_TCAM) { diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index d100e58d10..332cbb847b 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -996,7 +996,7 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns, return -ENOMEM; } - rte_memcpy(&node->fdir_conf, rule, sizeof(struct hns3_fdir_rule)); + memcpy(&node->fdir_conf, rule, sizeof(struct hns3_fdir_rule)); ret = hns3_insert_fdir_filter(hw, fdir_info, node); if (ret < 0) { rte_free(node); diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index 7fbe65313c..96b91bed6b 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -2416,8 +2416,8 @@ hns3_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, } rss_conf = (struct rte_flow_action_rss *)data; rss_rule = (struct hns3_rss_conf_ele *)flow->rule; - rte_memcpy(rss_conf, &rss_rule->filter_info.conf, - sizeof(struct rte_flow_action_rss)); + memcpy(rss_conf, &rss_rule->filter_info.conf, + sizeof(struct rte_flow_action_rss)); break; default: return rte_flow_error_set(error, ENOTSUP, diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 380ce1a720..bf128074b7 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -22,7 +22,6 @@ #include <ethdev_pci.h> #include <rte_memzone.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_alarm.h> #include <dev_driver.h> #include <rte_tailq.h> @@ -4448,7 +4447,7 @@ i40e_macaddr_add(struct rte_eth_dev *dev, return -EINVAL; } - rte_memcpy(&mac_filter.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(&mac_filter.mac_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) mac_filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; else @@ -5333,7 +5332,7 @@ i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi, vsi->info.valid_sections = rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID); memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; hw = I40E_VSI_TO_HW(vsi); @@ -5372,8 +5371,8 @@ i40e_vsi_update_tc_bandwidth(struct i40e_vsi *vsi, uint8_t enabled_tcmap) return ret; } - rte_memcpy(vsi->info.qs_handle, tc_bw_data.qs_handles, - sizeof(vsi->info.qs_handle)); + memcpy(vsi->info.qs_handle, tc_bw_data.qs_handles, + sizeof(vsi->info.qs_handle)); return I40E_SUCCESS; } @@ -5630,8 +5629,7 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) if (vsi->type != I40E_VSI_MAIN) return I40E_ERR_CONFIG; memset(&def_filter, 0, sizeof(def_filter)); - rte_memcpy(def_filter.mac_addr, hw->mac.perm_addr, - ETH_ADDR_LEN); + memcpy(def_filter.mac_addr, hw->mac.perm_addr, ETH_ADDR_LEN); def_filter.vlan_tag = 0; def_filter.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH | I40E_AQC_MACVLAN_DEL_IGNORE_VLAN; @@ -5649,16 +5647,15 @@ i40e_update_default_filter_setting(struct i40e_vsi *vsi) return I40E_ERR_NO_MEMORY; } mac = &f->mac_info.mac_addr; - rte_memcpy(&mac->addr_bytes, hw->mac.perm_addr, - ETH_ADDR_LEN); + memcpy(&mac->addr_bytes, hw->mac.perm_addr, ETH_ADDR_LEN); f->mac_info.filter_type = I40E_MACVLAN_PERFECT_MATCH; TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); vsi->mac_num++; return ret; } - rte_memcpy(&filter.mac_addr, - (struct rte_ether_addr *)(hw->mac.perm_addr), ETH_ADDR_LEN); + memcpy(&filter.mac_addr, (struct rte_ether_addr *)(hw->mac.perm_addr), + ETH_ADDR_LEN); filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; return i40e_vsi_add_mac(vsi, &filter); } @@ -5977,8 +5974,8 @@ i40e_vsi_setup(struct i40e_pf *pf, PMD_DRV_LOG(ERR, "Failed to get VSI params"); goto fail_msix_alloc; } - rte_memcpy(&vsi->info, &ctxt.info, - sizeof(struct i40e_aqc_vsi_properties_data)); + memcpy(&vsi->info, &ctxt.info, + sizeof(struct i40e_aqc_vsi_properties_data)); vsi->vsi_id = ctxt.vsi_number; vsi->info.valid_sections = 0; @@ -5995,8 +5992,8 @@ i40e_vsi_setup(struct i40e_pf *pf, rte_cpu_to_le_16(I40E_AQ_VSI_PROP_VLAN_VALID); vsi->info.port_vlan_flags = I40E_AQ_VSI_PVLAN_MODE_ALL | I40E_AQ_VSI_PVLAN_EMOD_STR_BOTH; - rte_memcpy(&ctxt.info, &vsi->info, - sizeof(struct i40e_aqc_vsi_properties_data)); + memcpy(&ctxt.info, &vsi->info, + sizeof(struct i40e_aqc_vsi_properties_data)); ret = i40e_vsi_config_tc_queue_mapping(vsi, &ctxt.info, I40E_DEFAULT_TCMAP); if (ret != I40E_SUCCESS) { @@ -6016,16 +6013,15 @@ i40e_vsi_setup(struct i40e_pf *pf, goto fail_msix_alloc; } - rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, - sizeof(vsi->info.tc_mapping)); - rte_memcpy(&vsi->info.queue_mapping, - &ctxt.info.queue_mapping, - sizeof(vsi->info.queue_mapping)); + memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, + sizeof(vsi->info.tc_mapping)); + memcpy(&vsi->info.queue_mapping, &ctxt.info.queue_mapping, + sizeof(vsi->info.queue_mapping)); vsi->info.mapping_flags = ctxt.info.mapping_flags; vsi->info.valid_sections = 0; - rte_memcpy(pf->dev_addr.addr_bytes, hw->mac.perm_addr, - ETH_ADDR_LEN); + memcpy(pf->dev_addr.addr_bytes, hw->mac.perm_addr, + ETH_ADDR_LEN); /** * Updating default filter settings are necessary to prevent @@ -6168,7 +6164,7 @@ i40e_vsi_setup(struct i40e_pf *pf, if (vsi->type != I40E_VSI_FDIR) { /* MAC/VLAN configuration for non-FDIR VSI*/ - rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); + memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); @@ -6281,7 +6277,7 @@ i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on) vsi->info.port_vlan_flags &= ~(I40E_AQ_VSI_PVLAN_EMOD_MASK); vsi->info.port_vlan_flags |= vlan_flags; ctxt.seid = vsi->seid; - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); if (ret) PMD_DRV_LOG(INFO, "Update VSI failed to %s vlan stripping", @@ -7148,8 +7144,8 @@ i40e_add_macvlan_filters(struct i40e_vsi *vsi, memset(req_list, 0, ele_buff_size); for (i = 0; i < actual_num; i++) { - rte_memcpy(req_list[i].mac_addr, - &filter[num + i].macaddr, ETH_ADDR_LEN); + memcpy(req_list[i].mac_addr, &filter[num + i].macaddr, + ETH_ADDR_LEN); req_list[i].vlan_tag = rte_cpu_to_le_16(filter[num + i].vlan_id); @@ -7224,8 +7220,8 @@ i40e_remove_macvlan_filters(struct i40e_vsi *vsi, memset(req_list, 0, ele_buff_size); for (i = 0; i < actual_num; i++) { - rte_memcpy(req_list[i].mac_addr, - &filter[num + i].macaddr, ETH_ADDR_LEN); + memcpy(req_list[i].mac_addr, &filter[num + i].macaddr, + ETH_ADDR_LEN); req_list[i].vlan_tag = rte_cpu_to_le_16(filter[num + i].vlan_id); @@ -7381,8 +7377,8 @@ i40e_find_all_vlan_for_mac(struct i40e_vsi *vsi, "vlan number doesn't match"); return I40E_ERR_PARAM; } - rte_memcpy(&mv_f[i].macaddr, - addr, ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, addr, + ETH_ADDR_LEN); mv_f[i].vlan_id = j * I40E_UINT32_BIT_SIZE + k; i++; @@ -7410,8 +7406,7 @@ i40e_find_all_mac_for_vlan(struct i40e_vsi *vsi, PMD_DRV_LOG(ERR, "buffer number not match"); return I40E_ERR_PARAM; } - rte_memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, - ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, ETH_ADDR_LEN); mv_f[i].vlan_id = vlan; mv_f[i].filter_type = f->mac_info.filter_type; i++; @@ -7446,8 +7441,8 @@ i40e_vsi_remove_all_macvlan_filter(struct i40e_vsi *vsi) i = 0; if (vsi->vlan_num == 0) { TAILQ_FOREACH(f, &vsi->mac_list, next) { - rte_memcpy(&mv_f[i].macaddr, - &f->mac_info.mac_addr, ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, + ETH_ADDR_LEN); mv_f[i].filter_type = f->mac_info.filter_type; mv_f[i].vlan_id = 0; i++; @@ -7616,8 +7611,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) for (i = 0; i < vlan_num; i++) { mv_f[i].filter_type = mac_filter->filter_type; - rte_memcpy(&mv_f[i].macaddr, &mac_filter->mac_addr, - ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &mac_filter->mac_addr, ETH_ADDR_LEN); } if (mac_filter->filter_type == I40E_MACVLAN_PERFECT_MATCH || @@ -7639,8 +7633,7 @@ i40e_vsi_add_mac(struct i40e_vsi *vsi, struct i40e_mac_filter_info *mac_filter) ret = I40E_ERR_NO_MEMORY; goto DONE; } - rte_memcpy(&f->mac_info.mac_addr, &mac_filter->mac_addr, - ETH_ADDR_LEN); + memcpy(&f->mac_info.mac_addr, &mac_filter->mac_addr, ETH_ADDR_LEN); f->mac_info.filter_type = mac_filter->filter_type; TAILQ_INSERT_TAIL(&vsi->mac_list, f, next); vsi->mac_num++; @@ -7686,8 +7679,7 @@ i40e_vsi_delete_mac(struct i40e_vsi *vsi, struct rte_ether_addr *addr) for (i = 0; i < vlan_num; i++) { mv_f[i].filter_type = filter_type; - rte_memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, - ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, ETH_ADDR_LEN); } if (filter_type == I40E_MACVLAN_PERFECT_MATCH || filter_type == I40E_MACVLAN_HASH_MATCH) { @@ -7973,9 +7965,8 @@ i40e_tunnel_filter_convert( tunnel_filter->input.flags = cld_filter->element.flags; tunnel_filter->input.tenant_id = cld_filter->element.tenant_id; tunnel_filter->queue = cld_filter->element.queue_number; - rte_memcpy(tunnel_filter->input.general_fields, - cld_filter->general_fields, - sizeof(cld_filter->general_fields)); + memcpy(tunnel_filter->input.general_fields, + cld_filter->general_fields, sizeof(cld_filter->general_fields)); return 0; } @@ -8522,9 +8513,8 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4; ipv4_addr = rte_be_to_cpu_32(tunnel_filter->ip_addr.ipv4_addr); ipv4_addr_le = rte_cpu_to_le_32(ipv4_addr); - rte_memcpy(&pfilter->element.ipaddr.v4.data, - &ipv4_addr_le, - sizeof(pfilter->element.ipaddr.v4.data)); + memcpy(&pfilter->element.ipaddr.v4.data, &ipv4_addr_le, + sizeof(pfilter->element.ipaddr.v4.data)); } else { ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV6; for (i = 0; i < 4; i++) { @@ -8532,9 +8522,8 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, rte_cpu_to_le_32(rte_be_to_cpu_32( tunnel_filter->ip_addr.ipv6_addr[i])); } - rte_memcpy(&pfilter->element.ipaddr.v6.data, - &convert_ipv6, - sizeof(pfilter->element.ipaddr.v6.data)); + memcpy(&pfilter->element.ipaddr.v6.data, &convert_ipv6, + sizeof(pfilter->element.ipaddr.v6.data)); } /* check tunneled type */ @@ -8779,7 +8768,7 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf, return -ENOMEM; } - rte_memcpy(tunnel, &check_filter, sizeof(check_filter)); + memcpy(tunnel, &check_filter, sizeof(check_filter)); ret = i40e_sw_tunnel_filter_insert(pf, tunnel); if (ret < 0) rte_free(tunnel); @@ -9904,8 +9893,7 @@ static int i40e_ethertype_filter_convert(const struct rte_eth_ethertype_filter *input, struct i40e_ethertype_filter *filter) { - rte_memcpy(&filter->input.mac_addr, &input->mac_addr, - RTE_ETHER_ADDR_LEN); + memcpy(&filter->input.mac_addr, &input->mac_addr, RTE_ETHER_ADDR_LEN); filter->input.ether_type = input->ether_type; filter->flags = input->flags; filter->queue = input->queue; @@ -10052,8 +10040,7 @@ i40e_ethertype_filter_set(struct i40e_pf *pf, return -ENOMEM; } - rte_memcpy(ethertype_filter, &check_filter, - sizeof(check_filter)); + memcpy(ethertype_filter, &check_filter, sizeof(check_filter)); ret = i40e_sw_ethertype_filter_insert(pf, ethertype_filter); if (ret < 0) rte_free(ethertype_filter); @@ -10933,11 +10920,10 @@ i40e_vsi_config_tc(struct i40e_vsi *vsi, uint8_t tc_map) goto out; } /* update the local VSI info with updated queue map */ - rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, - sizeof(vsi->info.tc_mapping)); - rte_memcpy(&vsi->info.queue_mapping, - &ctxt.info.queue_mapping, - sizeof(vsi->info.queue_mapping)); + memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, + sizeof(vsi->info.tc_mapping)); + memcpy(&vsi->info.queue_mapping, &ctxt.info.queue_mapping, + sizeof(vsi->info.queue_mapping)); vsi->info.mapping_flags = ctxt.info.mapping_flags; vsi->info.valid_sections = 0; @@ -11689,9 +11675,8 @@ i40e_tunnel_filter_restore(struct i40e_pf *pf) cld_filter.element.flags = f->input.flags; cld_filter.element.tenant_id = f->input.tenant_id; cld_filter.element.queue_number = f->queue; - rte_memcpy(cld_filter.general_fields, - f->input.general_fields, - sizeof(f->input.general_fields)); + memcpy(cld_filter.general_fields, f->input.general_fields, + sizeof(f->input.general_fields)); if (((f->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X11) == diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c index 47f79ecf11..554b763e9f 100644 --- a/drivers/net/i40e/i40e_fdir.c +++ b/drivers/net/i40e/i40e_fdir.c @@ -464,10 +464,10 @@ fill_ip6_head(const struct i40e_fdir_input *fdir_input, unsigned char *raw_pkt, * need to be presented in a reversed order with respect * to the expected received packets. */ - rte_memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip, - IPV6_ADDR_LEN); - rte_memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, - IPV6_ADDR_LEN); + memcpy(&ip6->src_addr, &fdir_input->flow.ipv6_flow.dst_ip, + IPV6_ADDR_LEN); + memcpy(&ip6->dst_addr, &fdir_input->flow.ipv6_flow.src_ip, + IPV6_ADDR_LEN); len += sizeof(struct rte_ipv6_hdr); return len; @@ -528,18 +528,16 @@ i40e_flow_fdir_fill_eth_ip_head(struct i40e_pf *pf, [I40E_FILTER_PCTYPE_NONF_IPV6_OTHER] = IPPROTO_NONE, }; - rte_memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, - sizeof(struct rte_ether_addr)); - rte_memcpy(raw_pkt + sizeof(struct rte_ether_addr), - &fdir_input->flow.l2_flow.src, - sizeof(struct rte_ether_addr)); + memcpy(raw_pkt, &fdir_input->flow.l2_flow.dst, + sizeof(struct rte_ether_addr)); + memcpy(raw_pkt + sizeof(struct rte_ether_addr), + &fdir_input->flow.l2_flow.src, sizeof(struct rte_ether_addr)); raw_pkt += 2 * sizeof(struct rte_ether_addr); if (vlan && fdir_input->flow_ext.vlan_tci) { - rte_memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); - rte_memcpy(raw_pkt + sizeof(uint16_t), - &fdir_input->flow_ext.vlan_tci, - sizeof(uint16_t)); + memcpy(raw_pkt, vlan_frame, sizeof(vlan_frame)); + memcpy(raw_pkt + sizeof(uint16_t), + &fdir_input->flow_ext.vlan_tci, sizeof(uint16_t)); raw_pkt += sizeof(vlan_frame); len += sizeof(vlan_frame); } @@ -1003,7 +1001,7 @@ static int i40e_fdir_filter_convert(const struct i40e_fdir_filter_conf *input, struct i40e_fdir_filter *filter) { - rte_memcpy(&filter->fdir, input, sizeof(struct i40e_fdir_filter_conf)); + memcpy(&filter->fdir, input, sizeof(struct i40e_fdir_filter_conf)); if (input->input.flow_ext.pkt_template) { filter->fdir.input.flow.raw_flow.packet = NULL; filter->fdir.input.flow.raw_flow.length = @@ -1060,7 +1058,7 @@ i40e_sw_fdir_filter_insert(struct i40e_pf *pf, struct i40e_fdir_filter *filter) return -1; hash_filter = &fdir_info->fdir_filter_array[ret]; - rte_memcpy(hash_filter, filter, sizeof(*filter)); + memcpy(hash_filter, filter, sizeof(*filter)); fdir_info->hash_map[ret] = hash_filter; TAILQ_INSERT_TAIL(&fdir_info->fdir_list, hash_filter, rules); diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 92165c8422..9afb7a540d 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -1175,7 +1175,7 @@ i40e_pattern_skip_void_item(struct rte_flow_item *items, pb = pe + 1; } /* Copy the END item. */ - rte_memcpy(items, pe, sizeof(struct rte_flow_item)); + memcpy(items, pe, sizeof(struct rte_flow_item)); } /* Check if the pattern matches a supported item type array */ @@ -1986,10 +1986,10 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, filter->input.flow_ext.oip_type = I40E_FDIR_IPTYPE_IPV6; - rte_memcpy(filter->input.flow.ipv6_flow.src_ip, - ipv6_spec->hdr.src_addr, 16); - rte_memcpy(filter->input.flow.ipv6_flow.dst_ip, - ipv6_spec->hdr.dst_addr, 16); + memcpy(filter->input.flow.ipv6_flow.src_ip, + ipv6_spec->hdr.src_addr, 16); + memcpy(filter->input.flow.ipv6_flow.dst_ip, + ipv6_spec->hdr.dst_addr, 16); /* Check if it is fragment. */ if (ipv6_spec->hdr.proto == @@ -2926,14 +2926,14 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, } if (!vxlan_flag) { - rte_memcpy(&filter->outer_mac, - ð_spec->hdr.dst_addr, - RTE_ETHER_ADDR_LEN); + memcpy(&filter->outer_mac, + ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); filter_type |= RTE_ETH_TUNNEL_FILTER_OMAC; } else { - rte_memcpy(&filter->inner_mac, - ð_spec->hdr.dst_addr, - RTE_ETHER_ADDR_LEN); + memcpy(&filter->inner_mac, + ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); filter_type |= RTE_ETH_TUNNEL_FILTER_IMAC; } } @@ -3026,8 +3026,8 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev, return -rte_errno; } - rte_memcpy(((uint8_t *)&tenant_id_be + 1), - vxlan_spec->hdr.vni, 3); + memcpy(((uint8_t *)&tenant_id_be + 1), + vxlan_spec->hdr.vni, 3); filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); filter_type |= RTE_ETH_TUNNEL_FILTER_TENID; @@ -3156,14 +3156,14 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, } if (!nvgre_flag) { - rte_memcpy(&filter->outer_mac, - ð_spec->hdr.dst_addr, - RTE_ETHER_ADDR_LEN); + memcpy(&filter->outer_mac, + ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); filter_type |= RTE_ETH_TUNNEL_FILTER_OMAC; } else { - rte_memcpy(&filter->inner_mac, - ð_spec->hdr.dst_addr, - RTE_ETHER_ADDR_LEN); + memcpy(&filter->inner_mac, + ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); filter_type |= RTE_ETH_TUNNEL_FILTER_IMAC; } } @@ -3278,8 +3278,8 @@ i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev, "Invalid NVGRE item"); return -rte_errno; } - rte_memcpy(((uint8_t *)&tenant_id_be + 1), - nvgre_spec->tni, 3); + memcpy(((uint8_t *)&tenant_id_be + 1), + nvgre_spec->tni, 3); filter->tenant_id = rte_be_to_cpu_32(tenant_id_be); filter_type |= RTE_ETH_TUNNEL_FILTER_TENID; @@ -3447,8 +3447,8 @@ i40e_flow_parse_mpls_pattern(__rte_unused struct rte_eth_dev *dev, "Invalid MPLS label mask"); return -rte_errno; } - rte_memcpy(((uint8_t *)&label_be + 1), - mpls_spec->label_tc_s, 3); + memcpy(((uint8_t *)&label_be + 1), + mpls_spec->label_tc_s, 3); filter->tenant_id = rte_be_to_cpu_32(label_be) >> 4; break; default: @@ -4051,9 +4051,8 @@ i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf, cld_filter.element.flags = filter->input.flags; cld_filter.element.tenant_id = filter->input.tenant_id; cld_filter.element.queue_number = filter->queue; - rte_memcpy(cld_filter.general_fields, - filter->input.general_fields, - sizeof(cld_filter.general_fields)); + memcpy(cld_filter.general_fields, filter->input.general_fields, + sizeof(cld_filter.general_fields)); if (!filter->is_to_vf) vsi = pf->main_vsi; @@ -4271,9 +4270,8 @@ i40e_flow_query(struct rte_eth_dev *dev __rte_unused, "action not supported"); return -rte_errno; } - rte_memcpy(rss_conf, - &rss_rule->rss_filter_info.conf, - sizeof(struct rte_flow_action_rss)); + memcpy(rss_conf, &rss_rule->rss_filter_info.conf, + sizeof(struct rte_flow_action_rss)); break; default: return rte_flow_error_set(error, ENOTSUP, diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c index 15d9ff868f..f8073ef9cb 100644 --- a/drivers/net/i40e/i40e_pf.c +++ b/drivers/net/i40e/i40e_pf.c @@ -16,7 +16,6 @@ #include <rte_ether.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include "i40e_logs.h" #include "base/i40e_prototype.h" @@ -869,7 +868,7 @@ i40e_pf_host_process_cmd_add_ether_address(struct i40e_pf_vf *vf, for (i = 0; i < addr_list->num_elements; i++) { mac = (struct rte_ether_addr *)(addr_list->list[i].addr); - rte_memcpy(&filter.mac_addr, mac, RTE_ETHER_ADDR_LEN); + memcpy(&filter.mac_addr, mac, RTE_ETHER_ADDR_LEN); filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; if (rte_is_zero_ether_addr(mac) || i40e_vsi_add_mac(vf->vsi, &filter)) { diff --git a/drivers/net/i40e/i40e_tm.c b/drivers/net/i40e/i40e_tm.c index cab296e1a4..3f77a7b3a0 100644 --- a/drivers/net/i40e/i40e_tm.c +++ b/drivers/net/i40e/i40e_tm.c @@ -279,8 +279,8 @@ i40e_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&pf->tm_conf.shaper_profile_list, shaper_profile, node); @@ -526,8 +526,8 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->reference_count = 0; tm_node->parent = NULL; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); pf->tm_conf.root = tm_node; /* increase the reference counter of the shaper profile */ @@ -600,8 +600,7 @@ i40e_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->reference_count = 0; tm_node->parent = parent_node; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); if (parent_node_type == I40E_TM_NODE_TYPE_PORT) { TAILQ_INSERT_TAIL(&pf->tm_conf.tc_list, tm_node, node); diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c index 9d39984ea1..03d0b61902 100644 --- a/drivers/net/i40e/rte_pmd_i40e.c +++ b/drivers/net/i40e/rte_pmd_i40e.c @@ -90,7 +90,7 @@ rte_pmd_i40e_set_vf_mac_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on) vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_MAC_CHK; memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; hw = I40E_VSI_TO_HW(vsi); @@ -192,7 +192,7 @@ rte_pmd_i40e_set_vf_vlan_anti_spoof(uint16_t port, uint16_t vf_id, uint8_t on) vsi->info.sec_flags &= ~I40E_AQ_VSI_SEC_FLAG_ENABLE_VLAN_CHK; memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; hw = I40E_VSI_TO_HW(vsi); @@ -237,9 +237,8 @@ i40e_vsi_rm_mac_filter(struct i40e_vsi *vsi) for (i = 0; i < vlan_num; i++) { mv_f[i].filter_type = filter_type; - rte_memcpy(&mv_f[i].macaddr, - &f->mac_info.mac_addr, - ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, + ETH_ADDR_LEN); } if (filter_type == I40E_MACVLAN_PERFECT_MATCH || filter_type == I40E_MACVLAN_HASH_MATCH) { @@ -298,9 +297,8 @@ i40e_vsi_restore_mac_filter(struct i40e_vsi *vsi) for (i = 0; i < vlan_num; i++) { mv_f[i].filter_type = f->mac_info.filter_type; - rte_memcpy(&mv_f[i].macaddr, - &f->mac_info.mac_addr, - ETH_ADDR_LEN); + memcpy(&mv_f[i].macaddr, &f->mac_info.mac_addr, + ETH_ADDR_LEN); } if (f->mac_info.filter_type == I40E_MACVLAN_PERFECT_MATCH || @@ -380,7 +378,7 @@ i40e_vsi_set_tx_loopback(struct i40e_vsi *vsi, uint8_t on) vsi->info.switch_id &= ~I40E_AQ_VSI_SW_ID_FLAG_ALLOW_LB; memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; ret = i40e_aq_update_vsi_params(hw, &ctxt, NULL); @@ -705,7 +703,7 @@ int rte_pmd_i40e_set_vf_vlan_insert(uint16_t port, uint16_t vf_id, vsi->info.port_vlan_flags &= ~I40E_AQ_VSI_PVLAN_INSERT_PVID; memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; hw = I40E_VSI_TO_HW(vsi); @@ -767,7 +765,7 @@ int rte_pmd_i40e_set_vf_broadcast(uint16_t port, uint16_t vf_id, } if (on) { - rte_memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); + memcpy(&filter.mac_addr, &broadcast, RTE_ETHER_ADDR_LEN); filter.filter_type = I40E_MACVLAN_PERFECT_MATCH; ret = i40e_vsi_add_mac(vsi, &filter); } else { @@ -839,7 +837,7 @@ int rte_pmd_i40e_set_vf_vlan_tag(uint16_t port, uint16_t vf_id, uint8_t on) } memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.seid = vsi->seid; hw = I40E_VSI_TO_HW(vsi); @@ -2586,11 +2584,10 @@ i40e_vsi_update_queue_region_mapping(struct i40e_hw *hw, return ret; } /* update the local VSI info with updated queue map */ - rte_memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, - sizeof(vsi->info.tc_mapping)); - rte_memcpy(&vsi->info.queue_mapping, - &ctxt.info.queue_mapping, - sizeof(vsi->info.queue_mapping)); + memcpy(&vsi->info.tc_mapping, &ctxt.info.tc_mapping, + sizeof(vsi->info.tc_mapping)); + memcpy(&vsi->info.queue_mapping, &ctxt.info.queue_mapping, + sizeof(vsi->info.queue_mapping)); vsi->info.mapping_flags = ctxt.info.mapping_flags; vsi->info.valid_sections = 0; @@ -2961,8 +2958,7 @@ i40e_queue_region_get_all_info(struct i40e_pf *pf, { struct i40e_queue_regions *info = &pf->queue_region; - rte_memcpy(regions_ptr, info, - sizeof(struct i40e_queue_regions)); + memcpy(regions_ptr, info, sizeof(struct i40e_queue_regions)); return 0; } diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index 811a10287b..35257c43f1 100644 --- a/drivers/net/iavf/iavf_fdir.c +++ b/drivers/net/iavf/iavf_fdir.c @@ -374,7 +374,7 @@ iavf_fdir_create(struct iavf_adapter *ad, if (filter->mark_flag == 1) iavf_fdir_rx_proc_enable(ad, 1); - rte_memcpy(rule, filter, sizeof(*rule)); + memcpy(rule, filter, sizeof(*rule)); flow->rule = rule; return 0; @@ -672,15 +672,13 @@ iavf_fdir_refine_input_set(const uint64_t input_set, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV4, PROT); memset(&ipv4_spec, 0, sizeof(ipv4_spec)); ipv4_spec.hdr.next_proto_id = proto_id; - rte_memcpy(hdr->buffer, &ipv4_spec.hdr, - sizeof(ipv4_spec.hdr)); + memcpy(hdr->buffer, &ipv4_spec.hdr, sizeof(ipv4_spec.hdr)); return true; case VIRTCHNL_PROTO_HDR_IPV6: VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, IPV6, PROT); memset(&ipv6_spec, 0, sizeof(ipv6_spec)); ipv6_spec.hdr.proto = proto_id; - rte_memcpy(hdr->buffer, &ipv6_spec.hdr, - sizeof(ipv6_spec.hdr)); + memcpy(hdr->buffer, &ipv6_spec.hdr, sizeof(ipv6_spec.hdr)); return true; default: return false; @@ -885,8 +883,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, ETHERTYPE); } - rte_memcpy(hdr1->buffer, eth_spec, - sizeof(struct rte_ether_hdr)); + memcpy(hdr1->buffer, eth_spec, + sizeof(struct rte_ether_hdr)); } hdrs->count = ++layer; @@ -976,8 +974,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, input_set |= IAVF_PROT_IPV4_INNER; } - rte_memcpy(hdr->buffer, &ipv4_spec->hdr, - sizeof(ipv4_spec->hdr)); + memcpy(hdr->buffer, &ipv4_spec->hdr, + sizeof(ipv4_spec->hdr)); hdrs->count = ++layer; @@ -1066,8 +1064,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, input_set |= IAVF_PROT_IPV6_INNER; } - rte_memcpy(hdr->buffer, &ipv6_spec->hdr, - sizeof(ipv6_spec->hdr)); + memcpy(hdr->buffer, &ipv6_spec->hdr, + sizeof(ipv6_spec->hdr)); hdrs->count = ++layer; break; @@ -1101,8 +1099,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr1, ETH, ETHERTYPE); - rte_memcpy(hdr->buffer, &ipv6_frag_spec->hdr, - sizeof(ipv6_frag_spec->hdr)); + memcpy(hdr->buffer, &ipv6_frag_spec->hdr, + sizeof(ipv6_frag_spec->hdr)); } else if (ipv6_frag_mask->hdr.id == UINT32_MAX) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -1153,13 +1151,11 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, } if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) - rte_memcpy(hdr->buffer, - &udp_spec->hdr, - sizeof(udp_spec->hdr)); + memcpy(hdr->buffer, &udp_spec->hdr, + sizeof(udp_spec->hdr)); else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) - rte_memcpy(hdr->buffer, - &udp_spec->hdr, - sizeof(udp_spec->hdr)); + memcpy(hdr->buffer, &udp_spec->hdr, + sizeof(udp_spec->hdr)); } hdrs->count = ++layer; @@ -1210,13 +1206,11 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, } if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) - rte_memcpy(hdr->buffer, - &tcp_spec->hdr, - sizeof(tcp_spec->hdr)); + memcpy(hdr->buffer, &tcp_spec->hdr, + sizeof(tcp_spec->hdr)); else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) - rte_memcpy(hdr->buffer, - &tcp_spec->hdr, - sizeof(tcp_spec->hdr)); + memcpy(hdr->buffer, &tcp_spec->hdr, + sizeof(tcp_spec->hdr)); } hdrs->count = ++layer; @@ -1256,13 +1250,11 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, } if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) - rte_memcpy(hdr->buffer, - &sctp_spec->hdr, - sizeof(sctp_spec->hdr)); + memcpy(hdr->buffer, &sctp_spec->hdr, + sizeof(sctp_spec->hdr)); else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) - rte_memcpy(hdr->buffer, - &sctp_spec->hdr, - sizeof(sctp_spec->hdr)); + memcpy(hdr->buffer, &sctp_spec->hdr, + sizeof(sctp_spec->hdr)); } hdrs->count = ++layer; @@ -1291,8 +1283,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, GTPU_IP, TEID); } - rte_memcpy(hdr->buffer, - gtp_spec, sizeof(*gtp_spec)); + memcpy(hdr->buffer, gtp_spec, + sizeof(*gtp_spec)); } tun_inner = 1; @@ -1346,8 +1338,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, psc.qfi = gtp_psc_spec->hdr.qfi; psc.type = gtp_psc_spec->hdr.type; psc.next = 0; - rte_memcpy(hdr->buffer, &psc, - sizeof(struct iavf_gtp_psc_spec_hdr)); + memcpy(hdr->buffer, &psc, + sizeof(struct iavf_gtp_psc_spec_hdr)); } hdrs->count = ++layer; @@ -1367,8 +1359,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, L2TPV3, SESS_ID); } - rte_memcpy(hdr->buffer, l2tpv3oip_spec, - sizeof(*l2tpv3oip_spec)); + memcpy(hdr->buffer, l2tpv3oip_spec, + sizeof(*l2tpv3oip_spec)); } hdrs->count = ++layer; @@ -1388,8 +1380,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, ESP, SPI); } - rte_memcpy(hdr->buffer, &esp_spec->hdr, - sizeof(esp_spec->hdr)); + memcpy(hdr->buffer, &esp_spec->hdr, + sizeof(esp_spec->hdr)); } hdrs->count = ++layer; @@ -1409,8 +1401,7 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, AH, SPI); } - rte_memcpy(hdr->buffer, ah_spec, - sizeof(*ah_spec)); + memcpy(hdr->buffer, ah_spec, sizeof(*ah_spec)); } hdrs->count = ++layer; @@ -1430,8 +1421,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, PFCP, S_FIELD); } - rte_memcpy(hdr->buffer, pfcp_spec, - sizeof(*pfcp_spec)); + memcpy(hdr->buffer, pfcp_spec, + sizeof(*pfcp_spec)); } hdrs->count = ++layer; @@ -1455,8 +1446,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, PC_RTC_ID); } - rte_memcpy(hdr->buffer, ecpri_spec, - sizeof(*ecpri_spec)); + memcpy(hdr->buffer, ecpri_spec, + sizeof(*ecpri_spec)); } hdrs->count = ++layer; @@ -1471,8 +1462,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GRE); if (gre_spec && gre_mask) { - rte_memcpy(hdr->buffer, gre_spec, - sizeof(*gre_spec)); + memcpy(hdr->buffer, gre_spec, + sizeof(*gre_spec)); } tun_inner = 1; @@ -1520,8 +1511,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, SESS_ID); } - rte_memcpy(hdr->buffer, l2tpv2_spec, - sizeof(*l2tpv2_spec)); + memcpy(hdr->buffer, l2tpv2_spec, + sizeof(*l2tpv2_spec)); } tun_inner = 1; @@ -1538,8 +1529,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad, VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, PPP); if (ppp_spec && ppp_mask) { - rte_memcpy(hdr->buffer, ppp_spec, - sizeof(*ppp_spec)); + memcpy(hdr->buffer, ppp_spec, + sizeof(*ppp_spec)); } hdrs->count = ++layer; diff --git a/drivers/net/iavf/iavf_fsub.c b/drivers/net/iavf/iavf_fsub.c index 74e1e7099b..d98cde0fa5 100644 --- a/drivers/net/iavf/iavf_fsub.c +++ b/drivers/net/iavf/iavf_fsub.c @@ -92,7 +92,7 @@ iavf_fsub_create(struct iavf_adapter *ad, struct rte_flow *flow, goto free_entry; } - rte_memcpy(rule, filter, sizeof(*rule)); + memcpy(rule, filter, sizeof(*rule)); flow->rule = rule; rte_free(meta); @@ -272,10 +272,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], input_set_byte += 2; } - rte_memcpy(hdr1->buffer_spec, eth_spec, - sizeof(struct rte_ether_hdr)); - rte_memcpy(hdr1->buffer_mask, eth_mask, - sizeof(struct rte_ether_hdr)); + memcpy(hdr1->buffer_spec, eth_spec, + sizeof(struct rte_ether_hdr)); + memcpy(hdr1->buffer_mask, eth_mask, + sizeof(struct rte_ether_hdr)); } else { /* flow subscribe filter will add dst mac in kernel */ input_set_byte += 6; @@ -325,10 +325,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], input_set_byte++; } - rte_memcpy(hdr->buffer_spec, &ipv4_spec->hdr, - sizeof(ipv4_spec->hdr)); - rte_memcpy(hdr->buffer_mask, &ipv4_mask->hdr, - sizeof(ipv4_spec->hdr)); + memcpy(hdr->buffer_spec, &ipv4_spec->hdr, + sizeof(ipv4_spec->hdr)); + memcpy(hdr->buffer_mask, &ipv4_mask->hdr, + sizeof(ipv4_spec->hdr)); } hdrs->count = ++layer; @@ -388,10 +388,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], input_set_byte += 4; } - rte_memcpy(hdr->buffer_spec, &ipv6_spec->hdr, - sizeof(ipv6_spec->hdr)); - rte_memcpy(hdr->buffer_mask, &ipv6_mask->hdr, - sizeof(ipv6_spec->hdr)); + memcpy(hdr->buffer_spec, &ipv6_spec->hdr, + sizeof(ipv6_spec->hdr)); + memcpy(hdr->buffer_mask, &ipv6_mask->hdr, + sizeof(ipv6_spec->hdr)); } hdrs->count = ++layer; @@ -425,10 +425,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], input_set_byte += 2; } - rte_memcpy(hdr->buffer_spec, &udp_spec->hdr, - sizeof(udp_spec->hdr)); - rte_memcpy(hdr->buffer_mask, &udp_mask->hdr, - sizeof(udp_mask->hdr)); + memcpy(hdr->buffer_spec, &udp_spec->hdr, + sizeof(udp_spec->hdr)); + memcpy(hdr->buffer_mask, &udp_mask->hdr, + sizeof(udp_mask->hdr)); } hdrs->count = ++layer; @@ -466,10 +466,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], input_set_byte += 2; } - rte_memcpy(hdr->buffer_spec, &tcp_spec->hdr, - sizeof(tcp_spec->hdr)); - rte_memcpy(hdr->buffer_mask, &tcp_mask->hdr, - sizeof(tcp_mask->hdr)); + memcpy(hdr->buffer_spec, &tcp_spec->hdr, + sizeof(tcp_spec->hdr)); + memcpy(hdr->buffer_mask, &tcp_mask->hdr, + sizeof(tcp_mask->hdr)); } hdrs->count = ++layer; @@ -498,10 +498,10 @@ iavf_fsub_parse_pattern(const struct rte_flow_item pattern[], return -rte_errno; } - rte_memcpy(hdr->buffer_spec, &vlan_spec->hdr, - sizeof(vlan_spec->hdr)); - rte_memcpy(hdr->buffer_mask, &vlan_mask->hdr, - sizeof(vlan_mask->hdr)); + memcpy(hdr->buffer_spec, &vlan_spec->hdr, + sizeof(vlan_spec->hdr)); + memcpy(hdr->buffer_mask, &vlan_mask->hdr, + sizeof(vlan_mask->hdr)); } hdrs->count = ++layer; diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c index 6f6e95fc45..0bcfb5bf24 100644 --- a/drivers/net/iavf/iavf_generic_flow.c +++ b/drivers/net/iavf/iavf_generic_flow.c @@ -2019,7 +2019,7 @@ iavf_pattern_skip_void_item(struct rte_flow_item *items, pb = pe + 1; } /* Copy the END item. */ - rte_memcpy(items, pe, sizeof(struct rte_flow_item)); + memcpy(items, pe, sizeof(struct rte_flow_item)); } /* Check if the pattern matches a supported item type array */ diff --git a/drivers/net/iavf/iavf_tm.c b/drivers/net/iavf/iavf_tm.c index 32bb3be45e..a6ad6bb0a2 100644 --- a/drivers/net/iavf/iavf_tm.c +++ b/drivers/net/iavf/iavf_tm.c @@ -342,8 +342,8 @@ iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->id = node_id; tm_node->parent = NULL; tm_node->reference_count = 0; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); vf->tm_conf.root = tm_node; return 0; } @@ -403,8 +403,7 @@ iavf_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->reference_count = 0; tm_node->parent = parent_node; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); if (parent_node_type == IAVF_TM_NODE_TYPE_PORT) { TAILQ_INSERT_TAIL(&vf->tm_conf.tc_list, tm_node, node); @@ -543,8 +542,8 @@ iavf_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&vf->tm_conf.shaper_profile_list, shaper_profile, node); diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index 1111d30f57..711186c1b5 100644 --- a/drivers/net/iavf/iavf_vchnl.c +++ b/drivers/net/iavf/iavf_vchnl.c @@ -920,7 +920,7 @@ iavf_get_vlan_offload_caps_v2(struct iavf_adapter *adapter) return ret; } - rte_memcpy(&vf->vlan_v2_caps, vf->aq_resp, sizeof(vf->vlan_v2_caps)); + memcpy(&vf->vlan_v2_caps, vf->aq_resp, sizeof(vf->vlan_v2_caps)); return 0; } @@ -1427,8 +1427,8 @@ iavf_add_del_all_mac_addr(struct iavf_adapter *adapter, bool add) addr = &adapter->dev_data->mac_addrs[i]; if (rte_is_zero_ether_addr(addr)) continue; - rte_memcpy(list->list[j].addr, addr->addr_bytes, - sizeof(addr->addr_bytes)); + memcpy(list->list[j].addr, addr->addr_bytes, + sizeof(addr->addr_bytes)); list->list[j].type = (j == 0 ? VIRTCHNL_ETHER_ADDR_PRIMARY : VIRTCHNL_ETHER_ADDR_EXTRA); @@ -1547,8 +1547,7 @@ iavf_add_del_eth_addr(struct iavf_adapter *adapter, struct rte_ether_addr *addr, list->vsi_id = vf->vsi_res->vsi_id; list->num_elements = 1; list->list[0].type = type; - rte_memcpy(list->list[0].addr, addr->addr_bytes, - sizeof(addr->addr_bytes)); + memcpy(list->list[0].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); args.ops = add ? VIRTCHNL_OP_ADD_ETH_ADDR : VIRTCHNL_OP_DEL_ETH_ADDR; args.in_args = cmd_buffer; diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index 7f8f5163ac..42e5b30b2b 100644 --- a/drivers/net/ice/ice_dcf.c +++ b/drivers/net/ice/ice_dcf.c @@ -731,7 +731,7 @@ dcf_get_vlan_offload_caps_v2(struct ice_dcf_hw *hw) return ret; } - rte_memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps)); + memcpy(&hw->vlan_v2_caps, &vlan_v2_caps, sizeof(vlan_v2_caps)); return 0; } @@ -1407,8 +1407,7 @@ ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, return -ENOMEM; } - rte_memcpy(list->list[0].addr, addr->addr_bytes, - sizeof(addr->addr_bytes)); + memcpy(list->list[0].addr, addr->addr_bytes, sizeof(addr->addr_bytes)); PMD_DRV_LOG(DEBUG, "add/rm mac:" RTE_ETHER_ADDR_PRT_FMT, RTE_ETHER_ADDR_BYTES(addr)); diff --git a/drivers/net/ice/ice_dcf_parent.c b/drivers/net/ice/ice_dcf_parent.c index 6e845f458a..0c53755c9d 100644 --- a/drivers/net/ice/ice_dcf_parent.c +++ b/drivers/net/ice/ice_dcf_parent.c @@ -407,7 +407,7 @@ ice_dcf_load_pkg(struct ice_adapter *adapter) use_dsn = ice_dcf_execute_virtchnl_cmd(&dcf_adapter->real_hw, &vc_cmd) == 0; if (use_dsn) - rte_memcpy(&dsn, pkg_info.dsn, sizeof(dsn)); + memcpy(&dsn, pkg_info.dsn, sizeof(dsn)); return ice_load_pkg(adapter, use_dsn, dsn); } diff --git a/drivers/net/ice/ice_dcf_sched.c b/drivers/net/ice/ice_dcf_sched.c index b08bc5f1de..465ae75d5c 100644 --- a/drivers/net/ice/ice_dcf_sched.c +++ b/drivers/net/ice/ice_dcf_sched.c @@ -308,8 +308,8 @@ ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->id = node_id; tm_node->parent = NULL; tm_node->reference_count = 0; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); hw->tm_conf.root = tm_node; return 0; @@ -373,8 +373,7 @@ ice_dcf_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->shaper_profile = shaper_profile; tm_node->reference_count = 0; tm_node->parent = parent_node; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); if (parent_node_type == ICE_DCF_TM_NODE_TYPE_PORT) { TAILQ_INSERT_TAIL(&hw->tm_conf.tc_list, tm_node, node); @@ -520,8 +519,8 @@ ice_dcf_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&hw->tm_conf.shaper_profile_list, shaper_profile, node); diff --git a/drivers/net/ice/ice_diagnose.c b/drivers/net/ice/ice_diagnose.c index 3be819d7f8..c22f71e48e 100644 --- a/drivers/net/ice/ice_diagnose.c +++ b/drivers/net/ice/ice_diagnose.c @@ -362,13 +362,13 @@ ice_dump_pkg(struct rte_eth_dev *dev, uint8_t **buff, uint32_t *size) count = *size / ICE_PKG_BUF_SIZE; for (i = 0; i < count; i++) { next_buff = (uint8_t *)(*buff) + i * ICE_PKG_BUF_SIZE; - rte_memcpy(pkg_buff.buf, next_buff, ICE_PKG_BUF_SIZE); + memcpy(pkg_buff.buf, next_buff, ICE_PKG_BUF_SIZE); if (ice_aq_upload_section(hw, (struct ice_buf_hdr *)&pkg_buff.buf[0], ICE_PKG_BUF_SIZE, NULL)) return -EINVAL; - rte_memcpy(next_buff, pkg_buff.buf, ICE_PKG_BUF_SIZE); + memcpy(next_buff, pkg_buff.buf, ICE_PKG_BUF_SIZE); } cache_size = sizeof(struct ice_package_header) + *size; diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 87385d2649..126afb763c 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -3453,11 +3453,11 @@ static int ice_init_rss(struct ice_pf *pf) RTE_MIN(rss_conf->rss_key_len, vsi->rss_key_size)); - rte_memcpy(key.standard_rss_key, vsi->rss_key, - ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE); - rte_memcpy(key.extended_hash_key, - &vsi->rss_key[ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE], - ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE); + memcpy(key.standard_rss_key, vsi->rss_key, + ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE); + memcpy(key.extended_hash_key, + &vsi->rss_key[ICE_AQC_GET_SET_RSS_KEY_DATA_RSS_KEY_SIZE], + ICE_AQC_GET_SET_RSS_KEY_DATA_HASH_KEY_SIZE); ret = ice_aq_set_rss_key(hw, vsi->idx, &key); if (ret) goto out; @@ -4549,7 +4549,7 @@ ice_vsi_config_vlan_filter(struct ice_vsi *vsi, bool on) vsi->info.sw_flags2 &= ~sw_flags2; vsi->info.sw_id = hw->port_info->sw_id; - (void)rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.info.valid_sections = rte_cpu_to_le_16(ICE_AQ_VSI_PROP_SW_VALID | ICE_AQ_VSI_PROP_SECURITY_VALID); @@ -5367,7 +5367,7 @@ ice_vsi_vlan_pvid_set(struct ice_vsi *vsi, struct ice_vsi_vlan_pvid_info *info) ICE_AQ_VSI_INNER_VLAN_EMODE_M); vsi->info.inner_vlan_flags |= vlan_flags; memset(&ctxt, 0, sizeof(ctxt)); - rte_memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); + memcpy(&ctxt.info, &vsi->info, sizeof(vsi->info)); ctxt.info.valid_sections = rte_cpu_to_le_16(ICE_AQ_VSI_PROP_VLAN_VALID); ctxt.vsi_num = vsi->vsi_id; diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c index 0b7920ad44..de7b531aa0 100644 --- a/drivers/net/ice/ice_fdir_filter.c +++ b/drivers/net/ice/ice_fdir_filter.c @@ -1224,13 +1224,13 @@ ice_fdir_extract_fltr_key(struct ice_fdir_fltr_pattern *key, memset(key, 0, sizeof(*key)); key->flow_type = input->flow_type; - rte_memcpy(&key->ip, &input->ip, sizeof(key->ip)); - rte_memcpy(&key->mask, &input->mask, sizeof(key->mask)); - rte_memcpy(&key->ext_data, &input->ext_data, sizeof(key->ext_data)); - rte_memcpy(&key->ext_mask, &input->ext_mask, sizeof(key->ext_mask)); + memcpy(&key->ip, &input->ip, sizeof(key->ip)); + memcpy(&key->mask, &input->mask, sizeof(key->mask)); + memcpy(&key->ext_data, &input->ext_data, sizeof(key->ext_data)); + memcpy(&key->ext_mask, &input->ext_mask, sizeof(key->ext_mask)); - rte_memcpy(&key->gtpu_data, &input->gtpu_data, sizeof(key->gtpu_data)); - rte_memcpy(&key->gtpu_mask, &input->gtpu_mask, sizeof(key->gtpu_mask)); + memcpy(&key->gtpu_data, &input->gtpu_data, sizeof(key->gtpu_data)); + memcpy(&key->gtpu_mask, &input->gtpu_mask, sizeof(key->gtpu_mask)); key->tunnel_type = filter->tunnel_type; } @@ -1358,7 +1358,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (!entry) goto error; - rte_memcpy(entry, filter, sizeof(*filter)); + memcpy(entry, filter, sizeof(*filter)); flow->rule = entry; @@ -1419,7 +1419,7 @@ ice_fdir_create_filter(struct ice_adapter *ad, if (filter->mark_flag == 1) ice_fdir_rx_parsing_enable(ad, 1); - rte_memcpy(entry, filter, sizeof(*entry)); + memcpy(entry, filter, sizeof(*entry)); ret = ice_fdir_entry_insert(pf, entry, &key); if (ret) { rte_flow_error_set(error, -ret, @@ -1720,8 +1720,8 @@ ice_fdir_parse_action(struct ice_adapter *ad, act_count = actions->conf; filter->input.cnt_ena = ICE_FXD_FLTR_QW0_STAT_ENA_PKTS; - rte_memcpy(&filter->act_count, act_count, - sizeof(filter->act_count)); + memcpy(&filter->act_count, act_count, + sizeof(filter->act_count)); break; default: @@ -1978,12 +1978,13 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, p_ext_data = (tunnel_type && is_outer) ? &filter->input.ext_data_outer : &filter->input.ext_data; - rte_memcpy(&p_ext_data->src_mac, - ð_spec->hdr.src_addr, RTE_ETHER_ADDR_LEN); - rte_memcpy(&p_ext_data->dst_mac, - ð_spec->hdr.dst_addr, RTE_ETHER_ADDR_LEN); - rte_memcpy(&p_ext_data->ether_type, - ð_spec->hdr.ether_type, sizeof(eth_spec->hdr.ether_type)); + memcpy(&p_ext_data->src_mac, ð_spec->hdr.src_addr, + RTE_ETHER_ADDR_LEN); + memcpy(&p_ext_data->dst_mac, ð_spec->hdr.dst_addr, + RTE_ETHER_ADDR_LEN); + memcpy(&p_ext_data->ether_type, + ð_spec->hdr.ether_type, + sizeof(eth_spec->hdr.ether_type)); break; case RTE_FLOW_ITEM_TYPE_IPV4: flow_type = ICE_FLTR_PTYPE_NONF_IPV4_OTHER; @@ -2108,8 +2109,8 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter *ad, if (ipv6_mask->hdr.hop_limits == UINT8_MAX) *input_set |= ICE_INSET_IPV6_HOP_LIMIT; - rte_memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16); - rte_memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16); + memcpy(&p_v6->dst_ip, ipv6_spec->hdr.dst_addr, 16); + memcpy(&p_v6->src_ip, ipv6_spec->hdr.src_addr, 16); vtc_flow_cpu = rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow); p_v6->tc = (uint8_t)(vtc_flow_cpu >> ICE_FDIR_IPV6_TC_OFFSET); p_v6->proto = ipv6_spec->hdr.proto; diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index 50d760004f..9e7de43575 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -1969,7 +1969,7 @@ ice_pattern_skip_void_item(struct rte_flow_item *items, pb = pe + 1; } /* Copy the END item. */ - rte_memcpy(items, pe, sizeof(struct rte_flow_item)); + memcpy(items, pe, sizeof(struct rte_flow_item)); } /* Check if the pattern matches a supported item type array */ diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index f923641533..80b44713a9 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -715,7 +715,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, pkt_len, ICE_BLK_RSS, true, &prof)) return -rte_errno; - rte_memcpy(&meta->raw.prof, &prof, sizeof(prof)); + memcpy(&meta->raw.prof, &prof, sizeof(prof)); rte_free(pkt_buf); rte_free(msk_buf); diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index 17f0ca0ce0..7515d738cd 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -293,8 +293,8 @@ ice_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&pf->tm_conf.shaper_profile_list, shaper_profile, node); @@ -403,8 +403,8 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->shaper_profile = shaper_profile; tm_node->children = (void *)((uint8_t *)tm_node + sizeof(struct ice_tm_node)); - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); pf->tm_conf.root = tm_node; return 0; } @@ -480,8 +480,7 @@ ice_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, PMD_DRV_LOG(WARNING, "weight != 1 not supported in level %d", level_id); - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); tm_node->parent->reference_count++; return 0; diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c index 86151c9ec9..9cf33c4b70 100644 --- a/drivers/net/idpf/idpf_ethdev.c +++ b/drivers/net/idpf/idpf_ethdev.c @@ -1088,8 +1088,8 @@ idpf_handle_virtchnl_msg(struct idpf_adapter_ext *adapter_ex) return; } - rte_memcpy(adapter->mbx_resp, ctlq_msg.ctx.indirect.payload->va, - IDPF_DFLT_MBX_BUF_SIZE); + memcpy(adapter->mbx_resp, ctlq_msg.ctx.indirect.payload->va, + IDPF_DFLT_MBX_BUF_SIZE); mbx_op = rte_le_to_cpu_16(ctlq_msg.opcode); vc_op = rte_le_to_cpu_32(ctlq_msg.cookie.mbx.chnl_opcode); @@ -1202,7 +1202,8 @@ idpf_adapter_ext_init(struct rte_pci_device *pci_dev, struct idpf_adapter_ext *a strncpy(adapter->name, pci_dev->device.name, PCI_PRI_STR_SIZE); - rte_memcpy(&base->caps, &req_caps, sizeof(struct virtchnl2_get_capabilities)); + memcpy(&base->caps, &req_caps, + sizeof(struct virtchnl2_get_capabilities)); ret = idpf_adapter_init(base); if (ret != 0) { diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c index 64f2235580..da659e1653 100644 --- a/drivers/net/idpf/idpf_rxtx.c +++ b/drivers/net/idpf/idpf_rxtx.c @@ -76,7 +76,7 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx, else ring_size = RTE_ALIGN(len * sizeof(struct idpf_base_tx_desc), IDPF_DMA_MEM_ALIGN); - rte_memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring")); + memcpy(ring_name, "idpf Tx ring", sizeof("idpf Tx ring")); break; case VIRTCHNL2_QUEUE_TYPE_RX: if (splitq) @@ -85,17 +85,19 @@ idpf_dma_zone_reserve(struct rte_eth_dev *dev, uint16_t queue_idx, else ring_size = RTE_ALIGN(len * sizeof(struct virtchnl2_singleq_rx_buf_desc), IDPF_DMA_MEM_ALIGN); - rte_memcpy(ring_name, "idpf Rx ring", sizeof("idpf Rx ring")); + memcpy(ring_name, "idpf Rx ring", sizeof("idpf Rx ring")); break; case VIRTCHNL2_QUEUE_TYPE_TX_COMPLETION: ring_size = RTE_ALIGN(len * sizeof(struct idpf_splitq_tx_compl_desc), IDPF_DMA_MEM_ALIGN); - rte_memcpy(ring_name, "idpf Tx compl ring", sizeof("idpf Tx compl ring")); + memcpy(ring_name, "idpf Tx compl ring", + sizeof("idpf Tx compl ring")); break; case VIRTCHNL2_QUEUE_TYPE_RX_BUFFER: ring_size = RTE_ALIGN(len * sizeof(struct virtchnl2_splitq_rx_buf_desc), IDPF_DMA_MEM_ALIGN); - rte_memcpy(ring_name, "idpf Rx buf ring", sizeof("idpf Rx buf ring")); + memcpy(ring_name, "idpf Rx buf ring", + sizeof("idpf Rx buf ring")); break; default: PMD_INIT_LOG(ERR, "Invalid queue type"); diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c index d20a29b9a2..eeb0ec55d9 100644 --- a/drivers/net/ipn3ke/ipn3ke_flow.c +++ b/drivers/net/ipn3ke/ipn3ke_flow.c @@ -100,15 +100,14 @@ ipn3ke_pattern_vxlan(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_ETH: eth = item->spec; - rte_memcpy(&parser->key[0], - eth->hdr.src_addr.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(&parser->key[0], eth->hdr.src_addr.addr_bytes, + RTE_ETHER_ADDR_LEN); break; case RTE_FLOW_ITEM_TYPE_VXLAN: vxlan = item->spec; - rte_memcpy(&parser->key[6], vxlan->hdr.vni, 3); + memcpy(&parser->key[6], vxlan->hdr.vni, 3); break; default: @@ -164,9 +163,8 @@ ipn3ke_pattern_mac(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_ETH: eth = item->spec; - rte_memcpy(parser->key, - eth->hdr.src_addr.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(parser->key, eth->hdr.src_addr.addr_bytes, + RTE_ETHER_ADDR_LEN); break; default: @@ -369,13 +367,13 @@ ipn3ke_pattern_ip_tcp(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = item->spec; - rte_memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); + memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); break; case RTE_FLOW_ITEM_TYPE_TCP: tcp = item->spec; - rte_memcpy(&parser->key[4], &tcp->hdr.src_port, 2); + memcpy(&parser->key[4], &tcp->hdr.src_port, 2); break; default: @@ -434,13 +432,13 @@ ipn3ke_pattern_ip_udp(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = item->spec; - rte_memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); + memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); break; case RTE_FLOW_ITEM_TYPE_UDP: udp = item->spec; - rte_memcpy(&parser->key[4], &udp->hdr.src_port, 2); + memcpy(&parser->key[4], &udp->hdr.src_port, 2); break; default: @@ -502,19 +500,19 @@ ipn3ke_pattern_ip_nvgre(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = item->spec; - rte_memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); + memcpy(&parser->key[0], &ipv4->hdr.src_addr, 4); break; case RTE_FLOW_ITEM_TYPE_UDP: udp = item->spec; - rte_memcpy(&parser->key[4], &udp->hdr.src_port, 2); + memcpy(&parser->key[4], &udp->hdr.src_port, 2); break; case RTE_FLOW_ITEM_TYPE_NVGRE: nvgre = item->spec; - rte_memcpy(&parser->key[6], nvgre->tni, 3); + memcpy(&parser->key[6], nvgre->tni, 3); break; default: @@ -576,19 +574,19 @@ ipn3ke_pattern_vxlan_ip_udp(const struct rte_flow_item patterns[], case RTE_FLOW_ITEM_TYPE_VXLAN: vxlan = item->spec; - rte_memcpy(&parser->key[0], vxlan->hdr.vni, 3); + memcpy(&parser->key[0], vxlan->hdr.vni, 3); break; case RTE_FLOW_ITEM_TYPE_IPV4: ipv4 = item->spec; - rte_memcpy(&parser->key[3], &ipv4->hdr.src_addr, 4); + memcpy(&parser->key[3], &ipv4->hdr.src_addr, 4); break; case RTE_FLOW_ITEM_TYPE_UDP: udp = item->spec; - rte_memcpy(&parser->key[7], &udp->hdr.src_port, 2); + memcpy(&parser->key[7], &udp->hdr.src_port, 2); break; default: diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c index 8145f1bb2a..99527d1879 100644 --- a/drivers/net/ipn3ke/ipn3ke_representor.c +++ b/drivers/net/ipn3ke/ipn3ke_representor.c @@ -137,17 +137,17 @@ ipn3ke_rpst_dev_start(struct rte_eth_dev *dev) if (hw->retimer.mac_type == IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI) { /* Set mac address */ - rte_memcpy(((char *)(&val)), - (char *)&dev->data->mac_addrs->addr_bytes[0], - sizeof(uint32_t)); + memcpy(((char *)(&val)), + (char *)&dev->data->mac_addrs->addr_bytes[0], + sizeof(uint32_t)); (*hw->f_mac_write)(hw, val, IPN3KE_MAC_PRIMARY_MAC_ADDR0, rpst->port_id, 0); - rte_memcpy(((char *)(&val)), - (char *)&dev->data->mac_addrs->addr_bytes[4], - sizeof(uint16_t)); + memcpy(((char *)(&val)), + (char *)&dev->data->mac_addrs->addr_bytes[4], + sizeof(uint16_t)); (*hw->f_mac_write)(hw, val, IPN3KE_MAC_PRIMARY_MAC_ADDR1, @@ -2753,13 +2753,13 @@ ipn3ke_rpst_mac_addr_set(struct rte_eth_dev *ethdev, rte_ether_addr_copy(&mac_addr[0], &rpst->mac_addr); /* Set mac address */ - rte_memcpy(((char *)(&val)), &mac_addr[0], sizeof(uint32_t)); + memcpy(((char *)(&val)), &mac_addr[0], sizeof(uint32_t)); (*hw->f_mac_write)(hw, val, IPN3KE_MAC_PRIMARY_MAC_ADDR0, rpst->port_id, 0); - rte_memcpy(((char *)(&val)), &mac_addr[4], sizeof(uint16_t)); + memcpy(((char *)(&val)), &mac_addr[4], sizeof(uint16_t)); (*hw->f_mac_write)(hw, val, IPN3KE_MAC_PRIMARY_MAC_ADDR0, diff --git a/drivers/net/ipn3ke/ipn3ke_tm.c b/drivers/net/ipn3ke/ipn3ke_tm.c index 0260227900..b7097083d2 100644 --- a/drivers/net/ipn3ke/ipn3ke_tm.c +++ b/drivers/net/ipn3ke/ipn3ke_tm.c @@ -814,7 +814,7 @@ ipn3ke_tm_shaper_profile_add(struct rte_eth_dev *dev, rte_strerror(EINVAL)); } else { sp->valid = 1; - rte_memcpy(&sp->params, profile, sizeof(sp->params)); + memcpy(&sp->params, profile, sizeof(sp->params)); } tm->h.n_shaper_profiles++; @@ -960,7 +960,7 @@ ipn3ke_tm_tdrop_profile_add(struct rte_eth_dev *dev, IPN3KE_TDROP_TH2_MASK); tp->th1 = th1; tp->th2 = th2; - rte_memcpy(&tp->params, profile, sizeof(tp->params)); + memcpy(&tp->params, profile, sizeof(tp->params)); /* Add to list */ tm->h.n_tdrop_profiles++; @@ -1308,7 +1308,7 @@ ipn3ke_tm_node_add(struct rte_eth_dev *dev, n->tdrop_profile = ipn3ke_hw_tm_tdrop_profile_search(hw, params->leaf.wred.wred_profile_id); - rte_memcpy(&n->params, params, sizeof(n->params)); + memcpy(&n->params, params, sizeof(n->params)); return 0; } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index c61c52b296..68f46d443a 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -6597,9 +6597,8 @@ ixgbe_add_del_ntuple_filter(struct rte_eth_dev *dev, sizeof(struct ixgbe_5tuple_filter), 0); if (filter == NULL) return -ENOMEM; - rte_memcpy(&filter->filter_info, - &filter_5tuple, - sizeof(struct ixgbe_5tuple_filter_info)); + memcpy(&filter->filter_info, &filter_5tuple, + sizeof(struct ixgbe_5tuple_filter_info)); filter->queue = ntuple_filter->queue; ret = ixgbe_add_5tuple_filter(dev, filter); if (ret < 0) { @@ -7596,9 +7595,7 @@ ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev, if (!node) return -ENOMEM; - rte_memcpy(&node->key, - &key, - sizeof(struct ixgbe_l2_tn_key)); + memcpy(&node->key, &key, sizeof(struct ixgbe_l2_tn_key)); node->pool = l2_tunnel->pool; ret = ixgbe_insert_l2_tn_filter(l2_tn_info, node); if (ret < 0) { diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c index 06d6e2126d..b168ab8278 100644 --- a/drivers/net/ixgbe/ixgbe_fdir.c +++ b/drivers/net/ixgbe/ixgbe_fdir.c @@ -74,7 +74,7 @@ else \ ipv6_addr[i] = 0; \ } \ - rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ + memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ } while (0) #define IXGBE_FDIRIP6M_INNER_MAC_SHIFT 4 @@ -1217,9 +1217,8 @@ ixgbe_fdir_filter_program(struct rte_eth_dev *dev, 0); if (!node) return -ENOMEM; - rte_memcpy(&node->ixgbe_fdir, - &rule->ixgbe_fdir, - sizeof(union ixgbe_atr_input)); + memcpy(&node->ixgbe_fdir, &rule->ixgbe_fdir, + sizeof(union ixgbe_atr_input)); node->fdirflags = fdircmd_flags; node->fdirhash = fdirhash; node->queue = queue; diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index 687341c6b8..8a13f47f2b 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -1944,10 +1944,10 @@ ixgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev, if (item->spec) { rule->b_spec = TRUE; ipv6_spec = item->spec; - rte_memcpy(rule->ixgbe_fdir.formatted.src_ip, - ipv6_spec->hdr.src_addr, 16); - rte_memcpy(rule->ixgbe_fdir.formatted.dst_ip, - ipv6_spec->hdr.dst_addr, 16); + memcpy(rule->ixgbe_fdir.formatted.src_ip, + ipv6_spec->hdr.src_addr, 16); + memcpy(rule->ixgbe_fdir.formatted.dst_ip, + ipv6_spec->hdr.dst_addr, 16); } /** @@ -3070,9 +3070,9 @@ ixgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&ntuple_filter_ptr->filter_info, - &ntuple_filter, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter_ptr->filter_info, + &ntuple_filter, + sizeof(struct rte_eth_ntuple_filter)); TAILQ_INSERT_TAIL(&filter_ntuple_list, ntuple_filter_ptr, entries); flow->rule = ntuple_filter_ptr; @@ -3096,9 +3096,9 @@ ixgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(ðertype_filter_ptr->filter_info, - ðertype_filter, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter_ptr->filter_info, + ðertype_filter, + sizeof(struct rte_eth_ethertype_filter)); TAILQ_INSERT_TAIL(&filter_ethertype_list, ethertype_filter_ptr, entries); flow->rule = ethertype_filter_ptr; @@ -3120,9 +3120,8 @@ ixgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&syn_filter_ptr->filter_info, - &syn_filter, - sizeof(struct rte_eth_syn_filter)); + memcpy(&syn_filter_ptr->filter_info, &syn_filter, + sizeof(struct rte_eth_syn_filter)); TAILQ_INSERT_TAIL(&filter_syn_list, syn_filter_ptr, entries); @@ -3141,9 +3140,8 @@ ixgbe_flow_create(struct rte_eth_dev *dev, if (fdir_rule.b_mask) { if (!fdir_info->mask_added) { /* It's the first time the mask is set. */ - rte_memcpy(&fdir_info->mask, - &fdir_rule.mask, - sizeof(struct ixgbe_hw_fdir_mask)); + memcpy(&fdir_info->mask, &fdir_rule.mask, + sizeof(struct ixgbe_hw_fdir_mask)); if (fdir_rule.mask.flex_bytes_mask) { ret = ixgbe_fdir_set_flexbytes_offset(dev, @@ -3185,9 +3183,9 @@ ixgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&fdir_rule_ptr->filter_info, - &fdir_rule, - sizeof(struct ixgbe_fdir_rule)); + memcpy(&fdir_rule_ptr->filter_info, + &fdir_rule, + sizeof(struct ixgbe_fdir_rule)); TAILQ_INSERT_TAIL(&filter_fdir_list, fdir_rule_ptr, entries); flow->rule = fdir_rule_ptr; @@ -3222,9 +3220,8 @@ ixgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&l2_tn_filter_ptr->filter_info, - &l2_tn_filter, - sizeof(struct ixgbe_l2_tunnel_conf)); + memcpy(&l2_tn_filter_ptr->filter_info, &l2_tn_filter, + sizeof(struct ixgbe_l2_tunnel_conf)); TAILQ_INSERT_TAIL(&filter_l2_tunnel_list, l2_tn_filter_ptr, entries); flow->rule = l2_tn_filter_ptr; @@ -3351,9 +3348,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_NTUPLE: ntuple_filter_ptr = (struct ixgbe_ntuple_filter_ele *) pmd_flow->rule; - rte_memcpy(&ntuple_filter, - &ntuple_filter_ptr->filter_info, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter, &ntuple_filter_ptr->filter_info, + sizeof(struct rte_eth_ntuple_filter)); ret = ixgbe_add_del_ntuple_filter(dev, &ntuple_filter, FALSE); if (!ret) { TAILQ_REMOVE(&filter_ntuple_list, @@ -3364,9 +3360,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_ETHERTYPE: ethertype_filter_ptr = (struct ixgbe_ethertype_filter_ele *) pmd_flow->rule; - rte_memcpy(ðertype_filter, - ðertype_filter_ptr->filter_info, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter, ðertype_filter_ptr->filter_info, + sizeof(struct rte_eth_ethertype_filter)); ret = ixgbe_add_del_ethertype_filter(dev, ðertype_filter, FALSE); if (!ret) { @@ -3378,9 +3373,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_SYN: syn_filter_ptr = (struct ixgbe_eth_syn_filter_ele *) pmd_flow->rule; - rte_memcpy(&syn_filter, - &syn_filter_ptr->filter_info, - sizeof(struct rte_eth_syn_filter)); + memcpy(&syn_filter, &syn_filter_ptr->filter_info, + sizeof(struct rte_eth_syn_filter)); ret = ixgbe_syn_filter_set(dev, &syn_filter, FALSE); if (!ret) { TAILQ_REMOVE(&filter_syn_list, @@ -3390,9 +3384,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, break; case RTE_ETH_FILTER_FDIR: fdir_rule_ptr = (struct ixgbe_fdir_rule_ele *)pmd_flow->rule; - rte_memcpy(&fdir_rule, - &fdir_rule_ptr->filter_info, - sizeof(struct ixgbe_fdir_rule)); + memcpy(&fdir_rule, &fdir_rule_ptr->filter_info, + sizeof(struct ixgbe_fdir_rule)); ret = ixgbe_fdir_filter_program(dev, &fdir_rule, TRUE, FALSE); if (!ret) { TAILQ_REMOVE(&filter_fdir_list, @@ -3405,8 +3398,8 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_L2_TUNNEL: l2_tn_filter_ptr = (struct ixgbe_eth_l2_tunnel_conf_ele *) pmd_flow->rule; - rte_memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info, - sizeof(struct ixgbe_l2_tunnel_conf)); + memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info, + sizeof(struct ixgbe_l2_tunnel_conf)); ret = ixgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_filter); if (!ret) { TAILQ_REMOVE(&filter_l2_tunnel_list, diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c index d331308556..d8ed095dce 100644 --- a/drivers/net/ixgbe/ixgbe_ipsec.c +++ b/drivers/net/ixgbe/ixgbe_ipsec.c @@ -680,10 +680,10 @@ ixgbe_crypto_add_ingress_sa_from_flow(const void *sess, const struct rte_flow_item_ipv6 *ipv6 = ip_spec; ic_session->src_ip.type = IPv6; ic_session->dst_ip.type = IPv6; - rte_memcpy(ic_session->src_ip.ipv6, - ipv6->hdr.src_addr, 16); - rte_memcpy(ic_session->dst_ip.ipv6, - ipv6->hdr.dst_addr, 16); + memcpy(ic_session->src_ip.ipv6, ipv6->hdr.src_addr, + 16); + memcpy(ic_session->dst_ip.ipv6, ipv6->hdr.dst_addr, + 16); } else { const struct rte_flow_item_ipv4 *ipv4 = ip_spec; ic_session->src_ip.type = IPv4; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index 0a0f639e39..f16bd45dbf 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -16,7 +16,6 @@ #include <rte_eal.h> #include <rte_ether.h> #include <ethdev_driver.h> -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_random.h> @@ -450,7 +449,7 @@ ixgbe_vf_reset(struct rte_eth_dev *dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); + memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); /* * Piggyback the multicast filter type so VF can compute the * correct vectors @@ -472,7 +471,7 @@ ixgbe_vf_set_mac_addr(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) if (rte_is_valid_assigned_ether_addr( (struct rte_ether_addr *)new_mac)) { - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); + memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } return -1; diff --git a/drivers/net/ixgbe/ixgbe_tm.c b/drivers/net/ixgbe/ixgbe_tm.c index ac8976062f..00d9de4393 100644 --- a/drivers/net/ixgbe/ixgbe_tm.c +++ b/drivers/net/ixgbe/ixgbe_tm.c @@ -289,8 +289,8 @@ ixgbe_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&tm_conf->shaper_profile_list, shaper_profile, node); @@ -637,8 +637,8 @@ ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->no = 0; tm_node->parent = NULL; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); tm_conf->root = tm_node; /* increase the reference counter of the shaper profile */ @@ -718,8 +718,7 @@ ixgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->reference_count = 0; tm_node->parent = parent_node; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); if (parent_node_type == IXGBE_TM_NODE_TYPE_PORT) { tm_node->no = parent_node->reference_count; TAILQ_INSERT_TAIL(&tm_conf->tc_list, diff --git a/drivers/net/ixgbe/rte_pmd_ixgbe.c b/drivers/net/ixgbe/rte_pmd_ixgbe.c index f76ef63921..ba700fe023 100644 --- a/drivers/net/ixgbe/rte_pmd_ixgbe.c +++ b/drivers/net/ixgbe/rte_pmd_ixgbe.c @@ -37,8 +37,8 @@ rte_pmd_ixgbe_set_vf_mac_addr(uint16_t port, uint16_t vf, if (rte_is_valid_assigned_ether_addr( (struct rte_ether_addr *)new_mac)) { - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, - RTE_ETHER_ADDR_LEN); + memcpy(vfinfo[vf].vf_mac_addresses, new_mac, + RTE_ETHER_ADDR_LEN); return hw->mac.ops.set_rar(hw, rar_entry, new_mac, vf, IXGBE_RAH_AV); } diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c index 649f8d0e61..f5a3354c46 100644 --- a/drivers/net/memif/memif_socket.c +++ b/drivers/net/memif/memif_socket.c @@ -48,7 +48,7 @@ memif_msg_send(int fd, memif_msg_t *msg, int afd) cmsg->cmsg_len = CMSG_LEN(sizeof(int)); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - rte_memcpy(CMSG_DATA(cmsg), &afd, sizeof(int)); + memcpy(CMSG_DATA(cmsg), &afd, sizeof(int)); } return sendmsg(fd, &mh, 0); @@ -675,7 +675,7 @@ memif_msg_receive(struct memif_control_channel *cc) if (cmsg->cmsg_type == SCM_CREDENTIALS) cr = (struct ucred *)CMSG_DATA(cmsg); else if (cmsg->cmsg_type == SCM_RIGHTS) - rte_memcpy(&afd, CMSG_DATA(cmsg), sizeof(int)); + memcpy(&afd, CMSG_DATA(cmsg), sizeof(int)); } cmsg = CMSG_NXTHDR(&mh, cmsg); } diff --git a/drivers/net/mlx5/mlx5_devx.c b/drivers/net/mlx5/mlx5_devx.c index 9fa400fc48..6380a5c83c 100644 --- a/drivers/net/mlx5/mlx5_devx.c +++ b/drivers/net/mlx5/mlx5_devx.c @@ -512,7 +512,7 @@ mlx5_rxq_obj_hairpin_new(struct mlx5_rxq_priv *rxq) * during queue setup. */ MLX5_ASSERT(hca_attr->hairpin_data_buffer_locked); - rte_memcpy(&locked_attr, &unlocked_attr, sizeof(locked_attr)); + memcpy(&locked_attr, &unlocked_attr, sizeof(locked_attr)); locked_attr.hairpin_data_buffer_type = MLX5_RQC_HAIRPIN_DATA_BUFFER_TYPE_LOCKED_INTERNAL_BUFFER; tmpl->rq = mlx5_devx_cmd_create_rq(priv->sh->cdev->ctx, &locked_attr, @@ -1289,7 +1289,7 @@ mlx5_txq_obj_hairpin_new(struct rte_eth_dev *dev, uint16_t idx) */ MLX5_ASSERT(hca_attr->hairpin_sq_wq_in_host_mem); MLX5_ASSERT(hca_attr->hairpin_sq_wqe_bb_size > 0); - rte_memcpy(&host_mem_attr, &dev_mem_attr, sizeof(host_mem_attr)); + memcpy(&host_mem_attr, &dev_mem_attr, sizeof(host_mem_attr)); umem_size = MLX5_WQE_SIZE * RTE_BIT32(host_mem_attr.wq_attr.log_hairpin_num_packets); umem_dbrec = RTE_ALIGN(umem_size, MLX5_DBR_SIZE); diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index f31fdfbf3d..dba8afbb28 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -4516,8 +4516,8 @@ flow_action_handles_translate(struct rte_eth_dev *dev, (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION_NUM, NULL, "too many shared actions"); } - rte_memcpy(&handle[copied_n].action, &actions[n].conf, - sizeof(actions[n].conf)); + memcpy(&handle[copied_n].action, &actions[n].conf, + sizeof(actions[n].conf)); handle[copied_n].index = n; copied_n++; } @@ -5383,30 +5383,30 @@ flow_hairpin_split(struct rte_eth_dev *dev, case RTE_FLOW_ACTION_TYPE_NVGRE_ENCAP: case RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN: case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP: - rte_memcpy(actions_tx, actions, + memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); actions_tx++; break; case RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID: if (push_vlan) { - rte_memcpy(actions_tx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_tx, actions, + sizeof(struct rte_flow_action)); actions_tx++; } else { - rte_memcpy(actions_rx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); actions_rx++; } break; case RTE_FLOW_ACTION_TYPE_COUNT: case RTE_FLOW_ACTION_TYPE_AGE: if (encap) { - rte_memcpy(actions_tx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_tx, actions, + sizeof(struct rte_flow_action)); actions_tx++; } else { - rte_memcpy(actions_rx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); actions_rx++; } break; @@ -5418,8 +5418,8 @@ flow_hairpin_split(struct rte_eth_dev *dev, actions_tx++; encap = 1; } else { - rte_memcpy(actions_rx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); actions_rx++; } break; @@ -5430,14 +5430,14 @@ flow_hairpin_split(struct rte_eth_dev *dev, sizeof(struct rte_flow_action)); actions_tx++; } else { - rte_memcpy(actions_rx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); actions_rx++; } break; default: - rte_memcpy(actions_rx, actions, - sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, + sizeof(struct rte_flow_action)); actions_rx++; break; } @@ -5447,7 +5447,7 @@ flow_hairpin_split(struct rte_eth_dev *dev, tag_action->type = (enum rte_flow_action_type) MLX5_RTE_FLOW_ACTION_TYPE_TAG; actions_rx++; - rte_memcpy(actions_rx, actions, sizeof(struct rte_flow_action)); + memcpy(actions_rx, actions, sizeof(struct rte_flow_action)); actions_rx++; set_tag = (void *)actions_rx; *set_tag = (struct mlx5_rte_flow_action_set_tag) { @@ -5457,7 +5457,7 @@ flow_hairpin_split(struct rte_eth_dev *dev, MLX5_ASSERT(set_tag->id > REG_NON); tag_action->conf = set_tag; /* Create Tx item list. */ - rte_memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); + memcpy(actions_tx, actions, sizeof(struct rte_flow_action)); addr = (void *)&pattern_tx[2]; item = pattern_tx; item->type = (enum rte_flow_item_type) diff --git a/drivers/net/mlx5/mlx5_flow_aso.c b/drivers/net/mlx5/mlx5_flow_aso.c index ab9eb21e01..0a44599737 100644 --- a/drivers/net/mlx5/mlx5_flow_aso.c +++ b/drivers/net/mlx5/mlx5_flow_aso.c @@ -1377,9 +1377,9 @@ mlx5_aso_ct_status_update(struct mlx5_aso_sq *sq, uint16_t num) MLX5_ASSERT(ct); MLX5_ASO_CT_UPDATE_STATE(ct, ASO_CONNTRACK_READY); if (sq->elts[idx].query_data) - rte_memcpy(sq->elts[idx].query_data, - (char *)((uintptr_t)sq->mr.addr + idx * 64), - 64); + memcpy(sq->elts[idx].query_data, + (char *)((uintptr_t)sq->mr.addr + idx * 64), + 64); } } diff --git a/drivers/net/mlx5/mlx5_flow_hw.c b/drivers/net/mlx5/mlx5_flow_hw.c index 9ebbe664d1..9f0f8d0907 100644 --- a/drivers/net/mlx5/mlx5_flow_hw.c +++ b/drivers/net/mlx5/mlx5_flow_hw.c @@ -2072,7 +2072,7 @@ mlx5_tbl_translate_modify_header(struct rte_eth_dev *dev, return rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "translate modify_header: no memory for modify header context"); - rte_memcpy(acts->mhdr, mhdr, sizeof(*mhdr)); + memcpy(acts->mhdr, mhdr, sizeof(*mhdr)); pattern.data = (__be64 *)acts->mhdr->mhdr_cmds; if (mhdr->shared) { uint32_t flags = mlx5_hw_act_flag[!!attr->group][tbl_type] | @@ -2669,8 +2669,8 @@ flow_hw_populate_rule_acts_caches(struct rte_eth_dev *dev, struct mlx5dr_rule_action *rule_acts = flow_hw_get_dr_action_buffer(priv, table, at_idx, q); - rte_memcpy(rule_acts, table->ats[at_idx].acts.rule_acts, - sizeof(table->ats[at_idx].acts.rule_acts)); + memcpy(rule_acts, table->ats[at_idx].acts.rule_acts, + sizeof(table->ats[at_idx].acts.rule_acts)); } } @@ -2972,9 +2972,9 @@ flow_hw_modify_field_construct(struct mlx5_modification_cmd *mhdr_cmd, mhdr_action->src.field != RTE_FLOW_FIELD_POINTER) return 0; if (mhdr_action->src.field == RTE_FLOW_FIELD_VALUE) - rte_memcpy(values, &mhdr_action->src.value, sizeof(values)); + memcpy(values, &mhdr_action->src.value, sizeof(values)); else - rte_memcpy(values, mhdr_action->src.pvalue, sizeof(values)); + memcpy(values, mhdr_action->src.pvalue, sizeof(values)); if (mhdr_action->dst.field == RTE_FLOW_FIELD_META || mhdr_action->dst.field == RTE_FLOW_FIELD_TAG || mhdr_action->dst.field == RTE_FLOW_FIELD_METER_COLOR || @@ -4825,7 +4825,7 @@ flow_hw_table_create(struct rte_eth_dev *dev, rte_flow_error_set(error, err, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL, "Failed to create template table"); else - rte_memcpy(error, &sub_error, sizeof(sub_error)); + memcpy(error, &sub_error, sizeof(sub_error)); } return NULL; } @@ -6917,8 +6917,9 @@ flow_hw_set_vlan_vid(struct rte_eth_dev *dev, if (masked) { uint32_t mask_val = 0xffffffff; - rte_memcpy(spec->src.value, &conf->vlan_vid, sizeof(conf->vlan_vid)); - rte_memcpy(mask->src.value, &mask_val, sizeof(mask_val)); + memcpy(spec->src.value, &conf->vlan_vid, + sizeof(conf->vlan_vid)); + memcpy(mask->src.value, &mask_val, sizeof(mask_val)); } ra[set_vlan_vid_ix].type = RTE_FLOW_ACTION_TYPE_MODIFY_FIELD; ra[set_vlan_vid_ix].conf = spec; @@ -6954,7 +6955,7 @@ flow_hw_set_vlan_vid_construct(struct rte_eth_dev *dev, .conf = &conf }; - rte_memcpy(conf.src.value, &vid, sizeof(vid)); + memcpy(conf.src.value, &vid, sizeof(vid)); return flow_hw_modify_field_construct(mhdr_cmd, act_data, hw_acts, &modify_action); } @@ -8577,8 +8578,8 @@ flow_hw_create_tx_repr_tag_jump_acts_tmpl(struct rte_eth_dev *dev, struct rte_flow_action actions_m[4] = { { 0 } }; unsigned int idx = 0; - rte_memcpy(set_tag_v.src.value, &tag_value, sizeof(tag_value)); - rte_memcpy(set_tag_m.src.value, &tag_mask, sizeof(tag_mask)); + memcpy(set_tag_v.src.value, &tag_value, sizeof(tag_value)); + memcpy(set_tag_m.src.value, &tag_mask, sizeof(tag_mask)); flow_hw_update_action_mask(&actions_v[idx], &actions_m[idx], RTE_FLOW_ACTION_TYPE_MODIFY_FIELD, &set_tag_v, &set_tag_m); @@ -8985,8 +8986,8 @@ flow_hw_create_ctrl_regc_jump_actions_template(struct rte_eth_dev *dev, }; set_reg_v.dst.offset = rte_bsf32(marker_mask); - rte_memcpy(set_reg_v.src.value, &marker_bits, sizeof(marker_bits)); - rte_memcpy(set_reg_m.src.value, &marker_mask, sizeof(marker_mask)); + memcpy(set_reg_v.src.value, &marker_bits, sizeof(marker_bits)); + memcpy(set_reg_m.src.value, &marker_mask, sizeof(marker_mask)); return flow_hw_actions_template_create(dev, &attr, actions_v, actions_m, error); } diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c index cc087348a4..afd3194553 100644 --- a/drivers/net/mlx5/mlx5_rx.c +++ b/drivers/net/mlx5/mlx5_rx.c @@ -767,9 +767,9 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe, ret = check_cqe_iteration(next, rxq->cqe_n, rxq->cq_ci); if (ret != MLX5_CQE_STATUS_SW_OWN || MLX5_CQE_FORMAT(next->op_own) == MLX5_COMPRESSED) - rte_memcpy(&rxq->title_cqe, - (const void *)(uintptr_t)cqe, - sizeof(struct mlx5_cqe)); + memcpy(&rxq->title_cqe, + (const void *)(uintptr_t)cqe, + sizeof(struct mlx5_cqe)); } } } diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c index 2363d7ed27..c3bcd3ef16 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec.c +++ b/drivers/net/mlx5/mlx5_rxtx_vec.c @@ -349,8 +349,8 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, ret = check_cqe_iteration(next, rxq->cqe_n, rxq->cq_ci); if (ret != MLX5_CQE_STATUS_SW_OWN || MLX5_CQE_FORMAT(next->op_own) == MLX5_COMPRESSED) - rte_memcpy(&rxq->title_pkt, elts[nocmp_n - 1], - sizeof(struct rte_mbuf)); + memcpy(&rxq->title_pkt, elts[nocmp_n - 1], + sizeof(struct rte_mbuf)); } /* Decompress the last CQE if compressed. */ if (comp_idx < MLX5_VPMD_DESCS_PER_LOOP) { @@ -499,8 +499,8 @@ rxq_burst_mprq_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, ret = check_cqe_iteration(next, rxq->cqe_n, rxq->cq_ci); if (ret != MLX5_CQE_STATUS_SW_OWN || MLX5_CQE_FORMAT(next->op_own) == MLX5_COMPRESSED) - rte_memcpy(&rxq->title_pkt, elts[nocmp_n - 1], - sizeof(struct rte_mbuf)); + memcpy(&rxq->title_pkt, elts[nocmp_n - 1], + sizeof(struct rte_mbuf)); } /* Decompress the last CQE if compressed. */ if (comp_idx < MLX5_VPMD_DESCS_PER_LOOP) { diff --git a/drivers/net/mvpp2/mrvl_tm.c b/drivers/net/mvpp2/mrvl_tm.c index 9fac80b867..a5cdae6d1d 100644 --- a/drivers/net/mvpp2/mrvl_tm.c +++ b/drivers/net/mvpp2/mrvl_tm.c @@ -437,7 +437,7 @@ mrvl_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shaper_profile_id, NULL, NULL); profile->id = shaper_profile_id; - rte_memcpy(&profile->params, params, sizeof(profile->params)); + memcpy(&profile->params, params, sizeof(profile->params)); LIST_INSERT_HEAD(&priv->shaper_profiles, profile, next); diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c index b8a32832d7..b1be12c2d5 100644 --- a/drivers/net/netvsc/hn_ethdev.c +++ b/drivers/net/netvsc/hn_ethdev.c @@ -16,7 +16,6 @@ #include <sys/ioctl.h> #include <rte_ethdev.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_memzone.h> #include <rte_devargs.h> diff --git a/drivers/net/nfp/flower/nfp_conntrack.c b/drivers/net/nfp/flower/nfp_conntrack.c index f89003be8b..279bf17eb3 100644 --- a/drivers/net/nfp/flower/nfp_conntrack.c +++ b/drivers/net/nfp/flower/nfp_conntrack.c @@ -1470,7 +1470,7 @@ nfp_ct_do_flow_merge(struct nfp_ct_zone_entry *ze, merge_entry->ze = ze; merge_entry->pre_ct_parent = pre_ct_entry; merge_entry->post_ct_parent = post_ct_entry; - rte_memcpy(merge_entry->cookie, new_cookie, sizeof(new_cookie)); + memcpy(merge_entry->cookie, new_cookie, sizeof(new_cookie)); merge_entry->rule.items_cnt = pre_ct_entry->rule.items_cnt + post_ct_entry->rule.items_cnt - cnt_same_item - 1; merge_entry->rule.actions_cnt = pre_ct_entry->rule.actions_cnt + diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c index 086cc8079a..4a6c587b6b 100644 --- a/drivers/net/nfp/flower/nfp_flower_flow.c +++ b/drivers/net/nfp/flower/nfp_flower_flow.c @@ -179,10 +179,10 @@ nfp_mask_id_alloc(struct nfp_flow_priv *priv, return -ENOENT; } - rte_memcpy(&temp_id, &ring->buf[ring->tail], NFP_FLOWER_MASK_ELEMENT_RS); + memcpy(&temp_id, &ring->buf[ring->tail], NFP_FLOWER_MASK_ELEMENT_RS); *mask_id = temp_id; - rte_memcpy(&ring->buf[ring->tail], &freed_id, NFP_FLOWER_MASK_ELEMENT_RS); + memcpy(&ring->buf[ring->tail], &freed_id, NFP_FLOWER_MASK_ELEMENT_RS); ring->tail = (ring->tail + NFP_FLOWER_MASK_ELEMENT_RS) % (NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS); @@ -201,7 +201,7 @@ nfp_mask_id_free(struct nfp_flow_priv *priv, if (CIRC_SPACE(ring->head, ring->tail, NFP_FLOWER_MASK_ENTRY_RS) == 0) return -ENOBUFS; - rte_memcpy(&ring->buf[ring->head], &mask_id, NFP_FLOWER_MASK_ELEMENT_RS); + memcpy(&ring->buf[ring->head], &mask_id, NFP_FLOWER_MASK_ELEMENT_RS); ring->head = (ring->head + NFP_FLOWER_MASK_ELEMENT_RS) % (NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS); @@ -2255,13 +2255,13 @@ nfp_flow_action_set_mac(char *act_data, set_mac = action->conf; if (mac_src_flag) { - rte_memcpy(&set_eth->eth_addr[RTE_ETHER_ADDR_LEN], - set_mac->mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(&set_eth->eth_addr[RTE_ETHER_ADDR_LEN], + set_mac->mac_addr, RTE_ETHER_ADDR_LEN); for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) set_eth->eth_addr_mask[RTE_ETHER_ADDR_LEN + i] = 0xff; } else { - rte_memcpy(&set_eth->eth_addr[0], - set_mac->mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(&set_eth->eth_addr[0], set_mac->mac_addr, + RTE_ETHER_ADDR_LEN); for (i = 0; i < RTE_ETHER_ADDR_LEN; i++) set_eth->eth_addr_mask[i] = 0xff; } @@ -2337,7 +2337,7 @@ nfp_flow_action_set_ipv6(char *act_data, set_ip->reserved = 0; for (i = 0; i < 4; i++) { - rte_memcpy(&tmp, &set_ipv6->ipv6_addr[i * 4], 4); + memcpy(&tmp, &set_ipv6->ipv6_addr[i * 4], 4); set_ip->ipv6[i].exact = tmp; set_ip->ipv6[i].mask = RTE_BE32(0xffffffff); } diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c index b2c55879ca..007e202e26 100644 --- a/drivers/net/nfp/flower/nfp_flower_representor.c +++ b/drivers/net/nfp/flower/nfp_flower_representor.c @@ -194,7 +194,7 @@ nfp_flower_repr_stats_get(struct rte_eth_dev *ethdev, struct nfp_flower_representor *repr; repr = ethdev->data->dev_private; - rte_memcpy(stats, &repr->repr_stats, sizeof(struct rte_eth_stats)); + memcpy(stats, &repr->repr_stats, sizeof(struct rte_eth_stats)); return 0; } diff --git a/drivers/net/nfp/nfp_mtr.c b/drivers/net/nfp/nfp_mtr.c index 6abc6dc9bc..d69139d861 100644 --- a/drivers/net/nfp/nfp_mtr.c +++ b/drivers/net/nfp/nfp_mtr.c @@ -243,7 +243,7 @@ nfp_mtr_profile_mod(struct nfp_app_fw_flower *app_fw_flower, struct nfp_profile_conf old_conf; /* Get the old profile config */ - rte_memcpy(&old_conf, &mtr_profile->conf, sizeof(old_conf)); + memcpy(&old_conf, &mtr_profile->conf, sizeof(old_conf)); memset(&mtr_profile->conf, 0, sizeof(struct nfp_profile_conf)); @@ -267,7 +267,7 @@ nfp_mtr_profile_mod(struct nfp_app_fw_flower *app_fw_flower, return 0; rollback: - rte_memcpy(&mtr_profile->conf, &old_conf, sizeof(old_conf)); + memcpy(&mtr_profile->conf, &old_conf, sizeof(old_conf)); return ret; } @@ -492,8 +492,8 @@ nfp_mtr_policy_add(struct rte_eth_dev *dev, } mtr_policy->policy_id = mtr_policy_id; - rte_memcpy(&mtr_policy->policy, policy, - sizeof(struct rte_mtr_meter_policy_params)); + memcpy(&mtr_policy->policy, policy, + sizeof(struct rte_mtr_meter_policy_params)); /* Insert policy into policy list */ LIST_INSERT_HEAD(&priv->policies, mtr_policy, next); @@ -1028,7 +1028,7 @@ nfp_mtr_stats_read(struct rte_eth_dev *dev, *stats_mask = mtr->stats_mask; rte_spinlock_lock(&priv->mtr_stats_lock); - rte_memcpy(&curr, &mtr->mtr_stats.curr, sizeof(curr)); + memcpy(&curr, &mtr->mtr_stats.curr, sizeof(curr)); rte_spinlock_unlock(&priv->mtr_stats_lock); prev = &mtr->mtr_stats.prev; diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c index 947ae7fe94..48f578b066 100644 --- a/drivers/net/ngbe/ngbe_pf.c +++ b/drivers/net/ngbe/ngbe_pf.c @@ -347,7 +347,7 @@ ngbe_vf_reset(struct rte_eth_dev *eth_dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = NGBE_VF_RESET | NGBE_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); + memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); /* * Piggyback the multicast filter type so VF can compute the * correct vectors @@ -369,7 +369,7 @@ ngbe_vf_set_mac_addr(struct rte_eth_dev *eth_dev, struct rte_ether_addr *ea = (struct rte_ether_addr *)new_mac; if (rte_is_valid_assigned_ether_addr(ea)) { - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); + memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.set_rar(hw, rar_entry, new_mac, vf, true); } return -1; diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index 7c46004f1e..fd8b01b2b1 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -465,7 +465,7 @@ eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) rss_conf->rss_hf & internal->flow_type_rss_offloads; if (rss_conf->rss_key) - rte_memcpy(internal->rss_key, rss_conf->rss_key, 40); + memcpy(internal->rss_key, rss_conf->rss_key, 40); rte_spinlock_unlock(&internal->rss_lock); @@ -482,7 +482,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, rss_conf->rss_hf = dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf; if (rss_conf->rss_key) - rte_memcpy(rss_conf->rss_key, internal->rss_key, 40); + memcpy(rss_conf->rss_key, internal->rss_key, 40); rte_spinlock_unlock(&internal->rss_lock); @@ -577,7 +577,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, struct pmd_options *args) internals->flow_type_rss_offloads = RTE_ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_ETH_RETA_GROUP_SIZE; - rte_memcpy(internals->rss_key, default_rss_key, 40); + memcpy(internals->rss_key, default_rss_key, 40); data = eth_dev->data; data->nb_rx_queues = (uint16_t)nb_rx_queues; diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c index bfec085045..54f0dfffbd 100644 --- a/drivers/net/pcap/pcap_ethdev.c +++ b/drivers/net/pcap/pcap_ethdev.c @@ -1270,7 +1270,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, return -1; PMD_LOG(INFO, "Setting phy MAC for %s", if_name); - rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); eth_dev->data->mac_addrs = mac_addrs; return 0; } diff --git a/drivers/net/pcap/pcap_osdep_freebsd.c b/drivers/net/pcap/pcap_osdep_freebsd.c index 20556b3e92..8811485aef 100644 --- a/drivers/net/pcap/pcap_osdep_freebsd.c +++ b/drivers/net/pcap/pcap_osdep_freebsd.c @@ -9,7 +9,6 @@ #include <sys/sysctl.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include "pcap_osdep.h" @@ -52,7 +51,7 @@ osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac) ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); - rte_memcpy(mac->addr_bytes, LLADDR(sdl), RTE_ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, LLADDR(sdl), RTE_ETHER_ADDR_LEN); rte_free(buf); return 0; diff --git a/drivers/net/pcap/pcap_osdep_linux.c b/drivers/net/pcap/pcap_osdep_linux.c index 97033f57c5..943e947296 100644 --- a/drivers/net/pcap/pcap_osdep_linux.c +++ b/drivers/net/pcap/pcap_osdep_linux.c @@ -9,7 +9,6 @@ #include <sys/socket.h> #include <unistd.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include "pcap_osdep.h" @@ -35,7 +34,7 @@ osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac) return -1; } - rte_memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(if_fd); return 0; diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index fd63262f3a..32fa2016d2 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -180,7 +180,7 @@ static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn) is_mac_exist = ecore_vf_bulletin_get_forced_mac(hwfn, mac, &is_mac_forced); if (is_mac_exist && is_mac_forced) - rte_memcpy(hwfn->hw_info.hw_mac_addr, mac, ETH_ALEN); + memcpy(hwfn->hw_info.hw_mac_addr, mac, ETH_ALEN); /* Always update link configuration according to bulletin */ qed_link_update(hwfn); diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 48953dd7a0..8d53983965 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -8,7 +8,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_os_shim.h> #include <rte_string_fns.h> #include <bus_vdev_driver.h> diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c index 2cfff20f47..2fd160e99e 100644 --- a/drivers/net/sfc/sfc.c +++ b/drivers/net/sfc/sfc.c @@ -850,7 +850,7 @@ sfc_rss_attach(struct sfc_adapter *sa) efx_ev_fini(sa->nic); efx_intr_fini(sa->nic); - rte_memcpy(rss->key, default_rss_key, sizeof(rss->key)); + memcpy(rss->key, default_rss_key, sizeof(rss->key)); memset(&rss->dummy_ctx, 0, sizeof(rss->dummy_ctx)); rss->dummy_ctx.conf.qid_span = 1; rss->dummy_ctx.dummy = true; diff --git a/drivers/net/sfc/sfc_ef10_tx.c b/drivers/net/sfc/sfc_ef10_tx.c index 116229382b..0b78a9eacc 100644 --- a/drivers/net/sfc/sfc_ef10_tx.c +++ b/drivers/net/sfc/sfc_ef10_tx.c @@ -514,7 +514,7 @@ sfc_ef10_xmit_tso_pkt(struct sfc_ef10_txq * const txq, struct rte_mbuf *m_seg, first_m_seg->outer_l2_len); th = (const struct rte_tcp_hdr *)(hdr_addr + tcph_off); - rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); + memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); sfc_ef10_tx_qdesc_tso2_create(txq, *added, packet_id, outer_packet_id, diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index 92ca5e7a60..a6f0743f10 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -1287,8 +1287,7 @@ sfc_set_mc_addr_list(struct rte_eth_dev *dev, } for (i = 0; i < nb_mc_addr; ++i) { - rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes, - EFX_MAC_ADDR_LEN); + memcpy(mc_addrs, mc_addr_set[i].addr_bytes, EFX_MAC_ADDR_LEN); mc_addrs += EFX_MAC_ADDR_LEN; } @@ -1672,7 +1671,7 @@ sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev, rss_conf->rss_hf = sfc_rx_hf_efx_to_rte(rss, rss->hash_types); rss_conf->rss_key_len = EFX_RSS_KEY_SIZE; if (rss_conf->rss_key != NULL) - rte_memcpy(rss_conf->rss_key, rss->key, EFX_RSS_KEY_SIZE); + memcpy(rss_conf->rss_key, rss->key, EFX_RSS_KEY_SIZE); return 0; } @@ -1741,7 +1740,7 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev, } } - rte_memcpy(rss->key, rss_conf->rss_key, sizeof(rss->key)); + memcpy(rss->key, rss_conf->rss_key, sizeof(rss->key)); } rss->hash_types = efx_hash_types; @@ -1840,7 +1839,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev, sfc_adapter_lock(sa); - rte_memcpy(rss_tbl_new, rss->tbl, sizeof(rss->tbl)); + memcpy(rss_tbl_new, rss->tbl, sizeof(rss->tbl)); for (entry = 0; entry < reta_size; entry++) { int grp_idx = entry % RTE_ETH_RETA_GROUP_SIZE; @@ -1864,7 +1863,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev, goto fail_scale_tbl_set; } - rte_memcpy(rss->tbl, rss_tbl_new, sizeof(rss->tbl)); + memcpy(rss->tbl, rss_tbl_new, sizeof(rss->tbl)); fail_scale_tbl_set: bad_reta_entry: diff --git a/drivers/net/sfc/sfc_flow.c b/drivers/net/sfc/sfc_flow.c index 1b50aefe5c..2bb98a4433 100644 --- a/drivers/net/sfc/sfc_flow.c +++ b/drivers/net/sfc/sfc_flow.c @@ -325,8 +325,8 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, efx_spec->efs_match_flags |= is_ifrm ? EFX_FILTER_MATCH_IFRM_LOC_MAC : EFX_FILTER_MATCH_LOC_MAC; - rte_memcpy(loc_mac, spec->hdr.dst_addr.addr_bytes, - EFX_MAC_ADDR_LEN); + memcpy(loc_mac, spec->hdr.dst_addr.addr_bytes, + EFX_MAC_ADDR_LEN); } else if (memcmp(mask->hdr.dst_addr.addr_bytes, ig_mask, EFX_MAC_ADDR_LEN) == 0) { if (rte_is_unicast_ether_addr(&spec->hdr.dst_addr)) @@ -348,8 +348,8 @@ sfc_flow_parse_eth(const struct rte_flow_item *item, */ if (rte_is_same_ether_addr(&mask->hdr.src_addr, &supp_mask.hdr.src_addr)) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_REM_MAC; - rte_memcpy(efx_spec->efs_rem_mac, spec->hdr.src_addr.addr_bytes, - EFX_MAC_ADDR_LEN); + memcpy(efx_spec->efs_rem_mac, spec->hdr.src_addr.addr_bytes, + EFX_MAC_ADDR_LEN); } else if (!rte_is_zero_ether_addr(&mask->hdr.src_addr)) { goto fail_bad_mask; } @@ -624,8 +624,8 @@ sfc_flow_parse_ipv6(const struct rte_flow_item *item, RTE_BUILD_BUG_ON(sizeof(efx_spec->efs_rem_host) != sizeof(spec->hdr.src_addr)); - rte_memcpy(&efx_spec->efs_rem_host, spec->hdr.src_addr, - sizeof(efx_spec->efs_rem_host)); + memcpy(&efx_spec->efs_rem_host, spec->hdr.src_addr, + sizeof(efx_spec->efs_rem_host)); } else if (!sfc_flow_is_zero(mask->hdr.src_addr, sizeof(mask->hdr.src_addr))) { goto fail_bad_mask; @@ -637,8 +637,8 @@ sfc_flow_parse_ipv6(const struct rte_flow_item *item, RTE_BUILD_BUG_ON(sizeof(efx_spec->efs_loc_host) != sizeof(spec->hdr.dst_addr)); - rte_memcpy(&efx_spec->efs_loc_host, spec->hdr.dst_addr, - sizeof(efx_spec->efs_loc_host)); + memcpy(&efx_spec->efs_loc_host, spec->hdr.dst_addr, + sizeof(efx_spec->efs_loc_host)); } else if (!sfc_flow_is_zero(mask->hdr.dst_addr, sizeof(mask->hdr.dst_addr))) { goto fail_bad_mask; @@ -889,8 +889,8 @@ sfc_flow_set_efx_spec_vni_or_vsid(efx_filter_spec_t *efx_spec, if (memcmp(vni_or_vsid_mask, vni_or_vsid_full_mask, EFX_VNI_OR_VSID_LEN) == 0) { efx_spec->efs_match_flags |= EFX_FILTER_MATCH_VNI_OR_VSID; - rte_memcpy(efx_spec->efs_vni_or_vsid, vni_or_vsid_val, - EFX_VNI_OR_VSID_LEN); + memcpy(efx_spec->efs_vni_or_vsid, vni_or_vsid_val, + EFX_VNI_OR_VSID_LEN); } else if (!sfc_flow_is_zero(vni_or_vsid_mask, EFX_VNI_OR_VSID_LEN)) { rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item, diff --git a/drivers/net/sfc/sfc_flow_rss.c b/drivers/net/sfc/sfc_flow_rss.c index e28c943335..a46ce1fa87 100644 --- a/drivers/net/sfc/sfc_flow_rss.c +++ b/drivers/net/sfc/sfc_flow_rss.c @@ -119,7 +119,7 @@ sfc_flow_rss_parse_conf(struct sfc_adapter *sa, key = ethdev_rss->key; } - rte_memcpy(out->key, key, sizeof(out->key)); + memcpy(out->key, key, sizeof(out->key)); switch (in->func) { case RTE_ETH_HASH_FUNCTION_DEFAULT: diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 60ff6d2181..1f243e798e 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -547,7 +547,7 @@ sfc_mae_mac_addr_add(struct sfc_adapter *sa, if (mac_addr == NULL) return ENOMEM; - rte_memcpy(mac_addr->addr_bytes, addr_bytes, EFX_MAC_ADDR_LEN); + memcpy(mac_addr->addr_bytes, addr_bytes, EFX_MAC_ADDR_LEN); mac_addr->refcnt = 1; mac_addr->fw_rsrc.mac_id.id = EFX_MAE_RSRC_ID_INVALID; diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c index a193229265..55aae9ef04 100644 --- a/drivers/net/sfc/sfc_rx.c +++ b/drivers/net/sfc/sfc_rx.c @@ -1526,7 +1526,7 @@ sfc_rx_process_adv_conf_rss(struct sfc_adapter *sa, sizeof(rss->key)); return EINVAL; } - rte_memcpy(rss->key, conf->rss_key, sizeof(rss->key)); + memcpy(rss->key, conf->rss_key, sizeof(rss->key)); } rss->hash_types = efx_hash_types; diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c index a0827d1c0d..5da2de3c3d 100644 --- a/drivers/net/sfc/sfc_tso.c +++ b/drivers/net/sfc/sfc_tso.c @@ -159,7 +159,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx, /* Handle TCP header */ th = (const struct rte_tcp_hdr *)(tsoh + tcph_off); - rte_memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); + memcpy(&sent_seq, &th->sent_seq, sizeof(uint32_t)); sent_seq = rte_be_to_cpu_32(sent_seq); efx_tx_qdesc_tso2_create(txq->common, packet_id, 0, sent_seq, diff --git a/drivers/net/sfc/sfc_tso.h b/drivers/net/sfc/sfc_tso.h index 9029ad1590..e914eae77e 100644 --- a/drivers/net/sfc/sfc_tso.h +++ b/drivers/net/sfc/sfc_tso.h @@ -35,7 +35,7 @@ sfc_tso_ip4_get_ipid(const uint8_t *pkt_hdrp, size_t ip_hdr_off) uint16_t ipid; ip_hdrp = (const struct rte_ipv4_hdr *)(pkt_hdrp + ip_hdr_off); - rte_memcpy(&ipid, &ip_hdrp->packet_id, sizeof(ipid)); + memcpy(&ipid, &ip_hdrp->packet_id, sizeof(ipid)); return rte_be_to_cpu_16(ipid); } @@ -46,9 +46,8 @@ sfc_tso_outer_udp_fix_len(const struct rte_mbuf *m, uint8_t *tsoh) rte_be16_t len = rte_cpu_to_be_16(m->l2_len + m->l3_len + m->l4_len + m->tso_segsz); - rte_memcpy(tsoh + m->outer_l2_len + m->outer_l3_len + - offsetof(struct rte_udp_hdr, dgram_len), - &len, sizeof(len)); + memcpy(tsoh + m->outer_l2_len + m->outer_l3_len + offsetof(struct rte_udp_hdr, dgram_len), + &len, sizeof(len)); } static inline void @@ -67,7 +66,7 @@ sfc_tso_innermost_ip_fix_len(const struct rte_mbuf *m, uint8_t *tsoh, len = rte_cpu_to_be_16(ip_payload_len); } - rte_memcpy(tsoh + iph_ofst + field_ofst, &len, sizeof(len)); + memcpy(tsoh + iph_ofst + field_ofst, &len, sizeof(len)); } unsigned int sfc_tso_prepare_header(uint8_t *tsoh, size_t header_len, diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 69d9da695b..518619c53b 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1404,11 +1404,11 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); ret = tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode); if (ret < 0) return ret; - rte_memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (pmd->remote_if_index && !pmd->flow_isolate) { /* Replace MAC redirection rule after a MAC change */ ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC); @@ -2010,7 +2010,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (rte_is_zero_ether_addr(mac_addr)) rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else - rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); + memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } /* @@ -2033,8 +2033,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (pmd->type == ETH_TUNTAP_TYPE_TAP) { memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, - RTE_ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, + RTE_ETHER_ADDR_LEN); if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) goto error_exit; } @@ -2091,8 +2091,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, pmd->name, pmd->remote_iface); goto error_remote; } - rte_memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, - RTE_ETHER_ADDR_LEN); + memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, + RTE_ETHER_ADDR_LEN); /* The desired MAC is already in ifreq after SIOCGIFHWADDR. */ if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) { TAP_LOG(ERR, "%s: failed to get %s MAC address.", diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index b75e8898e2..1c42fd74b4 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -4304,9 +4304,8 @@ txgbe_add_del_ntuple_filter(struct rte_eth_dev *dev, sizeof(struct txgbe_5tuple_filter), 0); if (filter == NULL) return -ENOMEM; - rte_memcpy(&filter->filter_info, - &filter_5tuple, - sizeof(struct txgbe_5tuple_filter_info)); + memcpy(&filter->filter_info, &filter_5tuple, + sizeof(struct txgbe_5tuple_filter_info)); filter->queue = ntuple_filter->queue; ret = txgbe_add_5tuple_filter(dev, filter); if (ret < 0) { @@ -5109,9 +5108,7 @@ txgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev, if (!node) return -ENOMEM; - rte_memcpy(&node->key, - &key, - sizeof(struct txgbe_l2_tn_key)); + memcpy(&node->key, &key, sizeof(struct txgbe_l2_tn_key)); node->pool = l2_tunnel->pool; ret = txgbe_insert_l2_tn_filter(l2_tn_info, node); if (ret < 0) { diff --git a/drivers/net/txgbe/txgbe_fdir.c b/drivers/net/txgbe/txgbe_fdir.c index a198b6781b..00366ed873 100644 --- a/drivers/net/txgbe/txgbe_fdir.c +++ b/drivers/net/txgbe/txgbe_fdir.c @@ -42,7 +42,7 @@ else \ ipv6_addr[i] = 0; \ } \ - rte_memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ + memcpy((ipaddr), ipv6_addr, sizeof(ipv6_addr));\ } while (0) /** @@ -858,8 +858,8 @@ txgbe_fdir_filter_program(struct rte_eth_dev *dev, sizeof(struct txgbe_fdir_filter), 0); if (!node) return -ENOMEM; - rte_memcpy(&node->input, &rule->input, - sizeof(struct txgbe_atr_input)); + memcpy(&node->input, &rule->input, + sizeof(struct txgbe_atr_input)); node->fdirflags = rule->fdirflags; node->fdirhash = fdirhash; node->queue = queue; diff --git a/drivers/net/txgbe/txgbe_flow.c b/drivers/net/txgbe/txgbe_flow.c index 7ef52d0b0f..c76fc0eed0 100644 --- a/drivers/net/txgbe/txgbe_flow.c +++ b/drivers/net/txgbe/txgbe_flow.c @@ -1834,10 +1834,10 @@ txgbe_parse_fdir_filter_normal(struct rte_eth_dev *dev __rte_unused, if (item->spec) { rule->b_spec = TRUE; ipv6_spec = item->spec; - rte_memcpy(rule->input.src_ip, - ipv6_spec->hdr.src_addr, 16); - rte_memcpy(rule->input.dst_ip, - ipv6_spec->hdr.dst_addr, 16); + memcpy(rule->input.src_ip, ipv6_spec->hdr.src_addr, + 16); + memcpy(rule->input.dst_ip, ipv6_spec->hdr.dst_addr, + 16); } /** @@ -2756,9 +2756,9 @@ txgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&ntuple_filter_ptr->filter_info, - &ntuple_filter, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter_ptr->filter_info, + &ntuple_filter, + sizeof(struct rte_eth_ntuple_filter)); TAILQ_INSERT_TAIL(&filter_ntuple_list, ntuple_filter_ptr, entries); flow->rule = ntuple_filter_ptr; @@ -2782,9 +2782,9 @@ txgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(ðertype_filter_ptr->filter_info, - ðertype_filter, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter_ptr->filter_info, + ðertype_filter, + sizeof(struct rte_eth_ethertype_filter)); TAILQ_INSERT_TAIL(&filter_ethertype_list, ethertype_filter_ptr, entries); flow->rule = ethertype_filter_ptr; @@ -2806,9 +2806,8 @@ txgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&syn_filter_ptr->filter_info, - &syn_filter, - sizeof(struct rte_eth_syn_filter)); + memcpy(&syn_filter_ptr->filter_info, &syn_filter, + sizeof(struct rte_eth_syn_filter)); TAILQ_INSERT_TAIL(&filter_syn_list, syn_filter_ptr, entries); @@ -2827,9 +2826,8 @@ txgbe_flow_create(struct rte_eth_dev *dev, if (fdir_rule.b_mask) { if (!fdir_info->mask_added) { /* It's the first time the mask is set. */ - rte_memcpy(&fdir_info->mask, - &fdir_rule.mask, - sizeof(struct txgbe_hw_fdir_mask)); + memcpy(&fdir_info->mask, &fdir_rule.mask, + sizeof(struct txgbe_hw_fdir_mask)); fdir_info->flex_bytes_offset = fdir_rule.flex_bytes_offset; @@ -2873,9 +2871,9 @@ txgbe_flow_create(struct rte_eth_dev *dev, "failed to allocate memory"); goto out; } - rte_memcpy(&fdir_rule_ptr->filter_info, - &fdir_rule, - sizeof(struct txgbe_fdir_rule)); + memcpy(&fdir_rule_ptr->filter_info, + &fdir_rule, + sizeof(struct txgbe_fdir_rule)); TAILQ_INSERT_TAIL(&filter_fdir_list, fdir_rule_ptr, entries); flow->rule = fdir_rule_ptr; @@ -2910,9 +2908,8 @@ txgbe_flow_create(struct rte_eth_dev *dev, PMD_DRV_LOG(ERR, "failed to allocate memory"); goto out; } - rte_memcpy(&l2_tn_filter_ptr->filter_info, - &l2_tn_filter, - sizeof(struct txgbe_l2_tunnel_conf)); + memcpy(&l2_tn_filter_ptr->filter_info, &l2_tn_filter, + sizeof(struct txgbe_l2_tunnel_conf)); TAILQ_INSERT_TAIL(&filter_l2_tunnel_list, l2_tn_filter_ptr, entries); flow->rule = l2_tn_filter_ptr; @@ -3038,9 +3035,8 @@ txgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_NTUPLE: ntuple_filter_ptr = (struct txgbe_ntuple_filter_ele *) pmd_flow->rule; - rte_memcpy(&ntuple_filter, - &ntuple_filter_ptr->filter_info, - sizeof(struct rte_eth_ntuple_filter)); + memcpy(&ntuple_filter, &ntuple_filter_ptr->filter_info, + sizeof(struct rte_eth_ntuple_filter)); ret = txgbe_add_del_ntuple_filter(dev, &ntuple_filter, FALSE); if (!ret) { TAILQ_REMOVE(&filter_ntuple_list, @@ -3051,9 +3047,8 @@ txgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_ETHERTYPE: ethertype_filter_ptr = (struct txgbe_ethertype_filter_ele *) pmd_flow->rule; - rte_memcpy(ðertype_filter, - ðertype_filter_ptr->filter_info, - sizeof(struct rte_eth_ethertype_filter)); + memcpy(ðertype_filter, ðertype_filter_ptr->filter_info, + sizeof(struct rte_eth_ethertype_filter)); ret = txgbe_add_del_ethertype_filter(dev, ðertype_filter, FALSE); if (!ret) { @@ -3065,9 +3060,8 @@ txgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_SYN: syn_filter_ptr = (struct txgbe_eth_syn_filter_ele *) pmd_flow->rule; - rte_memcpy(&syn_filter, - &syn_filter_ptr->filter_info, - sizeof(struct rte_eth_syn_filter)); + memcpy(&syn_filter, &syn_filter_ptr->filter_info, + sizeof(struct rte_eth_syn_filter)); ret = txgbe_syn_filter_set(dev, &syn_filter, FALSE); if (!ret) { TAILQ_REMOVE(&filter_syn_list, @@ -3077,9 +3071,8 @@ txgbe_flow_destroy(struct rte_eth_dev *dev, break; case RTE_ETH_FILTER_FDIR: fdir_rule_ptr = (struct txgbe_fdir_rule_ele *)pmd_flow->rule; - rte_memcpy(&fdir_rule, - &fdir_rule_ptr->filter_info, - sizeof(struct txgbe_fdir_rule)); + memcpy(&fdir_rule, &fdir_rule_ptr->filter_info, + sizeof(struct txgbe_fdir_rule)); ret = txgbe_fdir_filter_program(dev, &fdir_rule, TRUE, FALSE); if (!ret) { TAILQ_REMOVE(&filter_fdir_list, @@ -3092,8 +3085,8 @@ txgbe_flow_destroy(struct rte_eth_dev *dev, case RTE_ETH_FILTER_L2_TUNNEL: l2_tn_filter_ptr = (struct txgbe_eth_l2_tunnel_conf_ele *) pmd_flow->rule; - rte_memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info, - sizeof(struct txgbe_l2_tunnel_conf)); + memcpy(&l2_tn_filter, &l2_tn_filter_ptr->filter_info, + sizeof(struct txgbe_l2_tunnel_conf)); ret = txgbe_dev_l2_tunnel_filter_del(dev, &l2_tn_filter); if (!ret) { TAILQ_REMOVE(&filter_l2_tunnel_list, diff --git a/drivers/net/txgbe/txgbe_ipsec.c b/drivers/net/txgbe/txgbe_ipsec.c index f9f8108fb8..000dd5ec6d 100644 --- a/drivers/net/txgbe/txgbe_ipsec.c +++ b/drivers/net/txgbe/txgbe_ipsec.c @@ -658,10 +658,10 @@ txgbe_crypto_add_ingress_sa_from_flow(const void *sess, const struct rte_flow_item_ipv6 *ipv6 = ip_spec; ic_session->src_ip.type = IPv6; ic_session->dst_ip.type = IPv6; - rte_memcpy(ic_session->src_ip.ipv6, - ipv6->hdr.src_addr, 16); - rte_memcpy(ic_session->dst_ip.ipv6, - ipv6->hdr.dst_addr, 16); + memcpy(ic_session->src_ip.ipv6, ipv6->hdr.src_addr, + 16); + memcpy(ic_session->dst_ip.ipv6, ipv6->hdr.dst_addr, + 16); } else { const struct rte_flow_item_ipv4 *ipv4 = ip_spec; ic_session->src_ip.type = IPv4; diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c index 176f79005c..1e8668cbc9 100644 --- a/drivers/net/txgbe/txgbe_pf.c +++ b/drivers/net/txgbe/txgbe_pf.c @@ -17,7 +17,6 @@ #include <rte_eal.h> #include <rte_ether.h> #include <ethdev_driver.h> -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_random.h> #include <bus_pci_driver.h> @@ -435,7 +434,7 @@ txgbe_vf_reset(struct rte_eth_dev *eth_dev, uint16_t vf, uint32_t *msgbuf) /* reply to reset with ack and vf mac address */ msgbuf[0] = TXGBE_VF_RESET | TXGBE_VT_MSGTYPE_ACK; - rte_memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); + memcpy(new_mac, vf_mac, RTE_ETHER_ADDR_LEN); /* * Piggyback the multicast filter type so VF can compute the * correct vectors @@ -457,7 +456,7 @@ txgbe_vf_set_mac_addr(struct rte_eth_dev *eth_dev, struct rte_ether_addr *ea = (struct rte_ether_addr *)new_mac; if (rte_is_valid_assigned_ether_addr(ea)) { - rte_memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); + memcpy(vfinfo[vf].vf_mac_addresses, new_mac, 6); return hw->mac.set_rar(hw, rar_entry, new_mac, vf, true); } return -1; diff --git a/drivers/net/txgbe/txgbe_tm.c b/drivers/net/txgbe/txgbe_tm.c index 3171be73d0..7d77b01dfe 100644 --- a/drivers/net/txgbe/txgbe_tm.c +++ b/drivers/net/txgbe/txgbe_tm.c @@ -280,8 +280,8 @@ txgbe_shaper_profile_add(struct rte_eth_dev *dev, if (!shaper_profile) return -ENOMEM; shaper_profile->shaper_profile_id = shaper_profile_id; - rte_memcpy(&shaper_profile->profile, profile, - sizeof(struct rte_tm_shaper_params)); + memcpy(&shaper_profile->profile, profile, + sizeof(struct rte_tm_shaper_params)); TAILQ_INSERT_TAIL(&tm_conf->shaper_profile_list, shaper_profile, node); @@ -625,8 +625,8 @@ txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->no = 0; tm_node->parent = NULL; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, + sizeof(struct rte_tm_node_params)); tm_conf->root = tm_node; /* increase the reference counter of the shaper profile */ @@ -706,8 +706,7 @@ txgbe_node_add(struct rte_eth_dev *dev, uint32_t node_id, tm_node->reference_count = 0; tm_node->parent = parent_node; tm_node->shaper_profile = shaper_profile; - rte_memcpy(&tm_node->params, params, - sizeof(struct rte_tm_node_params)); + memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); if (parent_node_type == TXGBE_TM_NODE_TYPE_PORT) { tm_node->no = parent_node->reference_count; TAILQ_INSERT_TAIL(&tm_conf->tc_list, diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 21bbb008e0..a88a3a18a0 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -12,7 +12,6 @@ #include <ethdev_driver.h> #include <ethdev_vdev.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_net.h> #include <bus_vdev_driver.h> #include <rte_kvargs.h> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 517585740e..5c727cc4c0 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -10,7 +10,6 @@ #include <unistd.h> #include <ethdev_driver.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_memzone.h> #include <rte_malloc.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 16/30] raw: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (14 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 15/30] net: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 17/30] baseband: " Stephen Hemminger ` (13 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Rosen Xu, Sachin Saxena, Hemant Agrawal Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +-- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +-- drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +-- drivers/raw/ifpga/afu_pmd_n3000.c | 8 ++++---- drivers/raw/ifpga/ifpga_rawdev.c | 11 +++++------ drivers/raw/skeleton/skeleton_rawdev.c | 8 +++----- drivers/raw/skeleton/skeleton_rawdev_test.c | 1 - 7 files changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c index 859f28dcc1..c2aaed9203 100644 --- a/drivers/raw/ifpga/afu_pmd_he_hssi.c +++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c @@ -15,7 +15,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -314,7 +313,7 @@ static int he_hssi_config(struct afu_rawdev *dev, void *config, if (cfg->port >= NUM_HE_HSSI_PORTS) return -EINVAL; - rte_memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg)); + memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c index c7c5cda48c..ffb7075c84 100644 --- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c +++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c @@ -15,7 +15,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -363,7 +362,7 @@ static int he_lpbk_config(struct afu_rawdev *dev, void *config, if ((cfg->end < cfg->begin) || (cfg->end > MAX_CACHE_LINES)) return -EINVAL; - rte_memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg)); + memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c index a1db533eeb..b799e40d2d 100644 --- a/drivers/raw/ifpga/afu_pmd_he_mem.c +++ b/drivers/raw/ifpga/afu_pmd_he_mem.c @@ -14,7 +14,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -126,7 +125,7 @@ static int he_mem_tg_config(struct afu_rawdev *dev, void *config, if (config_size != sizeof(struct rte_pmd_afu_he_mem_tg_cfg)) return -EINVAL; - rte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg)); + memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c index 67b3941265..9236c0b153 100644 --- a/drivers/raw/ifpga/afu_pmd_n3000.c +++ b/drivers/raw/ifpga/afu_pmd_n3000.c @@ -1867,8 +1867,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config, if ((cfg->nlb_cfg.end < cfg->nlb_cfg.begin) || (cfg->nlb_cfg.end > MAX_CACHE_LINES)) return -EINVAL; - rte_memcpy(&priv->nlb_cfg, &cfg->nlb_cfg, - sizeof(struct rte_pmd_afu_nlb_cfg)); + memcpy(&priv->nlb_cfg, &cfg->nlb_cfg, + sizeof(struct rte_pmd_afu_nlb_cfg)); } else if (cfg->type == RTE_PMD_AFU_N3000_DMA) { if (cfg->dma_cfg.index >= NUM_N3000_DMA) return -EINVAL; @@ -1887,8 +1887,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config, cfg->dma_cfg.length); } } - rte_memcpy(&priv->dma_cfg, &cfg->dma_cfg, - sizeof(struct rte_pmd_afu_dma_cfg)); + memcpy(&priv->dma_cfg, &cfg->dma_cfg, + sizeof(struct rte_pmd_afu_dma_cfg)); } else { IFPGA_RAWDEV_PMD_ERR("Invalid type of N3000 AFU"); return -EINVAL; diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index f89bd3f9e2..d5d47e14dd 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -14,7 +14,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_kvargs.h> @@ -258,7 +257,7 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev) if (point < 12) return -1; point -= 12; - rte_memcpy(ifpga_dev->parent_bdf, &link[point], 12); + memcpy(ifpga_dev->parent_bdf, &link[point], 12); point = strlen(link1); if (point < 26) @@ -948,10 +947,10 @@ ifpga_rawdev_pr(struct rte_rawdev *dev, if (ret) return ret; - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b, - sizeof(u64)); - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8, - sizeof(u64)); + memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b, + sizeof(u64)); + memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8, + sizeof(u64)); IFPGA_RAWDEV_PMD_INFO("%s: uuid_l=0x%lx, uuid_h=0x%lx\n", __func__, diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index 6e99d35536..256f45cb5d 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -20,7 +20,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_lcore.h> #include <bus_vdev_driver.h> @@ -245,8 +244,8 @@ static int skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, skelq = &skeldev->queues[queue_id]; if (queue_id < SKELETON_MAX_QUEUES) - rte_memcpy(queue_conf, skelq, - sizeof(struct skeleton_rawdev_queue)); + memcpy(queue_conf, skelq, + sizeof(struct skeleton_rawdev_queue)); return 0; } @@ -281,8 +280,7 @@ static int skeleton_rawdev_queue_setup(struct rte_rawdev *dev, if (skeldev->num_queues > queue_id && q->depth < SKELETON_QUEUE_MAX_DEPTH) { - rte_memcpy(q, queue_conf, - sizeof(struct skeleton_rawdev_queue)); + memcpy(q, queue_conf, sizeof(struct skeleton_rawdev_queue)); clear_queue_bufs(queue_id); } else { SKELETON_PMD_ERR("Invalid queue configuration"); diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c index b7a7f623aa..dc32c4e29b 100644 --- a/drivers/raw/skeleton/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c @@ -7,7 +7,6 @@ #include <rte_common.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <dev_driver.h> #include <rte_rawdev.h> #include <bus_vdev_driver.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 17/30] baseband: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (15 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 16/30] raw: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 18/30] common: " Stephen Hemminger ` (12 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nicolas Chautru, Gagandeep Singh, Hemant Agrawal Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/baseband/acc/rte_acc100_pmd.c | 16 +++++++--------- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++++++++++----------- drivers/baseband/la12xx/bbdev_la12xx.c | 4 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index 4f666e514b..6e3160bcb8 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -2975,15 +2975,13 @@ enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint8_t *prev_ptr = (uint8_t *) prev_desc; uint8_t *new_ptr = (uint8_t *) desc; /* Copy first 4 words and BDESCs */ - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, - prev_ptr + ACC_5GUL_OFFSET_0, - ACC_5GUL_SIZE_1); + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); + memcpy(new_ptr + ACC_5GUL_OFFSET_0, + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); desc->req.op_addr = prev_desc->req.op_addr; /* Copy FCW */ - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, - prev_ptr + ACC_DESC_FCW_OFFSET, - ACC_FCW_LD_BLEN); + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, + prev_ptr + ACC_DESC_FCW_OFFSET, ACC_FCW_LD_BLEN); acc100_dma_desc_ld_update(op, &desc->req, input, h_output, &in_offset, &h_out_offset, &h_out_length, harq_layout); @@ -3130,7 +3128,7 @@ enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, desc = acc_desc(q, total_enqueued_cbs); desc->req.data_ptrs[0].address = q->ring_addr_iova + fcw_offset; desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); ret = acc100_dma_desc_ld_fill(op, &desc->req, &input, h_output, &in_offset, &h_out_offset, &h_out_length, @@ -4430,7 +4428,7 @@ acc100_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); value = acc_reg_read(d, HwPfPcieGpexBridgeControl); bool firstCfg = (value != ACC100_CFG_PCI_BRIDGE); diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c index 88b1104fab..3e5376a12e 100644 --- a/drivers/baseband/acc/rte_vrb_pmd.c +++ b/drivers/baseband/acc/rte_vrb_pmd.c @@ -2450,15 +2450,13 @@ vrb_enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint8_t *prev_ptr = (uint8_t *) prev_desc; uint8_t *new_ptr = (uint8_t *) desc; /* Copy first 4 words and BDESCs. */ - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, - prev_ptr + ACC_5GUL_OFFSET_0, - ACC_5GUL_SIZE_1); + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); + memcpy(new_ptr + ACC_5GUL_OFFSET_0, + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); desc->req.op_addr = prev_desc->req.op_addr; /* Copy FCW. */ - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, - prev_ptr + ACC_DESC_FCW_OFFSET, - ACC_FCW_LD_BLEN); + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, + prev_ptr + ACC_DESC_FCW_OFFSET, ACC_FCW_LD_BLEN); vrb_dma_desc_ld_update(op, &desc->req, input, h_output, &in_offset, &h_out_offset, &h_out_length, harq_layout); @@ -2566,7 +2564,8 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, fcw_offset = (desc_idx << 8) + ACC_DESC_FCW_OFFSET; desc->req.data_ptrs[0].address = q->ring_addr_iova + fcw_offset; desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, + ACC_FCW_LD_BLEN); desc->req.fcw_ld.tb_trailer_size = (c - r - 1) * trail_len; ret = vrb_dma_desc_ld_fill(op, &desc->req, &input, h_output, &in_offset, &h_out_offset, @@ -3991,7 +3990,7 @@ enqueue_mldts_split_op(struct acc_queue *q, struct rte_bbdev_mldts_op *op, if (symb == 0) desc->req.cbs_in_tb = num_syms; else - rte_memcpy(&desc->req.fcw_mldts, fcw, ACC_FCW_MLDTS_BLEN); + memcpy(&desc->req.fcw_mldts, fcw, ACC_FCW_MLDTS_BLEN); desc->req.data_ptrs[1].address = rte_pktmbuf_iova_offset(input_q, in_offset); desc->req.data_ptrs[1].blen = q_size; in_offset += q_size; @@ -4337,7 +4336,7 @@ vrb1_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration. */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); /* Check we are already out of PG. */ status = acc_reg_read(d, VRB1_PfHiSectionPowerGatingAck); @@ -4744,7 +4743,7 @@ vrb2_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration. */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); /* Explicitly releasing AXI as this may be stopped after PF FLR/BME. */ address = VRB2_PfDmaAxiControl; diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index bb754a5395..23e2fdb811 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -597,8 +597,8 @@ dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst) op = q_priv->bbdev_op[ci]; - rte_memcpy(dst, q_priv->msg_ch_vaddr[ci], - sizeof(struct bbdev_ipc_enqueue_op)); + memcpy(dst, q_priv->msg_ch_vaddr[ci], + sizeof(struct bbdev_ipc_enqueue_op)); /* Move Consumer Index forward */ ci++; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 18/30] common: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (16 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 17/30] baseband: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 19/30] crypto: " Stephen Hemminger ` (11 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Jingjing Wu, Kai Ji, Fan Zhang, Ashish Gupta Automatically generated by devtools/cocci/rte_memcpy.cocci Also, remove unnecessary includes of rte_memcpy.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/idpf/idpf_common_device.c | 4 ++-- drivers/common/idpf/idpf_common_virtchnl.c | 10 ++++++---- drivers/common/qat/qat_qp.c | 10 ++++------ drivers/compress/qat/qat_comp.c | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c index 8403ed83f9..37c859f830 100644 --- a/drivers/common/idpf/idpf_common_device.c +++ b/drivers/common/idpf/idpf_common_device.c @@ -477,8 +477,8 @@ idpf_vport_init(struct idpf_vport *vport, vport->num_rx_q = vport_info->num_rx_q; vport->num_rx_bufq = vport_info->num_rx_bufq; vport->max_mtu = vport_info->max_mtu; - rte_memcpy(vport->default_mac_addr, - vport_info->default_mac_addr, ETH_ALEN); + memcpy(vport->default_mac_addr, vport_info->default_mac_addr, + ETH_ALEN); vport->rss_algorithm = vport_info->rss_algorithm; vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN, vport_info->rss_key_size); diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c index c46ed50eb5..baabfeb216 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.c +++ b/drivers/common/idpf/idpf_common_virtchnl.c @@ -290,7 +290,8 @@ idpf_vc_caps_get(struct idpf_adapter *adapter) return err; } - rte_memcpy(&adapter->caps, args.out_buffer, sizeof(struct virtchnl2_get_capabilities)); + memcpy(&adapter->caps, args.out_buffer, + sizeof(struct virtchnl2_get_capabilities)); return 0; } @@ -327,7 +328,8 @@ idpf_vc_vport_create(struct idpf_vport *vport, return err; } - rte_memcpy(&(vport->vport_info.info), args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(&(vport->vport_info.info), args.out_buffer, + IDPF_DFLT_MBX_BUF_SIZE); return 0; } @@ -383,7 +385,7 @@ idpf_vc_queue_grps_add(struct idpf_vport *vport, return err; } - rte_memcpy(p2p_queue_grps_out, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(p2p_queue_grps_out, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); return 0; } @@ -922,7 +924,7 @@ idpf_vc_ptype_info_query(struct idpf_adapter *adapter, if (err != 0) DRV_LOG(ERR, "Failed to execute command of VIRTCHNL2_OP_GET_PTYPE_INFO"); - rte_memcpy(recv_ptype_info, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(recv_ptype_info, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); return err; } diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c index f95dd33375..0c30c4d8c1 100644 --- a/drivers/common/qat/qat_qp.c +++ b/drivers/common/qat/qat_qp.c @@ -871,9 +871,8 @@ qat_cq_get_fw_cipher_crc_cap(struct qat_qp *qp) return -EINVAL; } - rte_memcpy(src_data_addr, - cipher_crc_cap_check_plaintext, - sizeof(cipher_crc_cap_check_plaintext)); + memcpy(src_data_addr, cipher_crc_cap_check_plaintext, + sizeof(cipher_crc_cap_check_plaintext)); phy_src_addr = rte_mem_virt2iova(src_data_addr); if (phy_src_addr == 0 || phy_src_addr == RTE_BAD_IOVA) { @@ -892,9 +891,8 @@ qat_cq_get_fw_cipher_crc_cap(struct qat_qp *qp) auth_param = (void *)((uint8_t *)cipher_param + ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET); - rte_memcpy(cipher_param->u.cipher_IV_array, - cipher_crc_cap_check_iv, - sizeof(cipher_crc_cap_check_iv)); + memcpy(cipher_param->u.cipher_IV_array, cipher_crc_cap_check_iv, + sizeof(cipher_crc_cap_check_iv)); cipher_param->cipher_offset = cipher_crc_cap_check_cipher_offset; cipher_param->cipher_length = diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c index 559948a46a..5bcbefe395 100644 --- a/drivers/compress/qat/qat_comp.c +++ b/drivers/compress/qat/qat_comp.c @@ -375,7 +375,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, QAT_DP_LOG(DEBUG, "op %p, parent_cookie %p", op, parent_cookie); /* copy original op to the local variable for restoring later */ - rte_memcpy(&op_backup, op, sizeof(op_backup)); + memcpy(&op_backup, op, sizeof(op_backup)); parent_cookie->nb_child_responses = 0; parent_cookie->nb_children = 0; @@ -401,7 +401,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, } /* prepare local dst mbuf */ - rte_memcpy(&dst_mbuf, op->m_dst, sizeof(dst_mbuf)); + memcpy(&dst_mbuf, op->m_dst, sizeof(dst_mbuf)); rte_pktmbuf_reset(&dst_mbuf); dst_mbuf.buf_len = dst_data_size; dst_mbuf.data_len = dst_data_size; @@ -457,7 +457,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, if (ret < 0) { QAT_DP_LOG(WARNING, "Failed to build child descriptor"); /* restore op and clear cookie */ - rte_memcpy(op, &op_backup, sizeof(op_backup)); + memcpy(op, &op_backup, sizeof(op_backup)); parent_cookie->split_op = 0; parent_cookie->nb_children = 0; return ret; @@ -468,7 +468,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, } /* restore backed up original op */ - rte_memcpy(op, &op_backup, sizeof(op_backup)); + memcpy(op, &op_backup, sizeof(op_backup)); if (nb_descr != num_descriptors_built) QAT_DP_LOG(ERR, "split op. expected %d, built %d", -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 19/30] crypto: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (17 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 18/30] common: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 20/30] " Stephen Hemminger ` (10 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Sunil Uttarwar, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/crypto/ccp/ccp_crypto.c | 14 +++++--------- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c index 4b84b3303e..4a70bc5d6e 100644 --- a/drivers/crypto/ccp/ccp_crypto.c +++ b/drivers/crypto/ccp/ccp_crypto.c @@ -168,7 +168,7 @@ static int partial_hash_sha1(uint8_t *data_in, uint8_t *data_out) if (!SHA1_Init(&ctx)) return -EFAULT; SHA1_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); return 0; } @@ -179,8 +179,7 @@ static int partial_hash_sha224(uint8_t *data_in, uint8_t *data_out) if (!SHA224_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -191,8 +190,7 @@ static int partial_hash_sha256(uint8_t *data_in, uint8_t *data_out) if (!SHA256_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -203,8 +201,7 @@ static int partial_hash_sha384(uint8_t *data_in, uint8_t *data_out) if (!SHA384_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -215,8 +212,7 @@ static int partial_hash_sha512(uint8_t *data_in, uint8_t *data_out) if (!SHA512_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index 1dd1dbac9a..a67af3ec35 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -959,7 +959,7 @@ cnxk_crypto_cn10k_submit(void *qptr, void *inst, uint16_t nb_inst) lmt_dst = PLT_PTR_CAST(lmt_base); for (j = 0; j < i; j++) { - rte_memcpy(lmt_dst, inst, sizeof(struct cpt_inst_s)); + memcpy(lmt_dst, inst, sizeof(struct cpt_inst_s)); inst = RTE_PTR_ADD(inst, sizeof(struct cpt_inst_s)); lmt_dst = RTE_PTR_ADD(lmt_dst, 2 * sizeof(struct cpt_inst_s)); } diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index c211884dda..e6c1e1586b 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -1161,7 +1161,7 @@ cpt_sm_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_p void *dst = PLT_PTR_ADD(offset_vaddr, ROC_SE_OFF_CTRL_LEN); const uint64_t *src = fc_params->iv_buf; - rte_memcpy(dst, src, 16); + memcpy(dst, src, 16); } inst->w4.u64 = cpt_inst_w4.u64; } else { -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 20/30] crypto: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (18 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 19/30] crypto: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 21/30] event: " Stephen Hemminger ` (9 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Hemant Agrawal, Gagandeep Singh, Kai Ji, Pablo de Lara Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- drivers/crypto/qat/qat_sym_session.c | 52 +++++++++---------- .../scheduler/rte_cryptodev_scheduler.c | 6 +-- drivers/crypto/scheduler/scheduler_failover.c | 12 ++--- 5 files changed, 37 insertions(+), 39 deletions(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 44528eaf7f..3e7b78656b 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -676,7 +676,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) } cdb = &sess->cdb; - rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); + memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIB_SECURITY printf("\nsession protocol type = %d\n", sess->proto_alg); #endif diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c index a96779f059..f3f519f2d4 100644 --- a/drivers/crypto/ipsec_mb/pmd_snow3g.c +++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c @@ -291,8 +291,8 @@ process_snow3g_hash_op(struct ipsec_mb_qp *qp, struct rte_crypto_op **ops, /* Copy back digest from src to auth.digest.data */ if (digest_appended) - rte_memcpy(ops[i]->sym->auth.digest.data, - dst, SNOW3G_DIGEST_LENGTH); + memcpy(ops[i]->sym->auth.digest.data, dst, + SNOW3G_DIGEST_LENGTH); } processed_ops++; } diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 9e2dba5423..a93625b287 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -1439,7 +1439,7 @@ static int partial_hash_sha1(uint8_t *data_in, uint8_t *data_out) if (!SHA1_Init(&ctx)) return -EFAULT; SHA1_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); return 0; } @@ -1450,7 +1450,7 @@ static int partial_hash_sha224(uint8_t *data_in, uint8_t *data_out) if (!SHA224_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -1461,7 +1461,7 @@ static int partial_hash_sha256(uint8_t *data_in, uint8_t *data_out) if (!SHA256_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -1472,7 +1472,7 @@ static int partial_hash_sha384(uint8_t *data_in, uint8_t *data_out) if (!SHA384_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -1483,7 +1483,7 @@ static int partial_hash_sha512(uint8_t *data_in, uint8_t *data_out) if (!SHA512_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -1494,7 +1494,7 @@ static int partial_hash_md5(uint8_t *data_in, uint8_t *data_out) if (!MD5_Init(&ctx)) return -EFAULT; MD5_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, MD5_DIGEST_LENGTH); + memcpy(data_out, &ctx, MD5_DIGEST_LENGTH); return 0; } @@ -1615,8 +1615,7 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, return -ENOMEM; } - rte_memcpy(in, AES_CMAC_SEED, - ICP_QAT_HW_AES_128_KEY_SZ); + memcpy(in, AES_CMAC_SEED, ICP_QAT_HW_AES_128_KEY_SZ); rte_memcpy(p_state_buf, auth_key, auth_keylen); if (AES_set_encrypt_key(auth_key, auth_keylen << 3, @@ -1660,8 +1659,8 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, return -ENOMEM; } - rte_memcpy(in, qat_aes_xcbc_key_seed, - ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); + memcpy(in, qat_aes_xcbc_key_seed, + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); for (x = 0; x < HASH_XCBC_PRECOMP_KEY_NUM; x++) { if (AES_set_encrypt_key(auth_key, auth_keylen << 3, @@ -1924,8 +1923,8 @@ static int qat_sym_do_precomputes_ipsec_mb(enum icp_qat_hw_auth_algo hash_alg, uint8_t *input = in; uint8_t *out = p_state_buf; - rte_memcpy(input, qat_aes_xcbc_key_seed, - ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); + memcpy(input, qat_aes_xcbc_key_seed, + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); for (i = 0; i < HASH_XCBC_PRECOMP_KEY_NUM; i++) { if (aes_ipsecmb_job(input, out, m, auth_key, auth_keylen)) { memset(input - @@ -2441,8 +2440,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_auth_setup); switch (cdesc->qat_hash_alg) { case ICP_QAT_HW_AUTH_ALGO_SM3: - rte_memcpy(cdesc->cd_cur_ptr, sm3InitialState, - sizeof(sm3InitialState)); + memcpy(cdesc->cd_cur_ptr, sm3InitialState, + sizeof(sm3InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); state2_size = ICP_QAT_HW_SM3_STATE2_SZ; @@ -2453,9 +2452,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, hash_2->auth_config.config = ICP_QAT_HW_AUTH_CONFIG_BUILD(ICP_QAT_HW_AUTH_MODE2, cdesc->qat_hash_alg, digestsize); - rte_memcpy(cdesc->cd_cur_ptr + state1_size + state2_size + - sizeof(*hash_2), sm3InitialState, - sizeof(sm3InitialState)); + memcpy(cdesc->cd_cur_ptr + state1_size + state2_size + sizeof(*hash_2), + sm3InitialState, sizeof(sm3InitialState)); hash_cd_ctrl->inner_state1_sz = state1_size; hash_cd_ctrl->inner_state2_sz = state2_size; hash_cd_ctrl->inner_state2_offset = @@ -2493,8 +2491,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA1: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-1 */ - rte_memcpy(cdesc->cd_cur_ptr, sha1InitialState, - sizeof(sha1InitialState)); + memcpy(cdesc->cd_cur_ptr, sha1InitialState, + sizeof(sha1InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2520,8 +2518,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA224: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-224 */ - rte_memcpy(cdesc->cd_cur_ptr, sha224InitialState, - sizeof(sha224InitialState)); + memcpy(cdesc->cd_cur_ptr, sha224InitialState, + sizeof(sha224InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2545,8 +2543,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA256: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-256 */ - rte_memcpy(cdesc->cd_cur_ptr, sha256InitialState, - sizeof(sha256InitialState)); + memcpy(cdesc->cd_cur_ptr, sha256InitialState, + sizeof(sha256InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2570,8 +2568,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA384: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-384 */ - rte_memcpy(cdesc->cd_cur_ptr, sha384InitialState, - sizeof(sha384InitialState)); + memcpy(cdesc->cd_cur_ptr, sha384InitialState, + sizeof(sha384InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2595,8 +2593,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA512: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-512 */ - rte_memcpy(cdesc->cd_cur_ptr, sha512InitialState, - sizeof(sha512InitialState)); + memcpy(cdesc->cd_cur_ptr, sha512InitialState, + sizeof(sha512InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c index 9a21edd32a..ed1833a7c6 100644 --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c @@ -79,7 +79,7 @@ sync_caps(struct rte_cryptodev_capabilities *caps, /* remove a uncommon cap from the array */ for (j = i; j < sync_nb_caps - 1; j++) - rte_memcpy(&caps[j], &caps[j+1], sizeof(*cap)); + memcpy(&caps[j], &caps[j + 1], sizeof(*cap)); memset(&caps[sync_nb_caps - 1], 0, sizeof(*cap)); sync_nb_caps--; @@ -216,8 +216,8 @@ sync_sec_caps(uint32_t worker_idx, * caps, from the arrays */ for (j = i; j < nb_sec_caps - 1; j++) { - rte_memcpy(&sec_caps[j], &sec_caps[j+1], - sizeof(*sec_cap)); + memcpy(&sec_caps[j], &sec_caps[j + 1], + sizeof(*sec_cap)); rte_memcpy(&sec_crypto_caps[j][0], &sec_crypto_caps[j+1][0], diff --git a/drivers/crypto/scheduler/scheduler_failover.c b/drivers/crypto/scheduler/scheduler_failover.c index 52ff2ffbb7..e7c6d19d25 100644 --- a/drivers/crypto/scheduler/scheduler_failover.c +++ b/drivers/crypto/scheduler/scheduler_failover.c @@ -171,12 +171,12 @@ scheduler_start(struct rte_cryptodev *dev) sched_ctx->workers[PRIMARY_WORKER_IDX].qp_id = i; sched_ctx->workers[SECONDARY_WORKER_IDX].qp_id = i; - rte_memcpy(&qp_ctx->primary_worker, - &sched_ctx->workers[PRIMARY_WORKER_IDX], - sizeof(struct scheduler_worker)); - rte_memcpy(&qp_ctx->secondary_worker, - &sched_ctx->workers[SECONDARY_WORKER_IDX], - sizeof(struct scheduler_worker)); + memcpy(&qp_ctx->primary_worker, + &sched_ctx->workers[PRIMARY_WORKER_IDX], + sizeof(struct scheduler_worker)); + memcpy(&qp_ctx->secondary_worker, + &sched_ctx->workers[SECONDARY_WORKER_IDX], + sizeof(struct scheduler_worker)); } return 0; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 21/30] event: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (19 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 20/30] " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 22/30] mempool: " Stephen Hemminger ` (8 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Pavan Nikhilesh, Shijith Thotton, Abdullah Sevincer, Hemant Agrawal, Sachin Saxena, Jerin Jacob Automatically generated by devtools/cocci/rte_memcpy.cocci Also, remove unnecessary includes of rte_memcpy.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/event/cnxk/cnxk_eventdev_selftest.c | 1 - drivers/event/cnxk/cnxk_tim_evdev.c | 4 ++-- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dpaa/dpaa_eventdev.c | 1 - drivers/event/dpaa2/dpaa2_eventdev.c | 7 +++---- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 - drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - drivers/event/octeontx/timvf_evdev.c | 4 ++-- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c index 95c0f1b1f7..620f2a0d67 100644 --- a/drivers/event/cnxk/cnxk_eventdev_selftest.c +++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c @@ -13,7 +13,6 @@ #include <rte_lcore.h> #include <rte_malloc.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_test.h> diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c index 6d59fdf909..2027c4644c 100644 --- a/drivers/event/cnxk/cnxk_tim_evdev.c +++ b/drivers/event/cnxk/cnxk_tim_evdev.c @@ -115,8 +115,8 @@ cnxk_tim_ring_info_get(const struct rte_event_timer_adapter *adptr, adptr_info->min_resolution_ns = tim_ring->ena_periodic ? tim_ring->max_tout : tim_ring->tck_nsec; - rte_memcpy(&adptr_info->conf, &adptr->data->conf, - sizeof(struct rte_event_timer_adapter_conf)); + memcpy(&adptr_info->conf, &adptr->data->conf, + sizeof(struct rte_event_timer_adapter_conf)); } static int diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 628ddef649..e38b11f397 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -1668,7 +1668,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->issued_releases = 0; /* Save config message too. */ - rte_memcpy(&qm_port->cfg.ldb, &cfg, sizeof(qm_port->cfg.ldb)); + memcpy(&qm_port->cfg.ldb, &cfg, sizeof(qm_port->cfg.ldb)); /* update state */ qm_port->state = PORT_STARTED; /* enabled at create time */ @@ -1869,7 +1869,7 @@ dlb2_hw_create_dir_port(struct dlb2_eventdev *dlb2, qm_port->issued_releases = 0; /* Save config message too. */ - rte_memcpy(&qm_port->cfg.dir, &cfg, sizeof(qm_port->cfg.dir)); + memcpy(&qm_port->cfg.dir, &cfg, sizeof(qm_port->cfg.dir)); /* update state */ qm_port->state = PORT_STARTED; /* enabled at create time */ diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 919e922298..0d72fa7864 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -19,7 +19,6 @@ #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_memzone.h> #include <rte_pci.h> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 1273455673..490598cbc9 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -20,7 +20,6 @@ #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_pci.h> #include <bus_vdev_driver.h> @@ -159,7 +158,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[], "Unable to allocate event object"); goto send_partial; } - rte_memcpy(ev_temp, event, sizeof(struct rte_event)); + memcpy(ev_temp, event, sizeof(struct rte_event)); DPAA2_SET_FD_ADDR((&fd_arr[loop]), (size_t)ev_temp); DPAA2_SET_FD_LEN((&fd_arr[loop]), sizeof(struct rte_event)); @@ -230,7 +229,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp, RTE_SET_USED(rxq); - rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + memcpy(ev, ev_temp, sizeof(struct rte_event)); rte_free(ev_temp); qbman_swp_dqrr_consume(swp, dq); @@ -249,7 +248,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, RTE_SET_USED(swp); RTE_SET_USED(rxq); - rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + memcpy(ev, ev_temp, sizeof(struct rte_event)); rte_free(ev_temp); *dpaa2_seqn(ev->mbuf) = dqrr_index + 1; DPAA2_PER_LCORE_DQRR_SIZE++; diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c index 9d4938efe6..8a9a14f628 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c @@ -12,7 +12,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_lcore.h> #include <rte_per_lcore.h> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c index a68d3ac154..e07b473413 100644 --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c @@ -13,7 +13,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index b54ae126d2..c0a0c789de 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -14,7 +14,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_lcore.h> #include <rte_per_lcore.h> diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index 090b3ed183..6409d6d161 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -42,8 +42,8 @@ timvf_ring_info_get(const struct rte_event_timer_adapter *adptr, struct timvf_ring *timr = adptr->data->adapter_priv; adptr_info->max_tmo_ns = timr->max_tout; adptr_info->min_resolution_ns = timr->tck_nsec; - rte_memcpy(&adptr_info->conf, &adptr->data->conf, - sizeof(struct rte_event_timer_adapter_conf)); + memcpy(&adptr_info->conf, &adptr->data->conf, + sizeof(struct rte_event_timer_adapter_conf)); } static int -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 22/30] mempool: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (20 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 21/30] event: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 23/30] ml/cnxk: " Stephen Hemminger ` (7 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/mempool/dpaa/dpaa_mempool.c | 4 ++-- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 0b484b3d9c..f72b51b472 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -115,8 +115,8 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) return -ENOMEM; } - rte_memcpy(bp_info, (void *)&rte_dpaa_bpid_info[bpid], - sizeof(struct dpaa_bp_info)); + memcpy(bp_info, (void *)&rte_dpaa_bpid_info[bpid], + sizeof(struct dpaa_bp_info)); mp->pool_data = (void *)bp_info; DPAA_MEMPOOL_INFO("BMAN pool created for bpid =%d", bpid); diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 4c9245cb81..c711de30e8 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -16,7 +16,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> @@ -125,8 +124,8 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa2_bpid_info[bpid].bp_list = bp_list; rte_dpaa2_bpid_info[bpid].bpid = bpid; - rte_memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], - sizeof(struct dpaa2_bp_info)); + memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], + sizeof(struct dpaa2_bp_info)); mp->pool_data = (void *)bp_info; DPAA2_MEMPOOL_DEBUG("BP List created for bpid =%d", dpbp_attr.bpid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 23/30] ml/cnxk: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (21 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 22/30] mempool: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 24/30] app/test-pmd: " Stephen Hemminger ` (6 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Srikanth Yalavarthi Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/ml/cnxk/cn10k_ml_model.c | 8 +++++--- drivers/ml/cnxk/cn10k_ml_ops.c | 11 +++++++---- drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- drivers/ml/cnxk/mvtvm_ml_model.c | 8 +++++--- drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/ml/cnxk/cn10k_ml_model.c b/drivers/ml/cnxk/cn10k_ml_model.c index 0325cd54f1..4e39a584fa 100644 --- a/drivers/ml/cnxk/cn10k_ml_model.c +++ b/drivers/ml/cnxk/cn10k_ml_model.c @@ -560,7 +560,7 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set model info */ memset(info, 0, sizeof(struct rte_ml_model_info)); - rte_memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -579,7 +579,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, io_info->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, io_info->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = io_info->input[i].nb_dims; input[i].shape = &io_info->input[i].shape[0]; input[i].type = io_info->input[i].qtype; @@ -590,7 +591,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, io_info->output[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(output[i].name, io_info->output[i].name, + MRVL_ML_INPUT_NAME_LEN); output[i].nb_dims = io_info->output[i].nb_dims; output[i].shape = &io_info->output[i].shape[0]; output[i].type = io_info->output[i].qtype; diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c index 834e55e88e..e53ada7b1c 100644 --- a/drivers/ml/cnxk/cn10k_ml_ops.c +++ b/drivers/ml/cnxk/cn10k_ml_ops.c @@ -668,11 +668,13 @@ cn10k_ml_layer_load(void *device, uint16_t model_id, const char *layer_name, uin } /* Copy metadata to internal buffer */ - rte_memcpy(&layer->glow.metadata, buffer, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&layer->glow.metadata, buffer, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&layer->glow.metadata); /* Set layer name */ - rte_memcpy(layer->name, layer->glow.metadata.model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(layer->name, layer->glow.metadata.model.name, + MRVL_ML_MODEL_NAME_LEN); /* Enable support for batch_size of 256 */ if (layer->glow.metadata.model.batch_size == 0) @@ -748,11 +750,12 @@ cn10k_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * model->subtype = ML_CNXK_MODEL_SUBTYPE_GLOW_MRVL; /* Copy metadata to internal buffer */ - rte_memcpy(&model->glow.metadata, params->addr, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&model->glow.metadata, params->addr, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&model->glow.metadata); /* Set model name */ - rte_memcpy(model->name, (char *)model->glow.metadata.model.name, 64); + memcpy(model->name, (char *)model->glow.metadata.model.name, 64); /* Enable support for batch_size of 256 */ if (model->glow.metadata.model.batch_size == 0) diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c index 971362b242..f9d0f50e1f 100644 --- a/drivers/ml/cnxk/cnxk_ml_ops.c +++ b/drivers/ml/cnxk/cnxk_ml_ops.c @@ -1400,7 +1400,7 @@ cnxk_ml_model_info_get(struct rte_ml_dev *dev, uint16_t model_id, } info = (struct rte_ml_model_info *)model->info; - rte_memcpy(model_info, info, sizeof(struct rte_ml_model_info)); + memcpy(model_info, info, sizeof(struct rte_ml_model_info)); model_info->input_info = info->input_info; model_info->output_info = info->output_info; diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c index e3234ae442..99b4774a2e 100644 --- a/drivers/ml/cnxk/mvtvm_ml_model.c +++ b/drivers/ml/cnxk/mvtvm_ml_model.c @@ -310,7 +310,7 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo goto tvm_mrvl_model; metadata = &model->mvtvm.metadata; - rte_memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); + memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -327,7 +327,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, metadata->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, metadata->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = metadata->input[i].ndim; input[i].shape = &model->mvtvm.info.input[i].shape[0]; input[i].type = model->mvtvm.info.input[i].qtype; @@ -338,7 +339,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, metadata->output[i].name, MRVL_ML_OUTPUT_NAME_LEN); + memcpy(output[i].name, metadata->output[i].name, + MRVL_ML_OUTPUT_NAME_LEN); output[i].nb_dims = metadata->output[i].ndim; output[i].shape = &model->mvtvm.info.output[i].shape[0]; output[i].type = model->mvtvm.info.output[i].qtype; diff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c index e825c3fb23..fca7e0c3c0 100644 --- a/drivers/ml/cnxk/mvtvm_ml_ops.c +++ b/drivers/ml/cnxk/mvtvm_ml_ops.c @@ -194,7 +194,7 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * /* Copy mod.so */ model->mvtvm.object.so.addr = mz->addr; model->mvtvm.object.so.size = object[0].size; - rte_memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.so.addr, object[0].buffer, object[0].size); rte_free(object[0].buffer); @@ -203,7 +203,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.so.addr, RTE_ALIGN_CEIL(model->mvtvm.object.so.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.json.size = object[1].size; - rte_memcpy(model->mvtvm.object.json.name, object[1].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.json.name, object[1].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.json.addr, object[1].buffer, object[1].size); rte_free(object[1].buffer); @@ -212,7 +213,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.json.addr, RTE_ALIGN_CEIL(model->mvtvm.object.json.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.params.size = object[2].size; - rte_memcpy(model->mvtvm.object.params.name, object[2].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.params.name, object[2].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.params.addr, object[2].buffer, object[2].size); rte_free(object[2].buffer); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 24/30] app/test-pmd: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (22 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 23/30] ml/cnxk: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 25/30] app/graph: " Stephen Hemminger ` (5 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Aman Singh, Yuying Zhang, Ori Kam Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-pmd/cmdline.c | 48 ++++++++++++++++++------------------- app/test-pmd/cmdline_flow.c | 24 +++++++++---------- app/test-pmd/config.c | 8 +++---- app/test-pmd/csumonly.c | 1 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/noisy_vnf.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/testpmd.c | 1 - 11 files changed, 40 insertions(+), 48 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b7759e38a8..5e0740348a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -9534,7 +9534,7 @@ static void cmd_set_vxlan_parsed(void *parsed_result, vxlan_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(vxlan_encap_conf.vni, &id.vni[1], 3); + memcpy(vxlan_encap_conf.vni, &id.vni[1], 3); vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); vxlan_encap_conf.ip_tos = res->tos; @@ -9548,10 +9548,10 @@ static void cmd_set_vxlan_parsed(void *parsed_result, } if (vxlan_encap_conf.select_vlan) vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_vxlan = { @@ -9729,7 +9729,7 @@ static void cmd_set_nvgre_parsed(void *parsed_result, nvgre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(nvgre_encap_conf.tni, &id.tni[1], 3); + memcpy(nvgre_encap_conf.tni, &id.tni[1], 3); if (nvgre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, nvgre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, nvgre_encap_conf.ipv4_dst); @@ -9739,10 +9739,10 @@ static void cmd_set_nvgre_parsed(void *parsed_result, } if (nvgre_encap_conf.select_vlan) nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_nvgre = { @@ -9856,10 +9856,10 @@ static void cmd_set_l2_encap_parsed(void *parsed_result, return; if (l2_encap_conf.select_vlan) l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_l2_encap = { @@ -10038,7 +10038,7 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, mplsogre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsogre_encap_conf.label, &id.label, 3); + memcpy(mplsogre_encap_conf.label, &id.label, 3); if (mplsogre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst); @@ -10048,10 +10048,10 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, } if (mplsogre_encap_conf.select_vlan) mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_mplsogre_encap = { @@ -10274,7 +10274,7 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, mplsoudp_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3); + memcpy(mplsoudp_encap_conf.label, &id.label, 3); mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); if (mplsoudp_encap_conf.select_ipv4) { @@ -10286,10 +10286,10 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, } if (mplsoudp_encap_conf.select_vlan) mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_mplsoudp_encap = { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 60ee9337cf..95d9133ecb 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -13768,7 +13768,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in) fprintf(stderr, "Error - Not supported action\n"); return; } - rte_memcpy(data, action, sizeof(struct rte_flow_action)); + memcpy(data, action, sizeof(struct rte_flow_action)); data++; } } @@ -13929,8 +13929,8 @@ cmd_set_raw_parsed(const struct buffer *in) /* We have to add GTP header extra word. */ *total_size += sizeof(ext_word); - rte_memcpy(data_tail - (*total_size), - &ext_word, sizeof(ext_word)); + memcpy(data_tail - (*total_size), &ext_word, + sizeof(ext_word)); } size = sizeof(struct rte_gtp_hdr); break; @@ -13975,21 +13975,21 @@ cmd_set_raw_parsed(const struct buffer *in) if (opt->checksum_rsvd.checksum) { *total_size += sizeof(opt->checksum_rsvd); - rte_memcpy(data_tail - (*total_size), - &opt->checksum_rsvd, - sizeof(opt->checksum_rsvd)); + memcpy(data_tail - (*total_size), + &opt->checksum_rsvd, + sizeof(opt->checksum_rsvd)); } if (opt->key.key) { *total_size += sizeof(opt->key.key); - rte_memcpy(data_tail - (*total_size), - &opt->key.key, - sizeof(opt->key.key)); + memcpy(data_tail - (*total_size), + &opt->key.key, + sizeof(opt->key.key)); } if (opt->sequence.sequence) { *total_size += sizeof(opt->sequence.sequence); - rte_memcpy(data_tail - (*total_size), - &opt->sequence.sequence, - sizeof(opt->sequence.sequence)); + memcpy(data_tail - (*total_size), + &opt->sequence.sequence, + sizeof(opt->sequence.sequence)); } } proto = 0x2F; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ba1007ace6..8b201f2104 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2639,8 +2639,8 @@ port_flow_template_table_create(portid_t port_id, uint32_t id, } pt->nb_pattern_templates = nb_pattern_templates; pt->nb_actions_templates = nb_actions_templates; - rte_memcpy(&pt->flow_attr, &table_attr->flow_attr, - sizeof(struct rte_flow_attr)); + memcpy(&pt->flow_attr, &table_attr->flow_attr, + sizeof(struct rte_flow_attr)); printf("Template table #%u created\n", pt->id); return 0; } @@ -3259,8 +3259,8 @@ port_queue_action_handle_update(portid_t port_id, update = action->conf; break; case RTE_FLOW_ACTION_TYPE_METER_MARK: - rte_memcpy(&mtr_update.meter_mark, action->conf, - sizeof(struct rte_flow_action_meter_mark)); + memcpy(&mtr_update.meter_mark, action->conf, + sizeof(struct rte_flow_action_meter_mark)); if (mtr_update.meter_mark.profile) mtr_update.profile_valid = 1; if (mtr_update.meter_mark.policy) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 6711dda42e..0db26902a1 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 53b5f24f11..d9454a4d22 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c index ba06fae4a6..c9727d2856 100644 --- a/app/test-pmd/iofwd.c +++ b/app/test-pmd/iofwd.c @@ -24,7 +24,6 @@ #include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_branch_prediction.h> -#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h> diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index d19ace7395..ba63aedd79 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 57f77003fe..e1f9be4901 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index 81d1187cfe..cf951e9532 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -24,7 +24,6 @@ #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_lcore.h> -#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_ethdev.h> diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index 315f9286cd..cc73cf4ebf 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 70ea257fda..9dd3ffa850 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -30,7 +30,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_bus.h> #include <rte_eal.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 25/30] app/graph: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (23 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 24/30] app/test-pmd: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 26/30] app/test-eventdev: " Stephen Hemminger ` (4 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Sunil Kumar Kori, Rakesh Kudurumalla Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/graph/neigh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/graph/neigh.c b/app/graph/neigh.c index 79fd542c89..77f0766133 100644 --- a/app/graph/neigh.c +++ b/app/graph/neigh.c @@ -91,14 +91,14 @@ ip6_rewrite_node_add(struct neigh_ipv6_config *v6_config) memset(data, 0, len); /* Copy dst mac */ - rte_memcpy((void *)&data[0], (void *)&v6_config->mac, RTE_ETHER_ADDR_LEN); + memcpy((void *)&data[0], (void *)&v6_config->mac, RTE_ETHER_ADDR_LEN); /* Copy src mac */ rc = rte_eth_macaddr_get(portid, &smac); if (rc < 0) return rc; - rte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); return rte_node_ip6_rewrite_add(portid, data, len, portid); } @@ -121,7 +121,7 @@ ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config) memset(data, 0, len); /* Copy dst mac */ - rte_memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN); + memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN); /* Copy src mac */ rc = rte_eth_macaddr_get(portid, &smac); @@ -130,7 +130,7 @@ ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config) return rc; } - rte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); return rte_node_ip4_rewrite_add(portid, data, len, portid); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 26/30] app/test-eventdev: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (24 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 25/30] app/graph: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 27/30] app/test: " Stephen Hemminger ` (3 subsequent siblings) 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Jerin Jacob Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-eventdev/test_pipeline_common.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index b111690b7c..49bfd0c363 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -177,22 +177,17 @@ pipeline_tx_first(struct test_pipeline *t, struct evt_options *opt) mbuf->pkt_len = pkt_sz; /* Copy Ethernet header */ - rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), - ð_hdr, sizeof(struct rte_ether_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), + ð_hdr, sizeof(struct rte_ether_hdr)); /* Copy Ipv4 header */ - rte_memcpy(rte_pktmbuf_mtod_offset( - mbuf, char *, - sizeof(struct rte_ether_hdr)), - &ip_hdr, sizeof(struct rte_ipv4_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, sizeof(struct rte_ether_hdr)), + &ip_hdr, sizeof(struct rte_ipv4_hdr)); /* Copy UDP header */ - rte_memcpy( - rte_pktmbuf_mtod_offset( - mbuf, char *, - sizeof(struct rte_ipv4_hdr) + - sizeof(struct rte_ether_hdr)), - &udp_hdr, sizeof(struct rte_udp_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_ether_hdr)), + &udp_hdr, sizeof(struct rte_udp_hdr)); pkt_udp_hdr = rte_pktmbuf_mtod_offset( mbuf, struct rte_udp_hdr *, sizeof(struct rte_ipv4_hdr) + -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 27/30] app/test: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (25 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 26/30] app/test-eventdev: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-10 18:28 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 28/30] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger ` (2 subsequent siblings) 29 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Jasvinder Singh, Akhil Goyal, Fan Zhang, Byron Marohn, Yipeng Wang, Abhinandan Gujjar, Amit Prakash Shukla, Jerin Jacob, Konstantin Ananyev, Vladimir Medvedkin, Chas Williams, Min Hu (Connor), Sameh Gobriel, Sachin Saxena, Hemant Agrawal, Anoob Joseph, Harry van Haaren Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 4 +-- app/test/test_crc.c | 5 ++-- app/test/test_cryptodev.c | 18 ++++++------- app/test/test_cryptodev_asym.c | 1 - app/test/test_cryptodev_security_pdcp.c | 1 - app/test/test_efd.c | 1 - app/test/test_efd_perf.c | 1 - app/test/test_event_crypto_adapter.c | 12 ++++----- app/test/test_event_dma_adapter.c | 4 +-- app/test/test_eventdev.c | 1 - app/test/test_ipsec.c | 6 ++--- app/test/test_link_bonding_mode4.c | 8 +++--- app/test/test_mbuf.c | 1 - app/test/test_member.c | 1 - app/test/test_member_perf.c | 1 - app/test/test_rawdev.c | 1 - app/test/test_security_inline_proto.c | 36 ++++++++++++------------- app/test/test_service_cores.c | 1 - app/test/virtual_pmd.c | 3 +-- 20 files changed, 46 insertions(+), 61 deletions(-) diff --git a/app/test/commands.c b/app/test/commands.c index 497d8e9952..74494a0ef4 100644 --- a/app/test/commands.c +++ b/app/test/commands.c @@ -16,7 +16,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 867a88da00..fcca2d238e 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -148,8 +148,8 @@ initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, ip_hdr->proto = IPPROTO_UDP; ip_hdr->hop_limits = IP_DEFTTL; - rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); - rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); + memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); + memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } diff --git a/app/test/test_crc.c b/app/test/test_crc.c index b85fca35fe..30fe004506 100644 --- a/app/test/test_crc.c +++ b/app/test/test_crc.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_net_crc.h> #define CRC_VEC_LEN 32 @@ -83,7 +82,7 @@ test_crc_calc(void) return -7; for (i = 0; i < CRC32_VEC_LEN1; i += 12) - rte_memcpy(&test_data[i], crc32_vec1, 12); + memcpy(&test_data[i], crc32_vec1, 12); result = crc_calc(test_data, CRC32_VEC_LEN1, type); if (result != crc32_vec1_res) { @@ -93,7 +92,7 @@ test_crc_calc(void) /* 32-bit ethernet CRC: Test 3 */ for (i = 0; i < CRC32_VEC_LEN2; i += 12) - rte_memcpy(&test_data[i], crc32_vec1, 12); + memcpy(&test_data[i], crc32_vec1, 12); result = crc_calc(test_data, CRC32_VEC_LEN2, type); if (result != crc32_vec2_res) { diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1703ebccf1..97651cdb6c 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2479,8 +2479,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) sym_op->auth.data.length = QUOTE_512_BYTES; /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), - aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), + aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); /* Set crypto operation cipher parameters */ sym_op->cipher.data.offset = 0; @@ -2614,9 +2614,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess, DIGEST_BYTE_LENGTH_SHA512); TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - rte_memcpy(ut_params->digest, - digest, - DIGEST_BYTE_LENGTH_SHA512); + memcpy(ut_params->digest, digest, DIGEST_BYTE_LENGTH_SHA512); /* Generate Crypto op data structure */ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, @@ -2639,8 +2637,8 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess, sym_op->auth.data.length = QUOTE_512_BYTES; /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), - iv, CIPHER_IV_LENGTH_AES_CBC); + memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), + iv, CIPHER_IV_LENGTH_AES_CBC); sym_op->cipher.data.offset = 0; sym_op->cipher.data.length = QUOTE_512_BYTES; @@ -8997,7 +8995,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, uint8_t *, IV_OFFSET); if (tdata->iv.len == 0) { - rte_memcpy(iv_ptr, tdata->iv.data, AES_GCM_J0_LENGTH); + memcpy(iv_ptr, tdata->iv.data, AES_GCM_J0_LENGTH); debug_hexdump(stdout, "iv:", iv_ptr, AES_GCM_J0_LENGTH); } else { @@ -14337,8 +14335,8 @@ test_multi_session_random_usage(void) for (i = 0; i < MB_SESSION_NUMBER; i++) { - rte_memcpy(&ut_paramz[i].ut_params, &unittest_params, - sizeof(struct crypto_unittest_params)); + memcpy(&ut_paramz[i].ut_params, &unittest_params, + sizeof(struct crypto_unittest_params)); test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( &ut_paramz[i].ut_params, diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 17daf734e8..88561a8f25 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -8,7 +8,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_cryptodev.h> diff --git a/app/test/test_cryptodev_security_pdcp.c b/app/test/test_cryptodev_security_pdcp.c index a7641bab7a..39926cbee3 100644 --- a/app/test/test_cryptodev_security_pdcp.c +++ b/app/test/test_cryptodev_security_pdcp.c @@ -10,7 +10,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_bus_vdev.h> #include <rte_byteorder.h> diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 1c0986b9bc..306f851c52 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -13,7 +13,6 @@ test_efd(void) #else -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_efd.h> #include <rte_byteorder.h> diff --git a/app/test/test_efd_perf.c b/app/test/test_efd_perf.c index b212e96767..7f5a8b9a56 100644 --- a/app/test/test_efd_perf.c +++ b/app/test/test_efd_perf.c @@ -22,7 +22,6 @@ test_efd_perf(void) #include <rte_malloc.h> #include <rte_random.h> #include <rte_efd.h> -#include <rte_memcpy.h> #include <rte_thash.h> #define NUM_KEYSIZES 10 diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 0c56744ba0..4992c5bc50 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -454,7 +454,7 @@ test_op_forward_mode(uint8_t session_less) m_data.request_info.cdev_id = request_info.cdev_id; m_data.request_info.queue_pair_id = request_info.queue_pair_id; m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); } sym_op->m_src = m; @@ -653,8 +653,8 @@ test_asym_op_forward_mode(uint8_t session_less) m_data.request_info.cdev_id = request_info.cdev_id; m_data.request_info.queue_pair_id = request_info.queue_pair_id; m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + op->private_data_offset, - &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + op->private_data_offset, &m_data, + sizeof(m_data)); } /* Fill in event info and update event_ptr with rte_crypto_op */ memset(&ev, 0, sizeof(ev)); @@ -820,7 +820,7 @@ test_op_new_mode(uint8_t session_less) op->private_data_offset = len; /* Fill in private data information */ m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); } sym_op->m_src = m; @@ -977,8 +977,8 @@ test_asym_op_new_mode(uint8_t session_less) sizeof(struct rte_crypto_asym_xform)); /* Fill in private data information */ m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + op->private_data_offset, - &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + op->private_data_offset, &m_data, + sizeof(m_data)); } ret = send_op_recv_ev(op); diff --git a/app/test/test_event_dma_adapter.c b/app/test/test_event_dma_adapter.c index 35b417b69f..af2e44a703 100644 --- a/app/test/test_event_dma_adapter.c +++ b/app/test/test_event_dma_adapter.c @@ -269,8 +269,8 @@ test_op_forward_mode(void) op->vchan = TEST_DMA_VCHAN_ID; response_info.event = dma_response_info.event; - rte_memcpy((uint8_t *)op + sizeof(struct rte_event_dma_adapter_op), &response_info, - sizeof(struct rte_event)); + memcpy((uint8_t *)op + sizeof(struct rte_event_dma_adapter_op), + &response_info, sizeof(struct rte_event)); /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ memset(&ev[i], 0, sizeof(struct rte_event)); diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c index e4e234dc98..d2ae9b4930 100644 --- a/app/test/test_eventdev.c +++ b/app/test/test_eventdev.c @@ -8,7 +8,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #ifdef RTE_EXEC_ENV_WINDOWS static int diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 6cb1bac1e7..25aabdb616 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -601,10 +601,10 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, /* copy outer IP and ESP header */ ipv4_outer.total_length = rte_cpu_to_be_16(t_len); ipv4_outer.packet_id = rte_cpu_to_be_16(seq); - rte_memcpy(dst, &ipv4_outer, sizeof(ipv4_outer)); + memcpy(dst, &ipv4_outer, sizeof(ipv4_outer)); dst += sizeof(ipv4_outer); m->l3_len = sizeof(ipv4_outer); - rte_memcpy(dst, &esph, sizeof(esph)); + memcpy(dst, &esph, sizeof(esph)); dst += sizeof(esph); if (string != NULL) { @@ -616,7 +616,7 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, sizeof(esp_pad_bytes))); dst += padlen; /* copy ESP tail header */ - rte_memcpy(dst, &espt, sizeof(espt)); + memcpy(dst, &espt, sizeof(espt)); } else memset(dst, 0, t_len); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index ff13dbed93..e4827c1e80 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -1399,8 +1399,8 @@ test_mode4_ext_ctrl(void) for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); - rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), - &lacpdu, sizeof(lacpdu)); + memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, + sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } @@ -1453,8 +1453,8 @@ test_mode4_ext_lacp(void) for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); - rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), - &lacpdu, sizeof(lacpdu)); + memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, + sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 17be977f31..e1fa5b0f7f 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test/test_member.c b/app/test/test_member.c index 5a4d2750db..7281a644bd 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -7,7 +7,6 @@ #include <math.h> #include "test.h" -#include <rte_memcpy.h> #include <rte_malloc.h> #ifdef RTE_EXEC_ENV_WINDOWS diff --git a/app/test/test_member_perf.c b/app/test/test_member_perf.c index db6b8a18ef..f40fdba91e 100644 --- a/app/test/test_member_perf.c +++ b/app/test/test_member_perf.c @@ -11,7 +11,6 @@ #include <rte_cycles.h> #include <rte_malloc.h> #include <rte_random.h> -#include <rte_memcpy.h> #include <rte_thash.h> #include <math.h> diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c index d34691dacf..120e61dcc2 100644 --- a/app/test/test_rawdev.c +++ b/app/test/test_rawdev.c @@ -7,7 +7,6 @@ #include <rte_common.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_dev.h> #ifdef RTE_EXEC_ENV_WINDOWS diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index 10f7e58caa..03eaf29305 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -245,8 +245,8 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, /* Copy cipher session parameters */ if (sa->aead) { - rte_memcpy(sess_conf->crypto_xform, &sa->xform.aead, - sizeof(struct rte_crypto_sym_xform)); + memcpy(sess_conf->crypto_xform, &sa->xform.aead, + sizeof(struct rte_crypto_sym_xform)); sess_conf->crypto_xform->aead.key.data = sa->key.data; /* Verify crypto capabilities */ if (test_sec_crypto_caps_aead_verify(sec_cap, sess_conf->crypto_xform) != 0) { @@ -256,13 +256,13 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, } } else { if (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) { - rte_memcpy(&sess_conf->crypto_xform->cipher, - &sa->xform.chain.cipher.cipher, - sizeof(struct rte_crypto_cipher_xform)); + memcpy(&sess_conf->crypto_xform->cipher, + &sa->xform.chain.cipher.cipher, + sizeof(struct rte_crypto_cipher_xform)); - rte_memcpy(&sess_conf->crypto_xform->next->auth, - &sa->xform.chain.auth.auth, - sizeof(struct rte_crypto_auth_xform)); + memcpy(&sess_conf->crypto_xform->next->auth, + &sa->xform.chain.auth.auth, + sizeof(struct rte_crypto_auth_xform)); sess_conf->crypto_xform->cipher.key.data = sa->key.data; sess_conf->crypto_xform->next->auth.key.data = @@ -282,12 +282,12 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, return TEST_SKIPPED; } } else { - rte_memcpy(&sess_conf->crypto_xform->next->cipher, - &sa->xform.chain.cipher.cipher, - sizeof(struct rte_crypto_cipher_xform)); - rte_memcpy(&sess_conf->crypto_xform->auth, - &sa->xform.chain.auth.auth, - sizeof(struct rte_crypto_auth_xform)); + memcpy(&sess_conf->crypto_xform->next->cipher, + &sa->xform.chain.cipher.cipher, + sizeof(struct rte_crypto_cipher_xform)); + memcpy(&sess_conf->crypto_xform->auth, + &sa->xform.chain.auth.auth, + sizeof(struct rte_crypto_auth_xform)); sess_conf->crypto_xform->auth.key.data = sa->auth_key.data; sess_conf->crypto_xform->next->cipher.key.data = @@ -463,12 +463,12 @@ init_packet(struct rte_mempool *mp, const uint8_t *data, unsigned int len, bool return NULL; if (outer_ipv4) { - rte_memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), - &dummy_ipv4_eth_hdr, RTE_ETHER_HDR_LEN); + memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), + &dummy_ipv4_eth_hdr, RTE_ETHER_HDR_LEN); pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { - rte_memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), - &dummy_ipv6_eth_hdr, RTE_ETHER_HDR_LEN); + memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), + &dummy_ipv6_eth_hdr, RTE_ETHER_HDR_LEN); pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkt->l2_len = RTE_ETHER_HDR_LEN; diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index c12d52d8f1..fb08821b87 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_cycles.h> #include <rte_service.h> diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index b7d74a467a..ae48923df7 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -8,7 +8,6 @@ #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_ring.h> @@ -186,7 +185,7 @@ virtual_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct virtual_ethdev_private *dev_private = dev->data->dev_private; if (stats) - rte_memcpy(stats, &dev_private->eth_stats, sizeof(*stats)); + memcpy(stats, &dev_private->eth_stats, sizeof(*stats)); return 0; } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [EXTERNAL] [PATCH v4 27/30] app/test: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 27/30] app/test: " Stephen Hemminger @ 2024-04-10 18:28 ` Akhil Goyal 0 siblings, 0 replies; 88+ messages in thread From: Akhil Goyal @ 2024-04-10 18:28 UTC (permalink / raw) To: Stephen Hemminger, dev Cc: Jasvinder Singh, Fan Zhang, Byron Marohn, Yipeng Wang, Abhinandan Gujjar, Amit Prakash Shukla, Jerin Jacob, Konstantin Ananyev, Vladimir Medvedkin, Chas Williams, Min Hu (Connor), Sameh Gobriel, Sachin Saxena, Hemant Agrawal, Anoob Joseph, Harry van Haaren > Automatically generated by devtools/cocci/rte_memcpy.cocci > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > app/test/commands.c | 1 - > app/test/packet_burst_generator.c | 4 +-- > app/test/test_crc.c | 5 ++-- > app/test/test_cryptodev.c | 18 ++++++------- > app/test/test_cryptodev_asym.c | 1 - > app/test/test_cryptodev_security_pdcp.c | 1 - > app/test/test_ipsec.c | 6 ++--- > app/test/test_security_inline_proto.c | 36 ++++++++++++------------- For above changes Acked-by: Akhil Goyal <gakhil@marvell.com> ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 28/30] app/test-pipeline: remove unused rte_memcpy.h include 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (26 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 27/30] app/test: " Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 29/30] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 30/30] examples: replace use of fixed size rte_memcpy Stephen Hemminger 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu This included but never used here. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - 4 files changed, 4 deletions(-) diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c index daf838948b..f4d5d435ad 100644 --- a/app/test-pipeline/config.c +++ b/app/test-pipeline/config.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 558f0e428d..8028192306 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c index 4cc098d7ac..ca0bc9d9d1 100644 --- a/app/test-pipeline/main.c +++ b/app/test-pipeline/main.c @@ -19,7 +19,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/runtime.c b/app/test-pipeline/runtime.c index 752f783370..a6457488c0 100644 --- a/app/test-pipeline/runtime.c +++ b/app/test-pipeline/runtime.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 29/30] app/test-bbdev: remove unnecessary include of rte_memcpy.h 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (27 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 28/30] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 30/30] examples: replace use of fixed size rte_memcpy Stephen Hemminger 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nicolas Chautru Includes rte_memcpy.h but no rte_memcpy used. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-bbdev/test_bbdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c index cf224dca5d..7309d85bc5 100644 --- a/app/test-bbdev/test_bbdev.c +++ b/app/test-bbdev/test_bbdev.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_cycles.h> #include <rte_bus_vdev.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 30/30] examples: replace use of fixed size rte_memcpy 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger ` (28 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 29/30] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger @ 2024-04-05 16:53 ` Stephen Hemminger 29 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-05 16:53 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Nicolas Chautru, Chas Williams, Min Hu (Connor), Konstantin Ananyev, Tomasz Kantecki, Akhil Goyal, Bruce Richardson, Anatoly Burakov, David Hunt, Sivaprasad Tummala, Kirill Rybalchenko, Cristian Dumitrescu, Byron Marohn, Yipeng Wang, Maxime Coquelin, Chenbo Xia Automatically generated by devtools/cocci/rte_memcpy.cocci Use structure assignment where possible. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 1 - examples/ip_fragmentation/main.c | 1 - examples/ip_reassembly/main.c | 1 - examples/ipv4_multicast/main.c | 1 - examples/l2fwd-cat/cat.c | 4 +--- examples/l2fwd-jobstats/main.c | 1 - examples/l2fwd-keepalive/main.c | 1 - examples/l2fwd-macsec/main.c | 1 - examples/l2fwd/main.c | 1 - examples/l3fwd-power/main.c | 1 - examples/l3fwd/main.c | 1 - examples/link_status_interrupt/main.c | 1 - .../client_server_mp/mp_server/init.c | 1 - .../client_server_mp/mp_server/main.c | 1 - examples/multi_process/symmetric_mp/main.c | 1 - examples/ptpclient/ptpclient.c | 11 +++++------ examples/qos_sched/app_thread.c | 1 - examples/qos_sched/main.c | 1 - examples/server_node_efd/efd_server/init.c | 1 - examples/server_node_efd/efd_server/main.c | 1 - examples/vhost/main.c | 6 +++--- examples/vmdq/main.c | 7 +++---- examples/vmdq_dcb/main.c | 15 +++++---------- 24 files changed, 18 insertions(+), 45 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 16599ae9ce..52c8eabba7 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -359,7 +359,7 @@ add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); + memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void diff --git a/examples/bond/main.c b/examples/bond/main.c index 8528abf675..a10fc8c92d 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -21,7 +21,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 744a1aa9b4..d800d314a1 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -18,7 +18,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index bd0b1d31de..b23c2b0942 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -19,7 +19,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 6d0a8501ef..8f135a5a96 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c index 00e4cde48b..d1689fca29 100644 --- a/examples/l2fwd-cat/cat.c +++ b/examples/l2fwd-cat/cat.c @@ -12,7 +12,6 @@ #include <stdio.h> #include <rte_common.h> -#include <rte_memcpy.h> #include <pqos.h> @@ -314,8 +313,7 @@ parse_l3ca(const char *l3ca) if (cmask != 0 && is_contiguous(cmask) == 0) goto err; - rte_memcpy(&m_config[idx].cpumask, - &cpuset, sizeof(rte_cpuset_t)); + memcpy(&m_config[idx].cpumask, &cpuset, sizeof(rte_cpuset_t)); if (cmask != 0) { m_config[idx].cdp = 1; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 2653db4735..e3e02b751e 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -13,7 +13,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index 1463cef0fc..52bcc91790 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-macsec/main.c b/examples/l2fwd-macsec/main.c index a5d7a84828..529489e10d 100644 --- a/examples/l2fwd-macsec/main.c +++ b/examples/l2fwd-macsec/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 96fb33196f..d928c957c3 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index f4adcf41b5..9db9de806e 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 8d32ae1dd5..d77aa8c62c 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index a8423d5d2a..d726d5c3b5 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -19,7 +19,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index 65713dbea8..f3b9b49380 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -24,7 +24,6 @@ #include <rte_ring.h> #include <rte_log.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_interrupts.h> #include <rte_ether.h> diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index f54bb8b75a..df1bac37d0 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -24,7 +24,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_ether.h> #include <rte_interrupts.h> diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 1ff85875df..ebf546db84 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -37,7 +37,6 @@ #include <rte_ether.h> #include <rte_ethdev.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_string_fns.h> #include <rte_cycles.h> diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index afb61bba51..7edf235bfb 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -362,9 +362,9 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { - rte_memcpy(&ptp_data->master_clock_id, - &ptp_hdr->source_port_id.clock_id, - sizeof(struct clock_id)); + memcpy(&ptp_data->master_clock_id, + &ptp_hdr->source_port_id.clock_id, + sizeof(struct clock_id)); ptp_data->ptpset = 1; } @@ -469,9 +469,8 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4]; client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5]; - rte_memcpy(&ptp_data->client_clock_id, - client_clkid, - sizeof(struct clock_id)); + memcpy(&ptp_data->client_clock_id, client_clkid, + sizeof(struct clock_id)); /* Enable flag for hardware timestamping. */ created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST; diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c index 059c470afb..3b8d9d50e8 100644 --- a/examples/qos_sched/app_thread.c +++ b/examples/qos_sched/app_thread.c @@ -9,7 +9,6 @@ #include <rte_malloc.h> #include <rte_cycles.h> #include <rte_ethdev.h> -#include <rte_memcpy.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h> #include <rte_sched.h> diff --git a/examples/qos_sched/main.c b/examples/qos_sched/main.c index b3c2c9ef23..e756ce0da2 100644 --- a/examples/qos_sched/main.c +++ b/examples/qos_sched/main.c @@ -10,7 +10,6 @@ #include <rte_malloc.h> #include <rte_cycles.h> #include <rte_ethdev.h> -#include <rte_memcpy.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h> diff --git a/examples/server_node_efd/efd_server/init.c b/examples/server_node_efd/efd_server/init.c index 9c89f6b60d..9a20831a0d 100644 --- a/examples/server_node_efd/efd_server/init.c +++ b/examples/server_node_efd/efd_server/init.c @@ -24,7 +24,6 @@ #include <rte_ring.h> #include <rte_log.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_interrupts.h> #include <rte_ether.h> diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c index fd72882e3a..0cd17a9ca3 100644 --- a/examples/server_node_efd/efd_server/main.c +++ b/examples/server_node_efd/efd_server/main.c @@ -26,7 +26,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_ether.h> #include <rte_interrupts.h> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 3fc1b151d1..41df424565 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -405,9 +405,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_devices) conf.pool_map[i].pools = (1UL << i); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)); + memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, + sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)); return 0; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 4a3ce6884c..12ef5bffc2 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -17,7 +17,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> @@ -151,9 +150,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools) conf.pool_map[i].pools = (1UL << (i % num_pools)); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + *eth_conf = vmdq_conf_default; + eth_conf->rx_adv_conf.vmdq_rx_conf = conf; + if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 4ccc2fe4b0..f93eca5936 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -17,7 +17,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> @@ -161,15 +160,11 @@ get_eth_conf(struct rte_eth_conf *eth_conf) tx_conf.dcb_tc[i] = i % num_tcs; } dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs; - (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, - sizeof(conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, - sizeof(dcb_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, - sizeof(vmdq_conf))); - (void)(rte_memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, - sizeof(tx_conf))); + (void)(memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(conf))); + (void)(memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, sizeof(dcb_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, sizeof(vmdq_conf))); + (void)(memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, sizeof(tx_conf))); if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_DCB_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 0/2] uuid: generator functions and unit test 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger ` (4 preceding siblings ...) 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger @ 2024-04-09 17:05 ` Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 2/2] test: add functional test for uuid Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger 6 siblings, 2 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-09 17:05 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger While looking at using uuid's in some logging cases, discovered that the existing uuid support in EAL was missing some functions add in later versions of libuuid. Add functions to generate Uuid values, and add missing functional tests for uuid's. v4 - review comments and use stdatomic Stephen Hemminger (2): eal: add functions to generate uuid values test: add functional test for uuid app/test/meson.build | 1 + app/test/test_uuid.c | 138 +++++++++++++++++++++++++++++++ lib/eal/common/eal_common_uuid.c | 56 +++++++++++++ lib/eal/include/rte_uuid.h | 26 ++++++ lib/eal/version.map | 4 + 5 files changed, 225 insertions(+) create mode 100644 app/test/test_uuid.c -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 1/2] eal: add functions to generate uuid values 2024-04-09 17:05 ` [PATCH v4 0/2] uuid: generator functions and unit test Stephen Hemminger @ 2024-04-09 17:05 ` Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 2/2] test: add functional test for uuid Stephen Hemminger 1 sibling, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-09 17:05 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Useful to be able to generate uuid values for tests or for interaction with other subsystems as magic cookie. Naming and overall algorithm come from libuuid which is used by permission of original author. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_uuid.c | 56 ++++++++++++++++++++++++++++++++ lib/eal/include/rte_uuid.h | 26 +++++++++++++++ lib/eal/version.map | 4 +++ 3 files changed, 86 insertions(+) diff --git a/lib/eal/common/eal_common_uuid.c b/lib/eal/common/eal_common_uuid.c index 0a80bfbb38..a185ccb881 100644 --- a/lib/eal/common/eal_common_uuid.c +++ b/lib/eal/common/eal_common_uuid.c @@ -3,12 +3,18 @@ */ #include <stdio.h> +#include <stdbool.h> #include <string.h> #include <stdint.h> #include <stdlib.h> #include <ctype.h> +#include <time.h> +#include <rte_stdatomic.h> +#include <rte_random.h> +#include <rte_time.h> #include <rte_uuid.h> +#include <rte_os_shim.h> /* UUID packed form */ struct uuid { @@ -165,3 +171,53 @@ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len) uuid.node[0], uuid.node[1], uuid.node[2], uuid.node[3], uuid.node[4], uuid.node[5]); } + +void rte_uuid_generate_random(rte_uuid_t out) +{ + union { + uint64_t words[2]; + rte_uuid_t uuid; + } buf; + struct uuid uu; + + /* UUID is 128 bit */ + buf.words[0] = rte_rand(); + buf.words[1] = rte_rand(); + + /* Mark these random bytes a version 4 random uuid */ + uuid_unpack(buf.uuid, &uu); + uu.clock_seq = (uu.clock_seq & 0x3FFF) | 0x8000; + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uuid_pack(&uu, out); +} + +void rte_uuid_generate_time(rte_uuid_t out) +{ + struct uuid uu; + struct timespec ts; + uint64_t ns, rnd; + static RTE_ATOMIC(uint16_t) sequence; + + /* The time value for UUID is 100ns since 15 October 1582 */ + clock_gettime(CLOCK_REALTIME, &ts); + + ns = ts.tv_nsec / 100; + ns += (uint64_t) ts.tv_sec * (NSEC_PER_SEC / 100); + ns += (((uint64_t) 0x01B21DD2) << 32) + 0x13814000; + + uu.time_low = (uint32_t) ns; + uu.time_mid = (uint16_t) (ns >> 32); + uu.time_hi_and_version = (uint16_t) (ns >> 48); + uu.time_hi_and_version = (uu.time_hi_and_version & 0x0FFF) | 0x4000; + uu.clock_seq = rte_atomic_fetch_add_explicit(&sequence, 1, rte_memory_order_relaxed); + + rnd = rte_rand(); + memcpy(uu.node, &rnd, 6); + /* + * Follow the convention so that random node part + * will not match a valid MAC address, + */ + uu.node[0] |= 0x1; + + uuid_pack(&uu, out); +} diff --git a/lib/eal/include/rte_uuid.h b/lib/eal/include/rte_uuid.h index cfefd4308a..5fe7d32d39 100644 --- a/lib/eal/include/rte_uuid.h +++ b/lib/eal/include/rte_uuid.h @@ -18,6 +18,8 @@ extern "C" { #include <stddef.h> #include <string.h> +#include <rte_compat.h> + /** * Struct describing a Universal Unique Identifier */ @@ -100,6 +102,30 @@ int rte_uuid_parse(const char *in, rte_uuid_t uu); */ void rte_uuid_unparse(const rte_uuid_t uu, char *out, size_t len); +/** + * Generate a random uuid + * + * Uses high quality pseudo-random generator rte_rand() to generate a universal + * unique identifier. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_random(rte_uuid_t uu); + +/** + * Generate a uuid based on time stamp. + * + * Uses the current time and a random Ethernet MAC address to generate a + * universal unique identifier. + * + * @param uu + * Resulting UUID + */ +__rte_experimental +void rte_uuid_generate_time(rte_uuid_t uu); + #ifdef __cplusplus } #endif diff --git a/lib/eal/version.map b/lib/eal/version.map index 3df50c3fbb..aca0d97c63 100644 --- a/lib/eal/version.map +++ b/lib/eal/version.map @@ -396,6 +396,10 @@ EXPERIMENTAL { # added in 24.03 rte_vfio_get_device_info; # WINDOWS_NO_EXPORT + + # added in 24.07 + rte_uuid_generate_random; + rte_uuid_generate_time; }; INTERNAL { -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v4 2/2] test: add functional test for uuid 2024-04-09 17:05 ` [PATCH v4 0/2] uuid: generator functions and unit test Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 1/2] eal: add functions to generate uuid values Stephen Hemminger @ 2024-04-09 17:05 ` Stephen Hemminger 1 sibling, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-04-09 17:05 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The uuid functions in EAL were not covered by existing functional tests. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/meson.build | 1 + app/test/test_uuid.c | 138 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 app/test/test_uuid.c diff --git a/app/test/meson.build b/app/test/meson.build index 7d909039ae..11fb7dbffa 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -198,6 +198,7 @@ source_file_deps = { 'test_trace.c': [], 'test_trace_perf.c': [], 'test_trace_register.c': [], + 'test_uuid.c' : [], 'test_vdev.c': ['kvargs', 'bus_vdev'], 'test_version.c': [], } diff --git a/app/test/test_uuid.c b/app/test/test_uuid.c new file mode 100644 index 0000000000..a4b1b34786 --- /dev/null +++ b/app/test/test_uuid.c @@ -0,0 +1,138 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2024 Stephen Hemminger + */ + +#include <rte_uuid.h> + +#include "test.h" + +#define NROUNDS 100 + +static int +check_duplicate_uuid(rte_uuid_t uids[]) +{ + int i, j; + char out[256]; + + for (i = 0; i < NROUNDS - 1; i++) { + for (j = i + 1; j < NROUNDS; j++) { + if (rte_uuid_compare(uids[i], uids[j]) == 0) { + rte_uuid_unparse(uids[i], out, sizeof(out)); + printf("Generated duplicate random uuids %d == %d : %s\n", + i, j, out); + return TEST_FAILED; + } + } + } + return TEST_SUCCESS; +} + + +static const struct uuid_case { + const char *in; + rte_uuid_t result; +} good_cases[] = { + { "02ce8e94-5b84-47fc-8f86-72633c5b5061", + RTE_UUID_INIT(0x02ce8e94, 0x5b84, 0x47fc, 0x8f86, 0x72633c5b5061) }, + { "2c72af87-d220-4931-98ec-45c8520c94e1", + RTE_UUID_INIT(0x2c72af87, 0xd220, 0x4931, 0x98ec, 0x45c8520c94e1) }, + { "441edca1-0942-4ccd-9b33-233e0454fe5b", + RTE_UUID_INIT(0x441edca1, 0x0942, 0x4ccd, 0x9b33, 0x233e0454fe5b) }, +}; + +static const char * const bad_cases[] = { + "", /* empty */ + "41edca1-0942-4ccd-9b33-233e0454fe5b", /* too short */ + "d5cecbac-531b-4527-b0629-2bc3011dc9c", /* hyphen in wrong place */ + "db318745-1347-4f5e-m142-d86dc41172b2", /* bad hex */ +}; + +static int +test_uuid(void) +{ + rte_uuid_t uids[NROUNDS] = { }; + rte_uuid_t clone[NROUNDS] = { }; + unsigned int i; + int ret; + + /* Test generate random uuid */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(uids[i])) { + printf("Zero'd uuid %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_generate_random(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + ret = check_duplicate_uuid(uids); + if (ret != TEST_SUCCESS) + return ret; + + /* Test generate time */ + for (i = 0; i < NROUNDS; i++) { + rte_uuid_generate_time(uids[i]); + + if (rte_uuid_is_null(uids[i])) { + printf("Generated random uuid %d is null\n", i); + return TEST_FAILED; + } + } + + + /* Test that copy works */ + for (i = 0; i < NROUNDS; i++) { + if (!rte_uuid_is_null(clone[i])) { + printf("Zero'd clone %d is not null\n", i); + return TEST_FAILED; + } + + rte_uuid_copy(clone[i], uids[i]); + + if (rte_uuid_compare(uids[i], clone[i]) != 0) { + printf("Copied uuid does not match\n"); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(good_cases); i++) { + const struct uuid_case *c = &good_cases[i]; + char out[37]; + rte_uuid_t uu; + + if (rte_uuid_parse(c->in, uu) != 0) { + printf("Failed to parse '%s'\n", c->in); + return TEST_FAILED; + } + if (rte_uuid_compare(uu, c->result) != 0) { + printf("Parse mismatch for '%s'\n", c->in); + return TEST_FAILED; + } + + rte_uuid_unparse(uu, out, sizeof(out)); + if (strcmp(out, c->in) != 0) { + printf("Parse/unparse mismatch (%s != %s)\n", + out, c->in); + return TEST_FAILED; + } + } + + for (i = 0; i < RTE_DIM(bad_cases); i++) { + const char *s = bad_cases[i]; + rte_uuid_t uu; + + if (rte_uuid_parse(s, uu) == 0) { + printf("Accepted parse of '%s'\n", s); + return TEST_FAILED; + } + } + return TEST_SUCCESS; +} + + +REGISTER_FAST_TEST(uuid_autotest, true, true, test_uuid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 00/32] replace use of rte_memcpy() with fixed size 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger ` (5 preceding siblings ...) 2024-04-09 17:05 ` [PATCH v4 0/2] uuid: generator functions and unit test Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger ` (32 more replies) 6 siblings, 33 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger The DPDK has a lot of unnecessary usage of rte_memcpy. This patch set replaces cases where rte_memcpy is used with a fixed size constant size. Typical example is: rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); which can be replaced with: memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); This does not change the resulting binary on almost all architectures because x86 version of intrisics and glibc are the same, and other architectures were using __builtin_constant_p(). The main benefit is that analysis tools like fortify, Coverity, and ASAN analyzers can check these memcpy's. A recent example is that on Ubuntu 22.04 detected undefined use of memcpy such as: memcpy(dst, NULL, 0) The first patch is a simple coccinelle script to do the replacement and the rest are the results broken out by module. The script can be used again to make sure more bad usage doesn't creep in with new drivers. v5 - rebase and fix a couple of the SW drivers. rewording of commit messages v4 - replace other unnecessary rte_memcpy in ethdev. replace memcpy with structure assignment where possible. fixup formatting in a couple places. v3 - rebase and rerun coccinelle script on 24.03 - consolidate patches by subtree - remove inclusion of rte_memcpy.h when no longer used. Stephen Hemminger (32): cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy eal: replace use of fixed size rte_memcpy ethdev: replace uses of rte_memcpy eventdev: replace use of fixed size rte_memcpy cryptodev: replace use of fixed size rte_memcpy ip_frag: replace use of fixed size rte_memcpy net: replace use of fixed size rte_memcpy lpm: replace use of fixed size rte_memcpy node: replace use of fixed size rte_memcpy pdcp: replace use of fixed size rte_memcpy pipeline: replace use of fixed size rte_memcpy rib: replace use of fixed size rte_memcpy security: replace use of fixed size rte_memcpy bus: remove unneeded rte_memcpy.h include raw: replace use of fixed size rte_memcpy baseband: replace use of fixed size rte_memcpy common: replace use of fixed size rte_memcpy crypto: replace use of fixed size rte_memcpy event: replace use of fixed size rte_memcpy mempool: replace use of fixed size rte_memcpy ml/cnxk: replace use of fixed size rte_memcpy app/test-pmd: replace use of fixed size rte_memcpy app/graph: replace use of fixed size rte_memcpy app/test-eventdev: replace use of fixed size rte_memcpy app/test: replace use of fixed size rte_memcpy app/test-pipeline: remove unused rte_memcpy.h include app/test-bbdev: remove unnecessary include of rte_memcpy.h examples: replace use of fixed size rte_memcpy net/null: replace use of fixed size memcpy net/tap: replace use of fixed size rte_memcpy net/pcap: replace use of fixed size rte_memcpy net/af_xdp:: replace use of fixed size rte_memcpy app/graph/neigh.c | 8 +- app/test-bbdev/test_bbdev.c | 1 - app/test-eventdev/test_pipeline_common.c | 19 ++-- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - app/test-pmd/cmdline.c | 48 ++++----- app/test-pmd/cmdline_flow.c | 24 ++--- app/test-pmd/config.c | 8 +- app/test-pmd/csumonly.c | 1 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/noisy_vnf.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/testpmd.c | 1 - app/test/commands.c | 1 - app/test/packet_burst_generator.c | 4 +- app/test/test_crc.c | 5 +- app/test/test_cryptodev.c | 18 ++-- app/test/test_cryptodev_asym.c | 1 - app/test/test_cryptodev_security_pdcp.c | 1 - app/test/test_efd.c | 1 - app/test/test_efd_perf.c | 1 - app/test/test_event_crypto_adapter.c | 12 +-- app/test/test_event_dma_adapter.c | 4 +- app/test/test_eventdev.c | 1 - app/test/test_ipsec.c | 6 +- app/test/test_link_bonding_mode4.c | 8 +- app/test/test_mbuf.c | 1 - app/test/test_member.c | 1 - app/test/test_member_perf.c | 1 - app/test/test_rawdev.c | 1 - app/test/test_security_inline_proto.c | 36 +++---- app/test/test_service_cores.c | 1 - app/test/virtual_pmd.c | 3 +- devtools/cocci/rte_memcpy.cocci | 11 ++ drivers/baseband/acc/rte_acc100_pmd.c | 16 ++- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++-- drivers/baseband/la12xx/bbdev_la12xx.c | 4 +- drivers/bus/auxiliary/linux/auxiliary.c | 1 - drivers/bus/fslmc/fslmc_bus.c | 1 - drivers/bus/fslmc/fslmc_vfio.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - drivers/common/idpf/idpf_common_device.c | 4 +- drivers/common/idpf/idpf_common_virtchnl.c | 10 +- drivers/common/qat/qat_qp.c | 10 +- drivers/compress/qat/qat_comp.c | 8 +- drivers/crypto/ccp/ccp_crypto.c | 14 +-- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- drivers/crypto/qat/qat_sym_session.c | 52 +++++---- .../scheduler/rte_cryptodev_scheduler.c | 6 +- drivers/crypto/scheduler/scheduler_failover.c | 12 +-- drivers/event/cnxk/cnxk_eventdev_selftest.c | 1 - drivers/event/cnxk/cnxk_tim_evdev.c | 4 +- drivers/event/dlb2/dlb2.c | 4 +- drivers/event/dpaa/dpaa_eventdev.c | 1 - drivers/event/dpaa2/dpaa2_eventdev.c | 7 +- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 - drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - drivers/event/octeontx/timvf_evdev.c | 4 +- drivers/mempool/dpaa/dpaa_mempool.c | 4 +- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 +- drivers/ml/cnxk/cn10k_ml_model.c | 8 +- drivers/ml/cnxk/cn10k_ml_ops.c | 11 +- drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- drivers/ml/cnxk/mvtvm_ml_model.c | 8 +- drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/pcap/pcap_ethdev.c | 2 +- drivers/net/pcap/pcap_osdep_freebsd.c | 2 +- drivers/net/pcap/pcap_osdep_linux.c | 2 +- drivers/net/tap/rte_eth_tap.c | 14 +-- drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +- drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +- drivers/raw/ifpga/afu_pmd_n3000.c | 8 +- drivers/raw/ifpga/ifpga_rawdev.c | 11 +- drivers/raw/skeleton/skeleton_rawdev.c | 8 +- drivers/raw/skeleton/skeleton_rawdev_test.c | 1 - examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 1 - examples/ip_fragmentation/main.c | 1 - examples/ip_reassembly/main.c | 1 - examples/ipv4_multicast/main.c | 1 - examples/l2fwd-cat/cat.c | 4 +- examples/l2fwd-jobstats/main.c | 1 - examples/l2fwd-keepalive/main.c | 1 - examples/l2fwd-macsec/main.c | 1 - examples/l2fwd/main.c | 1 - examples/l3fwd-power/main.c | 1 - examples/l3fwd/main.c | 1 - examples/link_status_interrupt/main.c | 1 - .../client_server_mp/mp_server/init.c | 1 - .../client_server_mp/mp_server/main.c | 1 - examples/multi_process/symmetric_mp/main.c | 1 - examples/ptpclient/ptpclient.c | 11 +- examples/qos_sched/app_thread.c | 1 - examples/qos_sched/main.c | 1 - examples/server_node_efd/efd_server/init.c | 1 - examples/server_node_efd/efd_server/main.c | 1 - examples/vhost/main.c | 6 +- examples/vmdq/main.c | 7 +- examples/vmdq_dcb/main.c | 15 +-- lib/cryptodev/rte_cryptodev.c | 2 +- lib/eal/common/eal_common_options.c | 7 +- lib/ethdev/rte_ethdev.c | 12 +-- lib/ethdev/rte_flow.c | 101 +++++++++--------- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/eventdev/rte_event_dma_adapter.c | 4 +- lib/eventdev/rte_event_timer_adapter.c | 2 +- lib/fib/trie.c | 2 +- lib/ip_frag/rte_ipv6_fragmentation.c | 4 +- lib/ip_frag/rte_ipv6_reassembly.c | 6 +- lib/lpm/rte_lpm6.c | 3 +- lib/net/rte_ether.c | 2 +- lib/node/ip6_lookup.c | 8 +- lib/pdcp/pdcp_process.c | 36 +++---- lib/pipeline/rte_table_action.c | 8 +- lib/rib/rte_rib6.h | 5 +- lib/security/rte_security.c | 4 +- 131 files changed, 368 insertions(+), 450 deletions(-) create mode 100644 devtools/cocci/rte_memcpy.cocci -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 02/32] eal: replace use of " Stephen Hemminger ` (31 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Rte_memcpy need not be used for the simple case of copying a fix size structure because it is not faster and will hide problems from code analysis tools. Coverity, Fortify and other analyzers special case memcpy() and can find issues that rte_memcpy() will hide. Many platforms use memcpy instead of rte_memcpy already. The only reason rte_memcpy() was added in original DPDK was that the older Gcc was doing slower on x86 than the special rte_memcpy() when handling larger size copies. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- devtools/cocci/rte_memcpy.cocci | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 devtools/cocci/rte_memcpy.cocci diff --git a/devtools/cocci/rte_memcpy.cocci b/devtools/cocci/rte_memcpy.cocci new file mode 100644 index 0000000000..fa1038fc06 --- /dev/null +++ b/devtools/cocci/rte_memcpy.cocci @@ -0,0 +1,11 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst; constant size; +@@ +( +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +) -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 02/32] eal: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 03/32] ethdev: replace uses of rte_memcpy Stephen Hemminger ` (30 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eal/common/eal_common_options.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c index e541f07939..07bfaffdac 100644 --- a/lib/eal/common/eal_common_options.c +++ b/lib/eal/common/eal_common_options.c @@ -30,7 +30,6 @@ #include <rte_tailq.h> #include <rte_version.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #ifndef RTE_EXEC_ENV_WINDOWS #include <rte_telemetry.h> #endif @@ -1253,7 +1252,7 @@ eal_parse_lcores(const char *lcores) /* without '@', by default using lcore_set as cpuset */ if (*lcores != '@') - rte_memcpy(&cpuset, &lcore_set, sizeof(cpuset)); + memcpy(&cpuset, &lcore_set, sizeof(cpuset)); set_count = CPU_COUNT(&lcore_set); /* start to update lcore_set */ @@ -1275,8 +1274,8 @@ eal_parse_lcores(const char *lcores) if (check_cpuset(&cpuset) < 0) goto err; - rte_memcpy(&lcore_config[idx].cpuset, &cpuset, - sizeof(rte_cpuset_t)); + memcpy(&lcore_config[idx].cpuset, &cpuset, + sizeof(rte_cpuset_t)); } /* some cores from the lcore_set can't be handled by EAL */ -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 03/32] ethdev: replace uses of rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 02/32] eal: replace use of " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 04/32] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger ` (29 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko, Ori Kam Replace use of rte_memcpy in ethdev. Most of these were fixed size, and the others were not in the fast path. Where possible replace memcpy() with structure assignment which has same effect is type safe. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> ethdev: struct assign --- lib/ethdev/rte_ethdev.c | 12 ++--- lib/ethdev/rte_flow.c | 101 +++++++++++++++++++--------------------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index f1c658f49e..27d2416466 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -15,7 +15,6 @@ #include <rte_log.h> #include <rte_interrupts.h> #include <rte_kvargs.h> -#include <rte_memcpy.h> #include <rte_common.h> #include <rte_mempool.h> #include <rte_malloc.h> @@ -618,7 +617,7 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) rte_spinlock_lock(rte_mcfg_ethdev_get_lock()); if (eth_dev_shared_data_prepare() != NULL) { - rte_memcpy(owner, ðdev->data->owner, sizeof(*owner)); + *owner = ethdev->data->owner; ret = 0; } else { ret = -ENOMEM; @@ -1316,15 +1315,14 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, dev->data->dev_configured = 0; /* Store original config, as rollback required on failure */ - memcpy(&orig_conf, &dev->data->dev_conf, sizeof(dev->data->dev_conf)); + orig_conf = dev->data->dev_conf; /* * Copy the dev_conf parameter into the dev structure. * rte_eth_dev_info_get() requires dev_conf, copy it before dev_info get */ if (dev_conf != &dev->data->dev_conf) - memcpy(&dev->data->dev_conf, dev_conf, - sizeof(dev->data->dev_conf)); + dev->data->dev_conf = *dev_conf; /* Backup mtu for rollback */ old_mtu = dev->data->mtu; @@ -1601,7 +1599,7 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, eth_dev_rx_queue_config(dev, 0); eth_dev_tx_queue_config(dev, 0); rollback: - memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf)); + dev->data->dev_conf = orig_conf; if (old_mtu != dev->data->mtu) dev->data->mtu = old_mtu; @@ -3843,7 +3841,7 @@ rte_eth_dev_conf_get(uint16_t port_id, struct rte_eth_conf *dev_conf) return -EINVAL; } - memcpy(dev_conf, &dev->data->dev_conf, sizeof(struct rte_eth_conf)); + *dev_conf = dev->data->dev_conf; rte_ethdev_trace_conf_get(port_id, dev_conf); diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index 7ab1100ea0..776352b984 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -62,7 +62,8 @@ rte_flow_conv_copy(void *buf, const void *data, const size_t size, size_t sz = rte_type ? desc[type].size : sizeof(void *); if (buf == NULL || data == NULL) return 0; - rte_memcpy(buf, data, (size > sz ? sz : size)); + + memcpy(buf, data, (size > sz ? sz : size)); if (rte_type && desc[type].desc_fn) sz += desc[type].desc_fn(size > 0 ? buf : NULL, data); return sz; @@ -73,11 +74,10 @@ rte_flow_item_flex_conv(void *buf, const void *data) { struct rte_flow_item_flex *dst = buf; const struct rte_flow_item_flex *src = data; - if (buf) { - dst->pattern = rte_memcpy - ((void *)((uintptr_t)(dst + 1)), src->pattern, - src->length); - } + + if (buf) + dst->pattern = memcpy((void *)((uintptr_t)(dst + 1)), + src->pattern, src->length); return src->length; } @@ -643,16 +643,18 @@ rte_flow_conv_item_spec(void *buf, const size_t size, mask.raw = item->mask ? item->mask : &rte_flow_item_raw_mask; src.raw = data; dst.raw = buf; - rte_memcpy(dst.raw, - (&(struct rte_flow_item_raw){ - .relative = src.raw->relative, - .search = src.raw->search, - .reserved = src.raw->reserved, - .offset = src.raw->offset, - .limit = src.raw->limit, - .length = src.raw->length, - }), - size > sizeof(*dst.raw) ? sizeof(*dst.raw) : size); + + memcpy(dst.raw, + (&(struct rte_flow_item_raw){ + .relative = src.raw->relative, + .search = src.raw->search, + .reserved = src.raw->reserved, + .offset = src.raw->offset, + .limit = src.raw->limit, + .length = src.raw->length, + }), + size > sizeof(*dst.raw) ? sizeof(*dst.raw) : size); + off = sizeof(*dst.raw); if (type == RTE_FLOW_CONV_ITEM_SPEC || (type == RTE_FLOW_CONV_ITEM_MASK && @@ -664,9 +666,8 @@ rte_flow_conv_item_spec(void *buf, const size_t size, if (tmp) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.raw->pattern)); if (size >= off + tmp) - dst.raw->pattern = rte_memcpy - ((void *)((uintptr_t)dst.raw + off), - src.raw->pattern, tmp); + dst.raw->pattern = memcpy((void *)((uintptr_t)dst.raw + off), + src.raw->pattern, tmp); off += tmp; } break; @@ -716,32 +717,31 @@ rte_flow_conv_action_conf(void *buf, const size_t size, case RTE_FLOW_ACTION_TYPE_RSS: src.rss = action->conf; dst.rss = buf; - rte_memcpy(dst.rss, - (&(struct rte_flow_action_rss){ - .func = src.rss->func, - .level = src.rss->level, - .types = src.rss->types, - .key_len = src.rss->key_len, - .queue_num = src.rss->queue_num, - }), - size > sizeof(*dst.rss) ? sizeof(*dst.rss) : size); + memcpy(dst.rss, + (&(struct rte_flow_action_rss){ + .func = src.rss->func, + .level = src.rss->level, + .types = src.rss->types, + .key_len = src.rss->key_len, + .queue_num = src.rss->queue_num, + }), + size > sizeof(*dst.rss) ? sizeof(*dst.rss) : size); + off = sizeof(*dst.rss); if (src.rss->key_len && src.rss->key) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->key)); tmp = sizeof(*src.rss->key) * src.rss->key_len; if (size >= (uint64_t)off + (uint64_t)tmp) - dst.rss->key = rte_memcpy - ((void *)((uintptr_t)dst.rss + off), - src.rss->key, tmp); + dst.rss->key = memcpy((void *)((uintptr_t)dst.rss + off), + src.rss->key, tmp); off += tmp; } if (src.rss->queue_num) { off = RTE_ALIGN_CEIL(off, sizeof(*dst.rss->queue)); tmp = sizeof(*src.rss->queue) * src.rss->queue_num; if (size >= (uint64_t)off + (uint64_t)tmp) - dst.rss->queue = rte_memcpy - ((void *)((uintptr_t)dst.rss + off), - src.rss->queue, tmp); + dst.rss->queue = memcpy((void *)((uintptr_t)dst.rss + off), + src.rss->queue, tmp); off += tmp; } break; @@ -983,20 +983,15 @@ rte_flow_conv_rule(struct rte_flow_conv_rule *dst, size_t off; int ret; - rte_memcpy(dst, - (&(struct rte_flow_conv_rule){ - .attr = NULL, - .pattern = NULL, - .actions = NULL, - }), - size > sizeof(*dst) ? sizeof(*dst) : size); + memcpy(dst, &(struct rte_flow_conv_rule) { }, + size > sizeof(*dst) ? sizeof(*dst) : size); + off = sizeof(*dst); if (src->attr_ro) { off = RTE_ALIGN_CEIL(off, sizeof(double)); if (size && size >= off + sizeof(*dst->attr)) - dst->attr = rte_memcpy - ((void *)((uintptr_t)dst + off), - src->attr_ro, sizeof(*dst->attr)); + dst->attr = memcpy((void *)((uintptr_t)dst + off), + src->attr_ro, sizeof(*dst->attr)); off += sizeof(*dst->attr); } if (src->pattern_ro) { @@ -1098,7 +1093,7 @@ rte_flow_conv(enum rte_flow_conv_op op, attr = src; if (size > sizeof(*attr)) size = sizeof(*attr); - rte_memcpy(dst, attr, size); + memcpy(dst, attr, size); ret = sizeof(*attr); break; case RTE_FLOW_CONV_OP_ITEM: @@ -1180,14 +1175,14 @@ rte_flow_copy(struct rte_flow_desc *desc, size_t len, if (ret < 0) return 0; ret += sizeof(*desc) - sizeof(*dst); - rte_memcpy(desc, - (&(struct rte_flow_desc){ - .size = ret, - .attr = *attr, - .items = dst_size ? dst->pattern : NULL, - .actions = dst_size ? dst->actions : NULL, - }), - len > sizeof(*desc) ? sizeof(*desc) : len); + memcpy(desc, + (&(struct rte_flow_desc){ + .size = ret, + .attr = *attr, + .items = dst_size ? dst->pattern : NULL, + .actions = dst_size ? dst->actions : NULL, + }), + len > sizeof(*desc) ? sizeof(*desc) : len); rte_flow_trace_copy(desc, len, attr, items, actions, ret); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 04/32] eventdev: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (2 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 03/32] ethdev: replace uses of rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 05/32] cryptodev: " Stephen Hemminger ` (28 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Abhinandan Gujjar, Jerin Jacob, Amit Prakash Shukla, Erik Gabriel Carrillo Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/eventdev/rte_event_dma_adapter.c | 4 ++-- lib/eventdev/rte_event_timer_adapter.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/eventdev/rte_event_crypto_adapter.c b/lib/eventdev/rte_event_crypto_adapter.c index db1c7f3906..e2fff2ecc9 100644 --- a/lib/eventdev/rte_event_crypto_adapter.c +++ b/lib/eventdev/rte_event_crypto_adapter.c @@ -655,7 +655,7 @@ eca_ops_enqueue_burst(struct event_crypto_adapter *adapter, continue; } - rte_memcpy(ev, &m_data->response_info, sizeof(*ev)); + memcpy(ev, &m_data->response_info, sizeof(*ev)); ev->event_ptr = ops[i]; ev->event_type = RTE_EVENT_TYPE_CRYPTODEV; if (adapter->implicit_release_disabled) diff --git a/lib/eventdev/rte_event_dma_adapter.c b/lib/eventdev/rte_event_dma_adapter.c index 24dff556db..6784c562b0 100644 --- a/lib/eventdev/rte_event_dma_adapter.c +++ b/lib/eventdev/rte_event_dma_adapter.c @@ -447,7 +447,7 @@ rte_event_dma_adapter_create(uint8_t id, uint8_t evdev_id, struct rte_event_port if (pc == NULL) return -ENOMEM; - rte_memcpy(pc, port_config, sizeof(struct rte_event_port_conf)); + memcpy(pc, port_config, sizeof(struct rte_event_port_conf)); ret = rte_event_dma_adapter_create_ext(id, evdev_id, edma_default_config_cb, mode, pc); if (ret != 0) rte_free(pc); @@ -668,7 +668,7 @@ edma_ops_enqueue_burst(struct event_dma_adapter *adapter, struct rte_event_dma_a continue; } - rte_memcpy(ev, response_info, sizeof(struct rte_event)); + memcpy(ev, response_info, sizeof(struct rte_event)); ev->event_ptr = ops[i]; ev->event_type = RTE_EVENT_TYPE_DMADEV; if (adapter->implicit_release_disabled) diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index 5886965d14..9ca52cc6de 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -549,7 +549,7 @@ event_buffer_add(struct event_buffer *bufp, struct rte_event *eventp) /* Instead of modulus, bitwise AND with mask to get head_idx. */ head_idx = bufp->head & EVENT_BUFFER_MASK; buf_eventp = &bufp->events[head_idx]; - rte_memcpy(buf_eventp, eventp, sizeof(struct rte_event)); + memcpy(buf_eventp, eventp, sizeof(struct rte_event)); /* Wrap automatically when overflow occurs. */ bufp->head++; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 05/32] cryptodev: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (3 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 04/32] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 06/32] ip_frag: " Stephen Hemminger ` (27 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Fan Zhang Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/cryptodev/rte_cryptodev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cryptodev/rte_cryptodev.c b/lib/cryptodev/rte_cryptodev.c index 886eb7adc4..1377777525 100644 --- a/lib/cryptodev/rte_cryptodev.c +++ b/lib/cryptodev/rte_cryptodev.c @@ -2854,7 +2854,7 @@ crypto_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < CRYPTO_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 06/32] ip_frag: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (4 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 05/32] cryptodev: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 07/32] net: " Stephen Hemminger ` (26 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Konstantin Ananyev Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/ip_frag/rte_ipv6_fragmentation.c | 4 +--- lib/ip_frag/rte_ipv6_reassembly.c | 6 ++---- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/ip_frag/rte_ipv6_fragmentation.c b/lib/ip_frag/rte_ipv6_fragmentation.c index 56696f32f8..72ce6501c8 100644 --- a/lib/ip_frag/rte_ipv6_fragmentation.c +++ b/lib/ip_frag/rte_ipv6_fragmentation.c @@ -5,8 +5,6 @@ #include <stddef.h> #include <errno.h> -#include <rte_memcpy.h> - #include "ip_frag_common.h" /** @@ -23,7 +21,7 @@ __fill_ipv6hdr_frag(struct rte_ipv6_hdr *dst, { struct rte_ipv6_fragment_ext *fh; - rte_memcpy(dst, src, sizeof(*dst)); + memcpy(dst, src, sizeof(*dst)); dst->payload_len = rte_cpu_to_be_16(len); dst->proto = IPPROTO_FRAGMENT; diff --git a/lib/ip_frag/rte_ipv6_reassembly.c b/lib/ip_frag/rte_ipv6_reassembly.c index 88863a98d1..663b1737a6 100644 --- a/lib/ip_frag/rte_ipv6_reassembly.c +++ b/lib/ip_frag/rte_ipv6_reassembly.c @@ -4,8 +4,6 @@ #include <stddef.h> -#include <rte_memcpy.h> - #include "ip_frag_common.h" /** @@ -143,8 +141,8 @@ rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl, int32_t ip_len; int32_t trim; - rte_memcpy(&key.src_dst[0], ip_hdr->src_addr, 16); - rte_memcpy(&key.src_dst[2], ip_hdr->dst_addr, 16); + memcpy(&key.src_dst[0], ip_hdr->src_addr, 16); + memcpy(&key.src_dst[2], ip_hdr->dst_addr, 16); key.id = frag_hdr->id; key.key_len = IPV6_KEYLEN; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 07/32] net: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (5 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 06/32] ip_frag: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 08/32] lpm: " Stephen Hemminger ` (25 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/net/rte_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/rte_ether.c b/lib/net/rte_ether.c index f59c20289d..761b38f805 100644 --- a/lib/net/rte_ether.c +++ b/lib/net/rte_ether.c @@ -13,7 +13,7 @@ rte_eth_random_addr(uint8_t *addr) uint64_t rand = rte_rand(); uint8_t *p = (uint8_t *)&rand; - rte_memcpy(addr, p, RTE_ETHER_ADDR_LEN); + memcpy(addr, p, RTE_ETHER_ADDR_LEN); addr[0] &= (uint8_t)~RTE_ETHER_GROUP_ADDR; /* clear multicast bit */ addr[0] |= RTE_ETHER_LOCAL_ADMIN_ADDR; /* set local assignment bit */ } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 08/32] lpm: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (6 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 07/32] net: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 09/32] node: " Stephen Hemminger ` (24 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Bruce Richardson, Vladimir Medvedkin Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/lpm/rte_lpm6.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c index 46d8f71a2d..242695dd4d 100644 --- a/lib/lpm/rte_lpm6.c +++ b/lib/lpm/rte_lpm6.c @@ -11,7 +11,6 @@ #include <rte_log.h> #include <rte_common.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_eal_memconfig.h> #include <rte_string_fns.h> #include <rte_errno.h> @@ -139,7 +138,7 @@ ip6_mask_addr(uint8_t *ip, uint8_t depth) static inline void ip6_copy_addr(uint8_t *dst, const uint8_t *src) { - rte_memcpy(dst, src, RTE_LPM6_IPV6_ADDR_SIZE); + memcpy(dst, src, RTE_LPM6_IPV6_ADDR_SIZE); } /* -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 09/32] node: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (7 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 08/32] lpm: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 10/32] pdcp: " Stephen Hemminger ` (23 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nithin Dabilpuram, Pavan Nikhilesh Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/node/ip6_lookup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/node/ip6_lookup.c b/lib/node/ip6_lookup.c index 309964f60f..b8e567ccd9 100644 --- a/lib/node/ip6_lookup.c +++ b/lib/node/ip6_lookup.c @@ -112,28 +112,28 @@ ip6_lookup_node_process_scalar(struct rte_graph *graph, struct rte_node *node, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf0, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[0], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[0], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf1 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf1, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf1, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[1], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[1], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf2 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf2, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf2, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[2], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[2], ipv6_hdr->dst_addr, 16); /* Extract DIP of mbuf3 */ ipv6_hdr = rte_pktmbuf_mtod_offset(mbuf3, struct rte_ipv6_hdr *, sizeof(struct rte_ether_hdr)); /* Extract hop_limits as ipv6 hdr is in cache */ node_mbuf_priv1(mbuf3, dyn)->ttl = ipv6_hdr->hop_limits; - rte_memcpy(ip_batch[3], ipv6_hdr->dst_addr, 16); + memcpy(ip_batch[3], ipv6_hdr->dst_addr, 16); rte_lpm6_lookup_bulk_func(lpm6, ip_batch, next_hop, 4); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 10/32] pdcp: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (8 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 09/32] node: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 11/32] pipeline: " Stephen Hemminger ` (22 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Anoob Joseph, Volodymyr Fialko Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pdcp/pdcp_process.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c index 9b9b881124..6c0693f666 100644 --- a/lib/pdcp/pdcp_process.c +++ b/lib/pdcp/pdcp_process.c @@ -60,7 +60,7 @@ pdcp_iv_gen_null_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv *e m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -72,10 +72,10 @@ pdcp_iv_gen_null_zs(struct rte_crypto_op *cop, const struct entity_priv *en_priv iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static void @@ -89,7 +89,7 @@ pdcp_iv_gen_aes_ctr_null(struct rte_crypto_op *cop, const struct entity_priv *en iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, 16); + memcpy(iv, iv_u64, 16); } static void @@ -101,8 +101,8 @@ pdcp_iv_gen_zs_null(struct rte_crypto_op *cop, const struct entity_priv *en_priv iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64 = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64, 8); - rte_memcpy(iv + 8, &iv_u64, 8); + memcpy(iv, &iv_u64, 8); + memcpy(iv + 8, &iv_u64, 8); } static void @@ -115,17 +115,17 @@ pdcp_iv_gen_zs_zs(struct rte_crypto_op *cop, const struct entity_priv *en_priv, /* Generating cipher IV */ iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); - rte_memcpy(iv + 8, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); + memcpy(iv + 8, &iv_u64[0], 8); iv += PDCP_IV_LEN; /* Generating auth IV */ iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static void @@ -140,12 +140,12 @@ pdcp_iv_gen_zs_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv *en_ iv = rte_crypto_op_ctod_offset(cop, uint8_t *, PDCP_IV_OFFSET); iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); - rte_memcpy(iv + 8, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); + memcpy(iv + 8, &iv_u64[0], 8); m_ptr = (uint8_t *)rte_pktmbuf_prepend(mb, 8); m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -162,11 +162,11 @@ pdcp_iv_gen_aes_ctr_aes_cmac(struct rte_crypto_op *cop, const struct entity_priv iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, PDCP_IV_LEN); + memcpy(iv, iv_u64, PDCP_IV_LEN); m_ptr = (uint8_t *)rte_pktmbuf_prepend(mb, 8); m = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(m_ptr, &m, 8); + memcpy(m_ptr, &m, 8); } static void @@ -179,15 +179,15 @@ pdcp_iv_gen_aes_ctr_zs(struct rte_crypto_op *cop, const struct entity_priv *en_p iv_u64[0] = en_priv->cipher_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); iv_u64[1] = 0; - rte_memcpy(iv, iv_u64, PDCP_IV_LEN); + memcpy(iv, iv_u64, PDCP_IV_LEN); iv += PDCP_IV_LEN; iv_u64[0] = en_priv->auth_iv_part.u64[0] | ((uint64_t)(rte_cpu_to_be_32(count))); - rte_memcpy(iv, &iv_u64[0], 8); + memcpy(iv, &iv_u64[0], 8); iv_u64[1] = iv_u64[0] ^ en_priv->auth_iv_part.u64[1]; - rte_memcpy(iv + 8, &iv_u64[1], 8); + memcpy(iv + 8, &iv_u64[1], 8); } static int -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 11/32] pipeline: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (9 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 10/32] pdcp: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 12/32] rib: " Stephen Hemminger ` (21 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/pipeline/rte_table_action.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pipeline/rte_table_action.c b/lib/pipeline/rte_table_action.c index 87c3e0e2c9..aec84deed5 100644 --- a/lib/pipeline/rte_table_action.c +++ b/lib/pipeline/rte_table_action.c @@ -1441,7 +1441,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->src_port, data->port); - rte_memcpy(ip->src_addr, data->addr, 16); + memcpy(ip->src_addr, data->addr, 16); tcp->src_port = data->port; tcp->cksum = tcp_cksum; } else { @@ -1454,7 +1454,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, udp->src_port, data->port); - rte_memcpy(ip->src_addr, data->addr, 16); + memcpy(ip->src_addr, data->addr, 16); udp->src_port = data->port; udp->dgram_cksum = udp_cksum; } @@ -1469,7 +1469,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, tcp->dst_port, data->port); - rte_memcpy(ip->dst_addr, data->addr, 16); + memcpy(ip->dst_addr, data->addr, 16); tcp->dst_port = data->port; tcp->cksum = tcp_cksum; } else { @@ -1482,7 +1482,7 @@ pkt_ipv6_work_nat(struct rte_ipv6_hdr *ip, udp->dst_port, data->port); - rte_memcpy(ip->dst_addr, data->addr, 16); + memcpy(ip->dst_addr, data->addr, 16); udp->dst_port = data->port; udp->dgram_cksum = udp_cksum; } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 12/32] rib: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (10 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 11/32] pipeline: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 13/32] security: " Stephen Hemminger ` (20 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Vladimir Medvedkin Mostly automatically generated by devtools/cocci/rte_memcpy.cocci The fib/trie.c was relying on headers rte_rib6 -> rte_memcpy -> rte_vect since rib6 is no longer using rte_memcpy need to get rte_vect.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/fib/trie.c | 2 +- lib/rib/rte_rib6.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/fib/trie.c b/lib/fib/trie.c index 09470e7287..a77f6c758b 100644 --- a/lib/fib/trie.c +++ b/lib/fib/trie.c @@ -9,7 +9,7 @@ #include <rte_debug.h> #include <rte_malloc.h> #include <rte_errno.h> - +#include <rte_vect.h> #include <rte_rib6.h> #include <rte_fib6.h> #include "trie.h" diff --git a/lib/rib/rte_rib6.h b/lib/rib/rte_rib6.h index 775286f965..f366d3d197 100644 --- a/lib/rib/rte_rib6.h +++ b/lib/rib/rte_rib6.h @@ -14,7 +14,8 @@ * Level compressed tree implementation for IPv6 Longest Prefix Match */ -#include <rte_memcpy.h> +#include <string.h> + #include <rte_common.h> #ifdef __cplusplus @@ -61,7 +62,7 @@ rte_rib6_copy_addr(uint8_t *dst, const uint8_t *src) { if ((dst == NULL) || (src == NULL)) return; - rte_memcpy(dst, src, RTE_RIB6_IPV6_ADDR_SIZE); + memcpy(dst, src, RTE_RIB6_IPV6_ADDR_SIZE); } /** -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 13/32] security: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (11 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 12/32] rib: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 14/32] bus: remove unneeded rte_memcpy.h include Stephen Hemminger ` (19 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Akhil Goyal, Anoob Joseph Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- lib/security/rte_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/security/rte_security.c b/lib/security/rte_security.c index e5c862f5f5..28d59ef388 100644 --- a/lib/security/rte_security.c +++ b/lib/security/rte_security.c @@ -384,7 +384,7 @@ crypto_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->op != RTE_CRYPTO_OP_TYPE_UNDEFINED) { memset(&caps_val, 0, CRYPTO_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < CRYPTO_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } @@ -409,7 +409,7 @@ sec_caps_array(struct rte_tel_data *d, while ((dev_caps = &capabilities[i++])->action != RTE_SECURITY_ACTION_TYPE_NONE) { memset(&caps_val, 0, SEC_CAPS_SZ * sizeof(caps_val[0])); - rte_memcpy(caps_val, dev_caps, sizeof(capabilities[0])); + memcpy(caps_val, dev_caps, sizeof(capabilities[0])); for (j = 0; j < SEC_CAPS_SZ; j++) rte_tel_data_add_array_uint(d, caps_val[j]); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 14/32] bus: remove unneeded rte_memcpy.h include 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (12 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 13/32] security: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 15/32] raw: replace use of fixed size rte_memcpy Stephen Hemminger ` (18 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Parav Pandit, Xueming Li, Hemant Agrawal, Sachin Saxena, Chenbo Xia, Nipun Gupta Included here but never used. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/bus/auxiliary/linux/auxiliary.c | 1 - drivers/bus/fslmc/fslmc_bus.c | 1 - drivers/bus/fslmc/fslmc_vfio.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - 7 files changed, 7 deletions(-) diff --git a/drivers/bus/auxiliary/linux/auxiliary.c b/drivers/bus/auxiliary/linux/auxiliary.c index 02fc9285dc..011278d79b 100644 --- a/drivers/bus/auxiliary/linux/auxiliary.c +++ b/drivers/bus/auxiliary/linux/auxiliary.c @@ -8,7 +8,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <eal_filesystem.h> #include "../private.h" diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index c155f4a2fd..6696aa2575 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -13,7 +13,6 @@ #include <bus_driver.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <ethdev_driver.h> #include <rte_mbuf_dyn.h> diff --git a/drivers/bus/fslmc/fslmc_vfio.c b/drivers/bus/fslmc/fslmc_vfio.c index 5966776a85..2011cd6e77 100644 --- a/drivers/bus/fslmc/fslmc_vfio.c +++ b/drivers/bus/fslmc/fslmc_vfio.c @@ -24,7 +24,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c index d7f6e45b7d..cc4d51c7f2 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c @@ -14,7 +14,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c index 07256ed7ec..5ff98b2176 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpci.c @@ -13,7 +13,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 4aec7b2cd8..bb8efc1871 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -26,7 +26,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c index 3d237398d9..12e58735b7 100644 --- a/drivers/bus/pci/linux/pci.c +++ b/drivers/bus/pci/linux/pci.c @@ -10,7 +10,6 @@ #include <rte_bus_pci.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <rte_vfio.h> #include "eal_filesystem.h" -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 15/32] raw: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (13 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 14/32] bus: remove unneeded rte_memcpy.h include Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 16/32] baseband: " Stephen Hemminger ` (17 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Rosen Xu, Sachin Saxena, Hemant Agrawal Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +-- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +-- drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +-- drivers/raw/ifpga/afu_pmd_n3000.c | 8 ++++---- drivers/raw/ifpga/ifpga_rawdev.c | 11 +++++------ drivers/raw/skeleton/skeleton_rawdev.c | 8 +++----- drivers/raw/skeleton/skeleton_rawdev_test.c | 1 - 7 files changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/raw/ifpga/afu_pmd_he_hssi.c b/drivers/raw/ifpga/afu_pmd_he_hssi.c index 859f28dcc1..c2aaed9203 100644 --- a/drivers/raw/ifpga/afu_pmd_he_hssi.c +++ b/drivers/raw/ifpga/afu_pmd_he_hssi.c @@ -15,7 +15,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -314,7 +313,7 @@ static int he_hssi_config(struct afu_rawdev *dev, void *config, if (cfg->port >= NUM_HE_HSSI_PORTS) return -EINVAL; - rte_memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg)); + memcpy(&priv->he_hssi_cfg, cfg, sizeof(priv->he_hssi_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_he_lpbk.c b/drivers/raw/ifpga/afu_pmd_he_lpbk.c index c7c5cda48c..ffb7075c84 100644 --- a/drivers/raw/ifpga/afu_pmd_he_lpbk.c +++ b/drivers/raw/ifpga/afu_pmd_he_lpbk.c @@ -15,7 +15,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -363,7 +362,7 @@ static int he_lpbk_config(struct afu_rawdev *dev, void *config, if ((cfg->end < cfg->begin) || (cfg->end > MAX_CACHE_LINES)) return -EINVAL; - rte_memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg)); + memcpy(&priv->he_lpbk_cfg, cfg, sizeof(priv->he_lpbk_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_he_mem.c b/drivers/raw/ifpga/afu_pmd_he_mem.c index a1db533eeb..b799e40d2d 100644 --- a/drivers/raw/ifpga/afu_pmd_he_mem.c +++ b/drivers/raw/ifpga/afu_pmd_he_mem.c @@ -14,7 +14,6 @@ #include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <rte_vfio.h> #include <bus_pci_driver.h> @@ -126,7 +125,7 @@ static int he_mem_tg_config(struct afu_rawdev *dev, void *config, if (config_size != sizeof(struct rte_pmd_afu_he_mem_tg_cfg)) return -EINVAL; - rte_memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg)); + memcpy(&priv->he_mem_tg_cfg, config, sizeof(priv->he_mem_tg_cfg)); return 0; } diff --git a/drivers/raw/ifpga/afu_pmd_n3000.c b/drivers/raw/ifpga/afu_pmd_n3000.c index 67b3941265..9236c0b153 100644 --- a/drivers/raw/ifpga/afu_pmd_n3000.c +++ b/drivers/raw/ifpga/afu_pmd_n3000.c @@ -1867,8 +1867,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config, if ((cfg->nlb_cfg.end < cfg->nlb_cfg.begin) || (cfg->nlb_cfg.end > MAX_CACHE_LINES)) return -EINVAL; - rte_memcpy(&priv->nlb_cfg, &cfg->nlb_cfg, - sizeof(struct rte_pmd_afu_nlb_cfg)); + memcpy(&priv->nlb_cfg, &cfg->nlb_cfg, + sizeof(struct rte_pmd_afu_nlb_cfg)); } else if (cfg->type == RTE_PMD_AFU_N3000_DMA) { if (cfg->dma_cfg.index >= NUM_N3000_DMA) return -EINVAL; @@ -1887,8 +1887,8 @@ static int n3000_afu_config(struct afu_rawdev *dev, void *config, cfg->dma_cfg.length); } } - rte_memcpy(&priv->dma_cfg, &cfg->dma_cfg, - sizeof(struct rte_pmd_afu_dma_cfg)); + memcpy(&priv->dma_cfg, &cfg->dma_cfg, + sizeof(struct rte_pmd_afu_dma_cfg)); } else { IFPGA_RAWDEV_PMD_ERR("Invalid type of N3000 AFU"); return -EINVAL; diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index a972b3b7a4..4057fcdca2 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -14,7 +14,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_devargs.h> -#include <rte_memcpy.h> #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_kvargs.h> @@ -258,7 +257,7 @@ static int ifpga_rawdev_fill_info(struct ifpga_rawdev *ifpga_dev) if (point < 12) return -1; point -= 12; - rte_memcpy(ifpga_dev->parent_bdf, &link[point], 12); + memcpy(ifpga_dev->parent_bdf, &link[point], 12); point = strlen(link1); if (point < 26) @@ -949,10 +948,10 @@ ifpga_rawdev_pr(struct rte_rawdev *dev, if (ret) return ret; - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b, - sizeof(u64)); - rte_memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8, - sizeof(u64)); + memcpy(&afu_pr_conf->afu_id.uuid.uuid_low, uuid.b, + sizeof(u64)); + memcpy(&afu_pr_conf->afu_id.uuid.uuid_high, uuid.b + 8, + sizeof(u64)); IFPGA_RAWDEV_PMD_INFO("%s: uuid_l=0x%lx, uuid_h=0x%lx\n", __func__, diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index 6e99d35536..256f45cb5d 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -20,7 +20,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_lcore.h> #include <bus_vdev_driver.h> @@ -245,8 +244,8 @@ static int skeleton_rawdev_queue_def_conf(struct rte_rawdev *dev, skelq = &skeldev->queues[queue_id]; if (queue_id < SKELETON_MAX_QUEUES) - rte_memcpy(queue_conf, skelq, - sizeof(struct skeleton_rawdev_queue)); + memcpy(queue_conf, skelq, + sizeof(struct skeleton_rawdev_queue)); return 0; } @@ -281,8 +280,7 @@ static int skeleton_rawdev_queue_setup(struct rte_rawdev *dev, if (skeldev->num_queues > queue_id && q->depth < SKELETON_QUEUE_MAX_DEPTH) { - rte_memcpy(q, queue_conf, - sizeof(struct skeleton_rawdev_queue)); + memcpy(q, queue_conf, sizeof(struct skeleton_rawdev_queue)); clear_queue_bufs(queue_id); } else { SKELETON_PMD_ERR("Invalid queue configuration"); diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c index b7a7f623aa..dc32c4e29b 100644 --- a/drivers/raw/skeleton/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c @@ -7,7 +7,6 @@ #include <rte_common.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <dev_driver.h> #include <rte_rawdev.h> #include <bus_vdev_driver.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 16/32] baseband: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (14 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 15/32] raw: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-23 18:28 ` Chautru, Nicolas 2024-05-22 3:27 ` [PATCH v5 17/32] common: " Stephen Hemminger ` (16 subsequent siblings) 32 siblings, 1 reply; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nicolas Chautru, Gagandeep Singh, Hemant Agrawal Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/baseband/acc/rte_acc100_pmd.c | 16 +++++++--------- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++++++++++----------- drivers/baseband/la12xx/bbdev_la12xx.c | 4 ++-- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c index ee50b9c60c..4a929d9cfa 100644 --- a/drivers/baseband/acc/rte_acc100_pmd.c +++ b/drivers/baseband/acc/rte_acc100_pmd.c @@ -2975,15 +2975,13 @@ enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint8_t *prev_ptr = (uint8_t *) prev_desc; uint8_t *new_ptr = (uint8_t *) desc; /* Copy first 4 words and BDESCs */ - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, - prev_ptr + ACC_5GUL_OFFSET_0, - ACC_5GUL_SIZE_1); + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); + memcpy(new_ptr + ACC_5GUL_OFFSET_0, + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); desc->req.op_addr = prev_desc->req.op_addr; /* Copy FCW */ - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, - prev_ptr + ACC_DESC_FCW_OFFSET, - ACC_FCW_LD_BLEN); + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, + prev_ptr + ACC_DESC_FCW_OFFSET, ACC_FCW_LD_BLEN); acc100_dma_desc_ld_update(op, &desc->req, input, h_output, &in_offset, &h_out_offset, &h_out_length, harq_layout); @@ -3130,7 +3128,7 @@ enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, desc = acc_desc(q, total_enqueued_cbs); desc->req.data_ptrs[0].address = q->ring_addr_iova + fcw_offset; desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); ret = acc100_dma_desc_ld_fill(op, &desc->req, &input, h_output, &in_offset, &h_out_offset, &h_out_length, @@ -4430,7 +4428,7 @@ acc100_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); value = acc_reg_read(d, HwPfPcieGpexBridgeControl); bool firstCfg = (value != ACC100_CFG_PCI_BRIDGE); diff --git a/drivers/baseband/acc/rte_vrb_pmd.c b/drivers/baseband/acc/rte_vrb_pmd.c index 585dc49bd6..bb11ff887a 100644 --- a/drivers/baseband/acc/rte_vrb_pmd.c +++ b/drivers/baseband/acc/rte_vrb_pmd.c @@ -2450,15 +2450,13 @@ vrb_enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, uint8_t *prev_ptr = (uint8_t *) prev_desc; uint8_t *new_ptr = (uint8_t *) desc; /* Copy first 4 words and BDESCs. */ - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, - prev_ptr + ACC_5GUL_OFFSET_0, - ACC_5GUL_SIZE_1); + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); + memcpy(new_ptr + ACC_5GUL_OFFSET_0, + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); desc->req.op_addr = prev_desc->req.op_addr; /* Copy FCW. */ - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, - prev_ptr + ACC_DESC_FCW_OFFSET, - ACC_FCW_LD_BLEN); + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, + prev_ptr + ACC_DESC_FCW_OFFSET, ACC_FCW_LD_BLEN); vrb_dma_desc_ld_update(op, &desc->req, input, h_output, &in_offset, &h_out_offset, &h_out_length, harq_layout); @@ -2566,7 +2564,8 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct acc_queue *q, struct rte_bbdev_dec_op *op, fcw_offset = (desc_idx << 8) + ACC_DESC_FCW_OFFSET; desc->req.data_ptrs[0].address = q->ring_addr_iova + fcw_offset; desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, ACC_FCW_LD_BLEN); + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, + ACC_FCW_LD_BLEN); desc->req.fcw_ld.tb_trailer_size = (c - r - 1) * trail_len; ret = vrb_dma_desc_ld_fill(op, &desc->req, &input, h_output, &in_offset, &h_out_offset, @@ -4002,7 +4001,7 @@ enqueue_mldts_split_op(struct acc_queue *q, struct rte_bbdev_mldts_op *op, if (symb == 0) desc->req.cbs_in_tb = num_syms; else - rte_memcpy(&desc->req.fcw_mldts, fcw, ACC_FCW_MLDTS_BLEN); + memcpy(&desc->req.fcw_mldts, fcw, ACC_FCW_MLDTS_BLEN); desc->req.data_ptrs[1].address = rte_pktmbuf_iova_offset(input_q, in_offset); desc->req.data_ptrs[1].blen = q_size; in_offset += q_size; @@ -4352,7 +4351,7 @@ vrb1_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration. */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); /* Check we are already out of PG. */ status = acc_reg_read(d, VRB1_PfHiSectionPowerGatingAck); @@ -4759,7 +4758,7 @@ vrb2_configure(const char *dev_name, struct rte_acc_conf *conf) struct acc_device *d = bbdev->data->dev_private; /* Store configuration. */ - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); /* Explicitly releasing AXI as this may be stopped after PF FLR/BME. */ address = VRB2_PfDmaAxiControl; diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c index bb754a5395..23e2fdb811 100644 --- a/drivers/baseband/la12xx/bbdev_la12xx.c +++ b/drivers/baseband/la12xx/bbdev_la12xx.c @@ -597,8 +597,8 @@ dequeue_single_op(struct bbdev_la12xx_q_priv *q_priv, void *dst) op = q_priv->bbdev_op[ci]; - rte_memcpy(dst, q_priv->msg_ch_vaddr[ci], - sizeof(struct bbdev_ipc_enqueue_op)); + memcpy(dst, q_priv->msg_ch_vaddr[ci], + sizeof(struct bbdev_ipc_enqueue_op)); /* Move Consumer Index forward */ ci++; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [PATCH v5 16/32] baseband: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 16/32] baseband: " Stephen Hemminger @ 2024-05-23 18:28 ` Chautru, Nicolas 0 siblings, 0 replies; 88+ messages in thread From: Chautru, Nicolas @ 2024-05-23 18:28 UTC (permalink / raw) To: Stephen Hemminger, dev; +Cc: Gagandeep Singh, Hemant Agrawal Hi Stephen, Still issue with indentation inconsistencies below. Thanks Nic > -----Original Message----- > From: Stephen Hemminger <stephen@networkplumber.org> > Sent: Tuesday, May 21, 2024 8:28 PM > To: dev@dpdk.org > Cc: Stephen Hemminger <stephen@networkplumber.org>; Chautru, Nicolas > <nicolas.chautru@intel.com>; Gagandeep Singh <g.singh@nxp.com>; > Hemant Agrawal <hemant.agrawal@nxp.com> > Subject: [PATCH v5 16/32] baseband: replace use of fixed size rte_memcpy > > Automatically generated by devtools/cocci/rte_memcpy.cocci > > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> > --- > drivers/baseband/acc/rte_acc100_pmd.c | 16 +++++++--------- > drivers/baseband/acc/rte_vrb_pmd.c | 21 ++++++++++----------- > drivers/baseband/la12xx/bbdev_la12xx.c | 4 ++-- > 3 files changed, 19 insertions(+), 22 deletions(-) > > diff --git a/drivers/baseband/acc/rte_acc100_pmd.c > b/drivers/baseband/acc/rte_acc100_pmd.c > index ee50b9c60c..4a929d9cfa 100644 > --- a/drivers/baseband/acc/rte_acc100_pmd.c > +++ b/drivers/baseband/acc/rte_acc100_pmd.c > @@ -2975,15 +2975,13 @@ enqueue_ldpc_dec_one_op_cb(struct > acc_queue *q, struct rte_bbdev_dec_op *op, > uint8_t *prev_ptr = (uint8_t *) prev_desc; > uint8_t *new_ptr = (uint8_t *) desc; > /* Copy first 4 words and BDESCs */ > - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); > - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, > - prev_ptr + ACC_5GUL_OFFSET_0, > - ACC_5GUL_SIZE_1); > + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); > + memcpy(new_ptr + ACC_5GUL_OFFSET_0, > + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); > desc->req.op_addr = prev_desc->req.op_addr; > /* Copy FCW */ > - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, > - prev_ptr + ACC_DESC_FCW_OFFSET, > - ACC_FCW_LD_BLEN); > + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, > + prev_ptr + ACC_DESC_FCW_OFFSET, > ACC_FCW_LD_BLEN); > acc100_dma_desc_ld_update(op, &desc->req, input, > h_output, > &in_offset, &h_out_offset, > &h_out_length, harq_layout); > @@ -3130,7 +3128,7 @@ enqueue_ldpc_dec_one_op_tb(struct acc_queue > *q, struct rte_bbdev_dec_op *op, > desc = acc_desc(q, total_enqueued_cbs); > desc->req.data_ptrs[0].address = q->ring_addr_iova + > fcw_offset; > desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; > - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, > ACC_FCW_LD_BLEN); > + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, > ACC_FCW_LD_BLEN); > ret = acc100_dma_desc_ld_fill(op, &desc->req, &input, > h_output, &in_offset, &h_out_offset, > &h_out_length, > @@ -4430,7 +4428,7 @@ acc100_configure(const char *dev_name, struct > rte_acc_conf *conf) > struct acc_device *d = bbdev->data->dev_private; > > /* Store configuration */ > - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > > value = acc_reg_read(d, HwPfPcieGpexBridgeControl); > bool firstCfg = (value != ACC100_CFG_PCI_BRIDGE); diff --git > a/drivers/baseband/acc/rte_vrb_pmd.c > b/drivers/baseband/acc/rte_vrb_pmd.c > index 585dc49bd6..bb11ff887a 100644 > --- a/drivers/baseband/acc/rte_vrb_pmd.c > +++ b/drivers/baseband/acc/rte_vrb_pmd.c > @@ -2450,15 +2450,13 @@ vrb_enqueue_ldpc_dec_one_op_cb(struct > acc_queue *q, struct rte_bbdev_dec_op *op, > uint8_t *prev_ptr = (uint8_t *) prev_desc; > uint8_t *new_ptr = (uint8_t *) desc; > /* Copy first 4 words and BDESCs. */ > - rte_memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); > - rte_memcpy(new_ptr + ACC_5GUL_OFFSET_0, > - prev_ptr + ACC_5GUL_OFFSET_0, > - ACC_5GUL_SIZE_1); > + memcpy(new_ptr, prev_ptr, ACC_5GUL_SIZE_0); > + memcpy(new_ptr + ACC_5GUL_OFFSET_0, > + prev_ptr + ACC_5GUL_OFFSET_0, ACC_5GUL_SIZE_1); > desc->req.op_addr = prev_desc->req.op_addr; > /* Copy FCW. */ > - rte_memcpy(new_ptr + ACC_DESC_FCW_OFFSET, > - prev_ptr + ACC_DESC_FCW_OFFSET, > - ACC_FCW_LD_BLEN); > + memcpy(new_ptr + ACC_DESC_FCW_OFFSET, > + prev_ptr + ACC_DESC_FCW_OFFSET, > ACC_FCW_LD_BLEN); > vrb_dma_desc_ld_update(op, &desc->req, input, h_output, > &in_offset, &h_out_offset, > &h_out_length, harq_layout); > @@ -2566,7 +2564,8 @@ vrb_enqueue_ldpc_dec_one_op_tb(struct > acc_queue *q, struct rte_bbdev_dec_op *op, > fcw_offset = (desc_idx << 8) + ACC_DESC_FCW_OFFSET; > desc->req.data_ptrs[0].address = q->ring_addr_iova + > fcw_offset; > desc->req.data_ptrs[0].blen = ACC_FCW_LD_BLEN; > - rte_memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, > ACC_FCW_LD_BLEN); > + memcpy(&desc->req.fcw_ld, &desc_first->req.fcw_ld, > + ACC_FCW_LD_BLEN); > desc->req.fcw_ld.tb_trailer_size = (c - r - 1) * trail_len; > ret = vrb_dma_desc_ld_fill(op, &desc->req, &input, > h_output, &in_offset, &h_out_offset, @@ - > 4002,7 +4001,7 @@ enqueue_mldts_split_op(struct acc_queue *q, struct > rte_bbdev_mldts_op *op, > if (symb == 0) > desc->req.cbs_in_tb = num_syms; > else > - rte_memcpy(&desc->req.fcw_mldts, fcw, > ACC_FCW_MLDTS_BLEN); > + memcpy(&desc->req.fcw_mldts, fcw, > ACC_FCW_MLDTS_BLEN); > desc->req.data_ptrs[1].address = > rte_pktmbuf_iova_offset(input_q, in_offset); > desc->req.data_ptrs[1].blen = q_size; > in_offset += q_size; > @@ -4352,7 +4351,7 @@ vrb1_configure(const char *dev_name, struct > rte_acc_conf *conf) > struct acc_device *d = bbdev->data->dev_private; > > /* Store configuration. */ > - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > > /* Check we are already out of PG. */ > status = acc_reg_read(d, VRB1_PfHiSectionPowerGatingAck); @@ - > 4759,7 +4758,7 @@ vrb2_configure(const char *dev_name, struct > rte_acc_conf *conf) > struct acc_device *d = bbdev->data->dev_private; > > /* Store configuration. */ > - rte_memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > + memcpy(&d->acc_conf, conf, sizeof(d->acc_conf)); > > /* Explicitly releasing AXI as this may be stopped after PF FLR/BME. > */ > address = VRB2_PfDmaAxiControl; > diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c > b/drivers/baseband/la12xx/bbdev_la12xx.c > index bb754a5395..23e2fdb811 100644 > --- a/drivers/baseband/la12xx/bbdev_la12xx.c > +++ b/drivers/baseband/la12xx/bbdev_la12xx.c > @@ -597,8 +597,8 @@ dequeue_single_op(struct bbdev_la12xx_q_priv > *q_priv, void *dst) > > op = q_priv->bbdev_op[ci]; > > - rte_memcpy(dst, q_priv->msg_ch_vaddr[ci], > - sizeof(struct bbdev_ipc_enqueue_op)); > + memcpy(dst, q_priv->msg_ch_vaddr[ci], > + sizeof(struct bbdev_ipc_enqueue_op)); > > /* Move Consumer Index forward */ > ci++; > -- > 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 17/32] common: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (15 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 16/32] baseband: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 18/32] crypto: " Stephen Hemminger ` (15 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Jingjing Wu, Kai Ji, Fan Zhang, Ashish Gupta Automatically generated by devtools/cocci/rte_memcpy.cocci Also, remove unnecessary includes of rte_memcpy.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/common/idpf/idpf_common_device.c | 4 ++-- drivers/common/idpf/idpf_common_virtchnl.c | 10 ++++++---- drivers/common/qat/qat_qp.c | 10 ++++------ drivers/compress/qat/qat_comp.c | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/common/idpf/idpf_common_device.c b/drivers/common/idpf/idpf_common_device.c index 8403ed83f9..37c859f830 100644 --- a/drivers/common/idpf/idpf_common_device.c +++ b/drivers/common/idpf/idpf_common_device.c @@ -477,8 +477,8 @@ idpf_vport_init(struct idpf_vport *vport, vport->num_rx_q = vport_info->num_rx_q; vport->num_rx_bufq = vport_info->num_rx_bufq; vport->max_mtu = vport_info->max_mtu; - rte_memcpy(vport->default_mac_addr, - vport_info->default_mac_addr, ETH_ALEN); + memcpy(vport->default_mac_addr, vport_info->default_mac_addr, + ETH_ALEN); vport->rss_algorithm = vport_info->rss_algorithm; vport->rss_key_size = RTE_MIN(IDPF_RSS_KEY_LEN, vport_info->rss_key_size); diff --git a/drivers/common/idpf/idpf_common_virtchnl.c b/drivers/common/idpf/idpf_common_virtchnl.c index c46ed50eb5..baabfeb216 100644 --- a/drivers/common/idpf/idpf_common_virtchnl.c +++ b/drivers/common/idpf/idpf_common_virtchnl.c @@ -290,7 +290,8 @@ idpf_vc_caps_get(struct idpf_adapter *adapter) return err; } - rte_memcpy(&adapter->caps, args.out_buffer, sizeof(struct virtchnl2_get_capabilities)); + memcpy(&adapter->caps, args.out_buffer, + sizeof(struct virtchnl2_get_capabilities)); return 0; } @@ -327,7 +328,8 @@ idpf_vc_vport_create(struct idpf_vport *vport, return err; } - rte_memcpy(&(vport->vport_info.info), args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(&(vport->vport_info.info), args.out_buffer, + IDPF_DFLT_MBX_BUF_SIZE); return 0; } @@ -383,7 +385,7 @@ idpf_vc_queue_grps_add(struct idpf_vport *vport, return err; } - rte_memcpy(p2p_queue_grps_out, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(p2p_queue_grps_out, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); return 0; } @@ -922,7 +924,7 @@ idpf_vc_ptype_info_query(struct idpf_adapter *adapter, if (err != 0) DRV_LOG(ERR, "Failed to execute command of VIRTCHNL2_OP_GET_PTYPE_INFO"); - rte_memcpy(recv_ptype_info, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); + memcpy(recv_ptype_info, args.out_buffer, IDPF_DFLT_MBX_BUF_SIZE); return err; } diff --git a/drivers/common/qat/qat_qp.c b/drivers/common/qat/qat_qp.c index f95dd33375..0c30c4d8c1 100644 --- a/drivers/common/qat/qat_qp.c +++ b/drivers/common/qat/qat_qp.c @@ -871,9 +871,8 @@ qat_cq_get_fw_cipher_crc_cap(struct qat_qp *qp) return -EINVAL; } - rte_memcpy(src_data_addr, - cipher_crc_cap_check_plaintext, - sizeof(cipher_crc_cap_check_plaintext)); + memcpy(src_data_addr, cipher_crc_cap_check_plaintext, + sizeof(cipher_crc_cap_check_plaintext)); phy_src_addr = rte_mem_virt2iova(src_data_addr); if (phy_src_addr == 0 || phy_src_addr == RTE_BAD_IOVA) { @@ -892,9 +891,8 @@ qat_cq_get_fw_cipher_crc_cap(struct qat_qp *qp) auth_param = (void *)((uint8_t *)cipher_param + ICP_QAT_FW_HASH_REQUEST_PARAMETERS_OFFSET); - rte_memcpy(cipher_param->u.cipher_IV_array, - cipher_crc_cap_check_iv, - sizeof(cipher_crc_cap_check_iv)); + memcpy(cipher_param->u.cipher_IV_array, cipher_crc_cap_check_iv, + sizeof(cipher_crc_cap_check_iv)); cipher_param->cipher_offset = cipher_crc_cap_check_cipher_offset; cipher_param->cipher_length = diff --git a/drivers/compress/qat/qat_comp.c b/drivers/compress/qat/qat_comp.c index 559948a46a..5bcbefe395 100644 --- a/drivers/compress/qat/qat_comp.c +++ b/drivers/compress/qat/qat_comp.c @@ -375,7 +375,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, QAT_DP_LOG(DEBUG, "op %p, parent_cookie %p", op, parent_cookie); /* copy original op to the local variable for restoring later */ - rte_memcpy(&op_backup, op, sizeof(op_backup)); + memcpy(&op_backup, op, sizeof(op_backup)); parent_cookie->nb_child_responses = 0; parent_cookie->nb_children = 0; @@ -401,7 +401,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, } /* prepare local dst mbuf */ - rte_memcpy(&dst_mbuf, op->m_dst, sizeof(dst_mbuf)); + memcpy(&dst_mbuf, op->m_dst, sizeof(dst_mbuf)); rte_pktmbuf_reset(&dst_mbuf); dst_mbuf.buf_len = dst_data_size; dst_mbuf.data_len = dst_data_size; @@ -457,7 +457,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, if (ret < 0) { QAT_DP_LOG(WARNING, "Failed to build child descriptor"); /* restore op and clear cookie */ - rte_memcpy(op, &op_backup, sizeof(op_backup)); + memcpy(op, &op_backup, sizeof(op_backup)); parent_cookie->split_op = 0; parent_cookie->nb_children = 0; return ret; @@ -468,7 +468,7 @@ qat_comp_build_multiple_requests(void *in_op, struct qat_qp *qp, } /* restore backed up original op */ - rte_memcpy(op, &op_backup, sizeof(op_backup)); + memcpy(op, &op_backup, sizeof(op_backup)); if (nb_descr != num_descriptors_built) QAT_DP_LOG(ERR, "split op. expected %d, built %d", -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 18/32] crypto: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (16 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 17/32] common: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 19/32] event: " Stephen Hemminger ` (14 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Hemant Agrawal, Sunil Uttarwar, Ankur Dwivedi, Anoob Joseph, Tejasree Kondoj, Gagandeep Singh, Kai Ji, Pablo de Lara Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/crypto/ccp/ccp_crypto.c | 14 ++--- drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- drivers/crypto/cnxk/cnxk_se.h | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- drivers/crypto/qat/qat_sym_session.c | 52 +++++++++---------- .../scheduler/rte_cryptodev_scheduler.c | 6 +-- drivers/crypto/scheduler/scheduler_failover.c | 12 ++--- 8 files changed, 44 insertions(+), 50 deletions(-) diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c index 4b84b3303e..4a70bc5d6e 100644 --- a/drivers/crypto/ccp/ccp_crypto.c +++ b/drivers/crypto/ccp/ccp_crypto.c @@ -168,7 +168,7 @@ static int partial_hash_sha1(uint8_t *data_in, uint8_t *data_out) if (!SHA1_Init(&ctx)) return -EFAULT; SHA1_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); return 0; } @@ -179,8 +179,7 @@ static int partial_hash_sha224(uint8_t *data_in, uint8_t *data_out) if (!SHA224_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -191,8 +190,7 @@ static int partial_hash_sha256(uint8_t *data_in, uint8_t *data_out) if (!SHA256_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -203,8 +201,7 @@ static int partial_hash_sha384(uint8_t *data_in, uint8_t *data_out) if (!SHA384_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -215,8 +212,7 @@ static int partial_hash_sha512(uint8_t *data_in, uint8_t *data_out) if (!SHA512_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, - SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c index 1dd1dbac9a..a67af3ec35 100644 --- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c +++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c @@ -959,7 +959,7 @@ cnxk_crypto_cn10k_submit(void *qptr, void *inst, uint16_t nb_inst) lmt_dst = PLT_PTR_CAST(lmt_base); for (j = 0; j < i; j++) { - rte_memcpy(lmt_dst, inst, sizeof(struct cpt_inst_s)); + memcpy(lmt_dst, inst, sizeof(struct cpt_inst_s)); inst = RTE_PTR_ADD(inst, sizeof(struct cpt_inst_s)); lmt_dst = RTE_PTR_ADD(lmt_dst, 2 * sizeof(struct cpt_inst_s)); } diff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h index 6374718a82..1fcbf0669a 100644 --- a/drivers/crypto/cnxk/cnxk_se.h +++ b/drivers/crypto/cnxk/cnxk_se.h @@ -1161,7 +1161,7 @@ cpt_sm_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_p void *dst = PLT_PTR_ADD(offset_vaddr, ROC_SE_OFF_CTRL_LEN); const uint64_t *src = fc_params->iv_buf; - rte_memcpy(dst, src, 16); + memcpy(dst, src, 16); } inst->w4.u64 = cpt_inst_w4.u64; } else { diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index 44528eaf7f..3e7b78656b 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -676,7 +676,7 @@ dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) } cdb = &sess->cdb; - rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); + memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); #ifdef RTE_LIB_SECURITY printf("\nsession protocol type = %d\n", sess->proto_alg); #endif diff --git a/drivers/crypto/ipsec_mb/pmd_snow3g.c b/drivers/crypto/ipsec_mb/pmd_snow3g.c index a96779f059..f3f519f2d4 100644 --- a/drivers/crypto/ipsec_mb/pmd_snow3g.c +++ b/drivers/crypto/ipsec_mb/pmd_snow3g.c @@ -291,8 +291,8 @@ process_snow3g_hash_op(struct ipsec_mb_qp *qp, struct rte_crypto_op **ops, /* Copy back digest from src to auth.digest.data */ if (digest_appended) - rte_memcpy(ops[i]->sym->auth.digest.data, - dst, SNOW3G_DIGEST_LENGTH); + memcpy(ops[i]->sym->auth.digest.data, dst, + SNOW3G_DIGEST_LENGTH); } processed_ops++; } diff --git a/drivers/crypto/qat/qat_sym_session.c b/drivers/crypto/qat/qat_sym_session.c index 9e2dba5423..a93625b287 100644 --- a/drivers/crypto/qat/qat_sym_session.c +++ b/drivers/crypto/qat/qat_sym_session.c @@ -1439,7 +1439,7 @@ static int partial_hash_sha1(uint8_t *data_in, uint8_t *data_out) if (!SHA1_Init(&ctx)) return -EFAULT; SHA1_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA_DIGEST_LENGTH); return 0; } @@ -1450,7 +1450,7 @@ static int partial_hash_sha224(uint8_t *data_in, uint8_t *data_out) if (!SHA224_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -1461,7 +1461,7 @@ static int partial_hash_sha256(uint8_t *data_in, uint8_t *data_out) if (!SHA256_Init(&ctx)) return -EFAULT; SHA256_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA256_DIGEST_LENGTH); return 0; } @@ -1472,7 +1472,7 @@ static int partial_hash_sha384(uint8_t *data_in, uint8_t *data_out) if (!SHA384_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -1483,7 +1483,7 @@ static int partial_hash_sha512(uint8_t *data_in, uint8_t *data_out) if (!SHA512_Init(&ctx)) return -EFAULT; SHA512_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); + memcpy(data_out, &ctx, SHA512_DIGEST_LENGTH); return 0; } @@ -1494,7 +1494,7 @@ static int partial_hash_md5(uint8_t *data_in, uint8_t *data_out) if (!MD5_Init(&ctx)) return -EFAULT; MD5_Transform(&ctx, data_in); - rte_memcpy(data_out, &ctx, MD5_DIGEST_LENGTH); + memcpy(data_out, &ctx, MD5_DIGEST_LENGTH); return 0; } @@ -1615,8 +1615,7 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, return -ENOMEM; } - rte_memcpy(in, AES_CMAC_SEED, - ICP_QAT_HW_AES_128_KEY_SZ); + memcpy(in, AES_CMAC_SEED, ICP_QAT_HW_AES_128_KEY_SZ); rte_memcpy(p_state_buf, auth_key, auth_keylen); if (AES_set_encrypt_key(auth_key, auth_keylen << 3, @@ -1660,8 +1659,8 @@ static int qat_sym_do_precomputes(enum icp_qat_hw_auth_algo hash_alg, return -ENOMEM; } - rte_memcpy(in, qat_aes_xcbc_key_seed, - ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); + memcpy(in, qat_aes_xcbc_key_seed, + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); for (x = 0; x < HASH_XCBC_PRECOMP_KEY_NUM; x++) { if (AES_set_encrypt_key(auth_key, auth_keylen << 3, @@ -1924,8 +1923,8 @@ static int qat_sym_do_precomputes_ipsec_mb(enum icp_qat_hw_auth_algo hash_alg, uint8_t *input = in; uint8_t *out = p_state_buf; - rte_memcpy(input, qat_aes_xcbc_key_seed, - ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); + memcpy(input, qat_aes_xcbc_key_seed, + ICP_QAT_HW_AES_XCBC_MAC_STATE2_SZ); for (i = 0; i < HASH_XCBC_PRECOMP_KEY_NUM; i++) { if (aes_ipsecmb_job(input, out, m, auth_key, auth_keylen)) { memset(input - @@ -2441,8 +2440,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, cdesc->cd_cur_ptr += sizeof(struct icp_qat_hw_auth_setup); switch (cdesc->qat_hash_alg) { case ICP_QAT_HW_AUTH_ALGO_SM3: - rte_memcpy(cdesc->cd_cur_ptr, sm3InitialState, - sizeof(sm3InitialState)); + memcpy(cdesc->cd_cur_ptr, sm3InitialState, + sizeof(sm3InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); state2_size = ICP_QAT_HW_SM3_STATE2_SZ; @@ -2453,9 +2452,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, hash_2->auth_config.config = ICP_QAT_HW_AUTH_CONFIG_BUILD(ICP_QAT_HW_AUTH_MODE2, cdesc->qat_hash_alg, digestsize); - rte_memcpy(cdesc->cd_cur_ptr + state1_size + state2_size + - sizeof(*hash_2), sm3InitialState, - sizeof(sm3InitialState)); + memcpy(cdesc->cd_cur_ptr + state1_size + state2_size + sizeof(*hash_2), + sm3InitialState, sizeof(sm3InitialState)); hash_cd_ctrl->inner_state1_sz = state1_size; hash_cd_ctrl->inner_state2_sz = state2_size; hash_cd_ctrl->inner_state2_offset = @@ -2493,8 +2491,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA1: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-1 */ - rte_memcpy(cdesc->cd_cur_ptr, sha1InitialState, - sizeof(sha1InitialState)); + memcpy(cdesc->cd_cur_ptr, sha1InitialState, + sizeof(sha1InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2520,8 +2518,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA224: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-224 */ - rte_memcpy(cdesc->cd_cur_ptr, sha224InitialState, - sizeof(sha224InitialState)); + memcpy(cdesc->cd_cur_ptr, sha224InitialState, + sizeof(sha224InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2545,8 +2543,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA256: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-256 */ - rte_memcpy(cdesc->cd_cur_ptr, sha256InitialState, - sizeof(sha256InitialState)); + memcpy(cdesc->cd_cur_ptr, sha256InitialState, + sizeof(sha256InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2570,8 +2568,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA384: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-384 */ - rte_memcpy(cdesc->cd_cur_ptr, sha384InitialState, - sizeof(sha384InitialState)); + memcpy(cdesc->cd_cur_ptr, sha384InitialState, + sizeof(sha384InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; @@ -2595,8 +2593,8 @@ int qat_sym_cd_auth_set(struct qat_sym_session *cdesc, case ICP_QAT_HW_AUTH_ALGO_SHA512: if (cdesc->auth_mode == ICP_QAT_HW_AUTH_MODE0) { /* Plain SHA-512 */ - rte_memcpy(cdesc->cd_cur_ptr, sha512InitialState, - sizeof(sha512InitialState)); + memcpy(cdesc->cd_cur_ptr, sha512InitialState, + sizeof(sha512InitialState)); state1_size = qat_hash_get_state1_size( cdesc->qat_hash_alg); break; diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c index 9a21edd32a..ed1833a7c6 100644 --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c @@ -79,7 +79,7 @@ sync_caps(struct rte_cryptodev_capabilities *caps, /* remove a uncommon cap from the array */ for (j = i; j < sync_nb_caps - 1; j++) - rte_memcpy(&caps[j], &caps[j+1], sizeof(*cap)); + memcpy(&caps[j], &caps[j + 1], sizeof(*cap)); memset(&caps[sync_nb_caps - 1], 0, sizeof(*cap)); sync_nb_caps--; @@ -216,8 +216,8 @@ sync_sec_caps(uint32_t worker_idx, * caps, from the arrays */ for (j = i; j < nb_sec_caps - 1; j++) { - rte_memcpy(&sec_caps[j], &sec_caps[j+1], - sizeof(*sec_cap)); + memcpy(&sec_caps[j], &sec_caps[j + 1], + sizeof(*sec_cap)); rte_memcpy(&sec_crypto_caps[j][0], &sec_crypto_caps[j+1][0], diff --git a/drivers/crypto/scheduler/scheduler_failover.c b/drivers/crypto/scheduler/scheduler_failover.c index 52ff2ffbb7..e7c6d19d25 100644 --- a/drivers/crypto/scheduler/scheduler_failover.c +++ b/drivers/crypto/scheduler/scheduler_failover.c @@ -171,12 +171,12 @@ scheduler_start(struct rte_cryptodev *dev) sched_ctx->workers[PRIMARY_WORKER_IDX].qp_id = i; sched_ctx->workers[SECONDARY_WORKER_IDX].qp_id = i; - rte_memcpy(&qp_ctx->primary_worker, - &sched_ctx->workers[PRIMARY_WORKER_IDX], - sizeof(struct scheduler_worker)); - rte_memcpy(&qp_ctx->secondary_worker, - &sched_ctx->workers[SECONDARY_WORKER_IDX], - sizeof(struct scheduler_worker)); + memcpy(&qp_ctx->primary_worker, + &sched_ctx->workers[PRIMARY_WORKER_IDX], + sizeof(struct scheduler_worker)); + memcpy(&qp_ctx->secondary_worker, + &sched_ctx->workers[SECONDARY_WORKER_IDX], + sizeof(struct scheduler_worker)); } return 0; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 19/32] event: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (17 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 18/32] crypto: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 20/32] mempool: " Stephen Hemminger ` (13 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Pavan Nikhilesh, Shijith Thotton, Abdullah Sevincer, Hemant Agrawal, Sachin Saxena, Jerin Jacob Automatically generated by devtools/cocci/rte_memcpy.cocci Also, remove unnecessary includes of rte_memcpy.h Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/event/cnxk/cnxk_eventdev_selftest.c | 1 - drivers/event/cnxk/cnxk_tim_evdev.c | 4 ++-- drivers/event/dlb2/dlb2.c | 4 ++-- drivers/event/dpaa/dpaa_eventdev.c | 1 - drivers/event/dpaa2/dpaa2_eventdev.c | 7 +++---- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 - drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - drivers/event/octeontx/timvf_evdev.c | 4 ++-- 9 files changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c index 95c0f1b1f7..620f2a0d67 100644 --- a/drivers/event/cnxk/cnxk_eventdev_selftest.c +++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c @@ -13,7 +13,6 @@ #include <rte_lcore.h> #include <rte_malloc.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_per_lcore.h> #include <rte_random.h> #include <rte_test.h> diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c index 6d59fdf909..2027c4644c 100644 --- a/drivers/event/cnxk/cnxk_tim_evdev.c +++ b/drivers/event/cnxk/cnxk_tim_evdev.c @@ -115,8 +115,8 @@ cnxk_tim_ring_info_get(const struct rte_event_timer_adapter *adptr, adptr_info->min_resolution_ns = tim_ring->ena_periodic ? tim_ring->max_tout : tim_ring->tck_nsec; - rte_memcpy(&adptr_info->conf, &adptr->data->conf, - sizeof(struct rte_event_timer_adapter_conf)); + memcpy(&adptr_info->conf, &adptr->data->conf, + sizeof(struct rte_event_timer_adapter_conf)); } static int diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 0b91f03956..dbd92c32ed 100644 --- a/drivers/event/dlb2/dlb2.c +++ b/drivers/event/dlb2/dlb2.c @@ -1668,7 +1668,7 @@ dlb2_hw_create_ldb_port(struct dlb2_eventdev *dlb2, qm_port->issued_releases = 0; /* Save config message too. */ - rte_memcpy(&qm_port->cfg.ldb, &cfg, sizeof(qm_port->cfg.ldb)); + memcpy(&qm_port->cfg.ldb, &cfg, sizeof(qm_port->cfg.ldb)); /* update state */ qm_port->state = PORT_STARTED; /* enabled at create time */ @@ -1869,7 +1869,7 @@ dlb2_hw_create_dir_port(struct dlb2_eventdev *dlb2, qm_port->issued_releases = 0; /* Save config message too. */ - rte_memcpy(&qm_port->cfg.dir, &cfg, sizeof(qm_port->cfg.dir)); + memcpy(&qm_port->cfg.dir, &cfg, sizeof(qm_port->cfg.dir)); /* update state */ qm_port->state = PORT_STARTED; /* enabled at create time */ diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index 919e922298..0d72fa7864 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -19,7 +19,6 @@ #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_memzone.h> #include <rte_pci.h> diff --git a/drivers/event/dpaa2/dpaa2_eventdev.c b/drivers/event/dpaa2/dpaa2_eventdev.c index 1273455673..490598cbc9 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev.c +++ b/drivers/event/dpaa2/dpaa2_eventdev.c @@ -20,7 +20,6 @@ #include <rte_lcore.h> #include <rte_log.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_pci.h> #include <bus_vdev_driver.h> @@ -159,7 +158,7 @@ dpaa2_eventdev_enqueue_burst(void *port, const struct rte_event ev[], "Unable to allocate event object"); goto send_partial; } - rte_memcpy(ev_temp, event, sizeof(struct rte_event)); + memcpy(ev_temp, event, sizeof(struct rte_event)); DPAA2_SET_FD_ADDR((&fd_arr[loop]), (size_t)ev_temp); DPAA2_SET_FD_LEN((&fd_arr[loop]), sizeof(struct rte_event)); @@ -230,7 +229,7 @@ static void dpaa2_eventdev_process_parallel(struct qbman_swp *swp, RTE_SET_USED(rxq); - rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + memcpy(ev, ev_temp, sizeof(struct rte_event)); rte_free(ev_temp); qbman_swp_dqrr_consume(swp, dq); @@ -249,7 +248,7 @@ static void dpaa2_eventdev_process_atomic(struct qbman_swp *swp, RTE_SET_USED(swp); RTE_SET_USED(rxq); - rte_memcpy(ev, ev_temp, sizeof(struct rte_event)); + memcpy(ev, ev_temp, sizeof(struct rte_event)); rte_free(ev_temp); *dpaa2_seqn(ev->mbuf) = dqrr_index + 1; DPAA2_PER_LCORE_DQRR_SIZE++; diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c index 9d4938efe6..8a9a14f628 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c @@ -12,7 +12,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_lcore.h> #include <rte_per_lcore.h> diff --git a/drivers/event/dpaa2/dpaa2_hw_dpcon.c b/drivers/event/dpaa2/dpaa2_hw_dpcon.c index a68d3ac154..e07b473413 100644 --- a/drivers/event/dpaa2/dpaa2_hw_dpcon.c +++ b/drivers/event/dpaa2/dpaa2_hw_dpcon.c @@ -13,7 +13,6 @@ #include <errno.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c index b54ae126d2..c0a0c789de 100644 --- a/drivers/event/octeontx/ssovf_evdev_selftest.c +++ b/drivers/event/octeontx/ssovf_evdev_selftest.c @@ -14,7 +14,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_lcore.h> #include <rte_per_lcore.h> diff --git a/drivers/event/octeontx/timvf_evdev.c b/drivers/event/octeontx/timvf_evdev.c index 090b3ed183..6409d6d161 100644 --- a/drivers/event/octeontx/timvf_evdev.c +++ b/drivers/event/octeontx/timvf_evdev.c @@ -42,8 +42,8 @@ timvf_ring_info_get(const struct rte_event_timer_adapter *adptr, struct timvf_ring *timr = adptr->data->adapter_priv; adptr_info->max_tmo_ns = timr->max_tout; adptr_info->min_resolution_ns = timr->tck_nsec; - rte_memcpy(&adptr_info->conf, &adptr->data->conf, - sizeof(struct rte_event_timer_adapter_conf)); + memcpy(&adptr_info->conf, &adptr->data->conf, + sizeof(struct rte_event_timer_adapter_conf)); } static int -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 20/32] mempool: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (18 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 19/32] event: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 21/32] ml/cnxk: " Stephen Hemminger ` (12 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Hemant Agrawal, Sachin Saxena Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> --- drivers/mempool/dpaa/dpaa_mempool.c | 4 ++-- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 0b484b3d9c..f72b51b472 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -115,8 +115,8 @@ dpaa_mbuf_create_pool(struct rte_mempool *mp) return -ENOMEM; } - rte_memcpy(bp_info, (void *)&rte_dpaa_bpid_info[bpid], - sizeof(struct dpaa_bp_info)); + memcpy(bp_info, (void *)&rte_dpaa_bpid_info[bpid], + sizeof(struct dpaa_bp_info)); mp->pool_data = (void *)bp_info; DPAA_MEMPOOL_INFO("BMAN pool created for bpid =%d", bpid); diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index 4c9245cb81..c711de30e8 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -16,7 +16,6 @@ #include <rte_mbuf.h> #include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h> @@ -125,8 +124,8 @@ rte_hw_mbuf_create_pool(struct rte_mempool *mp) rte_dpaa2_bpid_info[bpid].bp_list = bp_list; rte_dpaa2_bpid_info[bpid].bpid = bpid; - rte_memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], - sizeof(struct dpaa2_bp_info)); + memcpy(bp_info, (void *)&rte_dpaa2_bpid_info[bpid], + sizeof(struct dpaa2_bp_info)); mp->pool_data = (void *)bp_info; DPAA2_MEMPOOL_DEBUG("BP List created for bpid =%d", dpbp_attr.bpid); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 21/32] ml/cnxk: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (19 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 20/32] mempool: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 22/32] app/test-pmd: " Stephen Hemminger ` (11 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Srikanth Yalavarthi Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/ml/cnxk/cn10k_ml_model.c | 8 +++++--- drivers/ml/cnxk/cn10k_ml_ops.c | 11 +++++++---- drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- drivers/ml/cnxk/mvtvm_ml_model.c | 8 +++++--- drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +++++--- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/ml/cnxk/cn10k_ml_model.c b/drivers/ml/cnxk/cn10k_ml_model.c index 0325cd54f1..4e39a584fa 100644 --- a/drivers/ml/cnxk/cn10k_ml_model.c +++ b/drivers/ml/cnxk/cn10k_ml_model.c @@ -560,7 +560,7 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set model info */ memset(info, 0, sizeof(struct rte_ml_model_info)); - rte_memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(info->name, metadata->model.name, MRVL_ML_MODEL_NAME_LEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -579,7 +579,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, io_info->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, io_info->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = io_info->input[i].nb_dims; input[i].shape = &io_info->input[i].shape[0]; input[i].type = io_info->input[i].qtype; @@ -590,7 +591,8 @@ cn10k_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, io_info->output[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(output[i].name, io_info->output[i].name, + MRVL_ML_INPUT_NAME_LEN); output[i].nb_dims = io_info->output[i].nb_dims; output[i].shape = &io_info->output[i].shape[0]; output[i].type = io_info->output[i].qtype; diff --git a/drivers/ml/cnxk/cn10k_ml_ops.c b/drivers/ml/cnxk/cn10k_ml_ops.c index 834e55e88e..e53ada7b1c 100644 --- a/drivers/ml/cnxk/cn10k_ml_ops.c +++ b/drivers/ml/cnxk/cn10k_ml_ops.c @@ -668,11 +668,13 @@ cn10k_ml_layer_load(void *device, uint16_t model_id, const char *layer_name, uin } /* Copy metadata to internal buffer */ - rte_memcpy(&layer->glow.metadata, buffer, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&layer->glow.metadata, buffer, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&layer->glow.metadata); /* Set layer name */ - rte_memcpy(layer->name, layer->glow.metadata.model.name, MRVL_ML_MODEL_NAME_LEN); + memcpy(layer->name, layer->glow.metadata.model.name, + MRVL_ML_MODEL_NAME_LEN); /* Enable support for batch_size of 256 */ if (layer->glow.metadata.model.batch_size == 0) @@ -748,11 +750,12 @@ cn10k_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * model->subtype = ML_CNXK_MODEL_SUBTYPE_GLOW_MRVL; /* Copy metadata to internal buffer */ - rte_memcpy(&model->glow.metadata, params->addr, sizeof(struct cn10k_ml_model_metadata)); + memcpy(&model->glow.metadata, params->addr, + sizeof(struct cn10k_ml_model_metadata)); cn10k_ml_model_metadata_update(&model->glow.metadata); /* Set model name */ - rte_memcpy(model->name, (char *)model->glow.metadata.model.name, 64); + memcpy(model->name, (char *)model->glow.metadata.model.name, 64); /* Enable support for batch_size of 256 */ if (model->glow.metadata.model.batch_size == 0) diff --git a/drivers/ml/cnxk/cnxk_ml_ops.c b/drivers/ml/cnxk/cnxk_ml_ops.c index 971362b242..f9d0f50e1f 100644 --- a/drivers/ml/cnxk/cnxk_ml_ops.c +++ b/drivers/ml/cnxk/cnxk_ml_ops.c @@ -1400,7 +1400,7 @@ cnxk_ml_model_info_get(struct rte_ml_dev *dev, uint16_t model_id, } info = (struct rte_ml_model_info *)model->info; - rte_memcpy(model_info, info, sizeof(struct rte_ml_model_info)); + memcpy(model_info, info, sizeof(struct rte_ml_model_info)); model_info->input_info = info->input_info; model_info->output_info = info->output_info; diff --git a/drivers/ml/cnxk/mvtvm_ml_model.c b/drivers/ml/cnxk/mvtvm_ml_model.c index e3234ae442..99b4774a2e 100644 --- a/drivers/ml/cnxk/mvtvm_ml_model.c +++ b/drivers/ml/cnxk/mvtvm_ml_model.c @@ -310,7 +310,7 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo goto tvm_mrvl_model; metadata = &model->mvtvm.metadata; - rte_memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); + memcpy(info->name, metadata->model.name, TVMDP_NAME_STRLEN); snprintf(info->version, RTE_ML_STR_MAX, "%u.%u.%u.%u", metadata->model.version[0], metadata->model.version[1], metadata->model.version[2], metadata->model.version[3]); @@ -327,7 +327,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set input info */ for (i = 0; i < info->nb_inputs; i++) { - rte_memcpy(input[i].name, metadata->input[i].name, MRVL_ML_INPUT_NAME_LEN); + memcpy(input[i].name, metadata->input[i].name, + MRVL_ML_INPUT_NAME_LEN); input[i].nb_dims = metadata->input[i].ndim; input[i].shape = &model->mvtvm.info.input[i].shape[0]; input[i].type = model->mvtvm.info.input[i].qtype; @@ -338,7 +339,8 @@ mvtvm_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo /* Set output info */ for (i = 0; i < info->nb_outputs; i++) { - rte_memcpy(output[i].name, metadata->output[i].name, MRVL_ML_OUTPUT_NAME_LEN); + memcpy(output[i].name, metadata->output[i].name, + MRVL_ML_OUTPUT_NAME_LEN); output[i].nb_dims = metadata->output[i].ndim; output[i].shape = &model->mvtvm.info.output[i].shape[0]; output[i].type = model->mvtvm.info.output[i].qtype; diff --git a/drivers/ml/cnxk/mvtvm_ml_ops.c b/drivers/ml/cnxk/mvtvm_ml_ops.c index e825c3fb23..fca7e0c3c0 100644 --- a/drivers/ml/cnxk/mvtvm_ml_ops.c +++ b/drivers/ml/cnxk/mvtvm_ml_ops.c @@ -194,7 +194,7 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * /* Copy mod.so */ model->mvtvm.object.so.addr = mz->addr; model->mvtvm.object.so.size = object[0].size; - rte_memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.so.name, object[0].name, TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.so.addr, object[0].buffer, object[0].size); rte_free(object[0].buffer); @@ -203,7 +203,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.so.addr, RTE_ALIGN_CEIL(model->mvtvm.object.so.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.json.size = object[1].size; - rte_memcpy(model->mvtvm.object.json.name, object[1].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.json.name, object[1].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.json.addr, object[1].buffer, object[1].size); rte_free(object[1].buffer); @@ -212,7 +213,8 @@ mvtvm_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params * RTE_PTR_ADD(model->mvtvm.object.json.addr, RTE_ALIGN_CEIL(model->mvtvm.object.json.size, RTE_CACHE_LINE_MIN_SIZE)); model->mvtvm.object.params.size = object[2].size; - rte_memcpy(model->mvtvm.object.params.name, object[2].name, TVMDP_NAME_STRLEN); + memcpy(model->mvtvm.object.params.name, object[2].name, + TVMDP_NAME_STRLEN); rte_memcpy(model->mvtvm.object.params.addr, object[2].buffer, object[2].size); rte_free(object[2].buffer); -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 22/32] app/test-pmd: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (20 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 21/32] ml/cnxk: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 23/32] app/graph: " Stephen Hemminger ` (10 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Aman Singh, Yuying Zhang, Ori Kam Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-pmd/cmdline.c | 48 ++++++++++++++++++------------------- app/test-pmd/cmdline_flow.c | 24 +++++++++---------- app/test-pmd/config.c | 8 +++---- app/test-pmd/csumonly.c | 1 - app/test-pmd/flowgen.c | 1 - app/test-pmd/iofwd.c | 1 - app/test-pmd/macfwd.c | 1 - app/test-pmd/macswap.c | 1 - app/test-pmd/noisy_vnf.c | 1 - app/test-pmd/rxonly.c | 1 - app/test-pmd/testpmd.c | 1 - 11 files changed, 40 insertions(+), 48 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b7759e38a8..5e0740348a 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -9534,7 +9534,7 @@ static void cmd_set_vxlan_parsed(void *parsed_result, vxlan_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(vxlan_encap_conf.vni, &id.vni[1], 3); + memcpy(vxlan_encap_conf.vni, &id.vni[1], 3); vxlan_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); vxlan_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); vxlan_encap_conf.ip_tos = res->tos; @@ -9548,10 +9548,10 @@ static void cmd_set_vxlan_parsed(void *parsed_result, } if (vxlan_encap_conf.select_vlan) vxlan_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(vxlan_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_vxlan = { @@ -9729,7 +9729,7 @@ static void cmd_set_nvgre_parsed(void *parsed_result, nvgre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(nvgre_encap_conf.tni, &id.tni[1], 3); + memcpy(nvgre_encap_conf.tni, &id.tni[1], 3); if (nvgre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, nvgre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, nvgre_encap_conf.ipv4_dst); @@ -9739,10 +9739,10 @@ static void cmd_set_nvgre_parsed(void *parsed_result, } if (nvgre_encap_conf.select_vlan) nvgre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(nvgre_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_nvgre = { @@ -9856,10 +9856,10 @@ static void cmd_set_l2_encap_parsed(void *parsed_result, return; if (l2_encap_conf.select_vlan) l2_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(l2_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(l2_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_l2_encap = { @@ -10038,7 +10038,7 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, mplsogre_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsogre_encap_conf.label, &id.label, 3); + memcpy(mplsogre_encap_conf.label, &id.label, 3); if (mplsogre_encap_conf.select_ipv4) { IPV4_ADDR_TO_UINT(res->ip_src, mplsogre_encap_conf.ipv4_src); IPV4_ADDR_TO_UINT(res->ip_dst, mplsogre_encap_conf.ipv4_dst); @@ -10048,10 +10048,10 @@ static void cmd_set_mplsogre_encap_parsed(void *parsed_result, } if (mplsogre_encap_conf.select_vlan) mplsogre_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(mplsogre_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_mplsogre_encap = { @@ -10274,7 +10274,7 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, mplsoudp_encap_conf.select_ipv4 = 0; else return; - rte_memcpy(mplsoudp_encap_conf.label, &id.label, 3); + memcpy(mplsoudp_encap_conf.label, &id.label, 3); mplsoudp_encap_conf.udp_src = rte_cpu_to_be_16(res->udp_src); mplsoudp_encap_conf.udp_dst = rte_cpu_to_be_16(res->udp_dst); if (mplsoudp_encap_conf.select_ipv4) { @@ -10286,10 +10286,10 @@ static void cmd_set_mplsoudp_encap_parsed(void *parsed_result, } if (mplsoudp_encap_conf.select_vlan) mplsoudp_encap_conf.vlan_tci = rte_cpu_to_be_16(res->tci); - rte_memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, - RTE_ETHER_ADDR_LEN); - rte_memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, - RTE_ETHER_ADDR_LEN); + memcpy(mplsoudp_encap_conf.eth_src, res->eth_src.addr_bytes, + RTE_ETHER_ADDR_LEN); + memcpy(mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes, + RTE_ETHER_ADDR_LEN); } static cmdline_parse_inst_t cmd_set_mplsoudp_encap = { diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 60ee9337cf..95d9133ecb 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -13768,7 +13768,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in) fprintf(stderr, "Error - Not supported action\n"); return; } - rte_memcpy(data, action, sizeof(struct rte_flow_action)); + memcpy(data, action, sizeof(struct rte_flow_action)); data++; } } @@ -13929,8 +13929,8 @@ cmd_set_raw_parsed(const struct buffer *in) /* We have to add GTP header extra word. */ *total_size += sizeof(ext_word); - rte_memcpy(data_tail - (*total_size), - &ext_word, sizeof(ext_word)); + memcpy(data_tail - (*total_size), &ext_word, + sizeof(ext_word)); } size = sizeof(struct rte_gtp_hdr); break; @@ -13975,21 +13975,21 @@ cmd_set_raw_parsed(const struct buffer *in) if (opt->checksum_rsvd.checksum) { *total_size += sizeof(opt->checksum_rsvd); - rte_memcpy(data_tail - (*total_size), - &opt->checksum_rsvd, - sizeof(opt->checksum_rsvd)); + memcpy(data_tail - (*total_size), + &opt->checksum_rsvd, + sizeof(opt->checksum_rsvd)); } if (opt->key.key) { *total_size += sizeof(opt->key.key); - rte_memcpy(data_tail - (*total_size), - &opt->key.key, - sizeof(opt->key.key)); + memcpy(data_tail - (*total_size), + &opt->key.key, + sizeof(opt->key.key)); } if (opt->sequence.sequence) { *total_size += sizeof(opt->sequence.sequence); - rte_memcpy(data_tail - (*total_size), - &opt->sequence.sequence, - sizeof(opt->sequence.sequence)); + memcpy(data_tail - (*total_size), + &opt->sequence.sequence, + sizeof(opt->sequence.sequence)); } } proto = 0x2F; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index ba1007ace6..8b201f2104 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -2639,8 +2639,8 @@ port_flow_template_table_create(portid_t port_id, uint32_t id, } pt->nb_pattern_templates = nb_pattern_templates; pt->nb_actions_templates = nb_actions_templates; - rte_memcpy(&pt->flow_attr, &table_attr->flow_attr, - sizeof(struct rte_flow_attr)); + memcpy(&pt->flow_attr, &table_attr->flow_attr, + sizeof(struct rte_flow_attr)); printf("Template table #%u created\n", pt->id); return 0; } @@ -3259,8 +3259,8 @@ port_queue_action_handle_update(portid_t port_id, update = action->conf; break; case RTE_FLOW_ACTION_TYPE_METER_MARK: - rte_memcpy(&mtr_update.meter_mark, action->conf, - sizeof(struct rte_flow_action_meter_mark)); + memcpy(&mtr_update.meter_mark, action->conf, + sizeof(struct rte_flow_action_meter_mark)); if (mtr_update.meter_mark.profile) mtr_update.profile_valid = 1; if (mtr_update.meter_mark.policy) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 6711dda42e..0db26902a1 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c index 53b5f24f11..d9454a4d22 100644 --- a/app/test-pmd/flowgen.c +++ b/app/test-pmd/flowgen.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/iofwd.c b/app/test-pmd/iofwd.c index ba06fae4a6..c9727d2856 100644 --- a/app/test-pmd/iofwd.c +++ b/app/test-pmd/iofwd.c @@ -24,7 +24,6 @@ #include <rte_per_lcore.h> #include <rte_lcore.h> #include <rte_branch_prediction.h> -#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_interrupts.h> diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c index d19ace7395..ba63aedd79 100644 --- a/app/test-pmd/macfwd.c +++ b/app/test-pmd/macfwd.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c index 57f77003fe..e1f9be4901 100644 --- a/app/test-pmd/macswap.c +++ b/app/test-pmd/macswap.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/noisy_vnf.c b/app/test-pmd/noisy_vnf.c index 81d1187cfe..cf951e9532 100644 --- a/app/test-pmd/noisy_vnf.c +++ b/app/test-pmd/noisy_vnf.c @@ -24,7 +24,6 @@ #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_lcore.h> -#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_ethdev.h> diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c index 315f9286cd..cc73cf4ebf 100644 --- a/app/test-pmd/rxonly.c +++ b/app/test-pmd/rxonly.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 70ea257fda..9dd3ffa850 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -30,7 +30,6 @@ #include <rte_debug.h> #include <rte_cycles.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_bus.h> #include <rte_eal.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 23/32] app/graph: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (21 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 22/32] app/test-pmd: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 24/32] app/test-eventdev: " Stephen Hemminger ` (9 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Sunil Kumar Kori, Rakesh Kudurumalla Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/graph/neigh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/graph/neigh.c b/app/graph/neigh.c index 79fd542c89..77f0766133 100644 --- a/app/graph/neigh.c +++ b/app/graph/neigh.c @@ -91,14 +91,14 @@ ip6_rewrite_node_add(struct neigh_ipv6_config *v6_config) memset(data, 0, len); /* Copy dst mac */ - rte_memcpy((void *)&data[0], (void *)&v6_config->mac, RTE_ETHER_ADDR_LEN); + memcpy((void *)&data[0], (void *)&v6_config->mac, RTE_ETHER_ADDR_LEN); /* Copy src mac */ rc = rte_eth_macaddr_get(portid, &smac); if (rc < 0) return rc; - rte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); return rte_node_ip6_rewrite_add(portid, data, len, portid); } @@ -121,7 +121,7 @@ ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config) memset(data, 0, len); /* Copy dst mac */ - rte_memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN); + memcpy((void *)&data[0], (void *)&v4_config->mac, RTE_ETHER_ADDR_LEN); /* Copy src mac */ rc = rte_eth_macaddr_get(portid, &smac); @@ -130,7 +130,7 @@ ip4_rewrite_node_add(struct neigh_ipv4_config *v4_config) return rc; } - rte_memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(&data[RTE_ETHER_ADDR_LEN], smac.addr_bytes, RTE_ETHER_ADDR_LEN); return rte_node_ip4_rewrite_add(portid, data, len, portid); } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 24/32] app/test-eventdev: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (22 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 23/32] app/graph: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 25/32] app/test: " Stephen Hemminger ` (8 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Jerin Jacob Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-eventdev/test_pipeline_common.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/app/test-eventdev/test_pipeline_common.c b/app/test-eventdev/test_pipeline_common.c index b111690b7c..49bfd0c363 100644 --- a/app/test-eventdev/test_pipeline_common.c +++ b/app/test-eventdev/test_pipeline_common.c @@ -177,22 +177,17 @@ pipeline_tx_first(struct test_pipeline *t, struct evt_options *opt) mbuf->pkt_len = pkt_sz; /* Copy Ethernet header */ - rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), - ð_hdr, sizeof(struct rte_ether_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), + ð_hdr, sizeof(struct rte_ether_hdr)); /* Copy Ipv4 header */ - rte_memcpy(rte_pktmbuf_mtod_offset( - mbuf, char *, - sizeof(struct rte_ether_hdr)), - &ip_hdr, sizeof(struct rte_ipv4_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, sizeof(struct rte_ether_hdr)), + &ip_hdr, sizeof(struct rte_ipv4_hdr)); /* Copy UDP header */ - rte_memcpy( - rte_pktmbuf_mtod_offset( - mbuf, char *, - sizeof(struct rte_ipv4_hdr) + - sizeof(struct rte_ether_hdr)), - &udp_hdr, sizeof(struct rte_udp_hdr)); + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_ether_hdr)), + &udp_hdr, sizeof(struct rte_udp_hdr)); pkt_udp_hdr = rte_pktmbuf_mtod_offset( mbuf, struct rte_udp_hdr *, sizeof(struct rte_ipv4_hdr) + -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 25/32] app/test: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (23 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 24/32] app/test-eventdev: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 26/32] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger ` (7 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Jasvinder Singh, Akhil Goyal, Fan Zhang, Byron Marohn, Yipeng Wang, Abhinandan Gujjar, Amit Prakash Shukla, Jerin Jacob, Konstantin Ananyev, Vladimir Medvedkin, Chas Williams, Min Hu (Connor), Sameh Gobriel, Sachin Saxena, Hemant Agrawal, Anoob Joseph, Harry van Haaren Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 4 +-- app/test/test_crc.c | 5 ++-- app/test/test_cryptodev.c | 18 ++++++------- app/test/test_cryptodev_asym.c | 1 - app/test/test_cryptodev_security_pdcp.c | 1 - app/test/test_efd.c | 1 - app/test/test_efd_perf.c | 1 - app/test/test_event_crypto_adapter.c | 12 ++++----- app/test/test_event_dma_adapter.c | 4 +-- app/test/test_eventdev.c | 1 - app/test/test_ipsec.c | 6 ++--- app/test/test_link_bonding_mode4.c | 8 +++--- app/test/test_mbuf.c | 1 - app/test/test_member.c | 1 - app/test/test_member_perf.c | 1 - app/test/test_rawdev.c | 1 - app/test/test_security_inline_proto.c | 36 ++++++++++++------------- app/test/test_service_cores.c | 1 - app/test/virtual_pmd.c | 3 +-- 20 files changed, 46 insertions(+), 61 deletions(-) diff --git a/app/test/commands.c b/app/test/commands.c index 497d8e9952..74494a0ef4 100644 --- a/app/test/commands.c +++ b/app/test/commands.c @@ -16,7 +16,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c index 867a88da00..fcca2d238e 100644 --- a/app/test/packet_burst_generator.c +++ b/app/test/packet_burst_generator.c @@ -148,8 +148,8 @@ initialize_ipv6_header(struct rte_ipv6_hdr *ip_hdr, uint8_t *src_addr, ip_hdr->proto = IPPROTO_UDP; ip_hdr->hop_limits = IP_DEFTTL; - rte_memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); - rte_memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); + memcpy(ip_hdr->src_addr, src_addr, sizeof(ip_hdr->src_addr)); + memcpy(ip_hdr->dst_addr, dst_addr, sizeof(ip_hdr->dst_addr)); return (uint16_t) (pkt_data_len + sizeof(struct rte_ipv6_hdr)); } diff --git a/app/test/test_crc.c b/app/test/test_crc.c index b85fca35fe..30fe004506 100644 --- a/app/test/test_crc.c +++ b/app/test/test_crc.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_net_crc.h> #define CRC_VEC_LEN 32 @@ -83,7 +82,7 @@ test_crc_calc(void) return -7; for (i = 0; i < CRC32_VEC_LEN1; i += 12) - rte_memcpy(&test_data[i], crc32_vec1, 12); + memcpy(&test_data[i], crc32_vec1, 12); result = crc_calc(test_data, CRC32_VEC_LEN1, type); if (result != crc32_vec1_res) { @@ -93,7 +92,7 @@ test_crc_calc(void) /* 32-bit ethernet CRC: Test 3 */ for (i = 0; i < CRC32_VEC_LEN2; i += 12) - rte_memcpy(&test_data[i], crc32_vec1, 12); + memcpy(&test_data[i], crc32_vec1, 12); result = crc_calc(test_data, CRC32_VEC_LEN2, type); if (result != crc32_vec2_res) { diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 1703ebccf1..97651cdb6c 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -2479,8 +2479,8 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) sym_op->auth.data.length = QUOTE_512_BYTES; /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), - aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); + memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), + aes_cbc_iv, CIPHER_IV_LENGTH_AES_CBC); /* Set crypto operation cipher parameters */ sym_op->cipher.data.offset = 0; @@ -2614,9 +2614,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess, DIGEST_BYTE_LENGTH_SHA512); TEST_ASSERT_NOT_NULL(ut_params->digest, "no room to append digest"); - rte_memcpy(ut_params->digest, - digest, - DIGEST_BYTE_LENGTH_SHA512); + memcpy(ut_params->digest, digest, DIGEST_BYTE_LENGTH_SHA512); /* Generate Crypto op data structure */ ut_params->op = rte_crypto_op_alloc(ts_params->op_mpool, @@ -2639,8 +2637,8 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(void *sess, sym_op->auth.data.length = QUOTE_512_BYTES; /* Copy IV at the end of the crypto operation */ - rte_memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), - iv, CIPHER_IV_LENGTH_AES_CBC); + memcpy(rte_crypto_op_ctod_offset(ut_params->op, uint8_t *, IV_OFFSET), + iv, CIPHER_IV_LENGTH_AES_CBC); sym_op->cipher.data.offset = 0; sym_op->cipher.data.length = QUOTE_512_BYTES; @@ -8997,7 +8995,7 @@ create_aead_operation(enum rte_crypto_aead_operation op, uint8_t *, IV_OFFSET); if (tdata->iv.len == 0) { - rte_memcpy(iv_ptr, tdata->iv.data, AES_GCM_J0_LENGTH); + memcpy(iv_ptr, tdata->iv.data, AES_GCM_J0_LENGTH); debug_hexdump(stdout, "iv:", iv_ptr, AES_GCM_J0_LENGTH); } else { @@ -14337,8 +14335,8 @@ test_multi_session_random_usage(void) for (i = 0; i < MB_SESSION_NUMBER; i++) { - rte_memcpy(&ut_paramz[i].ut_params, &unittest_params, - sizeof(struct crypto_unittest_params)); + memcpy(&ut_paramz[i].ut_params, &unittest_params, + sizeof(struct crypto_unittest_params)); test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( &ut_paramz[i].ut_params, diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c index 17daf734e8..88561a8f25 100644 --- a/app/test/test_cryptodev_asym.c +++ b/app/test/test_cryptodev_asym.c @@ -8,7 +8,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_cryptodev.h> diff --git a/app/test/test_cryptodev_security_pdcp.c b/app/test/test_cryptodev_security_pdcp.c index a7641bab7a..39926cbee3 100644 --- a/app/test/test_cryptodev_security_pdcp.c +++ b/app/test/test_cryptodev_security_pdcp.c @@ -10,7 +10,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_pause.h> #include <rte_bus_vdev.h> #include <rte_byteorder.h> diff --git a/app/test/test_efd.c b/app/test/test_efd.c index 1c0986b9bc..306f851c52 100644 --- a/app/test/test_efd.c +++ b/app/test/test_efd.c @@ -13,7 +13,6 @@ test_efd(void) #else -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_efd.h> #include <rte_byteorder.h> diff --git a/app/test/test_efd_perf.c b/app/test/test_efd_perf.c index b212e96767..7f5a8b9a56 100644 --- a/app/test/test_efd_perf.c +++ b/app/test/test_efd_perf.c @@ -22,7 +22,6 @@ test_efd_perf(void) #include <rte_malloc.h> #include <rte_random.h> #include <rte_efd.h> -#include <rte_memcpy.h> #include <rte_thash.h> #define NUM_KEYSIZES 10 diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 0c56744ba0..4992c5bc50 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -454,7 +454,7 @@ test_op_forward_mode(uint8_t session_less) m_data.request_info.cdev_id = request_info.cdev_id; m_data.request_info.queue_pair_id = request_info.queue_pair_id; m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); } sym_op->m_src = m; @@ -653,8 +653,8 @@ test_asym_op_forward_mode(uint8_t session_less) m_data.request_info.cdev_id = request_info.cdev_id; m_data.request_info.queue_pair_id = request_info.queue_pair_id; m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + op->private_data_offset, - &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + op->private_data_offset, &m_data, + sizeof(m_data)); } /* Fill in event info and update event_ptr with rte_crypto_op */ memset(&ev, 0, sizeof(ev)); @@ -820,7 +820,7 @@ test_op_new_mode(uint8_t session_less) op->private_data_offset = len; /* Fill in private data information */ m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + len, &m_data, sizeof(m_data)); } sym_op->m_src = m; @@ -977,8 +977,8 @@ test_asym_op_new_mode(uint8_t session_less) sizeof(struct rte_crypto_asym_xform)); /* Fill in private data information */ m_data.response_info.event = response_info.event; - rte_memcpy((uint8_t *)op + op->private_data_offset, - &m_data, sizeof(m_data)); + memcpy((uint8_t *)op + op->private_data_offset, &m_data, + sizeof(m_data)); } ret = send_op_recv_ev(op); diff --git a/app/test/test_event_dma_adapter.c b/app/test/test_event_dma_adapter.c index 35b417b69f..af2e44a703 100644 --- a/app/test/test_event_dma_adapter.c +++ b/app/test/test_event_dma_adapter.c @@ -269,8 +269,8 @@ test_op_forward_mode(void) op->vchan = TEST_DMA_VCHAN_ID; response_info.event = dma_response_info.event; - rte_memcpy((uint8_t *)op + sizeof(struct rte_event_dma_adapter_op), &response_info, - sizeof(struct rte_event)); + memcpy((uint8_t *)op + sizeof(struct rte_event_dma_adapter_op), + &response_info, sizeof(struct rte_event)); /* Fill in event info and update event_ptr with rte_event_dma_adapter_op */ memset(&ev[i], 0, sizeof(struct rte_event)); diff --git a/app/test/test_eventdev.c b/app/test/test_eventdev.c index e4e234dc98..d2ae9b4930 100644 --- a/app/test/test_eventdev.c +++ b/app/test/test_eventdev.c @@ -8,7 +8,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #ifdef RTE_EXEC_ENV_WINDOWS static int diff --git a/app/test/test_ipsec.c b/app/test/test_ipsec.c index 6cb1bac1e7..25aabdb616 100644 --- a/app/test/test_ipsec.c +++ b/app/test/test_ipsec.c @@ -601,10 +601,10 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, /* copy outer IP and ESP header */ ipv4_outer.total_length = rte_cpu_to_be_16(t_len); ipv4_outer.packet_id = rte_cpu_to_be_16(seq); - rte_memcpy(dst, &ipv4_outer, sizeof(ipv4_outer)); + memcpy(dst, &ipv4_outer, sizeof(ipv4_outer)); dst += sizeof(ipv4_outer); m->l3_len = sizeof(ipv4_outer); - rte_memcpy(dst, &esph, sizeof(esph)); + memcpy(dst, &esph, sizeof(esph)); dst += sizeof(esph); if (string != NULL) { @@ -616,7 +616,7 @@ setup_test_string_tunneled(struct rte_mempool *mpool, const char *string, sizeof(esp_pad_bytes))); dst += padlen; /* copy ESP tail header */ - rte_memcpy(dst, &espt, sizeof(espt)); + memcpy(dst, &espt, sizeof(espt)); } else memset(dst, 0, t_len); diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index ff13dbed93..e4827c1e80 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -1399,8 +1399,8 @@ test_mode4_ext_ctrl(void) for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); - rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), - &lacpdu, sizeof(lacpdu)); + memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, + sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } @@ -1453,8 +1453,8 @@ test_mode4_ext_lacp(void) for (i = 0; i < MEMBER_COUNT; i++) { lacp_tx_buf[i] = rte_pktmbuf_alloc(test_params.mbuf_pool); - rte_memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), - &lacpdu, sizeof(lacpdu)); + memcpy(rte_pktmbuf_mtod(lacp_tx_buf[i], char *), &lacpdu, + sizeof(lacpdu)); rte_pktmbuf_pkt_len(lacp_tx_buf[i]) = sizeof(lacpdu); } diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 17be977f31..e1fa5b0f7f 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -19,7 +19,6 @@ #include <rte_debug.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_launch.h> #include <rte_eal.h> #include <rte_per_lcore.h> diff --git a/app/test/test_member.c b/app/test/test_member.c index 5a4d2750db..7281a644bd 100644 --- a/app/test/test_member.c +++ b/app/test/test_member.c @@ -7,7 +7,6 @@ #include <math.h> #include "test.h" -#include <rte_memcpy.h> #include <rte_malloc.h> #ifdef RTE_EXEC_ENV_WINDOWS diff --git a/app/test/test_member_perf.c b/app/test/test_member_perf.c index db6b8a18ef..f40fdba91e 100644 --- a/app/test/test_member_perf.c +++ b/app/test/test_member_perf.c @@ -11,7 +11,6 @@ #include <rte_cycles.h> #include <rte_malloc.h> #include <rte_random.h> -#include <rte_memcpy.h> #include <rte_thash.h> #include <math.h> diff --git a/app/test/test_rawdev.c b/app/test/test_rawdev.c index d34691dacf..120e61dcc2 100644 --- a/app/test/test_rawdev.c +++ b/app/test/test_rawdev.c @@ -7,7 +7,6 @@ #include <rte_common.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_dev.h> #ifdef RTE_EXEC_ENV_WINDOWS diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index 10f7e58caa..03eaf29305 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -245,8 +245,8 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, /* Copy cipher session parameters */ if (sa->aead) { - rte_memcpy(sess_conf->crypto_xform, &sa->xform.aead, - sizeof(struct rte_crypto_sym_xform)); + memcpy(sess_conf->crypto_xform, &sa->xform.aead, + sizeof(struct rte_crypto_sym_xform)); sess_conf->crypto_xform->aead.key.data = sa->key.data; /* Verify crypto capabilities */ if (test_sec_crypto_caps_aead_verify(sec_cap, sess_conf->crypto_xform) != 0) { @@ -256,13 +256,13 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, } } else { if (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) { - rte_memcpy(&sess_conf->crypto_xform->cipher, - &sa->xform.chain.cipher.cipher, - sizeof(struct rte_crypto_cipher_xform)); + memcpy(&sess_conf->crypto_xform->cipher, + &sa->xform.chain.cipher.cipher, + sizeof(struct rte_crypto_cipher_xform)); - rte_memcpy(&sess_conf->crypto_xform->next->auth, - &sa->xform.chain.auth.auth, - sizeof(struct rte_crypto_auth_xform)); + memcpy(&sess_conf->crypto_xform->next->auth, + &sa->xform.chain.auth.auth, + sizeof(struct rte_crypto_auth_xform)); sess_conf->crypto_xform->cipher.key.data = sa->key.data; sess_conf->crypto_xform->next->auth.key.data = @@ -282,12 +282,12 @@ create_inline_ipsec_session(struct ipsec_test_data *sa, uint16_t portid, return TEST_SKIPPED; } } else { - rte_memcpy(&sess_conf->crypto_xform->next->cipher, - &sa->xform.chain.cipher.cipher, - sizeof(struct rte_crypto_cipher_xform)); - rte_memcpy(&sess_conf->crypto_xform->auth, - &sa->xform.chain.auth.auth, - sizeof(struct rte_crypto_auth_xform)); + memcpy(&sess_conf->crypto_xform->next->cipher, + &sa->xform.chain.cipher.cipher, + sizeof(struct rte_crypto_cipher_xform)); + memcpy(&sess_conf->crypto_xform->auth, + &sa->xform.chain.auth.auth, + sizeof(struct rte_crypto_auth_xform)); sess_conf->crypto_xform->auth.key.data = sa->auth_key.data; sess_conf->crypto_xform->next->cipher.key.data = @@ -463,12 +463,12 @@ init_packet(struct rte_mempool *mp, const uint8_t *data, unsigned int len, bool return NULL; if (outer_ipv4) { - rte_memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), - &dummy_ipv4_eth_hdr, RTE_ETHER_HDR_LEN); + memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), + &dummy_ipv4_eth_hdr, RTE_ETHER_HDR_LEN); pkt->l3_len = sizeof(struct rte_ipv4_hdr); } else { - rte_memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), - &dummy_ipv6_eth_hdr, RTE_ETHER_HDR_LEN); + memcpy(rte_pktmbuf_append(pkt, RTE_ETHER_HDR_LEN), + &dummy_ipv6_eth_hdr, RTE_ETHER_HDR_LEN); pkt->l3_len = sizeof(struct rte_ipv6_hdr); } pkt->l2_len = RTE_ETHER_HDR_LEN; diff --git a/app/test/test_service_cores.c b/app/test/test_service_cores.c index 010ab82893..6d0618c447 100644 --- a/app/test/test_service_cores.c +++ b/app/test/test_service_cores.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_cycles.h> #include <rte_service.h> diff --git a/app/test/virtual_pmd.c b/app/test/virtual_pmd.c index b7d74a467a..ae48923df7 100644 --- a/app/test/virtual_pmd.c +++ b/app/test/virtual_pmd.c @@ -8,7 +8,6 @@ #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_ring.h> @@ -186,7 +185,7 @@ virtual_ethdev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) struct virtual_ethdev_private *dev_private = dev->data->dev_private; if (stats) - rte_memcpy(stats, &dev_private->eth_stats, sizeof(*stats)); + memcpy(stats, &dev_private->eth_stats, sizeof(*stats)); return 0; } -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 26/32] app/test-pipeline: remove unused rte_memcpy.h include 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (24 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 25/32] app/test: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 27/32] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger ` (6 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Cristian Dumitrescu This included but never used here. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - 4 files changed, 4 deletions(-) diff --git a/app/test-pipeline/config.c b/app/test-pipeline/config.c index daf838948b..f4d5d435ad 100644 --- a/app/test-pipeline/config.c +++ b/app/test-pipeline/config.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 558f0e428d..8028192306 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/main.c b/app/test-pipeline/main.c index 4cc098d7ac..ca0bc9d9d1 100644 --- a/app/test-pipeline/main.c +++ b/app/test-pipeline/main.c @@ -19,7 +19,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> diff --git a/app/test-pipeline/runtime.c b/app/test-pipeline/runtime.c index 752f783370..a6457488c0 100644 --- a/app/test-pipeline/runtime.c +++ b/app/test-pipeline/runtime.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_per_lcore.h> #include <rte_launch.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 27/32] app/test-bbdev: remove unnecessary include of rte_memcpy.h 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (25 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 26/32] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 28/32] examples: replace use of fixed size rte_memcpy Stephen Hemminger ` (5 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Nicolas Chautru Includes rte_memcpy.h but no rte_memcpy used. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- app/test-bbdev/test_bbdev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/app/test-bbdev/test_bbdev.c b/app/test-bbdev/test_bbdev.c index cf224dca5d..7309d85bc5 100644 --- a/app/test-bbdev/test_bbdev.c +++ b/app/test-bbdev/test_bbdev.c @@ -6,7 +6,6 @@ #include <rte_hexdump.h> #include <rte_mbuf.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_cycles.h> #include <rte_bus_vdev.h> -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 28/32] examples: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (26 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 27/32] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 29/32] net/null: replace use of fixed size memcpy Stephen Hemminger ` (4 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev Cc: Stephen Hemminger, Nicolas Chautru, Chas Williams, Min Hu (Connor), Konstantin Ananyev, Tomasz Kantecki, Akhil Goyal, Bruce Richardson, Anatoly Burakov, David Hunt, Sivaprasad Tummala, Kirill Rybalchenko, Cristian Dumitrescu, Byron Marohn, Yipeng Wang, Maxime Coquelin, Chenbo Xia Automatically generated by devtools/cocci/rte_memcpy.cocci Use structure assignment where possible. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 1 - examples/ip_fragmentation/main.c | 1 - examples/ip_reassembly/main.c | 1 - examples/ipv4_multicast/main.c | 1 - examples/l2fwd-cat/cat.c | 4 +--- examples/l2fwd-jobstats/main.c | 1 - examples/l2fwd-keepalive/main.c | 1 - examples/l2fwd-macsec/main.c | 1 - examples/l2fwd/main.c | 1 - examples/l3fwd-power/main.c | 1 - examples/l3fwd/main.c | 1 - examples/link_status_interrupt/main.c | 1 - .../client_server_mp/mp_server/init.c | 1 - .../client_server_mp/mp_server/main.c | 1 - examples/multi_process/symmetric_mp/main.c | 1 - examples/ptpclient/ptpclient.c | 11 +++++------ examples/qos_sched/app_thread.c | 1 - examples/qos_sched/main.c | 1 - examples/server_node_efd/efd_server/init.c | 1 - examples/server_node_efd/efd_server/main.c | 1 - examples/vhost/main.c | 6 +++--- examples/vmdq/main.c | 7 +++---- examples/vmdq_dcb/main.c | 15 +++++---------- 24 files changed, 18 insertions(+), 45 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 46f20238db..772963fc9b 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -360,7 +360,7 @@ add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); + memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void diff --git a/examples/bond/main.c b/examples/bond/main.c index 9f38b63cbb..4e8eeb7a5e 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -21,7 +21,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 736eae6f05..e1f27498c0 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -18,7 +18,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c7019078f7..e770ade798 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -19,7 +19,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 1eed645d02..bd4c3f335b 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -17,7 +17,6 @@ #include <rte_byteorder.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c index 00e4cde48b..d1689fca29 100644 --- a/examples/l2fwd-cat/cat.c +++ b/examples/l2fwd-cat/cat.c @@ -12,7 +12,6 @@ #include <stdio.h> #include <rte_common.h> -#include <rte_memcpy.h> #include <pqos.h> @@ -314,8 +313,7 @@ parse_l3ca(const char *l3ca) if (cmask != 0 && is_contiguous(cmask) == 0) goto err; - rte_memcpy(&m_config[idx].cpumask, - &cpuset, sizeof(rte_cpuset_t)); + memcpy(&m_config[idx].cpumask, &cpuset, sizeof(rte_cpuset_t)); if (cmask != 0) { m_config[idx].cdp = 1; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 308b8edd20..a7cd5b4840 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -13,7 +13,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index c3ead9e8b7..010d727086 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd-macsec/main.c b/examples/l2fwd-macsec/main.c index 294ee113e3..2088115fb1 100644 --- a/examples/l2fwd-macsec/main.c +++ b/examples/l2fwd-macsec/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c6fafdd019..59ea3172ae 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index fba11da7ca..fc0f6b21ec 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index ad28ba9d2e..d16d21f956 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -21,7 +21,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index ac9c7f6217..aa33e71d7a 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -19,7 +19,6 @@ #include <rte_log.h> #include <rte_malloc.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index 65713dbea8..f3b9b49380 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -24,7 +24,6 @@ #include <rte_ring.h> #include <rte_log.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_interrupts.h> #include <rte_ether.h> diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index ebfc2febc5..691d453d0e 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -24,7 +24,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_ether.h> #include <rte_interrupts.h> diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index f7d8439cd4..7314a9c6ea 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -37,7 +37,6 @@ #include <rte_ether.h> #include <rte_ethdev.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_string_fns.h> #include <rte_cycles.h> diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index afb61bba51..7edf235bfb 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -362,9 +362,9 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { - rte_memcpy(&ptp_data->master_clock_id, - &ptp_hdr->source_port_id.clock_id, - sizeof(struct clock_id)); + memcpy(&ptp_data->master_clock_id, + &ptp_hdr->source_port_id.clock_id, + sizeof(struct clock_id)); ptp_data->ptpset = 1; } @@ -469,9 +469,8 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4]; client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5]; - rte_memcpy(&ptp_data->client_clock_id, - client_clkid, - sizeof(struct clock_id)); + memcpy(&ptp_data->client_clock_id, client_clkid, + sizeof(struct clock_id)); /* Enable flag for hardware timestamping. */ created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST; diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c index e50cc33fde..e9db70bb3c 100644 --- a/examples/qos_sched/app_thread.c +++ b/examples/qos_sched/app_thread.c @@ -9,7 +9,6 @@ #include <rte_malloc.h> #include <rte_cycles.h> #include <rte_ethdev.h> -#include <rte_memcpy.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h> #include <rte_sched.h> diff --git a/examples/qos_sched/main.c b/examples/qos_sched/main.c index b3c2c9ef23..e756ce0da2 100644 --- a/examples/qos_sched/main.c +++ b/examples/qos_sched/main.c @@ -10,7 +10,6 @@ #include <rte_malloc.h> #include <rte_cycles.h> #include <rte_ethdev.h> -#include <rte_memcpy.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h> diff --git a/examples/server_node_efd/efd_server/init.c b/examples/server_node_efd/efd_server/init.c index 9c89f6b60d..9a20831a0d 100644 --- a/examples/server_node_efd/efd_server/init.c +++ b/examples/server_node_efd/efd_server/init.c @@ -24,7 +24,6 @@ #include <rte_ring.h> #include <rte_log.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_interrupts.h> #include <rte_ether.h> diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c index 75ff0ea532..8cb1b33111 100644 --- a/examples/server_node_efd/efd_server/main.c +++ b/examples/server_node_efd/efd_server/main.c @@ -26,7 +26,6 @@ #include <rte_log.h> #include <rte_debug.h> #include <rte_mempool.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_ether.h> #include <rte_interrupts.h> diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 4391d88c3d..876b09f515 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -405,9 +405,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_devices) conf.pool_map[i].pools = (1UL << i); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)); + memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, + sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)); return 0; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 4a3ce6884c..12ef5bffc2 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -17,7 +17,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> @@ -151,9 +150,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools) conf.pool_map[i].pools = (1UL << (i % num_pools)); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + *eth_conf = vmdq_conf_default; + eth_conf->rx_adv_conf.vmdq_rx_conf = conf; + if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 4ccc2fe4b0..f93eca5936 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -17,7 +17,6 @@ #include <rte_common.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_eal.h> #include <rte_launch.h> #include <rte_cycles.h> @@ -161,15 +160,11 @@ get_eth_conf(struct rte_eth_conf *eth_conf) tx_conf.dcb_tc[i] = i % num_tcs; } dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs; - (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, - sizeof(conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, - sizeof(dcb_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, - sizeof(vmdq_conf))); - (void)(rte_memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, - sizeof(tx_conf))); + (void)(memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(conf))); + (void)(memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, sizeof(dcb_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, sizeof(vmdq_conf))); + (void)(memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, sizeof(tx_conf))); if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_DCB_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 29/32] net/null: replace use of fixed size memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (27 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 28/32] examples: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 30/32] net/tap: replace use of fixed size rte_memcpy Stephen Hemminger ` (3 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Tetsuya Mukawa Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/null/rte_eth_null.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index f4ed3b8a7f..82249cbe19 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -465,7 +465,7 @@ eth_rss_hash_update(struct rte_eth_dev *dev, struct rte_eth_rss_conf *rss_conf) rss_conf->rss_hf & internal->flow_type_rss_offloads; if (rss_conf->rss_key) - rte_memcpy(internal->rss_key, rss_conf->rss_key, 40); + memcpy(internal->rss_key, rss_conf->rss_key, 40); rte_spinlock_unlock(&internal->rss_lock); @@ -482,7 +482,7 @@ eth_rss_hash_conf_get(struct rte_eth_dev *dev, rss_conf->rss_hf = dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf; if (rss_conf->rss_key) - rte_memcpy(rss_conf->rss_key, internal->rss_key, 40); + memcpy(rss_conf->rss_key, internal->rss_key, 40); rte_spinlock_unlock(&internal->rss_lock); @@ -577,7 +577,7 @@ eth_dev_null_create(struct rte_vdev_device *dev, struct pmd_options *args) internals->flow_type_rss_offloads = RTE_ETH_RSS_PROTO_MASK; internals->reta_size = RTE_DIM(internals->reta_conf) * RTE_ETH_RETA_GROUP_SIZE; - rte_memcpy(internals->rss_key, default_rss_key, 40); + memcpy(internals->rss_key, default_rss_key, 40); data = eth_dev->data; data->nb_rx_queues = (uint16_t)nb_rx_queues; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 30/32] net/tap: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (28 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 29/32] net/null: replace use of fixed size memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 31/32] net/pcap: " Stephen Hemminger ` (2 subsequent siblings) 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/tap/rte_eth_tap.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 69d9da695b..518619c53b 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1404,11 +1404,11 @@ tap_mac_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) mac_addr)) mode = LOCAL_AND_REMOTE; ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, mac_addr, RTE_ETHER_ADDR_LEN); ret = tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 1, mode); if (ret < 0) return ret; - rte_memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); + memcpy(&pmd->eth_addr, mac_addr, RTE_ETHER_ADDR_LEN); if (pmd->remote_if_index && !pmd->flow_isolate) { /* Replace MAC redirection rule after a MAC change */ ret = tap_flow_implicit_destroy(pmd, TAP_REMOTE_LOCAL_MAC); @@ -2010,7 +2010,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (rte_is_zero_ether_addr(mac_addr)) rte_eth_random_addr((uint8_t *)&pmd->eth_addr); else - rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); + memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); } /* @@ -2033,8 +2033,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, if (pmd->type == ETH_TUNTAP_TYPE_TAP) { memset(&ifr, 0, sizeof(struct ifreq)); ifr.ifr_hwaddr.sa_family = AF_LOCAL; - rte_memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, - RTE_ETHER_ADDR_LEN); + memcpy(ifr.ifr_hwaddr.sa_data, &pmd->eth_addr, + RTE_ETHER_ADDR_LEN); if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) goto error_exit; } @@ -2091,8 +2091,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, pmd->name, pmd->remote_iface); goto error_remote; } - rte_memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, - RTE_ETHER_ADDR_LEN); + memcpy(&pmd->eth_addr, ifr.ifr_hwaddr.sa_data, + RTE_ETHER_ADDR_LEN); /* The desired MAC is already in ifreq after SIOCGIFHWADDR. */ if (tap_ioctl(pmd, SIOCSIFHWADDR, &ifr, 0, LOCAL_ONLY) < 0) { TAP_LOG(ERR, "%s: failed to get %s MAC address.", -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 31/32] net/pcap: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (29 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 30/32] net/tap: replace use of fixed size rte_memcpy Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 32/32] net/af_xdp:: " Stephen Hemminger 2024-05-26 14:51 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Mattias Rönnblom 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/pcap/pcap_ethdev.c | 2 +- drivers/net/pcap/pcap_osdep_freebsd.c | 2 +- drivers/net/pcap/pcap_osdep_linux.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c index bfec085045..54f0dfffbd 100644 --- a/drivers/net/pcap/pcap_ethdev.c +++ b/drivers/net/pcap/pcap_ethdev.c @@ -1270,7 +1270,7 @@ eth_pcap_update_mac(const char *if_name, struct rte_eth_dev *eth_dev, return -1; PMD_LOG(INFO, "Setting phy MAC for %s", if_name); - rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); + memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); eth_dev->data->mac_addrs = mac_addrs; return 0; } diff --git a/drivers/net/pcap/pcap_osdep_freebsd.c b/drivers/net/pcap/pcap_osdep_freebsd.c index 20556b3e92..d395a5957d 100644 --- a/drivers/net/pcap/pcap_osdep_freebsd.c +++ b/drivers/net/pcap/pcap_osdep_freebsd.c @@ -52,7 +52,7 @@ osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac) ifm = (struct if_msghdr *)buf; sdl = (struct sockaddr_dl *)(ifm + 1); - rte_memcpy(mac->addr_bytes, LLADDR(sdl), RTE_ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, LLADDR(sdl), RTE_ETHER_ADDR_LEN); rte_free(buf); return 0; diff --git a/drivers/net/pcap/pcap_osdep_linux.c b/drivers/net/pcap/pcap_osdep_linux.c index 97033f57c5..fc79ad6cdf 100644 --- a/drivers/net/pcap/pcap_osdep_linux.c +++ b/drivers/net/pcap/pcap_osdep_linux.c @@ -35,7 +35,7 @@ osdep_iface_mac_get(const char *if_name, struct rte_ether_addr *mac) return -1; } - rte_memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); + memcpy(mac->addr_bytes, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(if_fd); return 0; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* [PATCH v5 32/32] net/af_xdp:: replace use of fixed size rte_memcpy 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (30 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 31/32] net/pcap: " Stephen Hemminger @ 2024-05-22 3:27 ` Stephen Hemminger 2024-05-26 14:51 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Mattias Rönnblom 32 siblings, 0 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-22 3:27 UTC (permalink / raw) To: dev; +Cc: Stephen Hemminger, Ciara Loftus Automatically generated by devtools/cocci/rte_memcpy.cocci Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> --- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 6ba455bb9b..afaf358019 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -2096,7 +2096,7 @@ get_iface_info(const char *if_name, if (ioctl(sock, SIOCGIFHWADDR, &ifr)) goto error; - rte_memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); + memcpy(eth_addr, ifr.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); close(sock); return 0; -- 2.43.0 ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH v5 00/32] replace use of rte_memcpy() with fixed size 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger ` (31 preceding siblings ...) 2024-05-22 3:27 ` [PATCH v5 32/32] net/af_xdp:: " Stephen Hemminger @ 2024-05-26 14:51 ` Mattias Rönnblom 2024-05-26 23:32 ` Stephen Hemminger 32 siblings, 1 reply; 88+ messages in thread From: Mattias Rönnblom @ 2024-05-26 14:51 UTC (permalink / raw) To: Stephen Hemminger, dev On 2024-05-22 05:27, Stephen Hemminger wrote: > The DPDK has a lot of unnecessary usage of rte_memcpy. > This patch set replaces cases where rte_memcpy is used with a fixed > size constant size. > > Typical example is: > rte_memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); > which can be replaced with: > memcpy(mac_addrs, mac.addr_bytes, RTE_ETHER_ADDR_LEN); > > This does not change the resulting binary on almost all architectures > because x86 version of intrisics and glibc are the same, and > other architectures were using __builtin_constant_p(). > > The main benefit is that analysis tools like fortify, Coverity, and ASAN > analyzers can check these memcpy's. A recent example is that > on Ubuntu 22.04 detected undefined use of memcpy such as: > memcpy(dst, NULL, 0) > Would it be possible to instead have a build mode where rte_memcpy() is *always* delegating to memcpy(), and run these tools on that configuration? It seems easier to just always using rte_memcpy() in DPDK code, then let the platform (not the programmer) choose whatever is most appropriate. > The first patch is a simple coccinelle script to do the replacement > and the rest are the results broken out by module. The script can be used > again to make sure more bad usage doesn't creep in with new drivers. > > v5 - rebase and fix a couple of the SW drivers. > rewording of commit messages > > v4 - replace other unnecessary rte_memcpy in ethdev. > replace memcpy with structure assignment where possible. > fixup formatting in a couple places. > > v3 - rebase and rerun coccinelle script on 24.03 > - consolidate patches by subtree > - remove inclusion of rte_memcpy.h when no longer used. > > Stephen Hemminger (32): > cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy > eal: replace use of fixed size rte_memcpy > ethdev: replace uses of rte_memcpy > eventdev: replace use of fixed size rte_memcpy > cryptodev: replace use of fixed size rte_memcpy > ip_frag: replace use of fixed size rte_memcpy > net: replace use of fixed size rte_memcpy > lpm: replace use of fixed size rte_memcpy > node: replace use of fixed size rte_memcpy > pdcp: replace use of fixed size rte_memcpy > pipeline: replace use of fixed size rte_memcpy > rib: replace use of fixed size rte_memcpy > security: replace use of fixed size rte_memcpy > bus: remove unneeded rte_memcpy.h include > raw: replace use of fixed size rte_memcpy > baseband: replace use of fixed size rte_memcpy > common: replace use of fixed size rte_memcpy > crypto: replace use of fixed size rte_memcpy > event: replace use of fixed size rte_memcpy > mempool: replace use of fixed size rte_memcpy > ml/cnxk: replace use of fixed size rte_memcpy > app/test-pmd: replace use of fixed size rte_memcpy > app/graph: replace use of fixed size rte_memcpy > app/test-eventdev: replace use of fixed size rte_memcpy > app/test: replace use of fixed size rte_memcpy > app/test-pipeline: remove unused rte_memcpy.h include > app/test-bbdev: remove unnecessary include of rte_memcpy.h > examples: replace use of fixed size rte_memcpy > net/null: replace use of fixed size memcpy > net/tap: replace use of fixed size rte_memcpy > net/pcap: replace use of fixed size rte_memcpy > net/af_xdp:: replace use of fixed size rte_memcpy > > app/graph/neigh.c | 8 +- > app/test-bbdev/test_bbdev.c | 1 - > app/test-eventdev/test_pipeline_common.c | 19 ++-- > app/test-pipeline/config.c | 1 - > app/test-pipeline/init.c | 1 - > app/test-pipeline/main.c | 1 - > app/test-pipeline/runtime.c | 1 - > app/test-pmd/cmdline.c | 48 ++++----- > app/test-pmd/cmdline_flow.c | 24 ++--- > app/test-pmd/config.c | 8 +- > app/test-pmd/csumonly.c | 1 - > app/test-pmd/flowgen.c | 1 - > app/test-pmd/iofwd.c | 1 - > app/test-pmd/macfwd.c | 1 - > app/test-pmd/macswap.c | 1 - > app/test-pmd/noisy_vnf.c | 1 - > app/test-pmd/rxonly.c | 1 - > app/test-pmd/testpmd.c | 1 - > app/test/commands.c | 1 - > app/test/packet_burst_generator.c | 4 +- > app/test/test_crc.c | 5 +- > app/test/test_cryptodev.c | 18 ++-- > app/test/test_cryptodev_asym.c | 1 - > app/test/test_cryptodev_security_pdcp.c | 1 - > app/test/test_efd.c | 1 - > app/test/test_efd_perf.c | 1 - > app/test/test_event_crypto_adapter.c | 12 +-- > app/test/test_event_dma_adapter.c | 4 +- > app/test/test_eventdev.c | 1 - > app/test/test_ipsec.c | 6 +- > app/test/test_link_bonding_mode4.c | 8 +- > app/test/test_mbuf.c | 1 - > app/test/test_member.c | 1 - > app/test/test_member_perf.c | 1 - > app/test/test_rawdev.c | 1 - > app/test/test_security_inline_proto.c | 36 +++---- > app/test/test_service_cores.c | 1 - > app/test/virtual_pmd.c | 3 +- > devtools/cocci/rte_memcpy.cocci | 11 ++ > drivers/baseband/acc/rte_acc100_pmd.c | 16 ++- > drivers/baseband/acc/rte_vrb_pmd.c | 21 ++-- > drivers/baseband/la12xx/bbdev_la12xx.c | 4 +- > drivers/bus/auxiliary/linux/auxiliary.c | 1 - > drivers/bus/fslmc/fslmc_bus.c | 1 - > drivers/bus/fslmc/fslmc_vfio.c | 1 - > drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c | 1 - > drivers/bus/fslmc/portal/dpaa2_hw_dpci.c | 1 - > drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - > drivers/bus/pci/linux/pci.c | 1 - > drivers/common/idpf/idpf_common_device.c | 4 +- > drivers/common/idpf/idpf_common_virtchnl.c | 10 +- > drivers/common/qat/qat_qp.c | 10 +- > drivers/compress/qat/qat_comp.c | 8 +- > drivers/crypto/ccp/ccp_crypto.c | 14 +-- > drivers/crypto/cnxk/cnxk_cryptodev_ops.c | 2 +- > drivers/crypto/cnxk/cnxk_se.h | 2 +- > drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- > drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- > drivers/crypto/qat/qat_sym_session.c | 52 +++++---- > .../scheduler/rte_cryptodev_scheduler.c | 6 +- > drivers/crypto/scheduler/scheduler_failover.c | 12 +-- > drivers/event/cnxk/cnxk_eventdev_selftest.c | 1 - > drivers/event/cnxk/cnxk_tim_evdev.c | 4 +- > drivers/event/dlb2/dlb2.c | 4 +- > drivers/event/dpaa/dpaa_eventdev.c | 1 - > drivers/event/dpaa2/dpaa2_eventdev.c | 7 +- > drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - > drivers/event/dpaa2/dpaa2_hw_dpcon.c | 1 - > drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - > drivers/event/octeontx/timvf_evdev.c | 4 +- > drivers/mempool/dpaa/dpaa_mempool.c | 4 +- > drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 +- > drivers/ml/cnxk/cn10k_ml_model.c | 8 +- > drivers/ml/cnxk/cn10k_ml_ops.c | 11 +- > drivers/ml/cnxk/cnxk_ml_ops.c | 2 +- > drivers/ml/cnxk/mvtvm_ml_model.c | 8 +- > drivers/ml/cnxk/mvtvm_ml_ops.c | 8 +- > drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- > drivers/net/null/rte_eth_null.c | 6 +- > drivers/net/pcap/pcap_ethdev.c | 2 +- > drivers/net/pcap/pcap_osdep_freebsd.c | 2 +- > drivers/net/pcap/pcap_osdep_linux.c | 2 +- > drivers/net/tap/rte_eth_tap.c | 14 +-- > drivers/raw/ifpga/afu_pmd_he_hssi.c | 3 +- > drivers/raw/ifpga/afu_pmd_he_lpbk.c | 3 +- > drivers/raw/ifpga/afu_pmd_he_mem.c | 3 +- > drivers/raw/ifpga/afu_pmd_n3000.c | 8 +- > drivers/raw/ifpga/ifpga_rawdev.c | 11 +- > drivers/raw/skeleton/skeleton_rawdev.c | 8 +- > drivers/raw/skeleton/skeleton_rawdev_test.c | 1 - > examples/bbdev_app/main.c | 2 +- > examples/bond/main.c | 1 - > examples/ip_fragmentation/main.c | 1 - > examples/ip_reassembly/main.c | 1 - > examples/ipv4_multicast/main.c | 1 - > examples/l2fwd-cat/cat.c | 4 +- > examples/l2fwd-jobstats/main.c | 1 - > examples/l2fwd-keepalive/main.c | 1 - > examples/l2fwd-macsec/main.c | 1 - > examples/l2fwd/main.c | 1 - > examples/l3fwd-power/main.c | 1 - > examples/l3fwd/main.c | 1 - > examples/link_status_interrupt/main.c | 1 - > .../client_server_mp/mp_server/init.c | 1 - > .../client_server_mp/mp_server/main.c | 1 - > examples/multi_process/symmetric_mp/main.c | 1 - > examples/ptpclient/ptpclient.c | 11 +- > examples/qos_sched/app_thread.c | 1 - > examples/qos_sched/main.c | 1 - > examples/server_node_efd/efd_server/init.c | 1 - > examples/server_node_efd/efd_server/main.c | 1 - > examples/vhost/main.c | 6 +- > examples/vmdq/main.c | 7 +- > examples/vmdq_dcb/main.c | 15 +-- > lib/cryptodev/rte_cryptodev.c | 2 +- > lib/eal/common/eal_common_options.c | 7 +- > lib/ethdev/rte_ethdev.c | 12 +-- > lib/ethdev/rte_flow.c | 101 +++++++++--------- > lib/eventdev/rte_event_crypto_adapter.c | 2 +- > lib/eventdev/rte_event_dma_adapter.c | 4 +- > lib/eventdev/rte_event_timer_adapter.c | 2 +- > lib/fib/trie.c | 2 +- > lib/ip_frag/rte_ipv6_fragmentation.c | 4 +- > lib/ip_frag/rte_ipv6_reassembly.c | 6 +- > lib/lpm/rte_lpm6.c | 3 +- > lib/net/rte_ether.c | 2 +- > lib/node/ip6_lookup.c | 8 +- > lib/pdcp/pdcp_process.c | 36 +++---- > lib/pipeline/rte_table_action.c | 8 +- > lib/rib/rte_rib6.h | 5 +- > lib/security/rte_security.c | 4 +- > 131 files changed, 368 insertions(+), 450 deletions(-) > create mode 100644 devtools/cocci/rte_memcpy.cocci > ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH v5 00/32] replace use of rte_memcpy() with fixed size 2024-05-26 14:51 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Mattias Rönnblom @ 2024-05-26 23:32 ` Stephen Hemminger 2024-05-27 6:06 ` Mattias Rönnblom 2024-05-27 6:38 ` Morten Brørup 0 siblings, 2 replies; 88+ messages in thread From: Stephen Hemminger @ 2024-05-26 23:32 UTC (permalink / raw) To: Mattias Rönnblom; +Cc: dev On Sun, 26 May 2024 16:51:52 +0200 Mattias Rönnblom <hofors@lysator.liu.se> wrote: > > This does not change the resulting binary on almost all architectures > > because x86 version of intrisics and glibc are the same, and > > other architectures were using __builtin_constant_p(). > > > > The main benefit is that analysis tools like fortify, Coverity, and ASAN > > analyzers can check these memcpy's. A recent example is that > > on Ubuntu 22.04 detected undefined use of memcpy such as: > > memcpy(dst, NULL, 0) > > > > Would it be possible to instead have a build mode where rte_memcpy() is > *always* delegating to memcpy(), and run these tools on that configuration? > > It seems easier to just always using rte_memcpy() in DPDK code, then let > the platform (not the programmer) choose whatever is most appropriate. I would prefer that rte_memcpy be laid to rest and go away. It never had a reason to be there. ^ permalink raw reply [flat|nested] 88+ messages in thread
* Re: [PATCH v5 00/32] replace use of rte_memcpy() with fixed size 2024-05-26 23:32 ` Stephen Hemminger @ 2024-05-27 6:06 ` Mattias Rönnblom 2024-05-27 6:38 ` Morten Brørup 1 sibling, 0 replies; 88+ messages in thread From: Mattias Rönnblom @ 2024-05-27 6:06 UTC (permalink / raw) To: Stephen Hemminger; +Cc: dev On 2024-05-27 01:32, Stephen Hemminger wrote: > On Sun, 26 May 2024 16:51:52 +0200 > Mattias Rönnblom <hofors@lysator.liu.se> wrote: > >>> This does not change the resulting binary on almost all architectures >>> because x86 version of intrisics and glibc are the same, and >>> other architectures were using __builtin_constant_p(). >>> >>> The main benefit is that analysis tools like fortify, Coverity, and ASAN >>> analyzers can check these memcpy's. A recent example is that >>> on Ubuntu 22.04 detected undefined use of memcpy such as: >>> memcpy(dst, NULL, 0) >>> >> >> Would it be possible to instead have a build mode where rte_memcpy() is >> *always* delegating to memcpy(), and run these tools on that configuration? >> >> It seems easier to just always using rte_memcpy() in DPDK code, then let >> the platform (not the programmer) choose whatever is most appropriate. > > I would prefer that rte_memcpy be laid to rest and go away. Sounds good, but is this piecemeal approach the way to do it. Why ask DPDK programmers to memorize rules about when to use memcpy() and when not to, when that can be coded into the rte_memcpy() implementation. Worst case, when people have learned those rules, we'll change them. "Use rte_memcpy() only for large copies," or whatever it might be. Use rte_memcpy() across the board until memcpy() is a complete replacement, for every use case, for every CPU/compiler/OS. Applications using DPDK will benefit from any heuristics encoded into rte_memcpy.h. The won't run coccinelle script. > It never had a reason to be there. Sure, it did. Historically it has had better performance, up to at least fairly recently that seemed still be the case. I've patched DPDK to replace rte_memcpy() with memcpy() several times, and run with real-world apps. The result is always the same. The compiler is in a better position than DPDK to implement memcpy(), so eventually the compiler will win. ^ permalink raw reply [flat|nested] 88+ messages in thread
* RE: [PATCH v5 00/32] replace use of rte_memcpy() with fixed size 2024-05-26 23:32 ` Stephen Hemminger 2024-05-27 6:06 ` Mattias Rönnblom @ 2024-05-27 6:38 ` Morten Brørup 1 sibling, 0 replies; 88+ messages in thread From: Morten Brørup @ 2024-05-27 6:38 UTC (permalink / raw) To: Stephen Hemminger, Mattias Rönnblom; +Cc: dev > I would prefer that rte_memcpy be laid to rest and go away. > It never had a reason to be there. DPDK still contains remains of hand crafted code dating back from a time where compilers (read: the oldest compilers supported by DPDK) didn't produce efficient code. Rte_memcpy() is a prime example of this. There are other examples, e.g. the use of Duff's Device directly in C source code. This code was written a decade ago, and modern compilers are now much better at producing efficient code. Testing would be able to verify the theory that modern compilers (read: the oldest compilers supported by DPDK) produce code that is as efficient as the hand crafted code. If so, the hand crafted code has outlived its purpose, and should be considered obsolete cruft and be completely removed. Until we are certain that removing it doesn't degrade performance, we should keep it where it makes a difference (in the fast path). Special thanks goes to Stephen for his efforts in cleaning up DPDK! ^ permalink raw reply [flat|nested] 88+ messages in thread
end of thread, other threads:[~2024-05-27 6:38 UTC | newest] Thread overview: 88+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-04-03 16:32 [PATCH 0/2] uuid: enhancements and tests Stephen Hemminger 2024-04-03 16:32 ` [PATCH 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-04 16:11 ` Tyler Retzlaff 2024-04-03 16:32 ` [PATCH 2/2] test: add functional test for uuid Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 0/2] uuid: add generate functions and tests Stephen Hemminger 2024-04-03 22:11 ` [PATCH v2 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-04 16:16 ` Tyler Retzlaff 2024-04-03 22:11 ` [PATCH v2 2/2] test: add functional test for uuid Stephen Hemminger 2024-04-04 16:18 ` Tyler Retzlaff 2024-04-04 16:22 ` [PATCH v3 0/2] uuid: add generate functions and tests Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-04 16:22 ` [PATCH v3 2/2] test: add functional test for uuid Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 00/30] replace use of rte_memcpy with fixed sizes Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 01/30] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger 2024-04-06 9:01 ` Morten Brørup 2024-04-05 16:53 ` [PATCH v4 02/30] eal: replace use of " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 03/30] ethdev: replace uses of rte_memcpy Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 04/30] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 05/30] cryptodev: " Stephen Hemminger 2024-04-10 15:40 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 06/30] ip_frag: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 07/30] net: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 08/30] lpm: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 09/30] node: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 10/30] pdcp: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 11/30] pipeline: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 12/30] rib: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 13/30] security: " Stephen Hemminger 2024-04-10 15:40 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 14/30] bus: remove unneeded rte_memcpy.h include Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 15/30] net: replace use of fixed size rte_memcpy Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 16/30] raw: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 17/30] baseband: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 18/30] common: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 19/30] crypto: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 20/30] " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 21/30] event: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 22/30] mempool: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 23/30] ml/cnxk: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 24/30] app/test-pmd: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 25/30] app/graph: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 26/30] app/test-eventdev: " Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 27/30] app/test: " Stephen Hemminger 2024-04-10 18:28 ` [EXTERNAL] " Akhil Goyal 2024-04-05 16:53 ` [PATCH v4 28/30] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 29/30] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger 2024-04-05 16:53 ` [PATCH v4 30/30] examples: replace use of fixed size rte_memcpy Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 0/2] uuid: generator functions and unit test Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 1/2] eal: add functions to generate uuid values Stephen Hemminger 2024-04-09 17:05 ` [PATCH v4 2/2] test: add functional test for uuid Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 01/32] cocci/rte_memcpy: add script to eliminate fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 02/32] eal: replace use of " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 03/32] ethdev: replace uses of rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 04/32] eventdev: replace use of fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 05/32] cryptodev: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 06/32] ip_frag: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 07/32] net: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 08/32] lpm: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 09/32] node: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 10/32] pdcp: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 11/32] pipeline: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 12/32] rib: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 13/32] security: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 14/32] bus: remove unneeded rte_memcpy.h include Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 15/32] raw: replace use of fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 16/32] baseband: " Stephen Hemminger 2024-05-23 18:28 ` Chautru, Nicolas 2024-05-22 3:27 ` [PATCH v5 17/32] common: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 18/32] crypto: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 19/32] event: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 20/32] mempool: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 21/32] ml/cnxk: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 22/32] app/test-pmd: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 23/32] app/graph: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 24/32] app/test-eventdev: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 25/32] app/test: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 26/32] app/test-pipeline: remove unused rte_memcpy.h include Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 27/32] app/test-bbdev: remove unnecessary include of rte_memcpy.h Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 28/32] examples: replace use of fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 29/32] net/null: replace use of fixed size memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 30/32] net/tap: replace use of fixed size rte_memcpy Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 31/32] net/pcap: " Stephen Hemminger 2024-05-22 3:27 ` [PATCH v5 32/32] net/af_xdp:: " Stephen Hemminger 2024-05-26 14:51 ` [PATCH v5 00/32] replace use of rte_memcpy() with fixed size Mattias Rönnblom 2024-05-26 23:32 ` Stephen Hemminger 2024-05-27 6:06 ` Mattias Rönnblom 2024-05-27 6:38 ` Morten Brørup
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).