BCM芯片FP之counter

本文介绍了一种使用BCM芯片进行特定类型数据流统计的方法。通过一系列调试命令,如fpinitfpgroupcreate、fpentrycreate等,实现了对字节和数据包类型的流统计。

BCM芯片可以针对某一特定类型的流进行统计,调试的命令如下:

fp init
fp group create 0 1
fp entry create 1 1
fp stat create group=1 type0=Bytes type1=Packets
fp stat attach entry=1 StatId=1 
fp entry install 1

fp stat set StatId=1 type=bytes val=0
fp stat get StatId=1 type=bytes

/** * Information about a specific remote entity, and the relation between the local and that remote * entity. Station Control Block. */ struct scb { uint32 flags; /**< various bit flags as defined below */ uint32 flags2; /**< various bit flags2 as defined below */ uint32 flags3; /**< various bit flags3 as defined below */ uint32 flags4; /**< various bit flags4 as defined below */ wlc_bsscfg_t *bsscfg; /**< bsscfg to which this scb belongs */ struct ether_addr ea; /**< station address, must be aligned */ uint16 flowid; /**< SW flowid per scb */ uint8 state; /**< current state bitfield of auth/assoc process */ uint8 mark; /**< various marking bitfield */ uint8 rx_lq_samp_req; /**< recv link quality sampling request - fast path */ bool PS:1; /**< remote STA in PS mode */ bool PS_TWT:1; /**< remote STA in TWT PS mode */ bool PS_MLO:1; /**< remote STA in PS mode on this link for MLO STA */ bool PS_AGE:1; /**< remote STA should age-out pkts in PS Q */ bool ps_txfifo_blk:1; /**< STA in PS and draining txfifo. block release */ bool apps_tx:1; /**< Set when Tx packets should go to APPS */ bool ampdu_tx:1; /**< Set when Tx packets should go to AMPDU */ bool vht_membership_state_change_flag:1; bool permanent:1; /**< scb should not be reclaimed */ bool pmkid_included:1; /* PMKID included in assoc request */ bool fifo_free_in_progress:1; /* Take 1 bit out of 'pmkid_included' */ bool dh_params_included:1; /* Diffie Hellman params included in assoc response */ #ifdef WL_MLO bool use_mld_addr:1; /* Use MLD addr instead of link addr for hdr conv */ bool mlo_fifo_alloced:1; /* check for mlo fifo alloc */ bool ml_ie_valid:1; #endif /* WL_MLO */ uint8 ps_pretend; /**< AP pretending STA is in PS mode */ /* SCB flow data */ tx_flow_data_t *txflows[NUMPRIO]; rx_flow_data_t *rxflows[NUMPRIO]; uint16 seqctl[NUMPRIO]; /**< seqctl of last received frame (for dups) */ uint16 seqctl_nonqos; /**< seqctl of last received frame (for dups) for * non-QoS data and management */ uint16 cap; /**< sta's advertized capability field */ uint32 pktc_pps; /**< pps counter for activating pktc */ uint used; /**< time of last use */ uint scb_long_timeout; /**< inactivity timeout for associated STA */ enum wlc_bandunit bandunit; /**< the band this scb belongs to */ uint32 WPA_auth; /**< WPA: authenticated key management */ uint32 wsec; /**< ucast security algo. should match key->algo. * Needed before key is set */ /* APSD configuration */ struct { uint16 maxsplen; /**< Maximum Service Period Length from assoc req */ ac_bitmap_t ac_defl; /**< Bitmap of ACs enabled for APSD from assoc req */ ac_bitmap_t ac_trig; /**< Bitmap of ACs currently trigger-enabled */ ac_bitmap_t ac_delv; /**< Bitmap of ACs currently delivery-enabled */ } apsd; uint8 auth_alg; /**< 802.11 authentication mode */ #if defined(WL_PUQ) uint16 puq_idx[NUMPRIO]; /* We need a uint16 puq_idx to accommodate a uint16 * PUQMGR_PUQ_IDX_INV value. */ uint8 puq_deact_pending_map; /**< PUQ unhook/deact pending per TID(each bit) */ #endif /* WL_PUQ */ uint8 fifo_idx[AC_COUNT]; #ifdef WL_SAE uint16 peer_group; /* Peer SAE group */ #endif /* WL_SAE */ uint8 ac_suspend; dh_params_ie_t *dh_params; wlc_if_t *wds; /**< per-port WDS cookie */ wl_if_stats_t *if_stats; /* it's allocated as an array, use 'delay_stats + ac' to access per ac element! */ scb_delay_stats_t *delay_stats; /**< per-AC delay stats (allocated as scb cubby) */ txdelay_params_t *txdelay_params; /* WLPKTDLYSTAT_IND */ uint8 sup_chan_width; /**< VHT only. Channel width supported */ uint8 ext_nss_bw_sup; /* IEEE 802.11 REVmc Draft 8.0 EXT_NSS_BW support */ uint8 trf_enable_flag; /* This variable stores the bit map of type whose * stats are being maintained for txfail event */ int8 rssi; /* rssi for the received pkt */ wlc_scb_stats_t scb_stats; /* WLCNTSCB */ #ifdef WL_MLO wlc_scb_mlo_stats_t *mlo_stats; /* Stats for MLO */ struct ether_addr mld_addr; #endif /* WL_MLO */ #ifdef WL_TRAFFIC_THRESH struct scb_trf_info scb_trf_data[WL_TRF_MAX_QUEUE]; #endif // endif #ifdef WLSCB_HISTO wl_rate_histo_maps2_t *histo; /**< mapped histogram of rates */ #endif /* WLSCB_HISTO */ #if defined(WLATM_PERC) uint16 sched_staperc; /* Schedule context airtime percentage of sta */ #endif /* WLATM_PERC */ int16 pkts_inflt_fifocnt[NUMPRIO]; int32 pkts_inflt_fifocnt_all; int32 pkts_inflt_cqcnt[NUMPRIO]; uint8 fifo_inflt[NUMPRIO]; #ifdef WLTAF int16 utxd_inflt; /* # of utxd in ULMU TRIG fifo */ #endif // endif uint8 dropblock_dur; /* drop and block during new key process */ #ifdef MULTIAP uint8 map_profile; /* MultiAP-Profile SCB_MAP_PROFILE_X */ #endif /* MULTIAP */ #if defined(WL_PS_STATS) || defined(WL_PS_STATS_MIN) /* PS counters */ scb_ps_stats_t *ps_stats; #endif /* WL_PS_STATS || WL_PS_STATS_MIN */ #ifdef BCM_CSIMON wlc_csimon_sta_t *csimon; /* CSI Monitor info for this SCB */ #endif // endif rsnxe_ie_info_t *rsnxe_info; /* STA rsnxe IE info */ bcm_tlv_t *rsn_ie; /* RSN IE included in assoc response for OWE */ #if defined(WLCNTSCB) wlc_scb_rate_stats_t *scb_rate_stats; #endif /* WLCNTSCB */ /* CFP */ dll_t cfp_rx_node; /* for CFP RX binning, chained sendup */ /* SCB Critical data */ scb_cd_t crit; #ifdef WL_CS_RESTRICT_RELEASE uint16 restrict_txwin; /* WL_CS_RESTRICT_RELEASE */ uint8 restrict_deadline; /* WL_CS_RESTRICT_RELEASE */ #endif /* WL_CS_RESTRICT_RELEASE */ #ifdef WL_PKTDROP_STATS wlc_pktdrop_full_counters_t *pktdrop_full_counters; #endif /* WL_PKTDROP_STATS */ #ifdef WL_EAP_STATS struct ether_addr reassoc_ap; /* Previous assoc BSSID */ #endif /* WL_EAP_STATS */ #if defined(STA) && defined(DBG_BCN_LOSS) struct wlc_scb_dbg_bcn dbg_bcn; #endif // endif #ifdef BCMDBG uint32 ac_suspend_start; bool msg_macfltr; /* Debug message mac filter */ #endif /* BCMDBG */ struct scb_non_critical *generic_sec_handle; /* non-critical data, usually in DDR */ uint8 username[RADIUS_USERNAME_LEN]; };解析这个结构体
最新发布
10-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值