avf: add num tx/rx packets per queue

Type: improvement
Change-Id: I3459dba86eb7a784448633b69492d6d3f49db720
Signed-off-by: Dau Do <daudo@yahoo.com>
This commit is contained in:
Dau Do
2024-08-29 03:03:16 -07:00
parent b4808de247
commit b8d4490d9c
5 changed files with 28 additions and 0 deletions

View File

@ -180,6 +180,7 @@ typedef struct
u8 int_mode;
u8 buffer_pool_index;
u32 queue_index;
u64 total_packets;
} avf_rxq_t;
typedef struct
@ -198,6 +199,8 @@ typedef struct
avf_tx_desc_t *tmp_descs;
u32 *tmp_bufs;
u32 queue_index;
u64 total_packets;
u64 no_free_tx_count;
} avf_txq_t;
typedef struct

View File

@ -288,6 +288,7 @@ avf_rxq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 rxq_size)
d->qword[0] = vlib_buffer_get_pa (vm, b);
d++;
}
rxq->total_packets = 0;
return 0;
}
@ -337,6 +338,9 @@ avf_txq_init (vlib_main_t * vm, avf_device_t * ad, u16 qid, u16 txq_size)
vec_validate_aligned (txq->tmp_descs, txq->size, CLIB_CACHE_LINE_BYTES);
vec_validate_aligned (txq->tmp_bufs, txq->size, CLIB_CACHE_LINE_BYTES);
txq->total_packets = 0;
txq->no_free_tx_count = 0;
return 0;
}

View File

@ -104,6 +104,7 @@ format_avf_device (u8 * s, va_list * args)
u8 *a = 0;
avf_rxq_t *rxq = vec_elt_at_index (ad->rxqs, 0);
avf_txq_t *txq = vec_elt_at_index (ad->txqs, 0);
u32 idx = 0;
s = format (s, "rx: queues %u, desc %u (min %u max %u)", ad->n_rx_queues,
rxq->size, AVF_QUEUE_SZ_MIN, AVF_QUEUE_SZ_MAX);
@ -114,6 +115,22 @@ format_avf_device (u8 * s, va_list * args)
format_avf_device_flags, ad);
s = format (s, "\n%Ucapability flags: %U", format_white_space, indent,
format_avf_vf_cap_flags, ad->cap_flags);
s =
format (s, "\n%U Rx Queue: Total Packets", format_white_space, indent + 4);
for (idx = 0; idx < ad->n_rx_queues; idx++)
{
rxq = vec_elt_at_index (ad->rxqs, idx);
s = format (s, "\n%U %8u : %llu", format_white_space, indent + 4, idx,
rxq->total_packets);
}
s = format (s, "\n%U Tx Queue: Total Packets\t Total Drops",
format_white_space, indent + 4);
for (idx = 0; idx < ad->n_tx_queues; idx++)
{
txq = vec_elt_at_index (ad->txqs, idx);
s = format (s, "\n%U %8u : %llu\t %llu", format_white_space, indent + 4,
idx, txq->total_packets, txq->no_free_tx_count);
}
s = format (s, "\n%Unum-queue-pairs %d max-vectors %u max-mtu %u "
"rss-key-size %u rss-lut-size %u", format_white_space, indent,

View File

@ -539,6 +539,8 @@ done:
else
avf_rxq_refill (vm, node, rxq, 0 /* use_va_dma */ );
rxq->total_packets += n_rx_packets;
return n_rx_packets;
}

View File

@ -510,6 +510,7 @@ retry:
avf_tail_write (txq->qtx_tail, txq->next);
txq->n_enqueued += n_desc;
n_left -= n_enq;
txq->total_packets += n_enq;
}
if (n_left)
@ -522,6 +523,7 @@ retry:
vlib_buffer_free (vm, buffers, n_left);
vlib_error_count (vm, node->node_index,
AVF_TX_ERROR_NO_FREE_SLOTS, n_left);
txq->no_free_tx_count += n_left;
}
if (tf->shared_queue)