Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/1038977/?format=api
{ "id": 1038977, "url": "http://patchwork.ozlabs.org/api/patches/1038977/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20190208205043.11975-6-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": "<20190208205043.11975-6-anirudh.venkataramanan@intel.com>", "list_archive_url": null, "date": "2019-02-08T20:50:32", "name": "[S11,05/16] ice: fix stack hogs from struct ice_vsi_ctx structures", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "b7a666af8319f6497af967c290d90d01ac4044e8", "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/20190208205043.11975-6-anirudh.venkataramanan@intel.com/mbox/", "series": [ { "id": 90915, "url": "http://patchwork.ozlabs.org/api/series/90915/?format=api", "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=90915", "date": "2019-02-08T20:50:37", "name": "Bug fixes for ice", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/90915/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/1038977/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/1038977/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.138; helo=whitealder.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 whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\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 43x6qX2rXcz9sN1\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 9 Feb 2019 07:54:16 +1100 (AEDT)", "from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 0434686F8A;\n\tFri, 8 Feb 2019 20:54:15 +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 V5nF1LbClynt; Fri, 8 Feb 2019 20:54:12 +0000 (UTC)", "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D3B2A86BDC;\n\tFri, 8 Feb 2019 20:54:12 +0000 (UTC)", "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\tby ash.osuosl.org (Postfix) with ESMTP id 3EB461BF97F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Feb 2019 20:52:32 +0000 (UTC)", "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id C7CBB3142F\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Feb 2019 20:52:30 +0000 (UTC)", "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id TPflbzBNINDz for <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Feb 2019 20:52:29 +0000 (UTC)", "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby silver.osuosl.org (Postfix) with ESMTPS id 2520031364\n\tfor <intel-wired-lan@lists.osuosl.org>;\n\tFri, 8 Feb 2019 20:52:29 +0000 (UTC)", "from orsmga008.jf.intel.com ([10.7.209.65])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t08 Feb 2019 12:50:43 -0800", "from shasta.jf.intel.com ([10.166.241.11])\n\tby orsmga008.jf.intel.com with ESMTP; 08 Feb 2019 12:50:43 -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,348,1544515200\"; d=\"scan'208\";a=\"116332334\"", "From": "Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>", "To": "intel-wired-lan@lists.osuosl.org", "Date": "Fri, 8 Feb 2019 12:50:32 -0800", "Message-Id": "<20190208205043.11975-6-anirudh.venkataramanan@intel.com>", "X-Mailer": "git-send-email 2.14.5", "In-Reply-To": "<20190208205043.11975-1-anirudh.venkataramanan@intel.com>", "References": "<20190208205043.11975-1-anirudh.venkataramanan@intel.com>", "Subject": "[Intel-wired-lan] [PATCH S11 05/16] ice: fix stack hogs from struct\n\tice_vsi_ctx structures", "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": "From: Bruce Allan <bruce.w.allan@intel.com>\n\nstruct ice_vsi_ctx has gotten large enough that function local declarations\nof it on the stack are causing stack hogs. Fix that by allocating the\nstructs on heap. Cleanup some formatting issues in the code around these\nchanges and fix incorrect data type uses of returned functions in a couple\nplaces.\n\nSigned-off-by: Bruce Allan <bruce.w.allan@intel.com>\nSigned-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>\n---\n drivers/net/ethernet/intel/ice/ice_lib.c | 98 +++++++++++++++---------\n drivers/net/ethernet/intel/ice/ice_main.c | 27 ++++---\n drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 59 ++++++++------\n 3 files changed, 117 insertions(+), 67 deletions(-)", "diff": "diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c\nindex 82aae530d6c5..d93a0d5a783c 100644\n--- a/drivers/net/ethernet/intel/ice/ice_lib.c\n+++ b/drivers/net/ethernet/intel/ice/ice_lib.c\n@@ -348,19 +348,25 @@ static int ice_get_free_slot(void *array, int size, int curr)\n void ice_vsi_delete(struct ice_vsi *vsi)\n {\n \tstruct ice_pf *pf = vsi->back;\n-\tstruct ice_vsi_ctx ctxt;\n+\tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n \n+\tctxt = devm_kzalloc(&pf->pdev->dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn;\n+\n \tif (vsi->type == ICE_VSI_VF)\n-\t\tctxt.vf_num = vsi->vf_id;\n-\tctxt.vsi_num = vsi->vsi_num;\n+\t\tctxt->vf_num = vsi->vf_id;\n+\tctxt->vsi_num = vsi->vsi_num;\n \n-\tmemcpy(&ctxt.info, &vsi->info, sizeof(ctxt.info));\n+\tmemcpy(&ctxt->info, &vsi->info, sizeof(ctxt->info));\n \n-\tstatus = ice_free_vsi(&pf->hw, vsi->idx, &ctxt, false, NULL);\n+\tstatus = ice_free_vsi(&pf->hw, vsi->idx, ctxt, false, NULL);\n \tif (status)\n \t\tdev_err(&pf->pdev->dev, \"Failed to delete VSI %i in FW\\n\",\n \t\t\tvsi->vsi_num);\n+\n+\tdevm_kfree(&pf->pdev->dev, ctxt);\n }\n \n /**\n@@ -908,37 +914,41 @@ static void ice_set_rss_vsi_ctx(struct ice_vsi_ctx *ctxt, struct ice_vsi *vsi)\n */\n static int ice_vsi_init(struct ice_vsi *vsi)\n {\n-\tstruct ice_vsi_ctx ctxt = { 0 };\n \tstruct ice_pf *pf = vsi->back;\n \tstruct ice_hw *hw = &pf->hw;\n+\tstruct ice_vsi_ctx *ctxt;\n \tint ret = 0;\n \n+\tctxt = devm_kzalloc(&pf->pdev->dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n+\n \tswitch (vsi->type) {\n \tcase ICE_VSI_PF:\n-\t\tctxt.flags = ICE_AQ_VSI_TYPE_PF;\n+\t\tctxt->flags = ICE_AQ_VSI_TYPE_PF;\n \t\tbreak;\n \tcase ICE_VSI_VF:\n-\t\tctxt.flags = ICE_AQ_VSI_TYPE_VF;\n+\t\tctxt->flags = ICE_AQ_VSI_TYPE_VF;\n \t\t/* VF number here is the absolute VF number (0-255) */\n-\t\tctxt.vf_num = vsi->vf_id + hw->func_caps.vf_base_id;\n+\t\tctxt->vf_num = vsi->vf_id + hw->func_caps.vf_base_id;\n \t\tbreak;\n \tdefault:\n \t\treturn -ENODEV;\n \t}\n \n-\tice_set_dflt_vsi_ctx(&ctxt);\n+\tice_set_dflt_vsi_ctx(ctxt);\n \t/* if the switch is in VEB mode, allow VSI loopback */\n \tif (vsi->vsw->bridge_mode == BRIDGE_MODE_VEB)\n-\t\tctxt.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\t\tctxt->info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n \n \t/* Set LUT type and HASH type if RSS is enabled */\n \tif (test_bit(ICE_FLAG_RSS_ENA, pf->flags))\n-\t\tice_set_rss_vsi_ctx(&ctxt, vsi);\n+\t\tice_set_rss_vsi_ctx(ctxt, vsi);\n \n-\tctxt.info.sw_id = vsi->port_info->sw_id;\n-\tice_vsi_setup_q_map(vsi, &ctxt);\n+\tctxt->info.sw_id = vsi->port_info->sw_id;\n+\tice_vsi_setup_q_map(vsi, ctxt);\n \n-\tret = ice_add_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tret = ice_add_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (ret) {\n \t\tdev_err(&pf->pdev->dev,\n \t\t\t\"Add VSI failed, err %d\\n\", ret);\n@@ -946,11 +956,12 @@ static int ice_vsi_init(struct ice_vsi *vsi)\n \t}\n \n \t/* keep context for update VSI operations */\n-\tvsi->info = ctxt.info;\n+\tvsi->info = ctxt->info;\n \n \t/* record VSI number returned */\n-\tvsi->vsi_num = ctxt.vsi_num;\n+\tvsi->vsi_num = ctxt->vsi_num;\n \n+\tdevm_kfree(&pf->pdev->dev, ctxt);\n \treturn ret;\n }\n \n@@ -1823,26 +1834,34 @@ int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)\n {\n \tstruct device *dev = &vsi->back->pdev->dev;\n \tstruct ice_hw *hw = &vsi->back->hw;\n-\tstruct ice_vsi_ctx ctxt = { 0 };\n+\tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n+\tint ret = 0;\n+\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n \n \t/* Here we are configuring the VSI to let the driver add VLAN tags by\n \t * setting vlan_flags to ICE_AQ_VSI_VLAN_MODE_ALL. The actual VLAN tag\n \t * insertion happens in the Tx hot path, in ice_tx_map.\n \t */\n-\tctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_ALL;\n+\tctxt->info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_ALL;\n \n-\tctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n \n-\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tstatus = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (status) {\n \t\tdev_err(dev, \"update VSI for VLAN insert failed, err %d aq_err %d\\n\",\n \t\t\tstatus, hw->adminq.sq_last_status);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \n-\tvsi->info.vlan_flags = ctxt.info.vlan_flags;\n-\treturn 0;\n+\tvsi->info.vlan_flags = ctxt->info.vlan_flags;\n+out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn ret;\n }\n \n /**\n@@ -1854,35 +1873,42 @@ int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)\n {\n \tstruct device *dev = &vsi->back->pdev->dev;\n \tstruct ice_hw *hw = &vsi->back->hw;\n-\tstruct ice_vsi_ctx ctxt = { 0 };\n+\tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n+\tint ret = 0;\n+\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n \n \t/* Here we are configuring what the VSI should do with the VLAN tag in\n \t * the Rx packet. We can either leave the tag in the packet or put it in\n \t * the Rx descriptor.\n \t */\n-\tif (ena) {\n+\tif (ena)\n \t\t/* Strip VLAN tag from Rx packet and put it in the desc */\n-\t\tctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_STR_BOTH;\n-\t} else {\n+\t\tctxt->info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_STR_BOTH;\n+\telse\n \t\t/* Disable stripping. Leave tag in packet */\n-\t\tctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;\n-\t}\n+\t\tctxt->info.vlan_flags = ICE_AQ_VSI_VLAN_EMOD_NOTHING;\n \n \t/* Allow all packets untagged/tagged */\n-\tctxt.info.vlan_flags |= ICE_AQ_VSI_VLAN_MODE_ALL;\n+\tctxt->info.vlan_flags |= ICE_AQ_VSI_VLAN_MODE_ALL;\n \n-\tctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n \n-\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tstatus = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (status) {\n \t\tdev_err(dev, \"update VSI for VLAN strip failed, ena = %d err %d aq_err %d\\n\",\n \t\t\tena, status, hw->adminq.sq_last_status);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \n-\tvsi->info.vlan_flags = ctxt.info.vlan_flags;\n-\treturn 0;\n+\tvsi->info.vlan_flags = ctxt->info.vlan_flags;\n+out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn ret;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c\nindex 0731b8994958..aff348e42562 100644\n--- a/drivers/net/ethernet/intel/ice/ice_main.c\n+++ b/drivers/net/ethernet/intel/ice/ice_main.c\n@@ -3707,30 +3707,39 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)\n \tstruct device *dev = &vsi->back->pdev->dev;\n \tstruct ice_aqc_vsi_props *vsi_props;\n \tstruct ice_hw *hw = &vsi->back->hw;\n-\tstruct ice_vsi_ctx ctxt = { 0 };\n+\tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n+\tint ret = 0;\n \n \tvsi_props = &vsi->info;\n-\tctxt.info = vsi->info;\n+\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n+\n+\tctxt->info = vsi->info;\n \n \tif (bmode == BRIDGE_MODE_VEB)\n \t\t/* change from VEPA to VEB mode */\n-\t\tctxt.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\t\tctxt->info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n \telse\n \t\t/* change from VEB to VEPA mode */\n-\t\tctxt.info.sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n-\tctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);\n+\t\tctxt->info.sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB;\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);\n \n-\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tstatus = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (status) {\n \t\tdev_err(dev, \"update VSI for bridge mode failed, bmode = %d err %d aq_err %d\\n\",\n \t\t\tbmode, status, hw->adminq.sq_last_status);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \t/* Update sw flags for book keeping */\n-\tvsi_props->sw_flags = ctxt.info.sw_flags;\n+\tvsi_props->sw_flags = ctxt->info.sw_flags;\n \n-\treturn 0;\n+out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn ret;\n }\n \n /**\ndiff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\nindex 80b50e67cbef..79d793a76042 100644\n--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c\n@@ -345,25 +345,33 @@ static int ice_vsi_set_pvid(struct ice_vsi *vsi, u16 vid)\n {\n \tstruct device *dev = &vsi->back->pdev->dev;\n \tstruct ice_hw *hw = &vsi->back->hw;\n-\tstruct ice_vsi_ctx ctxt = { 0 };\n+\tstruct ice_vsi_ctx *ctxt;\n \tenum ice_status status;\n+\tint ret = 0;\n+\n+\tctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);\n+\tif (!ctxt)\n+\t\treturn -ENOMEM;\n \n-\tctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED |\n-\t\t\t ICE_AQ_VSI_PVLAN_INSERT_PVID |\n-\t\t\t ICE_AQ_VSI_VLAN_EMOD_STR;\n-\tctxt.info.pvid = cpu_to_le16(vid);\n-\tctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n+\tctxt->info.vlan_flags = (ICE_AQ_VSI_VLAN_MODE_UNTAGGED |\n+\t\t\t\t ICE_AQ_VSI_PVLAN_INSERT_PVID |\n+\t\t\t\t ICE_AQ_VSI_VLAN_EMOD_STR);\n+\tctxt->info.pvid = cpu_to_le16(vid);\n+\tctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_VLAN_VALID);\n \n-\tstatus = ice_update_vsi(hw, vsi->idx, &ctxt, NULL);\n+\tstatus = ice_update_vsi(hw, vsi->idx, ctxt, NULL);\n \tif (status) {\n \t\tdev_info(dev, \"update VSI for VLAN insert failed, err %d aq_err %d\\n\",\n \t\t\t status, hw->adminq.sq_last_status);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \n-\tvsi->info.pvid = ctxt.info.pvid;\n-\tvsi->info.vlan_flags = ctxt.info.vlan_flags;\n-\treturn 0;\n+\tvsi->info.pvid = ctxt->info.pvid;\n+\tvsi->info.vlan_flags = ctxt->info.vlan_flags;\n+out:\n+\tdevm_kfree(dev, ctxt);\n+\treturn ret;\n }\n \n /**\n@@ -2479,11 +2487,12 @@ int ice_get_vf_cfg(struct net_device *netdev, int vf_id,\n int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)\n {\n \tstruct ice_netdev_priv *np = netdev_priv(netdev);\n-\tstruct ice_vsi_ctx ctx = { 0 };\n \tstruct ice_vsi *vsi = np->vsi;\n \tstruct ice_pf *pf = vsi->back;\n+\tstruct ice_vsi_ctx *ctx;\n+\tenum ice_status status;\n \tstruct ice_vf *vf;\n-\tint status;\n+\tint ret = 0;\n \n \t/* validate the request */\n \tif (vf_id >= pf->num_alloc_vfs) {\n@@ -2503,25 +2512,31 @@ int ice_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool ena)\n \t\treturn 0;\n \t}\n \n-\tctx.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);\n+\tctx = devm_kzalloc(&pf->pdev->dev, sizeof(*ctx), GFP_KERNEL);\n+\tif (!ctx)\n+\t\treturn -ENOMEM;\n+\n+\tctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SECURITY_VALID);\n \n \tif (ena) {\n-\t\tctx.info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;\n-\t\tctx.info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M;\n+\t\tctx->info.sec_flags |= ICE_AQ_VSI_SEC_FLAG_ENA_MAC_ANTI_SPOOF;\n+\t\tctx->info.sw_flags2 |= ICE_AQ_VSI_SW_FLAG_RX_PRUNE_EN_M;\n \t}\n \n-\tstatus = ice_update_vsi(&pf->hw, vsi->idx, &ctx, NULL);\n+\tstatus = ice_update_vsi(&pf->hw, vsi->idx, ctx, NULL);\n \tif (status) {\n \t\tdev_dbg(&pf->pdev->dev,\n \t\t\t\"Error %d, failed to update VSI* parameters\\n\", status);\n-\t\treturn -EIO;\n+\t\tret = -EIO;\n+\t\tgoto out;\n \t}\n \n \tvf->spoofchk = ena;\n-\tvsi->info.sec_flags = ctx.info.sec_flags;\n-\tvsi->info.sw_flags2 = ctx.info.sw_flags2;\n-\n-\treturn status;\n+\tvsi->info.sec_flags = ctx->info.sec_flags;\n+\tvsi->info.sw_flags2 = ctx->info.sw_flags2;\n+out:\n+\tdevm_kfree(&pf->pdev->dev, ctx);\n+\treturn ret;\n }\n \n /**\n", "prefixes": [ "S11", "05/16" ] }