-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcomdef.h
More file actions
64 lines (44 loc) · 1.75 KB
/
comdef.h
File metadata and controls
64 lines (44 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef COMDEF_H
#define COMDEF_H
//#define NDEBUG
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#define TRUE 1 /* Boolean true value. */
#define FALSE 0 /* Boolean false value. */
#ifdef NULL
#undef NULL
#endif
#define NULL 0
/* DO NOT CHANGE THIS VALUE, optimized for shared memory access */
#define MAX_THREADS_PER_BLOCK 128
#define ONE_K (1UL << 10)
#define ONE_MEG (1UL << 20)
/* SHOULD be divisible by ELEM_SZ */
#define DEFAULT_RABIN_WINDOW 32
/* 6 yields on average 21.6 fingerprints, 7 - 10.8, 8 - 5.4, and 9 yields 2.7,
* if 0, all (MTU+1-DEFAULT_RABIN_WINDOW) fingerprints will be considered */
#define DEFAULT_RABIN_REPR_BITS 8
/* FIXME: MAX_NUMBER_OF_PACKETS and RABINPOLY_BUFFER
* should be dynamically determined. Since we use the shared memory of GPU,
* this buffer will not be used.
*/
#define MAX_NUMBER_OF_PACKETS (1024 * 16)
#define RABINPOLY_BUFFER (DEFAULT_RABIN_WINDOW * MAX_NUMBER_OF_PACKETS)
#define MAX_PINNED_MEM_RABINWIN (sizeof(struct rabinpoly_window))
#define MAX_PINNED_MEM_PAYLOAD (MAX_NUMBER_OF_PACKETS * DEFAULT_MTU)
//#define MAX_PINNED_MEM_METADATA (512 * ONE_K)
#define MAX_PINNED_MEM_METADATA (4 * sizeof(uint32_t) * MAX_NUMBER_OF_PACKETS)
#define FIXED_FP 12
/* 8 = sizeof(uint64_t) for fingerprint, 2 = sizeof(short) for offset,
* 1 = sizeof(char) for the number of fingerprints
*/
#define MAX_PINNED_MEM_OUTSIZE ((8 * MAX_NUMBER_OF_PACKETS * FIXED_FP) + (2 * MAX_NUMBER_OF_PACKETS * FIXED_FP) + (1 * MAX_NUMBER_OF_PACKETS))
#define MAX_PINNED_MEM_INSIZE (MAX_PINNED_MEM_PAYLOAD + MAX_PINNED_MEM_METADATA)
#define ELEM_SZ (sizeof(int4))
#define NSTREAMS 4
#define DEFAULT_MTU 1500
#define MASK ((1UL << DEFAULT_RABIN_REPR_BITS) - 1)
#define NUM_BUCKETS 512
#endif /* COMDEF_H */