Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/717935/?format=api
{ "id": 717935, "url": "http://patchwork.ozlabs.org/api/patches/717935/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20170120221150.7616.59999.stgit@localhost6.localdomain6/", "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": "<20170120221150.7616.59999.stgit@localhost6.localdomain6>", "list_archive_url": null, "date": "2017-01-20T22:11:50", "name": "[2/3] ixgbe: return early instead of wrap block in if statement", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "13a38d16e65df24816a16161690f3e8b8a44748e", "submitter": { "id": 1670, "url": "http://patchwork.ozlabs.org/api/people/1670/?format=api", "name": "Tantilov, Emil S", "email": "emil.s.tantilov@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/20170120221150.7616.59999.stgit@localhost6.localdomain6/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/717935/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/717935/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<intel-wired-lan-bounces@lists.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" ], "Received": [ "from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3v4w9y04hYz9t1P\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 21 Jan 2017 09:19:49 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id 544A786A54;\n\tFri, 20 Jan 2017 22:19:48 +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 ZT92qWrlOko7; Fri, 20 Jan 2017 22:19:47 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id B2C1C86A50;\n\tFri, 20 Jan 2017 22:19:47 +0000 (UTC)", "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\tby ash.osuosl.org (Postfix) with ESMTP id 896021BFEC6\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:46 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 859028287F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:46 +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 KKRTmA024Oi5 for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:45 +0000 (UTC)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby hemlock.osuosl.org (Postfix) with ESMTPS id A365F82334\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 20 Jan 2017 22:19:45 +0000 (UTC)", "from fmsmga004.fm.intel.com ([10.253.24.48])\n\tby fmsmga101.fm.intel.com with ESMTP; 20 Jan 2017 14:19:44 -0800", "from estantil-desk3.jf.intel.com (HELO localhost6.localdomain6)\n\t([134.134.3.64])\n\tby fmsmga004.fm.intel.com with ESMTP; 20 Jan 2017 14:19:44 -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-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.33,260,1477983600\"; d=\"scan'208\";a=\"215845178\"", "From": "Emil Tantilov <emil.s.tantilov@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 20 Jan 2017 14:11:50 -0800", "Message-ID": "<20170120221150.7616.59999.stgit@localhost6.localdomain6>", "In-Reply-To": "<20170120221145.7616.93906.stgit@localhost6.localdomain6>", "References": "<20170120221145.7616.93906.stgit@localhost6.localdomain6>", "User-Agent": "StGit/0.17.1-17-ge4e0", "MIME-Version": "1.0", "Subject": "[Intel-wired-lan] [PATCH 2/3] ixgbe: return early instead of wrap\n\tblock in if statement", "X-BeenThere": "intel-wired-lan@lists.osuosl.org", "X-Mailman-Version": "2.1.18-1", "Precedence": "list", "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n\t<intel-wired-lan.lists.osuosl.org>", "List-Unsubscribe": "<http://lists.osuosl.org/mailman/options/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=unsubscribe>", "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>", "List-Post": "<mailto:intel-wired-lan@lists.osuosl.org>", "List-Help": "<mailto:intel-wired-lan-request@lists.osuosl.org?subject=help>", "List-Subscribe": "<http://lists.osuosl.org/mailman/listinfo/intel-wired-lan>, \n\t<mailto:intel-wired-lan-request@lists.osuosl.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "intel-wired-lan-bounces@lists.osuosl.org", "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@lists.osuosl.org>" }, "content": "Since we exit at the end of the block, we can save a level of\nindentation by performing an early return, and make the next several\nsections of code more legible, with fewer 80 character line breaks.\n\nAlso moved allocating vfinfo at the beginning and the notification\nfor enabling SRIOV at the end of the function when we know that it\nwill succeed.\n\nSigned-off-by: Emil Tantilov <emil.s.tantilov@intel.com>\n---\n drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 85 ++++++++++++------------\n 1 file changed, 41 insertions(+), 44 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\nindex d10b25f..16952d3 100644\n--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c\n@@ -74,9 +74,9 @@ static inline void ixgbe_alloc_vf_macvlans(struct ixgbe_adapter *adapter)\n static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n {\n \tstruct ixgbe_hw *hw = &adapter->hw;\n+\tint i;\n \n \tadapter->flags |= IXGBE_FLAG_SRIOV_ENABLED;\n-\te_info(probe, \"SR-IOV enabled with %d VFs\\n\", adapter->num_vfs);\n \n \t/* Enable VMDq flag so device will be set in VM mode */\n \tadapter->flags |= IXGBE_FLAG_VMDQ_ENABLED;\n@@ -84,60 +84,57 @@ static int __ixgbe_enable_sriov(struct ixgbe_adapter *adapter)\n \t\tadapter->ring_feature[RING_F_VMDQ].limit = 1;\n \tadapter->ring_feature[RING_F_VMDQ].offset = adapter->num_vfs;\n \n-\t/* Initialize default switching mode VEB */\n-\tIXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);\n-\tadapter->bridge_mode = BRIDGE_MODE_VEB;\n-\n-\tixgbe_alloc_vf_macvlans(adapter);\n-\n \t/* If call to enable VFs succeeded then allocate memory\n \t * for per VF control structures.\n \t */\n-\tadapter->vfinfo =\n-\t\tkcalloc(adapter->num_vfs,\n-\t\t\tsizeof(struct vf_data_storage), GFP_KERNEL);\n-\tif (adapter->vfinfo) {\n-\t\tint i;\n-\n-\t\t/* limit trafffic classes based on VFs enabled */\n-\t\tif ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&\n-\t\t (adapter->num_vfs < 16)) {\n-\t\t\tadapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS;\n-\t\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS;\n-\t\t} else if (adapter->num_vfs < 32) {\n-\t\t\tadapter->dcb_cfg.num_tcs.pg_tcs = 4;\n-\t\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = 4;\n-\t\t} else {\n-\t\t\tadapter->dcb_cfg.num_tcs.pg_tcs = 1;\n-\t\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = 1;\n-\t\t}\n+\tadapter->vfinfo = kcalloc(adapter->num_vfs,\n+\t\t\t\t sizeof(struct vf_data_storage), GFP_KERNEL);\n+\tif (!adapter->vfinfo)\n+\t\treturn -ENOMEM;\n+\n+\tixgbe_alloc_vf_macvlans(adapter);\n+\n+\t/* Initialize default switching mode VEB */\n+\tIXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN);\n+\tadapter->bridge_mode = BRIDGE_MODE_VEB;\n \n-\t\t/* Disable RSC when in SR-IOV mode */\n-\t\tadapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE |\n-\t\t\t\t IXGBE_FLAG2_RSC_ENABLED);\n+\t/* limit trafffic classes based on VFs enabled */\n+\tif ((adapter->hw.mac.type == ixgbe_mac_82599EB) &&\n+\t (adapter->num_vfs < 16)) {\n+\t\tadapter->dcb_cfg.num_tcs.pg_tcs = MAX_TRAFFIC_CLASS;\n+\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = MAX_TRAFFIC_CLASS;\n+\t} else if (adapter->num_vfs < 32) {\n+\t\tadapter->dcb_cfg.num_tcs.pg_tcs = 4;\n+\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = 4;\n+\t} else {\n+\t\tadapter->dcb_cfg.num_tcs.pg_tcs = 1;\n+\t\tadapter->dcb_cfg.num_tcs.pfc_tcs = 1;\n+\t}\n \n-\t\tfor (i = 0; i < adapter->num_vfs; i++) {\n-\t\t\t/* enable spoof checking for all VFs */\n-\t\t\tadapter->vfinfo[i].spoofchk_enabled = true;\n+\t/* Disable RSC when in SR-IOV mode */\n+\tadapter->flags2 &= ~(IXGBE_FLAG2_RSC_CAPABLE |\n+\t\t\t IXGBE_FLAG2_RSC_ENABLED);\n \n-\t\t\t/* We support VF RSS querying only for 82599 and x540\n-\t\t\t * devices at the moment. These devices share RSS\n-\t\t\t * indirection table and RSS hash key with PF therefore\n-\t\t\t * we want to disable the querying by default.\n-\t\t\t */\n-\t\t\tadapter->vfinfo[i].rss_query_enabled = 0;\n+\tfor (i = 0; i < adapter->num_vfs; i++) {\n+\t\t/* enable spoof checking for all VFs */\n+\t\tadapter->vfinfo[i].spoofchk_enabled = true;\n \n-\t\t\t/* Untrust all VFs */\n-\t\t\tadapter->vfinfo[i].trusted = false;\n+\t\t/* We support VF RSS querying only for 82599 and x540\n+\t\t * devices at the moment. These devices share RSS\n+\t\t * indirection table and RSS hash key with PF therefore\n+\t\t * we want to disable the querying by default.\n+\t\t */\n+\t\tadapter->vfinfo[i].rss_query_enabled = 0;\n \n-\t\t\t/* set the default xcast mode */\n-\t\t\tadapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;\n-\t\t}\n+\t\t/* Untrust all VFs */\n+\t\tadapter->vfinfo[i].trusted = false;\n \n-\t\treturn 0;\n+\t\t/* set the default xcast mode */\n+\t\tadapter->vfinfo[i].xcast_mode = IXGBEVF_XCAST_MODE_NONE;\n \t}\n \n-\treturn -ENOMEM;\n+\te_info(probe, \"SR-IOV enabled with %d VFs\\n\", adapter->num_vfs);\n+\treturn 0;\n }\n \n /**\n", "prefixes": [ "2/3" ] }