diff options
author | Ariel Elior <ariele@broadcom.com> | 2013-08-27 18:13:03 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-27 22:03:04 -0400 |
commit | b4cddbd6dd9b3b9e08c26d8b7247e4e011092117 (patch) | |
tree | 778f0b97b2ca1dcfe696b65caca867486b5a0b42 | |
parent | 35a04aa35c2929f24c7f063f42b6d776ad848c24 (diff) |
bnx2x: Fix VF memory leak unload
Due to incorrect VF/PF conditions, when unloading a VF it will not release
part of the memory it has previously allocated.
Signed-off-by: Ariel Elior <ariele@broadcom.com>
Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 3 | ||||
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 9 |
2 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c index 26b4dfcc0087..0cc26110868d 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | |||
@@ -2962,8 +2962,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link) | |||
2962 | if (IS_PF(bp)) { | 2962 | if (IS_PF(bp)) { |
2963 | if (CNIC_LOADED(bp)) | 2963 | if (CNIC_LOADED(bp)) |
2964 | bnx2x_free_mem_cnic(bp); | 2964 | bnx2x_free_mem_cnic(bp); |
2965 | bnx2x_free_mem(bp); | ||
2966 | } | 2965 | } |
2966 | bnx2x_free_mem(bp); | ||
2967 | |||
2967 | bp->state = BNX2X_STATE_CLOSED; | 2968 | bp->state = BNX2X_STATE_CLOSED; |
2968 | bp->cnic_loaded = false; | 2969 | bp->cnic_loaded = false; |
2969 | 2970 | ||
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 8bdc8b973007..1627a4e09c32 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -7855,12 +7855,15 @@ void bnx2x_free_mem(struct bnx2x *bp) | |||
7855 | { | 7855 | { |
7856 | int i; | 7856 | int i; |
7857 | 7857 | ||
7858 | BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping, | ||
7859 | sizeof(struct host_sp_status_block)); | ||
7860 | |||
7861 | BNX2X_PCI_FREE(bp->fw_stats, bp->fw_stats_mapping, | 7858 | BNX2X_PCI_FREE(bp->fw_stats, bp->fw_stats_mapping, |
7862 | bp->fw_stats_data_sz + bp->fw_stats_req_sz); | 7859 | bp->fw_stats_data_sz + bp->fw_stats_req_sz); |
7863 | 7860 | ||
7861 | if (IS_VF(bp)) | ||
7862 | return; | ||
7863 | |||
7864 | BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping, | ||
7865 | sizeof(struct host_sp_status_block)); | ||
7866 | |||
7864 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, | 7867 | BNX2X_PCI_FREE(bp->slowpath, bp->slowpath_mapping, |
7865 | sizeof(struct bnx2x_slowpath)); | 7868 | sizeof(struct bnx2x_slowpath)); |
7866 | 7869 | ||