reduce use of rte_memcpy
Subsystems (8)
cover reduce use of rte_memcpy
The DPDK function rte_memcpy() only exists as an optimization for shortcomings in performance of libc memcpy() on some platforms. Many platforms have no special rte_memcpy() and just use memcpy().
But many analysis and test tools know that memcpy() is a special case and check for overwrite, bounds errors etc. Therefore memcpy() should be preferred wherever possible.
This patch series introduces a coccinelle script to find calls to rte_memcpy() where size is fixed, and change them to regular memcpy(). This was the starting point for this cleanup.
There is also some cleanups to include rte_memcpy.h and string.h where needed. Often the includes were happening by some other header. And also removal of rte_memcpy.h where no longer needed.
The result is a 46% reduction in use of rte_memcpy. The remaining rte_memcpy can be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes to rte_memcpy which need benchmarking;
- test code for rte_memcpy can be removed as last step.
No functional change, no warnings in all compilers including LTO.
Stephen Hemminger (61):
devtools/cocci: add script to replace fixed size rte_memcpy app/testpmd: replace rte_memcpy with memcpy
test: use memcpy instead of rte_memcpy
app/graph: replace rte_memcpy with memcpy
lpm: remove unnecessary include of rte_memcpy.h
acl: remove unnecessary include of rte_memcpy.h drivers/bus: remove unnecessary include of rte_memcpy.h
security: replace fixed size rte_memcpy
ethdev: replace use of rte_memcpy
net: replace use of rte_memcpy
pdcp: replace use of rte_memcpy
eventdev: replace fixed size rte_memcpy
eal: replace rte_memcpy of cpuset
cryptodev: replace use of rte_memcpy
drivers/raw: use memcpy for fixed size data
test-pipeline: replace use of rte_memcpy net/af_xdp: replace use of rte_memcpy
net/avp: replace use of rte_memcpy
net/axgbe: replace use of rte_memcpy
net/bnx2x: replace use of rte_memcpy
net/bnxt: replace use of rte_memcpy
net/bonding: replace use of rte_memcpy
net/cnxk: replace use of rte_memcpy
net/cxgbe: replace use of rte_memcpy
net/dpaa2: replace use of rte_memcpy
net/enic: replace use of rte_memcpy
net/failsafe: replace use of rte_memcpy
net/gve: replace use of rte_memcpy
net/hinic: replace use of rte_memcpy
net/hns3: replace use of rte_memcpy
net/mlx5: replace use of rte_memcpy
net/mvpp2: replace use of rte_memcpy
net/netvsc: replace use of rte_memcpy
net/nfp: replace use of rte_memcpy
net/ngbe: replace use of rte_memcpy
net/ntnic: replace use of rte_memcpy
net/null: replace use of rte_memcpy
net/qede: replace use of rte_memcpy
net/ring: replace use of rte_memcpy
net/sfc: replace use of rte_memcpy
net/txgbe: replace use of rte_memcpy
net/vhost: replace use of rte_memcpy
net/virtio: replace use of rte_memcpy
net/sxe2: replace use of rte_memcpy
net/zxdh: replace use of rte_memcpy
net/memif: use memcpy for fixed size data net/ice: use memcpy for fixed size data
test-bbdev: remove unnecessary include rte_memcpy.h drivers/mempool: use memcpy for fixed size data ml/cnxk: use memcpy for fixed size data drivers/event: use memcpy for fixed size data baseband/la12xx: use memcpy for fixed size data baseband/acc: replace use of rte_memcpy drivers/*/qat: use memcpy for fixed size data
hash: replace use of rte_memcpy
rib: remove rte_memcpy include
pcapng: replace use of rte_memcpy
efd: replace use of rte_memcpy
net/xsc: replace use of rte_memcpy
net/pcap: replace use of rte_memcpy
power: replace use of rte_memcpy
app/graph/neigh.c | 8 +- app/test-bbdev/test_bbdev.c | 1 - app/test-eventdev/test_pipeline_common.c | 8 +- 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 | 28 ++--- app/test-pmd/cmdline_flow.c | 34 +++--- app/test-pmd/config.c | 13 +-- 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-pmd/txonly.c | 7 +- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 10 +- app/test/test_bpf.c | 1 + app/test/test_crc.c | 7 +- app/test/test_cryptodev.c | 14 +-- app/test/test_cryptodev.h | 1 + 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_eventdev.c | 1 - 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_ring.h | 17 ++- app/test/test_security_inline_macsec.c | 2 +- app/test/test_security_inline_proto.c | 42 +++---- app/test/test_security_proto.c | 2 +- app/test/test_service_cores.c | 1 - app/test/test_thash.c | 4 +- app/test/virtual_pmd.c | 5 +- devtools/cocci/rte_memcpy_fixed.cocci | 15 +++ drivers/baseband/acc/rte_acc100_pmd.c | 7 +- 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_dpcon.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - 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_se.h | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 +- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 10 +- drivers/crypto/qat/qat_sym_session.c | 33 +++--- .../scheduler/rte_cryptodev_scheduler.c | 6 +- drivers/crypto/scheduler/scheduler_failover.c | 12 +- drivers/crypto/zsda/zsda_crypto_session.c | 6 +- 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 | 3 +- drivers/event/dpaa2/dpaa2_eventdev_selftest.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 | 8 +- drivers/ml/cnxk/tvmrt_ml_model.c | 9 +- drivers/ml/cnxk/tvmrt_ml_ops.c | 6 +- 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/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_mux.c | 36 +++--- 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/enic/enic_main.c | 6 +- drivers/net/failsafe/failsafe_ops.c | 10 +- drivers/net/gve/base/gve_adminq.c | 2 +- drivers/net/hinic/hinic_pmd_ethdev.c | 1 - drivers/net/hinic/hinic_pmd_flow.c | 41 ++++--- drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_flow.c | 4 +- drivers/net/intel/ice/ice_fdir_filter.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 | 31 +++--- 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 +-- drivers/net/nfp/nfp_mtr.c | 10 +- drivers/net/ngbe/ngbe_pf.c | 4 +- drivers/net/ntnic/ntnic_ethdev.c | 11 +- drivers/net/null/rte_eth_null.c | 12 +- drivers/net/pcap/pcap_ethdev.c | 9 +- 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/sxe2/sxe2_cmd_chnl.c | 6 +- drivers/net/sxe2/sxe2_flow.c | 11 +- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 36 +++--- drivers/net/sxe2/sxe2_ipsec.c | 2 +- drivers/net/sxe2/sxe2_rss.c | 10 +- drivers/net/sxe2/sxe2_rx.c | 4 +- drivers/net/sxe2/sxe2_stats.c | 25 +++-- drivers/net/sxe2/sxe2_tm.c | 4 +- drivers/net/txgbe/txgbe_ethdev.c | 9 +- drivers/net/txgbe/txgbe_fdir.c | 11 +- drivers/net/txgbe/txgbe_flow.c | 73 ++++++------ drivers/net/txgbe/txgbe_ipsec.c | 8 +- drivers/net/txgbe/txgbe_pf.c | 6 +- drivers/net/txgbe/txgbe_tm.c | 11 +- drivers/net/vhost/rte_eth_vhost.c | 1 - drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/xsc/xsc_dev.c | 2 +- drivers/net/zxdh/zxdh_common.c | 7 +- drivers/net/zxdh/zxdh_flow.c | 67 ++++++----- drivers/net/zxdh/zxdh_msg.c | 15 +-- drivers/net/zxdh/zxdh_mtr.c | 10 +- drivers/net/zxdh/zxdh_np.c | 1 - drivers/net/zxdh/zxdh_queue.c | 8 +- drivers/net/zxdh/zxdh_tables.c | 21 ++-- drivers/power/acpi/acpi_cpufreq.c | 4 +- drivers/power/amd_pstate/amd_pstate_cpufreq.c | 4 +- drivers/power/amd_uncore/amd_uncore.c | 5 +- drivers/power/cppc/cppc_cpufreq.c | 4 +- .../power/intel_pstate/intel_pstate_cpufreq.c | 3 +- drivers/power/intel_uncore/intel_uncore.c | 5 +- drivers/raw/ifpga/afu_pmd_he_hssi.c | 4 +- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 4 +- drivers/raw/ifpga/afu_pmd_he_mem.c | 4 +- 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 - lib/acl/rte_acl_osdep.h | 1 - lib/cryptodev/rte_cryptodev.c | 12 +- lib/eal/common/eal_common_options.c | 6 +- lib/efd/rte_efd.c | 3 +- lib/ethdev/rte_ethdev.c | 3 +- lib/ethdev/rte_flow.c | 104 ++++++++---------- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/hash/rte_thash.c | 4 +- lib/lpm/rte_lpm6.c | 1 - lib/net/rte_ether.c | 2 +- lib/pcapng/rte_pcapng.c | 2 +- lib/pdcp/pdcp_process.c | 51 +++++---- lib/rib/rte_rib6.h | 1 - lib/security/rte_security.c | 4 +- 190 files changed, 746 insertions(+), 807 deletions(-) create mode 100644 devtools/cocci/rte_memcpy_fixed.cocci
Signature · 1 line
2.53.0
PATCH 1/61 devtools/cocci: add script to replace fixed size rte_memcpy
Rte_memcpy need not be used for the simple case of copying a fix sized because it is not faster and will hide problems from code analysis tools. Static and dynamic analyzers special case memcpy() and can find issues that rte_memcpy() will hide.
Note: 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.
--- devtools/cocci/rte_memcpy_fixed.cocci | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 devtools/cocci/rte_memcpy_fixed.cocci
devtools/cocci/rte_memcpy_fixed.cocci new file +15 -0
@@ -0,0 +1,15 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst, E; +constant size; +@@ +( +- rte_memcpy(dst, src, sizeof(E)) ++ memcpy(dst, src, sizeof(E)) +| +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +)
Signature · 1 line
2.53.0
PATCH 2/61 app/testpmd: replace rte_memcpy with memcpy
In reply to Stephen HemmingerThe standard C library memcpy is as fast and has more checking by analysis tools than DPDK rte_memcpy.
--- app/test-pmd/cmdline.c | 28 ++++++++++++++-------------- app/test-pmd/cmdline_flow.c | 34 +++++++++++++++++----------------- app/test-pmd/config.c | 13 ++++++------- 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-pmd/txonly.c | 7 +++---- 12 files changed, 40 insertions(+), 50 deletions(-)
app/test-pmd/cmdline.c +14 -14
@@ -10516,7 +10516,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;
@@ -10530,9 +10530,9 @@ 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, +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, +memcpy (vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -10711,7 +10711,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);
@@ -10721,9 +10721,9 @@ 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, +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, +memcpy (nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -10838,9 +10838,9 @@ 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, +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, +memcpy (l2_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -11020,7 +11020,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);
@@ -11030,9 +11030,9 @@ 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, +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, +memcpy (mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -11256,7 +11256,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) {
@@ -11268,9 +11268,9 @@ 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, +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, +memcpy (mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
app/test-pmd/cmdline_flow.c +17 -17
@@ -13967,31 +13967,31 @@ cmd_set_raw_parsed_sample(const struct buffer *in)switch (action->type) {case RTE_FLOW_ACTION_TYPE_MARK : size =sizeof (struct rte_flow_action_mark ); -rte_memcpy (&sample_mark[idx], +memcpy (&sample_mark[idx], (const void *)action->conf, size); action->conf = &sample_mark[idx];break ;case RTE_FLOW_ACTION_TYPE_COUNT : size =sizeof (struct rte_flow_action_count ); -rte_memcpy (&sample_count[idx], +memcpy (&sample_count[idx], (const void *)action->conf, size); action->conf = &sample_count[idx];break ;case RTE_FLOW_ACTION_TYPE_QUEUE : size =sizeof (struct rte_flow_action_queue ); -rte_memcpy (&sample_queue[idx], +memcpy (&sample_queue[idx], (const void *)action->conf, size); action->conf = &sample_queue[idx];break ;case RTE_FLOW_ACTION_TYPE_RSS : size =sizeof (struct rte_flow_action_rss ); rss = action->conf; -rte_memcpy (&sample_rss_data[idx].conf, +memcpy (&sample_rss_data[idx].conf, (const void *)rss, size);if (rss->key_len && rss->key) { sample_rss_data[idx].conf.key = sample_rss_data[idx].key; -rte_memcpy ((void *)((uintptr_t ) +memcpy ((void *)((uintptr_t ) sample_rss_data[idx].conf.key), (const void *)rss->key,sizeof (uint8_t ) * rss->key_len);
@@ -13999,7 +13999,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in)if (rss->queue_num && rss->queue) { sample_rss_data[idx].conf.queue = sample_rss_data[idx].queue; -rte_memcpy ((void *)((uintptr_t ) +memcpy ((void *)((uintptr_t ) sample_rss_data[idx].conf.queue), (const void *)rss->queue,sizeof (uint16_t ) * rss->queue_num);
@@ -14008,13 +14008,13 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_RAW_ENCAP : size =sizeof (struct rte_flow_action_raw_encap ); -rte_memcpy (&sample_encap[idx], +memcpy (&sample_encap[idx], (const void *)action->conf, size); action->conf = &sample_encap[idx];break ;case RTE_FLOW_ACTION_TYPE_PORT_ID : size =sizeof (struct rte_flow_action_port_id ); -rte_memcpy (&sample_port_id[idx], +memcpy (&sample_port_id[idx], (const void *)action->conf, size); action->conf = &sample_port_id[idx];break ;
@@ -14022,7 +14022,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_VF : size =sizeof (struct rte_flow_action_vf ); -rte_memcpy (&sample_vf[idx], +memcpy (&sample_vf[idx], (const void *)action->conf, size); action->conf = &sample_vf[idx];break ;
@@ -14038,13 +14038,13 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : size =sizeof (struct rte_flow_action_ethdev ); -rte_memcpy (&sample_port_representor[idx], +memcpy (&sample_port_representor[idx], (const void *)action->conf, size); action->conf = &sample_port_representor[idx];break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : size =sizeof (struct rte_flow_action_ethdev ); -rte_memcpy (&sample_represented_port[idx], +memcpy (&sample_represented_port[idx], (const void *)action->conf, size); action->conf = &sample_represented_port[idx];break ;
@@ -14177,7 +14177,7 @@ cmd_set_raw_parsed(const struct buffer *in)if (geneve_opt->option_len && geneve_opt->data) { *total_size += geneve_opt->option_len *sizeof (uint32_t ); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), geneve_opt->data, geneve_opt->option_len *sizeof (uint32_t )); }
@@ -14217,7 +14217,7 @@ 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), +memcpy (data_tail - (*total_size), &ext_word,sizeof (ext_word)); } size =sizeof (struct rte_gtp_hdr );
@@ -14263,19 +14263,19 @@ cmd_set_raw_parsed(const struct buffer *in)if (gre_opt->checksum_rsvd.checksum) { *total_size +=sizeof (gre_opt->checksum_rsvd); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->checksum_rsvd,sizeof (gre_opt->checksum_rsvd)); }if (gre_opt->key.key) { *total_size +=sizeof (gre_opt->key.key); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->key.key,sizeof (gre_opt->key.key)); }if (gre_opt->sequence.sequence) { *total_size +=sizeof (gre_opt->sequence.sequence); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->sequence.sequence,sizeof (gre_opt->sequence.sequence)); }
@@ -14288,7 +14288,7 @@ cmd_set_raw_parsed(const struct buffer *in) }if (size) { *total_size += size; -rte_memcpy (data_tail - (*total_size), src_spec, size); +memcpy (data_tail - (*total_size), src_spec, size);/* update some fields which cannot be set by cmdline */ update_fields ((data_tail - (*total_size)), item, upper_layer);
app/test-pmd/config.c +6 -7
@@ -24,7 +24,6 @@#include <rte_debug.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_bus.h>
@@ -2263,9 +2262,9 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id, pft->num_pmd_actions, &error);return NULL ; } -rte_memcpy (pft->actions, pft->pmd_actions, +memcpy (pft->actions, pft->pmd_actions, pft->num_pmd_actions *sizeof (actions[0 ])); -rte_memcpy (pft->actions + pft->num_pmd_actions, actions, +memcpy (pft->actions + pft->num_pmd_actions, actions, num_actions *sizeof (actions[0 ])); }if (tunnel_ops->items) {
@@ -2291,9 +2290,9 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id, pft->num_pmd_items, &error);return NULL ; } -rte_memcpy (pft->items, pft->pmd_items, +memcpy (pft->items, pft->pmd_items, pft->num_pmd_items *sizeof (pattern[0 ])); -rte_memcpy (pft->items + pft->num_pmd_items, pattern, +memcpy (pft->items + pft->num_pmd_items, pattern, num_items *sizeof (pattern[0 ])); }
@@ -2731,7 +2730,7 @@ 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->attr, table_attr, +memcpy (&pt->attr, table_attr,sizeof (struct rte_flow_template_table_attr ));printf ("Template table #%u created\n" , pt->id);return 0 ;
@@ -3367,7 +3366,7 @@ 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, +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 ;
app/test-pmd/csumonly.c +0 -1
@@ -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>
app/test-pmd/flowgen.c +0 -1
@@ -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>
app/test-pmd/iofwd.c +0 -1
@@ -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>
app/test-pmd/macfwd.c +0 -1
@@ -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>
app/test-pmd/macswap.c +0 -1
@@ -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>
app/test-pmd/noisy_vnf.c +0 -1
@@ -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>
app/test-pmd/rxonly.c +0 -1
@@ -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>
app/test-pmd/testpmd.c +0 -1
@@ -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>
app/test-pmd/txonly.c +3 -4
@@ -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>
@@ -80,21 +79,21 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, copy_len = seg->data_len - offset; seg_buf = rte_pktmbuf_mtod_offset(seg, char *, offset);while (len > copy_len) { -rte_memcpy (seg_buf, buf, (size_t ) copy_len); +memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; seg_buf = rte_pktmbuf_mtod(seg, char *); copy_len = seg->data_len; } -rte_memcpy (seg_buf, buf, (size_t ) len); +memcpy (seg_buf, buf, (size_t ) len); }static inline void copy_buf_to_pkt (void * buf,unsigned len,struct rte_mbuf *pkt,unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), + memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);return ; }
Signature · 1 line
2.53.0
PATCH 3/61 test: use memcpy instead of rte_memcpy
In reply to Stephen HemmingerIf size is constant, better to use C library memcpy which has more coverage from ASAN and static analysis tools.
--- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 10 +++--- app/test/test_bpf.c | 1 + app/test/test_crc.c | 7 ++--- app/test/test_cryptodev.c | 14 ++++----- app/test/test_cryptodev.h | 1 + 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_eventdev.c | 1 - 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_ring.h | 17 +++++----- app/test/test_security_inline_macsec.c | 2 +- app/test/test_security_inline_proto.c | 42 ++++++++++++------------- app/test/test_security_proto.c | 2 +- app/test/test_service_cores.c | 1 - app/test/test_thash.c | 4 +-- app/test/virtual_pmd.c | 5 +-- 24 files changed, 62 insertions(+), 74 deletions(-)
app/test/commands.c +0 -1
@@ -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>
app/test/packet_burst_generator.c +5 -5
@@ -31,20 +31,20 @@ copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt, copy_len = seg->data_len - offset; seg_buf = rte_pktmbuf_mtod_offset(seg, char *, offset);while (len > copy_len) { -rte_memcpy (seg_buf, buf, (size_t ) copy_len); +memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; seg_buf = rte_pktmbuf_mtod(seg, void *); } -rte_memcpy (seg_buf, buf, (size_t ) len); +memcpy (seg_buf, buf, (size_t ) len); }static inline void copy_buf_to_pkt (void *buf,unsigned len,struct rte_mbuf *pkt,unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, + memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);return ; }
@@ -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 )); }
app/test/test_bpf.c +1 -0
@@ -12,6 +12,7 @@#include <rte_debug.h> #include <rte_hexdump.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_random.h> #include <rte_byteorder.h> #include <rte_errno.h>
app/test/test_crc.c +3 -4
@@ -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
@@ -116,14 +115,14 @@ crc_autotest(void)if (test_data ==NULL )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 ); ret |=crc_all_algs ("32-bit ethernet CRC: Test 2" ,RTE_NET_CRC32_ETH , test_data,CRC32_VEC_LEN1 , crc32_vec1_res);/* 32-bit ethernet CRC: Test 3 */ memset (test_data,0 ,CRC32_VEC_LEN1 );for (i =0 ; i <CRC32_VEC_LEN2 ; i +=12 ) -rte_memcpy (&test_data[i], crc32_vec1,12 ); +memcpy (&test_data[i], crc32_vec1,12 ); ret |=crc_all_algs ("32-bit ethernet CRC: Test 3" ,RTE_NET_CRC32_ETH , test_data,CRC32_VEC_LEN2 , crc32_vec2_res);
@@ -142,7 +141,7 @@ crc_autotest(void)/* 16-bit CCITT CRC: Test 7 */ memset (test_data,0 ,CRC32_VEC_LEN1 );for (i =0 ; i <CRC16_VEC_LEN3 ; i +=12 ) -rte_memcpy (&test_data[i], crc16_vec1,12 ); +memcpy (&test_data[i], crc16_vec1,12 ); ret |=crc_all_algs ("16-bit CCITT CRC: Test 7" ,RTE_NET_CRC16_CCITT , test_data,CRC16_VEC_LEN3 , crc16_vec3_res);return ret;
app/test/test_cryptodev.c +6 -8
@@ -2711,8 +2711,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 ;
@@ -2846,9 +2846,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,
@@ -2871,8 +2869,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 ;
@@ -9238,7 +9236,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 {
app/test/test_cryptodev.h +1 -0
@@ -5,6 +5,7 @@#define TEST_CRYPTODEV_H_ #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <rte_security.h> #define MAX_NUM_OPS_INFLIGHT (4096)
app/test/test_cryptodev_asym.c +0 -1
@@ -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>
app/test/test_cryptodev_security_pdcp.c +0 -1
@@ -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>
app/test/test_efd.c +0 -1
@@ -13,7 +13,6 @@ test_efd(void)#else -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_efd.h> #include <rte_byteorder.h>
app/test/test_efd_perf.c +0 -1
@@ -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
app/test/test_event_crypto_adapter.c +6 -6
@@ -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);
app/test/test_eventdev.c +0 -1
@@ -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
app/test/test_link_bonding_mode4.c +4 -4
@@ -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); }
app/test/test_mbuf.c +0 -1
@@ -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>
app/test/test_member.c +0 -1
@@ -7,7 +7,6 @@#include <math.h> #include "test.h" -#include <rte_memcpy.h> #include <rte_malloc.h> #ifdef RTE_EXEC_ENV_WINDOWS
app/test/test_member_perf.c +0 -1
@@ -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>
app/test/test_rawdev.c +0 -1
@@ -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
app/test/test_ring.h +8 -9
@@ -2,8 +2,9 @@* Copyright(c) 2019 Arm Limited */ +#include <string.h> +#include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_ptr_compress.h> #include <rte_ring.h> #include <rte_ring_elem.h>
@@ -166,11 +167,10 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n, r, esize, n, &zcd, NULL);if (unlikely (ret ==0 ))return 0 ; -rte_memcpy (zcd.ptr1, (char *)obj, zcd.n1 * esize); +memcpy (zcd.ptr1, (char *)obj, zcd.n1 * esize);if (unlikely (zcd.ptr2 !=NULL )) -rte_memcpy (zcd.ptr2, - (char *)obj + zcd.n1 * esize, - (ret - zcd.n1) * esize); +memcpy (zcd.ptr2, (char *)obj + zcd.n1 * esize, + (ret - zcd.n1) * esize);rte_ring_enqueue_zc_finish (r, ret);return ret;case (TEST_RING_ELEM_BURST_ZC_COMPRESS_PTR_16 ):
@@ -271,11 +271,10 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n, r, esize, n, &zcd, NULL);if (unlikely (ret ==0 ))return 0 ; -rte_memcpy ((char *)obj, zcd.ptr1, zcd.n1 * esize); +memcpy (obj, zcd.ptr1, zcd.n1 * esize);if (unlikely (zcd.ptr2 !=NULL )) -rte_memcpy ((char *)obj + zcd.n1 * esize, - zcd.ptr2, - (ret - zcd.n1) * esize); +memcpy ((char *)obj + zcd.n1 * esize, + zcd.ptr2, (ret - zcd.n1) * esize);rte_ring_dequeue_zc_finish (r, ret);return ret;case (TEST_RING_ELEM_BURST_ZC_COMPRESS_PTR_16 ):
app/test/test_security_inline_macsec.c +1 -1
@@ -128,7 +128,7 @@ init_packet(struct rte_mempool *mp, const uint8_t *data, unsigned int len)if (pkt ==NULL )return NULL ; -rte_memcpy (rte_pktmbuf_append (pkt, len), data, len); +memcpy (rte_pktmbuf_append (pkt, len), data, len);return pkt; }
app/test/test_security_inline_proto.c +21 -21
87 lines not on this page · raw message
app/test/test_security_proto.c +1 -1
@@ -167,5 +167,5 @@ test_sec_proto_pattern_generate(void)void test_sec_proto_pattern_set (uint8_t *buf,int len) { -rte_memcpy (buf, cleartext_pattern, len); +memcpy (buf, cleartext_pattern, len); }
app/test/test_service_cores.c +0 -1
@@ -7,7 +7,6 @@#include <rte_hexdump.h> #include <rte_malloc.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_random.h> #include <rte_service.h>
app/test/test_thash.c +2 -2
@@ -316,14 +316,14 @@ test_toeplitz_hash_gfni_bulk(void) tuple[0 ].v4.dst_addr =rte_cpu_to_be_32 (v4_tbl[i].dst_ip); tuple[0 ].v4.sport =rte_cpu_to_be_16 (v4_tbl[i].dst_port); tuple[0 ].v4.dport =rte_cpu_to_be_16 (v4_tbl[i].src_port); -rte_memcpy (tuples[0 ], &tuple[0 ],RTE_THASH_V4_L4_LEN *4 ); +memcpy (tuples[0 ], &tuple[0 ],RTE_THASH_V4_L4_LEN *4 );/*Load IPv6 headers and copy it into the corresponding tuple*/ tuple[1 ].v6.src_addr = v6_tbl[i].src_ip; tuple[1 ].v6.dst_addr = v6_tbl[i].dst_ip; tuple[1 ].v6.sport =rte_cpu_to_be_16 (v6_tbl[i].dst_port); tuple[1 ].v6.dport =rte_cpu_to_be_16 (v6_tbl[i].src_port); -rte_memcpy (tuples[1 ], &tuple[1 ],RTE_THASH_V6_L4_LEN *4 ); +memcpy (tuples[1 ], &tuple[1 ],RTE_THASH_V6_L4_LEN *4 );rte_thash_gfni_bulk (rss_key_matrixes,RTE_THASH_V6_L4_LEN *4 , tuples, rss,2 );
app/test/virtual_pmd.c +3 -2
@@ -2,13 +2,14 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <string.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h> #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>
@@ -187,7 +188,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 ; }
Signature · 1 line
2.53.0
RE: [PATCH 03/61] test: use memcpy instead of rte_memcpy
Quoted 29 lines
app/test/packet_burst_generator.c +3
-3@@ -31,20 +31,20 @@ copy_buf_to_pkt_segs(void *buf, unsigned len,struct rte_mbuf *pkt, copy_len = seg->data_len - offset; seg_buf = rte_pktmbuf_mtod_offset(seg, char *, offset);while (len > copy_len) { -rte_memcpy (seg_buf, buf, (size_t ) copy_len); +memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; seg_buf = rte_pktmbuf_mtod(seg, void *); } -rte_memcpy (seg_buf, buf, (size_t ) len); +memcpy (seg_buf, buf, (size_t ) len); }static inline void copy_buf_to_pkt (void *buf,unsigned len,struct rte_mbuf *pkt,unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, + memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf,
Quoted 1 line
(
size_t) len);
It looks like size is not constant in the above instances.
Try writing an intermediate wrapper using __rte_constant() to verify at build time. Something like (assuming the return value is unused):
#define rte_memcpy_const_size(dst, src, n) \
do { \
RTE_BUILD_BUG_ON(!__rte_constant(n)); \
memcpy(dst, src, n); \
} while (0)Re: [PATCH 03/61] test: use memcpy instead of rte_memcpy
Quoted 13 lines · On Thu, 20 Aug 2026 08:22:09 +0200 Morten Brørup <[email protected]>…
app/test/packet_burst_generator.c copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt, · line 48
Quoted 10 lines
static inline void
copy_buf_to_pkt(void *buf, unsigned len, structrte_mbuf*pkt,
unsigned offset)
{(quoted diff) +0
-1if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset),buf,
app/test/packet_burst_generator.c +1
-0+ memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);It looks like size is not constant in the above instances.
Quoted 8 lines
Try writing an intermediate wrapper using
__rte_constant()to verify at build time. Something like (assuming the return value is unused):#define
rte_memcpy_const_size(dst, src, n)\do { \ RTE_BUILD_BUG_ON(!__rte_constant(n)); \ memcpy(dst, src, n); \ } while (0)
The goal of this series is to hit as many places where rte_memcpy is unnecessary. For tests, this includes all tests except those tests specifically targeting testing rte_memcpy.
Morten Brørup
Acked-byRE: [PATCH 03/61] test: use memcpy instead of rte_memcpy
Quoted 29 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 18.23Quoted 13 lines · On Thu, 20 Aug 2026 08:22:09 +0200 Morten Brørup <[email protected]>…
app/test/packet_burst_generator.c copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt, · line 48
Quoted 10 lines
static inline void
copy_buf_to_pkt(void *buf, unsigned len, structrte_mbuf*pkt,
unsigned offset)
{(quoted diff) +0
-1if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset),buf,
app/test/packet_burst_generator.c +1
-0+ memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);It looks like size is not constant in the above instances.
Quoted 1 line
Try writing an intermediate wrapper using
__rte_constant()to verifyat build time.
Quoted 7 lines
Something like (assuming the return value is unused):
#define
rte_memcpy_const_size(dst, src, n)\do { \ RTE_BUILD_BUG_ON(!__rte_constant(n)); \ memcpy(dst, src, n); \ } while (0)
Quoted 3 lines
The goal of this series is to hit as many places where
rte_memcpyis unnecessary. For tests, this includes all tests except those tests specifically targeting testingrte_memcpy.
OK. I agree with that.
Then the patch description needs an update; it only mentions fixed-size copies.
Also the cover letter should mention that tests replace all uses of rte_memcpy(), not just fixed-size copies.
PATCH 4/61 app/graph: replace rte_memcpy with memcpy
In reply to Stephen HemmingerUse libc version of memcpy for fixed sizes.
--- app/graph/neigh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
app/graph/neigh.c +4 -4
@@ -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 (data, &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 (data, &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); }
Signature · 1 line
2.53.0
PATCH 5/61 lpm: remove unnecessary include of rte_memcpy.h
In reply to Stephen HemmingerNo longer used.
--- lib/lpm/rte_lpm6.c | 1 - 1 file changed, 1 deletion(-)
lib/lpm/rte_lpm6.c +0 -1
@@ -12,7 +12,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>
Signature · 1 line
2.53.0
PATCH 6/61 acl: remove unnecessary include of rte_memcpy.h
In reply to Stephen Hemmingerrte_memcpy is no longer used here.
--- lib/acl/rte_acl_osdep.h | 1 - 1 file changed, 1 deletion(-)
lib/acl/rte_acl_osdep.h +0 -1
@@ -33,7 +33,6 @@#include <rte_vect.h> #include <rte_memory.h> #include <rte_log.h> -#include <rte_memcpy.h> #include <rte_prefetch.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h>
Signature · 1 line
2.53.0
PATCH 7/61 drivers/bus: remove unnecessary include of rte_memcpy.h
In reply to Stephen HemmingerThe file is included but rte_memcpy() no longer used here.
--- 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_dpcon.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - 8 files changed, 8 deletions(-)
drivers/bus/auxiliary/linux/auxiliary.c +0 -1
@@ -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"
drivers/bus/fslmc/fslmc_bus.c +0 -1
@@ -14,7 +14,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> #include <rte_vfio.h>
drivers/bus/fslmc/fslmc_vfio.c +0 -1
@@ -28,7 +28,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>
drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +0 -1
@@ -15,7 +15,6 @@#include <eal_export.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h>
drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +0 -1
@@ -14,7 +14,6 @@#include <eal_export.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h>
drivers/bus/fslmc/portal/dpaa2_hw_dpcon.c +0 -1
@@ -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>
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0 -1
@@ -29,7 +29,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>
drivers/bus/pci/linux/pci.c +0 -1
@@ -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_export.h>
Signature · 1 line
2.53.0
PATCH 8/61 security: replace fixed size rte_memcpy
In reply to Stephen HemmingerUse memcpy for better compiler checks.
--- lib/security/rte_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/security/rte_security.c +2 -2
@@ -406,7 +406,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]); }
@@ -431,7 +431,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]); }
Signature · 1 line
2.53.0
PATCH 9/61 ethdev: replace use of rte_memcpy
In reply to Stephen HemmingerThe management of flows is better done using memcpy() or structure assignment where compiler can do more bounds checks.
--- lib/ethdev/rte_ethdev.c | 3 +- lib/ethdev/rte_flow.c | 104 ++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 60 deletions(-)
lib/ethdev/rte_ethdev.c +1 -2
@@ -16,7 +16,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>
@@ -637,7 +636,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 ;
lib/ethdev/rte_flow.c +46 -58
173 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH 10/61 net: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- lib/net/rte_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/net/rte_ether.c +1 -1
@@ -15,7 +15,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 */ }
Signature · 1 line
2.53.0
PATCH 11/61 pdcp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't use rte_memcpy because compiler has more bounds checking with regular memcpy.
Also, use include-what-you-use to fill in some of the include files that were inherited.
--- lib/pdcp/pdcp_process.c | 51 +++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 22 deletions(-)
lib/pdcp/pdcp_process.c +29 -22
@@ -2,13 +2,20 @@* Copyright(C) 2023 Marvell. */ +#include <errno.h> +#include <stdbool.h> +#include <string.h> + +#include <rte_common.h> #include <rte_crypto.h> #include <rte_crypto_sym.h> #include <rte_cryptodev.h> -#include <rte_memcpy.h> +#include <rte_mempool.h> +#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> #include <rte_pdcp.h> #include <rte_pdcp_hdr.h> +#include <rte_security.h> #include "pdcp_cnt.h" #include "pdcp_crypto.h"
@@ -60,7 +67,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 +79,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 +96,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 +108,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 +122,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 +147,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 +169,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 +186,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
@@ -614,7 +621,7 @@ pdcp_post_process_ul(const struct rte_pdcp_entity *entity, }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
@@ -968,7 +975,7 @@ pdcp_post_process_uplane_dl_flags(const struct rte_pdcp_entity *entity, struct r }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
@@ -1024,7 +1031,7 @@ pdcp_post_process_cplane_sn_12_dl(const struct rte_pdcp_entity *entity, }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
Signature · 1 line
2.53.0
PATCH 12/61 eventdev: replace fixed size rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy gets more checking from compiler.
--- lib/eventdev/rte_event_crypto_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_crypto_adapter.c +1 -1
@@ -700,7 +700,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];/** Restore "struct rte_event::impl_opaque" from mbuf
Signature · 1 line
2.53.0
PATCH 13/61 eal: replace rte_memcpy of cpuset
In reply to Stephen HemmingerSimple structure assignment is better than rte_memcpy.
--- lib/eal/common/eal_common_options.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_options.c +2 -4
@@ -29,7 +29,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
@@ -1446,7 +1445,7 @@ eal_parse_lcores(const char *lcores)/* without '@', by default using lcore_set as cpuset */ if (*lcores !='@' ) -rte_memcpy (&cpuset, &lcore_set,sizeof (cpuset)); + cpuset = lcore_set; set_count =CPU_COUNT (&lcore_set);/* start to update lcore_set */
@@ -1469,8 +1468,7 @@ eal_parse_lcores(const char *lcores)if (check_cpuset (&cpuset) <0 ) goto err; -rte_memcpy (&lcore_config[idx].cpuset, &cpuset, -sizeof (rte_cpuset_t)); + lcore_config[idx].cpuset = cpuset; }/* some cores from the lcore_set can't be handled by EAL */
Signature · 1 line
2.53.0
PATCH 14/61 cryptodev: replace use of rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy is as fast and safer.
--- drivers/crypto/ccp/ccp_crypto.c | 14 +++++--------- drivers/crypto/cnxk/cnxk_se.h | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 ++-- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 10 +++++----- drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 6 +++--- drivers/crypto/scheduler/scheduler_failover.c | 12 ++++++------ drivers/crypto/zsda/zsda_crypto_session.c | 6 +++--- lib/cryptodev/rte_cryptodev.c | 12 ++++-------- 8 files changed, 29 insertions(+), 37 deletions(-)
drivers/crypto/ccp/ccp_crypto.c +5 -9
@@ -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 ; }
drivers/crypto/cnxk/cnxk_se.h +1 -1
@@ -1252,7 +1252,7 @@ cpt_sm_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_pvoid *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 {
drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -2
@@ -292,8 +292,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++; }
drivers/crypto/mlx5/mlx5_crypto_gcm.c +5 -5
@@ -1061,9 +1061,9 @@ mlx5_crypto_gcm_ipsec_enqueue_burst(void *queue_pair,* shrink AAD before payload. First backup the mem, * then do shrink. */ -rte_memcpy (&qp->ipsec_mem[idx], -RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), -MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); +memcpy (&qp->ipsec_mem[idx], +RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), +MLX5_CRYPTO_GCM_IPSEC_IV_SIZE );/* If no memory overlap, do copy directly, otherwise memmove. */ if (likely (pkt_iv_len >= sess->aad_len))rte_memcpy (gcm_data.src_addr, op->sym->aead.aad.data, sess->aad_len);
@@ -1107,8 +1107,8 @@ mlx5_crypto_gcm_restore_ipsec_mem(struct mlx5_crypto_qp *qp,if (unlikely (sess->aad_len >MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ))memmove (op->sym->aead.aad.data,RTE_PTR_SUB (payload, sess->aad_len), sess->aad_len); -rte_memcpy (RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), - &qp->ipsec_mem[idx],MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); +memcpy (RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), + &qp->ipsec_mem[idx],MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); m_dst = op->sym->m_dst;if (m_dst && m_dst != m_src) {uint32_t bytes_to_copy;
drivers/crypto/scheduler/rte_cryptodev_scheduler.c +3 -3
@@ -80,7 +80,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--;
@@ -217,8 +217,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],
drivers/crypto/scheduler/scheduler_failover.c +6 -6
@@ -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 ;
drivers/crypto/zsda/zsda_crypto_session.c +3 -3
@@ -178,7 +178,7 @@ u32_to_u8(uint32_t *u_int32_t_data, uint8_t *u8_data) {uint32_t be_data =rte_cpu_to_be_32 (*u_int32_t_data); -rte_memcpy (u8_data, &be_data,sizeof (be_data)); +memcpy (u8_data, &be_data,sizeof (be_data)); } static void
@@ -283,8 +283,8 @@ zsda_decry_key_set(uint8_t key[64], const uint8_t *key1_ptr, uint8_t skey_len, : ZSDA_AES512_ROUND_NUM;zsda_aes_key_expansion (aes_round_key, round_num, key1_ptr, skey_len); -rte_memcpy (dec_key1, - ((uint8_t *)aes_round_key + (16 * round_num)),16 ); +memcpy (dec_key1, + ((uint8_t *)aes_round_key + (16 * round_num)),16 );if (skey_len ==ZSDA_SYM_XTS_512_SKEY_LEN && (16 * round_num) <=ZSDA_AES_MAX_EXP_BYTE_SIZE ) {
lib/cryptodev/rte_cryptodev.c +4 -8
@@ -16,7 +16,6 @@#include <rte_debug.h> #include <dev_driver.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_eal.h> #include <rte_common.h>
@@ -2566,8 +2565,7 @@ rte_cryptodev_sym_session_set_user_data(void *_sess, void *data,if (sess->user_data_sz < size)return -ENOMEM ; -rte_memcpy (sess->driver_priv_data + sess->sess_data_sz, data, size); - +memcpy (sess->driver_priv_data + sess->sess_data_sz, data, size);rte_cryptodev_trace_sym_session_set_user_data (sess, data, size);return 0 ;
@@ -2601,9 +2599,7 @@ rte_cryptodev_asym_session_set_user_data(void *session, void *data, uint16_t sizif (sess->user_data_sz < size)return -ENOMEM ; -rte_memcpy (sess->sess_private_data + - sess->max_priv_data_sz, - data, size); +memcpy (sess->sess_private_data + sess->max_priv_data_sz, data, size);rte_cryptodev_trace_asym_session_set_user_data (sess, data, size);
@@ -2750,7 +2746,7 @@ rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess,if (s->event_mdata ==NULL )return -ENOMEM ; } -rte_memcpy (s->event_mdata, ev_mdata, size); +memcpy (s->event_mdata, ev_mdata, size);return 0 ; }else
@@ -3098,7 +3094,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]); }
Signature · 1 line
2.53.0
PATCH 15/61 drivers/raw: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/raw/ifpga/afu_pmd_he_hssi.c | 4 ++-- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 4 ++-- drivers/raw/ifpga/afu_pmd_he_mem.c | 4 ++-- 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, 18 insertions(+), 22 deletions(-)
drivers/raw/ifpga/afu_pmd_he_hssi.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <inttypes.h> #include <unistd.h> #include <fcntl.h>
@@ -15,7 +16,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -313,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 ; }
drivers/raw/ifpga/afu_pmd_he_lpbk.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <inttypes.h> #include <unistd.h> #include <fcntl.h>
@@ -15,7 +16,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -362,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 ; }
drivers/raw/ifpga/afu_pmd_he_mem.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <fcntl.h> #include <poll.h>
@@ -14,7 +15,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -125,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 ; }
drivers/raw/ifpga/afu_pmd_n3000.c +4 -4
@@ -1864,8 +1864,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 ;
@@ -1884,8 +1884,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 ;
drivers/raw/ifpga/ifpga_rawdev.c +5 -6
@@ -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", __func__,
drivers/raw/skeleton/skeleton_rawdev.c +3 -5
@@ -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" );
drivers/raw/skeleton/skeleton_rawdev_test.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH 16/61 test-pipeline: replace use of rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy is safer and as fast here.
--- app/test-eventdev/test_pipeline_common.c | 8 ++++---- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - 5 files changed, 4 insertions(+), 8 deletions(-)
app/test-eventdev/test_pipeline_common.c +4 -4
@@ -153,22 +153,22 @@ 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), + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), ð_hdr, sizeof(struct rte_ether_hdr));/* Copy Ipv4 header */ - rte_memcpy(rte_pktmbuf_mtod_offset( + memcpy(rte_pktmbuf_mtod_offset( mbuf, char *, sizeof(struct rte_ether_hdr)), &ip_hdr, sizeof(struct rte_ipv4_hdr));/* Copy UDP header */ -rte_memcpy ( +memcpy (rte_pktmbuf_mtod_offset (mbuf ,char *, sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_ether_hdr)), - &udp_hdr, sizeof(struct rte_udp_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) +
app/test-pipeline/config.c +0 -1
@@ -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>
app/test-pipeline/init.c +0 -1
@@ -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>
app/test-pipeline/main.c +0 -1
@@ -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>
app/test-pipeline/runtime.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH 17/61 net/af_xdp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +1 -1
@@ -2234,7 +2234,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 ;
Signature · 1 line
2.53.0
PATCH 18/61 net/avp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/avp/avp_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/avp/avp_ethdev.c +2 -2
@@ -249,7 +249,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_LINE (DEBUG ,"Discarding stale response" ); -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_LINE(ERR, "Cannot send request %u to host",
@@ -286,7 +286,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_LINE(DEBUG, "Result %d received for request %u",
Signature · 1 line
2.53.0
PATCH 19/61 net/axgbe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/axgbe/axgbe_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -2
@@ -599,7 +599,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);
@@ -642,7 +642,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 ;
Signature · 1 line
2.53.0
PATCH 20/61 net/bnx2x: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/bnx2x/bnx2x.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/net/bnx2x/bnx2x.c +15 -17
@@ -2238,18 +2238,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);
@@ -6671,8 +6671,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 */
@@ -6738,8 +6737,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);
@@ -6954,7 +6952,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)) {
Signature · 1 line
2.53.0
PATCH 21/61 net/bnxt: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/bnxt/bnxt_flow.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/net/bnxt/bnxt_flow.c +18 -16
@@ -233,8 +233,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "DMAC is invalid!");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!");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.a,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.a,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 =
Signature · 1 line
2.53.0
PATCH 22/61 net/bonding: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/bonding/rte_eth_bond_8023ad.c | 4 ++-- drivers/net/bonding/rte_eth_bond_flow.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/bonding/rte_eth_bond_8023ad.c +2 -2
@@ -1548,10 +1548,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 ;
drivers/net/bonding/rte_eth_bond_flow.c +1 -1
@@ -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,
Signature · 1 line
2.53.0
PATCH 23/61 net/cnxk: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- 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 ++--- 7 files changed, 16 insertions(+), 13 deletions(-)
drivers/net/cnxk/cnxk_eswitch_devargs.c +2 -1
@@ -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++;
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -1
@@ -462,7 +462,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;
drivers/net/cnxk/cnxk_rep.c +2 -1
@@ -409,7 +409,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);
drivers/net/cnxk/cnxk_rep_flow.c +4 -2
@@ -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 */
@@ -231,7 +232,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 */
drivers/net/cnxk/cnxk_rep_msg.c +4 -4
@@ -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;
drivers/net/cnxk/cnxk_rep_ops.c +1 -1
@@ -692,7 +692,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 );
drivers/net/cnxk/cnxk_tm.c +2 -3
@@ -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;
Signature · 1 line
2.53.0
PATCH 24/61 net/cxgbe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- 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 +++++++++----------- 4 files changed, 16 insertions(+), 18 deletions(-)
drivers/net/cxgbe/clip_tbl.c +1 -1
@@ -115,7 +115,7 @@ static struct clip_entry *t4_clip_alloc(struct rte_eth_dev *dev,if (ce) {t4_os_lock (&ce->lock);if (rte_atomic_load_explicit (&ce->refcnt, rte_memory_order_relaxed) ==0 ) { -rte_memcpy (ce->addr, lip,sizeof (ce->addr)); +memcpy (ce->addr, lip,sizeof (ce->addr));if (v6) { ce->type =FILTER_TYPE_IPV6 ; rte_atomic_store_explicit(&ce->refcnt, 1,
drivers/net/cxgbe/cxgbe_filter.c +4 -4
@@ -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);
drivers/net/cxgbe/l2t.c +2 -2
@@ -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 );rte_atomic_store_explicit (&e->refcnt,1 , rte_memory_order_relaxed); ret =write_l2e (dev, e,0 , !L2T_LPBK , !L2T_ARPMISS );if (ret <0 )
drivers/net/cxgbe/smt.c +9 -11
@@ -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 (rte_atomic_load_explicit (&e->refcnt, rte_memory_order_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 ;
Signature · 1 line
2.53.0
PATCH 25/61 net/dpaa2: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_mux.c | 36 +++++++++++++------------- 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 +- 7 files changed, 19 insertions(+), 24 deletions(-)
drivers/net/dpaa2/base/dpaa2_hw_dpni.c +0 -1
@@ -12,7 +12,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>
drivers/net/dpaa2/dpaa2_ethdev.c +0 -1
@@ -12,7 +12,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>
drivers/net/dpaa2/dpaa2_mux.c +18 -18
@@ -150,12 +150,12 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, spec = pattern[loop].spec; mask = pattern[loop].mask; -rte_memcpy (&key_va[key_size], - &spec->hdr.next_proto_id,sizeof (uint8_t )); +memcpy (&key_va[key_size], &spec->hdr.next_proto_id, +sizeof (uint8_t ));if (mask) { -rte_memcpy (&mask_va[key_size], - &mask->hdr.next_proto_id, -sizeof (uint8_t )); +memcpy (&mask_va[key_size], + &mask->hdr.next_proto_id, +sizeof (uint8_t )); }else { mask_va[key_size] =0xff ; }
@@ -178,11 +178,11 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, spec = pattern[loop].spec; mask = pattern[loop].mask; -rte_memcpy (&key_va[key_size], - &spec->tci,sizeof (uint16_t )); +memcpy (&key_va[key_size], &spec->tci, +sizeof (uint16_t ));if (mask) { -rte_memcpy (&mask_va[key_size], - &mask->tci,sizeof (uint16_t )); +memcpy (&mask_va[key_size], &mask->tci, +sizeof (uint16_t )); }else {memset (&mask_va[key_size],0xff ,sizeof (rte_be16_t));
@@ -205,12 +205,12 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, spec = pattern[loop].spec; mask = pattern[loop].mask; -rte_memcpy (&key_va[key_size], - &spec->hdr.dst_port,sizeof (rte_be16_t)); +memcpy (&key_va[key_size], &spec->hdr.dst_port, +sizeof (rte_be16_t));if (mask) { -rte_memcpy (&mask_va[key_size], - &mask->hdr.dst_port, -sizeof (rte_be16_t)); +memcpy (&mask_va[key_size], + &mask->hdr.dst_port, +sizeof (rte_be16_t)); }else {memset (&mask_va[key_size],0xff ,sizeof (rte_be16_t));
@@ -233,11 +233,11 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, spec = pattern[loop].spec; mask = pattern[loop].mask; -rte_memcpy (&key_va[key_size], - &spec->type,sizeof (rte_be16_t)); +memcpy (&key_va[key_size], &spec->type, +sizeof (rte_be16_t));if (mask) { -rte_memcpy (&mask_va[key_size], - &mask->type,sizeof (rte_be16_t)); +memcpy (&mask_va[key_size], &mask->type, +sizeof (rte_be16_t)); }else {memset (&mask_va[key_size],0xff ,sizeof (rte_be16_t));
drivers/net/dpaa2/dpaa2_recycle.c +0 -1
@@ -8,7 +8,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>
drivers/net/dpaa2/dpaa2_rxtx.c +0 -1
@@ -12,7 +12,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>
drivers/net/dpaa2/dpaa2_sparser.c +0 -1
@@ -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>
drivers/net/dpaa2/dpaa2_tm.c +1 -1
@@ -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);
Signature · 1 line
2.53.0
PATCH 26/61 net/enic: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/enic/enic_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/enic/enic_main.c +3 -3
@@ -1215,8 +1215,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);
@@ -1248,7 +1248,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; }
Signature · 1 line
2.53.0
RE: [PATCH 26/61] net/enic: replace use of rte_memcpy
Quoted 45 lines
-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, August 20, 2026 2:12 PM
To: [email protected]
Cc: Stephen Hemminger <[email protected]>; John Daley (johndale) <[email protected]>; Hyong Youb Kim (hyonkim) <[email protected]>
Subject: [PATCH 26/61] net/enic: replace use ofrte_memcpyDon't need
rte_memcpyfor fixed size value.Signed-off-by Stephen Hemminger <[email protected]>--- drivers/net/enic/enic_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/net/enic/enic_main.c +2
-2@@ -1215,8 +1215,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),drivers/net/enic/enic_main.c +1
-1rss_key_buf_va, rss_key_buf_pa);@@ -1248,7 +1248,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;}
Quoted 2 lines
--
2.53.0
Thanks.
-Hyong
PATCH 27/61 net/failsafe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for addresses in control path.
The use of rte_memcpy() when saving the multicast address list is control path only. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
--- drivers/net/failsafe/failsafe_ops.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/failsafe/failsafe_ops.c +5 -5
@@ -909,16 +909,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",
@@ -1523,8 +1523,8 @@ fs_set_mc_addr_list(struct rte_eth_dev *dev, ret = -ENOMEM ; goto rollback; } -rte_memcpy (mcast_addrs, mc_addr_set, - nb_mc_addr *sizeof (PRIV (dev)->mcast_addrs[0 ])); +memcpy (mcast_addrs, mc_addr_set, + nb_mc_addr *sizeof (PRIV (dev)->mcast_addrs[0 ]));PRIV (dev)->nb_mcast_addr = nb_mc_addr;PRIV (dev)->mcast_addrs = mcast_addrs;
Signature · 1 line
2.53.0
PATCH 28/61 net/gve: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/gve/base/gve_adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/gve/base/gve_adminq.c +1 -1
@@ -1083,7 +1083,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);
Signature · 1 line
2.53.0
Re: [PATCH 28/61] net/gve: replace use of rte_memcpy
Quoted 4 lines · Stephen Hemminger
Don't need
rte_memcpyfor fixed size value.Signed-off-by Stephen Hemminger <[email protected]>
Quoted 20 lines
--- drivers/net/gve/base/gve_adminq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/gve/base/gve_adminq.c +1
-2@@ -1083,7 +1083,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); --2.53.0
PATCH 29/61 net/hinic: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
Use memcpy() or structure assignment.
--- drivers/net/hinic/hinic_pmd_ethdev.c | 1 - drivers/net/hinic/hinic_pmd_flow.c | 41 +++++++++++++--------------- 2 files changed, 19 insertions(+), 23 deletions(-)
drivers/net/hinic/hinic_pmd_ethdev.c +0 -1
@@ -8,7 +8,6 @@#include <ethdev_driver.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>
drivers/net/hinic/hinic_pmd_flow.c +19 -22
95 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH 30/61 net/hns3: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_flow.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/hns3/hns3_fdir.c +1 -1
@@ -1066,7 +1066,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);
drivers/net/hns3/hns3_flow.c +2 -2
@@ -2588,8 +2588,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,
Signature · 1 line
2.53.0
PATCH 31/61 net/mlx5: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- 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 | 31 +++++++++++++------------- drivers/net/mlx5/mlx5_rx.c | 6 ++--- drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +++---- 6 files changed, 47 insertions(+), 46 deletions(-)
drivers/net/mlx5/mlx5_devx.c +2 -2
@@ -587,7 +587,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,
@@ -1379,7 +1379,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 * (size_t )RTE_BIT32 (host_mem_attr.wq_attr.log_hairpin_num_packets); umem_dbrec =RTE_ALIGN (umem_size,MLX5_DBR_SIZE );
drivers/net/mlx5/mlx5_flow.c +19 -19
@@ -4632,8 +4632,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++; }
@@ -5487,30 +5487,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 ;
@@ -5522,8 +5522,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 ;
@@ -5534,14 +5534,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 ; }
@@ -5551,7 +5551,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 ) {
@@ -5561,7 +5561,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)
drivers/net/mlx5/mlx5_flow_aso.c +3 -3
@@ -1373,9 +1373,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 ); } }
drivers/net/mlx5/mlx5_flow_hw.c +16 -15
@@ -2509,7 +2509,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));if (!mhdr->shared) { pattern.data = (rte_be64_t *)acts->mhdr->mhdr_cmds;typeof (mp_ctx->mh) *mh = &mp_ctx->mh;
@@ -3231,7 +3231,7 @@ __flow_hw_translate_actions_template(struct rte_eth_dev *dev, err = rte_errno;__flow_hw_action_template_destroy (dev, acts);if (error !=NULL && sub_error.type !=RTE_FLOW_ERROR_TYPE_NONE ) { -rte_memcpy (error, &sub_error,sizeof (sub_error)); +memcpy (error, &sub_error,sizeof (sub_error));return -EINVAL ; } return rte_flow_error_set(error, err,
@@ -3296,8 +3296,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)); } }
@@ -3599,9 +3599,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 ||
@@ -5537,7 +5537,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 ; }
@@ -7951,8 +7951,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;
@@ -7989,7 +7990,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); }
@@ -10217,8 +10218,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);
@@ -10585,8 +10586,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); }
@@ -14137,7 +14138,7 @@ static int flow_hw_register_matcher(struct rte_eth_dev *dev,mlx5_hlist_unregister (priv->sh->groups, group_entry);if (error) {if (sub_error.type !=RTE_FLOW_ERROR_TYPE_NONE ) -rte_memcpy (error, &sub_error,sizeof (sub_error)); +memcpy (error, &sub_error,sizeof (sub_error)); } return rte_flow_error_set(error, rte_errno, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
drivers/net/mlx5/mlx5_rx.c +3 -3
@@ -883,9 +883,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 )); } } }
drivers/net/mlx5/mlx5_rxtx_vec.c +4 -4
@@ -364,8 +364,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 (MLX5_CQE_FORMAT (next->op_own) ==MLX5_COMPRESSED || ret !=MLX5_CQE_STATUS_SW_OWN ) -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:
@@ -528,8 +528,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 (MLX5_CQE_FORMAT (next->op_own) ==MLX5_COMPRESSED || ret !=MLX5_CQE_STATUS_SW_OWN ) -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:
Signature · 1 line
2.53.0
PATCH 32/61 net/mvpp2: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/mvpp2/mrvl_tm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mvpp2/mrvl_tm.c +1 -1
@@ -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);
Signature · 1 line
2.53.0
PATCH 33/61 net/netvsc: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/netvsc/hn_ethdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/netvsc/hn_ethdev.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH 34/61 net/nfp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/nfp/flower/nfp_conntrack.c | 2 +- drivers/net/nfp/flower/nfp_flower_flow.c | 16 ++++++++-------- drivers/net/nfp/nfp_mtr.c | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/nfp/flower/nfp_conntrack.c +1 -1
@@ -1475,7 +1475,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 +
drivers/net/nfp/flower/nfp_flower_flow.c +8 -8
@@ -234,10 +234,10 @@ nfp_mask_id_alloc_from_driver(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 );
@@ -256,7 +256,7 @@ nfp_mask_id_free_from_driver(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 );
@@ -2929,13 +2929,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 ; }
@@ -3011,7 +3011,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.a[i *4 ],4 ); +memcpy (&tmp, &set_ipv6->ipv6_addr.a[i *4 ],4 ); set_ip->ipv6[i].exact = tmp; set_ip->ipv6[i].mask =RTE_BE32 (0xffffffff ); }
drivers/net/nfp/nfp_mtr.c +5 -5
@@ -250,7 +250,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 ));
@@ -274,7 +274,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; }
@@ -499,8 +499,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);
@@ -1035,7 +1035,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;
Signature · 1 line
2.53.0
PATCH 35/61 net/ngbe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/ngbe/ngbe_pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ngbe/ngbe_pf.c +2 -2
@@ -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 ;
Signature · 1 line
2.53.0
PATCH 36/61 net/ntnic: replace use of rte_memcpy
In reply to Stephen HemmingerThe uses of rte_memcpy() in the RSS hash key update and get are control path only. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
The remaining uses of rte_memcpy() are left alone since they are on the receive and transmit fast paths.
--- drivers/net/ntnic/ntnic_ethdev.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/ntnic/ntnic_ethdev.c +6 -5
@@ -1768,7 +1768,7 @@ static int eth_dev_rss_hash_update(struct rte_eth_dev *eth_dev, struct rte_eth_rreturn -1 ; } -rte_memcpy (&tmp_rss_conf.rss_key, rss_conf->rss_key, rss_conf->rss_key_len); +memcpy (&tmp_rss_conf.rss_key, rss_conf->rss_key, rss_conf->rss_key_len); } tmp_rss_conf.algorithm = rss_conf->algorithm;
@@ -1778,7 +1778,8 @@ static int eth_dev_rss_hash_update(struct rte_eth_dev *eth_dev, struct rte_eth_rif (res ==0 ) { flow_filter_ops->nthw_mod_hsh_rcp_flush (&ndev->be, hsh_idx,1 ); -rte_memcpy (&ndev->rss_conf, &tmp_rss_conf,sizeof (struct nt_eth_rss_conf )); +memcpy (&ndev->rss_conf, &tmp_rss_conf, +sizeof (struct nt_eth_rss_conf )); }else {NT_LOG (ERR ,NTNIC ,"ERROR: - RSS hash update failed with error %i" , res);
@@ -1803,7 +1804,7 @@ static int rss_hash_conf_get(struct rte_eth_dev *eth_dev, struct rte_eth_rss_conif (rss_conf->rss_key !=NULL ) {int key_len =RTE_MIN (rss_conf->rss_key_len,MAX_RSS_KEY_LEN );memset (rss_conf->rss_key,0 , rss_conf->rss_key_len); -rte_memcpy (rss_conf->rss_key, &ndev->rss_conf.rss_key, key_len); +memcpy (rss_conf->rss_key, &ndev->rss_conf.rss_key, key_len); rss_conf->rss_key_len = key_len; }
@@ -2555,8 +2556,8 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) eth_dev->data->dev_private = internals; eth_dev->data->mac_addrs =rte_malloc (NULL ,NUM_MAC_ADDRS_PER_PORT *sizeof (struct rte_ether_addr ),0 ); -rte_memcpy (ð_dev->data->mac_addrs[0 ], - &internals->eth_addrs[0 ],RTE_ETHER_ADDR_LEN ); +memcpy (ð_dev->data->mac_addrs[0 ], &internals->eth_addrs[0 ], +RTE_ETHER_ADDR_LEN );NT_LOG_DBGX (DBG ,NTNIC ,"Setting up RX functions for SCG" ); eth_dev->rx_pkt_burst = eth_dev_rx_scg;
Signature · 1 line
2.53.0
PATCH 37/61 net/null: replace use of rte_memcpy
In reply to Stephen HemmingerThe null driver is not used for high speed production traffic, so any marginal performance difference from using regular memcpy() does not matter. Regular memcpy() gets more compile time checking of the arguments.
--- drivers/net/null/rte_eth_null.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/null/rte_eth_null.c +6 -6
@@ -4,12 +4,12 @@*/ #include <stdlib.h> +#include <string.h> #include <rte_mbuf.h> #include <ethdev_driver.h> #include <ethdev_vdev.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <bus_vdev_driver.h> #include <rte_kvargs.h> #include <rte_spinlock.h>
@@ -121,7 +121,7 @@ eth_null_copy_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)return 0 ;for (i =0 ; i < nb_bufs; i++) { - rte_memcpy(rte_pktmbuf_mtod(bufs[i], void *), h->dummy_packet, + memcpy(rte_pktmbuf_mtod(bufs[i], void *), h->dummy_packet, packet_size); bufs[i]->data_len = (uint16_t )packet_size; bufs[i]->pkt_len = packet_size;
@@ -169,7 +169,7 @@ eth_null_copy_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)struct rte_mbuf *m = bufs[i];size_t len =RTE_MIN (h->internals->packet_size, m->data_len); - rte_memcpy(h->dummy_packet, rte_pktmbuf_mtod(m, void *), len); + memcpy(h->dummy_packet, rte_pktmbuf_mtod(m, void *), len); bytes += m->pkt_len; }
@@ -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;
Signature · 1 line
2.53.0
PATCH 38/61 net/qede: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/qede/qede_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/qede/qede_main.c +1 -1
@@ -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);
Signature · 1 line
2.53.0
PATCH 39/61 net/ring: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/ring/rte_eth_ring.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/ring/rte_eth_ring.c +0 -1
@@ -9,7 +9,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>
Signature · 1 line
2.53.0
PATCH 40/61 net/sfc: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- 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 ++++----- 9 files changed, 25 insertions(+), 27 deletions(-)
drivers/net/sfc/sfc.c +1 -1
@@ -853,7 +853,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;
drivers/net/sfc/sfc_ef10_tx.c +1 -1
@@ -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,
drivers/net/sfc/sfc_ethdev.c +5 -6
@@ -1438,8 +1438,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 ; }
@@ -1823,7 +1822,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 ; }
@@ -1892,7 +1891,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;
@@ -1991,7 +1990,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 ;
@@ -2015,7 +2014,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:
drivers/net/sfc/sfc_flow.c +10 -10
@@ -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; }
@@ -618,8 +618,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.a,sizeof (mask->hdr.src_addr))) { goto fail_bad_mask;
@@ -631,8 +631,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.a,sizeof (mask->hdr.dst_addr))) { goto fail_bad_mask;
@@ -883,8 +883,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,
drivers/net/sfc/sfc_flow_rss.c +1 -1
@@ -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 :
drivers/net/sfc/sfc_mae.c +1 -1
@@ -546,7 +546,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 ;
drivers/net/sfc/sfc_rx.c +1 -1
@@ -1527,7 +1527,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;
drivers/net/sfc/sfc_tso.c +1 -1
@@ -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,
drivers/net/sfc/sfc_tso.h +4 -5
@@ -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,
Signature · 1 line
2.53.0
PATCH 41/61 net/txgbe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy() for small fixed values.
The use of rte_memcpy() in the IPV6_ADDR_TO_MASK macro is in the flow director mask setup, which is control path only. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
--- drivers/net/txgbe/txgbe_ethdev.c | 9 ++-- drivers/net/txgbe/txgbe_fdir.c | 11 +++-- drivers/net/txgbe/txgbe_flow.c | 73 +++++++++++++++----------------- drivers/net/txgbe/txgbe_ipsec.c | 8 ++-- drivers/net/txgbe/txgbe_pf.c | 6 +-- drivers/net/txgbe/txgbe_tm.c | 11 +++-- 6 files changed, 53 insertions(+), 65 deletions(-)
drivers/net/txgbe/txgbe_ethdev.c +3 -6
@@ -4933,9 +4933,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 ) {
@@ -5889,9 +5888,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 ) {
drivers/net/txgbe/txgbe_fdir.c +5 -6
@@ -21,7 +21,7 @@#define IPV6_ADDR_TO_MASK (ipaddr, ipv6m) do { \ uint8_t ipv6_addr[16]; \ uint8_t i; \ - rte_memcpy(ipv6_addr, (ipaddr), sizeof(ipv6_addr));\ + memcpy(ipv6_addr, (ipaddr), sizeof(ipv6_addr));\ (ipv6m) = 0; \ for (i = 0; i < sizeof(ipv6_addr); i++) { \ if (ipv6_addr[i] == UINT8_MAX) \
@@ -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 )/**
@@ -898,8 +898,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;
@@ -1051,8 +1051,7 @@ txgbevf_fdir_filter_program(struct rte_eth_dev *dev, sizeof(struct txgbe_fdir_filter), 0);if (!node)return -ENOMEM ; -rte_memcpy (&node->input, input, -sizeof (struct txgbe_atr_input )); +memcpy (&node->input, input,sizeof (struct txgbe_atr_input )); node->fdirflags = rule->fdirflags; node->fdirhash = fdirhash; node->queue = rule->queue;
drivers/net/txgbe/txgbe_flow.c +33 -40
151 lines not on this page · raw message
drivers/net/txgbe/txgbe_ipsec.c +4 -4
@@ -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;
drivers/net/txgbe/txgbe_pf.c +3 -3
@@ -7,6 +7,7 @@#include <errno.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <stdarg.h> #include <inttypes.h>
@@ -17,7 +18,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 +435,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 +457,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 ;
drivers/net/txgbe/txgbe_tm.c +5 -6
@@ -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,
Signature · 1 line
2.53.0
PATCH 42/61 net/vhost: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/vhost/rte_eth_vhost.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/vhost/rte_eth_vhost.c +0 -1
@@ -13,7 +13,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>
Signature · 1 line
2.53.0
PATCH 43/61 net/virtio: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/virtio/virtio_ethdev.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/virtio/virtio_ethdev.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH 44/61 net/sxe2: replace use of rte_memcpy
In reply to Stephen HemmingerThe uses of rte_memcpy() in the sxe2 driver are all in the control path. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
--- drivers/net/sxe2/sxe2_cmd_chnl.c | 6 ++-- drivers/net/sxe2/sxe2_flow.c | 11 +++---- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 36 ++++++++++++---------- drivers/net/sxe2/sxe2_ipsec.c | 2 +- drivers/net/sxe2/sxe2_rss.c | 10 +++--- drivers/net/sxe2/sxe2_rx.c | 4 +-- drivers/net/sxe2/sxe2_stats.c | 25 +++++++-------- drivers/net/sxe2/sxe2_tm.c | 4 +-- 8 files changed, 51 insertions(+), 47 deletions(-)
drivers/net/sxe2/sxe2_cmd_chnl.c +3 -3
@@ -961,7 +961,7 @@ int32_t sxe2_drv_rss_key_set(struct sxe2_adapter *adapter, uint8_t *key, uint16_ req->vsi_id =rte_cpu_to_le_16 (adapter->vsi_ctxt.dpdk_vsi_id); req->key_size =rte_cpu_to_le_16 (key_size); -rte_memcpy (req->key, key, key_size); +memcpy (req->key, key, key_size); sxe2_drv_cmd_params_fill(adapter, ¶m, SXE2_DRV_CMD_RSS_KEY_SET, req, buf_size,
@@ -998,7 +998,7 @@ int32_t sxe2_drv_rss_lut_set(struct sxe2_adapter *adapter, uint8_t *lut, uint16_ req->vsi_id =rte_cpu_to_le_16 (adapter->vsi_ctxt.dpdk_vsi_id); req->lut_size =rte_cpu_to_le_16 (lut_size); -rte_memcpy (req->lut, lut, lut_size); +memcpy (req->lut, lut, lut_size); sxe2_drv_cmd_params_fill(adapter, ¶m, SXE2_DRV_CMD_RSS_LUT_SET, req, buf_size,
@@ -1890,7 +1890,7 @@ int32_t sxe2_drv_sfp_eeprom_read(struct sxe2_adapter *adapter, struct sxe2_sfp_r } ret =0 ; -rte_memcpy (sfp_info->data, resp->data, sfp_info->len); +memcpy (sfp_info->data, resp->data, sfp_info->len); l_end:if (resp) {
drivers/net/sxe2/sxe2_flow.c +5 -6
@@ -80,8 +80,8 @@ static int32_t sxe2_flow_check_hdr_duplicate(struct sxe2_flow_item *item_new,uint16_t size =sizeof (struct sxe2_flow_item );union sxe2_flow_item_raw item_raw_new;union sxe2_flow_item_raw item_raw_exist; -rte_memcpy (&item_raw_new.item, item_new, size); -rte_memcpy (&item_raw_exist.item, item_exist, size); +memcpy (&item_raw_new.item, item_new, size); +memcpy (&item_raw_exist.item, item_exist, size);for (i =0 ; i < size; i++) {if (item_raw_new.raw[i] != item_raw_exist.raw[i])
@@ -416,7 +416,7 @@ static int32_t sxe2_flow_src_split_proc(struct rte_eth_dev *dev, ret = -ENOMEM ; goto l_end; } -rte_memcpy (flow_new, flow,sizeof (struct sxe2_flow )); + *flow_new = *flow;TAILQ_INSERT_TAIL (sxe2_flow_list, flow_new, next); flow_new->meta.flow_src_vsi = flow_src_vsi[SXE2_MAX_DRV_TYPE_DPDK ][idx];
@@ -437,7 +437,7 @@ static int32_t sxe2_flow_src_split_proc(struct rte_eth_dev *dev, ret = -ENOMEM ; goto l_end; } -rte_memcpy (flow_new, flow,sizeof (struct sxe2_flow )); + *flow_new = *flow;TAILQ_INSERT_TAIL (sxe2_flow_list, flow_new, next); flow_new->meta.flow_src_vsi = flow_src_vsi[SXE2_MAX_DRV_TYPE_KERNEL ][idx];
@@ -697,8 +697,7 @@ static int32_t sxe2_flow_tunnel_split_proc(struct rte_eth_dev *dev __rte_unused, ret = -ENOMEM ; goto l_end; } -rte_memcpy (sxe2_flow_new, sxe2_flow_exist, -sizeof (struct sxe2_flow )); + *sxe2_flow_new = *sxe2_flow_exist; pattern = &sxe2_flow_new->pattern_outer; sxe2_flow_new->meta.tunnel_type =SXE2_FLOW_TUNNEL_TYPE_GRE ;
drivers/net/sxe2/sxe2_flow_parse_pattern.c +20 -16
@@ -787,20 +787,20 @@ static int32_t sxe2_flow_parse_pattern_eth(const struct rte_flow_item *item,sxe2_set_bit (SXE2_FLOW_FLD_ID_ETH_DA , pattern->map_mask);sxe2_set_bit (SXE2_FLOW_FLD_ID_ETH_DA , pattern->map_spec); -rte_memcpy (pattern->item_spec.eth.dst_addr, dst_addr_spec, -RTE_ETHER_ADDR_LEN ); -rte_memcpy (pattern->item_mask.eth.dst_addr, dst_addr_mask, -RTE_ETHER_ADDR_LEN ); +memcpy (pattern->item_spec.eth.dst_addr, dst_addr_spec, +RTE_ETHER_ADDR_LEN ); +memcpy (pattern->item_mask.eth.dst_addr, dst_addr_mask, +RTE_ETHER_ADDR_LEN ); }if (!rte_is_zero_ether_addr (src_addr_mask)) {if (!rte_is_broadcast_ether_addr (src_addr_mask))sxe2_set_bit (SXE2_FLOW_FLD_ID_ETH_SA , pattern->map_mask);sxe2_set_bit (SXE2_FLOW_FLD_ID_ETH_SA , pattern->map_spec); -rte_memcpy (pattern->item_spec.eth.src_addr, src_addr_spec, -RTE_ETHER_ADDR_LEN ); -rte_memcpy (pattern->item_mask.eth.src_addr, src_addr_mask, -RTE_ETHER_ADDR_LEN ); +memcpy (pattern->item_spec.eth.src_addr, src_addr_spec, +RTE_ETHER_ADDR_LEN ); +memcpy (pattern->item_mask.eth.src_addr, src_addr_mask, +RTE_ETHER_ADDR_LEN ); }if (type_mask !=0 ) {if (type_mask !=UINT16_MAX ) {
@@ -1130,10 +1130,12 @@ static int32_t sxe2_flow_parse_pattern_ipv6(const struct rte_flow_item *item, sizeof(ipv6_addr_mask)) != 0)sxe2_set_bit (SXE2_FLOW_FLD_ID_IPV6_SA , pattern->map_mask);sxe2_set_bit (SXE2_FLOW_FLD_ID_IPV6_SA , pattern->map_spec); -rte_memcpy (&pattern->item_spec.ipv6.saddr, &ipv6_spec->hdr.src_addr, -sizeof (ipv6_spec->hdr.src_addr)); -rte_memcpy (&pattern->item_mask.ipv6.saddr, &ipv6_mask->hdr.src_addr, -sizeof (ipv6_mask->hdr.src_addr)); +memcpy (&pattern->item_spec.ipv6.saddr, + &ipv6_spec->hdr.src_addr, +sizeof (ipv6_spec->hdr.src_addr)); +memcpy (&pattern->item_mask.ipv6.saddr, + &ipv6_mask->hdr.src_addr, +sizeof (ipv6_mask->hdr.src_addr)); }if (memcmp (&ipv6_mask->hdr.dst_addr, ipv6_addr_empty,sizeof (ipv6_addr_empty)) !=0 ) {
@@ -1141,10 +1143,12 @@ static int32_t sxe2_flow_parse_pattern_ipv6(const struct rte_flow_item *item, sizeof(ipv6_addr_mask)) != 0)sxe2_set_bit (SXE2_FLOW_FLD_ID_IPV6_DA , pattern->map_mask);sxe2_set_bit (SXE2_FLOW_FLD_ID_IPV6_DA , pattern->map_spec); -rte_memcpy (&pattern->item_spec.ipv6.daddr, &ipv6_spec->hdr.dst_addr, -sizeof (ipv6_spec->hdr.dst_addr)); -rte_memcpy (&pattern->item_mask.ipv6.daddr, &ipv6_mask->hdr.dst_addr, -sizeof (ipv6_mask->hdr.dst_addr)); +memcpy (&pattern->item_spec.ipv6.daddr, + &ipv6_spec->hdr.dst_addr, +sizeof (ipv6_spec->hdr.dst_addr)); +memcpy (&pattern->item_mask.ipv6.daddr, + &ipv6_mask->hdr.dst_addr, +sizeof (ipv6_mask->hdr.dst_addr)); }if (ipv6_mask->hdr.vtc_flow) { vtc_flow_mask =rte_be_to_cpu_32 (ipv6_mask->hdr.vtc_flow);
drivers/net/sxe2/sxe2_ipsec.c +1 -1
@@ -1159,7 +1159,7 @@ int sxe2_ipsec_pkt_metadata_set(void *device, struct rte_security_session *sessi md = RTE_MBUF_DYNFIELD(m, sxe2_sctx->ipsec_ctx.md_offset, struct sxe2_ipsec_pkt_metadata *); -memcpy (md, &sxe2_sess->pkt_metadata_template,sizeof (struct sxe2_ipsec_pkt_metadata )); + *md = sxe2_sess->pkt_metadata_template; md->esp_head_offset = offset; PMD_LOG_INFO(DRV, "ipsec metadata set, offset:%u, said:%u, mode:%u, algo:%u.", offset,
drivers/net/sxe2/sxe2_rss.c +5 -5
@@ -35,7 +35,7 @@ int32_t sxe2_rss_hash_key_init(struct rte_eth_dev *dev)for (i =0 ; i < rss_ctxt->rss_key_size; i++) rss_ctxt->rss_key[i] = (uint8_t )rte_rand (); }else { -rte_memcpy (rss_ctxt->rss_key, rss_conf->rss_key, +memcpy (rss_ctxt->rss_key, rss_conf->rss_key,RTE_MIN (rss_conf->rss_key_len, rss_ctxt->rss_key_size)); }
@@ -421,7 +421,7 @@ int32_t sxe2_dev_rss_reta_update(struct rte_eth_dev *dev, ret = -ENOMEM ; goto l_end; } -rte_memcpy (lut_tmp, rss_ctxt->rss_lut, reta_size); +memcpy (lut_tmp, rss_ctxt->rss_lut, reta_size);for (i =0 ; i < reta_size; i++) { idx = i /RTE_ETH_RETA_GROUP_SIZE ;
@@ -436,7 +436,7 @@ int32_t sxe2_dev_rss_reta_update(struct rte_eth_dev *dev, goto l_end; } -rte_memcpy (rss_ctxt->rss_lut, lut_tmp, reta_size); +memcpy (rss_ctxt->rss_lut, lut_tmp, reta_size); l_end:if (lut_tmp)
@@ -514,7 +514,7 @@ static int32_t sxe2_rss_hash_key_update(struct rte_eth_dev *dev, goto l_end; } -rte_memcpy (rss_ctxt->rss_key, rss_conf->rss_key, rss_conf->rss_key_len); +memcpy (rss_ctxt->rss_key, rss_conf->rss_key, rss_conf->rss_key_len); l_end:return ret; }
@@ -575,7 +575,7 @@ int32_t sxe2_dev_rss_hash_conf_get(struct rte_eth_dev *dev,if (rss_conf->rss_key) { rss_conf->rss_key_len = rss_ctxt->rss_key_size; -rte_memcpy (rss_conf->rss_key, rss_ctxt->rss_key, rss_ctxt->rss_key_size); +memcpy (rss_conf->rss_key, rss_ctxt->rss_key, rss_ctxt->rss_key_size); } rss_conf->rss_hf = rss_ctxt->rss_hf; rss_conf->algorithm = rss_ctxt->hash_func;
drivers/net/sxe2/sxe2_rx.c +2 -2
@@ -311,8 +311,8 @@ int32_t __rte_cold sxe2_rx_queue_setup(struct rte_eth_dev *dev,if (rx_nseg >1 ) {for (i =0 ; i < rx_nseg; i++) { -rte_memcpy (&rxq->rx_seg[i], &rx_conf->rx_seg[i].split, -sizeof (struct rte_eth_rxseg_split )); +memcpy (&rxq->rx_seg[i], &rx_conf->rx_seg[i].split, +sizeof (struct rte_eth_rxseg_split )); } rxq->mb_pool = rxq->rx_seg[0 ].mp; }else {
drivers/net/sxe2/sxe2_stats.c +13 -12
@@ -288,18 +288,19 @@ static void sxe2_stats_update(struct sxe2_adapter *adapter) stats->rx_frame_good_bad = hw_stats->rx_frame_good_bad; stats->rx_unicast_good = hw_stats->rx_unicast_good; stats->rx_vlan_packets = hw_stats->rx_vlan_packets; -rte_memcpy (stats->rx_prio_buf_discard, hw_stats->rx_prio_buf_discard, -sizeof (hw_stats->rx_prio_buf_discard)); -rte_memcpy (stats->prio_xoff_rx, hw_stats->prio_xoff_rx, -sizeof (hw_stats->prio_xoff_rx)); -rte_memcpy (stats->prio_xon_rx, hw_stats->prio_xon_rx, -sizeof (hw_stats->prio_xon_rx)); -rte_memcpy (stats->prio_xon_tx, hw_stats->prio_xon_tx, -sizeof (hw_stats->prio_xon_tx)); -rte_memcpy (stats->prio_xoff_tx, hw_stats->prio_xoff_tx, -sizeof (hw_stats->prio_xoff_tx)); -rte_memcpy (stats->prio_xon_2_xoff, hw_stats->prio_xon_2_xoff, -sizeof (hw_stats->prio_xon_2_xoff)); +memcpy (stats->rx_prio_buf_discard, + hw_stats->rx_prio_buf_discard, +sizeof (hw_stats->rx_prio_buf_discard)); +memcpy (stats->prio_xoff_rx, hw_stats->prio_xoff_rx, +sizeof (hw_stats->prio_xoff_rx)); +memcpy (stats->prio_xon_rx, hw_stats->prio_xon_rx, +sizeof (hw_stats->prio_xon_rx)); +memcpy (stats->prio_xon_tx, hw_stats->prio_xon_tx, +sizeof (hw_stats->prio_xon_tx)); +memcpy (stats->prio_xoff_tx, hw_stats->prio_xoff_tx, +sizeof (hw_stats->prio_xoff_tx)); +memcpy (stats->prio_xon_2_xoff, hw_stats->prio_xon_2_xoff, +sizeof (hw_stats->prio_xon_2_xoff)); stats->imissed = hw_stats->rx_out_of_buffer + hw_stats->rx_qblock_drop;
drivers/net/sxe2/sxe2_tm.c +2 -2
@@ -421,8 +421,8 @@ static int32_t sxe2_tm_shaper_profile_add(struct rte_eth_dev *dev, uint32_t shap goto l_end; } -rte_memcpy (&shaper_profile->profile, profile, -sizeof (struct rte_tm_shaper_params )); +memcpy (&shaper_profile->profile, profile, +sizeof (struct rte_tm_shaper_params )); shaper_profile->id = shaper_profile_id;TAILQ_INSERT_TAIL (&adapter->tm_ctxt.profile_list, shaper_profile, node);
Signature · 1 line
2.53.0
PATCH 45/61 net/zxdh: replace use of rte_memcpy
In reply to Stephen HemmingerThe uses of rte_memcpy() in the control path of the zxdh driver have no performance benefit over regular memcpy(), and regular memcpy() gets more compile time checking of the arguments.
The only remaining rte_memcpy() is in zxdh_xmit_fill_net_hdr() which is on the transmit fast path.
--- drivers/net/zxdh/zxdh_common.c | 7 ++-- drivers/net/zxdh/zxdh_flow.c | 67 +++++++++++++++++++--------------- drivers/net/zxdh/zxdh_msg.c | 15 ++++---- drivers/net/zxdh/zxdh_mtr.c | 10 ++--- drivers/net/zxdh/zxdh_np.c | 1 - drivers/net/zxdh/zxdh_queue.c | 8 ++-- drivers/net/zxdh/zxdh_tables.c | 21 ++++++----- 7 files changed, 70 insertions(+), 59 deletions(-)
drivers/net/zxdh/zxdh_common.c +3 -4
@@ -7,7 +7,6 @@#include <ethdev_driver.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include "zxdh_ethdev.h" #include "zxdh_logs.h"
@@ -79,7 +78,7 @@ zxdh_fill_common_msg(struct zxdh_hw *hw, struct zxdh_pci_bar_msg *desc, msg_data->pcie_id = hw->pcie_id; msg_data->slen = buff_size;if (buff_size !=0 ) -rte_memcpy (msg_data +1 , buff, buff_size); +memcpy (msg_data +1 , buff, buff_size);return 0 ; }
@@ -123,7 +122,7 @@ zxdh_common_rsp_check(struct zxdh_msg_recviver_mem *msg_rsp,return -1 ; }if (len !=0 ) -rte_memcpy (buff, rsp_hdr +1 , len); +memcpy (buff, rsp_hdr +1 , len);return 0 ; }
@@ -228,7 +227,7 @@ zxdh_get_res_info(struct zxdh_res_para *dev, uint8_t field, uint8_t *res, uint16return ret; } *len = tbl_reps->len; -rte_memcpy (res, (recv_buf +ZXDH_REPS_HEADER_OFFSET + +memcpy (res, (recv_buf +ZXDH_REPS_HEADER_OFFSET +sizeof (struct zxdh_tbl_msg_reps_header )), *len);return ret; }
drivers/net/zxdh/zxdh_flow.c +38 -29
123 lines not on this page · raw message
drivers/net/zxdh/zxdh_msg.c +8 -7
@@ -3,9 +3,9 @@*/ #include <stdbool.h> +#include <string.h> #include <rte_common.h> -#include <rte_memcpy.h> #include <rte_spinlock.h> #include <rte_cycles.h> #include <inttypes.h>
@@ -899,7 +899,7 @@ zxdh_bar_msg_ack_async_msg_proc(struct zxdh_bar_msg_header *msg_header, }uint8_t *reps_buffer = (uint8_t *)reps_info->reps_addr; -rte_memcpy (reps_buffer +4 , receiver_buff, msg_header->len); +memcpy (reps_buffer +4 , receiver_buff, msg_header->len); *(uint16_t *)(reps_buffer +1 ) = msg_header->len; *(uint8_t *)(reps_info->reps_addr) =ZXDH_REPS_HEADER_REPLYED ;
@@ -1406,13 +1406,13 @@ zxdh_vf_port_uninit(struct zxdh_hw *pf_hw, uint16_t vport, } *res_len +=strlen (str); -rte_memcpy (reply_data_addr, str,strlen (str) +1 ); +memcpy (reply_data_addr, str,strlen (str) +1 );ZXDH_SET (msg_reply_body, res_info, flag,ZXDH_REPS_SUCC );return ret; proc_end: *res_len +=strlen (str); -rte_memcpy (reply_data_addr, str,strlen (str) +1 ); +memcpy (reply_data_addr, str,strlen (str) +1 );ZXDH_SET (msg_reply_body, res_info, flag,ZXDH_REPS_FAIL );return ret; }
@@ -1458,7 +1458,7 @@ zxdh_add_vf_mac_table(struct zxdh_hw *hw, uint16_t vport, success:sprintf (str," vport 0x%x set mac ret 0x%x\n" , port.vport, ret); *reply_len =strlen (str) +ZXDH_MSG_REPLYBODY_HEAD ; -rte_memcpy (reply_data_addr, str,strlen (str) +1 ); +memcpy (reply_data_addr, str,strlen (str) +1 );ZXDH_SET (msg_reply_body, reply_body, flag,ZXDH_REPS_SUCC );PMD_DRV_LOG (DEBUG ," reply len %d" , *reply_len);return ret;
@@ -1499,7 +1499,7 @@ zxdh_del_vf_mac_table(struct zxdh_hw *hw, uint16_t vport,sprintf (str,"vport 0x%x del mac ret 0x%x\n" , port.vport, ret); *res_len =strlen (str) +ZXDH_MSG_REPLYBODY_HEAD ; -rte_memcpy (reply_data_addr, str,strlen (str) +1 ); +memcpy (reply_data_addr, str,strlen (str) +1 );ZXDH_SET (msg_reply_body, res_info, flag,ZXDH_REPS_SUCC );return ret;
@@ -2331,7 +2331,8 @@ zxdh_vf_flow_hw_get(struct zxdh_hw *pf_hw, uint16_t vport, }PMD_DRV_LOG (INFO ," res len :%d" , *res_len); dh_flow = flow_rsp_addr; -rte_memcpy (&dh_flow->flowentry, &flow_entry->dh_flow.flowentry,sizeof (dh_flow->flowentry)); +memcpy (&dh_flow->flowentry, &flow_entry->dh_flow.flowentry, +sizeof (dh_flow->flowentry));ZXDH_SET (msg_reply_body, res_info, flag,ZXDH_REPS_SUCC );return 0 ; }
drivers/net/zxdh/zxdh_mtr.c +5 -5
@@ -590,9 +590,8 @@ static int zxdh_hw_profile_config(struct rte_eth_dev *dev, uint16_t hw_profile_i zxdh_plcr_profile_cfg->car_type =CAR_A ; zxdh_plcr_profile_cfg->packet_mode = mp->profile.packet_mode; zxdh_plcr_profile_cfg->hw_profile_id = hw_profile_id; -rte_memcpy (&zxdh_plcr_profile_cfg->plcr_param, - &mp->plcr_param, -sizeof (zxdh_plcr_profile_cfg->plcr_param)); +memcpy (&zxdh_plcr_profile_cfg->plcr_param, &mp->plcr_param, +sizeof (zxdh_plcr_profile_cfg->plcr_param));zxdh_msg_head_build (hw,ZXDH_PLCR_CAR_PROFILE_CFG_SET , &msg_info); ret = zxdh_vf_send_msg_to_pf(dev,
@@ -685,7 +684,7 @@ zxdh_meter_profile_add(struct rte_eth_dev *dev, mp->meter_profile_id = meter_profile_id; mp->dpdk_port_id = dev->data->port_id; mp->hw_profile_id =UINT16_MAX ; -rte_memcpy (&mp->profile, profile,sizeof (struct rte_mtr_meter_profile )); +memcpy (&mp->profile, profile,sizeof (struct rte_mtr_meter_profile )); ret =zxdh_mtr_profile_offload (dev, mp, profile, error);if (ret) {
@@ -772,7 +771,8 @@ zxdh_meter_policy_add(struct rte_eth_dev *dev,memset (mtr_policy,0 ,sizeof (struct zxdh_meter_policy )); mtr_policy->policy_id = policy_id; mtr_policy->dpdk_port_id = dev->data->port_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 ));/* Add to list. */ TAILQ_INSERT_TAIL (&zxdh_shared_data->mtr_policy_list, mtr_policy, next); mtr_policy->ref_cnt++;
drivers/net/zxdh/zxdh_np.c +0 -1
@@ -9,7 +9,6 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include "zxdh_np.h" #include "zxdh_logs.h"
drivers/net/zxdh/zxdh_queue.c +4 -4
@@ -244,8 +244,8 @@ zxdh_dev_rx_queue_setup(struct rte_eth_dev *dev, hw->queue_conf->queue_changed =1 ; } -rte_memcpy (&hw->queue_conf->conf[queue_idx].zxdh_rx_conf, - rx_conf,sizeof (struct rte_eth_rxconf )); +memcpy (&hw->queue_conf->conf[queue_idx].zxdh_rx_conf, rx_conf, +sizeof (struct rte_eth_rxconf )); hw->queue_conf->conf[queue_idx].rx_nb_desc = valid_nb_desc; hw->queue_conf->conf[queue_idx].queue_mp = mp;
@@ -336,8 +336,8 @@ zxdh_dev_tx_queue_setup(struct rte_eth_dev *dev, hw->queue_conf->queue_changed =1 ; } -rte_memcpy (&hw->queue_conf->conf[queue_idx].zxdh_tx_conf, - tx_conf,sizeof (struct rte_eth_txconf )); +memcpy (&hw->queue_conf->conf[queue_idx].zxdh_tx_conf, tx_conf, +sizeof (struct rte_eth_txconf )); hw->queue_conf->conf[queue_idx].tx_nb_desc = valid_nb_desc;return 0 ;
drivers/net/zxdh/zxdh_tables.c +12 -9
@@ -248,7 +248,8 @@ zxdh_add_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *adint32_t ret;if (rte_is_unicast_ether_addr (addr)) { -rte_memcpy (unicast_table.key.dmac_addr, addr,sizeof (struct rte_ether_addr )); +memcpy (unicast_table.key.dmac_addr, addr, +sizeof (struct rte_ether_addr )); unicast_table.key.sriov_vlan_tpid = srv_tpid; unicast_table.key.sriov_vlan_id = srv_vlanid;
@@ -286,8 +287,8 @@ zxdh_add_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *ad }else {for (group_id =0 ; group_id <4 ; group_id++) { multicast_table.key.vf_group_id = group_id; -rte_memcpy (multicast_table.key.mac_addr, - addr,sizeof (struct rte_ether_addr )); +memcpy (multicast_table.key.mac_addr, addr, +sizeof (struct rte_ether_addr ));ZXDH_DTB_HASH_ENTRY_INFO_T dtb_hash_entry = { .p_actu_key = (uint8_t *)&multicast_table.key, .p_rst = (uint8_t *)&multicast_table.entry
@@ -353,7 +354,8 @@ zxdh_del_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *adint32_t ret =0 ;if (rte_is_unicast_ether_addr (addr)) { -rte_memcpy (unicast_table.key.dmac_addr, addr,sizeof (struct rte_ether_addr )); +memcpy (unicast_table.key.dmac_addr, addr, +sizeof (struct rte_ether_addr )); unicast_table.key.sriov_vlan_id = srv_vlanid; unicast_table.key.sriov_vlan_tpid = srv_tpid; unicast_table.entry.hit_flag =0 ;
@@ -385,7 +387,8 @@ zxdh_del_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *ad } }else { multicast_table.key.vf_group_id = vport_num.vfid /64 ; -rte_memcpy (multicast_table.key.mac_addr, addr,sizeof (struct rte_ether_addr )); +memcpy (multicast_table.key.mac_addr, addr, +sizeof (struct rte_ether_addr ));ZXDH_DTB_HASH_ENTRY_INFO_T dtb_hash_entry = { .p_actu_key = (uint8_t *)&multicast_table.key,
@@ -416,8 +419,8 @@ zxdh_del_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *adfor (group_id =0 ; group_id <ZXDH_MC_GROUP_NUM ; group_id++) { multicast_table.key.vf_group_id = group_id; -rte_memcpy (multicast_table.key.mac_addr, addr, -sizeof (struct rte_ether_addr )); +memcpy (multicast_table.key.mac_addr, addr, +sizeof (struct rte_ether_addr ));ZXDH_DTB_HASH_ENTRY_INFO_T dtb_hash_entry = { .p_actu_key = (uint8_t *)&multicast_table.key, .p_rst = (uint8_t *)&multicast_table.entry
@@ -441,8 +444,8 @@ zxdh_del_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *adif (del_flag) {for (group_id =0 ; group_id <ZXDH_MC_GROUP_NUM ; group_id++) { multicast_table.key.vf_group_id = group_id; -rte_memcpy (multicast_table.key.mac_addr, addr, -sizeof (struct rte_ether_addr )); +memcpy (multicast_table.key.mac_addr, addr, +sizeof (struct rte_ether_addr ));ZXDH_DTB_HASH_ENTRY_INFO_T dtb_hash_entry = { .p_actu_key = (uint8_t *)&multicast_table.key, .p_rst = (uint8_t *)&multicast_table.entry
Signature · 1 line
2.53.0
PATCH 46/61 net/memif: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/net/memif/memif_socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/memif/memif_socket.c +2 -2
@@ -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); }
Signature · 1 line
2.53.0
PATCH 47/61 net/ice: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/net/intel/ice/ice_fdir_filter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_fdir_filter.c +2 -2
@@ -2873,8 +2873,8 @@ ice_fdir_parse_action(struct ice_adapter *ad,const struct rte_flow_action_count *act_count = act->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 :
Signature · 1 line
2.53.0
PATCH 48/61 test-bbdev: remove unnecessary include rte_memcpy.h
In reply to Stephen Hemmingerrte_memcpy not used here.
--- app/test-bbdev/test_bbdev.c | 1 - 1 file changed, 1 deletion(-)
app/test-bbdev/test_bbdev.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH 49/61 drivers/mempool: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/mempool/dpaa/dpaa_mempool.c | 4 ++-- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-)
drivers/mempool/dpaa/dpaa_mempool.c +2 -2
@@ -124,8 +124,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);
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +2 -3
@@ -17,7 +17,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>
@@ -143,8 +142,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);
Signature · 1 line
2.53.0
PATCH 50/61 ml/cnxk: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/ml/cnxk/cn10k_ml_model.c | 8 +++++--- drivers/ml/cnxk/cn10k_ml_ops.c | 8 +++++--- drivers/ml/cnxk/tvmrt_ml_model.c | 9 +++++---- drivers/ml/cnxk/tvmrt_ml_ops.c | 6 +++--- 4 files changed, 18 insertions(+), 13 deletions(-)
drivers/ml/cnxk/cn10k_ml_model.c +5 -3
@@ -564,7 +564,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 ]);
@@ -583,7 +583,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;
@@ -596,7 +597,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;
drivers/ml/cnxk/cn10k_ml_ops.c +5 -3
@@ -668,7 +668,8 @@ 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);/* Enable support for batch_size of 256 */
@@ -745,11 +746,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 )
drivers/ml/cnxk/tvmrt_ml_model.c +5 -4
@@ -848,7 +848,7 @@ tvmrt_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *moif (model->subtype ==ML_CNXK_MODEL_SUBTYPE_TVM_MRVL ) goto tvm_mrvl_model; -rte_memcpy (info->name, model->name,RTE_ML_STR_MAX ); +memcpy (info->name, model->name,RTE_ML_STR_MAX );snprintf (info->version,RTE_ML_STR_MAX ,"%u.%u.%u.%u" ,0 ,0 ,0 ,0 ); info->model_id = model->model_id; info->device_id = cnxk_mldev->mldev->data->dev_id;
@@ -863,7 +863,8 @@ tvmrt_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, model->tvmrt.info.input[i].name,MRVL_ML_INPUT_NAME_LEN ); +memcpy (input[i].name, model->tvmrt.info.input[i].name, +MRVL_ML_INPUT_NAME_LEN ); input[i].nb_dims = model->tvmrt.info.input[i].nb_dims; input[i].shape = &model->tvmrt.info.input[i].shape[0 ]; input[i].type = model->tvmrt.info.input[i].qtype;
@@ -876,8 +877,8 @@ tvmrt_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, model->tvmrt.info.output[i].name, -MRVL_ML_OUTPUT_NAME_LEN ); +memcpy (output[i].name, model->tvmrt.info.output[i].name, +MRVL_ML_OUTPUT_NAME_LEN ); output[i].nb_dims = model->tvmrt.info.output[i].nb_dims; output[i].shape = &model->tvmrt.info.output[i].shape[0 ]; output[i].type = model->tvmrt.info.output[i].qtype;
drivers/ml/cnxk/tvmrt_ml_ops.c +3 -3
@@ -229,7 +229,7 @@ tvmrt_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params */* Copy mod.so */ model->tvmrt.so.buffer = mz->addr; model->tvmrt.so.size = object[0 ].size; -rte_memcpy (model->tvmrt.so.name, object[0 ].name,RTE_ML_STR_MAX ); +memcpy (model->tvmrt.so.name, object[0 ].name,RTE_ML_STR_MAX );rte_memcpy (model->tvmrt.so.buffer, object[0 ].buffer, object[0 ].size);rte_free (object[0 ].buffer);
@@ -238,7 +238,7 @@ tvmrt_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params *RTE_PTR_ADD (model->tvmrt.so.buffer,RTE_ALIGN_CEIL (model->tvmrt.so.size,RTE_CACHE_LINE_MIN_SIZE )); model->tvmrt.json.size = object[1 ].size; -rte_memcpy (model->tvmrt.json.name, object[1 ].name,RTE_ML_STR_MAX ); +memcpy (model->tvmrt.json.name, object[1 ].name,RTE_ML_STR_MAX );rte_memcpy (model->tvmrt.json.buffer, object[1 ].buffer, object[1 ].size);rte_free (object[1 ].buffer);
@@ -247,7 +247,7 @@ tvmrt_ml_model_load(struct cnxk_ml_dev *cnxk_mldev, struct rte_ml_model_params *RTE_PTR_ADD (model->tvmrt.json.buffer,RTE_ALIGN_CEIL (model->tvmrt.json.size,RTE_CACHE_LINE_MIN_SIZE )); model->tvmrt.params.size = object[2 ].size; -rte_memcpy (model->tvmrt.params.name, object[2 ].name,RTE_ML_STR_MAX ); +memcpy (model->tvmrt.params.name, object[2 ].name,RTE_ML_STR_MAX );rte_memcpy (model->tvmrt.params.buffer, object[2 ].buffer, object[2 ].size);rte_free (object[2 ].buffer);
Signature · 1 line
2.53.0
PATCH 51/61 drivers/event: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- 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 | 3 +-- drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 1 - drivers/event/octeontx/ssovf_evdev_selftest.c | 1 - drivers/event/octeontx/timvf_evdev.c | 4 ++-- 8 files changed, 7 insertions(+), 12 deletions(-)
drivers/event/cnxk/cnxk_eventdev_selftest.c +0 -1
@@ -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>
drivers/event/cnxk/cnxk_tim_evdev.c +2 -2
@@ -141,8 +141,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
drivers/event/dlb2/dlb2.c +2 -2
@@ -1832,7 +1832,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 */
@@ -2026,7 +2026,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 */
drivers/event/dpaa/dpaa_eventdev.c +0 -1
@@ -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>
drivers/event/dpaa2/dpaa2_eventdev.c +1 -2
@@ -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 ));
drivers/event/dpaa2/dpaa2_eventdev_selftest.c +0 -1
@@ -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>
drivers/event/octeontx/ssovf_evdev_selftest.c +0 -1
@@ -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>
drivers/event/octeontx/timvf_evdev.c +2 -2
@@ -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
Signature · 1 line
2.53.0
PATCH 52/61 baseband/la12xx: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/baseband/la12xx/bbdev_la12xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/baseband/la12xx/bbdev_la12xx.c +2 -2
@@ -599,8 +599,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++;
Signature · 1 line
2.53.0
PATCH 53/61 baseband/acc: replace use of rte_memcpy
In reply to Stephen HemmingerUsing rte_memcpy is not needed here.
--- drivers/baseband/acc/rte_acc100_pmd.c | 7 ++++--- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/baseband/acc/rte_acc100_pmd.c +4 -3
@@ -2890,7 +2890,7 @@ enqueue_ldpc_dec_one_op_cb(struct acc_queue *q, struct rte_bbdev_dec_op *op, dec->q_m =1 ; dec->cb_params.e = dec->n_cb - dec->n_filler; dec->rv_index =0 ; -rte_memcpy (in, q->derm_buffer, dec->cb_params.e); +memcpy (in, q->derm_buffer, dec->cb_params.e);/* Capture counter when pre-processing is used */ q_data->queue_stats.enqueue_warn_count++;#else
@@ -2988,7 +2988,8 @@ 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,
@@ -4266,7 +4267,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 );
drivers/baseband/acc/rte_vrb_pmd.c +10 -11
@@ -2593,15 +2593,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);
@@ -2709,7 +2707,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,
@@ -4140,7 +4139,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;
@@ -4490,7 +4489,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);
@@ -4897,7 +4896,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;
Signature · 1 line
2.53.0
PATCH 54/61 drivers/*/qat: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/common/qat/qat_qp.c | 10 ++++----- drivers/compress/qat/qat_comp.c | 8 +++---- drivers/crypto/qat/qat_sym_session.c | 33 ++++++++++++++-------------- 3 files changed, 24 insertions(+), 27 deletions(-)
drivers/common/qat/qat_qp.c +4 -6
@@ -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 =
drivers/compress/qat/qat_comp.c +4 -4
@@ -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",
drivers/crypto/qat/qat_sym_session.c +16 -17
@@ -1585,8 +1585,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 -
@@ -2101,8 +2101,8 @@ static 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 ;
@@ -2113,9 +2113,8 @@ static 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 =
@@ -2154,8 +2153,8 @@ static 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 ;
@@ -2174,8 +2173,8 @@ static 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 ;
@@ -2193,8 +2192,8 @@ static 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 ;
@@ -2212,8 +2211,8 @@ static 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 ;
@@ -2231,8 +2230,8 @@ static 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 ;
Signature · 1 line
2.53.0
PATCH 55/61 hash: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need to use rte_memcpy to copy small key value here.
--- lib/hash/rte_thash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/hash/rte_thash.c +2 -2
@@ -3,13 +3,13 @@*/ #include <stdalign.h> +#include <string.h> #include <sys/queue.h> #include <eal_export.h> #include <rte_thash.h> #include <rte_tailq.h> #include <rte_random.h> -#include <rte_memcpy.h> #include <rte_errno.h> #include <rte_eal_memconfig.h> #include <rte_log.h>
@@ -263,7 +263,7 @@ rte_thash_init_ctx(const char *name, uint32_t key_len, uint32_t reta_sz, ctx->flags = flags;if (key) -rte_memcpy (ctx->hash_key, key, key_len); +memcpy (ctx->hash_key, key, key_len);else {for (i =0 ; i < key_len; i++) ctx->hash_key[i] =rte_rand ();
Signature · 1 line
2.53.0
PATCH 56/61 rib: remove rte_memcpy include
In reply to Stephen HemmingerThe rte_memcpy function is no longer used in this library.
--- lib/rib/rte_rib6.h | 1 - 1 file changed, 1 deletion(-)
lib/rib/rte_rib6.h +0 -1
@@ -14,7 +14,6 @@* Level compressed tree implementation for IPv6 Longest Prefix Match */ -#include <rte_memcpy.h> #include <rte_ip6.h> #ifdef __cplusplus
Signature · 1 line
2.53.0
PATCH 57/61 pcapng: replace use of rte_memcpy
In reply to Stephen HemmingerThe rte_memcpy is only in the wrapper for Windows where writev() is not present. Using memcpy is safer.
--- lib/pcapng/rte_pcapng.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/pcapng/rte_pcapng.c +1 -1
@@ -95,7 +95,7 @@ static ssize_t writev(int fd, const struct iovec *iov, int iovcnt) ptr = tmp_buf;for (i =0 ; i < iovcnt; i++) { -rte_memcpy (ptr, iov[i].iov_base, iov[i].iov_len); +memcpy (ptr, iov[i].iov_base, iov[i].iov_len); ptr += iov[i].iov_len; }
Signature · 1 line
2.53.0
PATCH 58/61 efd: replace use of rte_memcpy
In reply to Stephen HemmingerCopying small key with rte_memcpy is better done with memcpy which enables more analysis checks.
--- lib/efd/rte_efd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
lib/efd/rte_efd.c +1 -2
@@ -18,7 +18,6 @@#include <rte_malloc.h> #include <rte_prefetch.h> #include <rte_branch_prediction.h> -#include <rte_memcpy.h> #include <rte_ring.h> #include <rte_jhash.h> #include <rte_hash_crc.h>
@@ -1060,7 +1059,7 @@ efd_compute_update(struct rte_efd_table * const table,rte_prefetch0 (new_k); new_idx = (uint32_t ) ((uintptr_t ) slot_id); -rte_memcpy (EFD_KEY (new_idx, table), key, table->key_len); +memcpy (EFD_KEY (new_idx, table), key, table->key_len); current_group->key_idx[current_group->num_rules] = new_idx; current_group->value[current_group->num_rules] = value; current_group->bin_id[current_group->num_rules] = *bin_id;
Signature · 1 line
2.53.0
PATCH 59/61 net/xsc: replace use of rte_memcpy
In reply to Stephen HemmingerThe use of rte_memcpy() when building the RSS hash key mailbox command is control path only. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
The remaining uses of rte_memcpy() in xsc_tx_elts_store() are left alone since that is on the transmit fast path.
--- drivers/net/xsc/xsc_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xsc/xsc_dev.c +1 -1
@@ -159,7 +159,7 @@ xsc_dev_rss_key_modify(struct xsc_dev *xdev, uint8_t *rss_key, uint8_t rss_key_l in.hdr.opcode =rte_cpu_to_be_16 (XSC_CMD_OP_MODIFY_NIC_HCA ); key_len =RTE_MIN (rss_key_len,XSC_RSS_HASH_KEY_LEN ); -rte_memcpy (in.rss.hash_key, rss_key, key_len); +memcpy (in.rss.hash_key, rss_key, key_len); rss_caps_mask |=RTE_BIT32 (XSC_RSS_HASH_KEY_UPDATE ); in.rss.caps_mask = rss_caps_mask;
Signature · 1 line
2.53.0
PATCH 60/61 net/pcap: replace use of rte_memcpy
In reply to Stephen HemmingerThe pcap driver is not used for high speed production traffic, so any marginal performance difference from using regular memcpy() does not matter. Regular memcpy() gets more compile time checking of the arguments.
--- drivers/net/pcap/pcap_ethdev.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/pcap/pcap_ethdev.c +4 -5
@@ -25,7 +25,6 @@#include <ethdev_vdev.h> #include <rte_kvargs.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h> #include <bus_vdev_driver.h>
@@ -233,7 +232,7 @@ eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,uint16_t len =rte_pktmbuf_tailroom (mbuf);struct rte_mbuf *m = mbuf; -rte_memcpy (rte_pktmbuf_append (mbuf, len), data, len); +memcpy (rte_pktmbuf_append (mbuf, len), data, len); data_len -= len; data += len;
@@ -253,7 +252,7 @@ eth_pcap_rx_jumbo(struct rte_mempool *mb_pool, struct rte_mbuf *mbuf,/* Copy next segment. */ len =RTE_MIN (rte_pktmbuf_tailroom (m), data_len); -rte_memcpy (rte_pktmbuf_append (m, len), data, len); +memcpy (rte_pktmbuf_append (m, len), data, len); mbuf->nb_segs++; data_len -= len;
@@ -282,7 +281,7 @@ eth_pcap_rx_infinite(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)if (err)return i; - rte_memcpy(rte_pktmbuf_mtod(bufs[i], void *), + memcpy(rte_pktmbuf_mtod(bufs[i], void *),rte_pktmbuf_mtod (pcap_buf ,void *), pcap_buf->data_len); bufs[i]->data_len = pcap_buf->data_len;
@@ -389,7 +388,7 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)uint32_t len = header->caplen;if (len <=rte_pktmbuf_tailroom (mbuf)) {/* pcap packet will fit in the mbuf, can copy it */ - rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), packet, len); + memcpy(rte_pktmbuf_mtod(mbuf, void *), packet, len); mbuf->data_len = len; }else if (pcap_q->rx_scatter) {/* Scatter into multi-segment mbufs. */
Signature · 1 line
2.53.0
PATCH 61/61 power: replace use of rte_memcpy
In reply to Stephen HemmingerAll the uses of rte_memcpy() in the power drivers are in the frequency list query API, which is control path only. Regular memcpy() has no performance disadvantage there and gets more compile time checking of the arguments.
--- drivers/power/acpi/acpi_cpufreq.c | 4 ++-- drivers/power/amd_pstate/amd_pstate_cpufreq.c | 4 ++-- drivers/power/amd_uncore/amd_uncore.c | 5 ++--- drivers/power/cppc/cppc_cpufreq.c | 4 ++-- drivers/power/intel_pstate/intel_pstate_cpufreq.c | 3 +-- drivers/power/intel_uncore/intel_uncore.c | 5 ++--- 6 files changed, 11 insertions(+), 14 deletions(-)
drivers/power/acpi/acpi_cpufreq.c +2 -2
@@ -5,8 +5,8 @@#include <stdio.h> #include <fcntl.h> #include <stdlib.h> +#include <string.h> -#include <rte_memcpy.h> #include <rte_stdatomic.h> #include <rte_string_fns.h>
@@ -364,7 +364,7 @@ power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)POWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t ));return pi->nb_freqs; }
drivers/power/amd_pstate/amd_pstate_cpufreq.c +2 -2
@@ -5,8 +5,8 @@*/ #include <stdlib.h> +#include <string.h> -#include <rte_memcpy.h> #include <rte_stdatomic.h> #include "amd_pstate_cpufreq.h"
@@ -483,7 +483,7 @@ power_amd_pstate_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_tPOWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t ));return pi->nb_freqs; }
drivers/power/amd_uncore/amd_uncore.c +2 -3
@@ -5,8 +5,7 @@#include <errno.h> #include <dirent.h> #include <fnmatch.h> - -#include <rte_memcpy.h> +#include <string.h> #include "amd_uncore.h" #include "power_common.h"
@@ -269,7 +268,7 @@ power_amd_uncore_freqs(unsigned int pkg, unsigned int die, uint32_t *freqs, uintPOWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, ui->freqs, ui->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, ui->freqs, ui->nb_freqs *sizeof (uint32_t ));return ui->nb_freqs; }
drivers/power/cppc/cppc_cpufreq.c +2 -2
@@ -4,8 +4,8 @@*/ #include <stdlib.h> +#include <string.h> -#include <rte_memcpy.h> #include <rte_stdatomic.h> #include "cppc_cpufreq.h"
@@ -469,7 +469,7 @@ power_cppc_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)POWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t ));return pi->nb_freqs; }
drivers/power/intel_pstate/intel_pstate_cpufreq.c +1 -2
@@ -11,7 +11,6 @@#include <errno.h> #include <inttypes.h> -#include <rte_memcpy.h> #include <rte_stdatomic.h> #include "rte_power_pmd_mgmt.h"
@@ -679,7 +678,7 @@ power_pstate_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)POWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, pi->freqs, pi->nb_freqs *sizeof (uint32_t ));return pi->nb_freqs; }
drivers/power/intel_uncore/intel_uncore.c +2 -3
@@ -5,8 +5,7 @@#include <errno.h> #include <dirent.h> #include <fnmatch.h> - -#include <rte_memcpy.h> +#include <string.h> #include "intel_uncore.h" #include "power_common.h"
@@ -394,7 +393,7 @@ power_intel_uncore_freqs(unsigned int pkg, unsigned int die, uint32_t *freqs, uiPOWER_LOG (ERR ,"Buffer size is not enough" );return 0 ; } -rte_memcpy (freqs, ui->freqs, ui->nb_freqs *sizeof (uint32_t )); +memcpy (freqs, ui->freqs, ui->nb_freqs *sizeof (uint32_t ));return ui->nb_freqs; }
Signature · 1 line
2.53.0
About replacing rte_memcpy with memcpy()...
Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on some platforms.
Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell [1].
Where similar performance improvements implemented in the relevant compilers (GCC, Clang, MSVC)?
[1]: https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd3675fa
IMO, performance should remain a high priority for DPDK.
Quoted 5 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.
I think this is the only substantial benefit of replacing rte_memcpy() with memcpy()!
Could we reap this benefit by having special builds for such tools, where rte_memcpy() is modified to use memcpy() instead? Then we wouldn't have to compromise on performance.
Also, rte_memcpy() used to have a pragma disabling bounds checks due to some Intel drivers using [0] instead of []; the pragma was removed from rte_memcpy() when the Intel drivers were fixed. I'm not sufficiently familiar with analysis/test tools to say what they can detect when using memcpy() instead of the copy methods used by rte_memcpy().
Quoted 9 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.handstring.hwhere needed. Often the includes were happening by some other header. And also removal ofrte_memcpy.hwhere no longer needed.
Quoted 7 lines
The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.No functional change, no warnings in all compilers including LTO.
memcpy() does not always use inline vector instructions for fixed size copy [2].
[2]: https://inbox.dpdk.org/dev/[email protected]/
Another disadvantage of rte_memcpy() is the lack of developer guidance.
It is not well documented when to use rte_memcpy() and when to use memcpy().
We discussed something similar on the Tech Board meeting yesterday; it is not well documented when to use which type of "ring" (normal, RTS, HTS), so maybe we could remove one of them. But removing an option is not an improvement, if the removed option would have been the better choice for some use cases.
PS: The general guidance for rte_memcpy() usage is something like:rte_memcpy() only in fast path,memcpy() everywhere else,
assignment "=" when copying fixed size structures.
Quoted 57 lines · Morten Brørup
About replacing
rte_memcpywithmemcpy()...Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on some platforms.Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell [1].
Where similar performance improvements implemented in the relevant compilers (GCC, Clang, MSVC)?[1]: https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd3675fa
IMO, performance should remain a high priority for DPDK.
Quoted 5 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.I think this is the only substantial benefit of replacing
rte_memcpy()withmemcpy()!
Could we reap this benefit by having special builds for such tools, whererte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checks due to some Intel drivers using [0] instead of []; the pragma was removed fromrte_memcpy()when the Intel drivers were fixed. I'm not sufficiently familiar with analysis/test tools to say what they can detect when usingmemcpy()instead of the copy methods used byrte_memcpy().Quoted 9 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.handstring.hwhere needed. Often the includes were happening by some other header. And also removal ofrte_memcpy.hwhere no longer needed.Quoted 7 lines
The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.No functional change, no warnings in all compilers including LTO.
memcpy()does not always use inline vector instructions for fixed size copy [2].[2]: https://inbox.dpdk.org/dev/[email protected]/
Another disadvantage of
rte_memcpy()is the lack of developer guidance.
It is not well documented when to userte_memcpy()and when to usememcpy().
We discussed something similar on the Tech Board meeting yesterday; it is not well documented when to use which type of "ring" (normal, RTS, HTS), so maybe we could remove one of them. But removing an option is not an improvement, if the removed option would have been the better choice for some use cases.
Quoted 5 lines
PS: The general guidance for
rte_memcpy()usage is something like:rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.
Good guidance indeed.
I like this patchset, but one suggestion to make things easier to review and double check that we haven't let an unwanted change slip through: can you maybe split the patchset into 1) patches removing the unused headers from
2) patches replacing the rte_memcpy instances. Some of the patches labelled as replacing rte_memcpy are actually just removing the header include, e.g. patch 39, patch 42. [Even within the second group where we are replacing it, maybe consider splitting between rte_memcpy -> memcpy replacements and rte_memcpy to struct assignment changes.]
/Bruce
Quoted 16 lines
About replacing
rte_memcpywithmemcpy()...Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on some platforms.Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell [1]. Where similar performance improvements implemented in the relevant compilers (GCC, Clang, MSVC)?
Quoted 5 lines
[1]:
https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
3675faIMO, performance should remain a high priority for DPDK.
As I can read the series, good few of them do remove rte_memcpy from the CP, where it is clearly irrelevant.
For those on the DP, at least for some of them we can run perf tests:
let say for hash we do have perf_autotest which can be used to measure the perf diff. If there is none, or neglectable - then no point to keep rte_memcpy here.
Quoted 51 lines
Quoted 6 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.I think this is the only substantial benefit of replacing
rte_memcpy()withmemcpy()!
Could we reap this benefit by having special builds for such tools, whererte_memcpy()is modified to usememcpy()instead?
Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checks due to some Intel drivers using [0] instead of []; the pragma was removed fromrte_memcpy()when the Intel drivers were fixed.
I'm not sufficiently familiar with analysis/test tools to say what they can detect when usingmemcpy()instead of the copy methods used byrte_memcpy().Quoted 9 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.handstring.hwhere needed. Often the includes were happening by some other header. And also removal ofrte_memcpy.hwhere no longer needed.Quoted 7 lines
The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.No functional change, no warnings in all compilers including LTO.
memcpy()does not always use inline vector instructions for fixed size copy [2].[2]:
https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
rtserver.smartshare.dk/Another disadvantage of
rte_memcpy()is the lack of developer guidance. It is not well documented when to userte_memcpy()and when to usememcpy(). We discussed something similar on the Tech Board meeting yesterday; it is not well documented when to use which type of "ring" (normal, RTS, HTS), so maybe we could remove one of them.
But removing an option is not an improvement, if the removed option would have been the better choice for some use cases.
Quoted 4 lines
PS: The general guidance for
rte_memcpy()usage is something like:rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.
I suppose for te_memcpy() we can be even more strict:
Use it only for DP, and only after measurement, that shows clear perf improvement over ordinal memcpy().
Alnd also ask contributors to document it (in the comments), i.e.:
/* on <platform testsed> rte_memcpy() gives X% perf boost when doing ...*/ rte_memcpy(...);
Quoted 19 lines
From: Konstantin Ananyev [mailto:[email protected]]
Quoted 11 lines
About replacing
rte_memcpywithmemcpy()...Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on some platforms.Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell
[1].
Quoted 5 lines
Where similar performance improvements implemented in the relevant compilers (GCC, Clang, MSVC)?
[1]:
Quoted 8 lines
https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
Quoted 3 lines
3675fa
IMO, performance should remain a high priority for DPDK.
As I can read the series, good few of them do remove
rte_memcpyfrom the CP,
where it is clearly irrelevant.
Agree!
Quoted 5 lines
For those on the DP, at least for some of them we can run perf tests:
let say for hash we do haveperf_autotestwhich can be used to measure the
perf diff. If there is none, or neglectable - then no point to keeprte_memcpyhere.
Unless that perf test is run on all platforms, the result only shows perf diff on the tested platforms.
Quoted 68 lines
Quoted 9 lines
Quoted 7 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.I think this is the only substantial benefit of replacing
rte_memcpy()withQuoted 2 lines
memcpy()!
Could we reap this benefit by having special builds for such tools,where
Quoted 4 lines
rte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checks dueto some
Quoted 1 line
Intel drivers using [0] instead of []; the pragma was removed from
rte_memcpy()Quoted 2 lines
when the Intel drivers were fixed.
I'm not sufficiently familiar with analysis/test tools to say whatthey can detect
Quoted 17 lines
when using
memcpy()instead of the copy methods used byrte_memcpy().Quoted 15 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.handstring.hwhere needed. Often the includes were happening by some other header. And also removal ofrte_memcpy.hwhere no longer needed.The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.Quoted 3 lines
Quoted 1 line
No functional change, no warnings in all compilers including LTO.
memcpy()does not always use inline vector instructions for fixedsize copy [2].
Quoted 7 lines
[2]:
https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
rtserver.smartshare.dk/Another disadvantage of
rte_memcpy()is the lack of developerguidance.
Quoted 1 line
It is not well documented when to use
rte_memcpy()and when to use
memcpy().Quoted 1 line
We discussed something similar on the Tech Board meeting yesterday;
it is not
Quoted 1 line
well documented when to use which type of "ring" (normal, RTS, HTS),
so maybe
Quoted 2 lines
we could remove one of them.
But removing an option is not an improvement, if the removed optionwould
Quoted 6 lines
have been the better choice for some use cases.
PS: The general guidance for
rte_memcpy()usage is something like:rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.
Quoted 7 lines
I suppose for
te_memcpy()we can be even more strict:
Use it only for DP, and only after measurement, that shows clear perf improvement over ordinalmemcpy().
Alnd also ask contributors to document it (in the comments), i.e.:
/* on <platform testsed>rte_memcpy()gives X% perf boost when doing ...*/rte_memcpy(...);
Disagree!
DPDK has performance optimized libs and functions.
Developers should not need to document that using a DPDK function is faster than using a libc function. We don't require perf measurements for using DPDK rte_hash instead of libc hashmap.
I agree about not using rte_memcpy() in the control plane. And I support Stephen's effort to clean this up.
But why the eagerness to avoid using rte_memcpy() in the fast path?
Quoted 31 lines
Quoted 7 lines
Quoted 7 lines
About replacing
rte_memcpywithmemcpy()...Quoted 3 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12Quoted 13 lines
Quoted 6 lines
Quoted 2 lines
The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on some platforms.Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell
[1].
Quoted 5 lines
Where similar performance improvements implemented in the relevant compilers (GCC, Clang, MSVC)?
[1]:
https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
Quoted 7 lines
Quoted 3 lines
3675fa
IMO, performance should remain a high priority for DPDK.
As I can read the series, good few of them do remove
rte_memcpyfrom the CP,
where it is clearly irrelevant.Agree!
Quoted 8 lines
Quoted 5 lines
For those on the DP, at least for some of them we can run perf tests:
let say for hash we do haveperf_autotestwhich can be used to measure the
perf diff. If there is none, or neglectable - then no point to keeprte_memcpyhere.Unless that perf test is run on all platforms, the result only shows perf diff on the tested platforms.
How this patch differs from all others?
For each and every change we made in DPDK, to ensure that there is no perf regression introduced we rely on:
1) CI auto testing
2) manual testing from some platform vendors (once per release cycle)
3) good will of submitter to test the changes he produces as much as possible Obviously, yes we are not testing on each possible platform and yes, in theory some regressions can sneak in unseen.
But that could happen with other patches too, so from my perspective - we just need our usual testing procedure here, if it shows no regression, the patch is good to go in.
Quoted 77 lines
Quoted 40 lines
Quoted 9 lines
Quoted 7 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.I think this is the only substantial benefit of replacing
rte_memcpy()withQuoted 2 lines
memcpy()!
Could we reap this benefit by having special builds for such tools,where
Quoted 4 lines
rte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checks dueto some
Quoted 1 line
Intel drivers using [0] instead of []; the pragma was removed from
rte_memcpy()Quoted 2 lines
when the Intel drivers were fixed.
I'm not sufficiently familiar with analysis/test tools to say whatthey can detect
Quoted 17 lines
when using
memcpy()instead of the copy methods used byrte_memcpy().Quoted 15 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.handstring.hwhere needed. Often the includes were happening by some other header. And also removal ofrte_memcpy.hwhere no longer needed.The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.Quoted 7 lines
Quoted 3 lines
Quoted 1 line
No functional change, no warnings in all compilers including LTO.
memcpy()does not always use inline vector instructions for fixedsize copy [2].
Quoted 3 lines
[2]:
https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
Quoted 21 lines
Quoted 4 lines
rtserver.smartshare.dk/
Another disadvantage of
rte_memcpy()is the lack of developerguidance.
Quoted 1 line
It is not well documented when to use
rte_memcpy()and when to use
memcpy().Quoted 1 line
We discussed something similar on the Tech Board meeting yesterday;
it is not
Quoted 1 line
well documented when to use which type of "ring" (normal, RTS, HTS),
so maybe
Quoted 2 lines
we could remove one of them.
But removing an option is not an improvement, if the removed optionwould
Quoted 6 lines
have been the better choice for some use cases.
PS: The general guidance for
rte_memcpy()usage is something like:rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.Quoted 7 lines
I suppose for
te_memcpy()we can be even more strict:
Use it only for DP, and only after measurement, that shows clear perf improvement over ordinalmemcpy().
Alnd also ask contributors to document it (in the comments), i.e.:
/* on <platform testsed>rte_memcpy()gives X% perf boost when doing ...*/rte_memcpy(...);
Quoted 6 lines
Disagree!
DPDK has performance optimized libs and functions.
Developers should not need to document that using a DPDK function is faster than using a libc function.
We don't require perf measurements for using DPDKrte_hashinstead of libc hashmap.
Not sure what libc hashmap you are talking about?
AFAIK such thing doesn't exist.. or you talking about c++ maps? If so, then I think the analogy is not correct.
Why not to remember another example when we get rid of our own hand-written atomics and barriers in favor of using atomics ones.
Quoted 5 lines
I agree about not using
rte_memcpy()in the control plane. And I support Stephen's effort to clean this up.But why the eagerness to avoid using
rte_memcpy()in the fast path?
I think we are not talking about 'avoiding' but about 'limiting'.
There are many cases, when people use rte_memcpy() just because
'it is used in other places, so it is probably better'
In general memcpy() and rte_memcpy() have same syntax,
provide same functionality, plus CC vendors made a good progress in optimizing memcpy(), so now for many cases it provides nearly the same or better performance.
I think no-one forces to replace rte_memcpy() in places where it does provide better results, but for the cases when there is no perf difference, I think memcpy() should have precedence.
Quoted 44 lines
From: Konstantin Ananyev [mailto:[email protected]]
Sent: Thursday, 20 August 2026 15.08Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
About replacing
rte_memcpywithmemcpy()...Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on someplatforms.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell
[1].
Quoted 1 line
Where similar performance improvements implemented in the
relevant
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
compilers (GCC, Clang, MSVC)?
[1]:
https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
3675fa
IMO, performance should remain a high priority for DPDK.
As I can read the series, good few of them do remove
rte_memcpyfrom
Quoted 6 lines
Quoted 2 lines
the CP,
where it is clearly irrelevant.Agree!
Quoted 1 line
For those on the DP, at least for some of them we can run perf
tests:
Quoted 1 line
Quoted 1 line
let say for hash we do have
perf_autotestwhich can be used tomeasure
Quoted 4 lines
Quoted 3 lines
the
perf diff. If there is none, or neglectable - then no point to keeprte_memcpyhere.
Quoted 5 lines
Quoted 1 line
Unless that perf test is run on all platforms, the result only shows
perf diff on
Quoted 1 line
the tested platforms.
How this patch differs from all others?
It removes something that is supposed to be a performance optimization.
E.g. reference [1] fixes vhost performance on Haswell and Broadwell; if we remove rte_memcpy(), the performance of that use case on those CPU types might drop back to being bad.
Quoted 111 lines
For each and every change we made in DPDK, to ensure that there is no perf regression introduced we rely on:
1) CI auto testing
2) manual testing from some platform vendors (once per release cycle)
3) good will of submitter to test the changes he produces as much as possible
Obviously, yes we are not testing on each possible platform and yes, in theory
some regressions can sneak in unseen.
But that could happen with other patches too, so from my perspective - we just need our usual testing procedure here, if it shows no regression,
the patch is good to go in.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Many platforms have no special
rte_memcpy()and just use
memcpy().Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
But many analysis and test tools know that
memcpy()is aspecial
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
case and check for overwrite, bounds errors etc. Therefore
memcpy()Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
should be preferred wherever possible.
I think this is the only substantial benefit of replacing
rte_memcpy()withQuoted 2 lines
memcpy()!
Could we reap this benefit by having special builds for suchtools,
Quoted 5 lines
Quoted 5 lines
where
Quoted 4 lines
rte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checksdue
Quoted 2 lines
Quoted 2 lines
to some
Quoted 1 line
Intel drivers using [0] instead of []; the pragma was removed
from
Quoted 3 lines
Quoted 3 lines
rte_memcpy()Quoted 2 lines
when the Intel drivers were fixed.
I'm not sufficiently familiar with analysis/test tools to saywhat
Quoted 2 lines
Quoted 2 lines
they can detect
Quoted 1 line
when using
memcpy()instead of the copy methods used by
rte_memcpy().Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.hand
string.hQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
where needed. Often the includes were happening by some other header. And also removal of
rte_memcpy.hwhere no longerneeded.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.No functional change, no warnings in all compilers including
LTO.
Quoted 13 lines
Quoted 6 lines
Quoted 2 lines
memcpy()does not always use inline vector instructions for fixedsize copy [2].
Quoted 3 lines
[2]:
https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
Quoted 6 lines
Quoted 4 lines
rtserver.smartshare.dk/
Another disadvantage of
rte_memcpy()is the lack of developerguidance.
Quoted 1 line
It is not well documented when to use
rte_memcpy()and when touse
Quoted 2 lines
Quoted 2 lines
memcpy().Quoted 1 line
We discussed something similar on the Tech Board meeting
yesterday;
Quoted 2 lines
Quoted 2 lines
it is not
Quoted 1 line
well documented when to use which type of "ring" (normal, RTS,
HTS),
Quoted 3 lines
Quoted 3 lines
so maybe
Quoted 2 lines
we could remove one of them.
But removing an option is not an improvement, if the removedoption
Quoted 4 lines
Quoted 4 lines
would
Quoted 3 lines
have been the better choice for some use cases.
PS: The general guidance for
rte_memcpy()usage is somethinglike:
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.I suppose for
te_memcpy()we can be even more strict:
Use it only for DP, and only after measurement, that shows clear perf improvement over ordinalmemcpy().
Alnd also ask contributors to document it (in the comments), i.e.:
/* on <platform testsed>rte_memcpy()gives X% perf boost whendoing
Quoted 6 lines
Quoted 2 lines
...*/
rte_memcpy(...);Disagree!
DPDK has performance optimized libs and functions. Developers should not need to document that using a DPDK function is
Quoted 8 lines
faster
Quoted 2 lines
than using a libc function.
We don't require perf measurements for using DPDKrte_hashinstead oflibc
Quoted 1 line
hashmap.
Not sure what libc hashmap you are talking about? AFAIK such thing doesn't exist.. or you talking about c++ maps?
Sorry, it was hashmap in libmba. Bad example.
Quoted 3 lines
If so, then I think the analogy is not correct.
Why not to remember another example when we get rid of our own hand-written atomics and barriers in favor of using atomics ones.
Great example.
IIRC, many people were involved in this effort, and it was thoroughly reviewed for correctness and performance. And some of the old atomics still ended up remaining for performance reasons.
And C11 atomics is still not the default for DPDK.
That level of effort doesn't seem to be on the table for migrating from rte_memcpy() to memcpy().
The vibe I'm sensing is more like: "Compilers' built-in memcpy() is just as good as rte_memcpy(), so rte_memcpy() has outlived itself." And maybe that statement is true, but I just don't feel confident about it.
Perhaps I'm just being too cautious here.
Quoted 7 lines
Quoted 6 lines
I agree about not using
rte_memcpy()in the control plane. And I support Stephen's effort to clean this up.But why the eagerness to avoid using
rte_memcpy()in the fast path?
Quoted 12 lines
I think we are not talking about 'avoiding' but about 'limiting'. There are many cases, when people use
rte_memcpy()just because 'it is used in other places, so it is probably better'
In generalmemcpy()andrte_memcpy()have same syntax, provide same functionality, plus CC vendors made a good progress in optimizingmemcpy(),
so now for many cases it provides nearly the same or better performance.
I think no-one forces to replacerte_memcpy()in places where it does provide better results,
but for the cases when there is no perf difference, I thinkmemcpy()should have precedence.
You prefer memcpy() over rte_memcpy() when they perform similarly. That's your preference.
And you are not alone with that preference.
When they perform similarly, I prefer rte_memcpy(). And it seems I'm in the minority with that preference.
If we set up barriers to using rte_memcpy(), we'll see even more custom implementations, such as in the ring [3] and stack [4] libraries. But maybe (and I'm being serious here!) that might be a good thing after all:
Use memcpy() for general cases, and use individually specialized versions for special use cases.
(Possibly using pragmas to tweak memcpy() for some of those special use cases.)
[3]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/ring/rte_ring_elem_pvt.h#L65
[4]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/stack/rte_stack_std.h#L40
Here's an alternative path...
PowerPC rte_memcpy() uses memcpy() for fixed size copies [5]. And ARM makes the rte_memcpy() implementation build time optional [6]. We could start softly by copying these two concepts to X86 architecture.
[5]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/eal/ppc/include/rte_memcpy.h#L80
[6]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/eal/arm/include/rte_memcpy_64.h#L13
Quoted 224 lines · On Thu, 20 Aug 2026 16:00:53 +0200 Morten Brørup <[email protected]>…
Quoted 44 lines
From: Konstantin Ananyev [mailto:[email protected]]
Sent: Thursday, 20 August 2026 15.08Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
About replacing
rte_memcpywithmemcpy()...Quoted 5 lines
From: Stephen Hemminger [mailto:[email protected]]
Sent: Thursday, 20 August 2026 07.12The DPDK function
rte_memcpy()only exists as an optimization for shortcomings in performance of libcmemcpy()on someplatforms.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Yes, and those platforms should benefit from it.
E.g. the vhost performance improvements for Haswell and Broadwell
[1].
Quoted 1 line
Where similar performance improvements implemented in the
relevant
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
compilers (GCC, Clang, MSVC)?
[1]:
https://github.com/DPDK/dpdk/commit/4b42e90ef0e421dc777f2b2e377eb237cd
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
3675fa
IMO, performance should remain a high priority for DPDK.
As I can read the series, good few of them do remove
rte_memcpyfrom
Quoted 6 lines
Quoted 2 lines
the CP,
where it is clearly irrelevant.Agree!
Quoted 1 line
For those on the DP, at least for some of them we can run perf
tests:
Quoted 1 line
Quoted 1 line
let say for hash we do have
perf_autotestwhich can be used tomeasure
Quoted 4 lines
Quoted 3 lines
the
perf diff. If there is none, or neglectable - then no point to keeprte_memcpyhere.Quoted 5 lines
Quoted 1 line
Unless that perf test is run on all platforms, the result only shows
perf diff on
Quoted 1 line
the tested platforms.
How this patch differs from all others?
It removes something that is supposed to be a performance optimization.
E.g. reference [1] fixes vhost performance on Haswell and Broadwell; if we removerte_memcpy(), the performance of that use case on those CPU types might drop back to being bad.Quoted 111 lines
For each and every change we made in DPDK, to ensure that there is no perf regression introduced we rely on:
1) CI auto testing
2) manual testing from some platform vendors (once per release cycle)
3) good will of submitter to test the changes he produces as much as possible
Obviously, yes we are not testing on each possible platform and yes, in theory
some regressions can sneak in unseen.
But that could happen with other patches too, so from my perspective - we just need our usual testing procedure here, if it shows no regression,
the patch is good to go in.Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Many platforms have no special
rte_memcpy()and just use
memcpy().Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
But many analysis and test tools know that
memcpy()is aspecial
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
case and check for overwrite, bounds errors etc. Therefore
memcpy()Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
should be preferred wherever possible.
I think this is the only substantial benefit of replacing
rte_memcpy()withQuoted 2 lines
memcpy()!
Could we reap this benefit by having special builds for suchtools,
Quoted 5 lines
Quoted 5 lines
where
Quoted 4 lines
rte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checksdue
Quoted 2 lines
Quoted 2 lines
to some
Quoted 1 line
Intel drivers using [0] instead of []; the pragma was removed
from
Quoted 3 lines
Quoted 3 lines
rte_memcpy()Quoted 2 lines
when the Intel drivers were fixed.
I'm not sufficiently familiar with analysis/test tools to saywhat
Quoted 2 lines
Quoted 2 lines
they can detect
Quoted 1 line
when using
memcpy()instead of the copy methods used by
rte_memcpy().Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
This patch series introduces a coccinelle script to find calls to
rte_memcpy()where size is fixed, and change them to regularmemcpy(). This was the starting point for this cleanup.There is also some cleanups to include
rte_memcpy.hand
string.hQuoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
where needed. Often the includes were happening by some other header. And also removal of
rte_memcpy.hwhere no longerneeded.
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
The result is a 46% reduction in use of
rte_memcpy. The remainingrte_memcpycan be cleaned up later:
- drivers with active maintenance (like mlx5);
- changes torte_memcpywhich need benchmarking;
- test code forrte_memcpycan be removed as last step.No functional change, no warnings in all compilers including
LTO.
Quoted 13 lines
Quoted 6 lines
Quoted 2 lines
memcpy()does not always use inline vector instructions for fixedsize copy [2].
Quoted 3 lines
[2]:
https://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35F659B8@sma
Quoted 6 lines
Quoted 4 lines
rtserver.smartshare.dk/
Another disadvantage of
rte_memcpy()is the lack of developerguidance.
Quoted 1 line
It is not well documented when to use
rte_memcpy()and when touse
Quoted 2 lines
Quoted 2 lines
memcpy().Quoted 1 line
We discussed something similar on the Tech Board meeting
yesterday;
Quoted 2 lines
Quoted 2 lines
it is not
Quoted 1 line
well documented when to use which type of "ring" (normal, RTS,
HTS),
Quoted 3 lines
Quoted 3 lines
so maybe
Quoted 2 lines
we could remove one of them.
But removing an option is not an improvement, if the removedoption
Quoted 4 lines
Quoted 4 lines
would
Quoted 3 lines
have been the better choice for some use cases.
PS: The general guidance for
rte_memcpy()usage is somethinglike:
Quoted 9 lines
Quoted 9 lines
Quoted 3 lines
rte_memcpy()only in fast path,memcpy()everywhere else,
assignment "=" when copying fixed size structures.I suppose for
te_memcpy()we can be even more strict:
Use it only for DP, and only after measurement, that shows clear perf improvement over ordinalmemcpy().
Alnd also ask contributors to document it (in the comments), i.e.:
/* on <platform testsed>rte_memcpy()gives X% perf boost whendoing
Quoted 6 lines
Quoted 2 lines
...*/
rte_memcpy(...);Disagree!
DPDK has performance optimized libs and functions. Developers should not need to document that using a DPDK function isQuoted 8 lines
faster
Quoted 2 lines
than using a libc function.
We don't require perf measurements for using DPDKrte_hashinstead oflibc
Quoted 1 line
hashmap.
Not sure what libc hashmap you are talking about? AFAIK such thing doesn't exist.. or you talking about c++ maps?
Sorry, it was hashmap in libmba. Bad example.
Quoted 3 lines
If so, then I think the analogy is not correct.
Why not to remember another example when we get rid of our own hand-written atomics and barriers in favor of using atomics ones.Great example.
IIRC, many people were involved in this effort, and it was thoroughly reviewed for correctness and performance. And some of the old atomics still ended up remaining for performance reasons.
And C11 atomics is still not the default for DPDK.That level of effort doesn't seem to be on the table for migrating from
rte_memcpy()tomemcpy().
The vibe I'm sensing is more like: "Compilers' built-inmemcpy()is just as good asrte_memcpy(), sorte_memcpy()has outlived itself." And maybe that statement is true, but I just don't feel confident about it.
Perhaps I'm just being too cautious here.Quoted 7 lines
Quoted 6 lines
I agree about not using
rte_memcpy()in the control plane. And I support Stephen's effort to clean this up.But why the eagerness to avoid using
rte_memcpy()in the fast path?Quoted 12 lines
I think we are not talking about 'avoiding' but about 'limiting'. There are many cases, when people use
rte_memcpy()just because 'it is used in other places, so it is probably better'
In generalmemcpy()andrte_memcpy()have same syntax, provide same functionality, plus CC vendors made a good progress in optimizingmemcpy(),
so now for many cases it provides nearly the same or better performance.
I think no-one forces to replacerte_memcpy()in places where it does provide better results,
but for the cases when there is no perf difference, I thinkmemcpy()should have precedence.You prefer
memcpy()overrte_memcpy()when they perform similarly. That's your preference.
And you are not alone with that preference.When they perform similarly, I prefer
rte_memcpy(). And it seems I'm in the minority with that preference.If we set up barriers to using
rte_memcpy(), we'll see even more custom implementations, such as in the ring [3] and stack [4] libraries. But maybe (and I'm being serious here!) that might be a good thing after all:
Usememcpy()for general cases, and use individually specialized versions for special use cases.
(Possibly using pragmas to tweakmemcpy()for some of those special use cases.)[3]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/ring/rte_ring_elem_pvt.h#L65
[4]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/stack/rte_stack_std.h#L40
Quoted 8 lines
Here's an alternative path...
PowerPCrte_memcpy()usesmemcpy()for fixed size copies [5]. And ARM makes therte_memcpy()implementation build time optional [6]. We could start softly by copying these two concepts to X86 architecture.[5]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/eal/ppc/include/rte_memcpy.h#L80
[6]: https://elixir.bootlin.com/dpdk/v26.07/source/lib/eal/arm/include/rte_memcpy_64.h#L13
I used to think for DPDK performance should be the highest priority. Now I think the priorities need to be:
- security. in the age of AI scanners, security has to come first.
- performance.
- architecture. code must be logical and readable as much as possible.
- consistency. don't do special cases if not needed for 1,2,3
Also, no longer care if performance goes down for users using new releases on five year old tool chains. If they are on GCC over five years old (pre GCC 10) then the problem is really the tool set not DPDK.
Quoted 7 lines · On Thu, 20 Aug 2026 11:03:13 +0200 Morten Brørup <[email protected]>…
Quoted 5 lines
For those on the DP, at least for some of them we can run perf tests:
let say for hash we do haveperf_autotestwhich can be used to measure the
perf diff. If there is none, or neglectable - then no point to keeprte_memcpyhere.Unless that perf test is run on all platforms, the result only shows perf diff on the tested platforms.
There are also important DP (virtio, real PMD's) and test tool DP (pcap, null, and test code). The former need careful work, the later really don't matter with the .1% delta from memcpy.
Quoted 6 lines · On Thu, 20 Aug 2026 09:31:40 +0200 Morten Brørup <[email protected]>…
Quoted 5 lines
Many platforms have no special
rte_memcpy()and just usememcpy().But many analysis and test tools know that
memcpy()is a special case and check for overwrite, bounds errors etc. Thereforememcpy()should be preferred wherever possible.
Quoted 6 lines
I think this is the only substantial benefit of replacing
rte_memcpy()withmemcpy()!
Could we reap this benefit by having special builds for such tools, whererte_memcpy()is modified to usememcpy()instead? Then we wouldn't have to compromise on performance.Also,
rte_memcpy()used to have a pragma disabling bounds checks due to some Intel drivers using [0] instead of []; the pragma was removed fromrte_memcpy()when the Intel drivers were fixed. I'm not sufficiently familiar with analysis/test tools to say what they can detect when usingmemcpy()instead of the copy methods used byrte_memcpy().
The most common one is fortify which is runtime checking and part of Ubuntu etc build. So no doing some #ifdef FORTIFY_SOURCE really is not helping.
v2 cover reduce use of rte_memcpy
In reply to Stephen HemmingerThe DPDK function rte_memcpy() only exists as an optimization for shortcomings in performance of libc memcpy() on some platforms. Many platforms have no special rte_memcpy() and just use memcpy().
But many analysis and test tools know that memcpy() is a special case and check for overwrite, bounds errors etc. Therefore memcpy() should be preferred where ever possible.
This patch series introduces a coccinelle script to find calls to rte_memcpy() where size is fixed, and change them to regular memcpy(). Many of the patch series is just the results of that script.
There is also some cleanups to include rte_memcpy.h where it was not being done before; the include was happening by some other header. And also removal of rte_memcpy.h where no longer needed.
The result is a 45% reduction in use of rte_memcpy (1008 call sites down to 551). The leftover cases are places where rte_memcpy is used in data path; and test code for rte_memcpy.
v2:
- reorder the series so it bisects cleanly: the patches adding the missing includes of rte_memcpy.h now come first, before any patch that removes an include or replaces a call. In v1 those were at the end of the series, so intermediate commits could fail to build.
- move the documentation patch describing when to use rte_memcpy() to the front of the series, so the rationale for the rest of the changes is established first.
Stephen Hemminger (68):
devtools/cocci: add script to replace fixed size rte_memcpy
lib: add missing include of rte_memcpy.h
net: add missing include of rte_memcpy.h
crypto: add missing include of rte_memcpy.h
drivers: add missing include of rte_memcpy.h
app: add missing include of rte_memcpy.h
examples: add missing include of rte_memcpy.h
eal: document when to use rte_memcpy
app/testpmd: replace rte_memcpy with memcpy
test: use memcpy instead of rte_memcpy
app/graph: replace rte_memcpy with memcpy
lpm: remove unnecessary include of rte_memcpy.h
acl: remove unnecessary include of rte_memcpy.h drivers/bus: remove unnecessary include of rte_memcpy.h
security: replace fixed size rte_memcpy
ethdev: replace use of rte_memcpy
net: replace use of rte_memcpy
pdcp: replace use of rte_memcpy
eventdev: replace fixed size rte_memcpy
eal: replace rte_memcpy of cpuset
cryptodev: replace use of rte_memcpy
drivers/raw: use memcpy for fixed size data
test-pipeline: replace use of rte_memcpy net/af_xdp: replace use of rte_memcpy
net/avp: replace use of rte_memcpy
net/axgbe: replace use of rte_memcpy
net/bnx2x: replace use of rte_memcpy
net/bnxt: replace use of rte_memcpy
net/bonding: replace use of rte_memcpy
net/cnxk: replace use of rte_memcpy
net/cxgbe: replace use of rte_memcpy
net/dpaa2: replace use of rte_memcpy
net/enic: replace use of rte_memcpy
net/failsafe: replace use of rte_memcpy
net/gve: replace use of rte_memcpy
net/hinic: replace use of rte_memcpy
net/hns3: replace use of rte_memcpy
net/mlx5: replace use of rte_memcpy
net/mvpp2: replace use of rte_memcpy
net/netvsc: replace use of rte_memcpy
net/nfp: replace use of rte_memcpy
net/ngbe: replace use of rte_memcpy
net/ntnic: replace use of rte_memcpy
net/null: replace use of rte_memcpy
net/qede: replace use of rte_memcpy
net/ring: replace use of rte_memcpy
net/sfc: replace use of rte_memcpy
net/txgbe: replace use of rte_memcpy
net/vhost: replace use of rte_memcpy
net/virtio: replace use of rte_memcpy
net/sxe2: replace use of rte_memcpy
net/zxdh: replace use of rte_memcpy
net/memif: use memcpy for fixed size data net/ice: use memcpy for fixed size data
test-bbdev: remove unnecessary include rte_memcpy.h drivers/mempool: use memcpy for fixed size data ml/cnxk: use memcpy for fixed size data drivers/event: use memcpy for fixed size data baseband/la12xx: use memcpy for fixed size data baseband/acc: replace use of rte_memcpy drivers/*/qat: use memcpy for fixed size data
hash: replace use of rte_memcpy
rib: remove rte_memcpy include
pcapng: replace use of rte_memcpy
efd: replace use of rte_memcpy
net/xsc: replace use of rte_memcpy
net/pcap: replace use of rte_memcpy
power: replace use of rte_memcpy
app/graph/ip4_output_hook.c | 1 + app/graph/neigh.c | 8 +- app/test-bbdev/test_bbdev.c | 1 - app/test-bbdev/test_bbdev_perf.c | 1 + .../comp_perf_test_common.c | 1 + .../comp_perf_test_verify.c | 1 + app/test-dma-perf/benchmark.c | 1 + app/test-eventdev/test_pipeline_common.c | 8 +- app/test-mldev/test_common.c | 1 + app/test-mldev/test_inference_common.c | 1 + 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 | 28 ++--- app/test-pmd/cmdline_flow.c | 34 +++--- app/test-pmd/config.c | 13 +-- 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-pmd/txonly.c | 7 +- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 10 +- app/test/test_bpf.c | 1 + app/test/test_compressdev.c | 1 + app/test/test_crc.c | 7 +- app/test/test_cryptodev.c | 14 +-- app/test/test_cryptodev.h | 1 + app/test/test_cryptodev_asym.c | 1 - app/test/test_cryptodev_crosscheck.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 | 13 ++- app/test/test_eventdev.c | 1 - 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_ring.h | 17 ++- app/test/test_security_inline_macsec.c | 2 +- app/test/test_security_inline_proto.c | 42 +++---- app/test/test_security_proto.c | 2 +- app/test/test_service_cores.c | 1 - app/test/test_thash.c | 4 +- app/test/virtual_pmd.c | 5 +- devtools/cocci/rte_memcpy_fixed.cocci | 15 +++ drivers/baseband/acc/rte_acc100_pmd.c | 7 +- drivers/baseband/acc/rte_vrb_pmd.c | 21 ++-- drivers/baseband/la12xx/bbdev_la12xx.c | 4 +- .../baseband/turbo_sw/bbdev_turbo_software.c | 1 + 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_dpcon.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - drivers/common/mlx5/mlx5_common_mr.c | 1 + drivers/common/qat/qat_qp.c | 10 +- drivers/compress/qat/qat_comp.c | 8 +- drivers/crypto/armv8/rte_armv8_pmd.c | 1 + drivers/crypto/caam_jr/caam_jr.c | 1 + drivers/crypto/ccp/ccp_crypto.c | 15 +-- drivers/crypto/cnxk/cn10k_tls_ops.h | 1 + drivers/crypto/cnxk/cn20k_tls_ops.h | 1 + drivers/crypto/cnxk/cnxk_ae.h | 1 + drivers/crypto/cnxk/cnxk_se.h | 3 +- drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 1 + drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 1 + drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 1 + drivers/crypto/ipsec_mb/pmd_snow3g.c | 5 +- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 11 +- drivers/crypto/mvsam/rte_mrvl_pmd.c | 1 + drivers/crypto/openssl/rte_openssl_pmd.c | 1 + drivers/crypto/qat/asym/qat_asym.c | 1 + drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 1 + .../crypto/qat/dev/qat_crypto_pmd_gen_lce.c | 1 + drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 1 + drivers/crypto/qat/qat_sym_session.c | 33 +++--- .../scheduler/rte_cryptodev_scheduler.c | 7 +- drivers/crypto/scheduler/scheduler_failover.c | 12 +- drivers/crypto/virtio/virtio_cryptodev.c | 1 + drivers/crypto/virtio/virtio_rxtx.c | 1 + drivers/crypto/zsda/zsda_crypto_session.c | 6 +- drivers/dma/dpaa2/dpaa2_qdma.c | 1 + 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 | 3 +- drivers/event/dpaa2/dpaa2_eventdev_selftest.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_dev.c | 1 + drivers/ml/cnxk/cn10k_ml_model.c | 9 +- drivers/ml/cnxk/cn10k_ml_ops.c | 9 +- drivers/ml/cnxk/cnxk_ml_io.c | 1 + drivers/ml/cnxk/tvmrt_ml_model.c | 9 +- drivers/ml/cnxk/tvmrt_ml_ops.c | 7 +- drivers/net/af_xdp/rte_eth_af_xdp.c | 3 +- .../net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 1 + drivers/net/avp/avp_ethdev.c | 4 +- drivers/net/axgbe/axgbe_ethdev.c | 4 +- drivers/net/bnx2x/bnx2x.c | 32 +++--- drivers/net/bnx2x/bnx2x.h | 1 + drivers/net/bnx2x/ecore_sp.c | 1 + drivers/net/bnx2x/ecore_sp.h | 1 + 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/cn10k_ethdev_sec.c | 1 + drivers/net/cnxk/cn10k_rx.h | 1 + drivers/net/cnxk/cn20k_ethdev_sec.c | 1 + drivers/net/cnxk/cn20k_rx.h | 1 + drivers/net/cnxk/cnxk_eswitch_devargs.c | 3 +- drivers/net/cnxk/cnxk_ethdev_ops.c | 3 +- drivers/net/cnxk/cnxk_rep.c | 3 +- drivers/net/cnxk/cnxk_rep_flow.c | 7 +- drivers/net/cnxk/cnxk_rep_msg.c | 9 +- drivers/net/cnxk/cnxk_rep_ops.c | 3 +- drivers/net/cnxk/cnxk_tm.c | 5 +- drivers/net/cxgbe/clip_tbl.c | 2 +- drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/cxgbe/cxgbe_filter.c | 8 +- drivers/net/cxgbe/l2t.c | 4 +- drivers/net/cxgbe/sge.c | 1 + drivers/net/cxgbe/smt.c | 20 ++-- drivers/net/dpaa/dpaa_rxtx.c | 1 + drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 1 - drivers/net/dpaa2/dpaa2_ethdev.c | 1 - drivers/net/dpaa2/dpaa2_mux.c | 37 ++++--- 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/ena/ena_ethdev.c | 1 + drivers/net/ena/ena_rss.c | 1 + drivers/net/enic/enic_main.c | 6 +- drivers/net/failsafe/failsafe_ops.c | 10 +- drivers/net/gve/base/gve_adminq.c | 2 +- drivers/net/gve/gve_rx.c | 1 + drivers/net/gve/gve_tx.c | 1 + drivers/net/hinic/hinic_pmd_ethdev.c | 1 - drivers/net/hinic/hinic_pmd_flow.c | 41 ++++--- drivers/net/hinic/hinic_pmd_tx.c | 1 + drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_flow.c | 4 +- drivers/net/intel/ice/ice_fdir_filter.c | 4 +- .../net/intel/idpf/idpf_common_rxtx_avx512.c | 1 + drivers/net/ionic/ionic_rxtx.h | 1 + drivers/net/memif/memif_socket.c | 4 +- drivers/net/memif/rte_eth_memif.c | 1 + drivers/net/mlx4/mlx4_rxtx.c | 1 + drivers/net/mlx5/linux/mlx5_ethdev_os.c | 1 + drivers/net/mlx5/mlx5_devx.c | 4 +- drivers/net/mlx5/mlx5_flow.c | 39 +++---- drivers/net/mlx5/mlx5_flow_aso.c | 6 +- drivers/net/mlx5/mlx5_flow_dv.c | 1 + drivers/net/mlx5/mlx5_flow_flex.c | 1 + drivers/net/mlx5/mlx5_flow_hw.c | 32 +++--- drivers/net/mlx5/mlx5_rx.c | 6 +- drivers/net/mlx5/mlx5_rx.h | 1 + drivers/net/mlx5/mlx5_rxq.c | 1 + drivers/net/mlx5/mlx5_rxtx_vec.c | 8 +- drivers/net/mlx5/mlx5_tx.h | 1 + drivers/net/mlx5/mlx5_txpp.c | 1 + drivers/net/mvpp2/mrvl_tm.c | 2 +- drivers/net/netvsc/hn_ethdev.c | 1 - drivers/net/nfb/nfb_rx.h | 1 + drivers/net/nfb/nfb_tx.h | 1 + drivers/net/nfp/flower/nfp_conntrack.c | 3 +- drivers/net/nfp/flower/nfp_flower_cmsg.c | 1 + drivers/net/nfp/flower/nfp_flower_flow.c | 16 +-- drivers/net/nfp/nfp_mtr.c | 10 +- drivers/net/nfp/nfp_net_flow.c | 1 + drivers/net/nfp/nfpcore/nfp_nsp.c | 1 + drivers/net/ngbe/ngbe_pf.c | 4 +- drivers/net/ntnic/ntnic_ethdev.c | 12 +- drivers/net/null/rte_eth_null.c | 12 +- drivers/net/octeon_ep/otx_ep_rxtx.c | 1 + drivers/net/pcap/pcap_ethdev.c | 9 +- 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 | 12 +- drivers/net/sfc/sfc_flow.c | 20 ++-- drivers/net/sfc/sfc_flow_rss.c | 2 +- drivers/net/sfc/sfc_mae.c | 3 +- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_tbl_meta_cache.c | 1 + drivers/net/sfc/sfc_tso.c | 3 +- drivers/net/sfc/sfc_tso.h | 9 +- drivers/net/sxe2/sxe2_cmd_chnl.c | 6 +- drivers/net/sxe2/sxe2_flow.c | 11 +- drivers/net/sxe2/sxe2_flow_parse_pattern.c | 36 +++--- drivers/net/sxe2/sxe2_ipsec.c | 2 +- drivers/net/sxe2/sxe2_rss.c | 10 +- drivers/net/sxe2/sxe2_rx.c | 4 +- drivers/net/sxe2/sxe2_stats.c | 25 +++-- drivers/net/sxe2/sxe2_tm.c | 4 +- drivers/net/txgbe/txgbe_ethdev.c | 9 +- drivers/net/txgbe/txgbe_fdir.c | 11 +- drivers/net/txgbe/txgbe_flow.c | 73 ++++++------ drivers/net/txgbe/txgbe_ipsec.c | 8 +- drivers/net/txgbe/txgbe_pf.c | 6 +- drivers/net/txgbe/txgbe_tm.c | 11 +- drivers/net/vhost/rte_eth_vhost.c | 1 - drivers/net/virtio/virtio_ethdev.c | 1 - drivers/net/vmxnet3/vmxnet3_rxtx.c | 1 + drivers/net/xsc/xsc_dev.c | 2 +- drivers/net/xsc/xsc_tx.c | 1 + drivers/net/zxdh/zxdh_common.c | 7 +- drivers/net/zxdh/zxdh_flow.c | 67 ++++++----- drivers/net/zxdh/zxdh_msg.c | 15 +-- drivers/net/zxdh/zxdh_mtr.c | 10 +- drivers/net/zxdh/zxdh_np.c | 1 - drivers/net/zxdh/zxdh_queue.c | 8 +- drivers/net/zxdh/zxdh_rxtx.c | 1 + drivers/net/zxdh/zxdh_tables.c | 21 ++-- drivers/power/acpi/acpi_cpufreq.c | 4 +- drivers/power/amd_pstate/amd_pstate_cpufreq.c | 4 +- drivers/power/amd_uncore/amd_uncore.c | 5 +- drivers/power/cppc/cppc_cpufreq.c | 4 +- .../power/intel_pstate/intel_pstate_cpufreq.c | 3 +- drivers/power/intel_uncore/intel_uncore.c | 5 +- drivers/raw/ifpga/afu_pmd_he_hssi.c | 4 +- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 4 +- drivers/raw/ifpga/afu_pmd_he_mem.c | 4 +- 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 - drivers/regex/mlx5/mlx5_rxp.c | 1 + examples/bbdev_app/main.c | 1 + examples/dma/dmafwd.c | 1 + examples/ipsec-secgw/esp.c | 1 + lib/acl/rte_acl_osdep.h | 1 - lib/cryptodev/rte_cryptodev.c | 12 +- lib/eal/common/eal_common_options.c | 6 +- lib/eal/include/generic/rte_memcpy.h | 18 +++ lib/eal/x86/include/rte_memcpy.h | 1 + lib/efd/rte_efd.c | 3 +- lib/ethdev/rte_ethdev.c | 3 +- lib/ethdev/rte_flow.c | 104 ++++++++---------- lib/eventdev/rte_event_crypto_adapter.c | 2 +- lib/graph/rte_graph_model_mcore_dispatch.c | 1 + lib/hash/rte_thash.c | 4 +- lib/ipsec/esp_inb.c | 1 + lib/ipsec/esp_outb.c | 1 + lib/lpm/rte_lpm6.c | 1 - lib/net/rte_ether.c | 2 +- lib/node/interface_tx_feature.c | 1 + lib/node/ip4_local.c | 1 + lib/node/ip4_lookup.c | 1 + lib/node/ip4_lookup_fib.c | 1 + lib/node/ip4_reassembly.c | 1 + lib/node/ip4_rewrite.c | 1 + lib/node/ip6_lookup.c | 1 + lib/node/ip6_lookup_fib.c | 1 + lib/node/ip6_rewrite.c | 1 + lib/node/pkt_cls.c | 1 + lib/node/udp4_input.c | 1 + lib/pcapng/rte_pcapng.c | 2 +- lib/pdcp/pdcp_process.c | 51 +++++---- lib/port/rte_swx_port_source_sink.c | 1 + lib/rib/rte_rib6.h | 1 - lib/security/rte_security.c | 4 +- lib/vhost/vhost.c | 1 + lib/vhost/vhost_crypto.c | 1 + 280 files changed, 875 insertions(+), 807 deletions(-) create mode 100644 devtools/cocci/rte_memcpy_fixed.cocci
Signature · 1 line
2.53.0
PATCH v2 1/68 devtools/cocci: add script to replace fixed size rte_memcpy
Rte_memcpy need not be used for the simple case of copying a fix sized because it is not faster and will hide problems from code analysis tools. Static and dynamic analyzers special case memcpy() and can find issues that rte_memcpy() will hide.
Note: 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.
--- devtools/cocci/rte_memcpy_fixed.cocci | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 devtools/cocci/rte_memcpy_fixed.cocci
devtools/cocci/rte_memcpy_fixed.cocci new file +15 -0
@@ -0,0 +1,15 @@ +// +// rte_memcpy should not be used for simple fixed size structure +// because compiler's are smart enough to inline these. +// +@@ +expression src, dst, E; +constant size; +@@ +( +- rte_memcpy(dst, src, sizeof(E)) ++ memcpy(dst, src, sizeof(E)) +| +- rte_memcpy(dst, src, size) ++ memcpy(dst, src, size) +)
Signature · 1 line
2.53.0
PATCH v2 2/68 lib: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- lib/eal/x86/include/rte_memcpy.h | 1 + lib/graph/rte_graph_model_mcore_dispatch.c | 1 + lib/ipsec/esp_inb.c | 1 + lib/ipsec/esp_outb.c | 1 + lib/node/interface_tx_feature.c | 1 + lib/node/ip4_local.c | 1 + lib/node/ip4_lookup.c | 1 + lib/node/ip4_lookup_fib.c | 1 + lib/node/ip4_reassembly.c | 1 + lib/node/ip4_rewrite.c | 1 + lib/node/ip6_lookup.c | 1 + lib/node/ip6_lookup_fib.c | 1 + lib/node/ip6_rewrite.c | 1 + lib/node/pkt_cls.c | 1 + lib/node/udp4_input.c | 1 + lib/port/rte_swx_port_source_sink.c | 1 + lib/vhost/vhost.c | 1 + lib/vhost/vhost_crypto.c | 1 + 18 files changed, 18 insertions(+)
lib/eal/x86/include/rte_memcpy.h +1 -0
@@ -14,6 +14,7 @@#include <stdio.h> #include <stdint.h> #include <string.h> +#include <rte_memcpy.h> #include <rte_vect.h> #include <rte_common.h> #include <rte_config.h>
lib/graph/rte_graph_model_mcore_dispatch.c +1 -0
@@ -5,6 +5,7 @@#include "graph_private.h" #include <eal_export.h> #include "rte_graph_model_mcore_dispatch.h" +#include <rte_memcpy.h> int graph_sched_wq_create(struct graph *_graph, struct graph *_parent_graph,
lib/ipsec/esp_inb.c +1 -0
@@ -6,6 +6,7 @@#include <rte_esp.h> #include <rte_errno.h> #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include "sa.h" #include "ipsec_sqn.h"
lib/ipsec/esp_outb.c +1 -0
@@ -4,6 +4,7 @@#include <rte_ipsec.h> #include <rte_esp.h> +#include <rte_memcpy.h> #include <rte_udp.h> #include <rte_errno.h> #include <rte_cryptodev.h>
lib/node/interface_tx_feature.c +1 -0
@@ -9,6 +9,7 @@#include <rte_ether.h> #include <rte_graph_feature_arc_worker.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include "rte_node_ip4_api.h" #include "node_private.h"
lib/node/ip4_local.c +1 -0
@@ -15,6 +15,7 @@#include <rte_fbk_hash.h> #include <rte_jhash.h> #include <rte_hash_crc.h> +#include <rte_memcpy.h> #include "rte_node_ip4_api.h"
lib/node/ip4_lookup.c +1 -0
@@ -12,6 +12,7 @@#include <rte_graph_worker.h> #include <rte_ip.h> #include <rte_lpm.h> +#include <rte_memcpy.h> #include "rte_node_ip4_api.h"
lib/node/ip4_lookup_fib.c +1 -0
@@ -11,6 +11,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_ip.h> +#include <rte_memcpy.h> #include "rte_node_ip4_api.h"
lib/node/ip4_reassembly.c +1 -0
@@ -16,6 +16,7 @@#include <rte_ip.h> #include <rte_ip_frag.h> #include <rte_mbuf.h> +#include <rte_memcpy.h> #include <rte_tcp.h> #include <rte_udp.h>
lib/node/ip4_rewrite.c +1 -0
@@ -9,6 +9,7 @@#include <rte_graph_feature_arc_worker.h> #include <rte_ip.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_vect.h> #include "rte_node_ip4_api.h"
lib/node/ip6_lookup.c +1 -0
@@ -12,6 +12,7 @@#include <rte_graph_worker.h> #include <rte_ip.h> #include <rte_lpm6.h> +#include <rte_memcpy.h> #include "rte_node_ip6_api.h"
lib/node/ip6_lookup_fib.c +1 -0
@@ -11,6 +11,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_ip.h> +#include <rte_memcpy.h> #include "rte_node_ip6_api.h"
lib/node/ip6_rewrite.c +1 -0
@@ -9,6 +9,7 @@#include <rte_graph_worker.h> #include <rte_ip.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_vect.h> #include "rte_node_ip6_api.h"
lib/node/pkt_cls.c +1 -0
@@ -6,6 +6,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> +#include <rte_memcpy.h> #include "pkt_cls_priv.h" #include "node_private.h"
lib/node/udp4_input.c +1 -0
@@ -16,6 +16,7 @@#include <rte_fbk_hash.h> #include <rte_jhash.h> #include <rte_hash_crc.h> +#include <rte_memcpy.h> #include "rte_node_udp4_input_api.h"
lib/port/rte_swx_port_source_sink.c +1 -0
@@ -13,6 +13,7 @@#include <rte_common.h> #include <rte_mbuf.h> #include <rte_hexdump.h> +#include <rte_memcpy.h> #include "rte_swx_port_source_sink.h"
lib/vhost/vhost.c +1 -0
@@ -15,6 +15,7 @@#include <eal_export.h> #include <rte_errno.h> #include <rte_log.h> +#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_malloc.h> #include <rte_vhost.h>
lib/vhost/vhost_crypto.c +1 -0
@@ -8,6 +8,7 @@#include <rte_log.h> #include <rte_mbuf.h> #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include "iotlb.h" #include "rte_vhost_crypto.h"
Signature · 1 line
2.53.0
PATCH v2 3/68 net: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 1 + drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c | 1 + drivers/net/bnx2x/bnx2x.h | 1 + drivers/net/bnx2x/ecore_sp.c | 1 + drivers/net/bnx2x/ecore_sp.h | 1 + drivers/net/cnxk/cn10k_ethdev_sec.c | 1 + drivers/net/cnxk/cn10k_rx.h | 1 + drivers/net/cnxk/cn20k_ethdev_sec.c | 1 + drivers/net/cnxk/cn20k_rx.h | 1 + drivers/net/cnxk/cnxk_ethdev_ops.c | 1 + drivers/net/cnxk/cnxk_rep_flow.c | 1 + drivers/net/cnxk/cnxk_rep_msg.c | 1 + drivers/net/cnxk/cnxk_rep_ops.c | 1 + drivers/net/cxgbe/cxgbe_ethdev.c | 1 + drivers/net/cxgbe/sge.c | 1 + drivers/net/dpaa/dpaa_rxtx.c | 1 + drivers/net/dpaa2/dpaa2_mux.c | 1 + drivers/net/ena/ena_ethdev.c | 1 + drivers/net/ena/ena_rss.c | 1 + drivers/net/gve/gve_rx.c | 1 + drivers/net/gve/gve_tx.c | 1 + drivers/net/hinic/hinic_pmd_tx.c | 1 + drivers/net/intel/idpf/idpf_common_rxtx_avx512.c | 1 + drivers/net/ionic/ionic_rxtx.h | 1 + drivers/net/memif/rte_eth_memif.c | 1 + drivers/net/mlx4/mlx4_rxtx.c | 1 + drivers/net/mlx5/linux/mlx5_ethdev_os.c | 1 + drivers/net/mlx5/mlx5_flow.c | 1 + drivers/net/mlx5/mlx5_flow_dv.c | 1 + drivers/net/mlx5/mlx5_flow_flex.c | 1 + drivers/net/mlx5/mlx5_flow_hw.c | 1 + drivers/net/mlx5/mlx5_rx.h | 1 + drivers/net/mlx5/mlx5_rxq.c | 1 + drivers/net/mlx5/mlx5_tx.h | 1 + drivers/net/mlx5/mlx5_txpp.c | 1 + drivers/net/nfb/nfb_rx.h | 1 + drivers/net/nfb/nfb_tx.h | 1 + drivers/net/nfp/flower/nfp_conntrack.c | 1 + drivers/net/nfp/flower/nfp_flower_cmsg.c | 1 + drivers/net/nfp/nfp_net_flow.c | 1 + drivers/net/nfp/nfpcore/nfp_nsp.c | 1 + drivers/net/ntnic/ntnic_ethdev.c | 1 + drivers/net/octeon_ep/otx_ep_rxtx.c | 1 + drivers/net/sfc/sfc_ethdev.c | 1 + drivers/net/sfc/sfc_mae.c | 1 + drivers/net/sfc/sfc_tbl_meta_cache.c | 1 + drivers/net/sfc/sfc_tso.c | 1 + drivers/net/vmxnet3/vmxnet3_rxtx.c | 1 + drivers/net/xsc/xsc_tx.c | 1 + drivers/net/zxdh/zxdh_rxtx.c | 1 + 50 files changed, 50 insertions(+)
drivers/net/af_xdp/rte_eth_af_xdp.c +1 -0
@@ -22,6 +22,7 @@#include <ethdev_vdev.h> #include <rte_kvargs.h> #include <bus_vdev_driver.h> +#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_branch_prediction.h> #include <rte_common.h>
drivers/net/atlantic/hw_atl/hw_atl_utils_fw2x.c +1 -0
@@ -7,6 +7,7 @@*/ #include <rte_ether.h> +#include <rte_memcpy.h> #include <pthread.h> #include "../atl_hw_regs.h"
drivers/net/bnx2x/bnx2x.h +1 -0
@@ -15,6 +15,7 @@#define __BNX2X_H__#include <rte_byteorder.h> +#include <rte_memcpy.h> #include <rte_spinlock.h> #include <bus_pci_driver.h> #include <rte_io.h>
drivers/net/bnx2x/ecore_sp.c +1 -0
@@ -13,6 +13,7 @@#include "bnx2x.h" #include "ecore_init.h" +#include <rte_memcpy.h> /**** Exe Queue interfaces ****/
drivers/net/bnx2x/ecore_sp.h +1 -0
@@ -16,6 +16,7 @@#include <rte_bitops.h> #include <rte_byteorder.h> +#include <rte_memcpy.h> #if RTE_BYTE_ORDER ==RTE_LITTLE_ENDIAN #ifndef __LITTLE_ENDIAN
drivers/net/cnxk/cn10k_ethdev_sec.c +1 -0
@@ -4,6 +4,7 @@#include <rte_cryptodev.h> #include <rte_eventdev.h> +#include <rte_memcpy.h> #include <rte_security.h> #include <rte_security_driver.h> #include <rte_pmd_cnxk.h>
drivers/net/cnxk/cn10k_rx.h +1 -0
@@ -5,6 +5,7 @@#define __CN10K_RX_H__#include <rte_ethdev.h> +#include <rte_memcpy.h> #include <rte_security_driver.h> #include <rte_vect.h> #include "cn10k_rxtx.h"
drivers/net/cnxk/cn20k_ethdev_sec.c +1 -0
@@ -4,6 +4,7 @@#include <rte_cryptodev.h> #include <rte_eventdev.h> +#include <rte_memcpy.h> #include <rte_pmd_cnxk.h> #include <rte_security.h> #include <rte_security_driver.h>
drivers/net/cnxk/cn20k_rx.h +1 -0
@@ -6,6 +6,7 @@#include "cn20k_rxtx.h" #include <rte_ethdev.h> +#include <rte_memcpy.h> #include <rte_security_driver.h> #include <rte_vect.h>
drivers/net/cnxk/cnxk_ethdev_ops.c +1 -0
@@ -3,6 +3,7 @@*/ #include <cnxk_ethdev.h> +#include <rte_memcpy.h> int cnxk_nix_info_get (struct rte_eth_dev *eth_dev,struct rte_eth_dev_info *devinfo)
drivers/net/cnxk/cnxk_rep_flow.c +1 -0
@@ -8,6 +8,7 @@#include <cnxk_flow.h> #include <cnxk_rep.h> #include <cnxk_rep_msg.h> +#include <rte_memcpy.h> #define DEFAULT_DUMP_FILE_NAME "/tmp/fdump"#define MAX_BUFFER_SIZE 1500
drivers/net/cnxk/cnxk_rep_msg.c +1 -0
@@ -4,6 +4,7 @@#include <cnxk_rep.h> #include <cnxk_rep_msg.h> +#include <rte_memcpy.h> #define CTRL_MSG_RCV_TIMEOUT_MS 2000#define CTRL_MSG_READY_WAIT_US 2000
drivers/net/cnxk/cnxk_rep_ops.c +1 -0
@@ -4,6 +4,7 @@#include <cnxk_rep.h> #include <cnxk_rep_msg.h> +#include <rte_memcpy.h> #define MEMPOOL_CACHE_SIZE 256#define TX_DESC_PER_QUEUE 512
drivers/net/cxgbe/cxgbe_ethdev.c +1 -0
@@ -19,6 +19,7 @@#include <rte_interrupts.h> #include <rte_log.h> #include <rte_debug.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_branch_prediction.h>
drivers/net/cxgbe/sge.c +1 -0
@@ -19,6 +19,7 @@#include <rte_interrupts.h> #include <rte_log.h> #include <rte_debug.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <rte_branch_prediction.h> #include <rte_memory.h>
drivers/net/dpaa/dpaa_rxtx.c +1 -0
@@ -18,6 +18,7 @@#include <rte_interrupts.h> #include <rte_log.h> #include <rte_debug.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <rte_atomic.h> #include <rte_branch_prediction.h>
drivers/net/dpaa2/dpaa2_mux.c +1 -0
@@ -15,6 +15,7 @@#include <rte_log.h> #include <rte_malloc.h> #include <rte_flow_driver.h> +#include <rte_memcpy.h> #include <rte_tailq.h> #include <bus_fslmc_driver.h>
drivers/net/ena/ena_ethdev.c +1 -0
@@ -4,6 +4,7 @@*/ #include <rte_alarm.h> +#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_errno.h> #include <rte_version.h>
drivers/net/ena/ena_rss.c +1 -0
@@ -7,6 +7,7 @@#include "ena_logs.h" #include <ena_admin_defs.h> +#include <rte_memcpy.h> #define TEST_BIT (val, bit_shift) ((val) & (1UL << (bit_shift)))
drivers/net/gve/gve_rx.c +1 -0
@@ -4,6 +4,7 @@#include "gve_ethdev.h" #include "base/gve_adminq.h" +#include <rte_memcpy.h> #define GVE_PKT_CONT_BIT_IS_SET (x) (GVE_RXF_PKT_CONT & (x))
drivers/net/gve/gve_tx.c +1 -0
@@ -4,6 +4,7 @@#include "gve_ethdev.h" #include "base/gve_adminq.h" +#include <rte_memcpy.h> static inline void gve_free_bulk_mbuf (struct rte_mbuf **txep,int num)
drivers/net/hinic/hinic_pmd_tx.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_mbuf.h> +#include <rte_memcpy.h> #include <rte_tcp.h> #include <rte_sctp.h> #include <rte_udp.h>
drivers/net/intel/idpf/idpf_common_rxtx_avx512.c +1 -0
@@ -3,6 +3,7 @@*/ #include <eal_export.h> +#include <rte_memcpy.h> #include <rte_vect.h> #include "idpf_common_device.h" #include "idpf_common_rxtx.h"
drivers/net/ionic/ionic_rxtx.h +1 -0
@@ -8,6 +8,7 @@#include <stdint.h> #include "ionic_if.h" +#include <rte_memcpy.h> struct ionic_rx_qcq ;struct ionic_tx_qcq ;
drivers/net/memif/rte_eth_memif.c +1 -0
@@ -14,6 +14,7 @@#include <errno.h> #include <sys/eventfd.h> +#include <rte_memcpy.h> #include <rte_version.h> #include <rte_mbuf.h> #include <rte_ether.h>
drivers/net/mlx4/mlx4_rxtx.c +1 -0
@@ -25,6 +25,7 @@#include <rte_common.h> #include <rte_io.h> #include <rte_mbuf.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_prefetch.h>
drivers/net/mlx5/linux/mlx5_ethdev_os.c +1 -0
@@ -33,6 +33,7 @@#include <rte_eal_paging.h> #include <rte_interrupts.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_rwlock.h> #include <rte_cycles.h>
drivers/net/mlx5/mlx5_flow.c +1 -0
@@ -19,6 +19,7 @@#include <rte_flow_driver.h> #include <rte_malloc.h> #include <rte_ip.h> +#include <rte_memcpy.h> #include <mlx5_glue.h> #include <mlx5_devx_cmds.h>
drivers/net/mlx5/mlx5_flow_dv.c +1 -0
@@ -19,6 +19,7 @@#include <bus_pci_driver.h> #include <rte_ip.h> #include <rte_gre.h> +#include <rte_memcpy.h> #include <rte_vxlan.h> #include <rte_gtp.h> #include <rte_eal_paging.h>
drivers/net/mlx5/mlx5_flow_flex.c +1 -0
@@ -2,6 +2,7 @@* Copyright (c) 2021 NVIDIA Corporation & Affiliates */ #include <rte_malloc.h> +#include <rte_memcpy.h> #include <mlx5_devx_cmds.h> #include <mlx5_malloc.h> #include "mlx5.h"
drivers/net/mlx5/mlx5_flow_hw.c +1 -0
@@ -5,6 +5,7 @@#include <eal_export.h> #include <rte_flow.h> #include <rte_flow_driver.h> +#include <rte_memcpy.h> #include <rte_stdatomic.h> #include <mlx5_malloc.h>
drivers/net/mlx5/mlx5_rx.h +1 -0
@@ -10,6 +10,7 @@#include <sys/queue.h> #include <rte_mbuf.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_common.h> #include <rte_spinlock.h>
drivers/net/mlx5/mlx5_rxq.c +1 -0
@@ -19,6 +19,7 @@#include <rte_debug.h> #include <rte_io.h> #include <rte_eal_paging.h> +#include <rte_memcpy.h> #include <mlx5_glue.h> #include <mlx5_malloc.h>
drivers/net/mlx5/mlx5_tx.h +1 -0
@@ -10,6 +10,7 @@#include <sys/queue.h> #include <rte_mbuf.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_common.h> #include <rte_spinlock.h>
drivers/net/mlx5/mlx5_txpp.c +1 -0
@@ -11,6 +11,7 @@#include <rte_malloc.h> #include <rte_cycles.h> #include <rte_eal_paging.h> +#include <rte_memcpy.h> #include <mlx5_malloc.h> #include <mlx5_common_devx.h>
drivers/net/nfb/nfb_rx.h +1 -0
@@ -13,6 +13,7 @@#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> #include <rte_ethdev.h> +#include <rte_memcpy.h> #include <rte_time.h> #include "nfb.h"
drivers/net/nfb/nfb_tx.h +1 -0
@@ -13,6 +13,7 @@#include <ethdev_driver.h> #include <rte_ethdev.h> #include <rte_malloc.h> +#include <rte_memcpy.h> struct ndp_tx_queue {struct nfb_device *nfb;/* nfb dev structure */
drivers/net/nfp/flower/nfp_conntrack.c +1 -0
@@ -8,6 +8,7 @@#include <rte_malloc.h> #include <rte_hash.h> #include <rte_jhash.h> +#include <rte_memcpy.h> #include "../nfp_logs.h" #include "nfp_flower_cmsg.h"
drivers/net/nfp/flower/nfp_flower_cmsg.c +1 -0
@@ -10,6 +10,7 @@#include "../nfp_net_meta.h" #include "nfp_flower_ctrl.h" #include "nfp_flower_representor.h" +#include <rte_memcpy.h> static char *nfp_flower_cmsg_get_data (struct rte_mbuf *m)
drivers/net/nfp/nfp_net_flow.c +1 -0
@@ -9,6 +9,7 @@#include <rte_hash.h> #include <rte_jhash.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include "nfp_logs.h" #include "nfp_net_cmsg.h"
drivers/net/nfp/nfpcore/nfp_nsp.c +1 -0
@@ -7,6 +7,7 @@#include <nfp_platform.h> #include <rte_common.h> +#include <rte_memcpy.h> #include "nfp_logs.h" #include "nfp_resource.h"
drivers/net/ntnic/ntnic_ethdev.c +1 -0
@@ -7,6 +7,7 @@#include <rte_eal.h> #include <rte_dev.h> +#include <rte_memcpy.h> #include <rte_vfio.h> #include <rte_ethdev.h> #include <rte_bus_pci.h>
drivers/net/octeon_ep/otx_ep_rxtx.c +1 -0
@@ -5,6 +5,7 @@#include <unistd.h> #include <assert.h> #include <rte_eal.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_io.h>
drivers/net/sfc/sfc_ethdev.c +1 -0
@@ -12,6 +12,7 @@#include <dev_driver.h> #include <ethdev_driver.h> #include <ethdev_pci.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_errno.h>
drivers/net/sfc/sfc_mae.c +1 -0
@@ -12,6 +12,7 @@#include <rte_byteorder.h> #include <rte_bitops.h> #include <rte_common.h> +#include <rte_memcpy.h> #include <rte_vxlan.h> #include "efx.h"
drivers/net/sfc/sfc_tbl_meta_cache.c +1 -0
@@ -5,6 +5,7 @@#include <rte_malloc.h> #include <rte_jhash.h> +#include <rte_memcpy.h> #include "sfc_tbl_meta_cache.h" #include "sfc_debug.h"
drivers/net/sfc/sfc_tso.c +1 -0
@@ -8,6 +8,7 @@*/ #include <rte_ip.h> +#include <rte_memcpy.h> #include <rte_tcp.h> #include "sfc.h"
drivers/net/vmxnet3/vmxnet3_rxtx.c +1 -0
@@ -19,6 +19,7 @@#include <rte_log.h> #include <rte_debug.h> #include <rte_interrupts.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <rte_memory.h> #include <rte_memzone.h>
drivers/net/xsc/xsc_tx.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_io.h> +#include <rte_memcpy.h> #include "xsc_log.h" #include "xsc_defs.h"
drivers/net/zxdh/zxdh_rxtx.c +1 -0
@@ -5,6 +5,7 @@#include <stdint.h> #include <stdalign.h> +#include <rte_memcpy.h> #include <rte_net.h> #include "zxdh_logs.h"
Signature · 1 line
2.53.0
Re: [PATCH v2 03/68] net: add missing include of rte_memcpy.h
Quoted 6 lines · Stephen Hemminger
These files use
rte_memcpy()but relied onrte_memcpy.hbeing included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes ofrte_memcpy.hdo not break the build.Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 4/68 crypto: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- drivers/crypto/armv8/rte_armv8_pmd.c | 1 + drivers/crypto/caam_jr/caam_jr.c | 1 + drivers/crypto/ccp/ccp_crypto.c | 1 + drivers/crypto/cnxk/cn10k_tls_ops.h | 1 + drivers/crypto/cnxk/cn20k_tls_ops.h | 1 + drivers/crypto/cnxk/cnxk_ae.h | 1 + drivers/crypto/cnxk/cnxk_se.h | 1 + drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c | 1 + drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c | 1 + drivers/crypto/ipsec_mb/pmd_aesni_mb.c | 1 + drivers/crypto/ipsec_mb/pmd_snow3g.c | 1 + drivers/crypto/mlx5/mlx5_crypto_gcm.c | 1 + drivers/crypto/mvsam/rte_mrvl_pmd.c | 1 + drivers/crypto/openssl/rte_openssl_pmd.c | 1 + drivers/crypto/qat/asym/qat_asym.c | 1 + drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c | 1 + drivers/crypto/qat/dev/qat_crypto_pmd_gen_lce.c | 1 + drivers/crypto/qat/dev/qat_crypto_pmd_gens.h | 1 + drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 1 + drivers/crypto/virtio/virtio_cryptodev.c | 1 + drivers/crypto/virtio/virtio_rxtx.c | 1 + 21 files changed, 21 insertions(+)
drivers/crypto/armv8/rte_armv8_pmd.c +1 -0
@@ -11,6 +11,7 @@#include <bus_vdev_driver.h> #include <rte_malloc.h> #include <rte_cpuflags.h> +#include <rte_memcpy.h> #include "AArch64cryptolib.h"
drivers/crypto/caam_jr/caam_jr.c +1 -0
@@ -14,6 +14,7 @@#include <rte_cryptodev.h> #include <bus_vdev_driver.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_security_driver.h> #include <rte_hexdump.h>
drivers/crypto/ccp/ccp_crypto.c +1 -0
@@ -17,6 +17,7 @@#include <openssl/evp.h> /*sub key apis*/ #include <rte_hexdump.h> +#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_malloc.h> #include <rte_memory.h>
drivers/crypto/cnxk/cn10k_tls_ops.h +1 -0
@@ -6,6 +6,7 @@#define __CN10K_TLS_OPS_H__#include <rte_crypto_sym.h> +#include <rte_memcpy.h> #include <rte_security.h> #include "roc_ie.h"
drivers/crypto/cnxk/cn20k_tls_ops.h +1 -0
@@ -6,6 +6,7 @@#define __CN20K_TLS_OPS_H__#include <rte_crypto_sym.h> +#include <rte_memcpy.h> #include <rte_security.h> #include "roc_ie.h"
drivers/crypto/cnxk/cnxk_ae.h +1 -0
@@ -8,6 +8,7 @@#include <rte_common.h> #include <rte_crypto_asym.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_memory.h> #include "roc_ae.h"
drivers/crypto/cnxk/cnxk_se.h +1 -0
@@ -7,6 +7,7 @@#include <stdbool.h> #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include "cnxk_cryptodev.h" #include "cnxk_cryptodev_ops.h"
drivers/crypto/dpaa2_sec/dpaa2_sec_raw_dp.c +1 -0
@@ -12,6 +12,7 @@#include "dpaa2_sec_logs.h" #include <desc/algo.h> +#include <rte_memcpy.h> struct dpaa2_sec_raw_dp_ctx {dpaa2_sec_session *session;
drivers/crypto/dpaa_sec/dpaa_sec_raw_dp.c +1 -0
@@ -7,6 +7,7 @@#include <cryptodev_pmd.h> #include <rte_crypto.h> #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <rte_security_driver.h> /* RTA header files */
drivers/crypto/ipsec_mb/pmd_aesni_mb.c +1 -0
@@ -5,6 +5,7 @@#include <unistd.h> #include "pmd_aesni_mb_priv.h" +#include <rte_memcpy.h> RTE_DEFINE_PER_LCORE (pid_t, pid);
drivers/crypto/ipsec_mb/pmd_snow3g.c +1 -0
@@ -3,6 +3,7 @@*/ #include "pmd_snow3g_priv.h" +#include <rte_memcpy.h> /** Parse crypto xform chain and set private session parameters. */ static int
drivers/crypto/mlx5/mlx5_crypto_gcm.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_eal_paging.h> #include <rte_errno.h>
drivers/crypto/mvsam/rte_mrvl_pmd.c +1 -0
@@ -8,6 +8,7 @@#include <rte_hexdump.h> #include <rte_cryptodev.h> #include <cryptodev_pmd.h> +#include <rte_memcpy.h> #include <rte_security_driver.h> #include <bus_vdev_driver.h> #include <rte_malloc.h>
drivers/crypto/openssl/rte_openssl_pmd.c +1 -0
@@ -10,6 +10,7 @@#include <bus_vdev_driver.h> #include <rte_malloc.h> #include <rte_cpuflags.h> +#include <rte_memcpy.h> #include <openssl/cmac.h> #include <openssl/hmac.h>
drivers/crypto/qat/asym/qat_asym.c +1 -0
@@ -14,6 +14,7 @@#include "icp_qat_fw.h" #include "qat_pke.h" #include "qat_ec.h" +#include <rte_memcpy.h> #define ASYM_ENQ_THRESHOLD_NAME "qat_asym_enq_threshold"#define RSA_MODULUS_2048_BITS 2048
drivers/crypto/qat/dev/qat_crypto_pmd_gen3.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <cryptodev_pmd.h> #include "qat_sym_session.h" #include "qat_sym.h"
drivers/crypto/qat/dev/qat_crypto_pmd_gen_lce.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <cryptodev_pmd.h> #include "qat_sym_session.h" #include "qat_sym.h"
drivers/crypto/qat/dev/qat_crypto_pmd_gens.h +1 -0
@@ -8,6 +8,7 @@#include <rte_cryptodev.h> #include <rte_common.h> #include <rte_branch_prediction.h> +#include <rte_memcpy.h> #include "qat_crypto.h" #include "qat_sym_session.h" #include "qat_sym.h"
drivers/crypto/scheduler/rte_cryptodev_scheduler.c +1 -0
@@ -2,6 +2,7 @@* Copyright(c) 2017 Intel Corporation */ #include <eal_export.h> +#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_reorder.h> #include <rte_cryptodev.h>
drivers/crypto/virtio/virtio_cryptodev.c +1 -0
@@ -6,6 +6,7 @@#include <rte_common.h> #include <rte_errno.h> +#include <rte_memcpy.h> #include <rte_pci.h> #include <bus_pci_driver.h> #include <rte_cryptodev.h>
drivers/crypto/virtio/virtio_rxtx.c +1 -0
@@ -7,6 +7,7 @@#include "virtio_ring.h" #include "virtio_cryptodev.h" #include "virtio_crypto_algs.h" +#include <rte_memcpy.h> static void vq_ring_free_chain (struct virtqueue *vq,uint16_t desc_idx)
Signature · 1 line
2.53.0
PATCH v2 5/68 drivers: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- drivers/baseband/turbo_sw/bbdev_turbo_software.c | 1 + drivers/common/mlx5/mlx5_common_mr.c | 1 + drivers/dma/dpaa2/dpaa2_qdma.c | 1 + drivers/ml/cnxk/cn10k_ml_dev.c | 1 + drivers/ml/cnxk/cn10k_ml_model.c | 1 + drivers/ml/cnxk/cn10k_ml_ops.c | 1 + drivers/ml/cnxk/cnxk_ml_io.c | 1 + drivers/ml/cnxk/tvmrt_ml_ops.c | 1 + drivers/regex/mlx5/mlx5_rxp.c | 1 + 9 files changed, 9 insertions(+)
drivers/baseband/turbo_sw/bbdev_turbo_software.c +1 -0
@@ -8,6 +8,7 @@#include <rte_common.h> #include <bus_vdev_driver.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_ring.h> #include <rte_kvargs.h> #include <rte_cycles.h>
drivers/common/mlx5/mlx5_common_mr.c +1 -0
@@ -8,6 +8,7 @@#include <rte_eal_memconfig.h> #include <rte_eal_paging.h> #include <rte_errno.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_malloc.h> #include <rte_rwlock.h>
drivers/dma/dpaa2/dpaa2_qdma.c +1 -0
@@ -10,6 +10,7 @@#include <mc/fsl_dpdmai.h> +#include <rte_memcpy.h> #include <rte_pmd_dpaax_qdma.h> #include "dpaa2_hw_dpio.h" #include "dpaa2_qdma.h"
drivers/ml/cnxk/cn10k_ml_dev.c +1 -0
@@ -6,6 +6,7 @@#include <rte_dev.h> #include <rte_devargs.h> #include <rte_kvargs.h> +#include <rte_memcpy.h> #include <rte_mldev.h> #include <rte_mldev_pmd.h> #include <rte_pci.h>
drivers/ml/cnxk/cn10k_ml_model.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_hash_crc.h> +#include <rte_memcpy.h> #include <mldev_utils.h>
drivers/ml/cnxk/cn10k_ml_ops.c +1 -0
@@ -2,6 +2,7 @@* Copyright (c) 2022 Marvell. */ +#include <rte_memcpy.h> #include <rte_mldev.h> #include <rte_mldev_pmd.h>
drivers/ml/cnxk/cnxk_ml_io.c +1 -0
@@ -2,6 +2,7 @@* Copyright (c) 2023 Marvell. */ +#include <rte_memcpy.h> #include <rte_mldev.h> #include <mldev_utils.h>
drivers/ml/cnxk/tvmrt_ml_ops.c +1 -0
@@ -16,6 +16,7 @@#include <rte_common.h> #include <rte_cycles.h> +#include <rte_memcpy.h> #include <rte_mldev.h> #include <rte_mldev_pmd.h>
drivers/regex/mlx5/mlx5_rxp.c +1 -0
@@ -5,6 +5,7 @@#include <rte_log.h> #include <rte_errno.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_regexdev.h> #include <rte_regexdev_core.h> #include <rte_regexdev_driver.h>
Signature · 1 line
2.53.0
Re: [PATCH v2 05/68] drivers: add missing include of rte_memcpy.h
Quoted 6 lines · Stephen Hemminger
These files use
rte_memcpy()but relied onrte_memcpy.hbeing included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes ofrte_memcpy.hdo not break the build.Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 6/68 app: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- app/graph/ip4_output_hook.c | 1 + app/test-bbdev/test_bbdev_perf.c | 1 + app/test-compress-perf/comp_perf_test_common.c | 1 + app/test-compress-perf/comp_perf_test_verify.c | 1 + app/test-dma-perf/benchmark.c | 1 + app/test-mldev/test_common.c | 1 + app/test-mldev/test_inference_common.c | 1 + app/test/test_compressdev.c | 1 + app/test/test_cryptodev_crosscheck.c | 1 + app/test/test_event_crypto_adapter.c | 1 + 10 files changed, 10 insertions(+)
app/graph/ip4_output_hook.c +1 -0
@@ -5,6 +5,7 @@#include <rte_graph.h> #include <rte_graph_worker.h> #include <rte_graph_feature_arc_worker.h> +#include <rte_memcpy.h> #include "rte_node_ip4_api.h"
app/test-bbdev/test_bbdev_perf.c +1 -0
@@ -15,6 +15,7 @@#include <rte_cycles.h> #include <rte_lcore.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_random.h> #include <rte_hexdump.h> #include <rte_interrupts.h>
app/test-compress-perf/comp_perf_test_common.c +1 -0
@@ -6,6 +6,7 @@#include <rte_eal.h> #include <rte_log.h> #include <rte_compressdev.h> +#include <rte_memcpy.h> #include "comp_perf.h" #include "comp_perf_options.h"
app/test-compress-perf/comp_perf_test_verify.c +1 -0
@@ -8,6 +8,7 @@#include <rte_eal.h> #include <rte_log.h> #include <rte_compressdev.h> +#include <rte_memcpy.h> #include "comp_perf_test_verify.h" #include "comp_perf_test_common.h"
app/test-dma-perf/benchmark.c +1 -0
@@ -7,6 +7,7 @@#include <stdlib.h> #include <unistd.h> +#include <rte_memcpy.h> #include <rte_time.h> #include <rte_mbuf.h> #include <rte_dmadev.h>
app/test-mldev/test_common.c +1 -0
@@ -6,6 +6,7 @@#include <rte_common.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_mldev.h>
app/test-mldev/test_inference_common.c +1 -0
@@ -13,6 +13,7 @@#include <rte_launch.h> #include <rte_lcore.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_mldev.h>
app/test/test_compressdev.c +1 -0
@@ -10,6 +10,7 @@#include <rte_cycles.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_compressdev.h>
app/test/test_cryptodev_crosscheck.c +1 -0
@@ -3,6 +3,7 @@*/ #include <rte_cryptodev.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include "test.h" #include "test_cryptodev.h"
app/test/test_event_crypto_adapter.c +1 -0
@@ -7,6 +7,7 @@#include <string.h> #include <rte_common.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_mempool.h> #include <rte_mbuf.h> #include <rte_cryptodev.h>
Signature · 1 line
2.53.0
PATCH v2 7/68 examples: add missing include of rte_memcpy.h
In reply to Stephen HemmingerThese files use rte_memcpy() but relied on rte_memcpy.h being included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes of rte_memcpy.h do not break the build.
--- examples/bbdev_app/main.c | 1 + examples/dma/dmafwd.c | 1 + examples/ipsec-secgw/esp.c | 1 + 3 files changed, 3 insertions(+)
examples/bbdev_app/main.c +1 -0
@@ -29,6 +29,7 @@#include <rte_malloc.h> #include <rte_mbuf.h> #include <rte_mbuf_dyn.h> +#include <rte_memcpy.h> #include <rte_memory.h> #include <rte_mempool.h> #include <rte_log.h>
examples/dma/dmafwd.c +1 -0
@@ -12,6 +12,7 @@#include <rte_malloc.h> #include <rte_ethdev.h> #include <rte_dmadev.h> +#include <rte_memcpy.h> /* size of ring used for software copying between rx and tx. */ #define RTE_LOGTYPE_DMA RTE_LOGTYPE_USER1
examples/ipsec-secgw/esp.c +1 -0
@@ -15,6 +15,7 @@#include <rte_common.h> #include <rte_crypto.h> #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <rte_random.h> #include "ipsec.h"
Signature · 1 line
2.53.0
Re: [PATCH v2 07/68] examples: add missing include of rte_memcpy.h
Quoted 6 lines · Stephen Hemminger
These files use
rte_memcpy()but relied onrte_memcpy.hbeing included indirectly via another header. Add the direct include so that later patches which remove now-unnecessary includes ofrte_memcpy.hdo not break the build.Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 8/68 eal: document when to use rte_memcpy
In reply to Stephen HemmingerThe choice between rte_memcpy() and memcpy() was not documented, which has led to rte_memcpy() being used in places where it gives no benefit, such as the control path and copies of a constant size.
Document the guidance: structure assignment for fixed size objects, memcpy() for the control path and for constant sizes, and rte_memcpy() only for variable size copies in the data path.
--- lib/eal/include/generic/rte_memcpy.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
lib/eal/include/generic/rte_memcpy.h +18 -0
@@ -96,6 +96,24 @@ rte_mov256(uint8_t *dst, const uint8_t *src);/** * Copy bytes from one location to another. The locations must not overlap. * +* This function exists because on some platforms the libc memcpy() +* does not generate optimal code for the copy sizes and alignments +* common in packet processing. It is not a general replacement for +* memcpy(); prefer the following, in order: +* +* - Use structure assignment when copying a fixed size object. +* The compiler generates the best possible code, and the types +* are checked. +* - Use memcpy() everywhere else, in particular in the control path, +* and whenever the size is a compile time constant. For a constant +* size the compiler inlines the copy, so rte_memcpy() gains nothing, +* and memcpy() is understood by analysis tools such as the address +* sanitizer, valgrind and _FORTIFY_SOURCE which can then detect +* overlapping or out of bounds copies. +* - Use rte_memcpy() only in the data path, and only where the size is +* variable at run time. This is the case for which it was written, +* and where it can still be faster than the libc implementation. +* * @note This is implemented as a macro, so it's address should not be taken * and care is needed as parameter expressions may be evaluated multiple times. *
Signature · 1 line
2.53.0
Re: [PATCH v2 08/68] eal: document when to use rte_memcpy
Quoted 10 lines · Stephen Hemminger
The choice between
rte_memcpy()andmemcpy()was not documented, which has led torte_memcpy()being used in places where it gives no benefit, such as the control path and copies of a constant size.Document the guidance: structure assignment for fixed size objects,
memcpy()for the control path and for constant sizes, andrte_memcpy()only for variable size copies in the data path.Suggested-by Morten Brørup <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 9/68 app/testpmd: replace rte_memcpy with memcpy
In reply to Stephen HemmingerThe standard C library memcpy is as fast and has more checking by analysis tools than DPDK rte_memcpy.
--- app/test-pmd/cmdline.c | 28 ++++++++++++++-------------- app/test-pmd/cmdline_flow.c | 34 +++++++++++++++++----------------- app/test-pmd/config.c | 13 ++++++------- 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-pmd/txonly.c | 7 +++---- 12 files changed, 40 insertions(+), 50 deletions(-)
app/test-pmd/cmdline.c +14 -14
@@ -10516,7 +10516,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;
@@ -10530,9 +10530,9 @@ 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, +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, +memcpy (vxlan_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -10711,7 +10711,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);
@@ -10721,9 +10721,9 @@ 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, +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, +memcpy (nvgre_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -10838,9 +10838,9 @@ 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, +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, +memcpy (l2_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -11020,7 +11020,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);
@@ -11030,9 +11030,9 @@ 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, +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, +memcpy (mplsogre_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
@@ -11256,7 +11256,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) {
@@ -11268,9 +11268,9 @@ 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, +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, +memcpy (mplsoudp_encap_conf.eth_dst, res->eth_dst.addr_bytes,RTE_ETHER_ADDR_LEN ); }
app/test-pmd/cmdline_flow.c +17 -17
@@ -13967,31 +13967,31 @@ cmd_set_raw_parsed_sample(const struct buffer *in)switch (action->type) {case RTE_FLOW_ACTION_TYPE_MARK : size =sizeof (struct rte_flow_action_mark ); -rte_memcpy (&sample_mark[idx], +memcpy (&sample_mark[idx], (const void *)action->conf, size); action->conf = &sample_mark[idx];break ;case RTE_FLOW_ACTION_TYPE_COUNT : size =sizeof (struct rte_flow_action_count ); -rte_memcpy (&sample_count[idx], +memcpy (&sample_count[idx], (const void *)action->conf, size); action->conf = &sample_count[idx];break ;case RTE_FLOW_ACTION_TYPE_QUEUE : size =sizeof (struct rte_flow_action_queue ); -rte_memcpy (&sample_queue[idx], +memcpy (&sample_queue[idx], (const void *)action->conf, size); action->conf = &sample_queue[idx];break ;case RTE_FLOW_ACTION_TYPE_RSS : size =sizeof (struct rte_flow_action_rss ); rss = action->conf; -rte_memcpy (&sample_rss_data[idx].conf, +memcpy (&sample_rss_data[idx].conf, (const void *)rss, size);if (rss->key_len && rss->key) { sample_rss_data[idx].conf.key = sample_rss_data[idx].key; -rte_memcpy ((void *)((uintptr_t ) +memcpy ((void *)((uintptr_t ) sample_rss_data[idx].conf.key), (const void *)rss->key,sizeof (uint8_t ) * rss->key_len);
@@ -13999,7 +13999,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in)if (rss->queue_num && rss->queue) { sample_rss_data[idx].conf.queue = sample_rss_data[idx].queue; -rte_memcpy ((void *)((uintptr_t ) +memcpy ((void *)((uintptr_t ) sample_rss_data[idx].conf.queue), (const void *)rss->queue,sizeof (uint16_t ) * rss->queue_num);
@@ -14008,13 +14008,13 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_RAW_ENCAP : size =sizeof (struct rte_flow_action_raw_encap ); -rte_memcpy (&sample_encap[idx], +memcpy (&sample_encap[idx], (const void *)action->conf, size); action->conf = &sample_encap[idx];break ;case RTE_FLOW_ACTION_TYPE_PORT_ID : size =sizeof (struct rte_flow_action_port_id ); -rte_memcpy (&sample_port_id[idx], +memcpy (&sample_port_id[idx], (const void *)action->conf, size); action->conf = &sample_port_id[idx];break ;
@@ -14022,7 +14022,7 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_VF : size =sizeof (struct rte_flow_action_vf ); -rte_memcpy (&sample_vf[idx], +memcpy (&sample_vf[idx], (const void *)action->conf, size); action->conf = &sample_vf[idx];break ;
@@ -14038,13 +14038,13 @@ cmd_set_raw_parsed_sample(const struct buffer *in)break ;case RTE_FLOW_ACTION_TYPE_PORT_REPRESENTOR : size =sizeof (struct rte_flow_action_ethdev ); -rte_memcpy (&sample_port_representor[idx], +memcpy (&sample_port_representor[idx], (const void *)action->conf, size); action->conf = &sample_port_representor[idx];break ;case RTE_FLOW_ACTION_TYPE_REPRESENTED_PORT : size =sizeof (struct rte_flow_action_ethdev ); -rte_memcpy (&sample_represented_port[idx], +memcpy (&sample_represented_port[idx], (const void *)action->conf, size); action->conf = &sample_represented_port[idx];break ;
@@ -14177,7 +14177,7 @@ cmd_set_raw_parsed(const struct buffer *in)if (geneve_opt->option_len && geneve_opt->data) { *total_size += geneve_opt->option_len *sizeof (uint32_t ); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), geneve_opt->data, geneve_opt->option_len *sizeof (uint32_t )); }
@@ -14217,7 +14217,7 @@ 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), +memcpy (data_tail - (*total_size), &ext_word,sizeof (ext_word)); } size =sizeof (struct rte_gtp_hdr );
@@ -14263,19 +14263,19 @@ cmd_set_raw_parsed(const struct buffer *in)if (gre_opt->checksum_rsvd.checksum) { *total_size +=sizeof (gre_opt->checksum_rsvd); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->checksum_rsvd,sizeof (gre_opt->checksum_rsvd)); }if (gre_opt->key.key) { *total_size +=sizeof (gre_opt->key.key); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->key.key,sizeof (gre_opt->key.key)); }if (gre_opt->sequence.sequence) { *total_size +=sizeof (gre_opt->sequence.sequence); -rte_memcpy (data_tail - (*total_size), +memcpy (data_tail - (*total_size), &gre_opt->sequence.sequence,sizeof (gre_opt->sequence.sequence)); }
@@ -14288,7 +14288,7 @@ cmd_set_raw_parsed(const struct buffer *in) }if (size) { *total_size += size; -rte_memcpy (data_tail - (*total_size), src_spec, size); +memcpy (data_tail - (*total_size), src_spec, size);/* update some fields which cannot be set by cmdline */ update_fields ((data_tail - (*total_size)), item, upper_layer);
app/test-pmd/config.c +6 -7
@@ -24,7 +24,6 @@#include <rte_debug.h> #include <rte_log.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_launch.h> #include <rte_bus.h>
@@ -2263,9 +2262,9 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id, pft->num_pmd_actions, &error);return NULL ; } -rte_memcpy (pft->actions, pft->pmd_actions, +memcpy (pft->actions, pft->pmd_actions, pft->num_pmd_actions *sizeof (actions[0 ])); -rte_memcpy (pft->actions + pft->num_pmd_actions, actions, +memcpy (pft->actions + pft->num_pmd_actions, actions, num_actions *sizeof (actions[0 ])); }if (tunnel_ops->items) {
@@ -2291,9 +2290,9 @@ port_flow_tunnel_offload_cmd_prep(portid_t port_id, pft->num_pmd_items, &error);return NULL ; } -rte_memcpy (pft->items, pft->pmd_items, +memcpy (pft->items, pft->pmd_items, pft->num_pmd_items *sizeof (pattern[0 ])); -rte_memcpy (pft->items + pft->num_pmd_items, pattern, +memcpy (pft->items + pft->num_pmd_items, pattern, num_items *sizeof (pattern[0 ])); }
@@ -2731,7 +2730,7 @@ 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->attr, table_attr, +memcpy (&pt->attr, table_attr,sizeof (struct rte_flow_template_table_attr ));printf ("Template table #%u created\n" , pt->id);return 0 ;
@@ -3367,7 +3366,7 @@ 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, +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 ;
app/test-pmd/csumonly.c +0 -1
@@ -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>
app/test-pmd/flowgen.c +0 -1
@@ -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>
app/test-pmd/iofwd.c +0 -1
@@ -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>
app/test-pmd/macfwd.c +0 -1
@@ -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>
app/test-pmd/macswap.c +0 -1
@@ -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>
app/test-pmd/noisy_vnf.c +0 -1
@@ -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>
app/test-pmd/rxonly.c +0 -1
@@ -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>
app/test-pmd/testpmd.c +0 -1
@@ -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>
app/test-pmd/txonly.c +3 -4
@@ -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>
@@ -80,21 +79,21 @@ copy_buf_to_pkt_segs(void* buf, unsigned len, struct rte_mbuf *pkt, copy_len = seg->data_len - offset; seg_buf = rte_pktmbuf_mtod_offset(seg, char *, offset);while (len > copy_len) { -rte_memcpy (seg_buf, buf, (size_t ) copy_len); +memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; seg_buf = rte_pktmbuf_mtod(seg, char *); copy_len = seg->data_len; } -rte_memcpy (seg_buf, buf, (size_t ) len); +memcpy (seg_buf, buf, (size_t ) len); }static inline void copy_buf_to_pkt (void * buf,unsigned len,struct rte_mbuf *pkt,unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), + memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);return ; }
Signature · 1 line
2.53.0
Re: [PATCH v2 09/68] app/testpmd: replace rte_memcpy with memcpy
Quoted 4 lines · Stephen Hemminger
The standard C library memcpy is as fast and has more checking by analysis tools than DPDK
rte_memcpy.Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 10/68 test: use memcpy instead of rte_memcpy
In reply to Stephen HemmingerIf size is constant, better to use C library memcpy which has more coverage from ASAN and static analysis tools.
--- app/test/commands.c | 1 - app/test/packet_burst_generator.c | 10 +++--- app/test/test_bpf.c | 1 + app/test/test_crc.c | 7 ++--- app/test/test_cryptodev.c | 14 ++++----- app/test/test_cryptodev.h | 1 + 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_eventdev.c | 1 - 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_ring.h | 17 +++++----- app/test/test_security_inline_macsec.c | 2 +- app/test/test_security_inline_proto.c | 42 ++++++++++++------------- app/test/test_security_proto.c | 2 +- app/test/test_service_cores.c | 1 - app/test/test_thash.c | 4 +-- app/test/virtual_pmd.c | 5 +-- 24 files changed, 62 insertions(+), 74 deletions(-)
app/test/commands.c +0 -1
@@ -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>
app/test/packet_burst_generator.c +5 -5
@@ -31,20 +31,20 @@ copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt, copy_len = seg->data_len - offset; seg_buf = rte_pktmbuf_mtod_offset(seg, char *, offset);while (len > copy_len) { -rte_memcpy (seg_buf, buf, (size_t ) copy_len); +memcpy (seg_buf, buf, (size_t ) copy_len); len -= copy_len; buf = ((char *) buf + copy_len); seg = seg->next; seg_buf = rte_pktmbuf_mtod(seg, void *); } -rte_memcpy (seg_buf, buf, (size_t ) len); +memcpy (seg_buf, buf, (size_t ) len); }static inline void copy_buf_to_pkt (void *buf,unsigned len,struct rte_mbuf *pkt,unsigned offset) {if (offset + len <= pkt->data_len) { - rte_memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, + memcpy(rte_pktmbuf_mtod_offset(pkt, char *, offset), buf, (size_t) len);return ; }
@@ -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 )); }
app/test/test_bpf.c +1 -0
@@ -12,6 +12,7 @@#include <rte_debug.h> #include <rte_hexdump.h> #include <rte_malloc.h> +#include <rte_memcpy.h> #include <rte_random.h> #include <rte_byteorder.h> #include <rte_errno.h>
app/test/test_crc.c +3 -4
@@ -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
@@ -116,14 +115,14 @@ crc_autotest(void)if (test_data ==NULL )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 ); ret |=crc_all_algs ("32-bit ethernet CRC: Test 2" ,RTE_NET_CRC32_ETH , test_data,CRC32_VEC_LEN1 , crc32_vec1_res);/* 32-bit ethernet CRC: Test 3 */ memset (test_data,0 ,CRC32_VEC_LEN1 );for (i =0 ; i <CRC32_VEC_LEN2 ; i +=12 ) -rte_memcpy (&test_data[i], crc32_vec1,12 ); +memcpy (&test_data[i], crc32_vec1,12 ); ret |=crc_all_algs ("32-bit ethernet CRC: Test 3" ,RTE_NET_CRC32_ETH , test_data,CRC32_VEC_LEN2 , crc32_vec2_res);
@@ -142,7 +141,7 @@ crc_autotest(void)/* 16-bit CCITT CRC: Test 7 */ memset (test_data,0 ,CRC32_VEC_LEN1 );for (i =0 ; i <CRC16_VEC_LEN3 ; i +=12 ) -rte_memcpy (&test_data[i], crc16_vec1,12 ); +memcpy (&test_data[i], crc16_vec1,12 ); ret |=crc_all_algs ("16-bit CCITT CRC: Test 7" ,RTE_NET_CRC16_CCITT , test_data,CRC16_VEC_LEN3 , crc16_vec3_res);return ret;
app/test/test_cryptodev.c +6 -8
@@ -2711,8 +2711,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 ;
@@ -2846,9 +2846,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,
@@ -2871,8 +2869,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 ;
@@ -9238,7 +9236,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 {
app/test/test_cryptodev.h +1 -0
@@ -5,6 +5,7 @@#define TEST_CRYPTODEV_H_ #include <rte_cryptodev.h> +#include <rte_memcpy.h> #include <rte_security.h> #define MAX_NUM_OPS_INFLIGHT (4096)
app/test/test_cryptodev_asym.c +0 -1
@@ -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>
app/test/test_cryptodev_security_pdcp.c +0 -1
@@ -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>
app/test/test_efd.c +0 -1
@@ -13,7 +13,6 @@ test_efd(void)#else -#include <rte_memcpy.h> #include <rte_malloc.h> #include <rte_efd.h> #include <rte_byteorder.h>
app/test/test_efd_perf.c +0 -1
@@ -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
app/test/test_event_crypto_adapter.c +6 -6
@@ -455,7 +455,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;
@@ -654,8 +654,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));
@@ -821,7 +821,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;
@@ -978,8 +978,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);
app/test/test_eventdev.c +0 -1
@@ -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
app/test/test_link_bonding_mode4.c +4 -4
@@ -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); }
app/test/test_mbuf.c +0 -1
@@ -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>
app/test/test_member.c +0 -1
@@ -7,7 +7,6 @@#include <math.h> #include "test.h" -#include <rte_memcpy.h> #include <rte_malloc.h> #ifdef RTE_EXEC_ENV_WINDOWS
app/test/test_member_perf.c +0 -1
@@ -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>
app/test/test_rawdev.c +0 -1
@@ -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
app/test/test_ring.h +8 -9
@@ -2,8 +2,9 @@* Copyright(c) 2019 Arm Limited */ +#include <string.h> +#include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_ptr_compress.h> #include <rte_ring.h> #include <rte_ring_elem.h>
@@ -166,11 +167,10 @@ test_ring_enqueue(struct rte_ring *r, void **obj, int esize, unsigned int n, r, esize, n, &zcd, NULL);if (unlikely (ret ==0 ))return 0 ; -rte_memcpy (zcd.ptr1, (char *)obj, zcd.n1 * esize); +memcpy (zcd.ptr1, (char *)obj, zcd.n1 * esize);if (unlikely (zcd.ptr2 !=NULL )) -rte_memcpy (zcd.ptr2, - (char *)obj + zcd.n1 * esize, - (ret - zcd.n1) * esize); +memcpy (zcd.ptr2, (char *)obj + zcd.n1 * esize, + (ret - zcd.n1) * esize);rte_ring_enqueue_zc_finish (r, ret);return ret;case (TEST_RING_ELEM_BURST_ZC_COMPRESS_PTR_16 ):
@@ -271,11 +271,10 @@ test_ring_dequeue(struct rte_ring *r, void **obj, int esize, unsigned int n, r, esize, n, &zcd, NULL);if (unlikely (ret ==0 ))return 0 ; -rte_memcpy ((char *)obj, zcd.ptr1, zcd.n1 * esize); +memcpy (obj, zcd.ptr1, zcd.n1 * esize);if (unlikely (zcd.ptr2 !=NULL )) -rte_memcpy ((char *)obj + zcd.n1 * esize, - zcd.ptr2, - (ret - zcd.n1) * esize); +memcpy ((char *)obj + zcd.n1 * esize, + zcd.ptr2, (ret - zcd.n1) * esize);rte_ring_dequeue_zc_finish (r, ret);return ret;case (TEST_RING_ELEM_BURST_ZC_COMPRESS_PTR_16 ):
app/test/test_security_inline_macsec.c +1 -1
@@ -128,7 +128,7 @@ init_packet(struct rte_mempool *mp, const uint8_t *data, unsigned int len)if (pkt ==NULL )return NULL ; -rte_memcpy (rte_pktmbuf_append (pkt, len), data, len); +memcpy (rte_pktmbuf_append (pkt, len), data, len);return pkt; }
app/test/test_security_inline_proto.c +21 -21
87 lines not on this page · raw message
app/test/test_security_proto.c +1 -1
@@ -167,5 +167,5 @@ test_sec_proto_pattern_generate(void)void test_sec_proto_pattern_set (uint8_t *buf,int len) { -rte_memcpy (buf, cleartext_pattern, len); +memcpy (buf, cleartext_pattern, len); }
app/test/test_service_cores.c +0 -1
@@ -7,7 +7,6 @@#include <rte_hexdump.h> #include <rte_malloc.h> #include <rte_mbuf.h> -#include <rte_memcpy.h> #include <rte_random.h> #include <rte_service.h>
app/test/test_thash.c +2 -2
@@ -316,14 +316,14 @@ test_toeplitz_hash_gfni_bulk(void) tuple[0 ].v4.dst_addr =rte_cpu_to_be_32 (v4_tbl[i].dst_ip); tuple[0 ].v4.sport =rte_cpu_to_be_16 (v4_tbl[i].dst_port); tuple[0 ].v4.dport =rte_cpu_to_be_16 (v4_tbl[i].src_port); -rte_memcpy (tuples[0 ], &tuple[0 ],RTE_THASH_V4_L4_LEN *4 ); +memcpy (tuples[0 ], &tuple[0 ],RTE_THASH_V4_L4_LEN *4 );/*Load IPv6 headers and copy it into the corresponding tuple*/ tuple[1 ].v6.src_addr = v6_tbl[i].src_ip; tuple[1 ].v6.dst_addr = v6_tbl[i].dst_ip; tuple[1 ].v6.sport =rte_cpu_to_be_16 (v6_tbl[i].dst_port); tuple[1 ].v6.dport =rte_cpu_to_be_16 (v6_tbl[i].src_port); -rte_memcpy (tuples[1 ], &tuple[1 ],RTE_THASH_V6_L4_LEN *4 ); +memcpy (tuples[1 ], &tuple[1 ],RTE_THASH_V6_L4_LEN *4 );rte_thash_gfni_bulk (rss_key_matrixes,RTE_THASH_V6_L4_LEN *4 , tuples, rss,2 );
app/test/virtual_pmd.c +3 -2
@@ -2,13 +2,14 @@* Copyright(c) 2010-2014 Intel Corporation */ +#include <string.h> +#include <rte_mbuf.h> #include <rte_ethdev.h> #include <ethdev_driver.h> #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>
@@ -187,7 +188,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 ; }
Signature · 1 line
2.53.0
PATCH v2 11/68 app/graph: replace rte_memcpy with memcpy
In reply to Stephen HemmingerUse libc version of memcpy for fixed sizes.
--- app/graph/neigh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
app/graph/neigh.c +4 -4
@@ -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 (data, &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 (data, &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); }
Signature · 1 line
2.53.0
PATCH v2 12/68 lpm: remove unnecessary include of rte_memcpy.h
In reply to Stephen HemmingerNo longer used.
--- lib/lpm/rte_lpm6.c | 1 - 1 file changed, 1 deletion(-)
lib/lpm/rte_lpm6.c +0 -1
@@ -12,7 +12,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>
Signature · 1 line
2.53.0
PATCH v2 13/68 acl: remove unnecessary include of rte_memcpy.h
In reply to Stephen Hemmingerrte_memcpy is no longer used here.
--- lib/acl/rte_acl_osdep.h | 1 - 1 file changed, 1 deletion(-)
lib/acl/rte_acl_osdep.h +0 -1
@@ -33,7 +33,6 @@#include <rte_vect.h> #include <rte_memory.h> #include <rte_log.h> -#include <rte_memcpy.h> #include <rte_prefetch.h> #include <rte_byteorder.h> #include <rte_branch_prediction.h>
Signature · 1 line
2.53.0
PATCH v2 14/68 drivers/bus: remove unnecessary include of rte_memcpy.h
In reply to Stephen HemmingerThe file is included but rte_memcpy() no longer used here.
--- 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_dpcon.c | 1 - drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 1 - drivers/bus/pci/linux/pci.c | 1 - 8 files changed, 8 deletions(-)
drivers/bus/auxiliary/linux/auxiliary.c +0 -1
@@ -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"
drivers/bus/fslmc/fslmc_bus.c +0 -1
@@ -14,7 +14,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> #include <rte_vfio.h>
drivers/bus/fslmc/fslmc_vfio.c +0 -1
@@ -28,7 +28,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>
drivers/bus/fslmc/portal/dpaa2_hw_dpbp.c +0 -1
@@ -15,7 +15,6 @@#include <eal_export.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h>
drivers/bus/fslmc/portal/dpaa2_hw_dpci.c +0 -1
@@ -14,7 +14,6 @@#include <eal_export.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_string_fns.h> #include <rte_cycles.h> #include <rte_kvargs.h>
drivers/bus/fslmc/portal/dpaa2_hw_dpcon.c +0 -1
@@ -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>
drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +0 -1
@@ -29,7 +29,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>
drivers/bus/pci/linux/pci.c +0 -1
@@ -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_export.h>
Signature · 1 line
2.53.0
PATCH v2 15/68 security: replace fixed size rte_memcpy
In reply to Stephen HemmingerUse memcpy for better compiler checks.
--- lib/security/rte_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/security/rte_security.c +2 -2
@@ -406,7 +406,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]); }
@@ -431,7 +431,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]); }
Signature · 1 line
2.53.0
PATCH v2 16/68 ethdev: replace use of rte_memcpy
In reply to Stephen HemmingerThe management of flows is better done using memcpy() or structure assignment where compiler can do more bounds checks.
--- lib/ethdev/rte_ethdev.c | 3 +- lib/ethdev/rte_flow.c | 104 ++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 60 deletions(-)
lib/ethdev/rte_ethdev.c +1 -2
@@ -16,7 +16,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>
@@ -637,7 +636,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 ;
lib/ethdev/rte_flow.c +46 -58
173 lines not on this page · raw message
Signature · 1 line
2.53.0
Re: [PATCH v2 16/68] ethdev: replace use of rte_memcpy
Quoted 9 lines · Stephen Hemminger
The management of flows is better done using
memcpy()or structure assignment where compiler can do more bounds checks.Signed-off-by Stephen Hemminger <[email protected]>--- lib/ethdev/rte_ethdev.c | 3 +- lib/ethdev/rte_flow.c | 104 ++++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 60 deletions(-)
...
lib/ethdev/rte_flow.c rte_flow_conv(enum rte_flow_conv_op op, · line 1131
Quoted 9 lines
lib/ethdev/rte_flow.c +1
-3if (src->pattern_ro) {@@ -1138,9 +1128,7 @@ rte_flow_conv(enum rte_flow_conv_op op,break ;case RTE_FLOW_CONV_OP_ATTR : attr = src; -if (size >sizeof (*attr)) - size =sizeof (*attr); -rte_memcpy (dst, attr, size); +memcpy (dst, attr,RTE_MIN (size,sizeof (*attr)));
The size will be used later: rte_flow_trace_conv(op, dst, size, src, ret); In the new impl, the size was not updated, I think it should use the original size other than modified in the trace.
Quoted 3 lines
lib/ethdev/rte_flow.c +0
-0ret =sizeof (*attr);break ;case RTE_FLOW_CONV_OP_ITEM :
...
Quoted 1 line
PATCH v2 17/68 net: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- lib/net/rte_ether.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/net/rte_ether.c +1 -1
@@ -15,7 +15,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 */ }
Signature · 1 line
2.53.0
PATCH v2 18/68 pdcp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't use rte_memcpy because compiler has more bounds checking with regular memcpy.
Also, use include-what-you-use to fill in some of the include files that were inherited.
--- lib/pdcp/pdcp_process.c | 51 +++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 22 deletions(-)
lib/pdcp/pdcp_process.c +29 -22
@@ -2,13 +2,20 @@* Copyright(C) 2023 Marvell. */ +#include <errno.h> +#include <stdbool.h> +#include <string.h> + +#include <rte_common.h> #include <rte_crypto.h> #include <rte_crypto_sym.h> #include <rte_cryptodev.h> -#include <rte_memcpy.h> +#include <rte_mempool.h> +#include <rte_mbuf.h> #include <rte_mbuf_dyn.h> #include <rte_pdcp.h> #include <rte_pdcp_hdr.h> +#include <rte_security.h> #include "pdcp_cnt.h" #include "pdcp_crypto.h"
@@ -60,7 +67,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 +79,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 +96,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 +108,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 +122,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 +147,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 +169,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 +186,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
@@ -614,7 +621,7 @@ pdcp_post_process_ul(const struct rte_pdcp_entity *entity, }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
@@ -968,7 +975,7 @@ pdcp_post_process_uplane_dl_flags(const struct rte_pdcp_entity *entity, struct r }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
@@ -1024,7 +1031,7 @@ pdcp_post_process_cplane_sn_12_dl(const struct rte_pdcp_entity *entity, }if (unlikely (nb_err !=0 )) -rte_memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); +memcpy (&out_mb[nb_success], err_mb, nb_err *sizeof (struct rte_mbuf *)); *nb_err_ret = nb_err;return nb_success;
Signature · 1 line
2.53.0
PATCH v2 19/68 eventdev: replace fixed size rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy gets more checking from compiler.
--- lib/eventdev/rte_event_crypto_adapter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/eventdev/rte_event_crypto_adapter.c +1 -1
@@ -700,7 +700,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];/** Restore "struct rte_event::impl_opaque" from mbuf
Signature · 1 line
2.53.0
PATCH v2 20/68 eal: replace rte_memcpy of cpuset
In reply to Stephen HemmingerSimple structure assignment is better than rte_memcpy.
--- lib/eal/common/eal_common_options.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
lib/eal/common/eal_common_options.c +2 -4
@@ -29,7 +29,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
@@ -1446,7 +1445,7 @@ eal_parse_lcores(const char *lcores)/* without '@', by default using lcore_set as cpuset */ if (*lcores !='@' ) -rte_memcpy (&cpuset, &lcore_set,sizeof (cpuset)); + cpuset = lcore_set; set_count =CPU_COUNT (&lcore_set);/* start to update lcore_set */
@@ -1469,8 +1468,7 @@ eal_parse_lcores(const char *lcores)if (check_cpuset (&cpuset) <0 ) goto err; -rte_memcpy (&lcore_config[idx].cpuset, &cpuset, -sizeof (rte_cpuset_t)); + lcore_config[idx].cpuset = cpuset; }/* some cores from the lcore_set can't be handled by EAL */
Signature · 1 line
2.53.0
Re: [PATCH v2 20/68] eal: replace rte_memcpy of cpuset
Quoted 3 lines · Stephen Hemminger
Simple structure assignment is better than
rte_memcpy.Signed-off-by Stephen Hemminger <[email protected]>
PATCH v2 21/68 cryptodev: replace use of rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy is as fast and safer.
--- drivers/crypto/ccp/ccp_crypto.c | 14 +++++--------- drivers/crypto/cnxk/cnxk_se.h | 2 +- drivers/crypto/ipsec_mb/pmd_snow3g.c | 4 ++-- drivers/crypto/mlx5/mlx5_crypto_gcm.c | 10 +++++----- drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 6 +++--- drivers/crypto/scheduler/scheduler_failover.c | 12 ++++++------ drivers/crypto/zsda/zsda_crypto_session.c | 6 +++--- lib/cryptodev/rte_cryptodev.c | 12 ++++-------- 8 files changed, 29 insertions(+), 37 deletions(-)
drivers/crypto/ccp/ccp_crypto.c +5 -9
@@ -169,7 +169,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 ; }
@@ -180,8 +180,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 ; }
@@ -192,8 +191,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 ; }
@@ -204,8 +202,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 ; }
@@ -216,8 +213,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 ; }
drivers/crypto/cnxk/cnxk_se.h +1 -1
@@ -1253,7 +1253,7 @@ cpt_sm_prep(uint32_t flags, uint64_t d_offs, uint64_t d_lens, struct roc_se_fc_pvoid *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 {
drivers/crypto/ipsec_mb/pmd_snow3g.c +2 -2
@@ -293,8 +293,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++; }
drivers/crypto/mlx5/mlx5_crypto_gcm.c +5 -5
@@ -1062,9 +1062,9 @@ mlx5_crypto_gcm_ipsec_enqueue_burst(void *queue_pair,* shrink AAD before payload. First backup the mem, * then do shrink. */ -rte_memcpy (&qp->ipsec_mem[idx], -RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), -MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); +memcpy (&qp->ipsec_mem[idx], +RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), +MLX5_CRYPTO_GCM_IPSEC_IV_SIZE );/* If no memory overlap, do copy directly, otherwise memmove. */ if (likely (pkt_iv_len >= sess->aad_len))rte_memcpy (gcm_data.src_addr, op->sym->aead.aad.data, sess->aad_len);
@@ -1108,8 +1108,8 @@ mlx5_crypto_gcm_restore_ipsec_mem(struct mlx5_crypto_qp *qp,if (unlikely (sess->aad_len >MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ))memmove (op->sym->aead.aad.data,RTE_PTR_SUB (payload, sess->aad_len), sess->aad_len); -rte_memcpy (RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), - &qp->ipsec_mem[idx],MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); +memcpy (RTE_PTR_SUB (payload,MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ), + &qp->ipsec_mem[idx],MLX5_CRYPTO_GCM_IPSEC_IV_SIZE ); m_dst = op->sym->m_dst;if (m_dst && m_dst != m_src) {uint32_t bytes_to_copy;
drivers/crypto/scheduler/rte_cryptodev_scheduler.c +3 -3
@@ -81,7 +81,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--;
@@ -218,8 +218,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],
drivers/crypto/scheduler/scheduler_failover.c +6 -6
@@ -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 ;
drivers/crypto/zsda/zsda_crypto_session.c +3 -3
@@ -178,7 +178,7 @@ u32_to_u8(uint32_t *u_int32_t_data, uint8_t *u8_data) {uint32_t be_data =rte_cpu_to_be_32 (*u_int32_t_data); -rte_memcpy (u8_data, &be_data,sizeof (be_data)); +memcpy (u8_data, &be_data,sizeof (be_data)); } static void
@@ -283,8 +283,8 @@ zsda_decry_key_set(uint8_t key[64], const uint8_t *key1_ptr, uint8_t skey_len, : ZSDA_AES512_ROUND_NUM;zsda_aes_key_expansion (aes_round_key, round_num, key1_ptr, skey_len); -rte_memcpy (dec_key1, - ((uint8_t *)aes_round_key + (16 * round_num)),16 ); +memcpy (dec_key1, + ((uint8_t *)aes_round_key + (16 * round_num)),16 );if (skey_len ==ZSDA_SYM_XTS_512_SKEY_LEN && (16 * round_num) <=ZSDA_AES_MAX_EXP_BYTE_SIZE ) {
lib/cryptodev/rte_cryptodev.c +4 -8
@@ -16,7 +16,6 @@#include <rte_debug.h> #include <dev_driver.h> #include <rte_memory.h> -#include <rte_memcpy.h> #include <rte_memzone.h> #include <rte_eal.h> #include <rte_common.h>
@@ -2566,8 +2565,7 @@ rte_cryptodev_sym_session_set_user_data(void *_sess, void *data,if (sess->user_data_sz < size)return -ENOMEM ; -rte_memcpy (sess->driver_priv_data + sess->sess_data_sz, data, size); - +memcpy (sess->driver_priv_data + sess->sess_data_sz, data, size);rte_cryptodev_trace_sym_session_set_user_data (sess, data, size);return 0 ;
@@ -2601,9 +2599,7 @@ rte_cryptodev_asym_session_set_user_data(void *session, void *data, uint16_t sizif (sess->user_data_sz < size)return -ENOMEM ; -rte_memcpy (sess->sess_private_data + - sess->max_priv_data_sz, - data, size); +memcpy (sess->sess_private_data + sess->max_priv_data_sz, data, size);rte_cryptodev_trace_asym_session_set_user_data (sess, data, size);
@@ -2750,7 +2746,7 @@ rte_cryptodev_session_event_mdata_set(uint8_t dev_id, void *sess,if (s->event_mdata ==NULL )return -ENOMEM ; } -rte_memcpy (s->event_mdata, ev_mdata, size); +memcpy (s->event_mdata, ev_mdata, size);return 0 ; }else
@@ -3098,7 +3094,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]); }
Signature · 1 line
2.53.0
PATCH v2 22/68 drivers/raw: use memcpy for fixed size data
In reply to Stephen HemmingerThe regular libc memcpy is inline for fix sizes and has better analysis coverage.
--- drivers/raw/ifpga/afu_pmd_he_hssi.c | 4 ++-- drivers/raw/ifpga/afu_pmd_he_lpbk.c | 4 ++-- drivers/raw/ifpga/afu_pmd_he_mem.c | 4 ++-- 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, 18 insertions(+), 22 deletions(-)
drivers/raw/ifpga/afu_pmd_he_hssi.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <inttypes.h> #include <unistd.h> #include <fcntl.h>
@@ -15,7 +16,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -313,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 ; }
drivers/raw/ifpga/afu_pmd_he_lpbk.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <inttypes.h> #include <unistd.h> #include <fcntl.h>
@@ -15,7 +16,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -362,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 ; }
drivers/raw/ifpga/afu_pmd_he_mem.c +2 -2
@@ -6,6 +6,7 @@#include <stdio.h> #include <stdint.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include <fcntl.h> #include <poll.h>
@@ -14,7 +15,6 @@#include <rte_eal.h> #include <rte_malloc.h> -#include <rte_memcpy.h> #include <rte_io.h> #include <bus_pci_driver.h> #include <bus_ifpga_driver.h>
@@ -125,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 ; }
drivers/raw/ifpga/afu_pmd_n3000.c +4 -4
@@ -1864,8 +1864,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 ;
@@ -1884,8 +1884,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 ;
drivers/raw/ifpga/ifpga_rawdev.c +5 -6
@@ -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", __func__,
drivers/raw/skeleton/skeleton_rawdev.c +3 -5
@@ -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" );
drivers/raw/skeleton/skeleton_rawdev_test.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH v2 23/68 test-pipeline: replace use of rte_memcpy
In reply to Stephen HemmingerUsing regular memcpy is safer and as fast here.
--- app/test-eventdev/test_pipeline_common.c | 8 ++++---- app/test-pipeline/config.c | 1 - app/test-pipeline/init.c | 1 - app/test-pipeline/main.c | 1 - app/test-pipeline/runtime.c | 1 - 5 files changed, 4 insertions(+), 8 deletions(-)
app/test-eventdev/test_pipeline_common.c +4 -4
@@ -153,22 +153,22 @@ 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), + memcpy(rte_pktmbuf_mtod_offset(mbuf, char *, 0), ð_hdr, sizeof(struct rte_ether_hdr));/* Copy Ipv4 header */ - rte_memcpy(rte_pktmbuf_mtod_offset( + memcpy(rte_pktmbuf_mtod_offset( mbuf, char *, sizeof(struct rte_ether_hdr)), &ip_hdr, sizeof(struct rte_ipv4_hdr));/* Copy UDP header */ -rte_memcpy ( +memcpy (rte_pktmbuf_mtod_offset (mbuf ,char *, sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_ether_hdr)), - &udp_hdr, sizeof(struct rte_udp_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) +
app/test-pipeline/config.c +0 -1
@@ -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>
app/test-pipeline/init.c +0 -1
@@ -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>
app/test-pipeline/main.c +0 -1
@@ -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>
app/test-pipeline/runtime.c +0 -1
@@ -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>
Signature · 1 line
2.53.0
PATCH v2 24/68 net/af_xdp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/af_xdp/rte_eth_af_xdp.c +1 -1
@@ -2235,7 +2235,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 ;
Signature · 1 line
2.53.0
PATCH v2 25/68 net/avp: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/avp/avp_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/avp/avp_ethdev.c +2 -2
@@ -249,7 +249,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_LINE (DEBUG ,"Discarding stale response" ); -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_LINE(ERR, "Cannot send request %u to host",
@@ -286,7 +286,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_LINE(DEBUG, "Result %d received for request %u",
Signature · 1 line
2.53.0
PATCH v2 26/68 net/axgbe: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/axgbe/axgbe_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/axgbe/axgbe_ethdev.c +2 -2
@@ -599,7 +599,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);
@@ -642,7 +642,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 ;
Signature · 1 line
2.53.0
PATCH v2 27/68 net/bnx2x: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/bnx2x/bnx2x.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-)
drivers/net/bnx2x/bnx2x.c +15 -17
@@ -2238,18 +2238,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);
@@ -6671,8 +6671,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 */
@@ -6738,8 +6737,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);
@@ -6954,7 +6952,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)) {
Signature · 1 line
2.53.0
PATCH v2 28/68 net/bnxt: replace use of rte_memcpy
In reply to Stephen HemmingerDon't need rte_memcpy for fixed size value.
--- drivers/net/bnxt/bnxt_flow.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/net/bnxt/bnxt_flow.c +18 -16
@@ -233,8 +233,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "DMAC is invalid!");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!");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.a,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.a,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 =
Signature · 1 line
2.53.0
Re: [PATCH v2 28/68] net/bnxt: replace use of rte_memcpy
Quoted 104 lines · Stephen Hemminger
Don't need
rte_memcpyfor fixed size value.Signed-off-by Stephen Hemminger <[email protected]>--- drivers/net/bnxt/bnxt_flow.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-)drivers/net/bnxt/bnxt_flow.c +3
-2@@ -233,8 +233,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "DMAC is invalid!");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;drivers/net/bnxt/bnxt_flow.c +3
-2@@ -257,8 +258,9 @@ bnxt_validate_and_parse_flow_type(const struct rte_flow_attr *attr, "SMAC is invalid!");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;drivers/net/bnxt/bnxt_flow.c +6
-6@@ -423,23 +425,23 @@ bnxt_validate_and_parse_flow_type(const structrte_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.a,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.a,16)) {drivers/net/bnxt/bnxt_flow.c +4
-4-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 =drivers/net/bnxt/bnxt_flow.c +2
-2@@ -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 =
Quoted 1 line
--
Quoted 4 lines
2.53.0