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_FC_ALG0_H 17 #define FILLP_FC_ALG0_H 18 19 #include "fillp_flow_control.h" 20 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #define FILLP_FC0_DEFAULT_RATE 200000 27 28 #define FILLP_FC0_PACK_RECV_INTERVAL_SAMPLE_NUM 20 /* num of the interval in two adjacent PACK received */ 29 30 enum FillpFcAlg0State { 31 FILLP_FC0_STATE_INIT, 32 FILLP_FC0_STATE_BW_PROBE 33 }; 34 35 struct FillpRttSample { 36 FILLP_LLONG t; /* rtt time */ 37 FILLP_LLONG v; /* rtt value */ 38 }; 39 40 #define FILLP_FC0_PROBE_HISTORY_PACK_MAX_RATE_NUM 11 41 42 struct FillpFlowControlAlg0 { 43 struct FillpFlowControl *flowControl; 44 FILLP_UINT32 maxRecvRate; /* kbps */ 45 FILLP_UINT32 maxRateAllowed; 46 FILLP_UINT8 fcState; /* is rate detecting or stable */ 47 FILLP_UINT8 historyMaxRecvRateIndex; 48 FILLP_UINT8 sendRateIncreaseGainIndex; 49 FILLP_UINT32 packDeltaUsArrayIndex; 50 struct FillpMaxRateSample historyMaxRecvRate; /* State for the parameterized max tracker */ 51 FILLP_UINT32 packDeltaUsArray[FILLP_FC0_PACK_RECV_INTERVAL_SAMPLE_NUM]; 52 }; 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif /* FILLP_FC_ALG0_H */ 59