Skip to contentSkip to conversation

reduce use of rte_memcpy

PATCH Superseded Stephen Hemminger 10 participants 169 messages Aug 20 – Sep 11 Page 2 of 2

Subsystems (8)
lore
Share & tools
lore
#113 lore raw

PATCH v2 29/68 net/bonding: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index d1f30229d0..6d970153cf 100644
@@ -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
index 5d0be5caf5..bb9d347e2b 100644
@@ -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
#114 lore raw

PATCH v2 30/68 net/cnxk: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 655813c71a..556503ade1 100644
@@ -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, &eth_da[i], sizeof(struct rte_eth_devargs));
+		memcpy(&eswitch_dev->esw_da[j].da, &eth_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
index b1ccc6598c..69c4375db1 100644
@@ -463,7 +463,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
index e536898d3a..1e72d5dbaa 100644
@@ -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
index 68ee334e01..23d9376c24 100644
@@ -82,7 +82,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 */
@@ -232,7 +233,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
index 48179dab36..837471c0dc 100644
@@ -59,7 +59,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);
 			}
 		}
@@ -91,7 +91,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);
@@ -199,7 +199,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;
@@ -219,7 +219,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
index 6dab022732..2409e8790f 100644
@@ -693,7 +693,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
index 0ed6732dda..48354d902b 100644
@@ -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
#115 lore raw

PATCH v2 31/68 net/cxgbe: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 8588b88158..ba7c9f19e4 100644
@@ -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
index 5a7efe7a73..3d1d087ec2 100644
@@ -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
index ecb5fec911..19a190314f 100644
@@ -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
index 2f961c1ead..8f26dc572a 100644
@@ -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
#116 lore raw

PATCH v2 32/68 net/dpaa2: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 26ad105c73..33b20c35f7 100644
@@ -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
index f211357919..d6786b5cb0 100644
@@ -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
index 7b7bf4161c..19b9388d41 100644
@@ -151,12 +151,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;
 			}
@@ -179,11 +179,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));
@@ -206,12 +206,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));
@@ -234,11 +234,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
index f78d12362e..8dd10738ab 100644
@@ -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
index c31d6556ad..baaaacc2e0 100644
@@ -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
index 6c3e6eb573..60dadb4776 100644
@@ -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
index 36e815c356..497cd2dc84 100644
@@ -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
#117 lore raw

PATCH v2 33/68 net/enic: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 2696fa77d4..59a557a38e 100644
@@ -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
#118 lore raw

PATCH v2 34/68 net/failsafe: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index ddc8808ebe..f393476571 100644
@@ -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
#119 lore raw

PATCH v2 35/68 net/gve: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 89bf669c24..b7621a1fd1 100644
@@ -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
#120 lore raw

PATCH v2 36/68 net/hinic: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 91a4348fb6..9db2979365 100644
@@ -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
#121 lore raw

PATCH v2 37/68 net/hns3: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 50572ae430..86dba4eb2e 100644
@@ -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
index f2d1e4ec3a..f7e4d339d3 100644
@@ -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
Reviewed-by on v2 37/68
#122 lore raw

Re: [PATCH v2 37/68] net/hns3: replace use of rte_memcpy

Quoted 36 lines · Stephen Hemminger

Don'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
index 50572ae430..86dba4eb2e 100644
@@ -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
index f2d1e4ec3a..f7e4d339d3 100644
@@ -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,
#123 lore raw

PATCH v2 38/68 net/mlx5: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 4b30a4fade..ace23b6906 100644
@@ -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
index ccc3cb97aa..66e8b05b39 100644
@@ -4633,8 +4633,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++;
 	}
@@ -5488,30 +5488,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;
@@ -5523,8 +5523,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;
@@ -5535,14 +5535,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;
 		}
@@ -5552,7 +5552,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) {
@@ -5562,7 +5562,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
index cd84ab1966..fff6bfcd24 100644
@@ -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
index 626e10ca74..eb8c623a1c 100644
@@ -2510,7 +2510,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;
@@ -3232,7 +3232,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,
@@ -3297,8 +3297,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));
 	}
 }
 
@@ -3600,9 +3600,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 ||
@@ -5538,7 +5538,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;
 }
@@ -7952,8 +7952,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;
@@ -7990,7 +7991,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);
 }
 
@@ -10218,8 +10219,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);
@@ -10586,8 +10587,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);
 }
 
@@ -14138,7 +14139,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
index c0ad8d6701..a874998a31 100644
@@ -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
index 79e92811d5..1032c9bc02 100644
@@ -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
#125 lore raw

PATCH v2 39/68 net/mvpp2: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index c5046490ae..3fb343506c 100644
@@ -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
#126 lore raw

PATCH v2 40/68 net/netvsc: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 9a193e4a7a..c1bd55e6b5 100644
@@ -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
Reviewed-by on v2 40/68
#127 lore raw

RE: [EXTERNAL] [PATCH v2 40/68] net/netvsc: replace use of rte_memcpy

Quoted 3 lines

Don't need rte_memcpy for fixed size value.

Quoted 18 lines
---
 drivers/net/netvsc/hn_ethdev.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/netvsc/hn_ethdev.c +0 -2
index 9a193e4a7a..c1bd55e6b5 100644
@@ -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>
--

2.53.0

#128 lore raw

PATCH v2 41/68 net/nfp: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 0852d28fa7..dfc2bd25bf 100644
@@ -1476,7 +1476,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
index ad0fe9a8ef..426fdfe71c 100644
@@ -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
index 4833ebd881..8d121f1b7c 100644
@@ -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
#129 lore raw

PATCH v2 42/68 net/ngbe: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index db2384e28c..5f33aaff5f 100644
@@ -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
#130 lore raw

PATCH v2 43/68 net/ntnic: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index d536a41c4e..cf5e6b2e3f 100644
@@ -1769,7 +1769,7 @@ static int eth_dev_rss_hash_update(struct rte_eth_dev *eth_dev, struct rte_eth_r
 			return -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;
@@ -1779,7 +1779,8 @@ static int eth_dev_rss_hash_update(struct rte_eth_dev *eth_dev, struct rte_eth_r
 
 	if (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);
@@ -1804,7 +1805,7 @@ static int rss_hash_conf_get(struct rte_eth_dev *eth_dev, struct rte_eth_rss_con
 	if (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;
 	}
 
@@ -2556,8 +2557,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(&eth_dev->data->mac_addrs[0],
-					&internals->eth_addrs[0], RTE_ETHER_ADDR_LEN);
+		memcpy(&eth_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
#131 lore raw

PATCH v2 44/68 net/null: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index 7fba3a661b..3e21649f6e 100644
@@ -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
#132 lore raw

PATCH v2 45/68 net/qede: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index fd63262f3a..32fa2016d2 100644
@@ -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
#133 lore raw

PATCH v2 46/68 net/ring: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index b639544eab..60d41d8c06 100644
@@ -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
#134 lore raw

PATCH v2 47/68 net/sfc: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 39cd8d519a..6a136926f6 100644
@@ -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
index 5543dc495f..dd4745a90a 100644
@@ -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
index 0a8551fac7..4652a668ff 100644
@@ -1439,8 +1439,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;
 	}
 
@@ -1824,7 +1823,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;
 }
@@ -1893,7 +1892,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;
@@ -1992,7 +1991,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;
@@ -2016,7 +2015,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
index 1006243539..66158bdff7 100644
@@ -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
index 8e2749833b..7656ffb9f8 100644
@@ -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
index cbc7c9ecb0..88b45a16c3 100644
@@ -547,7 +547,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
index d8b961ff7e..1b1176925b 100644
@@ -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
index 76094669e9..b9b147c854 100644
@@ -160,7 +160,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
index 9029ad1590..e914eae77e 100644
@@ -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
#135 lore raw

PATCH v2 48/68 net/txgbe: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 4d2746371b..69be47e8f4 100644
@@ -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
index 67f586ffc7..2a9f56b49a 100644
@@ -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
index 65b6c251c6..e704732541 100644
@@ -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
index 91f73521fe..9dd6aabce1 100644
@@ -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
index 29c7c4adfb..b69883ffa9 100644
@@ -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
#136 lore raw

PATCH v2 49/68 net/vhost: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 05940f2461..97d60ecf5d 100644
@@ -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
#137 lore raw

Re: [PATCH v2 49/68] net/vhost: replace use of rte_memcpy

Quoted 7 lines · Stephen Hemminger

Don't need rte_memcpy for fixed size value.

---
 drivers/net/vhost/rte_eth_vhost.c | 1 -
 1 file changed, 1 deletion(-)

Change is correct, but patch needs different title and commit log, since you are removing an unnecessary header here, not removing rte_memcpy use itself.

Quoted 15 lines
drivers/net/vhost/rte_eth_vhost.c +0 -1
index 05940f2461..97d60ecf5d 100644
@@ -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
#138 lore raw

PATCH v2 50/68 net/virtio: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index 9fd746b80f..62a9d7fff9 100644
@@ -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
#139 lore raw

Re: [PATCH v2 50/68] net/virtio: replace use of rte_memcpy

Quoted 7 lines · Stephen Hemminger

Don't need rte_memcpy for fixed size value.

---
 drivers/net/virtio/virtio_ethdev.c | 1 -
 1 file changed, 1 deletion(-)

Change is correct, but patch needs different title and commit log, since you are removing an unnecessary header here, not removing rte_memcpy use itself.

Quoted 15 lines
drivers/net/virtio/virtio_ethdev.c +0 -1
index 9fd746b80f..62a9d7fff9 100644
@@ -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
#140 lore raw

PATCH v2 51/68 net/sxe2: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index b09989fe50..077e4f8c01 100644
@@ -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, &param, 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, &param, 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
index 63cfc36968..84669478d1 100644
@@ -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
index f5bf8922c6..d5a14398a7 100644
@@ -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
index e783a51b85..81cf250fd2 100644
@@ -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
index 1d56613043..6451096561 100644
@@ -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
index d700c60083..c84e767b25 100644
@@ -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
index 3ad8fe2fe9..6dc52ac4ab 100644
@@ -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
index 4c4f793cd5..893e1afa6d 100644
@@ -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
#141 lore raw

PATCH v2 52/68 net/zxdh: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index 2b821b1dc8..1dff77aee8 100644
@@ -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, uint16
 		return 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
index 4b01daf37a..64aa0ac5f9 100644
@@ -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
index b23f6535a8..48318a6941 100644
@@ -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
index b078ec5b6c..41542a89d8 100644
@@ -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
index 7162593b16..c47bc44710 100644
@@ -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
index 233d53a7e8..5ee1a7dea8 100644
@@ -248,7 +248,8 @@ zxdh_add_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *ad
 	int32_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 *ad
 	int32_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 *ad
 
 		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
@@ -441,8 +444,8 @@ zxdh_del_mac_table(struct zxdh_hw *hw, uint16_t vport, struct rte_ether_addr *ad
 		if (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
#142 lore raw

PATCH v2 53/68 net/memif: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index 649f8d0e61..f5a3354c46 100644
@@ -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
Acked-by on v2 53/68
#143 lore raw

Re: [PATCH v2 53/68] net/memif: use memcpy for fixed size data

Quoted 8 lines · Stephen Hemminger

The 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(-)
Quoted 25 lines
drivers/net/memif/memif_socket.c +2 -2
index 649f8d0e61..f5a3354c46 100644
@@ -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
#144 lore raw

PATCH v2 54/68 net/ice: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index d7ddd32f90..6d6fa04e72 100644
@@ -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
Acked-by on v2 54/68
#145 lore raw

Re: [PATCH v2 54/68] net/ice: use memcpy for fixed size data

Quoted 5 lines · Stephen Hemminger

The regular libc memcpy is inline for fix sizes and has better analysis coverage.

---

Quoted 8 lines
 drivers/net/intel/ice/ice_fdir_filter.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/intel/ice/ice_fdir_filter.c +0 -0
index d7ddd32f90..6d6fa04e72 100644

drivers/net/intel/ice/ice_fdir_filter.c ice_fdir_parse_action(struct ice_adapter *ad, · line 2877

Quoted 7 lines
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));

Since you are editing this line already, can you remove the line break and indentation. This should all fit on a single line now.

Quoted 6 lines
drivers/net/intel/ice/ice_fdir_filter.c +0 -0
 			break;
 		}
 		default:
Signature · 1 line
2.53.0
#146 lore raw

PATCH v2 55/68 test-bbdev: remove unnecessary include rte_memcpy.h

In reply to Stephen Hemminger

rte_memcpy not used here.

---
 app/test-bbdev/test_bbdev.c | 1 -
 1 file changed, 1 deletion(-)
app/test-bbdev/test_bbdev.c +0 -1
index 2422312f6b..5028e844ea 100644
@@ -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
#148 lore raw

PATCH v2 56/68 drivers/mempool: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index 2f8555a026..d041e09942 100644
@@ -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
index ee001d8ce0..f20e8dbdee 100644
@@ -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
#149 lore raw

PATCH v2 57/68 ml/cnxk: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index 58eebbf076..03817384dd 100644
@@ -565,7 +565,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]);
@@ -584,7 +584,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;
@@ -597,7 +598,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
index ffe3356720..07b767eded 100644
@@ -669,7 +669,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 */
@@ -746,11 +747,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
index 319c53a05b..f0bc616148 100644
@@ -848,7 +848,7 @@ tvmrt_ml_model_info_set(struct cnxk_ml_dev *cnxk_mldev, struct cnxk_ml_model *mo
 	if (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
index 01493077bb..b00cec3bcc 100644
@@ -230,7 +230,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);
 
@@ -239,7 +239,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);
 
@@ -248,7 +248,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
#150 lore raw

PATCH v2 58/68 drivers/event: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index 8f3d0982e9..adef6b3f2d 100644
@@ -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
index 8cdb8a72dd..a523b93d24 100644
@@ -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
index 084875f1c8..7e781ed920 100644
@@ -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
index e5d93afca2..bea89cb12d 100644
@@ -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
index 95d9154b11..f6fecd9740 100644
@@ -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
index 9d4938efe6..8a9a14f628 100644
@@ -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
index b54ae126d2..c0a0c789de 100644
@@ -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
index b404b1db61..712e2bb973 100644
@@ -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
Acked-by on v2 58/68
#151 lore raw

Re: [PATCH v2 58/68] drivers/event: use memcpy for fixed size data

Quoted 4 lines · Stephen Hemminger

The regular libc memcpy is inline for fix sizes and has better analysis coverage.

Quoted 11 lines
---
 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(-)
#152 lore raw

PATCH v2 59/68 baseband/la12xx: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index 1116dacc4b..791ed5e5f6 100644
@@ -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
#153 lore raw

PATCH v2 60/68 baseband/acc: replace use of rte_memcpy

In reply to Stephen Hemminger

Using 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
index cbcacc7aa3..7261ac937d 100644
@@ -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
index 1f85e33462..cb3ef51fcb 100644
@@ -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
#154 lore raw

PATCH v2 61/68 drivers/*/qat: use memcpy for fixed size data

In reply to Stephen Hemminger

The 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
index fe28cb160d..6ea4548bba 100644
@@ -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
index 559948a46a..5bcbefe395 100644
@@ -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
index d89c20cad6..1197537545 100644
@@ -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
#155 lore raw

PATCH v2 62/68 hash: replace use of rte_memcpy

In reply to Stephen Hemminger

Don'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
index fcd41248b9..931bb55f0e 100644
@@ -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
#157 lore raw

PATCH v2 63/68 rib: remove rte_memcpy include

In reply to Stephen Hemminger

The 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
index e3fb464ae6..2e554579d1 100644
@@ -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
Acked-by on v2 63/68
#158 lore raw

Re: [PATCH v2 63/68] rib: remove rte_memcpy include

Quoted 7 lines · Stephen Hemminger

The rte_memcpy function is no longer used in this library.

---
 lib/rib/rte_rib6.h | 1 -
 1 file changed, 1 deletion(-)
Quoted 15 lines
lib/rib/rte_rib6.h +0 -1
index e3fb464ae6..2e554579d1 100644
@@ -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
#159 lore raw

PATCH v2 64/68 pcapng: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index b5d1026891..4c84e855cf 100644
@@ -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
#161 lore raw

PATCH v2 65/68 efd: replace use of rte_memcpy

In reply to Stephen Hemminger

Copying 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
index 4dfc0ec9a4..09b0b01d90 100644
@@ -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
#163 lore raw

PATCH v2 66/68 net/xsc: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index 478f489516..baec15d153 100644
@@ -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
#164 lore raw

PATCH v2 67/68 net/pcap: replace use of rte_memcpy

In reply to Stephen Hemminger

The 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
index 08d3ab9e91..a22e41200a 100644
@@ -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
Acked-by on v2 67/68
#165 lore raw

Re: [PATCH v2 67/68] net/pcap: replace use of rte_memcpy

Quoted 9 lines · Stephen Hemminger

The 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(-)
#166 lore raw

PATCH v2 68/68 power: replace use of rte_memcpy

In reply to Stephen Hemminger

All 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
index af85a8cdec..03769a0276 100644
@@ -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
index af9c1309f3..7efaf7b944 100644
@@ -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_t
 		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_uncore/amd_uncore.c +2 -3
index c3e95cdc08..f9dc0c814f 100644
@@ -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, uint
 		POWER_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
index aed44c1212..b4bfe1865f 100644
@@ -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
index dfbb5635a1..da0ea562c7 100644
@@ -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
index 6759ea1445..2cbcf864d5 100644
@@ -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, ui
 		POWER_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
#167 lore raw
In reply to Stephen Hemminger
Quoted 21 lines · Stephen Hemminger

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 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.

Quoted 10 lines

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.

I like this series, and the rework of the order in v2 is ok, but I actually think the patchset should be split - at least into 2, if not more.

The patches removing the unnecessary include of rte_memcpy from C files should be split out into a separate patchset. There are a number of these in the series, and many have an incorrect patch title and description, a couple of which I flagged (I was working backward through the patchset - don't ask why, cos I don't know!). That patchset is a trivial review and merge case, since if it builds it's fine.

That then cuts down the rest of the set by a bit, making it more trackable. If possible, I'd actually like to see another patchset separated out to cover the case where you replace all constant-sized rte_memcpy calls, which use sizeof, with regular memcpy. Having all patches doing the same thing again makes it trivial to review and ack.

That would then leave the rest of the changes which require more examination - where we are replacing a non-constant copy using rte_memcpy with a memcpy. That's where the focus needs to be for review.

Just my 2c. I think having a 68-patch set in one is too big.

/Bruce

#168 lore raw
Quoted 36 lines · Bruce Richardson
Quoted 21 lines · Stephen Hemminger

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 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.

Quoted 10 lines

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.

I like this series, and the rework of the order in v2 is ok, but I actually think the patchset should be split - at least into 2, if not more.

Quoted 8 lines

The patches removing the unnecessary include of rte_memcpy from C files should be split out into a separate patchset. There are a number of these in the series, and many have an incorrect patch title and description, a couple of which I flagged (I was working backward through the patchset - don't ask why, cos I don't know!). That patchset is a trivial review and merge case, since if it builds it's fine.

That then cuts down the rest of the set by a bit, making it more trackable.

s/trackable/tractable/

Quoted 5 lines

If possible, I'd actually like to see another patchset separated out to cover the case where you replace all constant-sized rte_memcpy calls, which use sizeof, with regular memcpy. Having all patches doing the same thing again makes it trivial to review and ack.

Further suggestion - can you just do up a 2 patch set with the cocci script as patch 1, and a single replacement patch from running it as patch 2 (or one patch per app/lib/drivers/...)?