summaryrefslogtreecommitdiff
path: root/lib/librte_ip_frag
diff options
context:
space:
mode:
authorThomas Monjalon <thomas.monjalon@6wind.com>2016-04-22 14:21:26 +0200
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-05-02 15:31:17 +0200
commit50705e8e3cdd261c1333ede1f449feb9c2c69893 (patch)
tree24d06db5c709c44c5975e18f23f1f637463bae17 /lib/librte_ip_frag
parent1f49ec153c8f91ee34c23e58c7443eb87f566b60 (diff)
downloaddpdk-50705e8e3cdd261c1333ede1f449feb9c2c69893.zip
dpdk-50705e8e3cdd261c1333ede1f449feb9c2c69893.tar.gz
dpdk-50705e8e3cdd261c1333ede1f449feb9c2c69893.tar.xz
eal: add assert macro for debug
The macro RTE_VERIFY always checks a condition. It is optimized with "unlikely" hint. While this macro is well suited for test applications, it is preferred in libraries and examples to enable such check in debug mode. That's why the macro RTE_ASSERT is introduced to call RTE_VERIFY only if built with debug logs enabled. A lot of assert macros were duplicated and enabled with a specific flag. Removing these #ifdef allows to test these code branches more easily and avoid dead code pitfalls. The ENA_ASSERT is kept (in debug mode only) because it has more parameters to log. Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Diffstat (limited to 'lib/librte_ip_frag')
-rw-r--r--lib/librte_ip_frag/ip_frag_common.h8
-rw-r--r--lib/librte_ip_frag/rte_ipv4_fragmentation.c2
-rw-r--r--lib/librte_ip_frag/rte_ipv6_fragmentation.c2
3 files changed, 2 insertions, 10 deletions
diff --git a/lib/librte_ip_frag/ip_frag_common.h b/lib/librte_ip_frag/ip_frag_common.h
index 5542a38..835e4f9 100644
--- a/lib/librte_ip_frag/ip_frag_common.h
+++ b/lib/librte_ip_frag/ip_frag_common.h
@@ -38,17 +38,9 @@
/* 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
diff --git a/lib/librte_ip_frag/rte_ipv4_fragmentation.c b/lib/librte_ip_frag/rte_ipv4_fragmentation.c
index a4ed923..a2259e8 100644
--- a/lib/librte_ip_frag/rte_ipv4_fragmentation.c
+++ b/lib/librte_ip_frag/rte_ipv4_fragmentation.c
@@ -107,7 +107,7 @@ rte_ipv4_fragment_packet(struct rte_mbuf *pkt_in,
frag_size = (uint16_t)(mtu_size - sizeof(struct ipv4_hdr));
/* Fragment size should be a multiply of 8. */
- IP_FRAG_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
+ RTE_ASSERT((frag_size & IPV4_HDR_FO_MASK) == 0);
in_hdr = rte_pktmbuf_mtod(pkt_in, struct ipv4_hdr *);
flag_offset = rte_cpu_to_be_16(in_hdr->fragment_offset);
diff --git a/lib/librte_ip_frag/rte_ipv6_fragmentation.c b/lib/librte_ip_frag/rte_ipv6_fragmentation.c
index 1e30004..db666bb 100644
--- a/lib/librte_ip_frag/rte_ipv6_fragmentation.c
+++ b/lib/librte_ip_frag/rte_ipv6_fragmentation.c
@@ -110,7 +110,7 @@ rte_ipv6_fragment_packet(struct rte_mbuf *pkt_in,
frag_size = (uint16_t)(mtu_size - sizeof(struct ipv6_hdr));
/* Fragment size should be a multiple of 8. */
- IP_FRAG_ASSERT((frag_size & ~RTE_IPV6_EHDR_FO_MASK) == 0);
+ RTE_ASSERT((frag_size & ~RTE_IPV6_EHDR_FO_MASK) == 0);
/* Check that pkts_out is big enough to hold all fragments */
if (unlikely (frag_size * nb_pkts_out <