@@ -34,6 +34,7 @@ Inner L4 checksum = Y
Packet type parsing = Y
Basic stats = Y
Stats per queue = Y
+Extended stats = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
@@ -32,6 +32,7 @@ Inner L4 checksum = Y
Packet type parsing = Y
Basic stats = Y
Stats per queue = Y
+Extended stats = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
@@ -29,6 +29,7 @@ Inner L4 checksum = Y
Packet type parsing = Y
Basic stats = Y
Stats per queue = Y
+Extended stats = Y
Module EEPROM dump = Y
Linux = Y
ARMv8 = Y
@@ -1170,6 +1170,11 @@ struct eth_dev_ops cnxk_eth_dev_ops = {
.queue_stats_mapping_set = cnxk_nix_queue_stats_mapping,
.stats_get = cnxk_nix_stats_get,
.stats_reset = cnxk_nix_stats_reset,
+ .xstats_get = cnxk_nix_xstats_get,
+ .xstats_get_names = cnxk_nix_xstats_get_names,
+ .xstats_reset = cnxk_nix_xstats_reset,
+ .xstats_get_by_id = cnxk_nix_xstats_get_by_id,
+ .xstats_get_names_by_id = cnxk_nix_xstats_get_names_by_id,
};
static int
@@ -279,6 +279,17 @@ int cnxk_nix_queue_stats_mapping(struct rte_eth_dev *dev, uint16_t queue_id,
uint8_t stat_idx, uint8_t is_rx);
int cnxk_nix_stats_reset(struct rte_eth_dev *dev);
int cnxk_nix_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats);
+int cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat *xstats, unsigned int n);
+int cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit);
+int cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat_name *xstats_names,
+ const uint64_t *ids, unsigned int limit);
+int cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
+ uint64_t *values, unsigned int n);
+int cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev);
/* Lookup configuration */
const uint32_t *cnxk_nix_supported_ptypes_get(struct rte_eth_dev *eth_dev);
@@ -83,3 +83,135 @@ cnxk_nix_queue_stats_mapping(struct rte_eth_dev *eth_dev, uint16_t queue_id,
return 0;
}
+
+int
+cnxk_nix_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *xstats,
+ unsigned int n)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix_xstat roc_xstats[n];
+ int size, i;
+
+ size = roc_nix_xstats_get(&dev->nix, roc_xstats, n);
+
+ /* If requested array do not have space then return with count */
+ if (size < 0 || size > (int)n)
+ return size;
+
+ for (i = 0; i < size; i++) {
+ xstats[i].id = roc_xstats[i].id;
+ xstats[i].value = roc_xstats[i].value;
+ }
+
+ return size;
+}
+
+int
+cnxk_nix_xstats_get_names(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat_name *xstats_names,
+ unsigned int limit)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix_xstat_name roc_xstats_name[limit];
+ struct roc_nix *nix = &dev->nix;
+ int size, i;
+
+ if ((int)limit < roc_nix_num_xstats_get(nix) && xstats_names == NULL)
+ return roc_nix_num_xstats_get(nix);
+
+ size = roc_nix_xstats_names_get(nix, roc_xstats_name, limit);
+
+ for (i = 0; i < size; i++)
+ strlcpy(xstats_names[i].name, roc_xstats_name[i].name,
+ sizeof(xstats_names[i].name));
+
+ return size;
+}
+
+int
+cnxk_nix_xstats_get_names_by_id(struct rte_eth_dev *eth_dev,
+ struct rte_eth_xstat_name *xstats_names,
+ const uint64_t *ids, unsigned int limit)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ uint32_t xstat_cnt = roc_nix_num_xstats_get(&dev->nix), i;
+ struct roc_nix_xstat_name xnames[xstat_cnt];
+
+ if (limit < xstat_cnt && ids == NULL)
+ return xstat_cnt;
+
+ if (limit > xstat_cnt)
+ return -EINVAL;
+
+ if (xstats_names == NULL)
+ return -ENOMEM;
+
+ roc_nix_xstats_names_get(&dev->nix, xnames, limit);
+
+ for (i = 0; i < xstat_cnt; i++) {
+ if (ids[i] >= xstat_cnt)
+ return -EINVAL;
+
+ strlcpy(xstats_names[i].name, xnames[ids[i]].name,
+ sizeof(xstats_names[i].name));
+ }
+
+ return limit;
+}
+
+int
+cnxk_nix_xstats_get_by_id(struct rte_eth_dev *eth_dev, const uint64_t *ids,
+ uint64_t *values, unsigned int n)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ uint32_t xstat_cnt = roc_nix_num_xstats_get(&dev->nix), i;
+ struct roc_nix_xstat xstats[xstat_cnt];
+
+ if (n < xstat_cnt && ids == NULL)
+ return xstat_cnt;
+
+ if (n > xstat_cnt)
+ return -EINVAL;
+
+ if (values == NULL)
+ return -ENOMEM;
+
+ roc_nix_xstats_get(&dev->nix, xstats, n);
+
+ for (i = 0; i < xstat_cnt; i++) {
+ if (ids[i] >= xstat_cnt)
+ return -EINVAL;
+ values[i] = xstats[ids[i]].value;
+ }
+
+ return n;
+}
+
+int
+cnxk_nix_xstats_reset(struct rte_eth_dev *eth_dev)
+{
+ struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
+ struct roc_nix *nix = &dev->nix;
+ int rc = 0, i;
+
+ rc = roc_nix_stats_reset(nix);
+ if (rc)
+ goto exit;
+
+ /* Reset Rx Queues */
+ for (i = 0; i < dev->nb_rxq; i++) {
+ rc = roc_nix_stats_queue_reset(nix, i, 1);
+ if (rc)
+ goto exit;
+ }
+
+ /* Reset Tx Queues */
+ for (i = 0; i < dev->nb_txq; i++) {
+ rc = roc_nix_stats_queue_reset(nix, i, 0);
+ if (rc)
+ goto exit;
+ }
+
+exit:
+ return rc;
+}