Skip to content

Commit 44e59e3

Browse files
Yunsheng Lindavem330
authored andcommitted
net: hns3: do not return GE PFC setting err when initializing
GE MAC does not support PFC, when driver is initializing and MAC is in GE Mode, ignore the fw not supported error, otherwise initialization will fail. Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4a402f4 commit 44e59e3

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ static int hclge_map_update(struct hnae3_handle *h)
166166
if (ret)
167167
return ret;
168168

169-
ret = hclge_pause_setup_hw(hdev);
169+
ret = hclge_pause_setup_hw(hdev, false);
170170
if (ret)
171171
return ret;
172172

@@ -313,7 +313,7 @@ static int hclge_ieee_setpfc(struct hnae3_handle *h, struct ieee_pfc *pfc)
313313

314314
hdev->tm_info.hw_pfc_map = pfc_map;
315315

316-
return hclge_pause_setup_hw(hdev);
316+
return hclge_pause_setup_hw(hdev, false);
317317
}
318318

319319
/* DCBX configuration */
@@ -361,7 +361,7 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc)
361361
hclge_tm_schd_info_update(hdev, tc);
362362
hclge_tm_prio_tc_info_update(hdev, prio_tc);
363363

364-
ret = hclge_tm_init_hw(hdev);
364+
ret = hclge_tm_init_hw(hdev, false);
365365
if (ret)
366366
return ret;
367367

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7428,7 +7428,7 @@ static int hclge_reset_ae_dev(struct hnae3_ae_dev *ae_dev)
74287428
return ret;
74297429
}
74307430

7431-
ret = hclge_tm_init_hw(hdev);
7431+
ret = hclge_tm_init_hw(hdev, true);
74327432
if (ret) {
74337433
dev_err(&pdev->dev, "tm init hw fail, ret =%d\n", ret);
74347434
return ret;

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,7 +1255,7 @@ static int hclge_tm_bp_setup(struct hclge_dev *hdev)
12551255
return ret;
12561256
}
12571257

1258-
int hclge_pause_setup_hw(struct hclge_dev *hdev)
1258+
int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init)
12591259
{
12601260
int ret;
12611261

@@ -1271,10 +1271,15 @@ int hclge_pause_setup_hw(struct hclge_dev *hdev)
12711271
if (!hnae3_dev_dcb_supported(hdev))
12721272
return 0;
12731273

1274-
/* When MAC is GE Mode, hdev does not support pfc setting */
1274+
/* GE MAC does not support PFC, when driver is initializing and MAC
1275+
* is in GE Mode, ignore the error here, otherwise initialization
1276+
* will fail.
1277+
*/
12751278
ret = hclge_pfc_setup_hw(hdev);
1276-
if (ret)
1277-
dev_warn(&hdev->pdev->dev, "set pfc pause failed:%d\n", ret);
1279+
if (init && ret == -EOPNOTSUPP)
1280+
dev_warn(&hdev->pdev->dev, "GE MAC does not support pfc\n");
1281+
else
1282+
return ret;
12781283

12791284
return hclge_tm_bp_setup(hdev);
12801285
}
@@ -1314,7 +1319,7 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc)
13141319
hclge_tm_schd_info_init(hdev);
13151320
}
13161321

1317-
int hclge_tm_init_hw(struct hclge_dev *hdev)
1322+
int hclge_tm_init_hw(struct hclge_dev *hdev, bool init)
13181323
{
13191324
int ret;
13201325

@@ -1326,7 +1331,7 @@ int hclge_tm_init_hw(struct hclge_dev *hdev)
13261331
if (ret)
13271332
return ret;
13281333

1329-
ret = hclge_pause_setup_hw(hdev);
1334+
ret = hclge_pause_setup_hw(hdev, init);
13301335
if (ret)
13311336
return ret;
13321337

@@ -1345,7 +1350,7 @@ int hclge_tm_schd_init(struct hclge_dev *hdev)
13451350
if (ret)
13461351
return ret;
13471352

1348-
return hclge_tm_init_hw(hdev);
1353+
return hclge_tm_init_hw(hdev, true);
13491354
}
13501355

13511356
int hclge_tm_vport_map_update(struct hclge_dev *hdev)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ struct hclge_port_shapping_cmd {
143143

144144
int hclge_tm_schd_init(struct hclge_dev *hdev);
145145
int hclge_tm_vport_map_update(struct hclge_dev *hdev);
146-
int hclge_pause_setup_hw(struct hclge_dev *hdev);
146+
int hclge_pause_setup_hw(struct hclge_dev *hdev, bool init);
147147
int hclge_tm_schd_setup_hw(struct hclge_dev *hdev);
148148
void hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc);
149149
void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc);
150150
int hclge_tm_dwrr_cfg(struct hclge_dev *hdev);
151-
int hclge_tm_init_hw(struct hclge_dev *hdev);
151+
int hclge_tm_init_hw(struct hclge_dev *hdev, bool init);
152152
int hclge_mac_pause_en_cfg(struct hclge_dev *hdev, bool tx, bool rx);
153153
int hclge_pause_addr_cfg(struct hclge_dev *hdev, const u8 *mac_addr);
154154
int hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats);

0 commit comments

Comments
 (0)