src/dpdk/drivers/net/bnxt/bnxt_stats.c
int bnxt_flow_stats_req(struct bnxt *bp)
{
	int i;
	int rc = 0;
	struct rte_flow *flow;
	uint16_t in_flow_tbl_cnt = 0;
	struct bnxt_vnic_info *vnic = NULL;
	struct bnxt_filter_info *valid_en_tbl[bp->flow_stat->max_fc];
	uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC;

	bnxt_acquire_flow_lock(bp);
	for (i = 0; i < bp->max_vnics; i++) {
		vnic = &bp->vnic_info[i];
		if (vnic && vnic->fw_vnic_id == INVALID_VNIC_ID)
			continue;

		if (STAILQ_EMPTY(&vnic->flow_list))
			continue;

		STAILQ_FOREACH(flow, &vnic->flow_list, next) {
			if (!flow || !flow->filter)
				continue;

			valid_en_tbl[in_flow_tbl_cnt++] = flow->filter;
			if (in_flow_tbl_cnt >= bp->flow_stat->max_fc) {
				rc = bnxt_update_fc_tbl(bp, counter_type,
							valid_en_tbl,
							in_flow_tbl_cnt);
				if (rc)
					goto err;
				in_flow_tbl_cnt = 0;
				continue;
			}
		}
	}

	if (!in_flow_tbl_cnt) {
		bnxt_release_flow_lock(bp);
		goto out;
	}

	rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
				in_flow_tbl_cnt);
	if (!rc) {
		bnxt_release_flow_lock(bp);
		return 0;
	}

err:
	/* If cmd fails once, no need of
	 * invoking again every second
	 */
	bnxt_release_flow_lock(bp);
	bnxt_cancel_fc_thread(bp);
out:
	return rc;
}
/* Walks through the list which has all the flows
 * requesting for explicit flow counters.
 */
Walks through the list which has all the flows
requesting for explicit flow counters.
Walks through the list which has all the flows requesting for explicit flow counters .
int bnxt_flow_stats_req(struct bnxt *bp)
{
	int i;
	int rc = 0;
	struct rte_flow *flow;
	uint16_t in_flow_tbl_cnt = 0;
	struct bnxt_vnic_info *vnic = NULL;
	struct bnxt_filter_info *valid_en_tbl[bp->flow_stat->max_fc];
	uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC;
	bnxt_acquire_flow_lock(bp);
	for (i = 0; i < bp->max_vnics; i++) {
		vnic = &bp->vnic_info[i];
		if (vnic && vnic->fw_vnic_id == INVALID_VNIC_ID)
			continue;
		if (STAILQ_EMPTY(&vnic->flow_list))
			continue;
		STAILQ_FOREACH(flow, &vnic->flow_list, next) {
			if (!flow || !flow->filter)
				continue;
			valid_en_tbl[in_flow_tbl_cnt++] = flow->filter;
			if (in_flow_tbl_cnt >= bp->flow_stat->max_fc) {
				rc = bnxt_update_fc_tbl(bp, counter_type,
							valid_en_tbl,
							in_flow_tbl_cnt);
				if (rc)
					goto err;
				in_flow_tbl_cnt = 0;
				continue;
			}
		}
	}
	if (!in_flow_tbl_cnt) {
		bnxt_release_flow_lock(bp);
		goto out;
	}
	rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
				in_flow_tbl_cnt);
	if (!rc) {
		bnxt_release_flow_lock(bp);
		return 0;
	}
err:
	bnxt_release_flow_lock(bp);
	bnxt_cancel_fc_thread(bp);
out:
	return rc;
}
int bnxt_flow_stats_req ( struct bnxt * bp ) { int i ; int rc = 0 ; struct rte_flow * flow ; uint16_t in_flow_tbl_cnt = 0 ; struct bnxt_vnic_info * vnic = NULL ; struct bnxt_filter_info * valid_en_tbl [ bp -> flow_stat -> max_fc ] ; uint16_t counter_type = CFA_COUNTER_CFG_IN_COUNTER_TYPE_FC ; bnxt_acquire_flow_lock ( bp ) ; for ( i = 0 ; i < bp -> max_vnics ; i ++ ) { vnic = & bp -> vnic_info [ i ] ; if ( vnic && vnic -> fw_vnic_id == INVALID_VNIC_ID ) continue ; if ( STAILQ_EMPTY ( & vnic -> flow_list ) ) continue ; STAILQ_FOREACH ( flow , & vnic -> flow_list , next ) { if ( ! flow || ! flow -> filter ) continue ; valid_en_tbl [ in_flow_tbl_cnt ++ ] = flow -> filter ; if ( in_flow_tbl_cnt >= bp -> flow_stat -> max_fc ) { rc = bnxt_update_fc_tbl ( bp , counter_type , valid_en_tbl , in_flow_tbl_cnt ) ; if ( rc ) goto err ; in_flow_tbl_cnt = 0 ; continue ; } } } if ( ! in_flow_tbl_cnt ) { bnxt_release_flow_lock ( bp ) ; goto out ; } rc = bnxt_update_fc_tbl ( bp , counter_type , valid_en_tbl , in_flow_tbl_cnt ) ; if ( ! rc ) { bnxt_release_flow_lock ( bp ) ; return 0 ; } err : bnxt_release_flow_lock ( bp ) ; bnxt_cancel_fc_thread ( bp ) ; out : return rc ; }
Walks through the list which has all the flows
 requesting for explicit flow counters.
Walks through the list which has all the flows requesting for explicit flow counters .
/* If cmd fails once, no need of
	 * invoking again every second
	 */