+ struct find_ctx *ctx = data;
+
+ if (strcmp(ctx->name, xstats_name) == 0) {
+ if (ctx->id != NULL)
+ *ctx->id = xstats_id;
+ dsw_xstats_get(ctx->dev, mode, queue_port_id, &xstats_id,
+ &ctx->value, 1);
+ }
+}
+
+uint64_t
+dsw_xstats_get_by_name(const struct rte_eventdev *dev, const char *name,
+ unsigned int *id)
+{
+ struct dsw_evdev *dsw = dsw_pmd_priv(dev);
+ uint16_t port_id;
+
+ struct find_ctx ctx = {
+ .dev = dev,
+ .name = name,
+ .id = id,
+ .value = -EINVAL
+ };
+
+ dsw_xstats_dev_foreach(dsw_xstats_find_stat, &ctx);
+
+ for (port_id = 0; port_id < dsw->num_ports; port_id++)
+ dsw_xstats_port_foreach(dsw, port_id, dsw_xstats_find_stat,
+ &ctx);
+
+ return ctx.value;