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 6A6E843E0C; Fri, 5 Apr 2024 19:00:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5765142686; Fri, 5 Apr 2024 18:56:20 +0200 (CEST) Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) by mails.dpdk.org (Postfix) with ESMTP id 40B064113D for ; Fri, 5 Apr 2024 18:56:13 +0200 (CEST) Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-6ed01c63657so666043b3a.2 for ; Fri, 05 Apr 2024 09:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712336172; x=1712940972; 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=S2HCHoHi91TGwKUEbtCqGzmh8YXFmkKZOAuLpIp8htQ=; b=kMhxZPu4SuBAjbgDc+VM+v6I7fp+EFhKz/jjhyfo2rEloiJ5VRytp04xF7JRPPeB8S vLIc+AfhuUVFiT/u1aK+sodJY5BCl4xI5bBJmtfxT40zdZ3rejEsFXz5IIxGgdqCjBON bVHtTAJ5iG8aHawQ+6cvWUNNkcbr8+t+l9gSWoFOa/8jhlcHLj87SazLI+ssDoVxShHL t6YgUJtQMpBeFGpsbRVeIb31D5fn9Y2fxvTZbtQwnb0QJMi/6DvNG/emVmkS7pI+Ch7q Xp4v3ruDsazvuNpH/rc5QJoLFrESflRzxM8S7BR/oMZFDekEDIgyEK9yl21k/0JWTfGz VVEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712336172; x=1712940972; 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=S2HCHoHi91TGwKUEbtCqGzmh8YXFmkKZOAuLpIp8htQ=; b=MvAwTCqCcWBptZNitB9fFBrWhzDt06wLEJlO29icXySuMbGsc7HS6Z+hSB/0YgwjEq J5MBN5pcBQiO0a/YcJSrDBRhlpVdAso+gk0koVDFgocVc6tOed70d/aktN/AyPCZI3e4 LWGqOYZeRRluy3F3NGlHiaPnOI7XpeTcfoQmxjQuaD21XMjJ3O+xJxmocKNJ8jyfZlDR lHoYgNDv728lv2NkJ3IvqTPLuKAk/ZbFkzs4StS4H5gz0gMyIdTRovUeOA5aBAvH88mp aeGpGm5y/19CJ1NyEUKBtBSOg5IsKVEDCUPJsT3cU2eJE14Z+DPeTeyN9VH9asdh1kK2 5t9w== X-Gm-Message-State: AOJu0Yzt4GvV9bxBgXanmtWh4ATU6ROuRPOC2DgG2Y6omBH2kIbySvpO /aoSAPySfN+ZIzaT0OjOqvY2wxQ32l4KRnAONwMvmkpCorQo6XixcJs4RcVnQ8oZ41GtvkfJcab NnaWUEw== X-Google-Smtp-Source: AGHT+IFeNH4uSSgzCg3CvJCrLeM7l08RvWVM4SF2BlTaYD5JqDRRN320a2z3UZ1SAf6TomaPuYznDA== X-Received: by 2002:a05:6a00:1250:b0:6ec:fdfe:9bea with SMTP id u16-20020a056a00125000b006ecfdfe9beamr1558420pfi.26.1712336172345; Fri, 05 Apr 2024 09:56:12 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id c2-20020aa781c2000000b006e6c0f8ce1bsm1728555pfn.47.2024.04.05.09.56.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 09:56:11 -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 v4 30/30] examples: replace use of fixed size rte_memcpy Date: Fri, 5 Apr 2024 09:53:41 -0700 Message-ID: <20240405165518.367503-31-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240405165518.367503-1-stephen@networkplumber.org> References: <20240403163432.437275-1-stephen@networkplumber.org> <20240405165518.367503-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 16599ae9ce..52c8eabba7 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/bond/main.c b/examples/bond/main.c index 8528abf675..a10fc8c92d 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 744a1aa9b4..d800d314a1 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 bd0b1d31de..b23c2b0942 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 6d0a8501ef..8f135a5a96 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 2653db4735..e3e02b751e 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 1463cef0fc..52bcc91790 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 a5d7a84828..529489e10d 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 96fb33196f..d928c957c3 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 f4adcf41b5..9db9de806e 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 8d32ae1dd5..d77aa8c62c 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 a8423d5d2a..d726d5c3b5 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 f54bb8b75a..df1bac37d0 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 1ff85875df..ebf546db84 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 059c470afb..3b8d9d50e8 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 fd72882e3a..0cd17a9ca3 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 3fc1b151d1..41df424565 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