From: Sarosh Arif <sarosh.arif@emumba.com>
To: olivier.matz@6wind.com
Cc: dev@dpdk.org, Sarosh Arif <sarosh.arif@emumba.com>
Subject: [dpdk-dev] [PATCH] mbuf: replace c memcpy() code semantics with optimized rte_memcpy()
Date: Thu, 23 Jul 2020 12:02:40 +0500 [thread overview]
Message-ID: <20200723070240.14749-1-sarosh.arif@emumba.com> (raw)
Since rte_memcpy is more optimized it should be used instead of memcpy
Signed-off-by: Sarosh Arif <sarosh.arif@emumba.com>
---
lib/librte_mbuf/rte_mbuf.c | 2 +-
lib/librte_mbuf/rte_mbuf.h | 3 ++-
lib/librte_mbuf/rte_mbuf_dyn.c | 8 +++++---
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 8a456e5e6..71b5998ce 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -66,7 +66,7 @@ rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg)
~RTE_PKTMBUF_POOL_F_PINNED_EXT_BUF) == 0);
mbp_priv = rte_mempool_get_priv(mp);
- memcpy(mbp_priv, user_mbp_priv, sizeof(*mbp_priv));
+ rte_memcpy(mbp_priv, user_mbp_priv, sizeof(*mbp_priv));
}
/*
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 7259575a7..b7f6bfaa2 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -42,6 +42,7 @@
#include <rte_byteorder.h>
#include <rte_mbuf_ptype.h>
#include <rte_mbuf_core.h>
+#include <rte_memcpy.h>
#ifdef __cplusplus
extern "C" {
@@ -1109,7 +1110,7 @@ rte_pktmbuf_attach_extbuf(struct rte_mbuf *m, void *buf_addr,
static inline void
rte_mbuf_dynfield_copy(struct rte_mbuf *mdst, const struct rte_mbuf *msrc)
{
- memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
+ rte_memcpy(&mdst->dynfield1, msrc->dynfield1, sizeof(mdst->dynfield1));
}
/* internal */
diff --git a/lib/librte_mbuf/rte_mbuf_dyn.c b/lib/librte_mbuf/rte_mbuf_dyn.c
index 538a43f69..0631a35a9 100644
--- a/lib/librte_mbuf/rte_mbuf_dyn.c
+++ b/lib/librte_mbuf/rte_mbuf_dyn.c
@@ -15,6 +15,7 @@
#include <rte_string_fns.h>
#include <rte_mbuf.h>
#include <rte_mbuf_dyn.h>
+#include <rte_memcpy.h>
#define RTE_MBUF_DYN_MZNAME "rte_mbuf_dyn"
@@ -200,7 +201,7 @@ rte_mbuf_dynfield_lookup(const char *name, struct rte_mbuf_dynfield *params)
}
if (params != NULL)
- memcpy(params, &mbuf_dynfield->params, sizeof(*params));
+ rte_memcpy(params, &mbuf_dynfield->params, sizeof(*params));
return mbuf_dynfield->offset;
}
@@ -303,7 +304,8 @@ __rte_mbuf_dynfield_register_offset(const struct rte_mbuf_dynfield *params,
rte_free(te);
return -1;
}
- memcpy(&mbuf_dynfield->params, params, sizeof(mbuf_dynfield->params));
+ rte_memcpy(&mbuf_dynfield->params, params,
+ sizeof(mbuf_dynfield->params));
mbuf_dynfield->offset = offset;
te->data = mbuf_dynfield;
@@ -399,7 +401,7 @@ rte_mbuf_dynflag_lookup(const char *name,
}
if (params != NULL)
- memcpy(params, &mbuf_dynflag->params, sizeof(*params));
+ rte_memcpy(params, &mbuf_dynflag->params, sizeof(*params));
return mbuf_dynflag->bitnum;
}
--
2.17.1
next reply other threads:[~2020-07-23 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-23 7:02 Sarosh Arif [this message]
2020-07-23 15:47 ` Stephen Hemminger
2020-07-28 13:30 ` Sarosh Arif
2020-07-28 13:50 ` Olivier Matz
2020-07-28 17:46 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200723070240.14749-1-sarosh.arif@emumba.com \
--to=sarosh.arif@emumba.com \
--cc=dev@dpdk.org \
--cc=olivier.matz@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).