From 48e8d2396ff3950e9ac69022a876324ceec8571d Mon Sep 17 00:00:00 2001 From: Rasesh Mody Date: Tue, 18 Oct 2016 21:11:17 -0700 Subject: [PATCH] net/qede: use firmware config macros as needed Replaced CONFIG_QED_BINARY_FW with CONFIG_ECORE_BINARY_FW. Use CONFIG_ECORE_BINARY_FW and CONFIG_ECORE_ZIPPED_FW defines as required. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/bcm_osal.c | 2 ++ drivers/net/qede/base/ecore.h | 20 +++++++++++++++----- drivers/net/qede/qede_main.c | 20 +++++++++++--------- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/drivers/net/qede/base/bcm_osal.c b/drivers/net/qede/base/bcm_osal.c index 16029b589d..67270fdb78 100644 --- a/drivers/net/qede/base/bcm_osal.c +++ b/drivers/net/qede/base/bcm_osal.c @@ -152,6 +152,7 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev, return mz->addr; } +#ifdef CONFIG_ECORE_ZIPPED_FW u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len, u8 *input_buf, u32 max_size, u8 *unzip_buf) { @@ -182,6 +183,7 @@ u32 qede_unzip_data(struct ecore_hwfn *p_hwfn, u32 input_len, return p_hwfn->stream->total_out / 4; } +#endif void qede_get_mcp_proto_stats(struct ecore_dev *edev, diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index c83b22bf51..b9127de963 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -9,6 +9,18 @@ #ifndef __ECORE_H #define __ECORE_H +/* @DPDK */ +#include +#include +#include + +#define CONFIG_ECORE_BINARY_FW +#define CONFIG_ECORE_ZIPPED_FW + +#ifdef CONFIG_ECORE_ZIPPED_FW +#include +#endif + #include "ecore_hsi_common.h" #include "ecore_hsi_debug_tools.h" #include "ecore_hsi_init_func.h" @@ -423,9 +435,6 @@ struct storm_stats { u32 len; }; -#define CONFIG_ECORE_BINARY_FW -#define CONFIG_ECORE_ZIPPED_FW - struct ecore_fw_data { #ifdef CONFIG_ECORE_BINARY_FW struct fw_ver_info *fw_ver_info; @@ -521,8 +530,8 @@ struct ecore_hwfn { /* QM init */ struct ecore_qm_info qm_info; - /* Buffer for unzipping firmware data */ #ifdef CONFIG_ECORE_ZIPPED_FW + /* Buffer for unzipping firmware data */ void *unzip_buf; #endif @@ -674,9 +683,10 @@ struct ecore_dev { bool b_is_emul_full; #endif +#ifdef CONFIG_ECORE_BINARY_FW /* @DPDK */ void *firmware; - u64 fw_len; +#endif }; diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 73608c697c..2e62371d09 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -6,10 +6,6 @@ * See LICENSE.qede_pmd for copyright and licensing details. */ -#include -#include -#include -#include #include #include @@ -20,7 +16,6 @@ static uint8_t npar_tx_switching = 1; /* Alarm timeout. */ #define QEDE_ALARM_TIMEOUT_US 100000 -#define CONFIG_QED_BINARY_FW /* Global variable to hold absolute path of fw file */ char fw_file[PATH_MAX]; @@ -83,6 +78,7 @@ static int qed_nic_setup(struct ecore_dev *edev) return rc; } +#ifdef CONFIG_ECORE_ZIPPED_FW static int qed_alloc_stream_mem(struct ecore_dev *edev) { int i; @@ -112,7 +108,9 @@ static void qed_free_stream_mem(struct ecore_dev *edev) OSAL_FREE(p_hwfn->p_dev, p_hwfn->stream); } } +#endif +#ifdef CONFIG_ECORE_BINARY_FW static int qed_load_firmware_data(struct ecore_dev *edev) { int fd; @@ -158,6 +156,7 @@ static int qed_load_firmware_data(struct ecore_dev *edev) return 0; } +#endif static void qed_handle_bulletin_change(struct ecore_hwfn *hwfn) { @@ -222,7 +221,7 @@ static int qed_slowpath_start(struct ecore_dev *edev, struct ecore_tunn_start_params tunn_info; #endif -#ifdef CONFIG_QED_BINARY_FW +#ifdef CONFIG_ECORE_BINARY_FW if (IS_PF(edev)) { rc = qed_load_firmware_data(edev); if (rc) { @@ -240,7 +239,7 @@ static int qed_slowpath_start(struct ecore_dev *edev, /* set int_coalescing_mode */ edev->int_coalescing_mode = ECORE_COAL_MODE_ENABLE; - /* Should go with CONFIG_QED_BINARY_FW */ +#ifdef CONFIG_ECORE_ZIPPED_FW if (IS_PF(edev)) { /* Allocate stream for unzipping */ rc = qed_alloc_stream_mem(edev); @@ -252,9 +251,10 @@ static int qed_slowpath_start(struct ecore_dev *edev, } qed_start_iov_task(edev); +#endif /* Start the slowpath */ -#ifdef CONFIG_QED_BINARY_FW +#ifdef CONFIG_ECORE_BINARY_FW if (IS_PF(edev)) data = edev->firmware; #endif @@ -307,7 +307,7 @@ static int qed_slowpath_start(struct ecore_dev *edev, err2: ecore_resc_free(edev); err: -#ifdef CONFIG_QED_BINARY_FW +#ifdef CONFIG_ECORE_BINARY_FW if (IS_PF(edev)) { if (edev->firmware) rte_free(edev->firmware); @@ -625,7 +625,9 @@ static int qed_slowpath_stop(struct ecore_dev *edev) return -ENODEV; if (IS_PF(edev)) { +#ifdef CONFIG_ECORE_ZIPPED_FW qed_free_stream_mem(edev); +#endif #ifdef CONFIG_QED_SRIOV if (IS_QED_ETH_IF(edev)) -- 2.20.1