From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0782144093; Wed, 22 May 2024 05:33:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 92250410F9; Wed, 22 May 2024 05:31:18 +0200 (CEST) Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) by mails.dpdk.org (Postfix) with ESMTP id C620A40E36 for ; Wed, 22 May 2024 05:30:51 +0200 (CEST) Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-6f447976de7so1927357b3a.1 for ; Tue, 21 May 2024 20:30:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1716348651; x=1716953451; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vLVeEFpdSR4pk5I1tjXnbHt8E6LU3qIUxX0LlZ2QdSY=; b=dxH5Hi6imE7UKM7Cd5sz/V+9kfutT03f4yUQvIPCLtzf8riBAfycI6Ig1SQGB56yqI YtPGey0M8+58/OptuOMPb7y+4l+pjXkGdWZ87PpD/BfvdQDjjFcVAOzyjzVZzoE4CCHc mdTzHDt4Nbf6F+bnd9aF8mtE/38NDL7ehgIf1EH4m24bo0bkLWAMYkMHc5z25NawMTYa mijMl6YKQP5VYfaOWGLYxELAFBAHsTgcMkg3iCSsJb3LQ2EwtHDvoohNqEBDUg3zpbto wE+5BKPQskUZnuIrIlfNplHTCqqcCRMRpsOQ0tOrW6Wdnq+Ce2fNXCdyUt0JjMF8cJTf 6jnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716348651; x=1716953451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vLVeEFpdSR4pk5I1tjXnbHt8E6LU3qIUxX0LlZ2QdSY=; b=leJgzkbdS7O3lfpjbilxBSak1pQB/3MREf68yXQT2fERrigbtgT5Qm5Q/WwXw7RsSy KimM1LcZL6TV6MATYMlZ59mw4XF+KD6ZJ6jdwCPawyBxQ9IuR5qY+JRDAuJBlC7mvQU6 GRC2MDVLaVZlQgJYnSbI8+yh6kLjaUVsxYqWOXZNyaEgJZ2aOuVOYaJSFLW7kogezz2i 6BJsnuBz0mLCrnQOESdC4exftMS5+de0Er7tygm/duwWp4CEbl85eUfOEgmuoV+B7h5+ ovHrAGD5b2b7LzXdFzjfAF2yUD6jOA4CRD2Tn/HhqZt0zcDnCqOXKphMxxGOrl1jj8D2 VacQ== X-Gm-Message-State: AOJu0YzhxRXlls3XQT7TU+FVVdGv7B5j3jXaS8pychJeK9KJ3+LmVqvB gDG3oOhkkSEieVbAJf/SHrfMSXJJ87IkpGV0iIOW2q1JGVFaquRROzDAJnZi7diaKKQwrYR8bS1 GzhA= X-Google-Smtp-Source: AGHT+IG9kX4wfn0IY9pBrDUdVnuoDpPA5fyty8NbhBZt4d46k5QxC8wO1IafWApL9285/qkfkYQd/g== X-Received: by 2002:a05:6a20:438f:b0:1af:f717:e017 with SMTP id adf61e73a8af0-1b1f87f977bmr933308637.27.1716348650945; Tue, 21 May 2024 20:30:50 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f323c70dafsm2264325ad.260.2024.05.21.20.30.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 20:30:50 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Nicolas Chautru , Chas Williams , "Min Hu (Connor)" , Konstantin Ananyev , Tomasz Kantecki , Akhil Goyal , Bruce Richardson , Anatoly Burakov , David Hunt , Sivaprasad Tummala , Kirill Rybalchenko , Cristian Dumitrescu , Byron Marohn , Yipeng Wang , Maxime Coquelin , Chenbo Xia Subject: [PATCH v5 28/32] examples: replace use of fixed size rte_memcpy Date: Tue, 21 May 2024 20:27:55 -0700 Message-ID: <20240522033009.143100-29-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240522033009.143100-1-stephen@networkplumber.org> References: <20240403163432.437275-1-stephen@networkplumber.org> <20240522033009.143100-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Automatically generated by devtools/cocci/rte_memcpy.cocci Use structure assignment where possible. Signed-off-by: Stephen Hemminger --- examples/bbdev_app/main.c | 2 +- examples/bond/main.c | 1 - examples/ip_fragmentation/main.c | 1 - examples/ip_reassembly/main.c | 1 - examples/ipv4_multicast/main.c | 1 - examples/l2fwd-cat/cat.c | 4 +--- examples/l2fwd-jobstats/main.c | 1 - examples/l2fwd-keepalive/main.c | 1 - examples/l2fwd-macsec/main.c | 1 - examples/l2fwd/main.c | 1 - examples/l3fwd-power/main.c | 1 - examples/l3fwd/main.c | 1 - examples/link_status_interrupt/main.c | 1 - .../client_server_mp/mp_server/init.c | 1 - .../client_server_mp/mp_server/main.c | 1 - examples/multi_process/symmetric_mp/main.c | 1 - examples/ptpclient/ptpclient.c | 11 +++++------ examples/qos_sched/app_thread.c | 1 - examples/qos_sched/main.c | 1 - examples/server_node_efd/efd_server/init.c | 1 - examples/server_node_efd/efd_server/main.c | 1 - examples/vhost/main.c | 6 +++--- examples/vmdq/main.c | 7 +++---- examples/vmdq_dcb/main.c | 15 +++++---------- 24 files changed, 18 insertions(+), 45 deletions(-) diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c index 46f20238db..772963fc9b 100644 --- a/examples/bbdev_app/main.c +++ b/examples/bbdev_app/main.c @@ -360,7 +360,7 @@ add_ether_hdr(struct rte_mbuf *pkt_src, struct rte_mbuf *pkt_dst) eth_to = rte_pktmbuf_mtod(pkt_dst, struct rte_ether_hdr *); /* copy header */ - rte_memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); + memcpy(eth_to, eth_from, sizeof(struct rte_ether_hdr)); } static inline void diff --git a/examples/bond/main.c b/examples/bond/main.c index 9f38b63cbb..4e8eeb7a5e 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 736eae6f05..e1f27498c0 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index c7019078f7..e770ade798 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 1eed645d02..bd4c3f335b 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l2fwd-cat/cat.c b/examples/l2fwd-cat/cat.c index 00e4cde48b..d1689fca29 100644 --- a/examples/l2fwd-cat/cat.c +++ b/examples/l2fwd-cat/cat.c @@ -12,7 +12,6 @@ #include #include -#include #include @@ -314,8 +313,7 @@ parse_l3ca(const char *l3ca) if (cmask != 0 && is_contiguous(cmask) == 0) goto err; - rte_memcpy(&m_config[idx].cpumask, - &cpuset, sizeof(rte_cpuset_t)); + memcpy(&m_config[idx].cpumask, &cpuset, sizeof(rte_cpuset_t)); if (cmask != 0) { m_config[idx].cdp = 1; diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index 308b8edd20..a7cd5b4840 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c index c3ead9e8b7..010d727086 100644 --- a/examples/l2fwd-keepalive/main.c +++ b/examples/l2fwd-keepalive/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l2fwd-macsec/main.c b/examples/l2fwd-macsec/main.c index 294ee113e3..2088115fb1 100644 --- a/examples/l2fwd-macsec/main.c +++ b/examples/l2fwd-macsec/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index c6fafdd019..59ea3172ae 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index fba11da7ca..fc0f6b21ec 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index ad28ba9d2e..d16d21f956 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index ac9c7f6217..aa33e71d7a 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -19,7 +19,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index 65713dbea8..f3b9b49380 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index ebfc2febc5..691d453d0e 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index f7d8439cd4..7314a9c6ea 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c index afb61bba51..7edf235bfb 100644 --- a/examples/ptpclient/ptpclient.c +++ b/examples/ptpclient/ptpclient.c @@ -362,9 +362,9 @@ parse_sync(struct ptpv2_data_slave_ordinary *ptp_data, uint16_t rx_tstamp_idx) ptp_data->seqID_SYNC = rte_be_to_cpu_16(ptp_hdr->seq_id); if (ptp_data->ptpset == 0) { - rte_memcpy(&ptp_data->master_clock_id, - &ptp_hdr->source_port_id.clock_id, - sizeof(struct clock_id)); + memcpy(&ptp_data->master_clock_id, + &ptp_hdr->source_port_id.clock_id, + sizeof(struct clock_id)); ptp_data->ptpset = 1; } @@ -469,9 +469,8 @@ parse_fup(struct ptpv2_data_slave_ordinary *ptp_data) client_clkid->id[6] = eth_hdr->src_addr.addr_bytes[4]; client_clkid->id[7] = eth_hdr->src_addr.addr_bytes[5]; - rte_memcpy(&ptp_data->client_clock_id, - client_clkid, - sizeof(struct clock_id)); + memcpy(&ptp_data->client_clock_id, client_clkid, + sizeof(struct clock_id)); /* Enable flag for hardware timestamping. */ created_pkt->ol_flags |= RTE_MBUF_F_TX_IEEE1588_TMST; diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c index e50cc33fde..e9db70bb3c 100644 --- a/examples/qos_sched/app_thread.c +++ b/examples/qos_sched/app_thread.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/qos_sched/main.c b/examples/qos_sched/main.c index b3c2c9ef23..e756ce0da2 100644 --- a/examples/qos_sched/main.c +++ b/examples/qos_sched/main.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/examples/server_node_efd/efd_server/init.c b/examples/server_node_efd/efd_server/init.c index 9c89f6b60d..9a20831a0d 100644 --- a/examples/server_node_efd/efd_server/init.c +++ b/examples/server_node_efd/efd_server/init.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/server_node_efd/efd_server/main.c b/examples/server_node_efd/efd_server/main.c index 75ff0ea532..8cb1b33111 100644 --- a/examples/server_node_efd/efd_server/main.c +++ b/examples/server_node_efd/efd_server/main.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include diff --git a/examples/vhost/main.c b/examples/vhost/main.c index 4391d88c3d..876b09f515 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -405,9 +405,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_devices) conf.pool_map[i].pools = (1UL << i); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf)); + memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, + sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf)); return 0; } diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c index 4a3ce6884c..12ef5bffc2 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -151,9 +150,9 @@ get_eth_conf(struct rte_eth_conf *eth_conf, uint32_t num_pools) conf.pool_map[i].pools = (1UL << (i % num_pools)); } - (void)(rte_memcpy(eth_conf, &vmdq_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &conf, - sizeof(eth_conf->rx_adv_conf.vmdq_rx_conf))); + *eth_conf = vmdq_conf_default; + eth_conf->rx_adv_conf.vmdq_rx_conf = conf; + if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | diff --git a/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 4ccc2fe4b0..f93eca5936 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -161,15 +160,11 @@ get_eth_conf(struct rte_eth_conf *eth_conf) tx_conf.dcb_tc[i] = i % num_tcs; } dcb_conf.nb_tcs = (enum rte_eth_nb_tcs)num_tcs; - (void)(rte_memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, - sizeof(conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, - sizeof(dcb_conf))); - (void)(rte_memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, - sizeof(vmdq_conf))); - (void)(rte_memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, - sizeof(tx_conf))); + (void)(memcpy(eth_conf, &vmdq_dcb_conf_default, sizeof(*eth_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_dcb_conf, &conf, sizeof(conf))); + (void)(memcpy(ð_conf->rx_adv_conf.dcb_rx_conf, &dcb_conf, sizeof(dcb_conf))); + (void)(memcpy(ð_conf->rx_adv_conf.vmdq_rx_conf, &vmdq_conf, sizeof(vmdq_conf))); + (void)(memcpy(ð_conf->tx_adv_conf.vmdq_dcb_tx_conf, &tx_conf, sizeof(tx_conf))); if (rss_enable) { eth_conf->rxmode.mq_mode = RTE_ETH_MQ_RX_VMDQ_DCB_RSS; eth_conf->rx_adv_conf.rss_conf.rss_hf = RTE_ETH_RSS_IP | -- 2.43.0