[71/71] examples: replace use of fixed size rte_memcpy

Message ID 20240229225936.483472-72-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series replace use of fixed size rte_memcpy |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build fail github build: failed
ci/intel-Functional success Functional PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Stephen Hemminger Feb. 29, 2024, 10:58 p.m. UTC
Automatically generated by devtools/cocci/rte_memcpy.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 examples/bbdev_app/main.c      |  2 +-
 examples/l2fwd-cat/cat.c       |  3 +--
 examples/ptpclient/ptpclient.c | 11 +++++------
 examples/vhost/main.c          |  5 ++---
 examples/vmdq/main.c           |  5 ++---
 examples/vmdq_dcb/main.c       | 14 +++++---------
 6 files changed, 16 insertions(+), 24 deletions(-)
  

Patch

diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c
index 16599ae9cee3..52c8eabba778 100644
--- a/examples/bbdev_app/main.c
+++ b/examples/bbdev_app/main.c
@@ -359,7 +359,7 @@  add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst)
 	eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *);
 
 	/* copy header */
-	rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr));
+	memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr));
 }
 
 static inline void
diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c
index 00e4cde48b48..b03fef47fdb7 100644
--- a/examples/l2fwd-cat/cat.c
+++ b/examples/l2fwd-cat/cat.c
@@ -314,8 +314,7 @@  parse_l3ca(const char *l3ca)
 		if (cmask != 0 && is_contiguous(cmask) == 0)
 			goto err;
 
-		rte_memcpy(&m_config[idx].cpumask,
-			&cpuset, sizeof(rte_cpuset_t));
+		memcpy(&m_config[idx].cpumask, &cpuset, sizeof(rte_cpuset_t));
 
 		if (cmask != 0) {
 			m_config[idx].cdp = 1;
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index 2535d848a1e9..e918bc05db34 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -359,9 +359,9 @@  parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx)
 	ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id);
 
 	if (ptp_data->ptpset == 0) {
-		rte_memcpy(&ptp_data->master_clock_id,
-				&ptp_hdr->source_port_id.clock_id,
-				sizeof(struct clock_id));
+		memcpy(&ptp_data->master_clock_id,
+		       &ptp_hdr->source_port_id.clock_id,
+		       sizeof(struct clock_id));
 		ptp_data->ptpset = 1;
 	}
 
@@ -466,9 +466,8 @@  parse_fup(struct ptpv2_data_slave_ordinary *ptp_data)
 		client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4];
 		client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5];
 
-		rte_memcpy(&ptp_data->client_clock_id,
-			   client_clkid,
-			   sizeof(struct clock_id));
+		memcpy(&ptp_data->client_clock_id, client_clkid,
+		       sizeof(struct clock_id));
 
 		/* Enable flag for hardware timestamping. */
 		created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST;
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 3fc1b151d182..5691ec110ac8 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -405,9 +405,8 @@  get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_devices)
 		conf.pool_map[i].pools = (1UL << i);
 	}
 
-	(void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf,
-		   sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+	(void)(memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
+	(void)(memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
 	return 0;
 }
 
diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c
index 4a3ce6884c5c..3a9d1281d901 100644
--- a/examples/vmdq/main.c
+++ b/examples/vmdq/main.c
@@ -151,9 +151,8 @@  get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools)
 		conf.pool_map[i].pools = (1UL << (i % num_pools));
 	}
 
-	(void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf,
-		   sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
+	(void)(memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)));
+	(void)(memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &conf, sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)));
 	if (rss_enable) {
 		eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_RSS;
 		eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP |
diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c
index 4ccc2fe4b01c..4aab67b23d67 100644
--- a/examples/vmdq_dcb/main.c
+++ b/examples/vmdq_dcb/main.c
@@ -161,15 +161,11 @@  get_eth_conf(struct rte_eth_conf *eth_conf)
 		tx_conf.dcb_tc[i] = i % num_tcs;
 	}
 	dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs;
-	(void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf,
-			  sizeof(conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf,
-			  sizeof(dcb_conf)));
-	(void)(rte_memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf,
-			  sizeof(vmdq_conf)));
-	(void)(rte_memcpy(&eth_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf,
-			  sizeof(tx_conf)));
+	(void)(memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf)));
+	(void)(memcpy(&eth_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(conf)));
+	(void)(memcpy(&eth_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, sizeof(dcb_conf)));
+	(void)(memcpy(&eth_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, sizeof(vmdq_conf)));
+	(void)(memcpy(&eth_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, sizeof(tx_conf)));
 	if (rss_enable) {
 		eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_DCB_RSS;
 		eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP |