net/hns3: simplify process of some return values
Currently, the return value processing of some functions can be combined and the result is that some codes can be optimized. Signed-off-by: Lijun Ou <oulijun@huawei.com> Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
This commit is contained in:
parent
0265a1980f
commit
10ed8b8721
@ -749,12 +749,10 @@ hns3_dcb_schd_mode_cfg(struct hns3_hw *hw)
|
||||
}
|
||||
|
||||
ret = hns3_dcb_lvl34_schd_mode_cfg(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "config lvl34_schd_mode failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -845,12 +843,10 @@ hns3_dcb_dwrr_cfg(struct hns3_hw *hw)
|
||||
}
|
||||
|
||||
ret = hns3_dcb_pri_dwrr_cfg(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "config pri_dwrr failed: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -932,12 +928,10 @@ hns3_pri_q_qs_cfg(struct hns3_hw *hw)
|
||||
|
||||
/* Cfg q -> qs mapping */
|
||||
ret = hns3_q_to_qs_map(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "nq_to_qs mapping fail: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1552,12 +1546,10 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns)
|
||||
|
||||
hns3_dcb_update_tc_queue_mapping(hw, nb_rx_q, nb_tx_q);
|
||||
ret = hns3_q_to_qs_map(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "failed to map nq to qs! ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
@ -1569,10 +1561,8 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns)
|
||||
|
||||
if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) {
|
||||
ret = hns3_dcb_configure(hns);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "Failed to config dcb: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Update queue map without PFC configuration,
|
||||
|
@ -312,11 +312,9 @@ hns3_restore_vlan_table(struct hns3_adapter *hns)
|
||||
uint16_t vlan_id;
|
||||
int ret = 0;
|
||||
|
||||
if (pf->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_ENABLE) {
|
||||
ret = hns3_vlan_pvid_configure(hns, pf->port_base_vlan_cfg.pvid,
|
||||
1);
|
||||
return ret;
|
||||
}
|
||||
if (pf->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_ENABLE)
|
||||
return hns3_vlan_pvid_configure(hns,
|
||||
pf->port_base_vlan_cfg.pvid, 1);
|
||||
|
||||
LIST_FOREACH(vlan_entry, &pf->vlan_list, next) {
|
||||
if (vlan_entry->hd_tbl_status) {
|
||||
@ -2238,12 +2236,10 @@ hns3_config_mtu(struct hns3_hw *hw, uint16_t mps)
|
||||
}
|
||||
|
||||
ret = hns3_buffer_alloc(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "Failed to allocate buffer, ret = %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -2725,12 +2721,10 @@ hns3_get_configuration(struct hns3_hw *hw)
|
||||
}
|
||||
|
||||
ret = hns3_get_board_configuration(hw);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
PMD_INIT_LOG(ERR, "Failed to get board configuration: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -3664,7 +3658,6 @@ hns3_set_promisc_mode(struct hns3_hw *hw, bool en_uc_pmc, bool en_mc_pmc)
|
||||
struct hns3_promisc_param param;
|
||||
bool en_bc_pmc = true;
|
||||
uint8_t vf_id;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* In current version VF is not supported when PF is driven by DPDK
|
||||
@ -3674,11 +3667,7 @@ hns3_set_promisc_mode(struct hns3_hw *hw, bool en_uc_pmc, bool en_mc_pmc)
|
||||
vf_id = 0;
|
||||
|
||||
hns3_promisc_param_init(¶m, en_uc_pmc, en_mc_pmc, en_bc_pmc, vf_id);
|
||||
ret = hns3_cmd_set_promisc_mode(hw, ¶m);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
return hns3_cmd_set_promisc_mode(hw, ¶m);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -283,10 +283,9 @@ hns3vf_add_mc_mac_addr(struct hns3_adapter *hns,
|
||||
mac_addr);
|
||||
hns3_err(hw, "Failed to add mc mac addr(%s) for vf: %d",
|
||||
mac_str, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -306,10 +305,9 @@ hns3vf_remove_mc_mac_addr(struct hns3_adapter *hns,
|
||||
mac_addr);
|
||||
hns3_err(hw, "Failed to remove mc mac addr(%s) for vf: %d",
|
||||
mac_str, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -550,13 +548,11 @@ hns3vf_bind_ring_with_vector(struct hns3_hw *hw, uint8_t vector_id,
|
||||
op_str = mmap ? "Map" : "Unmap";
|
||||
ret = hns3_send_mbx_msg(hw, code, 0, (uint8_t *)&bind_msg,
|
||||
sizeof(bind_msg), false, NULL, 0);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "%s TQP %d fail, vector_id is %d, ret is %d.",
|
||||
op_str, queue_id, bind_msg.vector_id, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1675,12 +1671,10 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue)
|
||||
return ret;
|
||||
|
||||
ret = hns3_start_queues(hns, reset_queue);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
hns3_err(hw, "Failed to start queues: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user