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: set iopl only when needed
[dpdk.git]
/
lib
/
librte_ip_frag
/
ip_frag_common.h
diff --git
a/lib/librte_ip_frag/ip_frag_common.h
b/lib/librte_ip_frag/ip_frag_common.h
index
3e588a0
..
210f409
100644
(file)
--- a/
lib/librte_ip_frag/ip_frag_common.h
+++ b/
lib/librte_ip_frag/ip_frag_common.h
@@
-41,34
+41,43
@@
#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, USER1, fmt, ##args)
#define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, USER1, fmt, ##args)
-#define
RTE_IP_FRAG_ASSERT(exp)
\
+#define
IP_FRAG_ASSERT(exp)
\
if (!(exp)) { \
rte_panic("function %s, line%d\tassert \"" #exp "\" failed\n", \
__func__, __LINE__); \
}
#else
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
if (!(exp)) { \
rte_panic("function %s, line%d\tassert \"" #exp "\" failed\n", \
__func__, __LINE__); \
}
#else
#define IP_FRAG_LOG(lvl, fmt, args...) do {} while(0)
-#define
RTE_IP_FRAG_ASSERT(exp) do { } while
(0)
+#define
IP_FRAG_ASSERT(exp) do {} while
(0)
#endif /* IP_FRAG_DEBUG */
#endif /* IP_FRAG_DEBUG */
+#define IPV4_KEYLEN 1
+#define IPV6_KEYLEN 4
+
/* helper macros */
#define IP_FRAG_MBUF2DR(dr, mb) ((dr)->row[(dr)->cnt++] = (mb))
/* helper macros */
#define IP_FRAG_MBUF2DR(dr, mb) ((dr)->row[(dr)->cnt++] = (mb))
+#define IPv6_KEY_BYTES(key) \
+ (key)[0], (key)[1], (key)[2], (key)[3]
+#define IPv6_KEY_BYTES_FMT \
+ "%08" PRIx64 "%08" PRIx64 "%08" PRIx64 "%08" PRIx64
+
/* internal functions declarations */
/* internal functions declarations */
-struct rte_mbuf * ip_frag_process(struct
rte_
ip_frag_pkt *fp,
+struct rte_mbuf * ip_frag_process(struct ip_frag_pkt *fp,
struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb,
uint16_t ofs, uint16_t len, uint16_t more_frags);
struct rte_ip_frag_death_row *dr, struct rte_mbuf *mb,
uint16_t ofs, uint16_t len, uint16_t more_frags);
-struct
rte_
ip_frag_pkt * ip_frag_find(struct rte_ip_frag_tbl *tbl,
+struct ip_frag_pkt * ip_frag_find(struct rte_ip_frag_tbl *tbl,
struct rte_ip_frag_death_row *dr,
const struct ip_frag_key *key, uint64_t tms);
struct rte_ip_frag_death_row *dr,
const struct ip_frag_key *key, uint64_t tms);
-struct
rte_
ip_frag_pkt * ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
+struct ip_frag_pkt * ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
const struct ip_frag_key *key, uint64_t tms,
const struct ip_frag_key *key, uint64_t tms,
- struct
rte_ip_frag_pkt **free, struct rte_
ip_frag_pkt **stale);
+ struct
ip_frag_pkt **free, struct
ip_frag_pkt **stale);
/* these functions need to be declared here as ip_frag_process relies on them */
/* these functions need to be declared here as ip_frag_process relies on them */
-struct rte_mbuf * ipv4_frag_reassemble(const struct rte_ip_frag_pkt *fp);
+struct rte_mbuf * ipv4_frag_reassemble(const struct ip_frag_pkt *fp);
+struct rte_mbuf * ipv6_frag_reassemble(const struct ip_frag_pkt *fp);
@@
-80,8
+89,10
@@
struct rte_mbuf * ipv4_frag_reassemble(const struct rte_ip_frag_pkt *fp);
static inline int
ip_frag_key_is_empty(const struct ip_frag_key * key)
{
static inline int
ip_frag_key_is_empty(const struct ip_frag_key * key)
{
- if (key->src_dst != 0)
- return 0;
+ uint32_t i;
+ for (i = 0; i < key->key_len; i++)
+ if (key->src_dst[i] != 0)
+ return 0;
return 1;
}
return 1;
}
@@
-89,14
+100,20
@@
ip_frag_key_is_empty(const struct ip_frag_key * key)
static inline void
ip_frag_key_invalidate(struct ip_frag_key * key)
{
static inline void
ip_frag_key_invalidate(struct ip_frag_key * key)
{
- key->src_dst = 0;
+ uint32_t i;
+ for (i = 0; i < key->key_len; i++)
+ key->src_dst[i] = 0;
}
/* compare two keys */
static inline int
ip_frag_key_cmp(const struct ip_frag_key * k1, const struct ip_frag_key * k2)
{
}
/* compare two keys */
static inline int
ip_frag_key_cmp(const struct ip_frag_key * k1, const struct ip_frag_key * k2)
{
- return k1->src_dst ^ k2->src_dst;
+ uint32_t i, val;
+ val = k1->id ^ k2->id;
+ for (i = 0; i < k1->key_len; i++)
+ val |= k1->src_dst[i] ^ k2->src_dst[i];
+ return val;
}
/*
}
/*
@@
-105,7
+122,7
@@
ip_frag_key_cmp(const struct ip_frag_key * k1, const struct ip_frag_key * k2)
/* put fragment on death row */
static inline void
/* put fragment on death row */
static inline void
-ip_frag_free(struct
rte_
ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr)
+ip_frag_free(struct ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr)
{
uint32_t i, k;
{
uint32_t i, k;
@@
-123,7
+140,7
@@
ip_frag_free(struct rte_ip_frag_pkt *fp, struct rte_ip_frag_death_row *dr)
/* if key is empty, mark key as in use */
static inline void
/* if key is empty, mark key as in use */
static inline void
-ip_frag_inuse(struct rte_ip_frag_tbl *tbl, const struct
rte_
ip_frag_pkt *fp)
+ip_frag_inuse(struct rte_ip_frag_tbl *tbl, const struct ip_frag_pkt *fp)
{
if (ip_frag_key_is_empty(&fp->key)) {
TAILQ_REMOVE(&tbl->lru, fp, lru);
{
if (ip_frag_key_is_empty(&fp->key)) {
TAILQ_REMOVE(&tbl->lru, fp, lru);
@@
-133,7
+150,7
@@
ip_frag_inuse(struct rte_ip_frag_tbl *tbl, const struct rte_ip_frag_pkt *fp)
/* reset the fragment */
static inline void
/* reset the fragment */
static inline void
-ip_frag_reset(struct
rte_
ip_frag_pkt *fp, uint64_t tms)
+ip_frag_reset(struct ip_frag_pkt *fp, uint64_t tms)
{
static const struct ip_frag zero_frag = {
.ofs = 0,
{
static const struct ip_frag zero_frag = {
.ofs = 0,
@@
-156,20
+173,19
@@
ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
struct rte_mbuf *ms;
/* adjust start of the last fragment data. */
struct rte_mbuf *ms;
/* adjust start of the last fragment data. */
- rte_pktmbuf_adj(mp, (uint16_t)(mp->pkt.vlan_macip.f.l2_len +
- mp->pkt.vlan_macip.f.l3_len));
+ rte_pktmbuf_adj(mp, (uint16_t)(mp->l2_len + mp->l3_len));
/* chain two fragments. */
ms = rte_pktmbuf_lastseg(mn);
/* chain two fragments. */
ms = rte_pktmbuf_lastseg(mn);
- ms->
pkt.
next = mp;
+ ms->next = mp;
/* accumulate number of segments and total length. */
/* accumulate number of segments and total length. */
- mn->
pkt.nb_segs = (uint8_t)(mn->pkt.nb_segs + mp->pkt.
nb_segs);
- mn->pkt
.pkt_len += mp->pkt.
pkt_len;
+ mn->
nb_segs = (uint8_t)(mn->nb_segs + mp->
nb_segs);
+ mn->pkt
_len += mp->
pkt_len;
/* reset pkt_len and nb_segs for chained fragment. */
/* reset pkt_len and nb_segs for chained fragment. */
- mp->pkt
.pkt_len = mp->pkt.
data_len;
- mp->
pkt.
nb_segs = 1;
+ mp->pkt
_len = mp->
data_len;
+ mp->nb_segs = 1;
}
}