From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from office2.cesnet.cz (office2.cesnet.cz [195.113.144.244]) by dpdk.org (Postfix) with ESMTP id E6BCD1C5D5 for ; Wed, 4 Apr 2018 15:42:43 +0200 (CEST) Received: from emilion.liberouter.org (emilion.liberouter.org [195.113.172.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id B965C400063; Wed, 4 Apr 2018 15:42:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1522849363; bh=XT5PtTxI5yJ4MuMwfvt/YItpRW/+5WdNMqbj7GmPuwE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=cENvWODsVDY+DAPeMMFZTRNtYyVfrd9OKGgRkKMy0K28EzzHphYvUi/nBb21rzrGF khCAIUWRMPHiL0sDRG6ajXRnwyqwKMo/AquOnisjsEBUbUMKqeYCYXh4ku682TCEEk qwe4HbnQXSlK10HaB8vAFjYZKsXL6jjuHgg3P51E= From: Matej Vido To: dev@dpdk.org Cc: remes@netcope.com Date: Wed, 4 Apr 2018 15:42:20 +0200 Message-Id: <1522849341-49049-4-git-send-email-vido@cesnet.cz> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1522849341-49049-1-git-send-email-vido@cesnet.cz> References: <1522849341-49049-1-git-send-email-vido@cesnet.cz> Subject: [dpdk-dev] [PATCH 3/4] net/szedata2: add stat of mbuf allocation failures X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Apr 2018 13:42:44 -0000 Signed-off-by: Matej Vido --- drivers/net/szedata2/rte_eth_szedata2.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c index f41716d..8278780 100644 --- a/drivers/net/szedata2/rte_eth_szedata2.c +++ b/drivers/net/szedata2/rte_eth_szedata2.c @@ -67,7 +67,16 @@ #define SZEDATA2_DEV_PATH_FMT "/dev/szedataII%u" +struct pmd_internals { + struct rte_eth_dev *dev; + uint16_t max_rx_queues; + uint16_t max_tx_queues; + char sze_dev[PATH_MAX]; + struct rte_mem_resource *pci_rsc; +}; + struct szedata2_rx_queue { + struct pmd_internals *priv; struct szedata *sze; uint8_t rx_channel; uint16_t in_port; @@ -78,6 +87,7 @@ struct szedata2_rx_queue { }; struct szedata2_tx_queue { + struct pmd_internals *priv; struct szedata *sze; uint8_t tx_channel; volatile uint64_t tx_pkts; @@ -85,13 +95,6 @@ struct szedata2_tx_queue { volatile uint64_t err_pkts; }; -struct pmd_internals { - uint16_t max_rx_queues; - uint16_t max_tx_queues; - char sze_dev[PATH_MAX]; - struct rte_mem_resource *pci_rsc; -}; - static struct ether_addr eth_addr = { .addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 } }; @@ -130,8 +133,10 @@ struct pmd_internals { for (i = 0; i < nb_pkts; i++) { mbuf = rte_pktmbuf_alloc(sze_q->mb_pool); - if (unlikely(mbuf == NULL)) + if (unlikely(mbuf == NULL)) { + sze_q->priv->dev->data->rx_mbuf_alloc_failed++; break; + } /* get the next sze packet */ if (sze->ct_rx_lck != NULL && !sze->ct_rx_rem_bytes && @@ -351,6 +356,8 @@ struct pmd_internals { uint16_t packet_len1 = 0; uint16_t packet_len2 = 0; uint16_t hw_data_align; + uint64_t *mbuf_failed_ptr = + &sze_q->priv->dev->data->rx_mbuf_alloc_failed; if (unlikely(sze_q->sze == NULL || nb_pkts == 0)) return 0; @@ -538,6 +545,7 @@ struct pmd_internals { sze->ct_rx_lck = ct_rx_lck_backup; sze->ct_rx_rem_bytes = ct_rx_rem_bytes_backup; sze->ct_rx_cur_ptr = ct_rx_cur_ptr_backup; + sze_q->priv->dev->data->rx_mbuf_alloc_failed++; break; } @@ -587,6 +595,7 @@ struct pmd_internals { ct_rx_rem_bytes_backup; sze->ct_rx_cur_ptr = ct_rx_cur_ptr_backup; + (*mbuf_failed_ptr)++; goto finish; } @@ -630,6 +639,7 @@ struct pmd_internals { ct_rx_rem_bytes_backup; sze->ct_rx_cur_ptr = ct_rx_cur_ptr_backup; + (*mbuf_failed_ptr)++; goto finish; } @@ -1086,6 +1096,7 @@ struct pmd_internals { stats->ibytes = rx_total_bytes; stats->obytes = tx_total_bytes; stats->oerrors = tx_err_total; + stats->rx_nombuf = dev->data->rx_mbuf_alloc_failed; return 0; } @@ -1290,6 +1301,7 @@ struct pmd_internals { return -ENOMEM; } + rxq->priv = internals; rxq->sze = szedata_open(internals->sze_dev); if (rxq->sze == NULL) { RTE_LOG(ERR, PMD, "szedata_open() failed for rx queue id " @@ -1346,6 +1358,7 @@ struct pmd_internals { return -ENOMEM; } + txq->priv = internals; txq->sze = szedata_open(internals->sze_dev); if (txq->sze == NULL) { RTE_LOG(ERR, PMD, "szedata_open() failed for tx queue id " @@ -1543,6 +1556,8 @@ struct pmd_internals { pci_addr->domain, pci_addr->bus, pci_addr->devid, pci_addr->function); + internals->dev = dev; + /* Get index of szedata2 device file and create path to device file */ ret = get_szedata2_index(pci_addr, &szedata2_index); if (ret != 0) { -- 1.8.3.1