summaryrefslogtreecommitdiff
path: root/drivers/net/softnic
diff options
context:
space:
mode:
authorReshma Pattan <reshma.pattan@intel.com>2018-09-11 15:20:44 +0100
committerCristian Dumitrescu <cristian.dumitrescu@intel.com>2018-10-12 17:59:07 +0200
commita373200590de44deb98ad3f97889e24d4cb96424 (patch)
tree06d09d42fb9fac81e0bb9fed778e0e7dbb707f31 /drivers/net/softnic
parentbd0447d2c50a138467edf1231c339b19036ff870 (diff)
downloaddpdk-next-eventdev-a373200590de44deb98ad3f97889e24d4cb96424.zip
dpdk-next-eventdev-a373200590de44deb98ad3f97889e24d4cb96424.tar.gz
dpdk-next-eventdev-a373200590de44deb98ad3f97889e24d4cb96424.tar.xz
net/softnic: support flow query
Added pmd_flow_query() API, for flow query support. Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Diffstat (limited to 'drivers/net/softnic')
-rw-r--r--drivers/net/softnic/rte_eth_softnic_flow.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c
index 90387b3..bdf1d40 100644
--- a/drivers/net/softnic/rte_eth_softnic_flow.c
+++ b/drivers/net/softnic/rte_eth_softnic_flow.c
@@ -1654,8 +1654,63 @@ pmd_flow_destroy(struct rte_eth_dev *dev,
return 0;
}
+static int
+pmd_flow_query(struct rte_eth_dev *dev __rte_unused,
+ struct rte_flow *flow,
+ const struct rte_flow_action *action __rte_unused,
+ void *data,
+ struct rte_flow_error *error)
+{
+ struct rte_table_action_stats_counters stats;
+ struct softnic_table *table;
+ struct rte_flow_query_count *flow_stats = data;
+ int status;
+
+ /* Check input parameters. */
+ if (flow == NULL)
+ return rte_flow_error_set(error,
+ EINVAL,
+ RTE_FLOW_ERROR_TYPE_HANDLE,
+ NULL,
+ "Null flow");
+
+ if (data == NULL)
+ return rte_flow_error_set(error,
+ EINVAL,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ "Null data");
+
+ table = &flow->pipeline->table[flow->table_id];
+
+ /* Rule stats read. */
+ status = rte_table_action_stats_read(table->a,
+ flow->data,
+ &stats,
+ flow_stats->reset);
+ if (status)
+ return rte_flow_error_set(error,
+ EINVAL,
+ RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
+ NULL,
+ "Pipeline table rule stats read failed");
+
+ /* Fill in flow stats. */
+ flow_stats->hits_set =
+ (table->ap->params.stats.n_packets_enabled) ? 1 : 0;
+ flow_stats->bytes_set =
+ (table->ap->params.stats.n_bytes_enabled) ? 1 : 0;
+ flow_stats->hits = stats.n_packets;
+ flow_stats->bytes = stats.n_bytes;
+
+ return 0;
+}
+
const struct rte_flow_ops pmd_flow_ops = {
.validate = pmd_flow_validate,
.create = pmd_flow_create,
.destroy = pmd_flow_destroy,
+ .flush = NULL,
+ .query = pmd_flow_query,
+ .isolate = NULL,
};