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

Function nfp_flow_stats_get

dpdk/drivers/net/nfp/nfp_flow.c:4158–4205  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4156}
4157
4158static void
4159nfp_flow_stats_get(struct rte_eth_dev *dev,
4160 struct rte_flow *nfp_flow,
4161 void *data)
4162{
4163 bool reset;
4164 uint64_t cookie;
4165 uint32_t ctx_id;
4166 struct rte_flow *flow;
4167 struct nfp_flow_priv *priv;
4168 struct nfp_fl_stats *stats;
4169 struct nfp_ct_map_entry *me;
4170 struct rte_flow_query_count *query;
4171
4172 priv = nfp_flow_dev_to_priv(dev);
4173 flow = nfp_flow_table_search(priv, nfp_flow);
4174 if (flow == NULL) {
4175 PMD_DRV_LOG(ERR, "Can not find statistics for this flow.");
4176 return;
4177 }
4178
4179 query = data;
4180 reset = query->reset;
4181 memset(query, 0, sizeof(*query));
4182
4183 /* Find the flow in ct_map_table */
4184 cookie = rte_be_to_cpu_64(nfp_flow->payload.meta->host_cookie);
4185 me = nfp_ct_map_table_search(priv, (char *)&cookie, sizeof(uint64_t));
4186 if (me != NULL) {
4187 stats = nfp_ct_flow_stats_get(priv, me);
4188 } else {
4189 ctx_id = rte_be_to_cpu_32(nfp_flow->payload.meta->host_ctx_id);
4190 stats = &priv->stats[ctx_id];
4191 }
4192
4193 rte_spinlock_lock(&priv->stats_lock);
4194 if (stats->pkts != 0 && stats->bytes != 0) {
4195 query->hits = stats->pkts;
4196 query->bytes = stats->bytes;
4197 query->hits_set = 1;
4198 query->bytes_set = 1;
4199 if (reset) {
4200 stats->pkts = 0;
4201 stats->bytes = 0;
4202 }
4203 }
4204 rte_spinlock_unlock(&priv->stats_lock);
4205}
4206
4207static int
4208nfp_flow_query(struct rte_eth_dev *dev,

Callers 1

nfp_flow_queryFunction · 0.85

Calls 7

nfp_flow_dev_to_privFunction · 0.85
nfp_flow_table_searchFunction · 0.85
memsetFunction · 0.85
nfp_ct_map_table_searchFunction · 0.85
nfp_ct_flow_stats_getFunction · 0.85
rte_spinlock_lockFunction · 0.50
rte_spinlock_unlockFunction · 0.50

Tested by

no test coverage detected