Initial commit of tldk code.
[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 #define UDP_LOG(lvl, fmt, args...)      RTE_LOG(lvl, USER1, fmt, ##args)
27
28 /*
29  * if no AVX support, define _ymm_t here.
30  */
31
32 #ifdef __AVX__
33
34 #define _ymm_t  rte_ymm_t
35
36 #else
37
38 #define YMM_SIZE        (2 * sizeof(rte_xmm_t))
39 #define YMM_MASK        (YMM_SIZE - 1)
40
41 typedef union _ymm {
42         xmm_t    x[YMM_SIZE / sizeof(xmm_t)];
43         uint8_t  u8[YMM_SIZE / sizeof(uint8_t)];
44         uint16_t u16[YMM_SIZE / sizeof(uint16_t)];
45         uint32_t u32[YMM_SIZE / sizeof(uint32_t)];
46         uint64_t u64[YMM_SIZE / sizeof(uint64_t)];
47         double   pd[YMM_SIZE / sizeof(double)];
48 } _ymm_t;
49
50 #endif /* __AVX__ */
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif /* _OSDEP_H_ */