From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 171C3A0527; Thu, 23 Jul 2020 09:05:56 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B7DA51BF94; Thu, 23 Jul 2020 09:05:54 +0200 (CEST) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by dpdk.org (Postfix) with ESMTP id CBD5E1BF7B for ; Thu, 23 Jul 2020 09:05:52 +0200 (CEST) Received: by mail-wm1-f67.google.com with SMTP id 184so4190886wmb.0 for ; Thu, 23 Jul 2020 00:05:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=lSoxi1adlzxDJAU85RjjWZLMnXKNsfdPBVXucNkCCA0=; b=UsL6JyMUDrFtwIwfAhy33GBPUBbuu1Zc5s93BZHCrFUiHZ5LNyE8pBTgCfpkvhfcfq Wq/bz3EA6D/Q/unEqrt8pA07vcYncV+lUL+pla0K5QbwNlBamlYUnH4RRLUkD/q19K+u JX1sE2LKMoQJuWEgcbAzAED/AA4Vo1c19MwsDoQ9BV1Wtg4qtfsX9OZBfqnRyakHNApJ G746U5/4lYbg4OB5DWjtEELz4PA9glwcXIlYsBZxd4usX8X/gOEaIjK/Y+WEdMd6e1d3 TkSPTm4+n+qeD6Q6p76M4h5ur8tsnz+1OC5cy4apIXQNR4dCgBOnIhYas9K/OQ7HwibY dC7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lSoxi1adlzxDJAU85RjjWZLMnXKNsfdPBVXucNkCCA0=; b=f1cPO7zMLrBAcYOA1GFs90shXHQgQ77EzGv08HrizrZ4q7qEIdHRheooUKWNiorDqi pneNblbJgs8dvzecMEzmExbFKHIsLmdv/ageH2ke2LZwT6vhtVP/SlnB/vMs0npkXLvp Cfa3V98EoOjyRl6djPufXqxQfs+kixfgGPkxAAbb2OMFY960mjuoPf+6GWzVyFqoZluM I3M6Yo8rz535w8Gs9XfBS+VyMtrBR2ILoK+t5U5RgHVGGs03N4iyLIf/wfe+tw8rLxCC Wbt6rctHCaOYvuXDAcvdh9gN3DlLhxG12GO2d9P6gCH7oO9YSQihfUe4oafw+s2kAx8G 5hFA== X-Gm-Message-State: AOAM531g+EFxmKWALRDv2//9UWmg5KWY6kIRkVw8Pv8A/jk+Z8+Y3H9F VpYdQ1eR/+7zJwW1BAs+NIUAPw== X-Google-Smtp-Source: ABdhPJwCw2F9Y0pRuqkVh2hdoIXT5IIdi/FS1tifDqy8Z8/+Gi9eGCNviygI73Pff0Bk73YhUuca7g== X-Received: by 2002:a1c:4343:: with SMTP id q64mr2845201wma.20.1595487952345; Thu, 23 Jul 2020 00:05:52 -0700 (PDT) Received: from localhost.localdomain ([58.65.159.11]) by smtp.gmail.com with ESMTPSA id w16sm2830261wrg.95.2020.07.23.00.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jul 2020 00:05:51 -0700 (PDT) From: Sarosh Arif To: olivier.matz@6wind.com Cc: dev@dpdk.org, Sarosh Arif Date: Thu, 23 Jul 2020 12:02:40 +0500 Message-Id: <20200723070240.14749-1-sarosh.arif@emumba.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] mbuf: replace c memcpy() code semantics with optimized rte_memcpy() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Since rte_memcpy is more optimized it should be used instead of memcpy Signed-off-by: Sarosh Arif --- 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 #include #include +#include #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 #include #include +#include #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