From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E5BD12C60 for ; Mon, 25 Mar 2019 06:43:07 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 22:43:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="128368662" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2019 22:43:05 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, paul.m.stillwell.jr@intel.com, ferruh.yigit@intel.com, Qi Zhang , Bruce Allan Date: Mon, 25 Mar 2019 13:44:19 +0800 Message-Id: <20190325054452.2616-6-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190325054452.2616-1-qi.z.zhang@intel.com> References: <20190228055650.25237-1-qi.z.zhang@intel.com> <20190325054452.2616-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 05/38] net/ice/base: allow package copy to be used after resets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Mar 2019 05:43:08 -0000 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 --- drivers/net/ice/base/ice_flex_pipe.c | 9 +++++---- drivers/net/ice/base/ice_type.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index c87424601..66c47abda 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 2e865a78f..6bd73ed04 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; -- 2.13.6 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 27D2EA05D3 for ; Mon, 25 Mar 2019 06:43:56 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E090D4CA6; Mon, 25 Mar 2019 06:43:15 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id E5BD12C60 for ; Mon, 25 Mar 2019 06:43:07 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 22:43:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="128368662" Received: from dpdk51.sh.intel.com ([10.67.110.245]) by orsmga008.jf.intel.com with ESMTP; 24 Mar 2019 22:43:05 -0700 From: Qi Zhang To: wenzhuo.lu@intel.com, qiming.yang@intel.com Cc: dev@dpdk.org, paul.m.stillwell.jr@intel.com, ferruh.yigit@intel.com, Qi Zhang , Bruce Allan Date: Mon, 25 Mar 2019 13:44:19 +0800 Message-Id: <20190325054452.2616-6-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190325054452.2616-1-qi.z.zhang@intel.com> References: <20190228055650.25237-1-qi.z.zhang@intel.com> <20190325054452.2616-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH v4 05/38] net/ice/base: allow package copy to be used after resets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190325054419.gcvHZzPSv4YyfeT2RAXwOODUVUkrka71PxXwNzOxp6U@z> 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 --- drivers/net/ice/base/ice_flex_pipe.c | 9 +++++---- drivers/net/ice/base/ice_type.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c index c87424601..66c47abda 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 2e865a78f..6bd73ed04 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; -- 2.13.6