get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1049837,
    "url": "http://patchwork.ozlabs.org/api/patches/1049837/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190228232432.31659-9-anirudh.venkataramanan@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20190228232432.31659-9-anirudh.venkataramanan@intel.com>",
    "list_archive_url": null,
    "date": "2019-02-28T23:24:29",
    "name": "[S16,08/11] ice: Add code to get DCB related statistics",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "33305a5b670d9e1b5bd3abef56835fa83ef67bf7",
    "submitter": {
        "id": 73601,
        "url": "http://patchwork.ozlabs.org/api/people/73601/?format=api",
        "name": "Anirudh Venkataramanan",
        "email": "anirudh.venkataramanan@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190228232432.31659-9-anirudh.venkataramanan@intel.com/mbox/",
    "series": [
        {
            "id": 94826,
            "url": "http://patchwork.ozlabs.org/api/series/94826/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=94826",
            "date": "2019-02-28T23:24:25",
            "name": "Add support for Data Center Bridging (DCB)",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/94826/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1049837/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1049837/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=osuosl.org\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=intel-wired-lan-bounces@osuosl.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org;\n\tdmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 449TCy0741z9s4V\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Mar 2019 10:24:45 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 915D087A52;\n\tThu, 28 Feb 2019 23:24:44 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 9qwjJmE6lElG; Thu, 28 Feb 2019 23:24:42 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 51A9887A8D;\n\tThu, 28 Feb 2019 23:24:42 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6463B1BF964\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:24:38 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 61F248693D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:24:38 +0000 (UTC)",
            "from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id ZJYbsg2LMaFX for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:24:35 +0000 (UTC)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id 0A9B886416\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 28 Feb 2019 23:24:35 +0000 (UTC)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t28 Feb 2019 15:24:34 -0800",
            "from shasta.jf.intel.com ([10.166.241.11])\n\tby FMSMGA003.fm.intel.com with ESMTP; 28 Feb 2019 15:24:34 -0800"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.58,425,1544515200\"; d=\"scan'208\";a=\"137127727\"",
        "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Thu, 28 Feb 2019 15:24:29 -0800",
        "Message-Id": "<20190228232432.31659-9-anirudh.venkataramanan@intel.com>",
        "X-Mailer": "git-send-email 2.14.5",
        "In-Reply-To": "<20190228232432.31659-1-anirudh.venkataramanan@intel.com>",
        "References": "<20190228232432.31659-1-anirudh.venkataramanan@intel.com>",
        "Subject": "[Intel-wired-lan] [PATCH S16 08/11] ice: Add code to get DCB\n\trelated statistics",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "This patch adds a new function ice_update_dcb_stats to get DCB stats\nfrom the hardware and ethtool support for displaying these stats.\n\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c    | 38 +++++++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h    |  2 ++\n drivers/net/ethernet/intel/ice/ice_ethtool.c    | 36 +++++++++++++++++++++--\n drivers/net/ethernet/intel/ice/ice_hw_autogen.h |  5 ++++\n drivers/net/ethernet/intel/ice/ice_main.c       |  2 ++\n drivers/net/ethernet/intel/ice/ice_type.h       |  5 ++++\n 6 files changed, 86 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex fe4765483040..c6ddb748ef53 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -359,6 +359,44 @@ int ice_init_pf_dcb(struct ice_pf *pf)\n \treturn err;\n }\n \n+/**\n+ * ice_update_dcb_stats - Update DCB stats counters\n+ * @pf: PF whose stats needs to be updated\n+ */\n+void ice_update_dcb_stats(struct ice_pf *pf)\n+{\n+\tstruct ice_hw_port_stats *prev_ps, *cur_ps;\n+\tstruct ice_hw *hw = &pf->hw;\n+\tu8 pf_id = hw->pf_id;\n+\tint i;\n+\n+\tprev_ps = &pf->stats_prev;\n+\tcur_ps = &pf->stats;\n+\n+\tfor (i = 0; i < 8; i++) {\n+\t\tice_stat_update32(hw, GLPRT_PXOFFRXC(pf_id, i),\n+\t\t\t\t  pf->stat_prev_loaded,\n+\t\t\t\t  &prev_ps->priority_xoff_rx[i],\n+\t\t\t\t  &cur_ps->priority_xoff_rx[i]);\n+\t\tice_stat_update32(hw, GLPRT_PXONRXC(pf_id, i),\n+\t\t\t\t  pf->stat_prev_loaded,\n+\t\t\t\t  &prev_ps->priority_xon_rx[i],\n+\t\t\t\t  &cur_ps->priority_xon_rx[i]);\n+\t\tice_stat_update32(hw, GLPRT_PXONTXC(pf_id, i),\n+\t\t\t\t  pf->stat_prev_loaded,\n+\t\t\t\t  &prev_ps->priority_xon_tx[i],\n+\t\t\t\t  &cur_ps->priority_xon_tx[i]);\n+\t\tice_stat_update32(hw, GLPRT_PXOFFTXC(pf_id, i),\n+\t\t\t\t  pf->stat_prev_loaded,\n+\t\t\t\t  &prev_ps->priority_xoff_tx[i],\n+\t\t\t\t  &cur_ps->priority_xoff_tx[i]);\n+\t\tice_stat_update32(hw, GLPRT_RXON2OFFCNT(pf_id, i),\n+\t\t\t\t  pf->stat_prev_loaded,\n+\t\t\t\t  &prev_ps->priority_xon_2_xoff[i],\n+\t\t\t\t  &cur_ps->priority_xon_2_xoff[i]);\n+\t}\n+}\n+\n /**\n  * ice_tx_prepare_vlan_flags_dcb - prepare VLAN tagging for DCB\n  * @tx_ring: ring to send buffer on\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\nindex 1a430a45acf7..1b4159d44617 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n@@ -12,6 +12,7 @@ u8 ice_dcb_get_ena_tc(struct ice_dcbx_cfg *dcbcfg);\n u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);\n void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);\n int ice_init_pf_dcb(struct ice_pf *pf);\n+void ice_update_dcb_stats(struct ice_pf *pf);\n int\n ice_tx_prepare_vlan_flags_dcb(struct ice_ring *tx_ring,\n \t\t\t      struct ice_tx_buf *first);\n@@ -47,6 +48,7 @@ ice_tx_prepare_vlan_flags_dcb(struct ice_ring __always_unused *tx_ring,\n \treturn 0;\n }\n \n+#define ice_update_dcb_stats(pf) do {} while (0)\n #define ice_vsi_cfg_dcb_rings(vsi) do {} while (0)\n #define ice_dcb_process_lldp_set_mib_change(pf, event) do {} while (0)\n #define ice_set_cgd_num(tlan_ctx, ring) do {} while (0)\ndiff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c\nindex 1447ffc5d2b0..ea8558954cb4 100644\n--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c\n+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c\n@@ -33,8 +33,14 @@ static int ice_q_stats_len(struct net_device *netdev)\n #define ICE_PF_STATS_LEN\tARRAY_SIZE(ice_gstrings_pf_stats)\n #define ICE_VSI_STATS_LEN\tARRAY_SIZE(ice_gstrings_vsi_stats)\n \n-#define ICE_ALL_STATS_LEN(n)\t(ICE_PF_STATS_LEN + ICE_VSI_STATS_LEN + \\\n-\t\t\t\t ice_q_stats_len(n))\n+#define ICE_PFC_STATS_LEN ( \\\n+\t\t(FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_rx) + \\\n+\t\t FIELD_SIZEOF(struct ice_pf, stats.priority_xon_rx) + \\\n+\t\t FIELD_SIZEOF(struct ice_pf, stats.priority_xoff_tx) + \\\n+\t\t FIELD_SIZEOF(struct ice_pf, stats.priority_xon_tx)) \\\n+\t\t / sizeof(u64))\n+#define ICE_ALL_STATS_LEN(n)\t(ICE_PF_STATS_LEN + ICE_PFC_STATS_LEN + \\\n+\t\t\t\t ICE_VSI_STATS_LEN + ice_q_stats_len(n))\n \n static const struct ice_stats ice_gstrings_vsi_stats[] = {\n \tICE_VSI_STAT(\"tx_unicast\", eth_stats.tx_unicast),\n@@ -309,6 +315,22 @@ static void ice_get_strings(struct net_device *netdev, u32 stringset, u8 *data)\n \t\t\tp += ETH_GSTRING_LEN;\n \t\t}\n \n+\t\tfor (i = 0; i < ICE_MAX_USER_PRIORITY; i++) {\n+\t\t\tsnprintf(p, ETH_GSTRING_LEN,\n+\t\t\t\t \"port.tx-priority-%u-xon\", i);\n+\t\t\tp += ETH_GSTRING_LEN;\n+\t\t\tsnprintf(p, ETH_GSTRING_LEN,\n+\t\t\t\t \"port.tx-priority-%u-xoff\", i);\n+\t\t\tp += ETH_GSTRING_LEN;\n+\t\t}\n+\t\tfor (i = 0; i < ICE_MAX_USER_PRIORITY; i++) {\n+\t\t\tsnprintf(p, ETH_GSTRING_LEN,\n+\t\t\t\t \"port.rx-priority-%u-xon\", i);\n+\t\t\tp += ETH_GSTRING_LEN;\n+\t\t\tsnprintf(p, ETH_GSTRING_LEN,\n+\t\t\t\t \"port.rx-priority-%u-xoff\", i);\n+\t\t\tp += ETH_GSTRING_LEN;\n+\t\t}\n \t\tbreak;\n \tcase ETH_SS_PRIV_FLAGS:\n \t\tfor (i = 0; i < ICE_PRIV_FLAG_ARRAY_SIZE; i++) {\n@@ -486,6 +508,16 @@ ice_get_ethtool_stats(struct net_device *netdev,\n \t\tdata[i++] = (ice_gstrings_pf_stats[j].sizeof_stat ==\n \t\t\t     sizeof(u64)) ? *(u64 *)p : *(u32 *)p;\n \t}\n+\n+\tfor (j = 0; j < ICE_MAX_USER_PRIORITY; j++) {\n+\t\tdata[i++] = pf->stats.priority_xon_tx[j];\n+\t\tdata[i++] = pf->stats.priority_xoff_tx[j];\n+\t}\n+\n+\tfor (j = 0; j < ICE_MAX_USER_PRIORITY; j++) {\n+\t\tdata[i++] = pf->stats.priority_xon_rx[j];\n+\t\tdata[i++] = pf->stats.priority_xoff_rx[j];\n+\t}\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\nindex dfc180d2b282..e172ca002a0a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n+++ b/drivers/net/ethernet/intel/ice/ice_hw_autogen.h\n@@ -321,11 +321,16 @@\n #define GLPRT_PTC64L(_i)\t\t\t(0x00380B80 + ((_i) * 8))\n #define GLPRT_PTC9522H(_i)\t\t\t(0x00380D04 + ((_i) * 8))\n #define GLPRT_PTC9522L(_i)\t\t\t(0x00380D00 + ((_i) * 8))\n+#define GLPRT_PXOFFRXC(_i, _j)\t\t\t(0x00380500 + ((_i) * 8 + (_j) * 64))\n+#define GLPRT_PXOFFTXC(_i, _j)\t\t\t(0x00380F40 + ((_i) * 8 + (_j) * 64))\n+#define GLPRT_PXONRXC(_i, _j)\t\t\t(0x00380300 + ((_i) * 8 + (_j) * 64))\n+#define GLPRT_PXONTXC(_i, _j)\t\t\t(0x00380D40 + ((_i) * 8 + (_j) * 64))\n #define GLPRT_RFC(_i)\t\t\t\t(0x00380AC0 + ((_i) * 8))\n #define GLPRT_RJC(_i)\t\t\t\t(0x00380B00 + ((_i) * 8))\n #define GLPRT_RLEC(_i)\t\t\t\t(0x00380140 + ((_i) * 8))\n #define GLPRT_ROC(_i)\t\t\t\t(0x00380240 + ((_i) * 8))\n #define GLPRT_RUC(_i)\t\t\t\t(0x00380200 + ((_i) * 8))\n+#define GLPRT_RXON2OFFCNT(_i, _j)\t\t(0x00380700 + ((_i) * 8 + (_j) * 64))\n #define GLPRT_TDOLD(_i)\t\t\t\t(0x00381280 + ((_i) * 8))\n #define GLPRT_UPRCH(_i)\t\t\t\t(0x00381304 + ((_i) * 8))\n #define GLPRT_UPRCL(_i)\t\t\t\t(0x00381300 + ((_i) * 8))\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 367e9559b1ca..1a37132446a3 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -3251,6 +3251,8 @@ static void ice_update_pf_stats(struct ice_pf *pf)\n \tice_stat_update32(hw, GLPRT_LXOFFTXC(pf_id), pf->stat_prev_loaded,\n \t\t\t  &prev_ps->link_xoff_tx, &cur_ps->link_xoff_tx);\n \n+\tice_update_dcb_stats(pf);\n+\n \tice_stat_update32(hw, GLPRT_CRCERRS(pf_id), pf->stat_prev_loaded,\n \t\t\t  &prev_ps->crc_errors, &cur_ps->crc_errors);\n \ndiff --git a/drivers/net/ethernet/intel/ice/ice_type.h b/drivers/net/ethernet/intel/ice/ice_type.h\nindex c4cdfb2e0c4b..77bc0439e108 100644\n--- a/drivers/net/ethernet/intel/ice/ice_type.h\n+++ b/drivers/net/ethernet/intel/ice/ice_type.h\n@@ -477,6 +477,11 @@ struct ice_hw_port_stats {\n \tu64 link_xoff_rx;\t\t/* lxoffrxc */\n \tu64 link_xon_tx;\t\t/* lxontxc */\n \tu64 link_xoff_tx;\t\t/* lxofftxc */\n+\tu64 priority_xon_rx[8];\t\t/* pxonrxc[8] */\n+\tu64 priority_xoff_rx[8];\t/* pxoffrxc[8] */\n+\tu64 priority_xon_tx[8];\t\t/* pxontxc[8] */\n+\tu64 priority_xoff_tx[8];\t/* pxofftxc[8] */\n+\tu64 priority_xon_2_xoff[8];\t/* pxon2offc[8] */\n \tu64 rx_size_64;\t\t\t/* prc64 */\n \tu64 rx_size_127;\t\t/* prc127 */\n \tu64 rx_size_255;\t\t/* prc255 */\n",
    "prefixes": [
        "S16",
        "08/11"
    ]
}