get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/124656/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 124656,
    "url": "http://patches.dpdk.org/api/patches/124656/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230302103527.931071-19-mingxia.liu@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20230302103527.931071-19-mingxia.liu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230302103527.931071-19-mingxia.liu@intel.com",
    "date": "2023-03-02T10:35:24",
    "name": "[v8,18/21] net/cpfl: add HW statistics",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3553f7dff8ccaa7d4ea07ed3932035d74aeefcf9",
    "submitter": {
        "id": 2514,
        "url": "http://patches.dpdk.org/api/people/2514/?format=api",
        "name": "Liu, Mingxia",
        "email": "mingxia.liu@intel.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230302103527.931071-19-mingxia.liu@intel.com/mbox/",
    "series": [
        {
            "id": 27215,
            "url": "http://patches.dpdk.org/api/series/27215/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27215",
            "date": "2023-03-02T10:35:06",
            "name": "add support for cpfl PMD in DPDK",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/27215/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/124656/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/124656/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 79A4F41DB0;\n\tThu,  2 Mar 2023 03:22:55 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 61CB742D8B;\n\tThu,  2 Mar 2023 03:21:06 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n by mails.dpdk.org (Postfix) with ESMTP id E3C0042D88\n for <dev@dpdk.org>; Thu,  2 Mar 2023 03:21:04 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 01 Mar 2023 18:21:03 -0800",
            "from dpdk-mingxial-ice.sh.intel.com ([10.67.110.191])\n by fmsmga002.fm.intel.com with ESMTP; 01 Mar 2023 18:21:02 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1677723665; x=1709259665;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=Vg3y6UYxyYrzxKlH4n+g7IjWOMTPq2VMBxws7IrX8iE=;\n b=nelSOIkg1zSnjpIoSBEPQH0xIKTFIiGmnsHBJpMsGxKgIPuLKB0NQsGN\n C+BdCMBowSNDTNRaGvn4ry/lsX1bEmfzDm+syrSB2tcAllzdbjcx+yvtZ\n 0WGRTdHme+ALTu0a0X57F8ZosY4mswRNK/h9n2gb1r3LNPADyS9f97lsG\n v4S/uRweDSIg+4NpR/ny0BAMCJ7ThUIxj232KrgTVqXNTIWx7t/g+GXFv\n AXKRyhQggkymqqmwDQGlVXrqW3/rRZD0Rnj4icUVZS+99NpylNXa2mCt+\n VZbFvionUNTpC8tOhS98MAJKV9bH+V53smvqqQEvlnabiQwHydPe+jit5 Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10636\"; a=\"315013595\"",
            "E=Sophos;i=\"5.98,226,1673942400\"; d=\"scan'208\";a=\"315013595\"",
            "E=McAfee;i=\"6500,9779,10636\"; a=\"784607631\"",
            "E=Sophos;i=\"5.98,226,1673942400\"; d=\"scan'208\";a=\"784607631\""
        ],
        "X-ExtLoop1": "1",
        "From": "Mingxia Liu <mingxia.liu@intel.com>",
        "To": "dev@dpdk.org,\n\tbeilei.xing@intel.com,\n\tyuying.zhang@intel.com",
        "Cc": "Mingxia Liu <mingxia.liu@intel.com>",
        "Subject": "[PATCH v8 18/21] net/cpfl: add HW statistics",
        "Date": "Thu,  2 Mar 2023 10:35:24 +0000",
        "Message-Id": "<20230302103527.931071-19-mingxia.liu@intel.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20230302103527.931071-1-mingxia.liu@intel.com>",
        "References": "<20230216003010.3439881-1-mingxia.liu@intel.com>\n <20230302103527.931071-1-mingxia.liu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This patch add hardware packets/bytes statistics.\n\nSigned-off-by: Mingxia Liu <mingxia.liu@intel.com>\n---\n drivers/net/cpfl/cpfl_ethdev.c | 87 ++++++++++++++++++++++++++++++++++\n 1 file changed, 87 insertions(+)",
    "diff": "diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c\nindex 8ed6308a36..1f41bb8977 100644\n--- a/drivers/net/cpfl/cpfl_ethdev.c\n+++ b/drivers/net/cpfl/cpfl_ethdev.c\n@@ -175,6 +175,88 @@ cpfl_dev_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused)\n \treturn ptypes;\n }\n \n+static uint64_t\n+cpfl_get_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)\n+{\n+\tuint64_t mbuf_alloc_failed = 0;\n+\tstruct idpf_rx_queue *rxq;\n+\tint i = 0;\n+\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n+\t\trxq = dev->data->rx_queues[i];\n+\t\tmbuf_alloc_failed += __atomic_load_n(&rxq->rx_stats.mbuf_alloc_failed,\n+\t\t\t\t\t\t     __ATOMIC_RELAXED);\n+\t}\n+\n+\treturn mbuf_alloc_failed;\n+}\n+\n+static int\n+cpfl_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)\n+{\n+\tstruct idpf_vport *vport =\n+\t\t(struct idpf_vport *)dev->data->dev_private;\n+\tstruct virtchnl2_vport_stats *pstats = NULL;\n+\tint ret;\n+\n+\tret = idpf_vc_stats_query(vport, &pstats);\n+\tif (ret == 0) {\n+\t\tuint8_t crc_stats_len = (dev->data->dev_conf.rxmode.offloads &\n+\t\t\t\t\t RTE_ETH_RX_OFFLOAD_KEEP_CRC) ? 0 :\n+\t\t\t\t\t RTE_ETHER_CRC_LEN;\n+\n+\t\tidpf_vport_stats_update(&vport->eth_stats_offset, pstats);\n+\t\tstats->ipackets = pstats->rx_unicast + pstats->rx_multicast +\n+\t\t\t\tpstats->rx_broadcast - pstats->rx_discards;\n+\t\tstats->opackets = pstats->tx_broadcast + pstats->tx_multicast +\n+\t\t\t\t\t\tpstats->tx_unicast;\n+\t\tstats->imissed = pstats->rx_discards;\n+\t\tstats->ierrors = pstats->rx_errors;\n+\t\tstats->oerrors = pstats->tx_errors + pstats->tx_discards;\n+\t\tstats->ibytes = pstats->rx_bytes;\n+\t\tstats->ibytes -= stats->ipackets * crc_stats_len;\n+\t\tstats->obytes = pstats->tx_bytes;\n+\n+\t\tdev->data->rx_mbuf_alloc_failed = cpfl_get_mbuf_alloc_failed_stats(dev);\n+\t\tstats->rx_nombuf = dev->data->rx_mbuf_alloc_failed;\n+\t} else {\n+\t\tPMD_DRV_LOG(ERR, \"Get statistics failed\");\n+\t}\n+\treturn ret;\n+}\n+\n+static void\n+cpfl_reset_mbuf_alloc_failed_stats(struct rte_eth_dev *dev)\n+{\n+\tstruct idpf_rx_queue *rxq;\n+\tint i;\n+\n+\tfor (i = 0; i < dev->data->nb_rx_queues; i++) {\n+\t\trxq = dev->data->rx_queues[i];\n+\t\t__atomic_store_n(&rxq->rx_stats.mbuf_alloc_failed, 0, __ATOMIC_RELAXED);\n+\t}\n+}\n+\n+static int\n+cpfl_dev_stats_reset(struct rte_eth_dev *dev)\n+{\n+\tstruct idpf_vport *vport =\n+\t\t(struct idpf_vport *)dev->data->dev_private;\n+\tstruct virtchnl2_vport_stats *pstats = NULL;\n+\tint ret;\n+\n+\tret = idpf_vc_stats_query(vport, &pstats);\n+\tif (ret != 0)\n+\t\treturn ret;\n+\n+\t/* set stats offset base on current values */\n+\tvport->eth_stats_offset = *pstats;\n+\n+\tcpfl_reset_mbuf_alloc_failed_stats(dev);\n+\n+\treturn 0;\n+}\n+\n static int\n cpfl_init_rss(struct idpf_vport *vport)\n {\n@@ -371,6 +453,9 @@ cpfl_dev_start(struct rte_eth_dev *dev)\n \t\tgoto err_vport;\n \t}\n \n+\tif (cpfl_dev_stats_reset(dev))\n+\t\tPMD_DRV_LOG(ERR, \"Failed to reset stats\");\n+\n \tvport->stopped = 0;\n \n \treturn 0;\n@@ -441,6 +526,8 @@ static const struct eth_dev_ops cpfl_eth_dev_ops = {\n \t.tx_queue_release\t\t= cpfl_dev_tx_queue_release,\n \t.mtu_set\t\t\t= cpfl_dev_mtu_set,\n \t.dev_supported_ptypes_get\t= cpfl_dev_supported_ptypes_get,\n+\t.stats_get\t\t\t= cpfl_dev_stats_get,\n+\t.stats_reset\t\t\t= cpfl_dev_stats_reset,\n };\n \n static int\n",
    "prefixes": [
        "v8",
        "18/21"
    ]
}