+static void
+bnxt_setup_flow_counter(struct bnxt *bp)
+{
+ if (bp->fw_cap & BNXT_FW_CAP_ADV_FLOW_COUNTERS &&
+ !(bp->flags & BNXT_FLAG_FC_THREAD) && BNXT_FLOW_XSTATS_EN(bp)) {
+ rte_eal_alarm_set(US_PER_S * BNXT_FC_TIMER,
+ bnxt_flow_cnt_alarm_cb,
+ (void *)bp);
+ bp->flags |= BNXT_FLAG_FC_THREAD;
+ }
+}
+
+void bnxt_flow_cnt_alarm_cb(void *arg)
+{
+ int rc = 0;
+ struct bnxt *bp = arg;
+
+ if (!bp->flow_stat->rx_fc_out_tbl.va) {
+ PMD_DRV_LOG(ERR, "bp->flow_stat->rx_fc_out_tbl.va is NULL?\n");
+ bnxt_cancel_fc_thread(bp);
+ return;
+ }
+
+ if (!bp->flow_stat->flow_count) {
+ bnxt_cancel_fc_thread(bp);
+ return;
+ }
+
+ if (!bp->eth_dev->data->dev_started) {
+ bnxt_cancel_fc_thread(bp);
+ return;
+ }
+
+ rc = bnxt_flow_stats_req(bp);
+ if (rc) {
+ PMD_DRV_LOG(ERR, "Flow stat alarm not rescheduled.\n");
+ return;
+ }
+
+ rte_eal_alarm_set(US_PER_S * BNXT_FC_TIMER,
+ bnxt_flow_cnt_alarm_cb,
+ (void *)bp);
+}
+
+