Walks through the list which has all the flows * requesting for explicit flow counters. */
| 1026 | * requesting for explicit flow counters. |
| 1027 | */ |
| 1028 | int 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 | |
| 1076 | err: |
| 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); |
| 1082 | out: |
| 1083 | return rc; |
| 1084 | } |
no test coverage detected