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

Function rte_pipeline_table_stats_read

dpdk/lib/pipeline/rte_pipeline.c:1567–1610  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1565}
1566
1567int rte_pipeline_table_stats_read(struct rte_pipeline *p, uint32_t table_id,
1568 struct rte_pipeline_table_stats *stats, int clear)
1569{
1570 struct rte_table *table;
1571 int retval;
1572
1573 if (p == NULL) {
1574 RTE_LOG(ERR, PIPELINE, "%s: pipeline parameter NULL\n",
1575 __func__);
1576 return -EINVAL;
1577 }
1578
1579 if (table_id >= p->num_tables) {
1580 RTE_LOG(ERR, PIPELINE,
1581 "%s: table %u is out of range\n", __func__, table_id);
1582 return -EINVAL;
1583 }
1584
1585 table = &p->tables[table_id];
1586 if (table->ops.f_stats != NULL) {
1587 retval = table->ops.f_stats(table->h_table, &stats->stats, clear);
1588 if (retval != 0)
1589 return retval;
1590 } else if (stats != NULL)
1591 memset(&stats->stats, 0, sizeof(stats->stats));
1592
1593 if (stats != NULL) {
1594 stats->n_pkts_dropped_by_lkp_hit_ah =
1595 table->n_pkts_dropped_by_lkp_hit_ah;
1596 stats->n_pkts_dropped_by_lkp_miss_ah =
1597 table->n_pkts_dropped_by_lkp_miss_ah;
1598 stats->n_pkts_dropped_lkp_hit = table->n_pkts_dropped_lkp_hit;
1599 stats->n_pkts_dropped_lkp_miss = table->n_pkts_dropped_lkp_miss;
1600 }
1601
1602 if (clear != 0) {
1603 table->n_pkts_dropped_by_lkp_hit_ah = 0;
1604 table->n_pkts_dropped_by_lkp_miss_ah = 0;
1605 table->n_pkts_dropped_lkp_hit = 0;
1606 table->n_pkts_dropped_lkp_miss = 0;
1607 }
1608
1609 return 0;
1610}

Callers 2

Calls 1

memsetFunction · 0.85

Tested by

no test coverage detected