- /* Allocate memory for xstats names and values */
- ret = rte_rawdev_xstats_names_get(
- cfg.ports[0].ioat_ids[0], NULL, 0);
- if (ret < 0)
- return;
- nb_xstats = (unsigned int)ret;
-
- names_xstats = malloc(sizeof(*names_xstats) * nb_xstats);
- if (names_xstats == NULL) {
- rte_exit(EXIT_FAILURE,
- "Error allocating xstat names memory\n");
- }
- rte_rawdev_xstats_names_get(cfg.ports[0].ioat_ids[0],
- names_xstats, nb_xstats);
-
- ids_xstats = malloc(sizeof(*ids_xstats) * 2);
- if (ids_xstats == NULL) {
- rte_exit(EXIT_FAILURE,
- "Error allocating xstat ids_xstats memory\n");
- }
-
- xstats = malloc(sizeof(*xstats) * 2);
- if (xstats == NULL) {
- rte_exit(EXIT_FAILURE,
- "Error allocating xstat memory\n");
- }
-
- /* Get failed/successful enqueues stats index */
- ids_xstats[0] = ids_xstats[1] = nb_xstats;
- for (i = 0; i < nb_xstats; i++) {
- if (!strcmp(names_xstats[i].name, "failed_enqueues"))
- ids_xstats[0] = i;
- else if (!strcmp(names_xstats[i].name, "successful_enqueues"))
- ids_xstats[1] = i;
- if (ids_xstats[0] < nb_xstats && ids_xstats[1] < nb_xstats)
- break;
- }
- if (ids_xstats[0] == nb_xstats || ids_xstats[1] == nb_xstats) {
- rte_exit(EXIT_FAILURE,
- "Error getting failed/successful enqueues stats index\n");
- }
-