Change libtle_udp to use dring.
[tldk.git] / lib / libtle_udp / osdep.h
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 _OSDEP_H_
17 #define _OSDEP_H_
18
19 #include <rte_vect.h>
20 #include <rte_log.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 /*
27  * internal defines.
28  */
29 #define MAX_PKT_BURST   0x20
30
31 #define MAX_DRB_BURST   4
32
33 /*
34  * logging related macros.
35  */
36
37 #define UDP_LOG(lvl, fmt, args...)      RTE_LOG(lvl, USER1, fmt, ##args)
38
39 /*
40  * if no AVX support, define _ymm_t here.
41  */
42
43 #ifdef __AVX__
44
45 #define _ymm_t  rte_ymm_t
46
47 #else
48
49 #define YMM_SIZE        (2 * sizeof(rte_xmm_t))
50 #define YMM_MASK        (YMM_SIZE - 1)
51
52 typedef union _ymm {
53         xmm_t    x[YMM_SIZE / sizeof(xmm_t)];
54         uint8_t  u8[YMM_SIZE / sizeof(uint8_t)];
55         uint16_t u16[YMM_SIZE / sizeof(uint16_t)];
56         uint32_t u32[YMM_SIZE / sizeof(uint32_t)];
57         uint64_t u64[YMM_SIZE / sizeof(uint64_t)];
58         double   pd[YMM_SIZE / sizeof(double)];
59 } _ymm_t;
60
61 #endif /* __AVX__ */
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* _OSDEP_H_ */