From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH 00/32] Use structure assignment instead of memcpy
Date: Sat, 8 Feb 2025 12:21:52 -0800 [thread overview]
Message-ID: <20250208203142.242284-1-stephen@networkplumber.org> (raw)
This patch series reduces use of memcpy and rte_memcpy
in DPDK. It changes memcpy to a simple assignment operator
which easier to read, generates the same code, and
keeps type safety.
Historically memcpy was used in textbooks because there
was no structure assignement in original K&R C.
Stephen Hemminger (32):
devtools/cocci: prefer structure assignment over memcpy
app/testpmd: replace memcpy with assignment
app/graph: replace memcpy with structure assignment
crypto/dpaa_sec: replace memcpy with assignment
dma/dpaa2: replace memcpy with assignment
eventdev: replace memcpy with assignment
event/dpaa2: replace memcpy with structure assignment
event/dsw: replace memcpy with assignment
ml/cnxk: replace memcpy with assignment
examples: replace memcpy with assignment
node: replace memcpy with assignment
pipeline: replace memcpy with assignment
sched: replace memcpy with structure assignment
table: replace memcpy with structure assignment
net/ntnic: replace memcpy with structure assignment
net/bnxt: replace memcpy with structure assignment
crypto/qat: replace memcpy with structure assignment
mempool/cnxk: replace memcpy with structure assignment
net/dpaa2: replace memcpy with assignment
net/enic: replace memcpy with assignment
net/intel/i40e: replace memcpy with structure assignment
net/nfp: replace memcpy with assignment
net/txgbe: replace memcpy with assignment
net/bnx2x: replace memcpy with structure assignment
net/dpaa2: replace memcpy with structure assignment
net/bonding: replace memcpy with structure assignment
net/cnxk: replace memcpy with structure assignment
net/enic: replace memcpy with structure assignment
net/iavf: replace memcpy with structure assignment
net/ice: replace memcpy with structure assignment
test: replace memcpy with structure assignment
test/cryptodev: replace memcpy with structure assignment
app/graph/ethdev.c | 2 +-
app/test-pmd/cmdline_flow.c | 2 +-
app/test/test_acl.c | 5 ++-
app/test/test_compressdev.c | 36 +++++++------------
app/test/test_cryptodev.c | 3 +-
app/test/test_security_inline_proto.c | 23 +++++-------
devtools/cocci/struct-assign.cocci | 15 ++++++++
drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +-
drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 3 +-
drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c | 3 +-
drivers/dma/dpaa2/dpaa2_qdma.c | 4 +--
drivers/event/dpaa2/dpaa2_eventdev.c | 7 ++--
drivers/event/dsw/dsw_event.c | 3 +-
drivers/mempool/cnxk/cnxk_mempool_ops.c | 2 +-
drivers/ml/cnxk/cnxk_ml_ops.c | 2 +-
drivers/net/bnx2x/bnx2x_stats.c | 2 +-
drivers/net/bnxt/bnxt_hwrm.c | 3 +-
drivers/net/bnxt/tf_core/tf_rm.c | 8 ++---
drivers/net/bnxt/tf_ulp/ulp_tun.c | 3 +-
drivers/net/bonding/rte_eth_bond_pmd.c | 2 +-
drivers/net/cnxk/cnxk_ethdev_cman.c | 2 +-
drivers/net/dpaa2/dpaa2_ethdev.c | 5 ++-
drivers/net/dpaa2/dpaa2_flow.c | 9 ++---
drivers/net/dpaa2/dpaa2_mux.c | 2 +-
drivers/net/enic/enic_fm_flow.c | 2 +-
drivers/net/enic/enic_main.c | 2 +-
drivers/net/intel/i40e/i40e_ethdev.c | 6 ++--
drivers/net/intel/i40e/i40e_fdir.c | 3 +-
drivers/net/intel/i40e/i40e_flow.c | 3 +-
drivers/net/intel/i40e/rte_pmd_i40e.c | 3 +-
drivers/net/intel/iavf/iavf_ipsec_crypto.c | 3 +-
drivers/net/intel/ice/ice_hash.c | 6 ++--
drivers/net/intel/ixgbe/ixgbe_flow.c | 4 +--
.../net/nfp/flower/nfp_flower_representor.c | 2 +-
.../net/ntnic/nthw/flow_api/flow_id_table.c | 4 +--
.../profile_inline/flow_api_profile_inline.c | 2 +-
drivers/net/txgbe/txgbe_flow.c | 4 +--
examples/bbdev_app/main.c | 2 +-
examples/ip_pipeline/parser.c | 2 +-
examples/l2fwd-cat/cat.c | 3 +-
examples/ptpclient/ptpclient.c | 4 +--
lib/eventdev/rte_event_dma_adapter.c | 2 +-
lib/eventdev/rte_event_timer_adapter.c | 2 +-
lib/node/ethdev_rx.c | 2 +-
lib/node/ip4_reassembly.c | 2 +-
lib/node/kernel_rx.c | 2 +-
lib/pipeline/rte_pipeline.c | 6 ++--
lib/pipeline/rte_swx_ctl.c | 2 +-
lib/pipeline/rte_swx_ipsec.c | 2 +-
lib/pipeline/rte_swx_pipeline_spec.c | 36 +++++++------------
lib/sched/rte_sched.c | 2 +-
lib/table/rte_swx_table_selector.c | 2 +-
52 files changed, 108 insertions(+), 155 deletions(-)
create mode 100644 devtools/cocci/struct-assign.cocci
--
2.47.2
next reply other threads:[~2025-02-08 20:31 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-08 20:21 Stephen Hemminger [this message]
2025-02-08 20:21 ` [PATCH 01/32] devtools/cocci: prefer structure assignment over memcpy Stephen Hemminger
2025-02-08 20:21 ` [PATCH 02/32] app/testpmd: replace memcpy with assignment Stephen Hemminger
2025-02-08 20:21 ` [PATCH 03/32] app/graph: replace memcpy with structure assignment Stephen Hemminger
2025-02-08 20:21 ` [PATCH 04/32] crypto/dpaa_sec: replace memcpy with assignment Stephen Hemminger
2025-02-08 20:21 ` [PATCH 05/32] dma/dpaa2: " Stephen Hemminger
2025-02-08 20:21 ` [PATCH 06/32] eventdev: " Stephen Hemminger
2025-02-08 20:21 ` [PATCH 07/32] event/dpaa2: replace memcpy with structure assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 08/32] event/dsw: replace memcpy with assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 09/32] ml/cnxk: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 10/32] examples: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 11/32] node: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 12/32] pipeline: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 13/32] sched: replace memcpy with structure assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 14/32] table: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 15/32] net/ntnic: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 16/32] net/bnxt: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 17/32] crypto/qat: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 18/32] mempool/cnxk: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 19/32] net/dpaa2: replace memcpy with assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 20/32] net/enic: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 21/32] net/intel/i40e: replace memcpy with structure assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 22/32] net/nfp: replace memcpy with assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 23/32] net/txgbe: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 24/32] net/bnx2x: replace memcpy with structure assignment Stephen Hemminger
2025-02-08 20:22 ` [PATCH 25/32] net/dpaa2: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 26/32] net/bonding: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 27/32] net/cnxk: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 28/32] net/enic: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 29/32] net/iavf: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 30/32] net/ice: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 31/32] test: " Stephen Hemminger
2025-02-08 20:22 ` [PATCH 32/32] test/cryptodev: " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250208203142.242284-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).