Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1229961/?format=api
{ "id": 1229961, "url": "http://patchwork.ozlabs.org/api/patches/1229961/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200127085927.13999-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": "<20200127085927.13999-1-anthony.l.nguyen@intel.com>", "list_archive_url": null, "date": "2020-01-27T08:59:13", "name": "[S39,01/15] ice: Validate config for SW DCB map", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "ad19323d402b59b1b963226d30dd2ca03d73a6fe", "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/20200127085927.13999-1-anthony.l.nguyen@intel.com/mbox/", "series": [ { "id": 155506, "url": "http://patchwork.ozlabs.org/api/series/155506/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=155506", "date": "2020-01-27T08:59:25", "name": "[S39,01/15] ice: Validate config for SW DCB map", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/155506/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1229961/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1229961/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.137;\n\thelo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\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 485xdf33tsz9sRW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tTue, 28 Jan 2020 04:32:22 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id C4FA784806;\n\tMon, 27 Jan 2020 17:32:20 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 4WLy_ll8ejAd; Mon, 27 Jan 2020 17:32:19 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id EE2298517E;\n\tMon, 27 Jan 2020 17:32:18 +0000 (UTC)", "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\tby ash.osuosl.org (Postfix) with ESMTP id 6F7631BF283\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:17 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 6947284B23\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:17 +0000 (UTC)", "from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id rWf6-VEVdkaV for <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:16 +0000 (UTC)", "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby fraxinus.osuosl.org (Postfix) with ESMTPS id 43E1B85087\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tMon, 27 Jan 2020 17:32:16 +0000 (UTC)", "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Jan 2020 09:32:09 -0800", "from unknown (HELO localhost.jf.intel.com) ([10.166.244.174])\n\tby fmsmga005.fm.intel.com with ESMTP; 27 Jan 2020 09:32:09 -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,370,1574150400\"; d=\"scan'208\";a=\"427350637\"", "From": "Tony Nguyen <anthony.l.nguyen@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Mon, 27 Jan 2020 00:59:13 -0800", "Message-Id": "<20200127085927.13999-1-anthony.l.nguyen@intel.com>", "X-Mailer": "git-send-email 2.20.1", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH S39 01/15] ice: Validate config for SW DCB\n\tmap", "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 or non-contiguous TCs.\nWithout this patch, any config having bad inputs will cause the loss of\nlink making PF unusable even after driver reload. Recoverable only via\nsystem reboot.\n\nSigned-off-by: Avinash Dayanand <avinash.dayanand@intel.com>\nSigned-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_dcb_lib.c | 55 ++++++++++++++++++++\n drivers/net/ethernet/intel/ice/ice_dcb_lib.h | 1 +\n drivers/net/ethernet/intel/ice/ice_dcb_nl.c | 7 +++\n 3 files changed, 63 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 0f4ca813a7ab..bd361212921c 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,56 @@ 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+ * @dcbcfg: pointer to DCB config structure\n+ */\n+int ice_dcb_bwchk(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 and assign\n+\t * all bandwidth to it i.e. 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+\t/* There are few rules with which TC bandwidth can be applied for any TC\n+\t * with a UP mapped to it.\n+\t *\t1. All TCs have zero BW - Valid\n+\t *\t ex: tcbw=0,0,0\n+\t *\t2. First few non-zero and rest zero BW - Valid\n+\t *\t ex: tcbw=100,0,0\n+\t *\t3. Zero BW in between 2 non-zero BW TCs - Invalid\n+\t *\t ex: tcbw=25,0,75\n+\t */\n+\tfor (i = 0; i < num_tc; i++) {\n+\t\t/* don't allow zero BW for TCs other than TC0 */\n+\t\tif (i && !etscfg->tcbwtable[i])\n+\t\t\tgoto err;\n+\n+\t\tif (etscfg->tsatable[i] == ICE_IEEE_TSA_ETS)\n+\t\t\ttotal_bw += etscfg->tcbwtable[i];\n+\t}\n+\n+\t /* total bandwidth should be equal to 100 */\n+\tif (total_bw != ICE_TC_MAX_BW)\n+\t\tgoto err;\n+\n+\treturn 0;\n+\n+err:\n+\treturn -EINVAL;\n+}\n+\n /**\n * ice_pf_dcb_cfg - Apply new DCB configuration\n * @pf: pointer to the PF struct\n@@ -206,6 +256,11 @@ 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(new_cfg)) {\n+\t\tdev_err(dev, \"Invalid config, not applying DCB\\n\");\n+\t\treturn -EINVAL;\n+\t}\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..2b900da27f57 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_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..a45e8abef8f3 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,12 @@ 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(new_cfg)) {\n+\t\tnetdev_err(netdev, \"Invalid config, not applying DCB\\n\");\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 +125,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", "01/15" ] }