Lines Matching refs:pfvf
10 static int otx2_check_pfc_config(struct otx2_nic *pfvf) in otx2_check_pfc_config() argument
12 u8 tx_queues = pfvf->hw.tx_queues, prio; in otx2_check_pfc_config()
13 u8 pfc_en = pfvf->pfc_en; in otx2_check_pfc_config()
18 dev_warn(pfvf->dev, in otx2_check_pfc_config()
28 int otx2_pfc_txschq_config(struct otx2_nic *pfvf) in otx2_pfc_txschq_config() argument
33 pfc_en = pfvf->pfc_en; in otx2_pfc_txschq_config()
40 if (!pfc_bit_set || !pfvf->pfc_alloc_status[prio]) in otx2_pfc_txschq_config()
45 err = otx2_txschq_config(pfvf, lvl, prio, true); in otx2_pfc_txschq_config()
47 dev_err(pfvf->dev, in otx2_pfc_txschq_config()
59 static int otx2_pfc_txschq_alloc_one(struct otx2_nic *pfvf, u8 prio) in otx2_pfc_txschq_alloc_one() argument
66 req = otx2_mbox_alloc_msg_nix_txsch_alloc(&pfvf->mbox); in otx2_pfc_txschq_alloc_one()
74 for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) in otx2_pfc_txschq_alloc_one()
77 rc = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_pfc_txschq_alloc_one()
82 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); in otx2_pfc_txschq_alloc_one()
87 for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) { in otx2_pfc_txschq_alloc_one()
91 pfvf->pfc_schq_list[lvl][prio] = rsp->schq_list[lvl][0]; in otx2_pfc_txschq_alloc_one()
98 pfvf->pfc_schq_list[lvl][prio] = pfvf->hw.txschq_list[lvl][0]; in otx2_pfc_txschq_alloc_one()
100 pfvf->pfc_alloc_status[prio] = true; in otx2_pfc_txschq_alloc_one()
104 int otx2_pfc_txschq_alloc(struct otx2_nic *pfvf) in otx2_pfc_txschq_alloc() argument
106 u8 pfc_en = pfvf->pfc_en; in otx2_pfc_txschq_alloc()
113 if (!pfc_bit_set || pfvf->pfc_alloc_status[prio]) in otx2_pfc_txschq_alloc()
117 err = otx2_pfc_txschq_alloc_one(pfvf, prio); in otx2_pfc_txschq_alloc()
119 dev_err(pfvf->dev, "%s failed to allocate PFC TX schedulers\n", __func__); in otx2_pfc_txschq_alloc()
128 static int otx2_pfc_txschq_stop_one(struct otx2_nic *pfvf, u8 prio) in otx2_pfc_txschq_stop_one() argument
133 for (lvl = 0; lvl <= pfvf->hw.txschq_link_cfg_lvl; lvl++) in otx2_pfc_txschq_stop_one()
134 otx2_txschq_free_one(pfvf, lvl, in otx2_pfc_txschq_stop_one()
135 pfvf->pfc_schq_list[lvl][prio]); in otx2_pfc_txschq_stop_one()
137 pfvf->pfc_alloc_status[prio] = false; in otx2_pfc_txschq_stop_one()
141 static int otx2_pfc_update_sq_smq_mapping(struct otx2_nic *pfvf, int prio) in otx2_pfc_update_sq_smq_mapping() argument
144 struct net_device *dev = pfvf->netdev; in otx2_pfc_update_sq_smq_mapping()
149 if (pfvf->pfc_alloc_status[prio]) in otx2_pfc_update_sq_smq_mapping()
150 netif_tx_stop_all_queues(pfvf->netdev); in otx2_pfc_update_sq_smq_mapping()
155 if (test_bit(CN10K_LMTST, &pfvf->hw.cap_flag)) { in otx2_pfc_update_sq_smq_mapping()
156 cn10k_sq_aq = otx2_mbox_alloc_msg_nix_cn10k_aq_enq(&pfvf->mbox); in otx2_pfc_update_sq_smq_mapping()
169 cn10k_sq_aq->sq.smq = otx2_get_smq_idx(pfvf, prio); in otx2_pfc_update_sq_smq_mapping()
171 sq_aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_pfc_update_sq_smq_mapping()
184 sq_aq->sq.smq = otx2_get_smq_idx(pfvf, prio); in otx2_pfc_update_sq_smq_mapping()
187 otx2_sync_mbox_msg(&pfvf->mbox); in otx2_pfc_update_sq_smq_mapping()
190 if (pfvf->pfc_alloc_status[prio]) in otx2_pfc_update_sq_smq_mapping()
191 netif_tx_start_all_queues(pfvf->netdev); in otx2_pfc_update_sq_smq_mapping()
199 int otx2_pfc_txschq_update(struct otx2_nic *pfvf) in otx2_pfc_txschq_update() argument
201 bool if_up = netif_running(pfvf->netdev); in otx2_pfc_txschq_update()
202 u8 pfc_en = pfvf->pfc_en, pfc_bit_set; in otx2_pfc_txschq_update()
203 struct mbox *mbox = &pfvf->mbox; in otx2_pfc_txschq_update()
211 if (!pfc_bit_set && pfvf->pfc_alloc_status[prio]) { in otx2_pfc_txschq_update()
214 netif_tx_stop_all_queues(pfvf->netdev); in otx2_pfc_txschq_update()
216 otx2_smq_flush(pfvf, pfvf->pfc_schq_list[NIX_TXSCH_LVL_SMQ][prio]); in otx2_pfc_txschq_update()
218 netif_tx_start_all_queues(pfvf->netdev); in otx2_pfc_txschq_update()
221 err = otx2_pfc_txschq_stop_one(pfvf, prio); in otx2_pfc_txschq_update()
223 dev_err(pfvf->dev, in otx2_pfc_txschq_update()
236 if (!pfc_bit_set || pfvf->pfc_alloc_status[prio]) in otx2_pfc_txschq_update()
240 err = otx2_pfc_txschq_alloc_one(pfvf, prio); in otx2_pfc_txschq_update()
243 dev_err(pfvf->dev, in otx2_pfc_txschq_update()
250 err = otx2_pfc_update_sq_smq_mapping(pfvf, prio); in otx2_pfc_txschq_update()
253 dev_err(pfvf->dev, "%s failed PFC Tx schq sq:%d mapping", __func__, prio); in otx2_pfc_txschq_update()
258 err = otx2_pfc_txschq_config(pfvf); in otx2_pfc_txschq_update()
267 int otx2_pfc_txschq_stop(struct otx2_nic *pfvf) in otx2_pfc_txschq_stop() argument
272 pfc_en = pfvf->pfc_en; in otx2_pfc_txschq_stop()
275 if (!pfc_bit_set || !pfvf->pfc_alloc_status[prio]) in otx2_pfc_txschq_stop()
279 err = otx2_pfc_txschq_stop_one(pfvf, prio); in otx2_pfc_txschq_stop()
281 dev_err(pfvf->dev, "%s failed to stop PFC TX schedulers\n", __func__); in otx2_pfc_txschq_stop()
290 int otx2_config_priority_flow_ctrl(struct otx2_nic *pfvf) in otx2_config_priority_flow_ctrl() argument
296 if (is_otx2_lbkvf(pfvf->pdev)) in otx2_config_priority_flow_ctrl()
299 mutex_lock(&pfvf->mbox.lock); in otx2_config_priority_flow_ctrl()
300 req = otx2_mbox_alloc_msg_cgx_prio_flow_ctrl_cfg(&pfvf->mbox); in otx2_config_priority_flow_ctrl()
306 if (pfvf->pfc_en) { in otx2_config_priority_flow_ctrl()
313 req->pfc_en = pfvf->pfc_en; in otx2_config_priority_flow_ctrl()
315 if (!otx2_sync_mbox_msg(&pfvf->mbox)) { in otx2_config_priority_flow_ctrl()
317 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); in otx2_config_priority_flow_ctrl()
324 dev_warn(pfvf->dev, in otx2_config_priority_flow_ctrl()
330 mutex_unlock(&pfvf->mbox.lock); in otx2_config_priority_flow_ctrl()
335 void otx2_update_bpid_in_rqctx(struct otx2_nic *pfvf, int vlan_prio, int qidx, in otx2_update_bpid_in_rqctx() argument
338 bool if_up = netif_running(pfvf->netdev); in otx2_update_bpid_in_rqctx()
343 if (pfvf->queue_to_pfc_map[qidx] && pfc_enable) { in otx2_update_bpid_in_rqctx()
344 dev_warn(pfvf->dev, in otx2_update_bpid_in_rqctx()
346 pfvf->queue_to_pfc_map[qidx], qidx); in otx2_update_bpid_in_rqctx()
351 netif_tx_stop_all_queues(pfvf->netdev); in otx2_update_bpid_in_rqctx()
352 netif_carrier_off(pfvf->netdev); in otx2_update_bpid_in_rqctx()
355 pfvf->queue_to_pfc_map[qidx] = vlan_prio; in otx2_update_bpid_in_rqctx()
357 aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_update_bpid_in_rqctx()
363 aq->cq.bpid = pfvf->bpid[vlan_prio]; in otx2_update_bpid_in_rqctx()
371 otx2_sync_mbox_msg(&pfvf->mbox); in otx2_update_bpid_in_rqctx()
373 npa_aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_update_bpid_in_rqctx()
378 npa_aq->aura.nix0_bpid = pfvf->bpid[vlan_prio]; in otx2_update_bpid_in_rqctx()
385 otx2_sync_mbox_msg(&pfvf->mbox); in otx2_update_bpid_in_rqctx()
389 netif_carrier_on(pfvf->netdev); in otx2_update_bpid_in_rqctx()
390 netif_tx_start_all_queues(pfvf->netdev); in otx2_update_bpid_in_rqctx()
394 dev_warn(pfvf->dev, in otx2_update_bpid_in_rqctx()
402 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_dcbnl_ieee_getpfc() local
405 pfc->pfc_en = pfvf->pfc_en; in otx2_dcbnl_ieee_getpfc()
412 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_dcbnl_ieee_setpfc() local
416 old_pfc_en = pfvf->pfc_en; in otx2_dcbnl_ieee_setpfc()
417 pfvf->pfc_en = pfc->pfc_en; in otx2_dcbnl_ieee_setpfc()
419 if (pfvf->hw.tx_queues >= NIX_PF_PFC_PRIO_MAX) in otx2_dcbnl_ieee_setpfc()
425 err = otx2_check_pfc_config(pfvf); in otx2_dcbnl_ieee_setpfc()
427 pfvf->pfc_en = old_pfc_en; in otx2_dcbnl_ieee_setpfc()
432 err = otx2_config_priority_flow_ctrl(pfvf); in otx2_dcbnl_ieee_setpfc()
434 pfvf->pfc_en = old_pfc_en; in otx2_dcbnl_ieee_setpfc()
439 otx2_nix_cpt_config_bp(pfvf, false); in otx2_dcbnl_ieee_setpfc()
443 otx2_nix_config_bp(pfvf, true); in otx2_dcbnl_ieee_setpfc()
445 err = otx2_pfc_txschq_update(pfvf); in otx2_dcbnl_ieee_setpfc()
448 otx2_nix_config_bp(pfvf, false); in otx2_dcbnl_ieee_setpfc()
450 otx2_pfc_txschq_stop(pfvf); in otx2_dcbnl_ieee_setpfc()
451 pfvf->pfc_en = old_pfc_en; in otx2_dcbnl_ieee_setpfc()
452 otx2_config_priority_flow_ctrl(pfvf); in otx2_dcbnl_ieee_setpfc()
453 dev_err(pfvf->dev, "%s failed to update TX schedulers\n", __func__); in otx2_dcbnl_ieee_setpfc()
479 struct otx2_nic *pfvf = netdev_priv(dev); in otx2_dcbnl_set_ops() local
481 pfvf->queue_to_pfc_map = devm_kzalloc(pfvf->dev, pfvf->hw.rx_queues, in otx2_dcbnl_set_ops()
483 if (!pfvf->queue_to_pfc_map) in otx2_dcbnl_set_ops()