DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 06/10] ip_frag: replace memmove with custom copying
Date: Wed, 18 Jun 2014 15:50:33 +0100
Message-ID: <9359ed14fb16b22d9526c2dc1d5cb69f2d0ccba7.1403102825.git.anatoly.burakov@intel.com> (raw)
In-Reply-To: <cover.1403102825.git.anatoly.burakov@intel.com>
In-Reply-To: <cover.1403102825.git.anatoly.burakov@intel.com>

some implementations of memmove may make a copy of src before writing to
dst. we avoid that by explicitly writing from src to dst backwards.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_ip_frag/rte_ipv6_reassembly.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lib/librte_ip_frag/rte_ipv6_reassembly.c b/lib/librte_ip_frag/rte_ipv6_reassembly.c
index c622827..3f06960 100644
--- a/lib/librte_ip_frag/rte_ipv6_reassembly.c
+++ b/lib/librte_ip_frag/rte_ipv6_reassembly.c
@@ -45,6 +45,16 @@
  *
  */
 
+static inline void
+ip_frag_memmove(char *dst, char *src, int len)
+{
+	int i;
+
+	/* go backwards to make sure we don't overwrite anything important */
+	for (i = len - 1; i >= 0; i--)
+		dst[i] = src[i];
+}
+
 /*
  * Reassemble fragments into one packet.
  */
@@ -115,7 +125,7 @@ ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
 	frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
 	ip_hdr->proto = frag_hdr->next_header;
 
-	memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr),
+	ip_frag_memmove(rte_pktmbuf_mtod(m, char*) + sizeof(*frag_hdr),
 			rte_pktmbuf_mtod(m, char*), move_len);
 
 	rte_pktmbuf_adj(m, sizeof(*frag_hdr));
-- 
1.8.1.4

  parent reply	other threads:[~2014-06-18 14:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-18 14:50 [dpdk-dev] [PATCH 00/10] rte_ip_frag: various fixes for lib and examples Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 01/10] ip_frag: rename RTE_IP_FRAG_ASSERT to IP_FRAG_ASSERT Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 02/10] ip_frag: fix debug macros Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 03/10] ip_frag: renaming rte_ip_frag_pkt to ip_frag_pkt Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 04/10] ip_frag: fix stats macro, rename rte_ip_frag_tbl_stat structure Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 05/10] ip_frag: small fix, replace hardcode with a macro Anatoly Burakov
2014-06-18 14:50 ` Anatoly Burakov [this message]
2014-06-18 14:50 ` [dpdk-dev] [PATCH 07/10] ip_frag: fix order of arguments to key compare function Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 08/10] ip_fragmentation: small fixes Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 09/10] ip_reassembly: " Anatoly Burakov
2014-06-18 14:50 ` [dpdk-dev] [PATCH 10/10] rte_ip_frag: API header file fix Anatoly Burakov
2014-06-26 21:10 ` [dpdk-dev] [PATCH 00/10] rte_ip_frag: various fixes for lib and examples Thomas Monjalon

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=9359ed14fb16b22d9526c2dc1d5cb69f2d0ccba7.1403102825.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git