Skip to content

Use structure assignment instead of memcpy

Stephen Hemminger dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest32 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/32devtools/cocci: prefer structure assignment over memcpydevtools/cocci/struct-assign.cocci+15 -00 replies
2/32app/testpmd: replace memcpy with assignmentapp/test-pmd/cmdline_flow.c+1 -10 replies
3/32app/graph: replace memcpy with structure assignmentapp/graph/ethdev.c+1 -10 replies
4/32crypto/dpaa_sec: replace memcpy with assignmentdrivers/crypto/dpaa_sec/dpaa_sec.c+1 -11 reply
5/32dma/dpaa2: replace memcpy with assignmentdrivers/dma/dpaa2/dpaa2_qdma.c+1 -31 reply
6/32eventdev: replace memcpy with assignmentlib/eventdev/rte_event_dma_adapter.c lib/eventdev/rte_event_timer_adapter.c+2 -20 replies
7/32event/dpaa2: replace memcpy with structure assignmentdrivers/event/dpaa2/dpaa2_eventdev.c+3 -41 reply
8/32event/dsw: replace memcpy with assignmentdrivers/event/dsw/dsw_event.c+1 -21 reply
9/32ml/cnxk: replace memcpy with assignmentdrivers/ml/cnxk/cnxk_ml_ops.c+1 -10 replies
10/32examples: replace memcpy with assignmentexamples/bbdev_app/main.c examples/l2fwd-cat/cat.c examples/ptpclient/ptpclient.c+3 -60 replies
11/32node: replace memcpy with assignmentlib/node/ethdev_rx.c lib/node/ip4_reassembly.c lib/node/kernel_rx.c+3 -30 replies
12/32pipeline: replace memcpy with assignmentexamples/ip_pipeline/parser.c lib/pipeline/rte_pipeline.c lib/pipeline/rte_swx_ctl.c +2 more+18 -300 replies
13/32sched: replace memcpy with structure assignmentlib/sched/rte_sched.c+1 -10 replies
14/32table: replace memcpy with structure assignmentlib/table/rte_swx_table_selector.c+1 -10 replies
15/32net/ntnic: replace memcpy with structure assignmentdrivers/net/ntnic/nthw/flow_api/flow_id_table.c drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c+3 -30 replies
16/32net/bnxt: replace memcpy with structure assignmentdrivers/net/bnxt/bnxt_hwrm.c drivers/net/bnxt/tf_core/tf_rm.c drivers/net/bnxt/tf_ulp/ulp_tun.c+4 -101 reply
17/32crypto/qat: replace memcpy with structure assignmentdrivers/crypto/qat/dev/qat_crypto_pmd_gen3.c drivers/crypto/qat/dev/qat_crypto_pmd_gen5.c+2 -40 replies
18/32mempool/cnxk: replace memcpy with structure assignmentdrivers/mempool/cnxk/cnxk_mempool_ops.c+1 -10 replies
19/32net/dpaa2: replace memcpy with assignmentdrivers/net/dpaa2/dpaa2_mux.c+1 -11 reply
20/32net/enic: replace memcpy with assignmentdrivers/net/enic/enic_main.c+1 -10 replies
21/32net/intel/i40e: replace memcpy with structure assignmentdrivers/net/intel/i40e/i40e_ethdev.c drivers/net/intel/i40e/i40e_fdir.c drivers/net/intel/i40e/i40e_flow.c +2 more+6 -130 replies
22/32net/nfp: replace memcpy with assignmentdrivers/net/nfp/flower/nfp_flower_representor.c+1 -11 reply
23/32net/txgbe: replace memcpy with assignmentdrivers/net/txgbe/txgbe_flow.c+1 -30 replies
24/32net/bnx2x: replace memcpy with structure assignmentdrivers/net/bnx2x/bnx2x_stats.c+1 -10 replies
25/32net/dpaa2: replace memcpy with structure assignmentdrivers/net/dpaa2/dpaa2_ethdev.c drivers/net/dpaa2/dpaa2_flow.c+5 -91 reply
26/32net/bonding: replace memcpy with structure assignmentdrivers/net/bonding/rte_eth_bond_pmd.c+1 -10 replies
27/32net/cnxk: replace memcpy with structure assignmentdrivers/net/cnxk/cnxk_ethdev_cman.c+1 -10 replies
28/32net/enic: replace memcpy with structure assignmentdrivers/net/enic/enic_fm_flow.c+1 -10 replies
29/32net/iavf: replace memcpy with structure assignmentdrivers/net/intel/iavf/iavf_ipsec_crypto.c+1 -20 replies
30/32net/ice: replace memcpy with structure assignmentdrivers/net/intel/ice/ice_hash.c+2 -40 replies
31/32test: replace memcpy with structure assignmentapp/test/test_acl.c app/test/test_compressdev.c app/test/test_security_inline_proto.c+23 -410 replies
32/32test/cryptodev: replace memcpy with structure assignmentapp/test/test_cryptodev.c+1 -20 replies

Reviews trailers per patch

8 of 32 patches have a Reviewed-by or Acked-by.

PatchChaoyong HeSomnath KoturHemant AgrawalMattias Rönnblom
1/32
2/32
3/32
4/32A-b
5/32A-b
6/32
7/32A-b
8/32A-b
9/32
10/32
11/32
12/32
13/32
14/32
15/32
16/32A-b
17/32
18/32
19/32A-b
20/32
21/32
22/32A-b
23/32
24/32
25/32A-b
26/32
27/32
28/32
29/32
30/32
31/32
32/32

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH 00/32] Use structure assignment instead of memcpy

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
Signature · 1 line
2.47.2