net/dpaa2: add support for MAC address filtering
[dpdk.git] / lib / librte_ip_frag / ip_frag_common.h
index 210f409..835e4f9 100644 (file)
 
 /* logging macros. */
 #ifdef RTE_LIBRTE_IP_FRAG_DEBUG
-
 #define        IP_FRAG_LOG(lvl, fmt, args...)  RTE_LOG(lvl, USER1, fmt, ##args)
-
-#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)
-#define IP_FRAG_ASSERT(exp)    do {} while (0)
 #endif /* IP_FRAG_DEBUG */
 
 #define IPV4_KEYLEN 1
@@ -76,8 +68,8 @@ struct ip_frag_pkt * ip_frag_lookup(struct rte_ip_frag_tbl *tbl,
        struct ip_frag_pkt **free, struct ip_frag_pkt **stale);
 
 /* these functions need to be declared here as ip_frag_process relies on them */
-struct rte_mbuf * ipv4_frag_reassemble(const struct ip_frag_pkt *fp);
-struct rte_mbuf * ipv6_frag_reassemble(const struct ip_frag_pkt *fp);
+struct rte_mbuf *ipv4_frag_reassemble(struct ip_frag_pkt *fp);
+struct rte_mbuf *ipv6_frag_reassemble(struct ip_frag_pkt *fp);
 
 
 
@@ -90,7 +82,7 @@ static inline int
 ip_frag_key_is_empty(const struct ip_frag_key * key)
 {
        uint32_t i;
-       for (i = 0; i < key->key_len; i++)
+       for (i = 0; i < RTE_MIN(key->key_len, RTE_DIM(key->src_dst)); i++)
                if (key->src_dst[i] != 0)
                        return 0;
        return 1;
@@ -166,27 +158,4 @@ ip_frag_reset(struct ip_frag_pkt *fp, uint64_t tms)
        fp->frags[IP_FIRST_FRAG_IDX] = zero_frag;
 }
 
-/* chain two mbufs */
-static inline void
-ip_frag_chain(struct rte_mbuf *mn, struct rte_mbuf *mp)
-{
-       struct rte_mbuf *ms;
-
-       /* adjust start of the last fragment data. */
-       rte_pktmbuf_adj(mp, (uint16_t)(mp->l2_len + mp->l3_len));
-
-       /* chain two fragments. */
-       ms = rte_pktmbuf_lastseg(mn);
-       ms->next = mp;
-
-       /* accumulate number of segments and total length. */
-       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. */
-       mp->pkt_len = mp->data_len;
-       mp->nb_segs = 1;
-}
-
-
 #endif /* _IP_FRAG_COMMON_H_ */