net/qede: use firmware config macros as needed
authorRasesh Mody <rasesh.mody@qlogic.com>
Wed, 19 Oct 2016 04:11:17 +0000 (21:11 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 26 Oct 2016 17:38:29 +0000 (19:38 +0200)
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 <rasesh.mody@qlogic.com>
drivers/net/qede/base/bcm_osal.c
drivers/net/qede/base/ecore.h
drivers/net/qede/qede_main.c

index 16029b5..67270fd 100644 (file)
@@ -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,
index c83b22b..b9127de 100644 (file)
@@ -9,6 +9,18 @@
 #ifndef __ECORE_H
 #define __ECORE_H
 
+/* @DPDK */
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define CONFIG_ECORE_BINARY_FW
+#define CONFIG_ECORE_ZIPPED_FW
+
+#ifdef CONFIG_ECORE_ZIPPED_FW
+#include <zlib.h>
+#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
 
 };
 
index 73608c6..2e62371 100644 (file)
@@ -6,10 +6,6 @@
  * See LICENSE.qede_pmd for copyright and licensing details.
  */
 
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <zlib.h>
 #include <limits.h>
 #include <rte_alarm.h>
 
@@ -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))