From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Mody, Rasesh" Subject: [PATCH 17/18] net/qede/base: semantic changes Date: Sat, 29 Sep 2018 08:14:39 +0000 Message-ID: <1538208822-9726-18-git-send-email-rasesh.mody@cavium.com> References: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "Mody, Rasesh" , "ferruh.yigit@intel.com" , Dept-Eng DPDK Dev To: "dev@dpdk.org" Return-path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0088.outbound.protection.outlook.com [104.47.37.88]) by dpdk.org (Postfix) with ESMTP id E08431B0F9 for ; Sat, 29 Sep 2018 10:14:40 +0200 (CEST) In-Reply-To: <1538208822-9726-1-git-send-email-rasesh.mody@cavium.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch consists of semantic/formatting changes. Signed-off-by: Rasesh Mody --- drivers/net/qede/base/ecore_dcbx.c | 3 ++- drivers/net/qede/base/ecore_init_ops.c | 12 ++++----- drivers/net/qede/base/ecore_int.c | 3 ++- drivers/net/qede/base/ecore_int_api.h | 3 ++- drivers/net/qede/base/ecore_l2.c | 16 ++++++------ drivers/net/qede/base/ecore_mcp.c | 11 ++++---- drivers/net/qede/base/ecore_spq.c | 44 ++++++++++++++++++----------= ---- drivers/net/qede/base/ecore_sriov.c | 12 +++++---- 8 files changed, 58 insertions(+), 46 deletions(-) diff --git a/drivers/net/qede/base/ecore_dcbx.c b/drivers/net/qede/base/eco= re_dcbx.c index 7981c42..cbc69cd 100644 --- a/drivers/net/qede/base/ecore_dcbx.c +++ b/drivers/net/qede/base/ecore_dcbx.c @@ -325,7 +325,7 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) { struct dcbx_app_priority_feature *p_app; struct dcbx_app_priority_entry *p_tbl; - struct ecore_dcbx_results data =3D { 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 @@ u8 ecore_dcbx_get_dscp_value(struct ecore_hwfn *p_hwfn,= u8 pri) p_info =3D &p_hwfn->hw_info; num_entries =3D GET_MFW_FIELD(p_app->flags, DCBX_APP_NUM_ENTRIES); =20 + OSAL_MEMSET(&data, 0, sizeof(struct ecore_dcbx_results)); rc =3D ecore_dcbx_process_tlv(p_hwfn, p_ptt, &data, p_tbl, pri_tc_tbl, num_entries, dcbx_version); if (rc !=3D ECORE_SUCCESS) diff --git a/drivers/net/qede/base/ecore_init_ops.c b/drivers/net/qede/base= /ecore_init_ops.c index 47c1be2..044308b 100644 --- a/drivers/net/qede/base/ecore_init_ops.c +++ b/drivers/net/qede/base/ecore_init_ops.c @@ -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 =3D p_hwfn->p_dev; - const u8 *modes_tree_buf; u8 arg1, arg2, tree_val; + const u8 *modes_tree; =20 - modes_tree_buf =3D p_dev->fw_data->modes_tree_buf; - tree_val =3D modes_tree_buf[(*p_offset)++]; + modes_tree =3D p_dev->fw_data->modes_tree_buf; + tree_val =3D 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 =3D p_hwfn->p_dev; u32 cmd_num, num_init_ops; - union init_op *init_ops; + union init_op *init; bool b_dmae =3D false; enum _ecore_status_t rc =3D ECORE_SUCCESS; =20 num_init_ops =3D p_dev->fw_data->init_ops_size; - init_ops =3D p_dev->fw_data->init_ops; + init =3D p_dev->fw_data->init_ops; =20 #ifdef CONFIG_ECORE_ZIPPED_FW p_hwfn->unzip_buf =3D 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 =20 for (cmd_num =3D 0; cmd_num < num_init_ops; cmd_num++) { - union init_op *cmd =3D &init_ops[cmd_num]; + union init_op *cmd =3D &init[cmd_num]; u32 data =3D OSAL_LE32_TO_CPU(cmd->raw.op_data); =20 switch (GET_FIELD(data, INIT_CALLBACK_OP_OP)) { diff --git a/drivers/net/qede/base/ecore_int.c b/drivers/net/qede/base/ecor= e_int.c index e48a7bc..7368d55 100644 --- a/drivers/net/qede/base/ecore_int.c +++ b/drivers/net/qede/base/ecore_int.c @@ -1224,8 +1224,9 @@ static enum _ecore_status_t ecore_int_attentions(stru= ct 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 =3D { 0 }; + struct igu_prod_cons_update igu_ack; =20 + OSAL_MEMSET(&igu_ack, 0, sizeof(struct igu_prod_cons_update)); igu_ack.sb_id_and_flags =3D ((ack_cons << IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT) | (1 << IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT) | diff --git a/drivers/net/qede/base/ecore_int_api.h b/drivers/net/qede/base/= ecore_int_api.h index 5b9c31d..42538a4 100644 --- a/drivers/net/qede/base/ecore_int_api.h +++ b/drivers/net/qede/base/ecore_int_api.h @@ -92,8 +92,9 @@ static OSAL_INLINE u16 ecore_sb_update_sb_idx(struct ecor= e_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 =3D { 0 }; + struct igu_prod_cons_update igu_ack; =20 + OSAL_MEMSET(&igu_ack, 0, sizeof(struct igu_prod_cons_update)); igu_ack.sb_id_and_flags =3D ((sb_info->sb_ack << IGU_PROD_CONS_UPDATE_SB_INDEX_SHIFT) | (upd_flg << IGU_PROD_CONS_UPDATE_UPDATE_FLAG_SHIFT) | diff --git a/drivers/net/qede/base/ecore_l2.c b/drivers/net/qede/base/ecore= _l2.c index 5a0905e..8b9817e 100644 --- a/drivers/net/qede/base/ecore_l2.c +++ b/drivers/net/qede/base/ecore_l2.c @@ -2205,10 +2205,10 @@ enum _ecore_status_t return ecore_spq_post(p_hwfn, p_ent, OSAL_NULL); } =20 -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_hwf= n, return ECORE_SUCCESS; } =20 -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; diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecor= e_mcp.c index 202db13..6c65606 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -3084,7 +3084,7 @@ enum _ecore_status_t ecore_mcp_phy_read(struct ecore_= dev *p_dev, u32 cmd, { struct ecore_hwfn *p_hwfn =3D ECORE_LEADING_HWFN(p_dev); struct ecore_ptt *p_ptt; - u32 resp, param; + u32 resp =3D 0, param; enum _ecore_status_t rc; =20 p_ptt =3D ecore_ptt_acquire(p_hwfn); @@ -3124,7 +3124,7 @@ enum _ecore_status_t ecore_mcp_nvm_del_file(struct ec= ore_dev *p_dev, u32 addr) { struct ecore_hwfn *p_hwfn =3D ECORE_LEADING_HWFN(p_dev); struct ecore_ptt *p_ptt; - u32 resp, param; + u32 resp =3D 0, param; enum _ecore_status_t rc; =20 p_ptt =3D ecore_ptt_acquire(p_hwfn); @@ -3143,7 +3143,7 @@ enum _ecore_status_t ecore_mcp_nvm_put_file_begin(str= uct ecore_dev *p_dev, { struct ecore_hwfn *p_hwfn =3D ECORE_LEADING_HWFN(p_dev); struct ecore_ptt *p_ptt; - u32 resp, param; + u32 resp =3D 0, param; enum _ecore_status_t rc; =20 p_ptt =3D 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 =3D ECORE_LEADING_HWFN(p_dev); + u32 resp =3D 0, param, nvm_cmd; struct ecore_ptt *p_ptt; - u32 resp, param, nvm_cmd; enum _ecore_status_t rc; =20 p_ptt =3D ecore_ptt_acquire(p_hwfn); @@ -4216,10 +4216,11 @@ enum _ecore_status_t ecore_mcp_get_ppfid_bitmap(str= uct 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 =3D {0}; enum _ecore_status_t rc =3D ECORE_SUCCESS; u32 dword =3D val; + struct ecore_mcp_mb_params mb_params; =20 + OSAL_MEMSET(&mb_params, 0, sizeof(struct ecore_mcp_mb_params)); mb_params.cmd =3D DRV_MSG_CODE_WRITE_WOL_REG; mb_params.param =3D offset; mb_params.p_data_src =3D &dword; diff --git a/drivers/net/qede/base/ecore_spq.c b/drivers/net/qede/base/ecor= e_spq.c index 1a02ba2..88ad961 100644 --- a/drivers/net/qede/base/ecore_spq.c +++ b/drivers/net/qede/base/ecore_spq.c @@ -282,6 +282,7 @@ static enum _ecore_status_t ecore_spq_hw_post(struct ec= ore_hwfn *p_hwfn, struct event_ring_entry *p_eqe) { ecore_spq_async_comp_cb cb; + enum _ecore_status_t rc; =20 if (p_eqe->protocol_id >=3D MAX_PROTOCOL_TYPE) { DP_ERR(p_hwfn, "Wrong protocol: %d\n", p_eqe->protocol_id); @@ -289,15 +290,22 @@ static enum _ecore_status_t ecore_spq_hw_post(struct = ecore_hwfn *p_hwfn, } =20 cb =3D 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 =3D cb(p_hwfn, p_eqe->opcode, p_eqe->echo, + &p_eqe->data, p_eqe->fw_return_code); + if (rc !=3D ECORE_SUCCESS) + DP_NOTICE(p_hwfn, true, + "Async completion callback failed, rc =3D %d [opcode %x, echo %x, fw_= return_code %x]", + rc, p_eqe->opcode, p_eqe->echo, + p_eqe->fw_return_code); + + return rc; } =20 enum _ecore_status_t @@ -342,7 +350,7 @@ enum _ecore_status_t ecore_eq_completion(struct ecore_h= wfn *p_hwfn, struct ecore_eq *p_eq =3D cookie; struct ecore_chain *p_chain =3D &p_eq->chain; u16 fw_cons_idx =3D 0; - enum _ecore_status_t rc =3D 0; + enum _ecore_status_t rc =3D ECORE_SUCCESS; =20 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_h= wfn *p_hwfn, while (fw_cons_idx !=3D ecore_chain_get_cons_idx(p_chain)) { struct event_ring_entry *p_eqe =3D ecore_chain_consume(p_chain); if (!p_eqe) { - rc =3D ECORE_INVAL; + DP_ERR(p_hwfn, + "Unexpected NULL chain consumer entry\n"); break; } =20 @@ -382,15 +391,13 @@ enum _ecore_status_t ecore_eq_completion(struct ecore= _hwfn *p_hwfn, */ p_eqe->flags); =20 - if (GET_FIELD(p_eqe->flags, EVENT_RING_ENTRY_ASYNC)) { - if (ecore_async_event_completion(p_hwfn, p_eqe)) - rc =3D ECORE_INVAL; - } else if (ecore_spq_completion(p_hwfn, - p_eqe->echo, - p_eqe->fw_return_code, - &p_eqe->data)) { - rc =3D 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); =20 ecore_chain_recycle_consumed(p_chain); } @@ -936,12 +943,11 @@ enum _ecore_status_t ecore_spq_completion(struct ecor= e_hwfn *p_hwfn, struct ecore_spq_entry *found =3D OSAL_NULL; enum _ecore_status_t rc; =20 - if (!p_hwfn) - return ECORE_INVAL; - p_spq =3D p_hwfn->p_spq; - if (!p_spq) + if (!p_spq) { + DP_ERR(p_hwfn, "Unexpected NULL p_spq\n"); return ECORE_INVAL; + } =20 OSAL_SPIN_LOCK(&p_spq->lock); OSAL_LIST_FOR_EACH_ENTRY_SAFE(p_ent, diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ec= ore_sriov.c index 9e937e2..db929f0 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -218,7 +218,7 @@ struct ecore_vf_info *ecore_iov_get_vf_info(struct ecor= e_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; =20 for (i =3D 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; =20 if (mode =3D=3D 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 =3D { 0 }; struct ecore_iov_vf_mbx *mbx =3D &vf->vf_mbx; + struct ecore_sp_vport_start_params params; struct vfpf_vport_start_tlv *start; u8 status =3D 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 |=3D 1 << VFPF_BULLETIN_UNTAGGED_DEFAULT; } =20 + OSAL_MEMSET(¶ms, 0, sizeof(struct ecore_sp_vport_start_params)); params.tpa_mode =3D start->tpa_mode; params.remove_inner_vlan =3D start->inner_vlan_removal; params.tx_switching =3D 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; =20 req =3D &mbx->req_virt->update_coalesce; =20 @@ -3748,7 +3749,8 @@ enum _ecore_status_t struct ecore_queue_cid *p_cid; struct ecore_vf_info *vf; struct ecore_ptt *p_ptt; - int i, rc =3D 0; + int rc =3D 0; + u32 i; =20 if (!ecore_iov_is_valid_vfid(p_hwfn, vf_id, true, true)) { DP_NOTICE(p_hwfn, true, --=20 1.7.10.3