From: Qi Zhang Date: Mon, 25 Mar 2019 05:44:19 +0000 (+0800) Subject: net/ice/base: allow package copy to be used after resets X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=aeff2769f370ecc7e9c273e06e60bdaeb044c1c0;p=dpdk.git net/ice/base: allow package copy to be used after resets For components that make a copy of an external pipeline package file (i.e. the Linux and FreeBSD drivers), save the size of the package file along with the copy so that both can be used when calling ice_init_pkg() after a CORER/GLOBR reset. Also, do not free the copy of the package file in ice_init_pkg() since it is needed afterward for subsequent resets. Signed-off-by: Bruce Allan Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Reviewed-by: Qiming Yang Reviewed-by: Wenzhuo Lu --- diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index c874246017..66c47abda8 100644 --- a/drivers/net/ice/base/ice_flex_pipe.c +++ b/drivers/net/ice/base/ice_flex_pipe.c @@ -1269,6 +1269,7 @@ void ice_free_seg(struct ice_hw *hw) if (hw->pkg_copy) { ice_free(hw, hw->pkg_copy); hw->pkg_copy = NULL; + hw->pkg_size = 0; } hw->seg = NULL; } @@ -1351,8 +1352,6 @@ static enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len) status = ICE_SUCCESS; } - /* Free a previous segment, if necessary */ - ice_free_seg(hw); if (!status) { hw->seg = seg; /* on successful package download, update other required @@ -1401,12 +1400,14 @@ enum ice_status ice_copy_and_init_pkg(struct ice_hw *hw, const u8 *buf, u32 len) buf_copy = (u8 *)ice_memdup(hw, buf, len, ICE_NONDMA_TO_NONDMA); status = ice_init_pkg(hw, buf_copy, len); - if (status) + if (status) { /* Free the copy, since we failed to initialize the package */ ice_free(hw, buf_copy); - else + } else { /* Track the copied pkg so we can free it later */ hw->pkg_copy = buf_copy; + hw->pkg_size = len; + } return status; } diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h index 2e865a78fb..6bd73ed04d 100644 --- a/drivers/net/ice/base/ice_type.h +++ b/drivers/net/ice/base/ice_type.h @@ -728,6 +728,7 @@ struct ice_hw { /* Pointer to allocated copy of pkg memory */ u8 *pkg_copy; + u32 pkg_size; /* tunneling info */ struct ice_tunnel_table tnl;