net/liquidio: support Tx stats
Signed-off-by: Shijith Thotton <shijith.thotton@caviumnetworks.com> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Signed-off-by: Derek Chickles <derek.chickles@caviumnetworks.com> Signed-off-by: Venkat Koppula <venkat.koppula@caviumnetworks.com> Signed-off-by: Srisivasubramanian S <ssrinivasan@caviumnetworks.com> Signed-off-by: Mallesham Jatharakonda <mjatharakonda@oneconvergence.com>
This commit is contained in:
parent
47abece264
commit
04006cc2d0
@ -124,11 +124,32 @@ lio_dev_stats_get(struct rte_eth_dev *eth_dev,
|
|||||||
{
|
{
|
||||||
struct lio_device *lio_dev = LIO_DEV(eth_dev);
|
struct lio_device *lio_dev = LIO_DEV(eth_dev);
|
||||||
struct lio_droq_stats *oq_stats;
|
struct lio_droq_stats *oq_stats;
|
||||||
|
struct lio_iq_stats *iq_stats;
|
||||||
|
struct lio_instr_queue *txq;
|
||||||
struct lio_droq *droq;
|
struct lio_droq *droq;
|
||||||
|
int i, iq_no, oq_no;
|
||||||
uint64_t bytes = 0;
|
uint64_t bytes = 0;
|
||||||
uint64_t pkts = 0;
|
uint64_t pkts = 0;
|
||||||
uint64_t drop = 0;
|
uint64_t drop = 0;
|
||||||
int i, oq_no;
|
|
||||||
|
for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
|
||||||
|
iq_no = lio_dev->linfo.txpciq[i].s.q_no;
|
||||||
|
txq = lio_dev->instr_queue[iq_no];
|
||||||
|
if (txq != NULL) {
|
||||||
|
iq_stats = &txq->stats;
|
||||||
|
pkts += iq_stats->tx_done;
|
||||||
|
drop += iq_stats->tx_dropped;
|
||||||
|
bytes += iq_stats->tx_tot_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats->opackets = pkts;
|
||||||
|
stats->obytes = bytes;
|
||||||
|
stats->oerrors = drop;
|
||||||
|
|
||||||
|
pkts = 0;
|
||||||
|
drop = 0;
|
||||||
|
bytes = 0;
|
||||||
|
|
||||||
for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
|
for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
|
||||||
oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
|
oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
|
||||||
@ -152,8 +173,19 @@ lio_dev_stats_reset(struct rte_eth_dev *eth_dev)
|
|||||||
{
|
{
|
||||||
struct lio_device *lio_dev = LIO_DEV(eth_dev);
|
struct lio_device *lio_dev = LIO_DEV(eth_dev);
|
||||||
struct lio_droq_stats *oq_stats;
|
struct lio_droq_stats *oq_stats;
|
||||||
|
struct lio_iq_stats *iq_stats;
|
||||||
|
struct lio_instr_queue *txq;
|
||||||
struct lio_droq *droq;
|
struct lio_droq *droq;
|
||||||
int i, oq_no;
|
int i, iq_no, oq_no;
|
||||||
|
|
||||||
|
for (i = 0; i < eth_dev->data->nb_tx_queues; i++) {
|
||||||
|
iq_no = lio_dev->linfo.txpciq[i].s.q_no;
|
||||||
|
txq = lio_dev->instr_queue[iq_no];
|
||||||
|
if (txq != NULL) {
|
||||||
|
iq_stats = &txq->stats;
|
||||||
|
memset(iq_stats, 0, sizeof(struct lio_iq_stats));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
|
for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
|
||||||
oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
|
oq_no = lio_dev->linfo.rxpciq[i].s.q_no;
|
||||||
|
@ -1113,8 +1113,10 @@ lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
|
|||||||
|
|
||||||
inst_processed = lio_process_iq_request_list(lio_dev, iq);
|
inst_processed = lio_process_iq_request_list(lio_dev, iq);
|
||||||
|
|
||||||
if (inst_processed)
|
if (inst_processed) {
|
||||||
rte_atomic64_sub(&iq->instr_pending, inst_processed);
|
rte_atomic64_sub(&iq->instr_pending, inst_processed);
|
||||||
|
iq->stats.instr_processed += inst_processed;
|
||||||
|
}
|
||||||
|
|
||||||
tot_inst_processed += inst_processed;
|
tot_inst_processed += inst_processed;
|
||||||
inst_processed = 0;
|
inst_processed = 0;
|
||||||
@ -1130,7 +1132,7 @@ lio_flush_iq(struct lio_device *lio_dev, struct lio_instr_queue *iq)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
lio_send_command(struct lio_device *lio_dev, uint32_t iq_no, void *cmd,
|
lio_send_command(struct lio_device *lio_dev, uint32_t iq_no, void *cmd,
|
||||||
void *buf, uint32_t datasize __rte_unused, uint32_t reqtype)
|
void *buf, uint32_t datasize, uint32_t reqtype)
|
||||||
{
|
{
|
||||||
struct lio_instr_queue *iq = lio_dev->instr_queue[iq_no];
|
struct lio_instr_queue *iq = lio_dev->instr_queue[iq_no];
|
||||||
struct lio_iq_post_status st;
|
struct lio_iq_post_status st;
|
||||||
@ -1141,7 +1143,13 @@ lio_send_command(struct lio_device *lio_dev, uint32_t iq_no, void *cmd,
|
|||||||
|
|
||||||
if (st.status != LIO_IQ_SEND_FAILED) {
|
if (st.status != LIO_IQ_SEND_FAILED) {
|
||||||
lio_add_to_request_list(iq, st.index, buf, reqtype);
|
lio_add_to_request_list(iq, st.index, buf, reqtype);
|
||||||
|
LIO_INCR_INSTRQUEUE_PKT_COUNT(lio_dev, iq_no, bytes_sent,
|
||||||
|
datasize);
|
||||||
|
LIO_INCR_INSTRQUEUE_PKT_COUNT(lio_dev, iq_no, instr_posted, 1);
|
||||||
|
|
||||||
lio_ring_doorbell(lio_dev, iq);
|
lio_ring_doorbell(lio_dev, iq);
|
||||||
|
} else {
|
||||||
|
LIO_INCR_INSTRQUEUE_PKT_COUNT(lio_dev, iq_no, instr_dropped, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rte_spinlock_unlock(&iq->post_lock);
|
rte_spinlock_unlock(&iq->post_lock);
|
||||||
@ -1667,6 +1675,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts)
|
|||||||
struct lio_instr_queue *txq = tx_queue;
|
struct lio_instr_queue *txq = tx_queue;
|
||||||
union lio_cmd_setup cmdsetup;
|
union lio_cmd_setup cmdsetup;
|
||||||
struct lio_device *lio_dev;
|
struct lio_device *lio_dev;
|
||||||
|
struct lio_iq_stats *stats;
|
||||||
struct lio_data_pkt ndata;
|
struct lio_data_pkt ndata;
|
||||||
int i, processed = 0;
|
int i, processed = 0;
|
||||||
struct rte_mbuf *m;
|
struct rte_mbuf *m;
|
||||||
@ -1676,6 +1685,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts)
|
|||||||
|
|
||||||
lio_dev = txq->lio_dev;
|
lio_dev = txq->lio_dev;
|
||||||
iq_no = txq->txpciq.s.q_no;
|
iq_no = txq->txpciq.s.q_no;
|
||||||
|
stats = &lio_dev->instr_queue[iq_no]->stats;
|
||||||
|
|
||||||
if (!lio_dev->intf_open || !lio_dev->linfo.link.s.link_up) {
|
if (!lio_dev->intf_open || !lio_dev->linfo.link.s.link_up) {
|
||||||
PMD_TX_LOG(lio_dev, ERR, "Transmit failed link_status : %d\n",
|
PMD_TX_LOG(lio_dev, ERR, "Transmit failed link_status : %d\n",
|
||||||
@ -1697,6 +1707,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts)
|
|||||||
|
|
||||||
ndata.q_no = iq_no;
|
ndata.q_no = iq_no;
|
||||||
if (lio_iq_is_full(lio_dev, ndata.q_no)) {
|
if (lio_iq_is_full(lio_dev, ndata.q_no)) {
|
||||||
|
stats->tx_iq_busy++;
|
||||||
if (lio_dev_cleanup_iq(lio_dev, iq_no)) {
|
if (lio_dev_cleanup_iq(lio_dev, iq_no)) {
|
||||||
PMD_TX_LOG(lio_dev, ERR,
|
PMD_TX_LOG(lio_dev, ERR,
|
||||||
"Transmit failed iq:%d full\n",
|
"Transmit failed iq:%d full\n",
|
||||||
@ -1804,10 +1815,13 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts)
|
|||||||
lio_dev_cleanup_iq(lio_dev, iq_no);
|
lio_dev_cleanup_iq(lio_dev, iq_no);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stats->tx_done++;
|
||||||
|
stats->tx_tot_bytes += pkt_len;
|
||||||
processed++;
|
processed++;
|
||||||
}
|
}
|
||||||
|
|
||||||
xmit_failed:
|
xmit_failed:
|
||||||
|
stats->tx_dropped += (nb_pkts - processed);
|
||||||
|
|
||||||
return processed;
|
return processed;
|
||||||
}
|
}
|
||||||
|
@ -670,6 +670,9 @@ void lio_setup_response_list(struct lio_device *lio_dev);
|
|||||||
*/
|
*/
|
||||||
int lio_process_ordered_list(struct lio_device *lio_dev);
|
int lio_process_ordered_list(struct lio_device *lio_dev);
|
||||||
|
|
||||||
|
#define LIO_INCR_INSTRQUEUE_PKT_COUNT(lio_dev, iq_no, field, count) \
|
||||||
|
(((lio_dev)->instr_queue[iq_no]->stats.field) += count)
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
lio_swap_8B_data(uint64_t *data, uint32_t blocks)
|
lio_swap_8B_data(uint64_t *data, uint32_t blocks)
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,18 @@ struct lio_version {
|
|||||||
uint16_t reserved;
|
uint16_t reserved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Input Queue statistics. Each input queue has four stats fields. */
|
||||||
|
struct lio_iq_stats {
|
||||||
|
uint64_t instr_posted; /**< Instructions posted to this queue. */
|
||||||
|
uint64_t instr_processed; /**< Instructions processed in this queue. */
|
||||||
|
uint64_t instr_dropped; /**< Instructions that could not be processed */
|
||||||
|
uint64_t bytes_sent; /**< Bytes sent through this queue. */
|
||||||
|
uint64_t tx_done; /**< Num of packets sent to network. */
|
||||||
|
uint64_t tx_iq_busy; /**< Num of times this iq was found to be full. */
|
||||||
|
uint64_t tx_dropped; /**< Num of pkts dropped due to xmitpath errors. */
|
||||||
|
uint64_t tx_tot_bytes; /**< Total count of bytes sent to network. */
|
||||||
|
};
|
||||||
|
|
||||||
/** Output Queue statistics. Each output queue has four stats fields. */
|
/** Output Queue statistics. Each output queue has four stats fields. */
|
||||||
struct lio_droq_stats {
|
struct lio_droq_stats {
|
||||||
/** Number of packets received in this queue. */
|
/** Number of packets received in this queue. */
|
||||||
@ -319,6 +331,9 @@ struct lio_instr_queue {
|
|||||||
/** Number of instructions pending to be posted to Octeon. */
|
/** Number of instructions pending to be posted to Octeon. */
|
||||||
uint32_t fill_cnt;
|
uint32_t fill_cnt;
|
||||||
|
|
||||||
|
/** Statistics for this input queue. */
|
||||||
|
struct lio_iq_stats stats;
|
||||||
|
|
||||||
/** DMA mapped base address of the input descriptor ring. */
|
/** DMA mapped base address of the input descriptor ring. */
|
||||||
uint64_t base_addr_dma;
|
uint64_t base_addr_dma;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user