Lines Matching refs:pfvf
19 static void otx2_qos_aura_pool_free(struct otx2_nic *pfvf, int pool_id) in otx2_qos_aura_pool_free() argument
23 if (!pfvf->qset.pool) in otx2_qos_aura_pool_free()
26 pool = &pfvf->qset.pool[pool_id]; in otx2_qos_aura_pool_free()
27 qmem_free(pfvf->dev, pool->stack); in otx2_qos_aura_pool_free()
28 qmem_free(pfvf->dev, pool->fc_addr); in otx2_qos_aura_pool_free()
33 static int otx2_qos_sq_aura_pool_init(struct otx2_nic *pfvf, int qidx) in otx2_qos_sq_aura_pool_init() argument
35 struct otx2_qset *qset = &pfvf->qset; in otx2_qos_sq_aura_pool_init()
37 struct otx2_hw *hw = &pfvf->hw; in otx2_qos_sq_aura_pool_init()
56 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); in otx2_qos_sq_aura_pool_init()
57 pool = &pfvf->qset.pool[pool_id]; in otx2_qos_sq_aura_pool_init()
60 err = otx2_aura_init(pfvf, pool_id, pool_id, num_sqbs); in otx2_qos_sq_aura_pool_init()
65 err = otx2_pool_init(pfvf, pool_id, stack_pages, in otx2_qos_sq_aura_pool_init()
71 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_qos_sq_aura_pool_init()
85 err = otx2_alloc_rbuf(pfvf, pool, &bufptr); in otx2_qos_sq_aura_pool_init()
88 pfvf->hw_ops->aura_freeptr(pfvf, pool_id, bufptr); in otx2_qos_sq_aura_pool_init()
99 pa = otx2_iova_to_phys(pfvf->iommu_domain, iova); in otx2_qos_sq_aura_pool_init()
100 dma_unmap_page_attrs(pfvf->dev, iova, hw->sqb_size, in otx2_qos_sq_aura_pool_init()
104 otx2_aura_allocptr(pfvf, pool_id); in otx2_qos_sq_aura_pool_init()
109 qmem_free(pfvf->dev, pool->stack); in otx2_qos_sq_aura_pool_init()
111 qmem_free(pfvf->dev, pool->fc_addr); in otx2_qos_sq_aura_pool_init()
112 otx2_mbox_reset(&pfvf->mbox.mbox, 0); in otx2_qos_sq_aura_pool_init()
116 static void otx2_qos_sq_free_sqbs(struct otx2_nic *pfvf, int qidx) in otx2_qos_sq_free_sqbs() argument
118 struct otx2_qset *qset = &pfvf->qset; in otx2_qos_sq_free_sqbs()
119 struct otx2_hw *hw = &pfvf->hw; in otx2_qos_sq_free_sqbs()
131 pa = otx2_iova_to_phys(pfvf->iommu_domain, iova); in otx2_qos_sq_free_sqbs()
132 dma_unmap_page_attrs(pfvf->dev, iova, hw->sqb_size, in otx2_qos_sq_free_sqbs()
141 qmem_free(pfvf->dev, sq->sqe); in otx2_qos_sq_free_sqbs()
142 qmem_free(pfvf->dev, sq->tso_hdrs); in otx2_qos_sq_free_sqbs()
145 qmem_free(pfvf->dev, sq->timestamps); in otx2_qos_sq_free_sqbs()
151 static void otx2_qos_sqb_flush(struct otx2_nic *pfvf, int qidx) in otx2_qos_sqb_flush() argument
156 ptr = (__force u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_STATUS); in otx2_qos_sqb_flush()
165 static int otx2_qos_ctx_disable(struct otx2_nic *pfvf, u16 qidx, int aura_id) in otx2_qos_ctx_disable() argument
172 if (test_bit(CN10K_LMTST, &pfvf->hw.cap_flag)) { in otx2_qos_ctx_disable()
173 cn10k_sq_aq = otx2_mbox_alloc_msg_nix_cn10k_aq_enq(&pfvf->mbox); in otx2_qos_ctx_disable()
182 sq_aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_qos_ctx_disable()
192 aura_aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_qos_ctx_disable()
194 otx2_mbox_reset(&pfvf->mbox.mbox, 0); in otx2_qos_ctx_disable()
204 pool_aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_qos_ctx_disable()
206 otx2_mbox_reset(&pfvf->mbox.mbox, 0); in otx2_qos_ctx_disable()
217 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_qos_ctx_disable()
220 int otx2_qos_get_qid(struct otx2_nic *pfvf) in otx2_qos_get_qid() argument
224 qidx = find_first_zero_bit(pfvf->qos.qos_sq_bmap, in otx2_qos_get_qid()
225 pfvf->hw.tc_tx_queues); in otx2_qos_get_qid()
227 return qidx == pfvf->hw.tc_tx_queues ? -ENOSPC : qidx; in otx2_qos_get_qid()
230 void otx2_qos_free_qid(struct otx2_nic *pfvf, int qidx) in otx2_qos_free_qid() argument
232 clear_bit(qidx, pfvf->qos.qos_sq_bmap); in otx2_qos_free_qid()
235 int otx2_qos_enable_sq(struct otx2_nic *pfvf, int qidx) in otx2_qos_enable_sq() argument
237 struct otx2_hw *hw = &pfvf->hw; in otx2_qos_enable_sq()
240 if (pfvf->flags & OTX2_FLAG_INTF_DOWN) in otx2_qos_enable_sq()
245 mutex_lock(&pfvf->mbox.lock); in otx2_qos_enable_sq()
246 err = otx2_qos_sq_aura_pool_init(pfvf, sq_idx); in otx2_qos_enable_sq()
250 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, sq_idx); in otx2_qos_enable_sq()
251 err = otx2_sq_init(pfvf, sq_idx, pool_id); in otx2_qos_enable_sq()
255 mutex_unlock(&pfvf->mbox.lock); in otx2_qos_enable_sq()
259 void otx2_qos_disable_sq(struct otx2_nic *pfvf, int qidx) in otx2_qos_disable_sq() argument
261 struct otx2_qset *qset = &pfvf->qset; in otx2_qos_disable_sq()
262 struct otx2_hw *hw = &pfvf->hw; in otx2_qos_disable_sq()
270 if (pfvf->flags & OTX2_FLAG_INTF_DOWN) in otx2_qos_disable_sq()
273 sq = &pfvf->qset.sq[sq_idx]; in otx2_qos_disable_sq()
278 sq_idx >= otx2_get_total_tx_queues(pfvf)) { in otx2_qos_disable_sq()
279 netdev_err(pfvf->netdev, "Send Queue is not a QoS queue\n"); in otx2_qos_disable_sq()
283 cq = &qset->cq[pfvf->hw.rx_queues + sq_idx]; in otx2_qos_disable_sq()
284 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, sq_idx); in otx2_qos_disable_sq()
286 otx2_qos_sqb_flush(pfvf, sq_idx); in otx2_qos_disable_sq()
287 otx2_smq_flush(pfvf, otx2_get_smq_idx(pfvf, sq_idx)); in otx2_qos_disable_sq()
288 otx2_cleanup_tx_cqes(pfvf, cq); in otx2_qos_disable_sq()
290 mutex_lock(&pfvf->mbox.lock); in otx2_qos_disable_sq()
291 otx2_qos_ctx_disable(pfvf, sq_idx, pool_id); in otx2_qos_disable_sq()
292 mutex_unlock(&pfvf->mbox.lock); in otx2_qos_disable_sq()
294 otx2_qos_sq_free_sqbs(pfvf, sq_idx); in otx2_qos_disable_sq()
295 otx2_qos_aura_pool_free(pfvf, pool_id); in otx2_qos_disable_sq()