[v3,09/13] net/ngbe: add Tx descriptor error statistics
Checks
Commit Message
Count the number of packets not sent due to Tx descriptor error.
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/ngbe/ngbe_ethdev.c | 13 +++++++++++++
drivers/net/ngbe/ngbe_rxtx.c | 2 ++
drivers/net/ngbe/ngbe_rxtx.h | 1 +
3 files changed, 16 insertions(+)
@@ -1507,6 +1507,7 @@ ngbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev);
struct ngbe_stat_mappings *stat_mappings =
NGBE_DEV_STAT_MAPPINGS(dev);
+ struct ngbe_tx_queue *txq;
uint32_t i, j;
ngbe_read_stats_registers(hw, hw_stats);
@@ -1559,6 +1560,11 @@ ngbe_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
/* Tx Errors */
stats->oerrors = 0;
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ txq = dev->data->tx_queues[i];
+ stats->oerrors += txq->desc_error;
+ }
+
return 0;
}
@@ -1567,6 +1573,13 @@ ngbe_dev_stats_reset(struct rte_eth_dev *dev)
{
struct ngbe_hw *hw = ngbe_dev_hw(dev);
struct ngbe_hw_stats *hw_stats = NGBE_DEV_STATS(dev);
+ struct ngbe_tx_queue *txq;
+ uint32_t i;
+
+ for (i = 0; i < dev->data->nb_tx_queues; i++) {
+ txq = dev->data->tx_queues[i];
+ txq->desc_error = 0;
+ }
/* HW registers are cleared on read */
hw->offset_loaded = 0;
@@ -629,6 +629,7 @@ ngbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
tx_pkt = *tx_pkts++;
if (ngbe_check_pkt_err(tx_pkt)) {
rte_pktmbuf_free(tx_pkt);
+ txq->desc_error++;
continue;
}
@@ -2100,6 +2101,7 @@ ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
ngbe_set_tx_function(dev, txq);
txq->ops->reset(txq);
+ txq->desc_error = 0;
dev->data->tx_queues[queue_idx] = txq;
@@ -375,6 +375,7 @@ struct ngbe_tx_queue {
const struct ngbe_txq_ops *ops; /**< txq ops */
const struct rte_memzone *mz;
+ uint64_t desc_error;
};
struct ngbe_txq_ops {