1256 lines
47 KiB
C
Executable File
1256 lines
47 KiB
C
Executable File
/****************************************************************************
|
|
|
|
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
|
|
|
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
|
be copied by any method or incorporated into another program without
|
|
the express written consent of Aerospace C.Power. This Information or any portion
|
|
thereof remains the property of Aerospace C.Power. The Information contained herein
|
|
is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
|
liability for its use in any way and conveys no license or title under
|
|
any patent or copyright and makes no representation or warranty that this
|
|
Information is free from patent or copyright infringement.
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef CVG_NWM_STA_COMMON_H
|
|
#define CVG_NWM_STA_COMMON_H
|
|
|
|
#include "plc_utils.h"
|
|
#include "plc_mme_diagnose.h"
|
|
#include "cvg_beacon_sg.h"
|
|
#include "cvg_nwm_internal.h"
|
|
#include "cvg_api.h"
|
|
#include "cvg_security.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#if PLC_SUPPORT_STA_ROLE
|
|
|
|
/* sta device clearing NID & PCO in blacklist, unit is 1ms */
|
|
#define CVG_NWM_STA_BL_CLEAR_INTERVAL (6 * 60 * 1000)
|
|
|
|
/* sta device check NID & PCO in blacklist, unit is 1ms */
|
|
#define CVG_NWM_STA_BL_CHECK_INTERVAL (10 * 1000)
|
|
|
|
/* sta device clearing all NID & PCO in blacklist if no new network was
|
|
* discovered until the time expires, unit is 1s
|
|
*/
|
|
#define CVG_NWM_STA_BL_NO_NEW_NW_INTERVAL (60)
|
|
|
|
/* if sta device has added X times blacklists for a certain nid, do not clear
|
|
* the nid blacklist in network selecting stage, which avoid problems caused
|
|
* by frequent restart of the network, this macro defined the X
|
|
*/
|
|
#define CVG_NWM_STA_BL_ADD_CNT_TH (3)
|
|
|
|
/* if state machine restarted X times with CVG_VDEV_START_ASSOC_TIMEOUT reason,
|
|
* add current network into black list for a while. This macro defined the X.
|
|
*/
|
|
#define CVG_NWM_STA_ASSOC_TO_BL_CCO_TH 3
|
|
|
|
/* if sta authorization request duration is more than this threshold,
|
|
* allow to add current network into black list for a while, uint is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_AUTH_TO_BL_DUR_TH (15 * 60)
|
|
|
|
#if HW_PLATFORM == HW_PLATFORM_SIMU
|
|
|
|
/* sta device collecting beacon duration for network selection, unit is 1ms */
|
|
#define CVG_NWM_STA_NW_SEL_BC_DUR (5 * 1000)
|
|
|
|
#else /* HW_PLATFORM == HW_PLATFORM_SIMU */
|
|
|
|
/* sta device collecting beacon duration for network selection, unit is 1ms */
|
|
#define CVG_NWM_STA_NW_SEL_BC_DUR (10 * 1000)
|
|
|
|
#endif /* HW_PLATFORM == HW_PLATFORM_SIMU */
|
|
|
|
/* sta device collecting rf link beacon duration for network selection,
|
|
* unit is 1ms
|
|
*/
|
|
#define CVG_NWM_STA_RF_NW_SEL_BC_DUR (70 * 1000)
|
|
|
|
/* in the network selection stage, if the first effective network
|
|
* SNR detected is less than this threshold, the network selection will
|
|
* not be accelerated. at the same time, if the sniffing bc SNR is larger
|
|
* than this threshold, stop network selection immediately.
|
|
*/
|
|
#define CVG_NWM_STA_FAST_NW_SEL_BC_SNR_TH (30)
|
|
|
|
/* if the first sniffing netrwork SNR is less than this threshold,
|
|
* more network selection time will be given.
|
|
*/
|
|
#define CVG_NWM_STA_SLOW_NW_SEL_BC_SNR_TH (0)
|
|
|
|
/* if the first sniffing netrwork SNR is less than this threshold,
|
|
* more network selection time will be given.
|
|
*/
|
|
#define CVG_NWM_STA_MIDDLE_NW_SEL_BC_SNR_TH (20)
|
|
|
|
/* in the network selection stage, if the first effective network
|
|
* rf link RSSI detected is less than this threshold, the network selection will
|
|
* not be accelerated. at the same time, if the sniffing bc RSSI is larger
|
|
* than this threshold, stop network selection immediately.
|
|
*/
|
|
#define CVG_NWM_STA_RF_CERT_NW_SEL_BC_RSSI_TH (-80)
|
|
|
|
/* in the network selection stage, if the first effective network
|
|
* rf link RSSI detected is less than this threshold, the network selection will
|
|
* not be accelerated. at the same time, if the sniffing bc RSSI is larger
|
|
* than this threshold, stop network selection immediately.
|
|
*/
|
|
#define CVG_NWM_STA_RF_CERT_NW_SEL_BC_RSSI_TH2 (-95)
|
|
|
|
/* in the network selection stage, if the first effective network
|
|
* rf link RSSI detected is less than this threshold, the network selection will
|
|
* not be accelerated. at the same time, if the sniffing bc RSSI is larger
|
|
* than this threshold, stop network selection immediately.
|
|
*/
|
|
#define CVG_NWM_STA_RF_FAST_NW_SEL_BC_RSSI_TH (-53)
|
|
|
|
/* if the first sniffing netrwork rf RSSI is less than this threshold,
|
|
* more network selection time will be given.
|
|
*/
|
|
#define CVG_NWM_STA_RF_SLOW_NW_SEL_BC_RSSI_TH (-90)
|
|
|
|
/* if network info collecting duration is larged than
|
|
* (CVG_NWM_NW_MONITOR_DUR - this value), the network will be good
|
|
* candidate for network selection & ident, unit is 1s
|
|
*/
|
|
#define CVG_NWM_STA_NW_MONITOR_GUARD (2 * 60)
|
|
|
|
/* if network zc ntb info collecting duration is larged than
|
|
* (CVG_NWM_NW_ZC_MONITOR_DUR - this value), the network will be good
|
|
* candidate for network selection & ident, unit is 1s
|
|
*/
|
|
#define CVG_NWM_STA_NW_ZC_MONITOR_GUARD (4 * 60)
|
|
|
|
/* sta device network monitor count when locked by cco */
|
|
#define CVG_NWM_STA_NW_LOCKED_MONITOR_CNT (96)
|
|
|
|
/* the lock time of abnormal leave network, uint is 1min. */
|
|
#define CVG_NWM_STA_NW_ABN_LOCK_DUR (3 * 60)
|
|
|
|
/* threshold to define if local device has been associated with current network
|
|
* longer enough to extend network monitor window. unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_NW_ASSOC_LONG_TH (10 * 60 * 60)
|
|
|
|
/* threshold to define if local device has been associated with current network
|
|
* longer enough to extend network monitor window. unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_NW_ASSOC_MEDIUM_TH (2 * 60 * 60)
|
|
|
|
|
|
/* sta device network monitor count when associated with current network for
|
|
* for more than CVG_NWM_STA_NW_ASSOC_LONG_TH.
|
|
*/
|
|
#define CVG_NWM_STA_NW_LONG_MONITOR_CNT (8)
|
|
|
|
/* sta device network monitor count when associated with current network for
|
|
* for more than CVG_NWM_STA_NW_ASSOC_MEDIUM_TH.
|
|
*/
|
|
#define CVG_NWM_STA_NW_MEDIUM_MONITOR_CNT (2)
|
|
|
|
/* if no beacon slot assigned from CCO for some time, STA will leave current
|
|
* network and start network selection again. this value defined the time
|
|
* interval. unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_BC_TS_INTERVAL_MAX (4 * 60 * 60)
|
|
|
|
/* sta device data traffic collection duration for proxy selection. if data
|
|
* traffic collected within the duration, then the proxy selection duration
|
|
* will further be extened as required by CCO in vendor beacon entry. the
|
|
* unit is 1 beacon period.
|
|
*/
|
|
#define CVG_NWM_STA_PROXY_SEL_BC_DUR (1)
|
|
|
|
/* sta device network association beacon sync up duration. it's the time cvg
|
|
* start to wait for new beacon to sync up with the preferred network to the
|
|
* time the new beacon received. for every assoc req send, we need to make sure
|
|
* beacon is synced up, otherwise, mac layer scheduler won't be able to send
|
|
* out the packet. the unit is 1 beacon period.
|
|
*/
|
|
#define CVG_NWM_STA_ASSOC_SYNC_TO_DUR (20)
|
|
|
|
/* sta device network association timeout duration, it's the time cvg send
|
|
* out the assoc to the time cvg received the assoc conf. final assoc timeout
|
|
* duration is:
|
|
* min(CVG_NWM_STA_ASSOC_SEND_TO_DUR, CVG_NWM_STA_ASSOC_SEND_TO_DUR_MS).
|
|
* unit is 1 beacon period.
|
|
*/
|
|
#define CVG_NWM_STA_ASSOC_SEND_TO_DUR (3)
|
|
|
|
/* sta device network association timeout duration, it's the time cvg send
|
|
* out the assoc to the time cvg received the assoc conf. final assoc timeout
|
|
* duration is:
|
|
* min(CVG_NWM_STA_ASSOC_SEND_TO_DUR, CVG_NWM_STA_ASSOC_SEND_TO_DUR_MS).
|
|
* unit is 1ms.
|
|
*/
|
|
#define CVG_NWM_STA_ASSOC_SEND_TO_DUR_MS (15000)
|
|
|
|
/* sta device network authorization beacon sync up duration. it's the time cvg
|
|
* start to wait for new beacon to sync up with the preferred network to the
|
|
* time the new beacon received. for every auth req send, we need to make sure
|
|
* beacon is synced up, otherwise, mac layer scheduler won't be able to send
|
|
* out the packet. the unit is 1 beacon period.
|
|
*/
|
|
#define CVG_NWM_STA_AUTH_SYNC_TO_DUR (20)
|
|
|
|
/* sta device network authorization timeout duration, it's the time cvg send
|
|
* out the auth req to the time cvg received the auth conf. final auth timeout
|
|
* duration is:
|
|
* min(CVG_NWM_STA_AUTH_SEND_TO_DUR, CVG_NWM_STA_AUTH_SEND_TO_DUR_MS).
|
|
* unit is 1 beacon period.
|
|
*/
|
|
#define CVG_NWM_STA_AUTH_SEND_TO_DUR (3)
|
|
|
|
/* sta device network authorization timeout duration, it's the time cvg send
|
|
* out the auth req to the time cvg received the auth conf. final assoc timeout
|
|
* duration is:
|
|
* min(CVG_NWM_STA_AUTH_SEND_TO_DUR, CVG_NWM_STA_AUTH_SEND_TO_DUR_MS).
|
|
* unit is 1ms.
|
|
*/
|
|
#define CVG_NWM_STA_AUTH_SEND_TO_DUR_MS (15000)
|
|
|
|
/* sta device zero-crossing start collecting waiting duration. unit is 1s */
|
|
#define CVG_NWM_STA_ZC_CLCT_WAIT_DUR (8)
|
|
|
|
/* sta device network assoc retry allowed before restart network selection */
|
|
#define CVG_NWM_STA_ASSOC_RETRY_MAX (8)
|
|
|
|
/* sta device network assoc retry allowed before restart network selection */
|
|
#define CVG_NWM_STA_ASSOC_RETRY_MIN (3)
|
|
|
|
/* sta device network auth retry allowed before restart network selection */
|
|
#define CVG_NWM_STA_AUTH_RETRY_MAX (8)
|
|
|
|
/* sta device network auth retry allowed before restart network selection */
|
|
#define CVG_NWM_STA_AUTH_RETRY_MIN (3)
|
|
|
|
/* define sta new peer increase rate threshold, if new peer increase rate is
|
|
* bigger than this threshold, using smaller assoc retry count to speed up
|
|
* proxy selection and association
|
|
*/
|
|
#define CVG_NWM_STA_NEW_PEER_INC_TH (2)
|
|
|
|
/* sta device send heartbeat retry max count in fast connect mode. */
|
|
#define CVG_NWM_STA_FAST_HB_RPT_RETRY_MAX (5)
|
|
|
|
/* sta device force roaming retry max count */
|
|
#define CVG_NWM_STA_FORCE_ROAM_RETRY_MAX (3)
|
|
|
|
/* sta device roaming timeout retry max count in a route period. */
|
|
#define CVG_NWM_STA_ROAM_TIMEOUT_RETRY_MAX (2)
|
|
|
|
/* define extended delay time of leave indication mme for Guangdong test bed
|
|
* leave indication case. extend the offline time to ensure that the test bed
|
|
* can successfully read the meter before the sta is offline. unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_LEAVE_IND_EXT_DELAY_DUR (5)
|
|
|
|
/* define max delay deletion duration when direct sub-sta is kicked by cco.
|
|
* unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_LEAVE_DELAY_DEL_DUR_MAX (10)
|
|
|
|
/* according to smart grid spec, heart beat period is 2 * route period.
|
|
* sta should leave the network and restart the join process in following case:
|
|
*
|
|
* 1. if sta don't receive any beacon from the joined network in 1 heart beat
|
|
* period.
|
|
* 2. if the traffic success ratio between proxy and local device is 0 for 4
|
|
* consecutive route period.
|
|
* 3. if the joined network serial number changed.
|
|
* 4. sta received leave ind mme.
|
|
* 5. if local device is level 1 device and cco mac address changed for 1 route
|
|
* period.
|
|
* 6. if the role of proxy changed to sta for 1 route period.
|
|
* 7. proxy level is 15 which means local device level is bigger than 15.
|
|
*/
|
|
/* rule number 1 check threshold */
|
|
#define CVG_NWM_NO_BC_RX_CNT (2 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
/* rule number 2 check threshold */
|
|
#define CVG_NWM_PROXY_TF_0_CNT (4 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
/* rule number 5 check threshold */
|
|
#define CVG_NWM_CCO_ADDR_CHG_CNT (1 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
/* rule number 6 check threshold */
|
|
#define CVG_NWM_PROXY_STA_CNT (1 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
|
|
/* if downlink traffic success ratio with proxy is 0 for 2 consecutive route
|
|
* period, force roam to other possible proxy.
|
|
*/
|
|
#define CVG_NWM_PROXY_CHG_DL_TF_0_CNT (2 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
|
|
/* if uplink traffic success ratio with proxy is 0 for 3 consecutive route
|
|
* period, force roam to other possible proxy.
|
|
*/
|
|
#define CVG_NWM_PROXY_CHG_UL_TF_0_CNT (3 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
|
|
/* rule number 2 check threshold. in order to avoid leaving the network when
|
|
* rf discovery list period is too big than route period, need at least 8 rf
|
|
* discovery period to leave the network when rule number 2 is triggered.
|
|
* the threshold value take effect after peer is created. tf_sr == 0 for 8
|
|
* consecutive rf discovery period, sta will leave the network.
|
|
* CVG_NWM_RF_PROXY_TF_0_CNT >= (CVG_RT_RF_BM_INVALID_BITS +
|
|
* CVG_RT_RF_NM_RX_SR_TH1) + 4 rf discovery period.
|
|
*/
|
|
#define CVG_NWM_RF_PROXY_TF_0_CNT (8)
|
|
|
|
/* if rf downlink traffic success ratio with proxy is 0 for 6 consecutive rf
|
|
* discovery period, force roam to other possible proxy.
|
|
* the threshold value take effect after peer is created.
|
|
* CVG_NWM_RF_PROXY_CHG_DL_TF_0_CNT >= (CVG_RT_RF_BM_INVALID_BITS +
|
|
* CVG_RT_RF_NM_RX_SR_TH1) + 2 rf discovery period.
|
|
*/
|
|
#define CVG_NWM_RF_PROXY_CHG_DL_TF_0_CNT (6)
|
|
|
|
/* if rf uplink traffic success ratio with proxy is 0 for 6 consecutive rf
|
|
* discovery period, force roam to other possible proxy.
|
|
* the threshold value take effect after peer is created.
|
|
* CVG_NWM_RF_PROXY_CHG_UL_TF_0_CNT >= (CVG_RT_RF_BM_INVALID_BITS +
|
|
* CVG_RT_RF_NM_RX_SR_TH1) + 2 rf discovery period.
|
|
*/
|
|
#define CVG_NWM_RF_PROXY_CHG_UL_TF_0_CNT (6)
|
|
|
|
/* if direct connected sub sta of local device changed it's proxy to another
|
|
* device, local device should update the peer info and clean up the obsolete
|
|
* route entries. this macro defined the threshold for such change detection.
|
|
* the unit is partial route period. if local device keeps seeing the change in
|
|
* consecutive partial route period, it confirm the change is valid.
|
|
*/
|
|
#define CVG_NWM_D_SUB_STA_PROXY_CHG_CNT (CVG_RT_PARTIAL_RP_NUM + 2)
|
|
|
|
/* if role info of local device is out of sync with cco device, local device
|
|
* should update the local role info and clean up the obsolete sub sta info.
|
|
* this macro defined the threshold for such change detection.
|
|
* the unit is beacon period. if local device keeps seeing the change in
|
|
* consecutive beacon period, it confirm the change is valid.
|
|
*/
|
|
#define CVG_NWM_LOCAL_ROLE_CHG_CNT 20
|
|
|
|
/* if a remote peer of local device is not seen in hplc link (no discovery node
|
|
* list mme received) for some time, local device should clean up the peer info.
|
|
* this macro defined the threshold for such status detection.
|
|
* the unit is route period. if local device keeps seeing the status in
|
|
* consecutive route period, it confirm the status is valid and we should clean
|
|
* up the remote peer info.
|
|
* note that the clean up rule is not applicable to proxy and sub sta peers
|
|
* of local device.
|
|
*/
|
|
#define CVG_NWM_PEER_CLEANUP_CNT (3 * (CVG_RT_PARTIAL_RP_NUM + 1))
|
|
|
|
/* if a remote peer of local device is not seen in rf link (no discovery node
|
|
* list mme received) for some time, local device should clean up the peer info.
|
|
* this macro defined the threshold for such status detection.
|
|
* the unit is rf discovery node list period. if local device keeps seeing
|
|
* the status in consecutive rf discovery node list period, it confirm the
|
|
* status is valid and we should clean up the remote peer info.
|
|
* note that the clean up rule is not applicable to proxy and sub sta peers
|
|
* of local device.
|
|
*/
|
|
#define CVG_NWM_PEER_RF_CLEANUP_CNT (30)
|
|
|
|
/* the minimum interval between two consecutive network conflict report.
|
|
* set this value to a larger enough one to avoid network conflict report flood.
|
|
* the unit is 1 ms.
|
|
*/
|
|
#define CVG_NWM_NW_CONFLICT_RPT_INTERVAL (30 * 1000)
|
|
|
|
/* the minimum interval between two consecutive rf conflict report.
|
|
* set this value to a larger enough one to avoid network conflict report flood.
|
|
* the unit is 1s.
|
|
*/
|
|
#define CVG_NWM_RF_CONFLICT_RPT_INTERVAL (30)
|
|
|
|
/* the maximum interval between two consecutive rf conflict report.
|
|
* set this value to a larger enough one to avoid network conflict report flood.
|
|
* the unit is 1s.
|
|
*/
|
|
#define CVG_NWM_RF_CONFILICT_RPT_INTERVAL_MAX (3600)
|
|
|
|
/* as cco and sta have different clock source, the route period may be
|
|
* drifted so that sta and cco route period out of sync. to resolve the issue,
|
|
* sta should restart route period timer to sync up with cco periodically.
|
|
* this value defined the period for each route period sync up. the unit is
|
|
* 1 route period.
|
|
*/
|
|
#define CVG_NWM_STA_RP_SYNC_TH 1000
|
|
|
|
/* define neighbor network info life time for sta role device. if local sta
|
|
* role device hasn't seen this network till life time expired, the network
|
|
* info will be deleted. the unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_NN_INFO_EXPIRED_TH (20 * 60)
|
|
|
|
/* define neighbor network rf info life time for sta role device. if local sta
|
|
* role device hasn't seen this rf network till life time expired, the rf
|
|
* info will be deleted. the unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_RF_INFO_EXPIRED_DUR (20 * 60)
|
|
|
|
/* for PLC_SUPPORT_STA_TX_3_PHASE enabled case, if level 1 device phase X
|
|
* rx snr is higher than this value, level 1 device is allowed to tx in phase
|
|
* X time slot even if the main logical phase of the device is not phase X.
|
|
* unit is 1 db.
|
|
*/
|
|
#define CVG_NWM_STA_TX_3_PHASE_SNR_TH 19
|
|
|
|
/* after associated with a network for more than this duration, sta device
|
|
* should further enlarge the periodical roaming duration. unit is 1s.
|
|
*/
|
|
#define CVG_NWM_STA_ROAM_LEARNING_DUR (25 * 60)
|
|
|
|
/* after associated to the network, we need X route periods to learn
|
|
* the tx quality with the pco. sta should use both main hop and anchor hop
|
|
* for up link packets to CCO at the X route periods. this macro defined the X.
|
|
* the unit is 1 route period.
|
|
*/
|
|
#define CVG_NWM_STA_ANCHOR_VALID_TH 4
|
|
|
|
/* if set, hplc link has been evaluated for sta network selection */
|
|
#define CVG_NWM_STA_SEL_LINK_BM_PLC (1 << 0)
|
|
/* if set, rf link has been evaluated for sta network selection */
|
|
#define CVG_NWM_STA_SEL_LINK_BM_RF (1 << 1)
|
|
|
|
/* if STA device detect association prohibited X times for current selecting
|
|
* network, reselect the appropriate network. This macro defined the X.
|
|
*/
|
|
#define CVG_NWM_STA_FORBID_ASSOC_TH 3
|
|
|
|
/* define pipeline production test detecting timeout, unit is 1ms */
|
|
#define CVG_NWM_PT_DETECT_TIMEOUT_MIN (15 * 1000)
|
|
#define CVG_NWM_PT_DETECT_TIMEOUT_MAX (5 * 60 * 1000)
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_sta_info_to_mac() - set local tei & proxy tei
|
|
* & logical phase of the STA to mac.
|
|
* @param pdev_id: mac pdev id
|
|
* @param vdev_id: mac vdev id
|
|
* @param tei: tei
|
|
* @param proxy: proxy
|
|
* @param phase: phase
|
|
*/
|
|
void cvg_nwm_set_sta_info_to_mac(pdevid_t pdev_id, vdevid_t vdev_id,
|
|
uint16_t tei, uint16_t proxy, uint8_t phase);
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_bl_nid_to_mac() - set black list nid list to mac
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_set_bl_nid_to_mac(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_prefer_nid_to_mac() - set preferred nid to mac
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: preferred network id
|
|
* @param proxy: preferred proxy tei
|
|
*/
|
|
void cvg_nwm_set_prefer_nid_to_mac(cvg_nwm_vdev_t *nwm, uint32_t nid,
|
|
tei_t proxy);
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_dm_cfg_to_mac() - set dual mode tx config to mac
|
|
* @param nwm: nwm vdev pointer
|
|
* @param dm_tx_cfg: transmit config, 0 - invalid, 1 - async tx, 2 - sync tx
|
|
*/
|
|
void cvg_nwm_set_dm_cfg_to_mac(cvg_nwm_vdev_t *nwm, uint8_t dm_tx_cfg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_nw_valid_to_mac() - set nw valid to mac
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_set_nw_valid_to_mac(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_roam_check() - sta roam check.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param ignore_proxy: flag to mark if current proxy should be ignored while
|
|
* selecting the candidate proxy
|
|
* @param force_cnt: force roaming counter. if number of consecutive
|
|
* roaming request failed, local device will restart
|
|
* the state machine to restart network selection.
|
|
* @param roam_req: flag to mark if roam required
|
|
*/
|
|
void cvg_nwm_sta_roam_check(cvg_nwm_vdev_t *nwm, uint8_t ignore_proxy,
|
|
uint8_t force_cnt, uint8_t roam_req);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_hb_check() - sta heart beat check.
|
|
* @param nwm: nwm vdev pointer
|
|
* @retval: state
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_hb_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_switch_pco() - sta switch pco.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param tei: proxy tei
|
|
* @param link: link type between sta and proxy
|
|
* @param ps: path_sn
|
|
* @retval: 1 - state machine restart required
|
|
* @retval: 0 - otherwise
|
|
*/
|
|
uint8_t cvg_nwm_sta_switch_pco(cvg_nwm_vdev_t *nwm, tei_t proxy_tei, uint8_t link,
|
|
uint32_t path_sn);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_proxy_change_fwd_handle() - sta proxy change fwd handler.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param sta: sta tei
|
|
* @param proxy: proxy tei
|
|
* @param link: link type between sta and proxy
|
|
* @param sub_sta: sub sta tei bitmap
|
|
* @param path_sn: path_sn
|
|
*
|
|
* @retval: 0 - OK
|
|
* @retval: otherwise - error code
|
|
*/
|
|
uint32_t cvg_nwm_sta_proxy_change_fwd_handle(cvg_nwm_vdev_t *nwm, tei_t sta,
|
|
tei_t proxy, uint8_t link, cvg_tei_map_t *sub_sta, uint32_t path_sn);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_delete_duplicate_peer() - remove duplicate peer according
|
|
* to mac address. return non zero if state machine restart required.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param peer_tei: tei of the peer
|
|
* @param addr: mac address of the peer
|
|
*
|
|
* @retval: non zero if state machine restart required.
|
|
* @retval: 0 for else case.
|
|
*/
|
|
uint8_t cvg_nwm_sta_delete_duplicate_peer(cvg_nwm_vdev_t *nwm,
|
|
tei_t peer_tei, uint8_t *addr);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_update_remote_peer_info() - update remote peer info. note
|
|
* that this function may restart the whole state machine.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param peer: peer to be updated
|
|
* @param proxy: proxy tei of the peer
|
|
* @param role: role of the peer
|
|
* @param level: level of the peer
|
|
* @param rf_hop: rf hop of the peer
|
|
*
|
|
* @retval: next state of the whole state machine
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_update_remote_peer_info(
|
|
cvg_nwm_vdev_t *nwm, cvg_peer_info_t *peer, tei_t proxy, uint8_t role,
|
|
uint8_t level, uint8_t *rf_hop);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_update_local_peer_info() - update local peer info.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param sta_tei: sta tei
|
|
* @param proxy_tei: proxy tei
|
|
* @param link: link type between sta and proxy
|
|
* @param level: level
|
|
* @param path_number: path number
|
|
*
|
|
* @retval: 1 - state machine restart required
|
|
* @retval: 0 - otherwise
|
|
*/
|
|
uint8_t cvg_nwm_sta_update_local_peer_info(cvg_nwm_vdev_t *nwm,
|
|
tei_t sta_tei, tei_t proxy_tei, uint8_t link, uint8_t level,
|
|
uint32_t path_number);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_apply_rt_info() - sta apply rt info.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param path_sn: path sn
|
|
* @retval: 0 - valid info found
|
|
* @retval: 1 - valid info not found
|
|
*/
|
|
uint8_t cvg_nwm_sta_apply_rt_info(cvg_nwm_vdev_t *nwm, uint32_t path_sn);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_apply_sub_sta_rt_info() - sta apply sub sta rt info.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param sub_sta: sub sta
|
|
* @param path_sn: path sn
|
|
* @retval: 0 - valid info found
|
|
* @retval: 1 - valid info not found
|
|
*/
|
|
void cvg_nwm_sta_apply_sub_sta_rt_info(cvg_nwm_vdev_t *nwm,
|
|
tei_t sub_sta, uint32_t path_sn);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_cache_rt_info() - sta cache rt info.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param rt_info: route info
|
|
* @param rt_unit: route table unit, value is 1 or 2
|
|
* @retval: 0 - valid info found
|
|
* @retval: 1 - valid info not found
|
|
*/
|
|
uint8_t cvg_nwm_sta_cache_rt_info(cvg_nwm_vdev_t *nwm,
|
|
route_info_t *rt_info, uint8_t rt_unit);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_new_peer_check() - sta new peer check.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_sta_new_peer_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_leave_func() - sta leave network timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_leave_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_monitor_func() - sta monitor network timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_monitor_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief sta monitor network log timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_monitor_log_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief sta rf scan timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_rf_scan_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_bc_func() - sta join timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_bc_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_wdg_func() - sta watch dog timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_wdg_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_bl_clear_func() - sta black list timeout handle
|
|
* @param timer_id: timer id
|
|
* @param arg: cvg_nwm_vdev_t pointer
|
|
*/
|
|
void cvg_nwm_sta_bl_clear_func(timer_id_t timer_id, void *arg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_check_pco_in_blist() - check pco in blist.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: network id
|
|
* @retval: 0 - can not find blist for pco
|
|
* @retval: 1 - found
|
|
*/
|
|
uint32_t cvg_nwm_check_pco_in_blist(cvg_nwm_vdev_t *nwm,
|
|
uint32_t nid, tei_t pco_tei);
|
|
|
|
/**
|
|
* @brief cvg_nwm_add_cand_pco_to_blist() - add cand pco to blist.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_add_cand_pco_to_blist(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_set_candidate_pco() - set cand pco
|
|
* @param nwm: nwm vdev pointer
|
|
* @param pco: pco list
|
|
* @param cnt: counter
|
|
*/
|
|
void cvg_nwm_set_candidate_pco(cvg_nwm_vdev_t *nwm,
|
|
pco_link_info_t *pco, uint8_t cnt);
|
|
|
|
/**
|
|
* @brief cvg_nwm_get_candidate_pco() - get cand pco
|
|
* @param nwm: nwm vdev pointer
|
|
* @param pco: pco array pointer
|
|
* @retval: pco counter
|
|
*/
|
|
uint32_t cvg_nwm_get_candidate_pco(cvg_nwm_vdev_t *nwm, pco_link_info_t *pco);
|
|
|
|
/**
|
|
* @brief cvg_nwm_check_nid_in_blist() - check nid in blist.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: nid to be check
|
|
* @retval: NULL - if can not find this nid in blist
|
|
* @retval: nid blist - if find this nid in blist
|
|
*/
|
|
cvg_nwm_nid_blist *cvg_nwm_check_nid_in_blist(cvg_nwm_vdev_t *nwm,
|
|
uint32_t nid);
|
|
|
|
/**
|
|
* @brief cvg_nwm_add_nid_to_blist() - add nid to blist.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: nid
|
|
* @param network_sn: pointer to network sn
|
|
*/
|
|
void cvg_nwm_add_nid_to_blist(cvg_nwm_vdev_t *nwm, uint32_t nid,
|
|
uint8_t *network_sn);
|
|
|
|
/**
|
|
* @brief cvg_nwm_is_curr_nw_allow_bl() - whether to allow current network nid
|
|
* to be added to blist
|
|
* @param nwm: nwm vdev pointer
|
|
* @retval: 0 - not allow, 1 - allow
|
|
*/
|
|
uint8_t cvg_nwm_is_curr_nw_allow_bl(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_bp_cnt_check() - check if this is new bp count.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param bp_cnt: bp counter
|
|
* @param is_simple: flag to mark if it is simple beacon
|
|
* @retval: 0 - not new bp
|
|
* @retval: 1 - new bp
|
|
*/
|
|
uint8_t cvg_nwm_sta_bp_cnt_check(cvg_nwm_vdev_t *nwm, uint32_t bp_cnt,
|
|
uint8_t is_simple);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_nn_check() - check if any neighbor network info expired.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_sta_nn_check(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief remove neighbor network info from nid list.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: nid to be removed
|
|
*/
|
|
void cvg_nwm_sta_remove_nn_nid(cvg_nwm_vdev_t *nwm, uint32_t nid);
|
|
|
|
/**
|
|
* @brief check if good enough neighbor network exist.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param snr: snr to be checked for good enough network
|
|
* @return:
|
|
* 0 - good enough network not exist
|
|
* otherwise - good enough network exist
|
|
*/
|
|
uint8_t cvg_nwm_sta_is_nn_nid_good_enough(cvg_nwm_vdev_t *nwm, int8_t snr);
|
|
|
|
/**
|
|
* @brief get neighbor network info from nid list.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: nid to be searched
|
|
*/
|
|
cvg_nwm_sta_nw_info_t *cvg_nwm_sta_get_nn_info_by_nid(cvg_nwm_vdev_t *nwm,
|
|
uint32_t nid);
|
|
|
|
/**
|
|
* @brief get neighbor network info from nid list.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param mac_addr: cco mac address to be searched
|
|
*/
|
|
cvg_nwm_sta_nw_info_t *cvg_nwm_sta_get_nn_info_by_addr(cvg_nwm_vdev_t *nwm,
|
|
uint8_t *mac_addr);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_add_nn_nid() - add a neighbor network info include
|
|
* rf info into nid list.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param nid: nid
|
|
* @param rf_channel: rf channel
|
|
* @param peer_addr: pointer to sta mac address
|
|
* @param role: sta role
|
|
* @param level: sta level
|
|
* @param phase: logical phase of the snr. set to 0 if snr and phase
|
|
* info is not available.
|
|
* @param snr: rx snr of the network
|
|
* @param rssi: rx rssi of the network
|
|
* @param beacon_data: pointer to the beacon data if available
|
|
* @param cco_addr: pointer to cco mac address
|
|
* @param network_sn: pointer to network sn
|
|
* @param is_rf: flag to mark if it come from rf link
|
|
* @param rf_option: rf option
|
|
* @param band_id: hplc band id
|
|
*/
|
|
void cvg_nwm_sta_add_nn_nid(cvg_nwm_vdev_t *nwm, uint32_t nid,
|
|
uint8_t rf_channel, uint8_t *peer_addr, uint8_t role, uint8_t level,
|
|
uint8_t phase, int8_t snr, int8_t rssi, uint8_t *beacon_data,
|
|
uint8_t *cco_addr, uint8_t *network_sn, uint8_t is_rf, uint8_t rf_option,
|
|
uint8_t band_id);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_set_snr() - set local network snr.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param addr: sta mac address
|
|
* @param role: sta role
|
|
* @param level: sta level
|
|
* @param phase: logical phase of the snr.
|
|
* @param snr: rx snr of the network
|
|
* @param rssi: rx rssi of the network
|
|
* @param is_bcn: flag to mark if it is a beacon frame
|
|
* @param is_rf: flag to mark if it is come from rf link
|
|
*/
|
|
void cvg_nwm_sta_set_snr(cvg_nwm_vdev_t *nwm, uint8_t *addr, uint8_t role,
|
|
uint8_t level, uint8_t phase, int8_t snr, int8_t rssi, uint8_t is_bcn,
|
|
uint8_t is_rf);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_clear_nw_stat_info() - clear local and neighbor network
|
|
* statistic info.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_sta_clear_nw_stat_info(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_clear_nw_info() - clear local and neighbor network info.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param bc_cache_only: clean up beacon cache only
|
|
*/
|
|
void cvg_nwm_sta_clear_nw_info(cvg_nwm_vdev_t *nwm, uint8_t bc_cache_only);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_clear_best_nid_info() - clear best nid historical
|
|
* statistic.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_sta_clear_best_nid_info(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_restart_join_timer() - sta restart join timer.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param dur: duration
|
|
*/
|
|
void cvg_nwm_sta_restart_join_timer(cvg_nwm_vdev_t *nwm, uint32_t dur);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_stop_join_timer() - sta stop join timer.
|
|
* @param nwm: nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_sta_stop_join_timer(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_restart_monitor_timer() - sta restart monitor timer.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param dur: duration, unit 1ms
|
|
*/
|
|
void cvg_nwm_sta_restart_monitor_timer(cvg_nwm_vdev_t *nwm, uint32_t dur);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_switch_role() - swtich local device between
|
|
* either pco or sta role.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param role: role
|
|
*/
|
|
void cvg_nwm_sta_switch_role(cvg_nwm_vdev_t *nwm, uint8_t role);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_restart() - move sta role device back
|
|
to started status.
|
|
* @param nwm: nwm vdev pointer
|
|
* @param reason: restart reason. see CVG_VDEV_START_XXX
|
|
* @param cco_addr: next start preferred network mac address
|
|
*/
|
|
void cvg_nwm_sta_restart(cvg_nwm_vdev_t *nwm, uint8_t reason,
|
|
uint8_t *cco_addr);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_get_restart_prefer_cco_addr() - get prefer cco addr when
|
|
* sta vdev restart
|
|
* @param nwm: nwm vdev pointer
|
|
* @return: prefer cco addr
|
|
*/
|
|
uint8_t *cvg_nwm_sta_get_restart_prefer_cco_addr(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_set_bc_role() - set device role assigned by beacon
|
|
* @param vdev: vdev pointer
|
|
* @param role: role to be set. see PLC_DEV_ROLE_XXX
|
|
*/
|
|
void cvg_nwm_sta_set_bc_role(cvg_vdev_t *vdev, uint8_t role);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_is_debug_cco() - check if a cco is for debug purpose
|
|
* @param vdev: vdev pointer
|
|
* @param vendor: pointer to vendor beacon entry of the cco beacon
|
|
*
|
|
* @return
|
|
* 0 - is not debug cco
|
|
* 1 - is debug cco
|
|
*/
|
|
uint8_t cvg_nwm_sta_is_debug_cco(cvg_vdev_t *vdev,
|
|
mac_bc_vendor_spec_t *vendor);
|
|
|
|
/*
|
|
* @brief cvg_nwm_nid_blist_del_timeout() - delete nid in sta role device NID
|
|
* blacklist if timeout
|
|
* @param vdev: pointer of vdev
|
|
*/
|
|
void cvg_nwm_nid_blist_del_timeout(cvg_vdev_t *vdev);
|
|
|
|
/*
|
|
* @brief cvg_nwm_pco_blist_del_timeout() - delete pco in sta role device PCO
|
|
* blacklist if timeout
|
|
* @param vdev: pointer of vdev
|
|
*/
|
|
void cvg_nwm_pco_blist_del_timeout(cvg_vdev_t *vdev);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_get_best_nw_info() - get the best network
|
|
* info
|
|
* @param nwm: nwm vdev pointer
|
|
* @param big_diff: flag to mark if best network has big different with current
|
|
* network.
|
|
*
|
|
* @retval: best network info pointer
|
|
*/
|
|
cvg_nwm_sta_nw_info_t* cvg_nwm_sta_get_best_nw_info(cvg_nwm_vdev_t *nwm,
|
|
uint8_t *big_diff);
|
|
/**
|
|
* @brief cvg_nwm_sta_get_best_rf_nn_info() - get the best rf network
|
|
* info
|
|
* @param nwm: nwm vdev pointer
|
|
*
|
|
* @retval: best rf network info pointer
|
|
*/
|
|
cvg_nwm_sta_nw_info_t *cvg_nwm_sta_get_best_rf_nn_info(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_check_best_nw() - check local and neighbor networks,
|
|
* select the best network nid to join.
|
|
* @param nwm: pointer to nwm vdev
|
|
* @retval: next state
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_check_best_nw(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_check_zc_ntb_best_nw_ext() - check zc ntb tsfm best
|
|
* network
|
|
* @param nwm: pointer to nwm vdev
|
|
*/
|
|
void cvg_nwm_sta_check_zc_ntb_best_nw_ext(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_clear_zc_ntb_his() - clear zc ntb data history record
|
|
* @param clear_all: flag to mark if clear current data
|
|
* @param nwm: pointer to nwm vdev
|
|
*/
|
|
void cvg_nwm_sta_clear_zc_ntb_his(cvg_nwm_vdev_t *nwm, uint8_t clear_all);
|
|
|
|
/**
|
|
* @brief dump network state info
|
|
* @param nwm: pointer to nwm vdev
|
|
* @param nw_info: network info pointer
|
|
* @param nw_stat: buffer to receive the state info
|
|
*/
|
|
void cvg_nwm_sta_dump_nw_stat(cvg_nwm_vdev_t *nwm,
|
|
cvg_nwm_sta_nw_info_t *nw_info, mme_diag_tsfm_nw_stat_t *nw_stat);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_cl_check_msdu_rec() - check if this is a duplicate
|
|
* sof frame for connectionless mode.
|
|
* @param nwm: pointer to nwm vdev
|
|
* @param addr: original mac address
|
|
* @param msdu_sn: MSDU sequence number
|
|
* @param reboot_cnt: reboot count
|
|
* @retval: return non-zero if check failed
|
|
*/
|
|
uint8_t cvg_nwm_sta_cl_check_msdu_rec(cvg_nwm_vdev_t *nwm,
|
|
uint8_t *addr, uint16_t msdu_sn, uint8_t reboot_cnt);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_cl_fwd_bcast() - sta/pco device connectionless broadcast
|
|
* forwarding.
|
|
* @param nwm: pointer to nwm vdev
|
|
* @param buf: buf containing connectionless data
|
|
*/
|
|
void cvg_nwm_sta_cl_fwd_bcast(cvg_nwm_vdev_t *nwm, iot_pkt_t *buf);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_conn_less_handle() - handing connectionless data.
|
|
* @param nwm: - pointer to nwm vdev
|
|
* @param buf: - buffer containing connectionless data
|
|
* @param data: - pointer to connectionless data
|
|
* @param len: - data len.
|
|
* @param app_id: - application id of this msdu containing connectionless
|
|
* data.
|
|
* @retval: next state
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_conn_less_handle(cvg_nwm_vdev_t *nwm,
|
|
iot_pkt_t *buf, uint8_t *data, uint32_t len, uint8_t app_id);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_check_msdu_rec() - check if this is a duplicate sof frame
|
|
* for connection mode.
|
|
* @param nwm: pointer to nwm vdev
|
|
* @param org_src_tei: TEI of original source STA/CCO
|
|
* @param reboot_cnt: reboot count
|
|
* @param msdu_sn: MSDU sequence number
|
|
* @param send_type: send type. unicast or broadcast.
|
|
*
|
|
* @retval: return non-zero if check failed
|
|
*/
|
|
uint32_t cvg_nwm_sta_check_msdu_rec(cvg_nwm_vdev_t *nwm, tei_t org_src_tei,
|
|
uint8_t reboot_cnt, uint16_t msdu_sn, uint8_t send_type);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_clear_latest_cco_msdu_rec() - clear latest cco msdu rec.
|
|
* @param nwm: pointer to nwm vdev
|
|
*/
|
|
void cvg_nwm_sta_clear_latest_cco_msdu_rec(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_init_sta_vdev() - init sta vdev
|
|
* @param nwm: -- nwm vdev pointer
|
|
* @param cfg: -- vdev cfg pointer
|
|
* @return ERR_OK - for scuccess case
|
|
* @return otherwise - error code
|
|
*/
|
|
uint32_t cvg_nwm_init_sta_vdev(cvg_nwm_vdev_t *nwm, cvg_vdev_cfg_t *cfg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_deinit_sta_vdev() - deinit sta vdev
|
|
* @param nwm: -- nwm vdev pointer
|
|
*/
|
|
void cvg_nwm_deinit_sta_vdev(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_reset_sta_vdev() - reset sta vdev
|
|
* @param nwm: -- nwm vdev pointer
|
|
* @param cfg: -- vdev cfg pointer
|
|
*/
|
|
void cvg_nwm_reset_sta_vdev(cvg_nwm_vdev_t *nwm, cvg_vdev_cfg_t *cfg);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_check_proxy() - check if this a good proxy
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param tei: - station tei.
|
|
* @param addr: - station addr.
|
|
* @param phase: - staion phase.
|
|
* @param role: - station role.
|
|
* @param level: - station level.
|
|
* @param min_ul_dl_sr: - min_ul_dl_sr pf station.
|
|
* @param snr: - snr of packet of received form station.
|
|
* @param noise_floor: - noise floor of station.
|
|
* @param rf_hop: - station rf hop.
|
|
* @retval: return none zero if state machine restart required
|
|
*/
|
|
uint8_t cvg_nwm_sta_check_proxy(cvg_nwm_vdev_t *nwm,
|
|
tei_t tei, uint8_t addr[], uint8_t phase, uint8_t role,
|
|
uint8_t level, uint8_t min_ul_dl_sr, int8_t snr, uint8_t noise_floor,
|
|
uint8_t rf_hop);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_dis_node_rpt_as_bcn() - report discovered node to app,
|
|
* it comes from beacon
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param cap: - station capability entry parsed from the beacon.
|
|
* @param fp: - fixed info parsed from the beacon.
|
|
* @param fc: - frame control info parsed from the beacon.
|
|
*/
|
|
void cvg_nwm_sta_dis_node_rpt_as_bcn(cvg_nwm_vdev_t *nwm,
|
|
mac_bc_sta_cap_t *cap, mac_bc_fp_t *fp, mac_bc_fc_t *fc);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_start_hplc_timer() - hplc timer for network selection
|
|
* and joining
|
|
* @param nwm: -- nwm vdev pointer
|
|
* @param dur: -- duration time, unit is 1ms
|
|
*/
|
|
void cvg_nwm_sta_start_hplc_timer(cvg_nwm_vdev_t *nwm, uint32_t dur);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_start_rf_timer() - rf timer for network selection
|
|
* and joining
|
|
* @param nwm: -- nwm vdev pointer
|
|
* @param dur: -- duration time, unit is 1ms
|
|
*/
|
|
void cvg_nwm_sta_start_rf_timer(cvg_nwm_vdev_t *nwm, uint32_t dur);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_selecting_bc_rx_handle() - handling beacon info, in state
|
|
* machine "sta_state_selecting".
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param fc: - frame control info parsed from the beacon.
|
|
* @param fp: - fixed info parsed from the beacon.
|
|
* @param cap: - station capability entry parsed from the beacon.
|
|
* @param ts: - time slot parameters entry parsed from the beacon.
|
|
* @param rt: - routing parameters entry from the beacon.
|
|
* @param f_chg: - freq band change entry parsed from the beacon.
|
|
* @param rf_chg: - rf channel change entry parsed from the beacon.
|
|
* @param rf_rt: - rf routing parameters entry from the beacon.
|
|
* @param vendor: - vendor specified entry parsed from the beacon.
|
|
* @param bc_period - beacon period, uint is 1ms.
|
|
* @param is_new_bp: - return the flag to mark if this beacon is for a new
|
|
* beacon period
|
|
* @retval: next state of the whole state machine
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_selecting_bc_rx_handle(
|
|
cvg_nwm_vdev_t *nwm, mac_bc_fc_t *fc, mac_bc_fp_t *fp,
|
|
mac_bc_sta_cap_t *cap, mac_bc_time_slot_t *ts, mac_bc_rt_param_t *rt,
|
|
mac_bc_freq_chg_t *f_chg, mac_bc_rf_channel_chg_t *rf_chg,
|
|
mac_bc_rf_route_t *rf_rt, mac_bc_vendor_spec_t *vendor, uint32_t bc_period,
|
|
uint8_t *is_new_bp);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_selecting_bc_rx_handle() - handling beacon info, in state
|
|
* machine "sta_state_associating".
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param fc: - frame control info parsed from the beacon.
|
|
* @param fp: - fixed info parsed from the beacon.
|
|
* @param cap: - station capability entry parsed from the beacon.
|
|
* @param ts: - time slot parameters entry parsed from the beacon.
|
|
* @param rt: - routing parameters entry from the beacon.
|
|
* @param f_chg: - freq band change entry parsed from the beacon.
|
|
* @param rf_chg: - rf channel change entry parsed from the beacon.
|
|
* @param rf_rt: - rf routing parameters entry from the beacon.
|
|
* @param vendor: - vendor specified entry parsed from the beacon.
|
|
* @param is_new_bp: - return the flag to mark if this beacon is for a new
|
|
* beacon period
|
|
* @retval: next state of the whole state machine
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_associating_bc_rx_handle(
|
|
cvg_nwm_vdev_t *nwm, mac_bc_fc_t *fc, mac_bc_fp_t *fp,
|
|
mac_bc_sta_cap_t *cap, mac_bc_time_slot_t *ts, mac_bc_rt_param_t *rt,
|
|
mac_bc_freq_chg_t *f_chg, mac_bc_rf_channel_chg_t *rf_chg,
|
|
mac_bc_rf_route_t *rf_rt, mac_bc_vendor_spec_t *vendor, uint8_t *is_new_bp);
|
|
|
|
/**
|
|
* @brief cvg_nwm_sta_associated_bc_rx_handle() - handling beacon info, in state
|
|
* machine "sta_state_associated".
|
|
* @param nwm: - nwm vdev pointer
|
|
* @param rx_info - rx_info of the beacon.
|
|
* @param fc: - frame control info parsed from the beacon.
|
|
* @param fp: - fixed info parsed from the beacon.
|
|
* @param cap: - station capability entry parsed from the beacon.
|
|
* @param ts: - time slot parameters entry parsed from the beacon.
|
|
* @param rt: - routing parameters entry from the beacon.
|
|
* @param f_chg: - freq band change entry parsed from the beacon.
|
|
* @param rf_chg: - rf channel change entry parsed from the beacon.
|
|
* @param rf_rt: - rf routing parameters entry from the beacon.
|
|
* @param rtc: - rtc entry parsed from the beacon.
|
|
* @param vendor: - vendor specified entry parsed from the beacon.
|
|
* @param tx_req: - return flag to mark if beacon TX request for
|
|
* this beacon period.
|
|
* @param is_new_bp: - return the flag to mark if this beacon is for a new
|
|
* beacon period
|
|
* @retval: next state of the whole state machine
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_associated_bc_rx_handle(
|
|
cvg_nwm_vdev_t *nwm, mac_rx_info_t *rx_info, mac_bc_fc_t *fc,
|
|
mac_bc_fp_t *fp, mac_bc_sta_cap_t *cap, mac_bc_time_slot_t *ts,
|
|
mac_bc_rt_param_t *rt, mac_bc_freq_chg_t *f_chg,
|
|
mac_bc_rf_channel_chg_t *rf_chg, mac_bc_rf_route_t *rf_rt,
|
|
mac_bc_rtc_t *rtc, mac_bc_vendor_spec_t *vendor, uint8_t *tx_req,
|
|
uint8_t *is_new_bp);
|
|
|
|
/*
|
|
* @brief cvg_nwm_sta_check_cco_mac() - check current CCO address against white
|
|
* list and black list rule.
|
|
* @param nwm: nwm vdev pointer
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_sta_check_cco_mac(cvg_nwm_vdev_t *nwm);
|
|
|
|
/*
|
|
* @brief set prefer plc scan table according to neighbor network information
|
|
* @param nwm: pointer to nwm
|
|
*/
|
|
void cvg_nwm_sta_set_prefer_plc_scan(cvg_nwm_vdev_t *nwm);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_init() - sta state machine common function,
|
|
* in init state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_init(cvg_nwm_vdev_t *nwm,
|
|
cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_started() - sta state machine common function,
|
|
* in started state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_started(cvg_nwm_vdev_t *nwm,
|
|
cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_selecting() - sta state machine common function,
|
|
* in selecting state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_selecting(
|
|
cvg_nwm_vdev_t *nwm, cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_associating() - sta state machine common function,
|
|
* in associating state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_associating(
|
|
cvg_nwm_vdev_t *nwm, cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_associated() - sta state machine common function,
|
|
* in associated state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_associated(cvg_nwm_vdev_t *nwm,
|
|
cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_leaving() - sta state machine common function,
|
|
* in leaving state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_leaving(
|
|
cvg_nwm_vdev_t *nwm, cvg_vdev_event_t event, void *data);
|
|
|
|
/**
|
|
* @brief cvg_nwm_vdev_sm_sta_testing() - sta state machine common function,
|
|
* in testing state.
|
|
* @param nwm nwm vdev pointer
|
|
* @param event event to be delivered
|
|
* @param data data pointer of the event
|
|
* @retval: next state of the vdev.
|
|
*/
|
|
cvg_nwm_vdev_sta_state_t cvg_nwm_vdev_sm_sta_testing(
|
|
cvg_nwm_vdev_t *nwm, cvg_vdev_event_t event, void *data);
|
|
|
|
#else /* PLC_SUPPORT_STA_ROLE */
|
|
|
|
#define cvg_nwm_add_nid_to_blist(nwm, nid, network_sn)
|
|
|
|
#define cvg_nwm_init_sta_vdev(nwm, cfg) (ERR_NOSUPP)
|
|
|
|
#define cvg_nwm_deinit_sta_vdev(nwm)
|
|
|
|
#define cvg_nwm_reset_sta_vdev(nwm, cfg)
|
|
|
|
#endif /* PLC_SUPPORT_STA_ROLE */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* CVG_NWM_STA_COMMON_H */
|