src/dpdk/drivers/net/mlx4/mlx4_ethdev.c
int
mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
	struct rte_eth_stats tmp;
	unsigned int i;
	unsigned int idx;

	memset(&tmp, 0, sizeof(tmp));
	/* Add software counters. */
	for (i = 0; i != dev->data->nb_rx_queues; ++i) {
		struct rxq *rxq = dev->data->rx_queues[i];

		if (rxq == NULL)
			continue;
		idx = rxq->stats.idx;
		if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
			tmp.q_ipackets[idx] += rxq->stats.ipackets;
			tmp.q_ibytes[idx] += rxq->stats.ibytes;
			tmp.q_errors[idx] += (rxq->stats.idropped +
					      rxq->stats.rx_nombuf);
		}
		tmp.ipackets += rxq->stats.ipackets;
		tmp.ibytes += rxq->stats.ibytes;
		tmp.ierrors += rxq->stats.idropped;
		tmp.rx_nombuf += rxq->stats.rx_nombuf;
	}
	for (i = 0; i != dev->data->nb_tx_queues; ++i) {
		struct txq *txq = dev->data->tx_queues[i];

		if (txq == NULL)
			continue;
		idx = txq->stats.idx;
		if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
			tmp.q_opackets[idx] += txq->stats.opackets;
			tmp.q_obytes[idx] += txq->stats.obytes;
		}
		tmp.opackets += txq->stats.opackets;
		tmp.obytes += txq->stats.obytes;
		tmp.oerrors += txq->stats.odropped;
	}
	*stats = tmp;
	return 0;
}
/**
 * DPDK callback to get device statistics.
 *
 * @param dev
 *   Pointer to Ethernet device structure.
 * @param[out] stats
 *   Stats structure output buffer.
 */
DPDK callback to get device statistics.
@param dev
Pointer to Ethernet device structure.
@param[out] stats
Stats structure output buffer.
DPDK callback to get device statistics . @param dev Pointer to Ethernet device structure . @param [ out ] stats Stats structure output buffer .
int
mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
{
	struct rte_eth_stats tmp;
	unsigned int i;
	unsigned int idx;
	memset(&tmp, 0, sizeof(tmp));
	for (i = 0; i != dev->data->nb_rx_queues; ++i) {
		struct rxq *rxq = dev->data->rx_queues[i];
		if (rxq == NULL)
			continue;
		idx = rxq->stats.idx;
		if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
			tmp.q_ipackets[idx] += rxq->stats.ipackets;
			tmp.q_ibytes[idx] += rxq->stats.ibytes;
			tmp.q_errors[idx] += (rxq->stats.idropped +
					      rxq->stats.rx_nombuf);
		}
		tmp.ipackets += rxq->stats.ipackets;
		tmp.ibytes += rxq->stats.ibytes;
		tmp.ierrors += rxq->stats.idropped;
		tmp.rx_nombuf += rxq->stats.rx_nombuf;
	}
	for (i = 0; i != dev->data->nb_tx_queues; ++i) {
		struct txq *txq = dev->data->tx_queues[i];
		if (txq == NULL)
			continue;
		idx = txq->stats.idx;
		if (idx < RTE_ETHDEV_QUEUE_STAT_CNTRS) {
			tmp.q_opackets[idx] += txq->stats.opackets;
			tmp.q_obytes[idx] += txq->stats.obytes;
		}
		tmp.opackets += txq->stats.opackets;
		tmp.obytes += txq->stats.obytes;
		tmp.oerrors += txq->stats.odropped;
	}
	*stats = tmp;
	return 0;
}
int mlx4_stats_get ( struct rte_eth_dev * dev , struct rte_eth_stats * stats ) { struct rte_eth_stats tmp ; unsigned int i ; unsigned int idx ; memset ( & tmp , 0 , sizeof ( tmp ) ) ; for ( i = 0 ; i != dev -> data -> nb_rx_queues ; ++ i ) { struct rxq * rxq = dev -> data -> rx_queues [ i ] ; if ( rxq == NULL ) continue ; idx = rxq -> stats . idx ; if ( idx < RTE_ETHDEV_QUEUE_STAT_CNTRS ) { tmp . q_ipackets [ idx ] += rxq -> stats . ipackets ; tmp . q_ibytes [ idx ] += rxq -> stats . ibytes ; tmp . q_errors [ idx ] += ( rxq -> stats . idropped + rxq -> stats . rx_nombuf ) ; } tmp . ipackets += rxq -> stats . ipackets ; tmp . ibytes += rxq -> stats . ibytes ; tmp . ierrors += rxq -> stats . idropped ; tmp . rx_nombuf += rxq -> stats . rx_nombuf ; } for ( i = 0 ; i != dev -> data -> nb_tx_queues ; ++ i ) { struct txq * txq = dev -> data -> tx_queues [ i ] ; if ( txq == NULL ) continue ; idx = txq -> stats . idx ; if ( idx < RTE_ETHDEV_QUEUE_STAT_CNTRS ) { tmp . q_opackets [ idx ] += txq -> stats . opackets ; tmp . q_obytes [ idx ] += txq -> stats . obytes ; } tmp . opackets += txq -> stats . opackets ; tmp . obytes += txq -> stats . obytes ; tmp . oerrors += txq -> stats . odropped ; } * stats = tmp ; return 0 ; }
DPDK callback to get device statistics.
DPDK callback to get device statistics .
/* Add software counters. */