get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 8518,
    "url": "https://patches.dpdk.org/api/patches/8518/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1446459547-1754-5-git-send-email-harry.van.haaren@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1446459547-1754-5-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1446459547-1754-5-git-send-email-harry.van.haaren@intel.com",
    "date": "2015-11-02T10:19:01",
    "name": "[dpdk-dev,v5,04/10] igb: add xstats() implementation",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "98e442b62fdc338c50dc43a92e2a3af300ae7f76",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1446459547-1754-5-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/8518/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/8518/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id DF6A48E94;\n\tMon,  2 Nov 2015 11:19:23 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 2794F8E81\n\tfor <dev@dpdk.org>; Mon,  2 Nov 2015 11:19:22 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby orsmga101.jf.intel.com with ESMTP; 02 Nov 2015 02:19:22 -0800",
            "from sie-lab-212-222.ir.intel.com (HELO\n\tsilpixa00366884.ir.intel.com) ([10.237.212.222])\n\tby orsmga002.jf.intel.com with ESMTP; 02 Nov 2015 02:19:20 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.20,234,1444719600\"; d=\"scan'208\";a=\"840505408\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon,  2 Nov 2015 10:19:01 +0000",
        "Message-Id": "<1446459547-1754-5-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1446459547-1754-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1446204998-17151-2-git-send-email-harry.van.haaren@intel.com>\n\t<1446459547-1754-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5 04/10] igb: add xstats() implementation",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add xstats_get() and xstats_reset() functions to igb\ndriver, and the neccessary strings to expose these\nNIC statistics.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/net/e1000/igb_ethdev.c | 135 +++++++++++++++++++++++++++++++++++++++--\n 1 file changed, 130 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c\nindex 3ab082e..a5461e5 100644\n--- a/drivers/net/e1000/igb_ethdev.c\n+++ b/drivers/net/e1000/igb_ethdev.c\n@@ -96,7 +96,10 @@ static int  eth_igb_link_update(struct rte_eth_dev *dev,\n \t\t\t\tint wait_to_complete);\n static void eth_igb_stats_get(struct rte_eth_dev *dev,\n \t\t\t\tstruct rte_eth_stats *rte_stats);\n+static int eth_igb_xstats_get(struct rte_eth_dev *dev,\n+\t\t\t      struct rte_eth_xstats *xstats, unsigned n);\n static void eth_igb_stats_reset(struct rte_eth_dev *dev);\n+static void eth_igb_xstats_reset(struct rte_eth_dev *dev);\n static void eth_igb_infos_get(struct rte_eth_dev *dev,\n \t\t\t      struct rte_eth_dev_info *dev_info);\n static void eth_igbvf_infos_get(struct rte_eth_dev *dev,\n@@ -291,7 +294,9 @@ static const struct eth_dev_ops eth_igb_ops = {\n \t.allmulticast_disable = eth_igb_allmulticast_disable,\n \t.link_update          = eth_igb_link_update,\n \t.stats_get            = eth_igb_stats_get,\n+\t.xstats_get           = eth_igb_xstats_get,\n \t.stats_reset          = eth_igb_stats_reset,\n+\t.xstats_reset         = eth_igb_xstats_reset,\n \t.dev_infos_get        = eth_igb_infos_get,\n \t.mtu_set              = eth_igb_mtu_set,\n \t.vlan_filter_set      = eth_igb_vlan_filter_set,\n@@ -353,6 +358,76 @@ static const struct eth_dev_ops igbvf_eth_dev_ops = {\n \t.get_reg              = igbvf_get_regs,\n };\n \n+/* store statistics names and its offset in stats structure */\n+struct rte_igb_xstats_name_off {\n+\tchar name[RTE_ETH_XSTATS_NAME_SIZE];\n+\tunsigned offset;\n+};\n+\n+static const struct rte_igb_xstats_name_off rte_igb_stats_strings[] = {\n+\t{\"rx_crc_errors\", offsetof(struct e1000_hw_stats, crcerrs)},\n+\t{\"rx_align_errors\", offsetof(struct e1000_hw_stats, algnerrc)},\n+\t{\"rx_symbol_errors\", offsetof(struct e1000_hw_stats, symerrs)},\n+\t{\"rx_missed_packets\", offsetof(struct e1000_hw_stats, mpc)},\n+\t{\"tx_single_collision_packets\", offsetof(struct e1000_hw_stats, scc)},\n+\t{\"tx_multiple_collision_packets\", offsetof(struct e1000_hw_stats, mcc)},\n+\t{\"tx_excessive_collision_packets\", offsetof(struct e1000_hw_stats,\n+\t\tecol)},\n+\t{\"tx_late_collisions\", offsetof(struct e1000_hw_stats, latecol)},\n+\t{\"tx_total_collisions\", offsetof(struct e1000_hw_stats, colc)},\n+\t{\"tx_deferred_packets\", offsetof(struct e1000_hw_stats, dc)},\n+\t{\"tx_no_carrier_sense_packets\", offsetof(struct e1000_hw_stats, tncrs)},\n+\t{\"rx_carrier_ext_errors\", offsetof(struct e1000_hw_stats, cexterr)},\n+\t{\"rx_length_errors\", offsetof(struct e1000_hw_stats, rlec)},\n+\t{\"rx_xon_packets\", offsetof(struct e1000_hw_stats, xonrxc)},\n+\t{\"tx_xon_packets\", offsetof(struct e1000_hw_stats, xontxc)},\n+\t{\"rx_xoff_packets\", offsetof(struct e1000_hw_stats, xoffrxc)},\n+\t{\"tx_xoff_packets\", offsetof(struct e1000_hw_stats, xofftxc)},\n+\t{\"rx_flow_control_unsupported_packets\", offsetof(struct e1000_hw_stats,\n+\t\tfcruc)},\n+\t{\"rx_size_64_packets\", offsetof(struct e1000_hw_stats, prc64)},\n+\t{\"rx_size_65_to_127_packets\", offsetof(struct e1000_hw_stats, prc127)},\n+\t{\"rx_size_128_to_255_packets\", offsetof(struct e1000_hw_stats, prc255)},\n+\t{\"rx_size_256_to_511_packets\", offsetof(struct e1000_hw_stats, prc511)},\n+\t{\"rx_size_512_to_1023_packets\", offsetof(struct e1000_hw_stats,\n+\t\tprc1023)},\n+\t{\"rx_size_1024_to_max_packets\", offsetof(struct e1000_hw_stats,\n+\t\tprc1522)},\n+\t{\"rx_broadcast_packets\", offsetof(struct e1000_hw_stats, bprc)},\n+\t{\"rx_multicast_packets\", offsetof(struct e1000_hw_stats, mprc)},\n+\t{\"rx_undersize_errors\", offsetof(struct e1000_hw_stats, ruc)},\n+\t{\"rx_fragment_errors\", offsetof(struct e1000_hw_stats, rfc)},\n+\t{\"rx_oversize_errors\", offsetof(struct e1000_hw_stats, roc)},\n+\t{\"rx_jabber_errors\", offsetof(struct e1000_hw_stats, rjc)},\n+\t{\"rx_management_packets\", offsetof(struct e1000_hw_stats, mgprc)},\n+\t{\"rx_management_dropped\", offsetof(struct e1000_hw_stats, mgpdc)},\n+\t{\"tx_management_packets\", offsetof(struct e1000_hw_stats, mgptc)},\n+\t{\"rx_total_packets\", offsetof(struct e1000_hw_stats, tpr)},\n+\t{\"tx_total_packets\", offsetof(struct e1000_hw_stats, tpt)},\n+\t{\"rx_total_bytes\", offsetof(struct e1000_hw_stats, tor)},\n+\t{\"tx_total_bytes\", offsetof(struct e1000_hw_stats, tot)},\n+\t{\"tx_size_64_packets\", offsetof(struct e1000_hw_stats, ptc64)},\n+\t{\"tx_size_65_to_127_packets\", offsetof(struct e1000_hw_stats, ptc127)},\n+\t{\"tx_size_128_to_255_packets\", offsetof(struct e1000_hw_stats, ptc255)},\n+\t{\"tx_size_256_to_511_packets\", offsetof(struct e1000_hw_stats, ptc511)},\n+\t{\"tx_size_512_to_1023_packets\", offsetof(struct e1000_hw_stats,\n+\t\tptc1023)},\n+\t{\"tx_size_1023_to_max_packets\", offsetof(struct e1000_hw_stats,\n+\t\tptc1522)},\n+\t{\"tx_multicast_packets\", offsetof(struct e1000_hw_stats, mptc)},\n+\t{\"tx_broadcast_packets\", offsetof(struct e1000_hw_stats, bptc)},\n+\t{\"tx_tso_packets\", offsetof(struct e1000_hw_stats, tsctc)},\n+\t{\"tx_tso_errors\", offsetof(struct e1000_hw_stats, tsctfc)},\n+\t{\"rx_sent_to_host_packets\", offsetof(struct e1000_hw_stats, rpthc)},\n+\t{\"tx_sent_by_host_packets\", offsetof(struct e1000_hw_stats, hgptc)},\n+\t{\"rx_code_violation_packets\", offsetof(struct e1000_hw_stats, scvpc)},\n+\n+\t{\"interrupt_assert_count\", offsetof(struct e1000_hw_stats, iac)},\n+};\n+\n+#define IGB_NB_XSTATS (sizeof(rte_igb_stats_strings) / \\\n+\t\tsizeof(rte_igb_stats_strings[0]))\n+\n /**\n  * Atomically reads the link status information from global\n  * structure rte_eth_dev.\n@@ -1256,11 +1331,8 @@ igb_hardware_init(struct e1000_hw *hw)\n \n /* This function is based on igb_update_stats_counters() in igb/if_igb.c */\n static void\n-eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)\n+igb_read_stats_registers(struct e1000_hw *hw, struct e1000_hw_stats *stats)\n {\n-\tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n-\tstruct e1000_hw_stats *stats =\n-\t\t\tE1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n \tint pause_frames;\n \n \tif(hw->phy.media_type == e1000_media_type_copper ||\n@@ -1366,6 +1438,16 @@ eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)\n \tstats->cexterr += E1000_READ_REG(hw, E1000_CEXTERR);\n \tstats->tsctc += E1000_READ_REG(hw, E1000_TSCTC);\n \tstats->tsctfc += E1000_READ_REG(hw, E1000_TSCTFC);\n+}\n+\n+static void\n+eth_igb_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)\n+{\n+\tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct e1000_hw_stats *stats =\n+\t\t\tE1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n+\n+\tigb_read_stats_registers(hw, stats);\n \n \tif (rte_stats == NULL)\n \t\treturn;\n@@ -1408,6 +1490,50 @@ eth_igb_stats_reset(struct rte_eth_dev *dev)\n }\n \n static void\n+eth_igb_xstats_reset(struct rte_eth_dev *dev)\n+{\n+\tstruct e1000_hw_stats *stats =\n+\t\t\tE1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n+\n+\t/* HW registers are cleared on read */\n+\teth_igb_xstats_get(dev, NULL, IGB_NB_XSTATS);\n+\n+\t/* Reset software totals */\n+\tmemset(stats, 0, sizeof(*stats));\n+}\n+\n+static int\n+eth_igb_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstats *xstats,\n+\t\t   unsigned n)\n+{\n+\tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n+\tstruct e1000_hw_stats *hw_stats =\n+\t\t\tE1000_DEV_PRIVATE_TO_STATS(dev->data->dev_private);\n+\tunsigned i;\n+\n+\tif (n < IGB_NB_XSTATS)\n+\t\treturn IGB_NB_XSTATS;\n+\n+\tigb_read_stats_registers(hw, hw_stats);\n+\n+\t/* If this is a reset xstats is NULL, and we have cleared the\n+\t * registers by reading them.\n+\t */\n+\tif (!xstats)\n+\t\treturn 0;\n+\n+\t/* Extended stats */\n+\tfor (i = 0; i < IGB_NB_XSTATS; i++) {\n+\t\tsnprintf(xstats[i].name, sizeof(xstats[i].name),\n+\t\t\t \"%s\", rte_igb_stats_strings[i].name);\n+\t\txstats[i].value = *(uint64_t *)(((char *)hw_stats) +\n+\t\t\trte_igb_stats_strings[i].offset);\n+\t}\n+\n+\treturn IGB_NB_XSTATS;\n+}\n+\n+static void\n eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)\n {\n \tstruct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);\n@@ -1462,7 +1588,6 @@ eth_igbvf_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats)\n \trte_stats->ilbbytes = hw_stats->gorlbc;\n \trte_stats->olbpackets = hw_stats->gptlbc;\n \trte_stats->olbbytes = hw_stats->gotlbc;\n-\n }\n \n static void\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "04/10"
    ]
}