1 /*
2 * Copyright (C) 2021 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 #include "sys_congestion.h"
16
17 #include "nstackx_congestion.h"
18 #include "nstackx_error.h"
19 #include "nstackx_log.h"
20 #include "nstackx_util.h"
21
22 #define WIFI_QDISC_LENGTH 1000
23
24 #define WIFI_STA_INFO_FAKE_RX_RATE 216
25 #define WIFI_STA_INFO_FAKE_TX_RATE 432
26 #define WIFI_STA_INFO_FAKE_SIGNAL (-22)
27
CongModuleInit(void)28 int32_t CongModuleInit(void)
29 {
30 return NSTACKX_EOK;
31 }
32
CongModuleClean(void)33 void CongModuleClean(void)
34 {
35 return;
36 }
37
GetWifiInfo(const char * devName,WifiStationInfo * wifiStationInfo)38 int32_t GetWifiInfo(const char *devName, WifiStationInfo *wifiStationInfo)
39 {
40 (void)devName;
41 wifiStationInfo->rxRate = WIFI_STA_INFO_FAKE_RX_RATE;
42 wifiStationInfo->txRate = WIFI_STA_INFO_FAKE_TX_RATE;
43 wifiStationInfo->signal = WIFI_STA_INFO_FAKE_SIGNAL;
44
45 return NSTACKX_EOK;
46 }
47
GetQdiscLen(const char * devName,int32_t protocol,uint32_t * len)48 int32_t GetQdiscLen(const char *devName, int32_t protocol, uint32_t *len)
49 {
50 (void)devName;
51 (void)protocol;
52 if (len != NULL) {
53 *len = WIFI_QDISC_LENGTH;
54 } else {
55 return NSTACKX_EFAILED;
56 }
57 return NSTACKX_EOK;
58 }
59