net/qede/base: semantic changes
authorRasesh Mody <rasesh.mody@cavium.com>
Sat, 29 Sep 2018 08:14:39 +0000 (08:14 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 11 Oct 2018 16:53:48 +0000 (18:53 +0200)
This patch consists of semantic/formatting changes.

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
drivers/net/qede/base/ecore_dcbx.c
drivers/net/qede/base/ecore_init_ops.c
drivers/net/qede/base/ecore_int.c
drivers/net/qede/base/ecore_int_api.h
drivers/net/qede/base/ecore_l2.c
drivers/net/qede/base/ecore_mcp.c
drivers/net/qede/base/ecore_spq.c
drivers/net/qede/base/ecore_sriov.c

index 7981c42..cbc69cd 100644 (file)
@@ -325,7 +325,7 @@ ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt)
 {
        struct dcbx_app_priority_feature *p_app;
        struct dcbx_app_priority_entry *p_tbl;
-       struct ecore_dcbx_results data = { 0 };
+       struct ecore_dcbx_results data;
        struct dcbx_ets_feature *p_ets;
        struct ecore_hw_info *p_info;
        u32 pri_tc_tbl, flags;
@@ -345,6 +345,7 @@ ecore_dcbx_process_mib_info(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt)
        p_info = &p_hwfn->hw_info;
        num_entries = GET_MFW_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES);
 
+       OSAL_MEMSET(&data, 0, sizeof(struct ecore_dcbx_results));
        rc = ecore_dcbx_process_tlv(p_hwfn, p_ptt, &data, p_tbl, pri_tc_tbl,
                                    num_entries, dcbx_version);
        if (rc != ECORE_SUCCESS)
index 47c1be2..044308b 100644 (file)
@@ -420,11 +420,11 @@ static u8 ecore_init_cmd_mode_match(struct ecore_hwfn *p_hwfn,
                                    u16 *p_offset, int modes)
 {
        struct ecore_dev *p_dev = p_hwfn->p_dev;
-       const u8 *modes_tree_buf;
        u8 arg1, arg2, tree_val;
+       const u8 *modes_tree;
 
-       modes_tree_buf = p_dev->fw_data->modes_tree_buf;
-       tree_val = modes_tree_buf[(*p_offset)++];
+       modes_tree = p_dev->fw_data->modes_tree_buf;
+       tree_val = modes_tree[(*p_offset)++];
        switch (tree_val) {
        case INIT_MODE_OP_NOT:
                return ecore_init_cmd_mode_match(p_hwfn, p_offset, modes) ^ 1;
@@ -474,12 +474,12 @@ enum _ecore_status_t ecore_init_run(struct ecore_hwfn *p_hwfn,
 {
        struct ecore_dev *p_dev = p_hwfn->p_dev;
        u32 cmd_num, num_init_ops;
-       union init_op *init_ops;
+       union init_op *init;
        bool b_dmae = false;
        enum _ecore_status_t rc = ECORE_SUCCESS;
 
        num_init_ops = p_dev->fw_data->init_ops_size;
-       init_ops = p_dev->fw_data->init_ops;
+       init = p_dev->fw_data->init_ops;
 
 #ifdef CONFIG_ECORE_ZIPPED_FW
        p_hwfn->unzip_buf = OSAL_ZALLOC(p_hwfn->p_dev, GFP_ATOMIC,
@@ -491,7 +491,7 @@ enum _ecore_status_t ecore_init_run(struct ecore_hwfn *p_hwfn,
 #endif
 
        for (cmd_num = 0; cmd_num < num_init_ops; cmd_num++) {
-               union init_op *cmd = &init_ops[cmd_num];
+               union init_op *cmd = &init[cmd_num];
                u32 data = OSAL_LE32_TO_CPU(cmd->raw.op_data);
 
                switch (GET_FIELD(data, INIT_CALLBACK_OP_OP)) {
index e48a7bc..7368d55 100644 (file)
@@ -1224,8 +1224,9 @@ static enum _ecore_status_t ecore_int_attentions(struct ecore_hwfn *p_hwfn)
 static void ecore_sb_ack_attn(struct ecore_hwfn *p_hwfn,
                              void OSAL_IOMEM *igu_addr, u32 ack_cons)
 {
-       struct igu_prod_cons_update igu_ack = { 0 };
+       struct igu_prod_cons_update igu_ack;
 
+       OSAL_MEMSET(&igu_ack, 0, sizeof(struct igu_prod_cons_update));
        igu_ack.sb_id_and_flags =
            ((ack_cons << IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT) |
             (1 << IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT) |
index 5b9c31d..42538a4 100644 (file)
@@ -92,8 +92,9 @@ static OSAL_INLINE u16 ecore_sb_update_sb_idx(struct ecore_sb_info *sb_info)
 static OSAL_INLINE void ecore_sb_ack(struct ecore_sb_info *sb_info,
                                     enum igu_int_cmd int_cmd, u8 upd_flg)
 {
-       struct igu_prod_cons_update igu_ack = { 0 };
+       struct igu_prod_cons_update igu_ack;
 
+       OSAL_MEMSET(&igu_ack, 0, sizeof(struct igu_prod_cons_update));
        igu_ack.sb_id_and_flags =
            ((sb_info->sb_ack << IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT) |
             (upd_flg << IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT) |
index 5a0905e..8b9817e 100644 (file)
@@ -2205,10 +2205,10 @@ ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
        return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL);
 }
 
-int ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn,
-                          struct ecore_ptt *p_ptt,
-                          struct ecore_queue_cid *p_cid,
-                          u16 *p_rx_coal)
+enum _ecore_status_t ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn,
+                                           struct ecore_ptt *p_ptt,
+                                           struct ecore_queue_cid *p_cid,
+                                           u16 *p_rx_coal)
 {
        u32 coalesce, address, is_valid;
        struct cau_sb_entry sb_entry;
@@ -2240,10 +2240,10 @@ int ecore_get_rxq_coalesce(struct ecore_hwfn *p_hwfn,
        return ECORE_SUCCESS;
 }
 
-int ecore_get_txq_coalesce(struct ecore_hwfn *p_hwfn,
-                          struct ecore_ptt *p_ptt,
-                          struct ecore_queue_cid *p_cid,
-                          u16 *p_tx_coal)
+enum _ecore_status_t ecore_get_txq_coalesce(struct ecore_hwfn *p_hwfn,
+                                           struct ecore_ptt *p_ptt,
+                                           struct ecore_queue_cid *p_cid,
+                                           u16 *p_tx_coal)
 {
        u32 coalesce, address, is_valid;
        struct cau_sb_entry sb_entry;
index 202db13..6c65606 100644 (file)
@@ -3084,7 +3084,7 @@ enum _ecore_status_t ecore_mcp_phy_read(struct ecore_dev *p_dev, u32 cmd,
 {
        struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
        struct ecore_ptt *p_ptt;
-       u32 resp, param;
+       u32 resp = 0, param;
        enum _ecore_status_t rc;
 
        p_ptt = ecore_ptt_acquire(p_hwfn);
@@ -3124,7 +3124,7 @@ enum _ecore_status_t ecore_mcp_nvm_del_file(struct ecore_dev *p_dev, u32 addr)
 {
        struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
        struct ecore_ptt *p_ptt;
-       u32 resp, param;
+       u32 resp = 0, param;
        enum _ecore_status_t rc;
 
        p_ptt = ecore_ptt_acquire(p_hwfn);
@@ -3143,7 +3143,7 @@ enum _ecore_status_t ecore_mcp_nvm_put_file_begin(struct ecore_dev *p_dev,
 {
        struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
        struct ecore_ptt *p_ptt;
-       u32 resp, param;
+       u32 resp = 0, param;
        enum _ecore_status_t rc;
 
        p_ptt = ecore_ptt_acquire(p_hwfn);
@@ -3237,8 +3237,8 @@ enum _ecore_status_t ecore_mcp_phy_write(struct ecore_dev *p_dev, u32 cmd,
                                         u32 addr, u8 *p_buf, u32 len)
 {
        struct ecore_hwfn *p_hwfn = ECORE_LEADING_HWFN(p_dev);
+       u32 resp = 0, param, nvm_cmd;
        struct ecore_ptt *p_ptt;
-       u32 resp, param, nvm_cmd;
        enum _ecore_status_t rc;
 
        p_ptt = ecore_ptt_acquire(p_hwfn);
@@ -4216,10 +4216,11 @@ enum _ecore_status_t ecore_mcp_get_ppfid_bitmap(struct ecore_hwfn *p_hwfn,
 void ecore_mcp_wol_wr(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt,
                      u32 offset, u32 val)
 {
-       struct ecore_mcp_mb_params mb_params = {0};
        enum _ecore_status_t       rc = ECORE_SUCCESS;
        u32                        dword = val;
+       struct ecore_mcp_mb_params mb_params;
 
+       OSAL_MEMSET(&mb_params, 0, sizeof(struct ecore_mcp_mb_params));
        mb_params.cmd = DRV_MSG_CODE_WRITE_WOL_REG;
        mb_params.param = offset;
        mb_params.p_data_src = &dword;
index 1a02ba2..88ad961 100644 (file)
@@ -282,6 +282,7 @@ ecore_async_event_completion(struct ecore_hwfn *p_hwfn,
                             struct event_ring_entry *p_eqe)
 {
        ecore_spq_async_comp_cb cb;
+       enum _ecore_status_t rc;
 
        if (p_eqe->protocol_id >= MAX_PROTOCOL_TYPE) {
                DP_ERR(p_hwfn, "Wrong protocol: %d\n", p_eqe->protocol_id);
@@ -289,15 +290,22 @@ ecore_async_event_completion(struct ecore_hwfn *p_hwfn,
        }
 
        cb = p_hwfn->p_spq->async_comp_cb[p_eqe->protocol_id];
-       if (cb) {
-               return cb(p_hwfn, p_eqe->opcode, p_eqe->echo,
-                         &p_eqe->data, p_eqe->fw_return_code);
-       } else {
+       if (!cb) {
                DP_NOTICE(p_hwfn,
                          true, "Unknown Async completion for protocol: %d\n",
                          p_eqe->protocol_id);
                return ECORE_INVAL;
        }
+
+       rc = cb(p_hwfn, p_eqe->opcode, p_eqe->echo,
+               &p_eqe->data, p_eqe->fw_return_code);
+       if (rc != ECORE_SUCCESS)
+               DP_NOTICE(p_hwfn, true,
+                         "Async completion callback failed, rc = %d [opcode %x, echo %x, fw_return_code %x]",
+                         rc, p_eqe->opcode, p_eqe->echo,
+                         p_eqe->fw_return_code);
+
+       return rc;
 }
 
 enum _ecore_status_t
@@ -342,7 +350,7 @@ enum _ecore_status_t ecore_eq_completion(struct ecore_hwfn *p_hwfn,
        struct ecore_eq *p_eq = cookie;
        struct ecore_chain *p_chain = &p_eq->chain;
        u16 fw_cons_idx             = 0;
-       enum _ecore_status_t rc = 0;
+       enum _ecore_status_t rc = ECORE_SUCCESS;
 
        if (!p_hwfn->p_spq) {
                DP_ERR(p_hwfn, "Unexpected NULL p_spq\n");
@@ -366,7 +374,8 @@ enum _ecore_status_t ecore_eq_completion(struct ecore_hwfn *p_hwfn,
        while (fw_cons_idx != ecore_chain_get_cons_idx(p_chain)) {
                struct event_ring_entry *p_eqe = ecore_chain_consume(p_chain);
                if (!p_eqe) {
-                       rc = ECORE_INVAL;
+                       DP_ERR(p_hwfn,
+                              "Unexpected NULL chain consumer entry\n");
                        break;
                }
 
@@ -382,15 +391,13 @@ enum _ecore_status_t ecore_eq_completion(struct ecore_hwfn *p_hwfn,
                                                      */
                           p_eqe->flags);
 
-               if (GET_FIELD(p_eqe->flags, EVENT_RING_ENTRY_ASYNC)) {
-                       if (ecore_async_event_completion(p_hwfn, p_eqe))
-                               rc = ECORE_INVAL;
-               } else if (ecore_spq_completion(p_hwfn,
-                                               p_eqe->echo,
-                                               p_eqe->fw_return_code,
-                                               &p_eqe->data)) {
-                       rc = ECORE_INVAL;
-               }
+               if (GET_FIELD(p_eqe->flags, EVENT_RING_ENTRY_ASYNC))
+                       ecore_async_event_completion(p_hwfn, p_eqe);
+               else
+                       ecore_spq_completion(p_hwfn,
+                                            p_eqe->echo,
+                                            p_eqe->fw_return_code,
+                                            &p_eqe->data);
 
                ecore_chain_recycle_consumed(p_chain);
        }
@@ -936,12 +943,11 @@ enum _ecore_status_t ecore_spq_completion(struct ecore_hwfn *p_hwfn,
        struct ecore_spq_entry *found = OSAL_NULL;
        enum _ecore_status_t rc;
 
-       if (!p_hwfn)
-               return ECORE_INVAL;
-
        p_spq = p_hwfn->p_spq;
-       if (!p_spq)
+       if (!p_spq) {
+               DP_ERR(p_hwfn, "Unexpected NULL p_spq\n");
                return ECORE_INVAL;
+       }
 
        OSAL_SPIN_LOCK(&p_spq->lock);
        OSAL_LIST_FOR_EACH_ENTRY_SAFE(p_ent,
index 9e937e2..db929f0 100644 (file)
@@ -218,7 +218,7 @@ struct ecore_vf_info *ecore_iov_get_vf_info(struct ecore_hwfn *p_hwfn,
 static struct ecore_queue_cid *
 ecore_iov_get_vf_rx_queue_cid(struct ecore_vf_queue *p_queue)
 {
-       int i;
+       u32 i;
 
        for (i = 0; i < MAX_QUEUES_PER_QZONE; i++) {
                if (p_queue->cids[i].p_cid &&
@@ -240,7 +240,7 @@ static bool ecore_iov_validate_queue_mode(struct ecore_vf_info *p_vf,
                                          enum ecore_iov_validate_q_mode mode,
                                          bool b_is_tx)
 {
-       int i;
+       u32 i;
 
        if (mode == ECORE_IOV_VALIDATE_Q_NA)
                return true;
@@ -2089,8 +2089,8 @@ static void ecore_iov_vf_mbx_start_vport(struct ecore_hwfn *p_hwfn,
                                         struct ecore_ptt *p_ptt,
                                         struct ecore_vf_info *vf)
 {
-       struct ecore_sp_vport_start_params params = { 0 };
        struct ecore_iov_vf_mbx *mbx = &vf->vf_mbx;
+       struct ecore_sp_vport_start_params params;
        struct vfpf_vport_start_tlv *start;
        u8 status = PFVF_STATUS_SUCCESS;
        struct ecore_vf_info *vf_info;
@@ -2141,6 +2141,7 @@ static void ecore_iov_vf_mbx_start_vport(struct ecore_hwfn *p_hwfn,
                *p_bitmap |= 1 << VFPF_BULLETIN_UNTAGGED_DEFAULT;
        }
 
+       OSAL_MEMSET(&params, 0, sizeof(struct ecore_sp_vport_start_params));
        params.tpa_mode = start->tpa_mode;
        params.remove_inner_vlan = start->inner_vlan_removal;
        params.tx_switching = true;
@@ -3668,7 +3669,7 @@ static void ecore_iov_vf_pf_set_coalesce(struct ecore_hwfn *p_hwfn,
        struct ecore_queue_cid *p_cid;
        u16 rx_coal, tx_coal;
        u16 qid;
-       int i;
+       u32 i;
 
        req = &mbx->req_virt->update_coalesce;
 
@@ -3748,7 +3749,8 @@ ecore_iov_pf_configure_vf_queue_coalesce(struct ecore_hwfn *p_hwfn,
        struct ecore_queue_cid *p_cid;
        struct ecore_vf_info *vf;
        struct ecore_ptt *p_ptt;
-       int i, rc = 0;
+       int rc = 0;
+       u32 i;
 
        if (!ecore_iov_is_valid_vfid(p_hwfn, vf_id, true, true)) {
                DP_NOTICE(p_hwfn, true,