• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: hcc flow ctrl module completion.
15  * Author:
16  * Create: 2021-06-30
17  */
18 
19 #ifndef HCC_FLOW_CTRL_HEADER
20 #define HCC_FLOW_CTRL_HEADER
21 
22 #include "td_type.h"
23 #include "hcc.h"
24 #include "hcc_queue.h"
25 
26 #ifdef __cplusplus
27 #if __cplusplus
28 extern "C" {
29 #endif
30 #endif
31 
32 #define HCC_FC_PRE_PROC_WAIT_TIME 1000
33 
34 typedef enum _hcc_flowctrl_type_ {
35     HCC_FLOWCTRL_DATA,     // 被动接收  接收端的状态,(msg方式)
36     HCC_FLOWCTRL_CREDIT,   // 发送前主动获取接收端的剩余包数量
37     HCC_FLOWCTRL_BUTT,
38     HCC_FLOWCTRL_TYPE_INVALID = 0xF
39 } hcc_flowctrl_type;
40 
41 typedef enum _hcc_flowctrl_flag_ {
42     HCC_FLOWCTRL_FLAG_OFF = 0,
43     HCC_FLOWCTRL_FLAG_ON = 1
44 } hcc_flowctrl_flag;
45 
46 #ifdef CONFIG_HCC_SUPPORT_FLOW_CONTRL
47 td_bool hcc_flow_ctrl_sched_check(hcc_handler *hcc, hcc_trans_queue *queue);
48 ext_errno hcc_flow_ctrl_process(hcc_handler *hcc, hcc_trans_queue *queue);
49 td_u32 hcc_flowctrl_on_proc(td_u8 *data);
50 td_u32 hcc_flowctrl_off_proc(td_u8 *data);
51 td_u32 hcc_flowctrl_check_proc(td_u8 *data);
52 #if (defined(_PRE_OS_VERSION_LINUX) && defined(_PRE_OS_VERSION) && (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION))
53 ext_errno hcc_flow_ctrl_pre_proc(hcc_handler *hcc, hcc_transfer_param *param, hcc_trans_queue *hcc_queue);
54 #else
55 ext_errno hcc_flow_ctrl_pre_proc(hcc_handler *hcc, TD_CONST hcc_transfer_param *param,
56     hcc_trans_queue *hcc_queue);
57 #endif
58 td_void hcc_adapt_tx_start_subq(hcc_handler *hcc, hcc_trans_queue *hcc_queue);
59 ext_errno hcc_flow_ctrl_module_init(hcc_handler *hcc);
60 td_void hcc_flow_ctrl_module_deinit(hcc_handler *hcc);
61 td_void fc_msg_init(td_u8 chl);
62 #endif
63 td_bool fc_below_low_waterline(hcc_trans_queue *hcc_queue);
64 
65 #ifdef __cplusplus
66 #if __cplusplus
67 }
68 #endif
69 #endif
70 
71 #endif /* HCC_FLOW_CTRL_HEADER */