From patchwork Tue Apr 2 21:50:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 139064 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB2B743DC8; Tue, 2 Apr 2024 23:59:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C8F8C41149; Tue, 2 Apr 2024 23:56:27 +0200 (CEST) Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mails.dpdk.org (Postfix) with ESMTP id 9E70940E09 for ; Tue, 2 Apr 2024 23:56:09 +0200 (CEST) Received: by mail-pl1-f177.google.com with SMTP id d9443c01a7336-1e0d82c529fso48267545ad.2 for ; Tue, 02 Apr 2024 14:56:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1712094969; x=1712699769; 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=1w6LbBQGCsp1ll+2V3zx6vaeSwmLH77X6FCV3bVE7O4=; b=hfoCvJoLEtGbuY+g7llKTmeekJhfrnPZh/ZOOjlcJHsMPluy3kcslGu0Xrso0hOkXc emDtFuEIOoFoKcoXp7SRrIeyJ/pTH8anlpz5IpkH8XMh3UTEhO0bEfKA3TWjiqk++bpS LpsbqbqFDLA+xwNHNk68IuIzuzPUs7T/SSUB9bv8VRtxuiuCeClnyvJhXE/NGoNYpCSy boo7eXc1petP3FS8ETXJ1gUIrdhRH6x34Wlneuww5NcLw20jQyGOnIv1Swqh1Khx52RQ pQvKNQ7RRdHQa6gHmjgfYl25nIUrCsPvk9tNDxwx+onclxk2mnxkOvZmEp7Do0rGKUa2 /prA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712094969; x=1712699769; 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=1w6LbBQGCsp1ll+2V3zx6vaeSwmLH77X6FCV3bVE7O4=; b=UTa0PsS7GE8BsTJgLlJ6SyessVZ5BIteWorpOYDDrVcmhPZxmi9a27jNmHnzEZwrYH JhEvZDk/QhVkSEdbmxNrtCHdNUlP1EpZwL4KkpsdLFBSyyhf5nsZE8O7umcbr2G5rSq4 2qPHyGPXoRNx38FXk5uVDYVgZcJFD7+BuygjXB335XvTEcEilXc8t/SHjluFhon64mv5 2CaCF3MiIEuSDpFLzFdMOMj+EOKr04OI1/9A9GOziS2Xxnq79Do+O5Y0YdIOHwwOb5pH 7QELjZ8+7rbowewsk3my9scQJlqZrKZ8EcEdlEwziyRnulV5LpUGilqJtH+mx4ij/rmE vyTw== X-Gm-Message-State: AOJu0YyhPaC7DrcIibuc+mD0CMR2Ks8HFcTVYzOMIeO84qzA5GZjI0Ox 7O7ntfiVrJttrLQWwYnve0rgF3EHpPZxcbtU3KV9oxio07uEEw4rEMHfJsgEMABHM8STpRV/yLO X6XE= X-Google-Smtp-Source: AGHT+IHGdGVTGGdsfaaGsvOzOZjHImMjeCB6KZhU/Xp7CIGangAkKurHWCihZKJrJgRYEVH87kepow== X-Received: by 2002:a17:902:cf08:b0:1e2:3d75:f738 with SMTP id i8-20020a170902cf0800b001e23d75f738mr13525970plg.17.1712094968845; Tue, 02 Apr 2024 14:56:08 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id x15-20020a170902820f00b001dddf29b6e8sm11609381pln.299.2024.04.02.14.56.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 14:56:08 -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 v3 30/30] examples: replace use of fixed size rte_memcpy Date: Tue, 2 Apr 2024 14:50:46 -0700 Message-ID: <20240402215502.278838-31-stephen@networkplumber.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240402215502.278838-1-stephen@networkplumber.org> References: <20240229225936.483472-1-stephen@networkplumber.org> <20240402215502.278838-1-stephen@networkplumber.org> MIME-Version: 1.0 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 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 | 6 ++---- examples/vmdq_dcb/main.c | 15 +++++---------- 24 files changed, 17 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..d928f4a45c 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,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(ð_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(ð_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 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 |