MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bnxt_flow_stats_req

Function bnxt_flow_stats_req

dpdk/drivers/net/bnxt/bnxt_stats.c:1028–1084  ·  view source on GitHub ↗

Walks through the list which has all the flows * requesting for explicit flow counters. */

Source from the content-addressed store, hash-verified

1026 * requesting for explicit flow counters.
1027 */
1028int bnxt_flow_stats_req(struct bnxt *bp)
1029{
1030 int i;
1031 int rc = 0;
1032 struct rte_flow *flow;
1033 uint16_t in_flow_tbl_cnt = 0;
1034 struct bnxt_vnic_info *vnic = NULL;
1035 struct bnxt_filter_info *valid_en_tbl[bp->flow_stat->max_fc];
1036 uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC;
1037
1038 bnxt_acquire_flow_lock(bp);
1039 for (i = 0; i < bp->max_vnics; i++) {
1040 vnic = &bp->vnic_info[i];
1041 if (vnic && vnic->fw_vnic_id == INVALID_VNIC_ID)
1042 continue;
1043
1044 if (STAILQ_EMPTY(&vnic->flow_list))
1045 continue;
1046
1047 STAILQ_FOREACH(flow, &vnic->flow_list, next) {
1048 if (!flow || !flow->filter)
1049 continue;
1050
1051 valid_en_tbl[in_flow_tbl_cnt++] = flow->filter;
1052 if (in_flow_tbl_cnt >= bp->flow_stat->max_fc) {
1053 rc = bnxt_update_fc_tbl(bp, counter_type,
1054 valid_en_tbl,
1055 in_flow_tbl_cnt);
1056 if (rc)
1057 goto err;
1058 in_flow_tbl_cnt = 0;
1059 continue;
1060 }
1061 }
1062 }
1063
1064 if (!in_flow_tbl_cnt) {
1065 bnxt_release_flow_lock(bp);
1066 goto out;
1067 }
1068
1069 rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
1070 in_flow_tbl_cnt);
1071 if (!rc) {
1072 bnxt_release_flow_lock(bp);
1073 return 0;
1074 }
1075
1076err:
1077 /* If cmd fails once, no need of
1078 * invoking again every second
1079 */
1080 bnxt_release_flow_lock(bp);
1081 bnxt_cancel_fc_thread(bp);
1082out:
1083 return rc;
1084}

Callers 1

bnxt_flow_cnt_alarm_cbFunction · 0.85

Calls 2

bnxt_update_fc_tblFunction · 0.85
bnxt_cancel_fc_threadFunction · 0.85

Tested by

no test coverage detected