Plugins: Clean up the plugin directory so that each plugin has its own
[vpp.git] / plugins / vcgn-plugin / vcgn / cnat_bulk_port_defs.h
1 /* 
2  *------------------------------------------------------------------
3  * cnat_bulk_port_defs.h bulk port alloc definitions
4  *
5  * Copyright (c) 2011 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19
20 #ifndef __CNAT_BULK_PORT_DEFS_H__
21 #define __CNAT_BULK_PORT_DEFS_H__
22
23
24 #ifndef NO_BULK_LOGGING
25
26 typedef enum {
27     BULK_ALLOC_SIZE_NONE = 1,
28     BULK_ALLOC_SIZE_16 = 16,
29     BULK_ALLOC_SIZE_32 = 32,
30     BULK_ALLOC_SIZE_64 = 64,
31     BULK_ALLOC_SIZE_128 = 128,
32     BULK_ALLOC_SIZE_256 = 256,
33     BULK_ALLOC_SIZE_512 = 512,
34     BULK_ALLOC_SIZE_1024 = 1024,
35     BULK_ALLOC_SIZE_2048 = 2048,
36     BULK_ALLOC_SIZE_4096 = 4096
37 } bulk_alloc_size_t;
38
39 /* #define DEBUG_BULK_PORT 1   TODO: remove this later */
40
41 #define CACHE_ALLOC_NO_LOG_REQUIRED     -1
42 #define BULK_ALLOC_NOT_ATTEMPTED        -2
43
44 #define BULK_RANGE_INVALID 0xFFFF
45 #define BULK_RANGE_CACHE_SIZE 4
46
47 #define BULKSIZE_FROM_VRFMAP(vrfmap)    ((vrfmap)->bulk_size)
48
49 #define INIT_BULK_CACHE(udb)    \
50     {   \
51         int i;  \
52         for(i =0; i < BULK_RANGE_CACHE_SIZE; i++) \
53             (udb)->bulk_port_range_cache[i] = (i16)BULK_RANGE_INVALID; \
54     }   
55
56 #endif /* NO_BULK_LOGGING */
57 #endif /* __CNAT_BULK_PORT_DEFS_H__ */