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_RES_H
17 #define FILLP_RES_H
18 
19 #include "sockets.h"
20 
21 #ifdef FILLP_LINUX
22 #define __FAVOR_BSD
23 #include <netinet/tcp.h>
24 #endif
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 struct GlobalUdpRes {
31     FILLP_UINT16 rxBurst; /* max pkt number to recv each cycle */
32     FILLP_UINT16 numMsgSend;
33     FILLP_BOOL supportMmsg;
34     FILLP_UINT8 padd;
35 };
36 
37 
38 struct GlobalCommon {
39     FILLP_UINT32 recvCachePktNumBufferSize;
40     FILLP_UINT16 recvCachePktNumBufferTimeout;
41     FILLP_UINT16 maxSockNum;
42     FILLP_UINT16 maxConnNum;
43     FILLP_UINT16 maxInstNum;
44     FILLP_BOOL fullCpuEnable;
45     FILLP_BOOL outOfOrderCacheEnable;
46     FILLP_UINT8 cpuCoreUse;
47     FILLP_UINT8 reserve;
48     FILLP_UINT32 sendCache; /* size of send cache */
49     FILLP_UINT32 recvCache; /* size of recv cache  */
50     FILLP_UINT32 padd;
51 };
52 
53 struct GlobalFlowControl {
54     FILLP_UINT32 maxRate;
55     FILLP_UINT32 maxRecvRate;
56     FILLP_UINT32 initialRate;
57     FILLP_UINT16 oppositeSetPercentage; /* Only for Server */
58     FILLP_UINT16 maxRatePercentage;
59     FILLP_UINT16 nackRepeatTimes;
60     FILLP_UINT16 pktLossAllow;
61     FILLP_UINT8 fcAlg;
62     FILLP_UINT8 supportFairness;
63     FILLP_UINT32 limitRate;
64 };
65 
66 
67 struct GlobalResource {
68     struct GlobalUdpRes udp;
69     struct GlobalCommon common;
70     struct GlobalFlowControl flowControl;
71     FILLP_UINT8 pktLossThresHoldMax;
72     FILLP_UINT16 timingWheelAccuracy;
73     FILLP_UINT32 maximalAckNumLimit;
74     FILLP_UINT32 sendOneAckNum;
75     FILLP_UINT16 cpuPauseTime;
76     FILLP_UINT8 retransmitCmpTime;
77     FILLP_UINT8 reserve;
78     FILLP_UINT16 minRate;
79     FILLP_UINT16 minPackInterval;
80     FILLP_UINT16 unsendBoxLoopCheckBurst;
81     FILLP_UINT16 reserv;
82     FILLP_UINT32 instUnsendBoxSize;
83     FILLP_UINT16 nackRetryLen;
84     FILLP_UINT16 reserved;
85     double fcControlMultiNumInitialValue;
86     double fcMultiAdjustConst;
87     double fcMultiNumStep;
88     double fcNightyPercentVal;
89     FILLP_UINT32 fullCpuUseThresholdRate;
90     FILLP_UINT32 padd;
91 };
92 
93 void InitGlobalResourceDefault(void);
94 
95 extern struct GlobalResource g_resource;
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
101 #endif /* FILLP_RES_H */
102