+
+ type_end = strrchr(xstats[j].name, '_');
+
+ if ((type_end != NULL) &&
+ (strncmp(xstats[j].name, "rx_", sizeof("rx_") - 1) == 0)) {
+
+ if (strncmp(type_end, "_errors", sizeof("_errors") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_rx_errors",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_dropped", sizeof("_dropped") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_rx_dropped",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_bytes", sizeof("_bytes") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_rx_octets",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_packets", sizeof("_packets") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_rx_packets",
+ sizeof(dpdkstat_vl.type));
+ } else {
+ /* Does not fit obvious type: use a more generic one */
+ sstrncpy (dpdkstat_vl.type, "derive",
+ sizeof(dpdkstat_vl.type));
+ }
+
+ } else if ((type_end != NULL) &&
+ (strncmp(xstats[j].name, "tx_", sizeof("tx_") - 1)) == 0) {
+
+ if (strncmp(type_end, "_errors", sizeof("_errors") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_tx_errors",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_dropped", sizeof("_dropped") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_tx_dropped",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_bytes", sizeof("_bytes") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_tx_octets",
+ sizeof(dpdkstat_vl.type));
+ } else if (strncmp(type_end, "_packets", sizeof("_packets") - 1) == 0) {
+ sstrncpy (dpdkstat_vl.type, "if_tx_packets",
+ sizeof(dpdkstat_vl.type));
+ } else {
+ /* Does not fit obvious type: use a more generic one */
+ sstrncpy (dpdkstat_vl.type, "derive",
+ sizeof(dpdkstat_vl.type));
+ }
+
+ } else {
+ /* Does not fit obvious type, or strrchr error:
+ * use a more generic type */
+ sstrncpy (dpdkstat_vl.type, "derive",
+ sizeof(dpdkstat_vl.type));
+ }
+