test_common.h revision 68f21c31
1/*
2 * Copyright (c) 2016  Intel Corporation.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at:
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#ifndef TEST_COMMON_H_
17#define TEST_COMMON_H_
18
19#include <netinet/in.h>
20#include <netinet/ip6.h>
21
22#include <rte_config.h>
23#include <rte_common.h>
24#include <rte_errno.h>
25#include <rte_eal.h>
26#include <rte_lcore.h>
27#include <rte_ethdev.h>
28#include <rte_kvargs.h>
29#include <rte_errno.h>
30#include <rte_malloc.h>
31#include <rte_cycles.h>
32#include <rte_lpm.h>
33#include <rte_lpm6.h>
34#include <rte_hash.h>
35#include <rte_ip.h>
36#include <rte_ip_frag.h>
37#include <rte_udp.h>
38
39#define RX_RING_SIZE 128
40#define TX_RING_SIZE 128
41#define NUM_MBUFS 4095
42#define MBUF_CACHE_SIZE 250
43#define BURST_SIZE 32
44
45extern struct rte_mempool *mbuf_pool;
46extern struct rte_mempool *frag_mp;
47
48extern char binpath[PATH_MAX];
49
50int port_init(uint8_t port, struct rte_mempool *mbuf_pool);
51
52uint64_t
53_mbuf_tx_offload(uint64_t il2, uint64_t il3, uint64_t il4, uint64_t tso,
54	uint64_t ol3, uint64_t ol2);
55
56void
57fill_pkt_hdr_len(struct rte_mbuf *m, uint32_t l2, uint32_t l3, uint32_t l4);
58
59int
60is_ipv4_frag(const struct ipv4_hdr *iph);
61
62void
63fill_ipv4_hdr_len(struct rte_mbuf *m, uint32_t l2, uint32_t proto,
64	uint32_t frag);
65
66int
67ipv6x_hdr(uint32_t proto);
68
69uint16_t
70ipv4x_cksum(const void *iph, size_t len);
71
72void
73fill_ipv6x_hdr_len(struct rte_mbuf *m, uint32_t l2, uint32_t nproto,
74	uint32_t fproto);
75
76void
77fill_ipv6_hdr_len(struct rte_mbuf *m, uint32_t l2, uint32_t fproto);
78
79void
80fix_reassembled(struct rte_mbuf *m, int32_t hwcsum);
81
82uint32_t
83compress_pkt_list(struct rte_mbuf *pkt[], uint32_t nb_pkt, uint32_t nb_zero);
84
85void
86fill_eth_hdr_len(struct rte_mbuf *m);
87
88uint16_t
89typen_rx_callback(uint8_t port, __rte_unused uint16_t queue,
90	struct rte_mbuf *pkt[], uint16_t nb_pkts,
91	__rte_unused uint16_t max_pkts, void *user_param);
92
93int
94dummy_lookup4(void *opaque, const struct in_addr *addr, struct tle_dest *res);
95
96int
97dummy_lookup6(void *opaque, const struct in6_addr *addr, struct tle_dest *res);
98
99#endif /* TEST_COMMON_H_ */
100