1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
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 FILLP_OPT_H
17 #define FILLP_OPT_H
18 
19 #include "fillptypes.h"
20 #include "constant.h"
21 #include "pdt_fc.h"
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #define IP_HLEN 20
28 #define UDP_HLEN 8
29 
30 #define FILLP_VLEN 1
31 
32 struct NetBuf {
33     FILLP_INT len; // (data length+option)
34     FILLP_UINT8 padd[4];
35     struct sockaddr_in6 addr;
36     struct FtSocket *ftSock;
37     FILLP_CHAR *p;
38 };
39 
40 
41 #define FILLP_MAX_STACK_RATE (10 * 1000 * 1000)      /* 10 Gbps */
42 #define FILLP_MAX_STACK_RECV_RATE (10 * 1000 * 1000) /* 10 Gbps */
43 
44 #define FILLP_ITEM_MULT_NUM 2          /* fillp item multiplication number */
45 #define FILLP_SPUNGE_EVENTG_MULT_NUM 3 /* multiplication number for spunge event queue */
46 #define FILLP_TIME_PRECISION 3         /* time precision */
47 
48 #define FILLP_RTT_TIME_LEVEL1_HALF 100000
49 #define FILLP_RTT_TIME_LEVEL1 200000 /* rtt time */
50 #define FILLP_RTT_TIME_LEVEL2 400000 /* min packet interval if rtt is more then default rtt */
51 #define FILLP_NODATARECV_PACK_INTERVAL 500000
52 
53 #define FILLP_ONE_THIRD_OF_RTT 3  /* one third part of rtt */
54 #define FILLP_ONE_FOURTH_OF_RTT 4 /* one fourth part of rtt */
55 #define FILLP_ONE_FIFTH_OF_RTT 5  /* one fifth part of rtt */
56 #define FILLP_ONE_SIXTH_OF_RTT 6
57 #define FILLP_ONE_SEVEN_OF_RTT 7
58 #define FILLP_ONE_EIGHTH_OF_RTT 8
59 
60 #define FILLP_MIN_NACK_INTERVAL 20000
61 
62 /* max server allow send cache */
63 #define FILLP_DEFAULT_APP_MAX_SERVER_ALLOW_SEND_CACHE FILLP_MAX_SERVER_ALLOW_SEND_RECV_CACHE
64 /* max server allow recv catche */
65 #define FILLP_DEFAULT_APP_MAX_SERVER_ALLOW_RECV_CACHE FILLP_MAX_SERVER_ALLOW_SEND_RECV_CACHE
66 
67 #define FILLP_WR_DATA_CHECK_INTERVAL (50 * 1000)
68 
69 #define FILLP_DEFAULT_APP_OPPOSITE_SET_RATE 0 /* Only for Server */
70 
71 #define FILLP_DEFAULT_MB_TO_KB_FACTOR 1000 /* recv rate in MB */
72 
73 #define FILLP_DEFAULT_OPPOSITE_SET_PERCENTAGE 100 /* Only for Server */
74 #define FILLP_DEFAULT_MAX_RATE_PERCENTAGE 100
75 #define FILLP_MAX_LOSS_PERCENTAGE 100
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* FILLP_OPT_H */
82