git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
eal/arm: add prefetch operations for ARMv8
[dpdk.git]
/
lib
/
librte_ip_frag
/
rte_ipv6_reassembly.c
diff --git
a/lib/librte_ip_frag/rte_ipv6_reassembly.c
b/lib/librte_ip_frag/rte_ipv6_reassembly.c
index
c652250
..
d29cb1d
100644
(file)
--- a/
lib/librte_ip_frag/rte_ipv6_reassembly.c
+++ b/
lib/librte_ip_frag/rte_ipv6_reassembly.c
@@
-32,15
+32,9
@@
*/
#include <stddef.h>
*/
#include <stddef.h>
-#include <stdint.h>
-#include <rte_malloc.h>
#include <rte_memcpy.h>
#include <rte_memcpy.h>
-#include <rte_byteorder.h>
-#include <rte_mbuf.h>
-#include <rte_ip.h>
-#include "rte_ip_frag.h"
#include "ip_frag_common.h"
/**
#include "ip_frag_common.h"
/**
@@
-51,11
+45,21
@@
*
*/
*
*/
+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.
*/
struct rte_mbuf *
/*
* Reassemble fragments into one packet.
*/
struct rte_mbuf *
-ipv6_frag_reassemble(const struct
rte_
ip_frag_pkt *fp)
+ipv6_frag_reassemble(const struct ip_frag_pkt *fp)
{
struct ipv6_hdr *ip_hdr;
struct ipv6_extension_fragment *frag_hdr;
{
struct ipv6_hdr *ip_hdr;
struct ipv6_extension_fragment *frag_hdr;
@@
-82,7
+86,9
@@
ipv6_frag_reassemble(const struct rte_ip_frag_pkt *fp)
/* previous fragment found. */
if (fp->frags[i].ofs + fp->frags[i].len == ofs) {
/* previous fragment found. */
if (fp->frags[i].ofs + fp->frags[i].len == ofs) {
- ip_frag_chain(fp->frags[i].mb, m);
+ /* adjust start of the last fragment data. */
+ rte_pktmbuf_adj(m, (uint16_t)(m->l2_len + m->l3_len));
+ rte_pktmbuf_chain(fp->frags[i].mb, m);
/* update our last fragment and offset. */
m = fp->frags[i].mb;
/* update our last fragment and offset. */
m = fp->frags[i].mb;
@@
-97,15
+103,15
@@
ipv6_frag_reassemble(const struct rte_ip_frag_pkt *fp)
}
/* chain with the first fragment. */
}
/* chain with the first fragment. */
- ip_frag_chain(fp->frags[IP_FIRST_FRAG_IDX].mb, m);
+ rte_pktmbuf_adj(m, (uint16_t)(m->l2_len + m->l3_len));
+ rte_pktmbuf_chain(fp->frags[IP_FIRST_FRAG_IDX].mb, m);
m = fp->frags[IP_FIRST_FRAG_IDX].mb;
/* update mbuf fields for reassembled packet. */
m->ol_flags |= PKT_TX_IP_CKSUM;
/* update ipv6 header for the reassembled datagram */
m = fp->frags[IP_FIRST_FRAG_IDX].mb;
/* update mbuf fields for reassembled packet. */
m->ol_flags |= PKT_TX_IP_CKSUM;
/* update ipv6 header for the reassembled datagram */
- ip_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(m, uint8_t *) +
- m->pkt.vlan_macip.f.l2_len);
+ ip_hdr = rte_pktmbuf_mtod_offset(m, struct ipv6_hdr *, m->l2_len);
ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
ip_hdr->payload_len = rte_cpu_to_be_16(payload_len);
@@
-116,12
+122,11
@@
ipv6_frag_reassemble(const struct rte_ip_frag_pkt *fp)
* other headers, so we assume there are no other headers and thus update
* the main IPv6 header instead.
*/
* other headers, so we assume there are no other headers and thus update
* the main IPv6 header instead.
*/
- move_len = m->pkt.vlan_macip.f.l2_len + m->pkt.vlan_macip.f.l3_len -
- sizeof(*frag_hdr);
+ move_len = m->l2_len + m->l3_len - sizeof(*frag_hdr);
frag_hdr = (struct ipv6_extension_fragment *) (ip_hdr + 1);
ip_hdr->proto = frag_hdr->next_header;
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_offset(m, char *, sizeof(*frag_hdr)
),
rte_pktmbuf_mtod(m, char*), move_len);
rte_pktmbuf_adj(m, sizeof(*frag_hdr));
rte_pktmbuf_mtod(m, char*), move_len);
rte_pktmbuf_adj(m, sizeof(*frag_hdr));
@@
-154,7
+159,7
@@
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr)
{
struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb, uint64_t tms,
struct ipv6_hdr *ip_hdr, struct ipv6_extension_fragment *frag_hdr)
{
- struct
rte_
ip_frag_pkt *fp;
+ struct ip_frag_pkt *fp;
struct ip_frag_key key;
uint16_t ip_len, ip_ofs;
struct ip_frag_key key;
uint16_t ip_len, ip_ofs;
@@
-179,7
+184,8
@@
rte_ipv6_frag_reassemble_packet(struct rte_ip_frag_tbl *tbl,
"tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
"max_entries: %u, use_entries: %u\n\n",
__func__, __LINE__,
"tbl: %p, max_cycles: %" PRIu64 ", entry_mask: %#x, "
"max_entries: %u, use_entries: %u\n\n",
__func__, __LINE__,
- mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len, frag_hdr->more_frags,
+ mb, tms, IPv6_KEY_BYTES(key.src_dst), key.id, ip_ofs, ip_len,
+ RTE_IPV6_GET_MF(frag_hdr->frag_data),
tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
tbl->use_entries);
tbl, tbl->max_cycles, tbl->entry_mask, tbl->max_entries,
tbl->use_entries);