Skip to content

Commit

Permalink
ice: Cleanup after ice_status removal
Browse files Browse the repository at this point in the history
Clean up code after changing ice_status to int. Rearrange to fix reverse
Christmas tree and pull lines up where applicable.

Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
  • Loading branch information
anguy11 committed Dec 14, 2021
1 parent d54699e commit 5518ac2
Show file tree
Hide file tree
Showing 28 changed files with 265 additions and 350 deletions.
45 changes: 22 additions & 23 deletions drivers/net/ethernet/intel/ice/ice_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ ice_aq_get_phy_caps(struct ice_port_info *pi, bool qual_mods, u8 report_mode,
struct ice_aqc_get_phy_caps *cmd;
u16 pcaps_size = sizeof(*pcaps);
struct ice_aq_desc desc;
int status;
struct ice_hw *hw;
int status;

cmd = &desc.params.get_phy;

Expand Down Expand Up @@ -428,9 +428,9 @@ ice_aq_get_link_info(struct ice_port_info *pi, bool ena_lse,
struct ice_fc_info *hw_fc_info;
bool tx_pause, rx_pause;
struct ice_aq_desc desc;
int status;
struct ice_hw *hw;
u16 cmd_flags;
int status;

if (!pi)
return -EINVAL;
Expand Down Expand Up @@ -668,8 +668,8 @@ static void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw)
static int ice_get_fw_log_cfg(struct ice_hw *hw)
{
struct ice_aq_desc desc;
int status;
__le16 *config;
int status;
u16 size;

size = sizeof(*config) * ICE_AQC_FW_LOG_ID_MAX;
Expand Down Expand Up @@ -740,12 +740,12 @@ static int ice_get_fw_log_cfg(struct ice_hw *hw)
static int ice_cfg_fw_log(struct ice_hw *hw, bool enable)
{
struct ice_aqc_fw_logging *cmd;
int status = 0;
u16 i, chgs = 0, len = 0;
struct ice_aq_desc desc;
__le16 *data = NULL;
u8 actv_evnts = 0;
void *buf = NULL;
int status = 0;

if (!hw->fw_log.cq_en && !hw->fw_log.uart_en)
return 0;
Expand Down Expand Up @@ -906,9 +906,9 @@ static void ice_get_itr_intrl_gran(struct ice_hw *hw)
int ice_init_hw(struct ice_hw *hw)
{
struct ice_aqc_get_phy_caps_data *pcaps;
int status;
u16 mac_buf_len;
void *mac_buf;
int status;

/* Set MAC type based on DeviceID */
status = ice_set_mac_type(hw);
Expand Down Expand Up @@ -1457,11 +1457,11 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
struct ice_sq_cd *cd)
{
struct ice_aq_desc desc_cpy;
int status;
bool is_cmd_for_retry;
u8 *buf_cpy = NULL;
u8 idx = 0;
u16 opcode;
int status;

opcode = le16_to_cpu(desc->opcode);
is_cmd_for_retry = ice_should_retry_sq_send_cmd(opcode);
Expand Down Expand Up @@ -1820,16 +1820,15 @@ ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
*/
void ice_release_res(struct ice_hw *hw, enum ice_aq_res_ids res)
{
int status;
u32 total_delay = 0;
int status;

status = ice_aq_release_res(hw, res, 0, NULL);

/* there are some rare cases when trying to release the resource
* results in an admin queue timeout, so handle them correctly
*/
while ((status == -EIO) &&
(total_delay < hw->adminq.sq_cmd_timeout)) {
while ((status == -EIO) && (total_delay < hw->adminq.sq_cmd_timeout)) {
mdelay(1);
status = ice_aq_release_res(hw, res, 0, NULL);
total_delay++;
Expand Down Expand Up @@ -1884,8 +1883,8 @@ int
ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
{
struct ice_aqc_alloc_free_res_elem *buf;
int status;
u16 buf_len;
int status;

buf_len = struct_size(buf, elem, num);
buf = kzalloc(buf_len, GFP_KERNEL);
Expand Down Expand Up @@ -1921,8 +1920,8 @@ ice_alloc_hw_res(struct ice_hw *hw, u16 type, u16 num, bool btm, u16 *res)
int ice_free_hw_res(struct ice_hw *hw, u16 type, u16 num, u16 *res)
{
struct ice_aqc_alloc_free_res_elem *buf;
int status;
u16 buf_len;
int status;

buf_len = struct_size(buf, elem, num);
buf = kzalloc(buf_len, GFP_KERNEL);
Expand Down Expand Up @@ -2518,9 +2517,9 @@ ice_aq_list_caps(struct ice_hw *hw, void *buf, u16 buf_size, u32 *cap_count,
int
ice_discover_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_caps)
{
int status;
u32 cap_count = 0;
void *cbuf;
int status;

cbuf = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
if (!cbuf)
Expand Down Expand Up @@ -2552,9 +2551,9 @@ ice_discover_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_caps)
static int
ice_discover_func_caps(struct ice_hw *hw, struct ice_hw_func_caps *func_caps)
{
int status;
u32 cap_count = 0;
void *cbuf;
int status;

cbuf = kzalloc(ICE_AQ_MAX_BUF_LEN, GFP_KERNEL);
if (!cbuf)
Expand Down Expand Up @@ -3120,8 +3119,8 @@ ice_set_fc(struct ice_port_info *pi, u8 *aq_failures, bool ena_auto_link_update)
{
struct ice_aqc_set_phy_cfg_data cfg = { 0 };
struct ice_aqc_get_phy_caps_data *pcaps;
int status;
struct ice_hw *hw;
int status;

if (!pi || !aq_failures)
return -EINVAL;
Expand Down Expand Up @@ -3261,8 +3260,8 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_aqc_set_phy_cfg_data *cfg,
enum ice_fec_mode fec)
{
struct ice_aqc_get_phy_caps_data *pcaps;
int status;
struct ice_hw *hw;
int status;

if (!pi || !cfg)
return -EINVAL;
Expand Down Expand Up @@ -3652,9 +3651,9 @@ ice_aq_set_rss_lut(struct ice_hw *hw, struct ice_aq_get_set_rss_lut_params *set_
*
* get (0x0B04) or set (0x0B02) the RSS key per VSI
*/
static int __ice_aq_get_set_rss_key(struct ice_hw *hw, u16 vsi_id,
struct ice_aqc_get_set_rss_keys *key,
bool set)
static int
__ice_aq_get_set_rss_key(struct ice_hw *hw, u16 vsi_id,
struct ice_aqc_get_set_rss_keys *key, bool set)
{
struct ice_aqc_get_set_rss_key *cmd_resp;
u16 key_size = sizeof(*key);
Expand Down Expand Up @@ -3793,8 +3792,8 @@ ice_aq_dis_lan_txq(struct ice_hw *hw, u8 num_qgrps,
struct ice_aqc_dis_txq_item *item;
struct ice_aqc_dis_txqs *cmd;
struct ice_aq_desc desc;
int status;
u16 i, sz = 0;
int status;

cmd = &desc.params.dis_txqs;
ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_dis_txqs);
Expand Down Expand Up @@ -4189,8 +4188,8 @@ ice_ena_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u16 q_handle,
struct ice_aqc_txsched_elem_data node = { 0 };
struct ice_sched_node *parent;
struct ice_q_ctx *q_ctx;
int status;
struct ice_hw *hw;
int status;

if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
return -EIO;
Expand Down Expand Up @@ -4292,9 +4291,9 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues,
enum ice_disq_rst_src rst_src, u16 vmvf_num,
struct ice_sq_cd *cd)
{
int status = -ENOENT;
struct ice_aqc_dis_txq_item *qg_list;
struct ice_q_ctx *q_ctx;
int status = -ENOENT;
struct ice_hw *hw;
u16 i, buf_size;

Expand Down Expand Up @@ -4446,9 +4445,9 @@ ice_ena_vsi_rdma_qset(struct ice_port_info *pi, u16 vsi_handle, u8 tc,
struct ice_aqc_txsched_elem_data node = { 0 };
struct ice_aqc_add_rdma_qset_data *buf;
struct ice_sched_node *parent;
int status;
struct ice_hw *hw;
u16 i, buf_size;
int status;
int ret;

if (!pi || pi->port_state != ICE_SCHED_PORT_STATE_READY)
Expand Down Expand Up @@ -4523,8 +4522,8 @@ ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid,
u16 *q_id)
{
struct ice_aqc_dis_txq_item *qg_list;
int status = 0;
struct ice_hw *hw;
int status = 0;
u16 qg_size;
int i;

Expand Down
18 changes: 7 additions & 11 deletions drivers/net/ethernet/intel/ice/ice_controlq.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ ice_cfg_cq_regs(struct ice_hw *hw, struct ice_ctl_q_ring *ring, u16 num_entries)
*
* Configure base address and length registers for the transmit queue
*/
static int
ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
static int ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
return ice_cfg_cq_regs(hw, &cq->sq, cq->num_sq_entries);
}
Expand All @@ -308,8 +307,7 @@ ice_cfg_sq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
*
* Configure base address and length registers for the receive (event queue)
*/
static int
ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
static int ice_cfg_rq_regs(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
int status;

Expand Down Expand Up @@ -474,8 +472,7 @@ static int ice_init_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
*
* The main shutdown routine for the Control Transmit Queue
*/
static int
ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
static int ice_shutdown_sq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
int ret_code = 0;

Expand Down Expand Up @@ -541,8 +538,7 @@ static bool ice_aq_ver_check(struct ice_hw *hw)
*
* The main shutdown routine for the Control Receive Queue
*/
static int
ice_shutdown_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
static int ice_shutdown_rq(struct ice_hw *hw, struct ice_ctl_q_info *cq)
{
int ret_code = 0;

Expand Down Expand Up @@ -753,8 +749,8 @@ void ice_shutdown_all_ctrlq(struct ice_hw *hw)
*/
int ice_init_all_ctrlq(struct ice_hw *hw)
{
int status;
u32 retry = 0;
int status;

/* Init FW admin queue */
do {
Expand Down Expand Up @@ -970,9 +966,9 @@ ice_sq_send_cmd(struct ice_hw *hw, struct ice_ctl_q_info *cq,
struct ice_dma_mem *dma_buf = NULL;
struct ice_aq_desc *desc_on_ring;
bool cmd_completed = false;
int status = 0;
struct ice_sq_cd *details;
u32 total_delay = 0;
int status = 0;
u16 retval = 0;
u32 val = 0;

Expand Down Expand Up @@ -1160,9 +1156,9 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
{
u16 ntc = cq->rq.next_to_clean;
enum ice_aq_err rq_last_status;
int ret_code = 0;
struct ice_aq_desc *desc;
struct ice_dma_mem *bi;
int ret_code = 0;
u16 desc_idx;
u16 datalen;
u16 flags;
Expand Down
19 changes: 8 additions & 11 deletions drivers/net/ethernet/intel/ice/ice_dcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
*
* Start the embedded LLDP Agent on all ports. (0x0A06)
*/
int
ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd)
int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd)
{
struct ice_aqc_lldp_start *cmd;
struct ice_aq_desc desc;
Expand Down Expand Up @@ -597,12 +596,11 @@ ice_parse_org_tlv(struct ice_lldp_org_tlv *tlv, struct ice_dcbx_cfg *dcbcfg)
*
* Parse DCB configuration from the LLDPDU
*/
static int
ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
static int ice_lldp_to_dcb_cfg(u8 *lldpmib, struct ice_dcbx_cfg *dcbcfg)
{
struct ice_lldp_org_tlv *tlv;
int ret = 0;
u16 offset = 0;
int ret = 0;
u16 typelen;
u16 type;
u16 len;
Expand Down Expand Up @@ -652,8 +650,8 @@ int
ice_aq_get_dcb_cfg(struct ice_hw *hw, u8 mib_type, u8 bridgetype,
struct ice_dcbx_cfg *dcbcfg)
{
int ret;
u8 *lldpmib;
int ret;

/* Allocate the LLDPDU */
lldpmib = devm_kzalloc(ice_hw_to_dev(hw), ICE_LLDPDU_SIZE, GFP_KERNEL);
Expand Down Expand Up @@ -691,9 +689,9 @@ ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
bool *dcbx_agent_status, struct ice_sq_cd *cd)
{
struct ice_aqc_lldp_stop_start_specific_agent *cmd;
int status;
struct ice_aq_desc desc;
u16 opcode;
int status;

cmd = &desc.params.lldp_agent_ctrl;

Expand Down Expand Up @@ -902,8 +900,7 @@ ice_cee_to_dcb_cfg(struct ice_aqc_get_cee_dcb_cfg_resp *cee_cfg,
*
* Get IEEE or CEE mode DCB configuration from the Firmware
*/
static int
ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)
static int ice_get_ieee_or_cee_dcb_cfg(struct ice_port_info *pi, u8 dcbx_mode)
{
struct ice_dcbx_cfg *dcbx_cfg = NULL;
int ret;
Expand Down Expand Up @@ -1472,9 +1469,9 @@ int ice_set_dcb_cfg(struct ice_port_info *pi)
{
u8 mib_type, *lldpmib = NULL;
struct ice_dcbx_cfg *dcbcfg;
int ret;
struct ice_hw *hw;
u16 miblen;
int ret;

if (!pi)
return -EINVAL;
Expand Down Expand Up @@ -1542,8 +1539,8 @@ ice_update_port_tc_tree_cfg(struct ice_port_info *pi,
{
struct ice_sched_node *node, *tc_node;
struct ice_aqc_txsched_elem_data elem;
int status = 0;
u32 teid1, teid2;
int status = 0;
u8 i, j;

if (!pi)
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/ethernet/intel/ice/ice_dcb.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@ ice_query_port_ets(struct ice_port_info *pi,
int
ice_aq_stop_lldp(struct ice_hw *hw, bool shutdown_lldp_agent, bool persist,
struct ice_sq_cd *cd);
int
ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
int ice_aq_start_lldp(struct ice_hw *hw, bool persist, struct ice_sq_cd *cd);
int
ice_aq_start_stop_dcbx(struct ice_hw *hw, bool start_dcbx_agent,
bool *dcbx_agent_status, struct ice_sq_cd *cd);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/intel/ice/ice_devlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -762,9 +762,9 @@ static int ice_devlink_nvm_snapshot(struct devlink *devlink,
struct ice_pf *pf = devlink_priv(devlink);
struct device *dev = ice_pf_to_dev(pf);
struct ice_hw *hw = &pf->hw;
int status;
void *nvm_data;
u32 nvm_size;
int status;

nvm_size = hw->flash.flash_size;
nvm_data = vzalloc(nvm_size);
Expand Down Expand Up @@ -819,8 +819,8 @@ ice_devlink_devcaps_snapshot(struct devlink *devlink,
struct ice_pf *pf = devlink_priv(devlink);
struct device *dev = ice_pf_to_dev(pf);
struct ice_hw *hw = &pf->hw;
int status;
void *devcaps;
int status;

devcaps = vzalloc(ICE_AQ_MAX_BUF_LEN);
if (!devcaps)
Expand Down

0 comments on commit 5518ac2

Please sign in to comment.