From 60c099fbda43bcecdc8c7d59a33b91448f74a6ef Mon Sep 17 00:00:00 2001 From: Shaozhengchao Date: Mon, 16 Dec 2019 19:11:38 +0800 Subject: [PATCH] net/hinic: modify hw_layer comment driver inclusion category:bugfix bugzilla:4472 CVE:NA ----------------------------------------------------------------------- modify hw_layer comment Signed-off-by: Shaozhengchao Reviewed-by: Luoshaokai Signed-off-by: Yang Yingliang --- .../net/ethernet/huawei/hinic/hinic_api_cmd.c | 73 ++++++++++--------- drivers/net/ethernet/huawei/hinic/hinic_cfg.c | 6 +- drivers/net/ethernet/huawei/hinic/hinic_cfg.h | 3 - .../net/ethernet/huawei/hinic/hinic_cmdq.c | 4 +- drivers/net/ethernet/huawei/hinic/hinic_eqs.c | 66 ++++++++--------- .../net/ethernet/huawei/hinic/hinic_hwdev.c | 32 +++----- .../net/ethernet/huawei/hinic/hinic_hwdev.h | 4 +- .../net/ethernet/huawei/hinic/hinic_hwif.c | 26 ++++--- .../net/ethernet/huawei/hinic/hinic_mbox.c | 18 ++--- .../net/ethernet/huawei/hinic/hinic_mbox.h | 2 +- .../net/ethernet/huawei/hinic/hinic_mgmt.c | 54 ++++++++------ .../net/ethernet/huawei/hinic/hinic_mgmt.h | 1 - .../ethernet/huawei/hinic/hinic_msix_attr.c | 6 +- .../net/ethernet/huawei/hinic/hinic_nic_io.c | 6 +- .../ethernet/huawei/hinic/hinic_port_cmd.h | 10 +-- .../net/ethernet/huawei/hinic/hinic_sm_lt.h | 2 +- .../ethernet/huawei/hinic/hinic_sml_counter.c | 16 ++-- .../ethernet/huawei/hinic/hinic_sml_counter.h | 4 +- 18 files changed, 165 insertions(+), 168 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c b/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c index a76212ddabcf..e611faa945b2 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_api_cmd.c @@ -146,7 +146,7 @@ static void dump_api_chain_reg(struct hinic_api_cmd_chain *chain) * chain_busy - check if the chain is still processing last requests * @chain: chain to check * Return: 0 - success, negative - failure - **/ + */ static int chain_busy(struct hinic_api_cmd_chain *chain) { void *dev = chain->hwdev->dev_hdl; @@ -195,7 +195,7 @@ static int chain_busy(struct hinic_api_cmd_chain *chain) * @type: chain type * @cmd_size: the command size * Return: cell_data_size - **/ + */ static u16 get_cell_data_size(enum hinic_api_cmd_chain_type type, u16 cmd_size) { u16 cell_data_size = 0; @@ -226,7 +226,7 @@ static u16 get_cell_data_size(enum hinic_api_cmd_chain_type type, u16 cmd_size) * prepare_cell_ctrl - prepare the ctrl of the cell for the command * @cell_ctrl: the control of the cell to set the control into it * @cell_len: the size of the cell - **/ + */ static void prepare_cell_ctrl(u64 *cell_ctrl, u16 cell_len) { u64 ctrl; @@ -251,11 +251,11 @@ static void prepare_cell_ctrl(u64 *cell_ctrl, u16 cell_len) * @dest: destination node on the card that will receive the command * @cmd: command data * @cmd_size: the command size - **/ + */ static void prepare_api_cmd(struct hinic_api_cmd_chain *chain, - struct hinic_api_cmd_cell *cell, - enum hinic_node_id dest, - const void *cmd, u16 cmd_size) + struct hinic_api_cmd_cell *cell, + enum hinic_node_id dest, + const void *cmd, u16 cmd_size) { struct hinic_api_cmd_cell_ctxt *cell_ctxt; u32 priv; @@ -313,7 +313,7 @@ static void prepare_api_cmd(struct hinic_api_cmd_chain *chain, * @dest: destination node on the card that will receive the command * @cmd: command data * @cmd_size: the command size - **/ + */ static void prepare_cell(struct hinic_api_cmd_chain *chain, enum hinic_node_id dest, void *cmd, u16 cmd_size) @@ -342,7 +342,7 @@ static void issue_api_cmd(struct hinic_api_cmd_chain *chain) /** * api_cmd_status_update - update the status of the chain * @chain: chain to update - **/ + */ static void api_cmd_status_update(struct hinic_api_cmd_chain *chain) { struct hinic_api_cmd_status *wb_status; @@ -371,7 +371,7 @@ static void api_cmd_status_update(struct hinic_api_cmd_chain *chain) * wait_for_status_poll - wait for write to mgmt command to complete * @chain: the chain of the command * Return: 0 - success, negative - failure - **/ + */ static int wait_for_status_poll(struct hinic_api_cmd_chain *chain) { int err = -ETIMEDOUT; @@ -405,10 +405,10 @@ static void copy_resp_data(struct hinic_api_cmd_cell_ctxt *ctxt, void *ack, /** * prepare_cell - polling for respense data of the read api-command - * @chain: pointer to api cmd chain + * @ctxt: pointer to api cmd cell ctxt * * Return: 0 - success, negative - failure - **/ + */ static int wait_for_resp_polling(struct hinic_api_cmd_cell_ctxt *ctxt) { u64 resp_header; @@ -437,8 +437,11 @@ static int wait_for_resp_polling(struct hinic_api_cmd_cell_ctxt *ctxt) /** * wait_for_api_cmd_completion - wait for command to complete * @chain: chain for the command + * @ctxt: pointer to api cmd cell ctxt + * @ack: pointer to ack message + * @ack_size: the size of ack message * Return: 0 - success, negative - failure - **/ + */ static int wait_for_api_cmd_completion(struct hinic_api_cmd_chain *chain, struct hinic_api_cmd_cell_ctxt *ctxt, void *ack, u16 ack_size) @@ -495,9 +498,11 @@ static inline void update_api_cmd_ctxt(struct hinic_api_cmd_chain *chain, * @chain: chain for the command * @dest: destination node on the card that will receive the command * @cmd: command data - * @size: the command size + * @cmd_size: the command size + * @ack: the buffer for ack + * @ack_size: the size of ack * Return: 0 - success, negative - failure - **/ + */ static int api_cmd(struct hinic_api_cmd_chain *chain, enum hinic_node_id dest, void *cmd, u16 cmd_size, void *ack, u16 ack_size) @@ -544,7 +549,7 @@ static int api_cmd(struct hinic_api_cmd_chain *chain, * @cmd: command data * @size: the command size * Return: 0 - success, negative - failure - **/ + */ int hinic_api_cmd_write(struct hinic_api_cmd_chain *chain, enum hinic_node_id dest, void *cmd, u16 size) { @@ -561,8 +566,8 @@ int hinic_api_cmd_read(struct hinic_api_cmd_chain *chain, /** * api_cmd_hw_restart - restart the chain in the HW - * @chain: the API CMD specific chain to restart - **/ + * @cmd_chain: the API CMD specific chain to restart + */ static int api_cmd_hw_restart(struct hinic_api_cmd_chain *cmd_chain) { struct hinic_hwif *hwif = cmd_chain->hwdev->hwif; @@ -598,7 +603,7 @@ static int api_cmd_hw_restart(struct hinic_api_cmd_chain *cmd_chain) /** * api_cmd_ctrl_init - set the control register of a chain * @chain: the API CMD specific chain to set control register for - **/ + */ static void api_cmd_ctrl_init(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -624,7 +629,7 @@ static void api_cmd_ctrl_init(struct hinic_api_cmd_chain *chain) /** * api_cmd_set_status_addr - set the status address of a chain in the HW * @chain: the API CMD specific chain to set status address for - **/ + */ static void api_cmd_set_status_addr(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -642,7 +647,7 @@ static void api_cmd_set_status_addr(struct hinic_api_cmd_chain *chain) /** * api_cmd_set_num_cells - set the number cells of a chain in the HW * @chain: the API CMD specific chain to set the number of cells for - **/ + */ static void api_cmd_set_num_cells(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -656,7 +661,7 @@ static void api_cmd_set_num_cells(struct hinic_api_cmd_chain *chain) /** * api_cmd_head_init - set the head cell of a chain in the HW * @chain: the API CMD specific chain to set the head for - **/ + */ static void api_cmd_head_init(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -675,7 +680,7 @@ static void api_cmd_head_init(struct hinic_api_cmd_chain *chain) * wait_for_ready_chain - wait for the chain to be ready * @chain: the API CMD specific chain to wait for * Return: 0 - success, negative - failure - **/ + */ static int wait_for_ready_chain(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -706,7 +711,7 @@ static int wait_for_ready_chain(struct hinic_api_cmd_chain *chain) /** * api_cmd_chain_hw_clean - clean the HW * @chain: the API CMD specific chain - **/ + */ static void api_cmd_chain_hw_clean(struct hinic_api_cmd_chain *chain) { struct hinic_hwif *hwif = chain->hwdev->hwif; @@ -728,7 +733,7 @@ static void api_cmd_chain_hw_clean(struct hinic_api_cmd_chain *chain) * api_cmd_chain_hw_init - initialize the chain in the HW * @chain: the API CMD specific chain to initialize in HW * Return: 0 - success, negative - failure - **/ + */ static int api_cmd_chain_hw_init(struct hinic_api_cmd_chain *chain) { api_cmd_chain_hw_clean(chain); @@ -753,7 +758,7 @@ static int api_cmd_chain_hw_init(struct hinic_api_cmd_chain *chain) * @cell: the cell in the HW for the cmd * @cell_idx: the index of the cell * Return: 0 - success, negative - failure - **/ + */ static int alloc_cmd_buf(struct hinic_api_cmd_chain *chain, struct hinic_api_cmd_cell *cell, u32 cell_idx) { @@ -861,7 +866,7 @@ static int hinic_alloc_api_cmd_cell_buf(struct hinic_api_cmd_chain *chain, * @pre_node: previous cell * @node_vaddr: the virt addr of the cell * Return: 0 - success, negative - failure - **/ + */ static int api_cmd_create_cell(struct hinic_api_cmd_chain *chain, u32 cell_idx, struct hinic_api_cmd_cell *pre_node, struct hinic_api_cmd_cell **node_vaddr) @@ -907,7 +912,7 @@ static int api_cmd_create_cell(struct hinic_api_cmd_chain *chain, u32 cell_idx, * api_cmd_create_cells - create API CMD cells for specific chain * @chain: the API CMD specific chain * Return: 0 - success, negative - failure - **/ + */ static int api_cmd_create_cells(struct hinic_api_cmd_chain *chain) { struct hinic_api_cmd_cell *node = NULL, *pre_node = NULL; @@ -941,7 +946,7 @@ static int api_cmd_create_cells(struct hinic_api_cmd_chain *chain) * @chain: the API CMD specific chain to initialize * @attr: attributes to set in the chain * Return: 0 - success, negative - failure - **/ + */ static int api_chain_init(struct hinic_api_cmd_chain *chain, struct hinic_api_cmd_chain_attr *attr) { @@ -1040,7 +1045,7 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain, /** * api_chain_free - free API CMD specific chain * @chain: the API CMD specific chain to free - **/ + */ static void api_chain_free(struct hinic_api_cmd_chain *chain) { void *dev = chain->hwdev->dev_hdl; @@ -1064,7 +1069,7 @@ static void api_chain_free(struct hinic_api_cmd_chain *chain) * @chain: the API CMD specific chain to create * @attr: attributes to set in the chain * Return: 0 - success, negative - failure - **/ + */ static int api_cmd_create_chain(struct hinic_api_cmd_chain **cmd_chain, struct hinic_api_cmd_chain_attr *attr) { @@ -1116,7 +1121,7 @@ static int api_cmd_create_chain(struct hinic_api_cmd_chain **cmd_chain, /** * api_cmd_destroy_chain - destroy API CMD specific chain * @chain: the API CMD specific chain to destroy - **/ + */ static void api_cmd_destroy_chain(struct hinic_api_cmd_chain *chain) { api_chain_free(chain); @@ -1128,7 +1133,7 @@ static void api_cmd_destroy_chain(struct hinic_api_cmd_chain *chain) * @hwdev: the pointer to hw device * @chain: the API CMD chains that will be initialized * Return: 0 - success, negative - failure - **/ + */ int hinic_api_cmd_init(struct hinic_hwdev *hwdev, struct hinic_api_cmd_chain **chain) { @@ -1166,7 +1171,7 @@ int hinic_api_cmd_init(struct hinic_hwdev *hwdev, /** * hinic_api_cmd_free - free the API CMD chains * @chain: the API CMD chains that will be freed - **/ + */ void hinic_api_cmd_free(struct hinic_api_cmd_chain **chain) { enum hinic_api_cmd_chain_type chain_type; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c index 85e7be285132..70fe14918e3e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.c @@ -1826,7 +1826,7 @@ int cfg_set_func_sf_en(void *hwdev, u32 enbits, u32 enmask) "Failed to set stateful enable, err: %d, status: 0x%x, out_size: 0x%x\n", err, func_sf_enbits->status, out_size); kfree(func_sf_enbits); - return -EINVAL; + return -EFAULT; } kfree(func_sf_enbits); @@ -1866,7 +1866,7 @@ int cfg_get_func_sf_en(void *hwdev, u32 *enbits) sdk_err(dev->dev_hdl, "Failed to get stateful enable, err: %d, status: 0x%x, out_size: 0x%x\n", err, func_sf_enbits->status, out_size); kfree(func_sf_enbits); - return -EINVAL; + return -EFAULT; } *enbits = func_sf_enbits->stateful_enbits; @@ -2325,7 +2325,7 @@ int hinic_init_hwdev(struct hinic_init_para *para) /** * hinic_set_vf_dev_cap - Set max queue num for VF * @hwdev: the HW device for VF - **/ + */ int hinic_set_vf_dev_cap(void *hwdev) { int err; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h index 8ca07640d4c0..c390525b395e 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cfg.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_cfg.h @@ -290,9 +290,6 @@ struct cfg_eq_info { struct cfg_eq *eq; u8 num_ceq; - //u8 num_aeq; - //u8 num_eq; /* num_eq = num_ceq + num_aeq */ - u8 num_ceq_remain; /* mutex used for allocate EQs */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c index 3d15f2f98002..23612e882328 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_cmdq.c @@ -831,7 +831,7 @@ static int cmdq_async_cmd(struct hinic_cmdq *cmdq, enum hinic_ack_type ack_type, spin_lock_bh(&cmdq->cmdq_lock); - /* WQE_SIZE = WQEBB_SIZE, we will get the wq element and not shadow*/ + /* WQE_SIZE = WQEBB_SIZE, we will get the wq element and not shadow */ curr_wqe = hinic_get_wqe(cmdq->wq, num_wqebbs, &curr_prod_idx); if (!curr_wqe) { spin_unlock_bh(&cmdq->cmdq_lock); @@ -876,7 +876,7 @@ static int cmdq_set_arm_bit(struct hinic_cmdq *cmdq, void *buf_in, u16 in_size) /* Keep wrapped and doorbell index correct. bh - for tasklet(ceq) */ spin_lock_bh(&cmdq->cmdq_lock); - /* WQE_SIZE = WQEBB_SIZE, we will get the wq element and not shadow*/ + /* WQE_SIZE = WQEBB_SIZE, we will get the wq element and not shadow */ curr_wqe = hinic_get_wqe(cmdq->wq, num_wqebbs, &curr_prod_idx); if (!curr_wqe) { spin_unlock_bh(&cmdq->cmdq_lock); diff --git a/drivers/net/ethernet/huawei/hinic/hinic_eqs.c b/drivers/net/ethernet/huawei/hinic/hinic_eqs.c index 3074f8b48fac..4b2b0c02bcb0 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_eqs.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_eqs.c @@ -307,7 +307,7 @@ static u8 eq_cons_idx_checksum_set(u32 val) * @event: event for the handler * @hw_cb: callback function * Return: 0 - success, negative - failure - **/ + */ int hinic_aeq_register_hw_cb(void *hwdev, enum hinic_aeq_type event, hinic_aeq_hwe_cb hwe_cb) { @@ -330,7 +330,7 @@ EXPORT_SYMBOL(hinic_aeq_register_hw_cb); * hinic_aeq_unregister_hw_cb - unregister the aeq callback for specific event * @hwdev: pointer to hw device * @event: event for the handler - **/ + */ void hinic_aeq_unregister_hw_cb(void *hwdev, enum hinic_aeq_type event) { struct hinic_aeqs *aeqs; @@ -355,7 +355,7 @@ EXPORT_SYMBOL(hinic_aeq_unregister_hw_cb); * @event: soft event for the handler * @sw_cb: callback function * Return: 0 - success, negative - failure - **/ + */ int hinic_aeq_register_swe_cb(void *hwdev, enum hinic_aeq_sw_type event, hinic_aeq_swe_cb aeq_swe_cb) { @@ -378,7 +378,7 @@ EXPORT_SYMBOL(hinic_aeq_register_swe_cb); * hinic_aeq_unregister_sw_cb - unregister the aeq callback for sw event * @hwdev: pointer to hw device * @event: soft event for the handler - **/ + */ void hinic_aeq_unregister_swe_cb(void *hwdev, enum hinic_aeq_sw_type event) { struct hinic_aeqs *aeqs; @@ -403,7 +403,7 @@ EXPORT_SYMBOL(hinic_aeq_unregister_swe_cb); * @event: event for the handler * @callback: callback function * Return: 0 - success, negative - failure - **/ + */ int hinic_ceq_register_cb(void *hwdev, enum hinic_ceq_event event, hinic_ceq_event_cb callback) { @@ -426,7 +426,7 @@ EXPORT_SYMBOL(hinic_ceq_register_cb); * hinic_ceq_unregister_cb - unregister ceq callback for specific event * @hwdev: pointer to hw device * @event: event for the handler - **/ + */ void hinic_ceq_unregister_cb(void *hwdev, enum hinic_ceq_event event) { struct hinic_ceqs *ceqs; @@ -449,7 +449,7 @@ EXPORT_SYMBOL(hinic_ceq_unregister_cb); * set_eq_cons_idx - write the cons idx to the hw * @eq: The event queue to update the cons idx for * @arm_state: arm state value - **/ + */ static void set_eq_cons_idx(struct hinic_eq *eq, u32 arm_state) { u32 eq_wrap_ci, val; @@ -468,9 +468,9 @@ static void set_eq_cons_idx(struct hinic_eq *eq, u32 arm_state) /** * ceq_event_handler - handle for the ceq events - * @eqs: eqs part of the chip + * @ceqs: eqs part of the chip * @ceqe: ceq element of the event - **/ + */ static void ceq_event_handler(struct hinic_ceqs *ceqs, u32 ceqe) { struct hinic_hwdev *hwdev = ceqs->hwdev; @@ -495,7 +495,7 @@ static void ceq_event_handler(struct hinic_ceqs *ceqs, u32 ceqe) /** * aeq_irq_handler - handler for the aeq event * @eq: the async event queue of the event - **/ + */ static bool aeq_irq_handler(struct hinic_eq *eq) { struct hinic_aeqs *aeqs = aeq_to_aeqs(eq); @@ -585,7 +585,7 @@ static bool aeq_irq_handler(struct hinic_eq *eq) * ceq_irq_handler - handler for the ceq event * @eq: the completion event queue of the event * Return: true - success, false - failure - **/ + */ static bool ceq_irq_handler(struct hinic_eq *eq) { struct hinic_ceqs *ceqs = ceq_to_ceqs(eq); @@ -635,7 +635,7 @@ static void reschedule_eq_handler(struct hinic_eq *eq) * eq_irq_handler - handler for the eq event * @data: the event queue of the event * Return: true - success, false - failure - **/ + */ static bool eq_irq_handler(void *data) { struct hinic_eq *eq = (struct hinic_eq *)data; @@ -691,7 +691,7 @@ bool hinic_eq_intr_handler(void *hwdev, int msix_entry_idx) /** * eq_irq_work - eq work for the event * @work: the work that is associated with the eq - **/ + */ static void eq_irq_work(struct work_struct *work) { struct hinic_eq_work *aeq_work = @@ -705,7 +705,7 @@ static void eq_irq_work(struct work_struct *work) * aeq_interrupt - aeq interrupt handler * @irq: irq number * @data: the async event queue of the event - **/ + */ static irqreturn_t aeq_interrupt(int irq, void *data) { struct hinic_eq *aeq = (struct hinic_eq *)data; @@ -730,8 +730,7 @@ static irqreturn_t aeq_interrupt(int irq, void *data) /** * ceq_tasklet - ceq tasklet for the event * @ceq_data: data that will be used by the tasklet(ceq) - **/ - + */ static void ceq_tasklet(ulong ceq_data) { struct hinic_ceq_tasklet_data *ceq_tasklet_data = @@ -748,7 +747,7 @@ static void ceq_tasklet(ulong ceq_data) * ceq_interrupt - ceq interrupt handler * @irq: irq number * @data: the completion event queue of the event - **/ + */ static irqreturn_t ceq_interrupt(int irq, void *data) { struct hinic_eq *ceq = (struct hinic_eq *)data; @@ -811,7 +810,7 @@ static int set_ceq_ctrl_reg(struct hinic_hwdev *hwdev, u16 q_id, * set_eq_ctrls - setting eq's ctrls registers * @eq: the event queue for setting * Return: 0 - success, negative - failure - **/ + */ static int set_eq_ctrls(struct hinic_eq *eq) { enum hinic_eq_type type = eq->type; @@ -882,7 +881,7 @@ static int set_eq_ctrls(struct hinic_eq *eq) * ceq_elements_init - Initialize all the elements in the ceq * @eq: the event queue * @init_val: value to init with it the elements - **/ + */ static void ceq_elements_init(struct hinic_eq *eq, u32 init_val) { u32 i; @@ -900,7 +899,7 @@ static void ceq_elements_init(struct hinic_eq *eq, u32 init_val) * aeq_elements_init - initialize all the elements in the aeq * @eq: the event queue * @init_val: value to init with it the elements - **/ + */ static void aeq_elements_init(struct hinic_eq *eq, u32 init_val) { struct hinic_aeq_elem *aeqe; @@ -917,7 +916,7 @@ static void aeq_elements_init(struct hinic_eq *eq, u32 init_val) /** * alloc_eq_pages - allocate the pages for the queue * @eq: the event queue - **/ + */ static int alloc_eq_pages(struct hinic_eq *eq) { struct hinic_hwif *hwif = eq->hwdev->hwif; @@ -1025,7 +1024,7 @@ static int alloc_eq_pages(struct hinic_eq *eq) /** * free_eq_pages - free the pages of the queue * @eq: the event queue - **/ + */ static void free_eq_pages(struct hinic_eq *eq) { struct hinic_hwdev *hwdev = eq->hwdev; @@ -1066,14 +1065,14 @@ static inline u32 get_page_size(struct hinic_eq *eq) } /** * init_eq - initialize eq - * @eq: the event queue + * @eq: the event queue * @hwdev: the pointer to hw device * @q_id: Queue id number * @q_len: the number of EQ elements * @type: the type of the event queue, ceq or aeq * @entry: msix entry associated with the event queue * Return: 0 - Success, Negative - failure - **/ + */ static int init_eq(struct hinic_eq *eq, struct hinic_hwdev *hwdev, u16 q_id, u32 q_len, enum hinic_eq_type type, struct irq_info *entry) { @@ -1165,8 +1164,8 @@ static int init_eq(struct hinic_eq *eq, struct hinic_hwdev *hwdev, u16 q_id, /** * remove_eq - remove eq - * @eq: the event queue - **/ + * @eq: the event queue + */ static void remove_eq(struct hinic_eq *eq) { struct irq_info *entry = &eq->eq_irq; @@ -1202,10 +1201,10 @@ static void remove_eq(struct hinic_eq *eq) /** * hinic_aeqs_init - init all the aeqs * @hwdev: the pointer to hw device - * @num_ceqs: number of AEQs + * @num_aeqs: number of AEQs * @msix_entries: msix entries associated with the event queues * Return: 0 - Success, Negative - failure - **/ + */ int hinic_aeqs_init(struct hinic_hwdev *hwdev, u16 num_aeqs, struct irq_info *msix_entries) { @@ -1261,7 +1260,7 @@ int hinic_aeqs_init(struct hinic_hwdev *hwdev, u16 num_aeqs, /** * hinic_aeqs_free - free all the aeqs * @hwdev: the pointer to hw device - **/ + */ void hinic_aeqs_free(struct hinic_hwdev *hwdev) { struct hinic_aeqs *aeqs = hwdev->aeqs; @@ -1285,14 +1284,11 @@ void hinic_aeqs_free(struct hinic_hwdev *hwdev) /** * hinic_ceqs_init - init all the ceqs - * @ceqs: ceqs part of the chip - * @hwif: the hardware interface of a pci function device + * @hwdev: the pointer to hw device * @num_ceqs: number of CEQs - * @q_len: number of EQ elements - * @page_size: the page size of the event queue * @msix_entries: msix entries associated with the event queues * Return: 0 - Success, Negative - failure - **/ + */ int hinic_ceqs_init(struct hinic_hwdev *hwdev, u16 num_ceqs, struct irq_info *msix_entries) { @@ -1344,7 +1340,7 @@ int hinic_ceqs_init(struct hinic_hwdev *hwdev, u16 num_ceqs, /** * hinic_ceqs_free - free all the ceqs * @hwdev: the pointer to hw device - **/ + */ void hinic_ceqs_free(struct hinic_hwdev *hwdev) { struct hinic_ceqs *ceqs = hwdev->ceqs; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c index c358a8363c5e..a31bb6c36b46 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.c @@ -1071,7 +1071,7 @@ int hinic_clp_to_mgmt(void *hwdev, enum hinic_mod_type mod, u8 cmd, * hinic_cpu_to_be32 - convert data to big endian 32 bit format * @data: the data to convert * @len: length of data to convert, must be Multiple of 4B - **/ + */ void hinic_cpu_to_be32(void *data, int len) { int i, chunk_sz = sizeof(u32); @@ -1090,10 +1090,10 @@ void hinic_cpu_to_be32(void *data, int len) EXPORT_SYMBOL(hinic_cpu_to_be32); /** - * hinic_cpu_to_be32 - convert data from big endian 32 bit format + * hinic_be32_to_cpu - convert data from big endian 32 bit format * @data: the data to convert * @len: length of data to convert - **/ + */ void hinic_be32_to_cpu(void *data, int len) { int i, chunk_sz = sizeof(u32); @@ -1116,7 +1116,7 @@ EXPORT_SYMBOL(hinic_be32_to_cpu); * @sge: scatter gather entry * @addr: dma address * @len: length of relevant data in the dma address - **/ + */ void hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, u32 len) { sge->hi_addr = upper_32_bits(addr); @@ -1129,7 +1129,7 @@ void hinic_set_sge(struct hinic_sge *sge, dma_addr_t addr, u32 len) * @sge: scatter gather entry * * Return dma address of sg entry - **/ + */ dma_addr_t hinic_sge_to_dma(struct hinic_sge *sge) { return (dma_addr_t)((((u64)sge->hi_addr) << 32) | sge->lo_addr); @@ -1443,10 +1443,7 @@ static int hinic_vf_rx_tx_flush_in_pf(struct hinic_hwdev *hwdev, u16 vf_id) if (err || !out_size || clr_res.status) { sdk_warn(hwdev->dev_hdl, "Failed to flush doorbell, err: %d, status: 0x%x, out_size: 0x%x\n", err, clr_res.status, out_size); - if (err) - ret = err; - else - ret = -EFAULT; + ret = err ? err : (-EFAULT); } /* enable vf doorbell flush csr */ hinic_pf_set_vf_db_flush(hwdev, vf_id, ENABLE_DOORBELL); @@ -1485,10 +1482,7 @@ static int hinic_pf_rx_tx_flush(struct hinic_hwdev *hwdev) if (err || !out_size || clear_db.status) { sdk_warn(hwdev->dev_hdl, "Failed to flush doorbell, err: %d, status: 0x%x, out_size: 0x%x\n", err, clear_db.status, out_size); - if (err) - ret = err; - else - ret = -EFAULT; + ret = err ? err : (-EFAULT); } hinic_set_pf_status(hwif, HINIC_PF_STATUS_FLR_START_FLAG); @@ -1709,11 +1703,11 @@ static int init_ceqs_msix_attr(struct hinic_hwdev *hwdev) * @hwdev: the pointer to hw device * @entry_idx: the entry index in the dma table * @st: PCIE TLP steering tag - * @at: PCIE TLP AT field + * @at: PCIE TLP AT field * @ph: PCIE TLP Processing Hint field * @no_snooping: PCIE TLP No snooping * @tph_en: PCIE TLP Processing Hint Enable - **/ + */ static void set_pf_dma_attr_entry(struct hinic_hwdev *hwdev, u32 entry_idx, u8 st, u8 at, u8 ph, enum hinic_pcie_nosnoop no_snooping, @@ -1778,7 +1772,7 @@ static int set_vf_dma_attr_entry(struct hinic_hwdev *hwdev, u8 entry_idx, * dma_attr_table_init - initialize the the default dma attributes * @hwdev: the pointer to hw device * Return: 0 - success, negative - failure - **/ + */ static int dma_attr_table_init(struct hinic_hwdev *hwdev) { int err = 0; @@ -2300,7 +2294,7 @@ static int __get_func_misc_info(struct hinic_hwdev *hwdev) err = hinic_get_board_info(hwdev, &hwdev->board_info); if (err) { - /*For the pf/vf of slave host, return error */ + /* For the pf/vf of slave host, return error */ if (hinic_pcie_itf_id(hwdev)) return err; @@ -4429,9 +4423,7 @@ static u8 hinic_get_heartbeat_status(struct hinic_hwdev *hwdev) sdk_err(hwdev->dev_hdl, "Detect pcie is link down\n"); hinic_set_chip_absent(hwdev); hinic_force_complete_all(hwdev); - /* should notify chiperr to pangea - * when detecting pcie link down - */ + /* should notify chiperr to pangea when detecting pcie link down */ return 1; } diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h index eebd74b85f94..89a761c1cb7d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwdev.h @@ -46,7 +46,7 @@ #define HINIC_MGMT_STATUS_ERR_NXIO 19 /* No such device or address */ #define HINIC_MGMT_STATUS_ERR_ROLLBACK 20 /* Chip rollback fail */ #define HINIC_MGMT_STATUS_ERR_LEN 32 /* Length too short or too long */ -#define HINIC_MGMT_STATUS_ERR_UNSUPPORT 0xFF/* Feature not supported*/ +#define HINIC_MGMT_STATUS_ERR_UNSUPPORT 0xFF /* Feature not supported */ struct cfg_mgmt_info; struct rdma_comp_resource; @@ -107,7 +107,7 @@ struct mqm_addr_trans_tbl_info { enum hinic_node_id { HINIC_NODE_ID_IPSU = 4, - HINIC_NODE_ID_MGMT_HOST = 21, /*Host CPU send API to uP */ + HINIC_NODE_ID_MGMT_HOST = 21, /* Host CPU send API to uP */ HINIC_NODE_ID_MAX = 22 }; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_hwif.c b/drivers/net/ethernet/huawei/hinic/hinic_hwif.c index 53e5daa3a1ea..d7066951fb6b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_hwif.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_hwif.c @@ -12,6 +12,7 @@ * for more details. * */ + #define pr_fmt(fmt) KBUILD_MODNAME ": [COMM]" fmt #include @@ -49,7 +50,7 @@ void hinic_hwif_write_reg(struct hinic_hwif *hwif, u32 reg, u32 val) * hwif_ready - test if the HW initialization passed * @hwdev: the pointer to hw device * Return: 0 - success, negative - failure - **/ + */ static int hwif_ready(struct hinic_hwdev *hwdev) { u32 addr, attr1; @@ -93,7 +94,7 @@ static int wait_hwif_ready(struct hinic_hwdev *hwdev) * @attr0: the first attribute that was read from the hw * @attr1: the second attribute that was read from the hw * @attr2: the third attribute that was read from the hw - **/ + */ static void set_hwif_attr(struct hinic_hwif *hwif, u32 attr0, u32 attr1, u32 attr2) { @@ -117,7 +118,7 @@ static void set_hwif_attr(struct hinic_hwif *hwif, u32 attr0, u32 attr1, /** * get_hwif_attr - read and set the attributes as members in hwif * @hwif: the hardware interface of a pci function device - **/ + */ static void get_hwif_attr(struct hinic_hwif *hwif) { u32 addr, attr0, attr1, attr2; @@ -221,7 +222,7 @@ void hinic_disable_outbound(struct hinic_hwif *hwif) /** * set_ppf - try to set hwif as ppf and set the type of hwif in this case * @hwif: the hardware interface of a pci function device - **/ + */ static void set_ppf(struct hinic_hwif *hwif) { struct hinic_func_attr *attr = &hwif->attr; @@ -249,7 +250,7 @@ static void set_ppf(struct hinic_hwif *hwif) /** * get_mpf - get the mpf index into the hwif * @hwif: the hardware interface of a pci function device - **/ + */ static void get_mpf(struct hinic_hwif *hwif) { struct hinic_func_attr *attr = &hwif->attr; @@ -264,7 +265,7 @@ static void get_mpf(struct hinic_hwif *hwif) /** * set_mpf - try to set hwif as mpf and set the mpf idx in hwif * @hwif: the hardware interface of a pci function device - **/ + */ static void set_mpf(struct hinic_hwif *hwif) { struct hinic_func_attr *attr = &hwif->attr; @@ -537,7 +538,7 @@ static void __print_selftest_reg(struct hinic_hwdev *hwdev) * @hwdev: the pointer to hw device * @cfg_reg_base: configuration base address * Return: 0 - success, negative - failure - **/ + */ int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base, void *intr_reg_base, u64 db_base_phy, void *db_base, void *dwqe_mapping) @@ -605,7 +606,7 @@ int hinic_init_hwif(struct hinic_hwdev *hwdev, void *cfg_reg_base, /** * hinic_free_hwif - free the hw interface * @hwdev: the pointer to hw device - **/ + */ void hinic_free_hwif(struct hinic_hwdev *hwdev) { spin_lock_deinit(&hwdev->hwif->free_db_area.idx_lock); @@ -675,7 +676,7 @@ EXPORT_SYMBOL(hinic_global_func_id); /** * get function id from register,used by sriov hot migration process * @hwdev: the pointer to hw device - **/ + */ u16 hinic_global_func_id_hw(void *hwdev) { u32 addr, attr0; @@ -693,7 +694,7 @@ static int func_busy_state_check(struct hinic_hwdev *hwdev) u32 func_state; int cycle; - /*set BUSY before src vm suspend and clear it before dst vm resume*/ + /* set BUSY before src vm suspend and clear it before dst vm resume */ cycle = PIPE_CYCLE_MAX; func_state = hinic_func_busy_state_get(hwdev); while (func_state && cycle) { @@ -755,19 +756,20 @@ void hinic_func_own_free(void *hwdev) hinic_func_own_bit_set(dev, 0); up(&dev->func_sem); + return; } /** * get function id, used by sriov hot migratition process. * @hwdev: the pointer to hw device * @func_id: function id - **/ + */ int hinic_global_func_id_get(void *hwdev, u16 *func_id) { struct hinic_hwdev *dev = (struct hinic_hwdev *)hwdev; int err; - /*only vf get func_id from chip reg for sriov migrate*/ + /* only vf get func_id from chip reg for sriov migrate */ if (!HINIC_IS_VF(dev)) { *func_id = hinic_global_func_id(hwdev); return 0; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c index c9d18da19f38..ce6aa361aa6f 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mbox.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_mbox.c @@ -37,7 +37,7 @@ #define HINIC_MBOX_INT_STAT_DMA_SHIFT 14 /* The size of data to be send (unit of 4 bytes) */ #define HINIC_MBOX_INT_TX_SIZE_SHIFT 20 -/* SO_RO(strong order, relax order) */ +/* SO_RO(strong order, relax order) */ #define HINIC_MBOX_INT_STAT_DMA_SO_RO_SHIFT 25 #define HINIC_MBOX_INT_WB_EN_SHIFT 28 @@ -346,8 +346,8 @@ int hinic_register_ppf_to_pf_mbox_cb(struct hinic_hwdev *hwdev, /** * hinic_unregister_ppf_mbox_cb - unregister the mbox callback for ppf - * @hwdev: the pointer to hw device - * @mod: specific mod that the callback will handle + * @hwdev: the pointer to hw device + * @mod: specific mod that the callback will handle */ void hinic_unregister_ppf_mbox_cb(struct hinic_hwdev *hwdev, enum hinic_mod_type mod) @@ -365,8 +365,8 @@ void hinic_unregister_ppf_mbox_cb(struct hinic_hwdev *hwdev, /** * hinic_unregister_ppf_mbox_cb - unregister the mbox callback for pf - * @hwdev: the pointer to hw device - * @mod: specific mod that the callback will handle + * @hwdev: the pointer to hw device + * @mod: specific mod that the callback will handle */ void hinic_unregister_pf_mbox_cb(struct hinic_hwdev *hwdev, enum hinic_mod_type mod) @@ -384,8 +384,8 @@ void hinic_unregister_pf_mbox_cb(struct hinic_hwdev *hwdev, /** * hinic_unregister_vf_mbox_cb - unregister the mbox callback for vf - * @hwdev: the pointer to hw device - * @mod: specific mod that the callback will handle + * @hwdev:the pointer to hw device + * @mod:specific mod that the callback will handle */ void hinic_unregister_vf_mbox_cb(struct hinic_hwdev *hwdev, enum hinic_mod_type mod) @@ -403,8 +403,8 @@ void hinic_unregister_vf_mbox_cb(struct hinic_hwdev *hwdev, /** * hinic_unregister_ppf_mbox_cb - unregister the mbox callback for pf from ppf - * @hwdev: the pointer to hw device - * @mod: specific mod that the callback will handle + * @hwdev: the pointer to hw device + * @mod: specific mod that the callback will handle */ void hinic_unregister_ppf_to_pf_mbox_cb(struct hinic_hwdev *hwdev, enum hinic_mod_type mod) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mbox.h b/drivers/net/ethernet/huawei/hinic/hinic_mbox.h index a54639d0df0d..cfb118a7d9d7 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mbox.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_mbox.h @@ -124,7 +124,7 @@ struct hinic_mbox_func_to_func { u8 send_msg_id; enum mbox_event_state event_flag; - /*lock for mbox event flag*/ + /* lock for mbox event flag */ spinlock_t mbox_lock; u32 *vf_mbx_old_rand_id; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c index 1afbdb1f9f25..dadb7cc0588b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.c @@ -85,12 +85,12 @@ static void pf_to_mgmt_send_event_set(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, /** * hinic_register_mgmt_msg_cb - register sync msg handler for a module - * @hwdev: the pointer to hw device + * @hwdev: the pointer to hw device * @mod: module in the chip that this handler will handle its sync messages * @pri_handle: pri handle function * @callback: the handler for a sync message that will handle messages * Return: 0 - success, negative - failure - **/ + */ int hinic_register_mgmt_msg_cb(void *hwdev, enum hinic_mod_type mod, void *pri_handle, hinic_mgmt_msg_cb callback) { @@ -116,7 +116,7 @@ EXPORT_SYMBOL(hinic_register_mgmt_msg_cb); * hinic_unregister_mgmt_msg_cb - unregister sync msg handler for a module * @hwdev: the pointer to hw device * @mod: module in the chip that this handler will handle its sync messages - **/ + */ void hinic_unregister_mgmt_msg_cb(void *hwdev, enum hinic_mod_type mod) { struct hinic_msg_pf_to_mgmt *pf_to_mgmt; @@ -197,7 +197,7 @@ void hinic_comm_recv_up_self_cmd_unreg(void *hwdev, u8 cmd) * mgmt_msg_len - calculate the total message length * @msg_data_len: the length of the message data * Return: the total message length - **/ + */ static u16 mgmt_msg_len(u16 msg_data_len) { /* u64 - the size of the header */ @@ -223,9 +223,9 @@ static u16 mgmt_msg_len(u16 msg_data_len) * @mod: module in the chip that will get the message * @ack_type: message ack type * @direction: the direction of the original message - * @cmd: vmd type + * @cmd: cmd type * @msg_id: message id - **/ + */ static void prepare_header(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, u64 *header, u16 msg_len, enum hinic_mod_type mod, enum hinic_msg_ack_type ack_type, @@ -276,7 +276,7 @@ static void clp_prepare_header(struct hinic_hwdev *hwdev, * @header: pointer of the header to prepare * @msg: the data of the message * @msg_len: the length of the message - **/ + */ static void prepare_mgmt_cmd(u8 *mgmt_cmd, u64 *header, const void *msg, int msg_len) { @@ -299,7 +299,7 @@ static void prepare_mgmt_cmd(u8 *mgmt_cmd, u64 *header, const void *msg, * @direction: the direction of the original message * @resp_msg_id: msg id to response for * Return: 0 - success, negative - failure - **/ + */ static int send_msg_to_mgmt_async(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd, void *msg, u16 msg_len, @@ -364,10 +364,11 @@ int hinic_pf_to_mgmt_async(void *hwdev, enum hinic_mod_type mod, * @cmd: command of the message * @msg: the msg data * @msg_len: the msg data length + * @ack_type: message ack type * @direction: the direction of the original message * @resp_msg_id: msg id to response for * Return: 0 - success, negative - failure - **/ + */ static int send_msg_to_mgmt_sync(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd, void *msg, u16 msg_len, @@ -811,7 +812,7 @@ int hinic_pf_clp_to_mgmt(void *hwdev, enum hinic_mod_type mod, u8 cmd, clp_pf_to_mgmt = ((struct hinic_hwdev *)hwdev)->clp_pf_to_mgmt; clp_msg_buf = clp_pf_to_mgmt->clp_msg_buf; - /*4 bytes alignment*/ + /* 4 bytes alignment */ if (in_size % HINIC_CLP_DATA_UNIT_HOST) real_size = (in_size + (u16)sizeof(header) + HINIC_CLP_DATA_UNIT_HOST); @@ -837,7 +838,7 @@ int hinic_pf_clp_to_mgmt(void *hwdev, enum hinic_mod_type mod, u8 cmd, hinic_write_clp_reg(dev, HINIC_CLP_RSP_HOST, HINIC_CLP_READY_RSP_HOST, 0x0); - /*Send request*/ + /* Send request */ memset(clp_msg_buf, 0x0, HINIC_CLP_INPUT_BUFFER_LEN_HOST); clp_prepare_header(dev, &header, in_size, mod, 0, 0, cmd, 0); @@ -856,7 +857,7 @@ int hinic_pf_clp_to_mgmt(void *hwdev, enum hinic_mod_type mod, u8 cmd, return -EINVAL; } - /*Get response*/ + /* Get response */ clp_msg_buf = clp_pf_to_mgmt->clp_msg_buf; memset(clp_msg_buf, 0x0, HINIC_CLP_INPUT_BUFFER_LEN_HOST); err = hinic_read_clp_data(hwdev, clp_msg_buf, &real_size); @@ -934,7 +935,7 @@ int hinic_pf_to_mgmt_no_ack(void *hwdev, enum hinic_mod_type mod, u8 cmd, /** * api cmd write or read bypass defaut use poll, if want to use aeq interrupt, * please set wb_trigger_aeqe to 1 - **/ + */ int hinic_api_cmd_write_nack(void *hwdev, u8 dest, void *cmd, u16 size) { struct hinic_msg_pf_to_mgmt *pf_to_mgmt; @@ -1008,8 +1009,13 @@ static void __send_mgmt_ack(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, /** * mgmt_recv_msg_handler - handler for message from mgmt cpu * @pf_to_mgmt: PF to MGMT channel - * @recv_msg: received message details - **/ + * @mod: module in the chip that will get the message + * @cmd: command of the message + * @buf_in: the buffer of recv msg + * @in_size: the size of buffer + * @msg_id: message id + * @need_resp: the flag of need resp + */ static void mgmt_recv_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, enum hinic_mod_type mod, u8 cmd, void *buf_in, u16 in_size, u16 msg_id, int need_resp) @@ -1069,7 +1075,7 @@ static void mgmt_recv_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, * mgmt_resp_msg_handler - handler for response message from mgmt cpu * @pf_to_mgmt: PF to MGMT channel * @recv_msg: received message details - **/ + */ static void mgmt_resp_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, struct hinic_recv_msg *recv_msg) { @@ -1133,7 +1139,7 @@ static bool check_mgmt_seq_id_and_seg_len(struct hinic_recv_msg *recv_msg, * @pf_to_mgmt: PF to MGMT channel * @header: the header of the message * @recv_msg: received message details - **/ + */ static void recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, u8 *header, struct hinic_recv_msg *recv_msg) { @@ -1214,7 +1220,7 @@ static void recv_mgmt_msg_handler(struct hinic_msg_pf_to_mgmt *pf_to_mgmt, * @hwdev: the pointer to hw device * @header: the header of the message * @size: unused - **/ + */ void hinic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size) { struct hinic_hwdev *dev = (struct hinic_hwdev *)hwdev; @@ -1237,7 +1243,7 @@ void hinic_mgmt_msg_aeqe_handler(void *hwdev, u8 *header, u8 size) * alloc_recv_msg - allocate received message memory * @recv_msg: pointer that will hold the allocated data * Return: 0 - success, negative - failure - **/ + */ static int alloc_recv_msg(struct hinic_recv_msg *recv_msg) { recv_msg->seq_id = MGMT_MSG_MAX_SEQ_ID; @@ -1252,7 +1258,7 @@ static int alloc_recv_msg(struct hinic_recv_msg *recv_msg) /** * free_recv_msg - free received message memory * @recv_msg: pointer that holds the allocated data - **/ + */ static void free_recv_msg(struct hinic_recv_msg *recv_msg) { kfree(recv_msg->msg); @@ -1262,7 +1268,7 @@ static void free_recv_msg(struct hinic_recv_msg *recv_msg) * alloc_msg_buf - allocate all the message buffers of PF to MGMT channel * @pf_to_mgmt: PF to MGMT channel * Return: 0 - success, negative - failure - **/ + */ static int alloc_msg_buf(struct hinic_msg_pf_to_mgmt *pf_to_mgmt) { int err; @@ -1317,7 +1323,7 @@ static int alloc_msg_buf(struct hinic_msg_pf_to_mgmt *pf_to_mgmt) /** * free_msg_buf - free all the message buffers of PF to MGMT channel * @pf_to_mgmt: PF to MGMT channel - **/ + */ static void free_msg_buf(struct hinic_msg_pf_to_mgmt *pf_to_mgmt) { kfree(pf_to_mgmt->mgmt_ack_buf); @@ -1332,7 +1338,7 @@ static void free_msg_buf(struct hinic_msg_pf_to_mgmt *pf_to_mgmt) * hinic_pf_to_mgmt_init - initialize PF to MGMT channel * @hwdev: the pointer to hw device * Return: 0 - success, negative - failure - **/ + */ int hinic_pf_to_mgmt_init(struct hinic_hwdev *hwdev) { struct hinic_msg_pf_to_mgmt *pf_to_mgmt; @@ -1387,7 +1393,7 @@ int hinic_pf_to_mgmt_init(struct hinic_hwdev *hwdev) /** * hinic_pf_to_mgmt_free - free PF to MGMT channel * @hwdev: the pointer to hw device - **/ + */ void hinic_pf_to_mgmt_free(struct hinic_hwdev *hwdev) { struct hinic_msg_pf_to_mgmt *pf_to_mgmt = hwdev->pf_to_mgmt; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.h b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.h index 21318c895107..12aae39c70d7 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_mgmt.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_mgmt.h @@ -52,7 +52,6 @@ #define HINIC_MGMT_WQ_NAME "hinic_mgmt" -/*CLP*/ enum clp_data_type { HINIC_CLP_REQ_HOST = 0, HINIC_CLP_RSP_HOST = 1 diff --git a/drivers/net/ethernet/huawei/hinic/hinic_msix_attr.c b/drivers/net/ethernet/huawei/hinic/hinic_msix_attr.c index 0261e736bb19..0c3539fd127d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_msix_attr.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_msix_attr.c @@ -36,7 +36,7 @@ * @resend_timer: maximum wait for resending msix message * (unit coalesc period) * Return: 0 - success, negative - failure - **/ + */ int hinic_msix_attr_set(struct hinic_hwif *hwif, u16 msix_index, u8 pending_limit, u8 coalesc_timer, u8 lli_timer_cfg, u8 lli_credit_limit, @@ -71,7 +71,7 @@ int hinic_msix_attr_set(struct hinic_hwif *hwif, u16 msix_index, * @resend_timer_cfg: maximum wait for resending msix message * (unit coalesc period) * Return: 0 - success, negative - failure - **/ + */ int hinic_msix_attr_get(struct hinic_hwif *hwif, u16 msix_index, u8 *pending_limit, u8 *coalesc_timer_cfg, u8 *lli_timer_cfg, u8 *lli_credit_limit, @@ -105,7 +105,7 @@ int hinic_msix_attr_get(struct hinic_hwif *hwif, u16 msix_index, * @resend_timer_cnt: maximum wait for resending msix message * (unit coalesc period) * Return: 0 - success, negative - failure - **/ + */ int hinic_msix_attr_cnt_set(struct hinic_hwif *hwif, u16 msix_index, u8 lli_timer_cnt, u8 lli_credit_cnt, u8 coalesc_timer_cnt, u8 pending_cnt, diff --git a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c index a2160f2ca20f..e00ae11d197b 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_nic_io.c @@ -391,7 +391,7 @@ void hinic_sq_prepare_ctxt(struct hinic_sq *sq, u16 global_qpn, ci_start = (u16)wq->cons_idx; pi_start = (u16)wq->prod_idx; - /* read the first page from the HW table*/ + /* read the first page from the HW table */ wq_page_addr = be64_to_cpu(*wq->block_vaddr); wq_page_pfn = WQ_PAGE_PFN(wq_page_addr); @@ -453,7 +453,7 @@ void hinic_rq_prepare_ctxt(struct hinic_rq *rq, struct hinic_rq_ctxt *rq_ctxt) pi_start = (u16)wq->prod_idx; pi_start = pi_start & wq->mask; - /* read the first page from the HW table*/ + /* read the first page from the HW table */ wq_page_addr = be64_to_cpu(*wq->block_vaddr); wq_page_pfn = WQ_PAGE_PFN(wq_page_addr); @@ -695,7 +695,7 @@ static int clean_qp_offload_ctxt(struct hinic_nic_io *nic_io) clean_queue_offload_ctxt(nic_io, HINIC_QP_CTXT_TYPE_RQ)); } -/* init qps ctxt and set sq ci attr and arm all sq*/ +/* init qps ctxt and set sq ci attr and arm all sq */ int hinic_init_qp_ctxts(void *dev) { struct hinic_hwdev *hwdev = dev; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h b/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h index 57c5eafa2fb2..c24c155062d4 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_port_cmd.h @@ -84,7 +84,7 @@ enum hinic_port_cmd { HINIC_PORT_CMD_SET_RSS_CTX_TBL, HINIC_PORT_CMD_RSS_TEMP_MGR, - /* 0x36 ~ 0x40 have defined in base line*/ + /* 0x36 ~ 0x40 have defined in base line */ HINIC_PORT_CMD_RSS_CFG = 0x42, @@ -98,7 +98,7 @@ enum hinic_port_cmd { HINIC_PORT_CMD_GET_JUMBO_FRAME_SIZE = 0x4a, HINIC_PORT_CMD_SET_JUMBO_FRAME_SIZE, - /* 0x4c ~ 0x57 have defined in base line*/ + /* 0x4c ~ 0x57 have defined in base line */ HINIC_PORT_CMD_DISABLE_PROMISIC = 0x4c, HINIC_PORT_CMD_ENABLE_SPOOFCHK = 0x4e, HINIC_PORT_CMD_GET_MGMT_VERSION = 0x58, @@ -133,7 +133,7 @@ enum hinic_port_cmd { HINIC_PORT_CMD_SET_VF_VLAN, HINIC_PORT_CMD_CLR_VF_VLAN, - /* 0x6c,0x6e have defined in base line*/ + /* 0x6c,0x6e have defined in base line */ HINIC_PORT_CMD_SET_UCAPTURE_OPT = 0x6F, HINIC_PORT_CMD_SET_TSO = 0x70, @@ -171,7 +171,7 @@ enum hinic_port_cmd { HINIC_PORT_CMD_SET_IPSU_MAC = 0xcb, HINIC_PORT_CMD_GET_IPSU_MAC = 0xcc, - HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4, + HINIC_PORT_CMD_SET_XSFP_STATUS = 0xD4, HINIC_PORT_CMD_SET_IQ_ENABLE = 0xd6, @@ -525,7 +525,7 @@ enum hinic_pf_status { HINIC_PF_STATUS_FLR_FINISH_FLAG = 0x13, }; -/* total doorbell or direct wqe size is 512kB, db num: 128, dwqe: 128*/ +/* total doorbell or direct wqe size is 512kB, db num: 128, dwqe: 128 */ #define HINIC_DB_DWQE_SIZE 0x00080000 /* db/dwqe page size: 4K */ diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sm_lt.h b/drivers/net/ethernet/huawei/hinic/hinic_sm_lt.h index 78767c4e4a08..5fc66c0f3091 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sm_lt.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_sm_lt.h @@ -49,7 +49,7 @@ enum { SM_LT_NUM_3 /* lt num = 3, load 64B */ }; -/* lt load request*/ +/* lt load request */ typedef union { struct { u32 offset:8; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c index 012f8af0fc39..9536adf4c8bc 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.c @@ -83,7 +83,7 @@ static void hinic_sml_ctr_write_build_req(chipif_sml_ctr_wr_req_s *msg, * @ctr_id: counter id * @value: read counter value ptr * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_rd32(void *hwdev, u8 node, u8 instance, u32 ctr_id, u32 *value) { chipif_sml_ctr_rd_req_s req; @@ -120,7 +120,7 @@ EXPORT_SYMBOL(hinic_sm_ctr_rd32); * @value: read counter value ptr * Return: 0 - success, negative - failure * according to ACN error code (ERR_OK, ERR_PARAM, ERR_FAILED...etc) - **/ + */ int hinic_sm_ctr_rd32_clear(void *hwdev, u8 node, u8 instance, u32 ctr_id, u32 *value) { @@ -159,7 +159,7 @@ EXPORT_SYMBOL(hinic_sm_ctr_rd32_clear); * @ctr_id: counter id * @value: write counter value * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_wr32(void *hwdev, u8 node, u8 instance, u32 ctr_id, u32 value) { chipif_sml_ctr_wr_req_s req; @@ -184,7 +184,7 @@ int hinic_sm_ctr_wr32(void *hwdev, u8 node, u8 instance, u32 ctr_id, u32 value) * @ctr_id: counter id * @value: read counter value ptr * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_rd64(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 *value) { chipif_sml_ctr_rd_req_s req; @@ -219,7 +219,7 @@ int hinic_sm_ctr_rd64(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 *value) * @ctr_id: counter id * @value: write counter value * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_wr64(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 value) { chipif_sml_ctr_wr_req_s req; @@ -245,7 +245,7 @@ int hinic_sm_ctr_wr64(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 value) * @value1: read counter value ptr * @value2: read counter value ptr * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_rd64_pair(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 *value1, u64 *value2) { @@ -281,12 +281,12 @@ int hinic_sm_ctr_rd64_pair(void *hwdev, u8 node, u8 instance, * hinic_sm_ctr_wr64_pair - big pair 128 counter write * @hwdev: the pointer to hw device * @node: the node id - * @ctr_id: counter id * @instance: instance value + * @ctr_id: counter id * @value1: write counter value * @value2: write counter value * Return: 0 - success, negative - failure - **/ + */ int hinic_sm_ctr_wr64_pair(void *hwdev, u8 node, u8 instance, u32 ctr_id, u64 value1, u64 value2) { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.h b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.h index cf0e9e863b8f..21aa572f82ae 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_sml_counter.h @@ -89,8 +89,8 @@ typedef union { /* resopnse head */ typedef union { struct { - u32 pad:30; /*reserve*/ - u32 code:2; /*error code*/ + u32 pad:30; /* reserve */ + u32 code:2; /* error code */ } bs; u32 value; -- GitLab