Skip to content

Commit af01390

Browse files
Huazhong Tandavem330
authored andcommitted
net: hns3: do reinitialization while ETS configuration changed
When the ETS information is changed, the network device needs to be re-initialized, otherwise the information such as the receiving queue will be incorrect. Signed-off-by: Huazhong Tan <[email protected]> Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: Peng Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c3b9c50 commit af01390

File tree

4 files changed

+22
-15
lines changed

4 files changed

+22
-15
lines changed

drivers/net/ethernet/hisilicon/hns3/hns3_enet.c

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3728,7 +3728,6 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
37283728
{
37293729
struct hnae3_knic_private_info *kinfo = &handle->kinfo;
37303730
struct net_device *ndev = kinfo->netdev;
3731-
bool if_running;
37323731
int ret;
37333732

37343733
if (tc > HNAE3_MAX_TC)
@@ -3737,24 +3736,13 @@ static int hns3_client_setup_tc(struct hnae3_handle *handle, u8 tc)
37373736
if (!ndev)
37383737
return -ENODEV;
37393738

3740-
if_running = netif_running(ndev);
3741-
3742-
if (if_running) {
3743-
(void)hns3_nic_net_stop(ndev);
3744-
msleep(100);
3745-
}
3746-
37473739
ret = (kinfo->dcb_ops && kinfo->dcb_ops->map_update) ?
37483740
kinfo->dcb_ops->map_update(handle) : -EOPNOTSUPP;
37493741
if (ret)
3750-
goto err_out;
3742+
return ret;
37513743

37523744
ret = hns3_nic_set_real_num_queue(ndev);
37533745

3754-
err_out:
3755-
if (if_running)
3756-
(void)hns3_nic_net_open(ndev);
3757-
37583746
return ret;
37593747
}
37603748

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,16 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
222222
if (ret)
223223
return ret;
224224

225+
if (map_changed) {
226+
ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
227+
if (ret)
228+
return ret;
229+
230+
ret = hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
231+
if (ret)
232+
return ret;
233+
}
234+
225235
hclge_tm_schd_info_update(hdev, num_tc);
226236

227237
ret = hclge_ieee_ets_to_tm_info(hdev, ets);
@@ -232,6 +242,13 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets)
232242
ret = hclge_client_setup_tc(hdev);
233243
if (ret)
234244
return ret;
245+
ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
246+
if (ret)
247+
return ret;
248+
249+
ret = hclge_notify_client(hdev, HNAE3_UP_CLIENT);
250+
if (ret)
251+
return ret;
235252
}
236253

237254
return hclge_tm_dwrr_cfg(hdev);

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,8 +2401,8 @@ static void hclge_misc_irq_uninit(struct hclge_dev *hdev)
24012401
hclge_free_vector(hdev, 0);
24022402
}
24032403

2404-
static int hclge_notify_client(struct hclge_dev *hdev,
2405-
enum hnae3_reset_notify_type type)
2404+
int hclge_notify_client(struct hclge_dev *hdev,
2405+
enum hnae3_reset_notify_type type)
24062406
{
24072407
struct hnae3_client *client = hdev->nic_client;
24082408
u16 i;

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,4 +878,6 @@ void hclge_vport_stop(struct hclge_vport *vport);
878878
int hclge_set_vport_mtu(struct hclge_vport *vport, int new_mtu);
879879
int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf);
880880
u16 hclge_covert_handle_qid_global(struct hnae3_handle *handle, u16 queue_id);
881+
int hclge_notify_client(struct hclge_dev *hdev,
882+
enum hnae3_reset_notify_type type);
881883
#endif

0 commit comments

Comments
 (0)