[dpdk-dev] [PATCH v4] net/pcap: improve rx statistics
Ferruh Yigit
ferruh.yigit at intel.com
Thu Sep 9 10:05:41 CEST 2021
On 9/9/2021 5:16 AM, Qiming Chen wrote:
> In the receiving direction, if alloc mbuf or jumbo process failed, there
> is no err_pkts count, which makes it difficult to locate the problem.
> Because alloc mbuf failed, the rx_nombuf field is counted.
>
Please fix './devtools/check-git-log.sh' warnings.
> Signed-off-by: Qiming Chen <chenqiming_huawei at 163.com>
> ---
> v2:
> Clear coding style issues.
> v3:
> 1) Send direction does not release mbuf.
> 2) Failed to alloc mbuf is counted to the rx_nombuf field.
> v4:
> Add rx_nombuf field.
<...>
> @@ -297,8 +298,10 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
> break;
>
> mbuf = rte_pktmbuf_alloc(pcap_q->mb_pool);
> - if (unlikely(mbuf == NULL))
> - break;
> + if (unlikely(mbuf == NULL)) {
> + pcap_q->rx_stat.rx_nombuf++;
> + continue;
Not sure to update to 'continue' here. I guess both works but if allocating an
mbuf failed, keeping continue to the loop may cause more mbuf allocation
failure, 'break' may give more time to have mbufs available.
Also the patch is related to adding stats, so lets not update the behavior in
this patch.
> + }
>
> if (header.caplen <= rte_pktmbuf_tailroom(mbuf)) {
> /* pcap packet will fit in the mbuf, can copy it */
> @@ -311,6 +314,7 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
> mbuf,
> packet,
> header.caplen) == -1)) {
> + pcap_q->rx_stat.rx_nombuf++;
This one should update 'err_pkts'.
More information about the dev
mailing list