From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2D080A034C; Thu, 23 Jun 2022 00:49:44 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2E9C4069C; Thu, 23 Jun 2022 00:49:43 +0200 (CEST) Received: from forward501p.mail.yandex.net (forward501p.mail.yandex.net [77.88.28.111]) by mails.dpdk.org (Postfix) with ESMTP id 557A9400D6 for ; Thu, 23 Jun 2022 00:49:42 +0200 (CEST) Received: from iva6-2cc1dbf7c260.qloud-c.yandex.net (iva6-2cc1dbf7c260.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:610d:0:640:2cc1:dbf7]) by forward501p.mail.yandex.net (Yandex) with ESMTP id 926506214AF2; Thu, 23 Jun 2022 01:49:41 +0300 (MSK) Received: from iva3-6d6b5ab252da.qloud-c.yandex.net (iva3-6d6b5ab252da.qloud-c.yandex.net [2a02:6b8:c0c:c19:0:640:6d6b:5ab2]) by iva6-2cc1dbf7c260.qloud-c.yandex.net (mxback/Yandex) with ESMTP id hHtokddEVw-nff8M6oi; Thu, 23 Jun 2022 01:49:41 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1655938181; bh=ntZmQbmvvHmp7qfj0Zj+XtY7ovaajslC6ijadKCo46k=; h=In-Reply-To:From:Subject:Cc:References:Date:Message-ID:To; b=pZZKnvxOub3/fLYod9hV8D3JGPT0/DuN93PvNbW5eYVgXpLNkrWH6ObEY1mseVJ57 8Pm5uLIe0dcLed3Tl5/yjOLUD6KbUih21lxIow+YrrA0RUHLAv3xvZSbcAHaZoq6vJ 3/3bqKsQArrk4JYTvsQTga9ghBFssdMo2qHxJ4nE= Authentication-Results: iva6-2cc1dbf7c260.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by iva3-6d6b5ab252da.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id dfYD0pPOny-neNKDoeg; Thu, 23 Jun 2022 01:49:40 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: Date: Wed, 22 Jun 2022 23:49:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH] ip_frag: replace the rte memcpy with memcpy Content-Language: en-US To: Huichao Cai , dev@dpdk.org Cc: konstantin.ananyev@intel.com References: <1655561380-64616-1-git-send-email-chcchc88@163.com> From: Konstantin Ananyev In-Reply-To: <1655561380-64616-1-git-send-email-chcchc88@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 18/06/2022 15:09, Huichao Cai пишет: > To resolve the compilation warning,replace the rte_memcpy with memcpy. > Modify in file test_ipfrag.c and rte_ipv4_fragmentation.c. > > Signed-off-by: Huichao Cai > --- > app/test/test_ipfrag.c | 13 ++++++------- > lib/ip_frag/rte_ipv4_fragmentation.c | 7 +++---- > 2 files changed, 9 insertions(+), 11 deletions(-) > > diff --git a/app/test/test_ipfrag.c b/app/test/test_ipfrag.c > index dc62b0e..ba0ffd0 100644 > --- a/app/test/test_ipfrag.c > +++ b/app/test/test_ipfrag.c > @@ -23,7 +23,6 @@ > > #include > #include > -#include > #include > > #define NUM_MBUFS 128 > @@ -147,13 +146,13 @@ static void ut_teardown(void) > if (opt_copied) { > expected_opt->len = > sizeof(expected_first_frag_ipv4_opts_copied); > - rte_memcpy(expected_opt->data, > + memcpy(expected_opt->data, > expected_first_frag_ipv4_opts_copied, > sizeof(expected_first_frag_ipv4_opts_copied)); > } else { > expected_opt->len = > sizeof(expected_first_frag_ipv4_opts_nocopied); > - rte_memcpy(expected_opt->data, > + memcpy(expected_opt->data, > expected_first_frag_ipv4_opts_nocopied, > sizeof(expected_first_frag_ipv4_opts_nocopied)); > } > @@ -161,13 +160,13 @@ static void ut_teardown(void) > if (opt_copied) { > expected_opt->len = > sizeof(expected_sub_frag_ipv4_opts_copied); > - rte_memcpy(expected_opt->data, > + memcpy(expected_opt->data, > expected_sub_frag_ipv4_opts_copied, > sizeof(expected_sub_frag_ipv4_opts_copied)); > } else { > expected_opt->len = > sizeof(expected_sub_frag_ipv4_opts_nocopied); > - rte_memcpy(expected_opt->data, > + memcpy(expected_opt->data, > expected_sub_frag_ipv4_opts_nocopied, > sizeof(expected_sub_frag_ipv4_opts_nocopied)); > } > @@ -227,7 +226,7 @@ static void ut_teardown(void) > hdr->src_addr = rte_cpu_to_be_32(0x8080808); > hdr->dst_addr = rte_cpu_to_be_32(0x8080404); > > - rte_memcpy(hdr + 1, opt.data, opt.len); > + memcpy(hdr + 1, opt.data, opt.len); > } > > static void > @@ -312,7 +311,7 @@ static void ut_teardown(void) > char *iph_opt = rte_pktmbuf_mtod_offset(mb[i], > char *, sizeof(struct rte_ipv4_hdr)); > opt->len = opt_len; > - rte_memcpy(opt->data, iph_opt, opt_len); > + memcpy(opt->data, iph_opt, opt_len); > } else { > opt->len = RTE_IPV4_HDR_OPT_MAX_LEN; > memset(opt->data, RTE_IPV4_HDR_OPT_EOL, > diff --git a/lib/ip_frag/rte_ipv4_fragmentation.c b/lib/ip_frag/rte_ipv4_fragmentation.c > index a19f6fd..27a8ad2 100644 > --- a/lib/ip_frag/rte_ipv4_fragmentation.c > +++ b/lib/ip_frag/rte_ipv4_fragmentation.c > @@ -5,7 +5,6 @@ > #include > #include > > -#include > #include > > #include "ip_frag_common.h" > @@ -26,7 +25,7 @@ static inline void __fill_ipv4hdr_frag(struct rte_ipv4_hdr *dst, > const struct rte_ipv4_hdr *src, uint16_t header_len, > uint16_t len, uint16_t fofs, uint16_t dofs, uint32_t mf) > { > - rte_memcpy(dst, src, header_len); > + memcpy(dst, src, header_len); I am fine with replacements in test and inside the lib, for cases where 'len' parameter is constant value. Though as I said before, here 'header_len' is not a constant value. Are you sure it will not introduce any performance regression? > fofs = (uint16_t)(fofs + (dofs >> RTE_IPV4_HDR_FO_SHIFT)); > fofs = (uint16_t)(fofs | mf << RTE_IPV4_HDR_MF_SHIFT); > dst->fragment_offset = rte_cpu_to_be_16(fofs); > @@ -48,7 +47,7 @@ static inline uint16_t __create_ipopt_frag_hdr(uint8_t *iph, > struct rte_ipv4_hdr *iph_opt = (struct rte_ipv4_hdr *)ipopt_frag_hdr; > > ipopt_len = 0; > - rte_memcpy(ipopt_frag_hdr, iph, sizeof(struct rte_ipv4_hdr)); > + memcpy(ipopt_frag_hdr, iph, sizeof(struct rte_ipv4_hdr)); > ipopt_frag_hdr += sizeof(struct rte_ipv4_hdr); > > uint8_t *p_opt = iph + sizeof(struct rte_ipv4_hdr); > @@ -65,7 +64,7 @@ static inline uint16_t __create_ipopt_frag_hdr(uint8_t *iph, > break; > > if (RTE_IPV4_HDR_OPT_COPIED(*p_opt)) { > - rte_memcpy(ipopt_frag_hdr + ipopt_len, > + memcpy(ipopt_frag_hdr + ipopt_len, > p_opt, p_opt[1]); > ipopt_len += p_opt[1]; > }