get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1237755,
    "url": "http://patchwork.ozlabs.org/api/patches/1237755/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200213213059.33939-1-anthony.l.nguyen@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": "<20200213213059.33939-1-anthony.l.nguyen@intel.com>",
    "list_archive_url": null,
    "date": "2020-02-13T21:30:59",
    "name": "[S39,v2,01/15] ice: Validate config for SW DCB map",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "0c5a3a11efed692d135367117b9cc56d4e55469f",
    "submitter": {
        "id": 68875,
        "url": "http://patchwork.ozlabs.org/api/people/68875/?format=api",
        "name": "Tony Nguyen",
        "email": "anthony.l.nguyen@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/20200213213059.33939-1-anthony.l.nguyen@intel.com/mbox/",
    "series": [
        {
            "id": 158447,
            "url": "http://patchwork.ozlabs.org/api/series/158447/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=158447",
            "date": "2020-02-13T21:30:59",
            "name": "[S39,v2,01/15] ice: Validate config for SW DCB map",
            "version": 2,
            "mbox": "http://patchwork.ozlabs.org/series/158447/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1237755/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1237755/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; spf=pass (sender SPF authorized)\n\tsmtp.mailfrom=osuosl.org (client-ip=140.211.166.133;\n\thelo=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 48JV7k4g5Pz9sP7\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 14 Feb 2020 08:31:30 +1100 (AEDT)",
            "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 770AC87F71;\n\tThu, 13 Feb 2020 21:31:28 +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 3vZrzZLT-TLp; Thu, 13 Feb 2020 21:31:27 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 4F97F87EE8;\n\tThu, 13 Feb 2020 21:31:27 +0000 (UTC)",
            "from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id B1BA71BF338\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Feb 2020 21:31:25 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id ACF1086E1D\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Feb 2020 21:31:25 +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 WXxKAJ44Zxb3 for <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Feb 2020 21:31:24 +0000 (UTC)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id A344686D05\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tThu, 13 Feb 2020 21:31:24 +0000 (UTC)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t13 Feb 2020 13:31:20 -0800",
            "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby orsmga001.jf.intel.com with ESMTP; 13 Feb 2020 13:31:20 -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.70,438,1574150400\"; d=\"scan'208\";a=\"313859255\"",
        "From": "Tony Nguyen <anthony.l.nguyen@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org,\n\tpmenzel@molgen.mpg.de",
        "Date": "Thu, 13 Feb 2020 13:30:59 -0800",
        "Message-Id": "<20200213213059.33939-1-anthony.l.nguyen@intel.com>",
        "X-Mailer": "git-send-email 2.20.1",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [PATCH S39 v2 01/15] ice: Validate config for SW\n\tDCB map",
        "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>",
        "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": "From: Avinash Dayanand <avinash.dayanand@intel.com>\n\nValidate the inputs for SW DCB config received either via lldptool or pcap\nfile. And don't apply DCB for bad bandwidth inputs. Without this patch, any\nconfig having bad inputs will cause the loss of link making PF unusable\neven after driver reload. Recoverable only via system reboot.\n\nSigned-off-by: Avinash Dayanand <avinash.dayanand@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\nv2:\n- Allocate all bandwidth to TC0 if no TCs requested any bandwidth\n- Remove zero bandwidth check on non-TC0\n- Add message about reason for error and return from error immediately in\n  ice_dcb_bwchk()\n- Change a comment\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 40 ++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h |  1 +\n drivers/net/ethernet/intel/ice/ice_dcb_nl.c  |  6 +++\n 3 files changed, 47 insertions(+)",
    "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\nindex 017b71d8e894..175b08219f7a 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.c\n@@ -169,6 +169,43 @@ ice_peer_prep_tc_change(struct ice_peer_dev_int *peer_dev_int,\n \treturn 0;\n }\n \n+/**\n+ * ice_dcb_bwchk - check if ETS bandwidth input parameters are correct\n+ * @pf: pointer to the PF struct\n+ * @dcbcfg: pointer to DCB config structure\n+ */\n+int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg)\n+{\n+\tstruct ice_dcb_ets_cfg *etscfg = &dcbcfg->etscfg;\n+\tu8 num_tc, total_bw = 0;\n+\tint i;\n+\n+\t/* returns number of contigous TCs and 1 TC for non-contigous TCs,\n+\t * since at least 1 TC has to be configured\n+\t */\n+\tnum_tc = ice_dcb_get_num_tc(dcbcfg);\n+\n+\t/* no bandwidth checks required if there's only one TC, so assign\n+\t * all bandwidth to TC0 and return\n+\t */\n+\tif (num_tc == 1) {\n+\t\tetscfg->tcbwtable[0] = ICE_TC_MAX_BW;\n+\t\treturn 0;\n+\t}\n+\n+\tfor (i = 0; i < num_tc; i++)\n+\t\ttotal_bw += etscfg->tcbwtable[i];\n+\n+\tif (!total_bw) {\n+\t\tetscfg->tcbwtable[0] = ICE_TC_MAX_BW;\n+\t} else if (total_bw != ICE_TC_MAX_BW) {\n+\t\tdev_err(ice_pf_to_dev(pf), \"Invalid config, total bandwidth must equal 100\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n /**\n  * ice_pf_dcb_cfg - Apply new DCB configuration\n  * @pf: pointer to the PF struct\n@@ -206,6 +243,9 @@ int ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked)\n \t/* Notify capable peers about impending change to TCs */\n \tice_for_each_peer(pf, NULL, ice_peer_prep_tc_change);\n \n+\tif (ice_dcb_bwchk(pf, new_cfg))\n+\t\treturn -EINVAL;\n+\n \t/* Store old config in case FW config fails */\n \told_cfg = kmemdup(curr_cfg, sizeof(*old_cfg), GFP_KERNEL);\n \tif (!old_cfg)\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\nindex bb53edf462ba..11457b6ba145 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_lib.h\n@@ -20,6 +20,7 @@ u8 ice_dcb_get_num_tc(struct ice_dcbx_cfg *dcbcfg);\n u8 ice_dcb_get_tc(struct ice_vsi *vsi, int queue_index);\n int\n ice_pf_dcb_cfg(struct ice_pf *pf, struct ice_dcbx_cfg *new_cfg, bool locked);\n+int ice_dcb_bwchk(struct ice_pf *pf, struct ice_dcbx_cfg *dcbcfg);\n void ice_pf_dcb_recfg(struct ice_pf *pf);\n void ice_vsi_cfg_dcb_rings(struct ice_vsi *vsi);\n int ice_init_pf_dcb(struct ice_pf *pf, bool locked);\ndiff --git a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\nindex b61aba428adb..c572aa5c28e0 100644\n--- a/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\n+++ b/drivers/net/ethernet/intel/ice/ice_dcb_nl.c\n@@ -95,6 +95,11 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)\n \t\tnew_cfg->etsrec.prio_table[i] = ets->reco_prio_tc[i];\n \t}\n \n+\tif (ice_dcb_bwchk(pf, new_cfg)) {\n+\t\terr = -EINVAL;\n+\t\tgoto ets_out;\n+\t}\n+\n \t/* max_tc is a 1-8 value count of number of TC's, not a 0-7 value\n \t * for the TC's index number.  Add one to value if not zero, and\n \t * for zero set it to the FW's default value\n@@ -119,6 +124,7 @@ static int ice_dcbnl_setets(struct net_device *netdev, struct ieee_ets *ets)\n \tif (err == ICE_DCB_NO_HW_CHG)\n \t\terr = ICE_DCB_HW_CHG_RST;\n \n+ets_out:\n \tmutex_unlock(&pf->tc_mutex);\n \treturn err;\n }\n",
    "prefixes": [
        "S39",
        "v2",
        "01/15"
    ]
}