aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/ice/ice_main.c
diff options
context:
space:
mode:
authorBruce Allan <bruce.w.allan@intel.com>2019-02-08 15:50:32 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2019-02-25 11:56:01 -0500
commit198a666a4543be1a6e48f4b701dd3bd9387d37c3 (patch)
tree6a73814a797af37f389e0c8576553a2be4e81341 /drivers/net/ethernet/intel/ice/ice_main.c
parentc6dfd690f1c333475db1833ef3b5a4f4d6ba7365 (diff)
ice: fix stack hogs from struct ice_vsi_ctx structures
struct ice_vsi_ctx has gotten large enough that function local declarations of it on the stack are causing stack hogs. Fix that by allocating the structs on heap. Cleanup some formatting issues in the code around these changes and fix incorrect data type uses of returned functions in a couple places. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Andrew Bowers <andrewx.bowers@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/ice/ice_main.c')
-rw-r--r--drivers/net/ethernet/intel/ice/ice_main.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 0731b8994958..aff348e42562 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -3707,30 +3707,39 @@ static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
3707 struct device *dev = &vsi->back->pdev->dev; 3707 struct device *dev = &vsi->back->pdev->dev;
3708 struct ice_aqc_vsi_props *vsi_props; 3708 struct ice_aqc_vsi_props *vsi_props;
3709 struct ice_hw *hw = &vsi->back->hw; 3709 struct ice_hw *hw = &vsi->back->hw;
3710 struct ice_vsi_ctx ctxt = { 0 }; 3710 struct ice_vsi_ctx *ctxt;
3711 enum ice_status status; 3711 enum ice_status status;
3712 int ret = 0;
3712 3713
3713 vsi_props = &vsi->info; 3714 vsi_props = &vsi->info;
3714 ctxt.info = vsi->info; 3715
3716 ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
3717 if (!ctxt)
3718 return -ENOMEM;
3719
3720 ctxt->info = vsi->info;
3715 3721
3716 if (bmode == BRIDGE_MODE_VEB) 3722 if (bmode == BRIDGE_MODE_VEB)
3717 /* change from VEPA to VEB mode */ 3723 /* change from VEPA to VEB mode */
3718 ctxt.info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB; 3724 ctxt->info.sw_flags |= ICE_AQ_VSI_SW_FLAG_ALLOW_LB;
3719 else 3725 else
3720 /* change from VEB to VEPA mode */ 3726 /* change from VEB to VEPA mode */
3721 ctxt.info.sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB; 3727 ctxt->info.sw_flags &= ~ICE_AQ_VSI_SW_FLAG_ALLOW_LB;
3722 ctxt.info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID); 3728 ctxt->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_SW_VALID);
3723 3729
3724 status = ice_update_vsi(hw, vsi->idx, &ctxt, NULL); 3730 status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
3725 if (status) { 3731 if (status) {
3726 dev_err(dev, "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n", 3732 dev_err(dev, "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n",
3727 bmode, status, hw->adminq.sq_last_status); 3733 bmode, status, hw->adminq.sq_last_status);
3728 return -EIO; 3734 ret = -EIO;
3735 goto out;
3729 } 3736 }
3730 /* Update sw flags for book keeping */ 3737 /* Update sw flags for book keeping */
3731 vsi_props->sw_flags = ctxt.info.sw_flags; 3738 vsi_props->sw_flags = ctxt->info.sw_flags;
3732 3739
3733 return 0; 3740out:
3741 devm_kfree(dev, ctxt);
3742 return ret;
3734} 3743}
3735 3744
3736/** 3745/**