aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Raj <victor.raj@intel.com>2018-10-26 13:40:53 -0400
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2018-11-06 15:46:47 -0500
commit33e055fcc26909b1d66b5d1f334aee38356068d7 (patch)
treeecfc4389eb8992c2b7bbbf3346315e4124289ee7
parent0f5d4c21a50716f8bd4e220544b82dca7408d113 (diff)
ice: Free VSI contexts during for unload
In the unload path, all VSIs are freed. Also free the related VSI contexts to prevent memory leaks. Signed-off-by: Victor Raj <victor.raj@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>
-rw-r--r--drivers/net/ethernet/intel/ice/ice_common.c3
-rw-r--r--drivers/net/ethernet/intel/ice/ice_switch.c12
-rw-r--r--drivers/net/ethernet/intel/ice/ice_switch.h2
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 8cd6a2401fd9..554fd707a6d6 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -811,6 +811,9 @@ void ice_deinit_hw(struct ice_hw *hw)
811 /* Attempt to disable FW logging before shutting down control queues */ 811 /* Attempt to disable FW logging before shutting down control queues */
812 ice_cfg_fw_log(hw, false); 812 ice_cfg_fw_log(hw, false);
813 ice_shutdown_all_ctrlq(hw); 813 ice_shutdown_all_ctrlq(hw);
814
815 /* Clear VSI contexts if not already cleared */
816 ice_clear_all_vsi_ctx(hw);
814} 817}
815 818
816/** 819/**
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.c b/drivers/net/ethernet/intel/ice/ice_switch.c
index 33403f39f1b3..40c9c6558956 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.c
+++ b/drivers/net/ethernet/intel/ice/ice_switch.c
@@ -348,6 +348,18 @@ static void ice_clear_vsi_ctx(struct ice_hw *hw, u16 vsi_handle)
348} 348}
349 349
350/** 350/**
351 * ice_clear_all_vsi_ctx - clear all the VSI context entries
352 * @hw: pointer to the hw struct
353 */
354void ice_clear_all_vsi_ctx(struct ice_hw *hw)
355{
356 u16 i;
357
358 for (i = 0; i < ICE_MAX_VSI; i++)
359 ice_clear_vsi_ctx(hw, i);
360}
361
362/**
351 * ice_add_vsi - add VSI context to the hardware and VSI handle list 363 * ice_add_vsi - add VSI context to the hardware and VSI handle list
352 * @hw: pointer to the hw struct 364 * @hw: pointer to the hw struct
353 * @vsi_handle: unique VSI handle provided by drivers 365 * @vsi_handle: unique VSI handle provided by drivers
diff --git a/drivers/net/ethernet/intel/ice/ice_switch.h b/drivers/net/ethernet/intel/ice/ice_switch.h
index b88d96a1ef69..d5ef0bd58bf9 100644
--- a/drivers/net/ethernet/intel/ice/ice_switch.h
+++ b/drivers/net/ethernet/intel/ice/ice_switch.h
@@ -190,6 +190,8 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx,
190 struct ice_sq_cd *cd); 190 struct ice_sq_cd *cd);
191bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle); 191bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
192struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle); 192struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
193void ice_clear_all_vsi_ctx(struct ice_hw *hw);
194/* Switch config */
193enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw); 195enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
194 196
195/* Switch/bridge related commands */ 197/* Switch/bridge related commands */