Lines Matching refs:hdev

10 static int hclge_ieee_ets_to_tm_info(struct hclge_dev *hdev,  in hclge_ieee_ets_to_tm_info()  argument
18 hdev->tm_info.tc_info[i].tc_sch_mode = in hclge_ieee_ets_to_tm_info()
20 hdev->tm_info.pg_info[0].tc_dwrr[i] = 0; in hclge_ieee_ets_to_tm_info()
23 hdev->tm_info.tc_info[i].tc_sch_mode = in hclge_ieee_ets_to_tm_info()
25 hdev->tm_info.pg_info[0].tc_dwrr[i] = in hclge_ieee_ets_to_tm_info()
38 hclge_tm_prio_tc_info_update(hdev, ets->prio_tc); in hclge_ieee_ets_to_tm_info()
43 static void hclge_tm_info_to_ieee_ets(struct hclge_dev *hdev, in hclge_tm_info_to_ieee_ets() argument
50 ets->ets_cap = hdev->tc_max; in hclge_tm_info_to_ieee_ets()
53 ets->prio_tc[i] = hdev->tm_info.prio_tc[i]; in hclge_tm_info_to_ieee_ets()
54 ets->tc_tx_bw[i] = hdev->tm_info.pg_info[0].tc_dwrr[i]; in hclge_tm_info_to_ieee_ets()
56 if (hdev->tm_info.tc_info[i].tc_sch_mode == in hclge_tm_info_to_ieee_ets()
68 struct hclge_dev *hdev = vport->back; in hclge_ieee_getets() local
70 hclge_tm_info_to_ieee_ets(hdev, ets); in hclge_ieee_getets()
75 static int hclge_dcb_common_validate(struct hclge_dev *hdev, u8 num_tc, in hclge_dcb_common_validate() argument
80 if (num_tc > hdev->tc_max) { in hclge_dcb_common_validate()
81 dev_err(&hdev->pdev->dev, in hclge_dcb_common_validate()
83 num_tc, hdev->tc_max); in hclge_dcb_common_validate()
89 dev_err(&hdev->pdev->dev, in hclge_dcb_common_validate()
96 if (num_tc > hdev->vport[0].alloc_tqps) { in hclge_dcb_common_validate()
97 dev_err(&hdev->pdev->dev, in hclge_dcb_common_validate()
99 num_tc, hdev->vport[0].alloc_tqps); in hclge_dcb_common_validate()
106 static int hclge_ets_validate(struct hclge_dev *hdev, struct ieee_ets *ets, in hclge_ets_validate() argument
116 if (ets->prio_tc[i] != hdev->tm_info.prio_tc[i]) in hclge_ets_validate()
123 ret = hclge_dcb_common_validate(hdev, max_tc + 1, ets->prio_tc); in hclge_ets_validate()
127 for (i = 0; i < hdev->tc_max; i++) { in hclge_ets_validate()
130 if (hdev->tm_info.tc_info[i].tc_sch_mode != in hclge_ets_validate()
135 if (hdev->tm_info.tc_info[i].tc_sch_mode != in hclge_ets_validate()
151 if (*tc != hdev->tm_info.num_tc) in hclge_ets_validate()
157 static int hclge_map_update(struct hclge_dev *hdev) in hclge_map_update() argument
161 ret = hclge_tm_schd_setup_hw(hdev); in hclge_map_update()
165 ret = hclge_pause_setup_hw(hdev, false); in hclge_map_update()
169 ret = hclge_buffer_alloc(hdev); in hclge_map_update()
173 hclge_rss_indir_init_cfg(hdev); in hclge_map_update()
175 return hclge_rss_init_hw(hdev); in hclge_map_update()
178 static int hclge_client_setup_tc(struct hclge_dev *hdev) in hclge_client_setup_tc() argument
180 struct hclge_vport *vport = hdev->vport; in hclge_client_setup_tc()
186 for (i = 0; i < hdev->num_vmdq_vport + 1; i++) { in hclge_client_setup_tc()
193 ret = client->ops->setup_tc(handle, hdev->tm_info.num_tc); in hclge_client_setup_tc()
201 static int hclge_notify_down_uinit(struct hclge_dev *hdev) in hclge_notify_down_uinit() argument
205 ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); in hclge_notify_down_uinit()
209 return hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT); in hclge_notify_down_uinit()
212 static int hclge_notify_init_up(struct hclge_dev *hdev) in hclge_notify_init_up() argument
216 ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT); in hclge_notify_init_up()
220 return hclge_notify_client(hdev, HNAE3_UP_CLIENT); in hclge_notify_init_up()
227 struct hclge_dev *hdev = vport->back; in hclge_ieee_setets() local
232 if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) || in hclge_ieee_setets()
233 hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE) in hclge_ieee_setets()
236 ret = hclge_ets_validate(hdev, ets, &num_tc, &map_changed); in hclge_ieee_setets()
243 ret = hclge_notify_down_uinit(hdev); in hclge_ieee_setets()
248 hclge_tm_schd_info_update(hdev, num_tc); in hclge_ieee_setets()
250 ret = hclge_ieee_ets_to_tm_info(hdev, ets); in hclge_ieee_setets()
255 ret = hclge_map_update(hdev); in hclge_ieee_setets()
259 ret = hclge_client_setup_tc(hdev); in hclge_ieee_setets()
263 ret = hclge_notify_init_up(hdev); in hclge_ieee_setets()
268 return hclge_tm_dwrr_cfg(hdev); in hclge_ieee_setets()
274 hclge_notify_init_up(hdev); in hclge_ieee_setets()
283 struct hclge_dev *hdev = vport->back; in hclge_ieee_getpfc() local
288 pfc->pfc_cap = hdev->pfc_max; in hclge_ieee_getpfc()
289 prio_tc = hdev->tm_info.prio_tc; in hclge_ieee_getpfc()
290 pfc_map = hdev->tm_info.hw_pfc_map; in hclge_ieee_getpfc()
293 for (i = 0; i < hdev->tm_info.num_tc; i++) { in hclge_ieee_getpfc()
300 ret = hclge_pfc_tx_stats_get(hdev, requests); in hclge_ieee_getpfc()
304 ret = hclge_pfc_rx_stats_get(hdev, indications); in hclge_ieee_getpfc()
319 struct hclge_dev *hdev = vport->back; in hclge_ieee_setpfc() local
323 if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE) || in hclge_ieee_setpfc()
324 hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE) in hclge_ieee_setpfc()
327 if (pfc->pfc_en == hdev->tm_info.pfc_en) in hclge_ieee_setpfc()
330 prio_tc = hdev->tm_info.prio_tc; in hclge_ieee_setpfc()
333 for (i = 0; i < hdev->tm_info.num_tc; i++) { in hclge_ieee_setpfc()
342 hdev->tm_info.hw_pfc_map = pfc_map; in hclge_ieee_setpfc()
343 hdev->tm_info.pfc_en = pfc->pfc_en; in hclge_ieee_setpfc()
347 pfc->pfc_en, pfc_map, hdev->tm_info.num_tc); in hclge_ieee_setpfc()
349 hclge_tm_pfc_info_update(hdev); in hclge_ieee_setpfc()
351 ret = hclge_pause_setup_hw(hdev, false); in hclge_ieee_setpfc()
355 ret = hclge_notify_client(hdev, HNAE3_DOWN_CLIENT); in hclge_ieee_setpfc()
359 ret = hclge_buffer_alloc(hdev); in hclge_ieee_setpfc()
361 hclge_notify_client(hdev, HNAE3_UP_CLIENT); in hclge_ieee_setpfc()
365 return hclge_notify_client(hdev, HNAE3_UP_CLIENT); in hclge_ieee_setpfc()
372 struct hclge_dev *hdev = vport->back; in hclge_getdcbx() local
374 if (hdev->flag & HCLGE_FLAG_MQPRIO_ENABLE) in hclge_getdcbx()
377 return hdev->dcbx_cap; in hclge_getdcbx()
384 struct hclge_dev *hdev = vport->back; in hclge_setdcbx() local
394 hdev->dcbx_cap = mode; in hclge_setdcbx()
403 struct hclge_dev *hdev = vport->back; in hclge_setup_tc() local
406 if (hdev->flag & HCLGE_FLAG_DCB_ENABLE) in hclge_setup_tc()
409 ret = hclge_dcb_common_validate(hdev, tc, prio_tc); in hclge_setup_tc()
413 ret = hclge_notify_down_uinit(hdev); in hclge_setup_tc()
417 hclge_tm_schd_info_update(hdev, tc); in hclge_setup_tc()
418 hclge_tm_prio_tc_info_update(hdev, prio_tc); in hclge_setup_tc()
420 ret = hclge_tm_init_hw(hdev, false); in hclge_setup_tc()
424 ret = hclge_client_setup_tc(hdev); in hclge_setup_tc()
428 hdev->flag &= ~HCLGE_FLAG_DCB_ENABLE; in hclge_setup_tc()
431 hdev->flag |= HCLGE_FLAG_MQPRIO_ENABLE; in hclge_setup_tc()
433 hdev->flag &= ~HCLGE_FLAG_MQPRIO_ENABLE; in hclge_setup_tc()
435 return hclge_notify_init_up(hdev); in hclge_setup_tc()
438 hclge_notify_init_up(hdev); in hclge_setup_tc()
453 void hclge_dcb_ops_set(struct hclge_dev *hdev) in hclge_dcb_ops_set() argument
455 struct hclge_vport *vport = hdev->vport; in hclge_dcb_ops_set()
461 if (!hnae3_dev_dcb_supported(hdev) || in hclge_dcb_ops_set()
467 hdev->dcbx_cap = DCB_CAP_DCBX_VER_IEEE | DCB_CAP_DCBX_HOST; in hclge_dcb_ops_set()