Skip to content

Commit

Permalink
net: hns3: minior error handling change for hclge_tm_schd_info_init
Browse files Browse the repository at this point in the history
When hclge_tm_schd_info_update calls hclge_tm_schd_info_init to
initialize the schedule info, hdev->tm_info.num_pg and
hdev->tx_sch_mode is not changed, which makes the checking in
hclge_tm_schd_info_init unnecessary.

So this patch moves the hdev->tm_info.num_pg and hdev->tx_sch_mode
checking into hclge_tm_schd_init and changes the return type of
hclge_tm_schd_info_init from int to void.

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Yunsheng Lin authored and David S. Miller committed Aug 1, 2019
1 parent a4ee762 commit b6872fd
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c
Original file line number Diff line number Diff line change
Expand Up @@ -650,21 +650,15 @@ static void hclge_pfc_info_init(struct hclge_dev *hdev)
}
}

static int hclge_tm_schd_info_init(struct hclge_dev *hdev)
static void hclge_tm_schd_info_init(struct hclge_dev *hdev)
{
if ((hdev->tx_sch_mode != HCLGE_FLAG_TC_BASE_SCH_MODE) &&
(hdev->tm_info.num_pg != 1))
return -EINVAL;

hclge_tm_pg_info_init(hdev);

hclge_tm_tc_info_init(hdev);

hclge_tm_vport_info_update(hdev);

hclge_pfc_info_init(hdev);

return 0;
}

static int hclge_tm_pg_to_pri_map(struct hclge_dev *hdev)
Expand Down Expand Up @@ -1428,15 +1422,15 @@ int hclge_tm_init_hw(struct hclge_dev *hdev, bool init)

int hclge_tm_schd_init(struct hclge_dev *hdev)
{
int ret;

/* fc_mode is HCLGE_FC_FULL on reset */
hdev->tm_info.fc_mode = HCLGE_FC_FULL;
hdev->fc_mode_last_time = hdev->tm_info.fc_mode;

ret = hclge_tm_schd_info_init(hdev);
if (ret)
return ret;
if (hdev->tx_sch_mode != HCLGE_FLAG_TC_BASE_SCH_MODE &&
hdev->tm_info.num_pg != 1)
return -EINVAL;

hclge_tm_schd_info_init(hdev);

return hclge_tm_init_hw(hdev, true);
}
Expand Down

0 comments on commit b6872fd

Please sign in to comment.