Lines Matching refs:pfvf
20 struct otx2_nic *pfvf, int qidx) in otx2_nix_rq_op_stats() argument
25 ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_RQ_OP_OCTS); in otx2_nix_rq_op_stats()
28 ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_RQ_OP_PKTS); in otx2_nix_rq_op_stats()
33 struct otx2_nic *pfvf, int qidx) in otx2_nix_sq_op_stats() argument
38 ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_OCTS); in otx2_nix_sq_op_stats()
41 ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_PKTS); in otx2_nix_sq_op_stats()
45 void otx2_update_lmac_stats(struct otx2_nic *pfvf) in otx2_update_lmac_stats() argument
49 if (!netif_running(pfvf->netdev)) in otx2_update_lmac_stats()
52 mutex_lock(&pfvf->mbox.lock); in otx2_update_lmac_stats()
53 req = otx2_mbox_alloc_msg_cgx_stats(&pfvf->mbox); in otx2_update_lmac_stats()
55 mutex_unlock(&pfvf->mbox.lock); in otx2_update_lmac_stats()
59 otx2_sync_mbox_msg(&pfvf->mbox); in otx2_update_lmac_stats()
60 mutex_unlock(&pfvf->mbox.lock); in otx2_update_lmac_stats()
63 int otx2_update_rq_stats(struct otx2_nic *pfvf, int qidx) in otx2_update_rq_stats() argument
65 struct otx2_rcv_queue *rq = &pfvf->qset.rq[qidx]; in otx2_update_rq_stats()
67 if (!pfvf->qset.rq) in otx2_update_rq_stats()
70 otx2_nix_rq_op_stats(&rq->stats, pfvf, qidx); in otx2_update_rq_stats()
74 int otx2_update_sq_stats(struct otx2_nic *pfvf, int qidx) in otx2_update_sq_stats() argument
76 struct otx2_snd_queue *sq = &pfvf->qset.sq[qidx]; in otx2_update_sq_stats()
78 if (!pfvf->qset.sq) in otx2_update_sq_stats()
81 otx2_nix_sq_op_stats(&sq->stats, pfvf, qidx); in otx2_update_sq_stats()
85 void otx2_get_dev_stats(struct otx2_nic *pfvf) in otx2_get_dev_stats() argument
87 struct otx2_dev_stats *dev_stats = &pfvf->hw.dev_stats; in otx2_get_dev_stats()
90 otx2_read64(pfvf, NIX_LF_RX_STATX(reg)) in otx2_get_dev_stats()
92 otx2_read64(pfvf, NIX_LF_TX_STATX(reg)) in otx2_get_dev_stats()
116 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_stats64() local
119 otx2_get_dev_stats(pfvf); in otx2_get_stats64()
121 dev_stats = &pfvf->hw.dev_stats; in otx2_get_stats64()
134 static int otx2_hw_set_mac_addr(struct otx2_nic *pfvf, u8 *mac) in otx2_hw_set_mac_addr() argument
139 mutex_lock(&pfvf->mbox.lock); in otx2_hw_set_mac_addr()
140 req = otx2_mbox_alloc_msg_nix_set_mac_addr(&pfvf->mbox); in otx2_hw_set_mac_addr()
142 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_set_mac_addr()
148 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_hw_set_mac_addr()
149 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_set_mac_addr()
153 static int otx2_hw_get_mac_addr(struct otx2_nic *pfvf, in otx2_hw_get_mac_addr() argument
161 mutex_lock(&pfvf->mbox.lock); in otx2_hw_get_mac_addr()
162 req = otx2_mbox_alloc_msg_nix_get_mac_addr(&pfvf->mbox); in otx2_hw_get_mac_addr()
164 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_get_mac_addr()
168 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_hw_get_mac_addr()
170 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_get_mac_addr()
174 msghdr = otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &req->hdr); in otx2_hw_get_mac_addr()
176 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_get_mac_addr()
181 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_get_mac_addr()
188 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_set_mac_address() local
194 if (!otx2_hw_set_mac_addr(pfvf, addr->sa_data)) in otx2_set_mac_address()
203 int otx2_hw_set_mtu(struct otx2_nic *pfvf, int mtu) in otx2_hw_set_mtu() argument
208 mutex_lock(&pfvf->mbox.lock); in otx2_hw_set_mtu()
209 req = otx2_mbox_alloc_msg_nix_set_hw_frs(&pfvf->mbox); in otx2_hw_set_mtu()
211 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_set_mtu()
215 pfvf->max_frs = mtu + OTX2_ETH_HLEN; in otx2_hw_set_mtu()
216 req->maxlen = pfvf->max_frs; in otx2_hw_set_mtu()
218 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_hw_set_mtu()
219 mutex_unlock(&pfvf->mbox.lock); in otx2_hw_set_mtu()
223 int otx2_config_pause_frm(struct otx2_nic *pfvf) in otx2_config_pause_frm() argument
228 if (is_otx2_lbkvf(pfvf->pdev)) in otx2_config_pause_frm()
231 mutex_lock(&pfvf->mbox.lock); in otx2_config_pause_frm()
232 req = otx2_mbox_alloc_msg_cgx_cfg_pause_frm(&pfvf->mbox); in otx2_config_pause_frm()
238 req->rx_pause = !!(pfvf->flags & OTX2_FLAG_RX_PAUSE_ENABLED); in otx2_config_pause_frm()
239 req->tx_pause = !!(pfvf->flags & OTX2_FLAG_TX_PAUSE_ENABLED); in otx2_config_pause_frm()
242 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_config_pause_frm()
244 mutex_unlock(&pfvf->mbox.lock); in otx2_config_pause_frm()
248 int otx2_set_flowkey_cfg(struct otx2_nic *pfvf) in otx2_set_flowkey_cfg() argument
250 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_set_flowkey_cfg()
254 mutex_lock(&pfvf->mbox.lock); in otx2_set_flowkey_cfg()
255 req = otx2_mbox_alloc_msg_nix_rss_flowkey_cfg(&pfvf->mbox); in otx2_set_flowkey_cfg()
257 mutex_unlock(&pfvf->mbox.lock); in otx2_set_flowkey_cfg()
264 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_set_flowkey_cfg()
265 mutex_unlock(&pfvf->mbox.lock); in otx2_set_flowkey_cfg()
269 int otx2_set_rss_table(struct otx2_nic *pfvf) in otx2_set_rss_table() argument
271 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_set_rss_table()
272 struct mbox *mbox = &pfvf->mbox; in otx2_set_rss_table()
308 void otx2_set_rss_key(struct otx2_nic *pfvf) in otx2_set_rss_key() argument
310 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_set_rss_key()
322 otx2_write64(pfvf, NIX_LF_RX_SECRETX(5), in otx2_set_rss_key()
327 otx2_write64(pfvf, NIX_LF_RX_SECRETX(idx), *key++); in otx2_set_rss_key()
331 int otx2_rss_init(struct otx2_nic *pfvf) in otx2_rss_init() argument
333 struct otx2_rss_info *rss = &pfvf->hw.rss_info; in otx2_rss_init()
341 otx2_set_rss_key(pfvf); in otx2_rss_init()
343 if (!netif_is_rxfh_configured(pfvf->netdev)) { in otx2_rss_init()
348 pfvf->hw.rx_queues); in otx2_rss_init()
350 ret = otx2_set_rss_table(pfvf); in otx2_rss_init()
360 ret = otx2_set_flowkey_cfg(pfvf); in otx2_rss_init()
402 void otx2_setup_segmentation(struct otx2_nic *pfvf) in otx2_setup_segmentation() argument
406 struct otx2_hw *hw = &pfvf->hw; in otx2_setup_segmentation()
409 mutex_lock(&pfvf->mbox.lock); in otx2_setup_segmentation()
412 lso = otx2_mbox_alloc_msg_nix_lso_format_cfg(&pfvf->mbox); in otx2_setup_segmentation()
419 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_setup_segmentation()
424 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &lso->hdr); in otx2_setup_segmentation()
431 lso = otx2_mbox_alloc_msg_nix_lso_format_cfg(&pfvf->mbox); in otx2_setup_segmentation()
438 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_setup_segmentation()
443 otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, &lso->hdr); in otx2_setup_segmentation()
448 mutex_unlock(&pfvf->mbox.lock); in otx2_setup_segmentation()
451 mutex_unlock(&pfvf->mbox.lock); in otx2_setup_segmentation()
452 netdev_info(pfvf->netdev, in otx2_setup_segmentation()
454 pfvf->netdev->hw_features &= ~NETIF_F_GSO_UDP_L4; in otx2_setup_segmentation()
457 void otx2_config_irq_coalescing(struct otx2_nic *pfvf, int qidx) in otx2_config_irq_coalescing() argument
465 otx2_write64(pfvf, NIX_LF_CINTX_WAIT(qidx), in otx2_config_irq_coalescing()
466 ((u64)(pfvf->hw.cq_time_wait * 10) << 48) | in otx2_config_irq_coalescing()
467 ((u64)pfvf->hw.cq_qcount_wait << 32) | in otx2_config_irq_coalescing()
468 (pfvf->hw.cq_ecount_wait - 1)); in otx2_config_irq_coalescing()
471 dma_addr_t __otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool) in __otx2_alloc_rbuf() argument
480 iova = dma_map_single_attrs(pfvf->dev, buf, pool->rbsize, in __otx2_alloc_rbuf()
482 if (unlikely(dma_mapping_error(pfvf->dev, iova))) { in __otx2_alloc_rbuf()
490 static dma_addr_t otx2_alloc_rbuf(struct otx2_nic *pfvf, struct otx2_pool *pool) in otx2_alloc_rbuf() argument
495 addr = __otx2_alloc_rbuf(pfvf, pool); in otx2_alloc_rbuf()
502 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_tx_timeout() local
504 schedule_work(&pfvf->reset_task); in otx2_tx_timeout()
510 struct otx2_nic *pfvf = netdev_priv(netdev); in otx2_get_mac_from_af() local
513 err = otx2_hw_get_mac_addr(pfvf, netdev); in otx2_get_mac_from_af()
515 dev_warn(pfvf->dev, "Failed to read mac from hardware\n"); in otx2_get_mac_from_af()
523 static int otx2_get_link(struct otx2_nic *pfvf) in otx2_get_link() argument
529 if (pfvf->hw.tx_chan_base >= CGX_CHAN_BASE) { in otx2_get_link()
530 map = pfvf->hw.tx_chan_base & 0x7FF; in otx2_get_link()
534 if (pfvf->hw.tx_chan_base < SDP_CHAN_BASE) in otx2_get_link()
540 int otx2_txschq_config(struct otx2_nic *pfvf, int lvl) in otx2_txschq_config() argument
542 struct otx2_hw *hw = &pfvf->hw; in otx2_txschq_config()
546 req = otx2_mbox_alloc_msg_nix_txschq_cfg(&pfvf->mbox); in otx2_txschq_config()
596 otx2_get_link(pfvf)); in otx2_txschq_config()
618 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_txschq_config()
621 int otx2_txsch_alloc(struct otx2_nic *pfvf) in otx2_txsch_alloc() argument
627 req = otx2_mbox_alloc_msg_nix_txsch_alloc(&pfvf->mbox); in otx2_txsch_alloc()
635 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_txsch_alloc()
638 int otx2_txschq_stop(struct otx2_nic *pfvf) in otx2_txschq_stop() argument
643 mutex_lock(&pfvf->mbox.lock); in otx2_txschq_stop()
645 free_req = otx2_mbox_alloc_msg_nix_txsch_free(&pfvf->mbox); in otx2_txschq_stop()
647 mutex_unlock(&pfvf->mbox.lock); in otx2_txschq_stop()
652 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_txschq_stop()
653 mutex_unlock(&pfvf->mbox.lock); in otx2_txschq_stop()
658 pfvf->hw.txschq_list[lvl][schq] = 0; in otx2_txschq_stop()
663 void otx2_sqb_flush(struct otx2_nic *pfvf) in otx2_sqb_flush() argument
669 ptr = (u64 *)otx2_get_regaddr(pfvf, NIX_LF_SQ_OP_STATUS); in otx2_sqb_flush()
670 for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) { in otx2_sqb_flush()
703 static int otx2_rq_init(struct otx2_nic *pfvf, u16 qidx, u16 lpb_aura) in otx2_rq_init() argument
705 struct otx2_qset *qset = &pfvf->qset; in otx2_rq_init()
709 aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_rq_init()
717 aq->rq.lpb_sizem1 = (DMA_BUFFER_LEN(pfvf->rbsize) / 8) - 1; in otx2_rq_init()
723 aq->rq.xqe_pass = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); in otx2_rq_init()
724 aq->rq.xqe_drop = RQ_DROP_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); in otx2_rq_init()
733 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_rq_init()
736 static int otx2_sq_init(struct otx2_nic *pfvf, u16 qidx, u16 sqb_aura) in otx2_sq_init() argument
738 struct otx2_qset *qset = &pfvf->qset; in otx2_sq_init()
744 pool = &pfvf->qset.pool[sqb_aura]; in otx2_sq_init()
749 err = qmem_alloc(pfvf->dev, &sq->sqe, 1, sq->sqe_size); in otx2_sq_init()
753 err = qmem_alloc(pfvf->dev, &sq->tso_hdrs, qset->sqe_cnt, in otx2_sq_init()
763 if (pfvf->ptp) { in otx2_sq_init()
764 err = qmem_alloc(pfvf->dev, &sq->timestamps, qset->sqe_cnt, in otx2_sq_init()
771 sq->sqe_per_sqb = (pfvf->hw.sqb_size / sq->sqe_size) - 1; in otx2_sq_init()
777 sq->lmt_addr = (__force u64 *)(pfvf->reg_base + LMT_LF_LMTLINEX(qidx)); in otx2_sq_init()
778 sq->io_addr = (__force u64)otx2_get_regaddr(pfvf, NIX_LF_OP_SENDX(0)); in otx2_sq_init()
784 aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_sq_init()
788 aq->sq.cq = pfvf->hw.rx_queues + qidx; in otx2_sq_init()
793 aq->sq.smq = pfvf->hw.txschq_list[NIX_TXSCH_LVL_SMQ][0]; in otx2_sq_init()
795 aq->sq.default_chan = pfvf->hw.tx_chan_base; in otx2_sq_init()
810 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_sq_init()
813 static int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx) in otx2_cq_init() argument
815 struct otx2_qset *qset = &pfvf->qset; in otx2_cq_init()
822 if (qidx < pfvf->hw.rx_queues) { in otx2_cq_init()
828 cq->cint_idx = qidx - pfvf->hw.rx_queues; in otx2_cq_init()
831 cq->cqe_size = pfvf->qset.xqe_size; in otx2_cq_init()
834 err = qmem_alloc(pfvf->dev, &cq->cqe, cq->cqe_cnt, cq->cqe_size); in otx2_cq_init()
844 (pfvf->hw.rqpool_cnt != pfvf->hw.rx_queues)) ? 0 : qidx; in otx2_cq_init()
849 aq = otx2_mbox_alloc_msg_nix_aq_enq(&pfvf->mbox); in otx2_cq_init()
862 if (qidx < pfvf->hw.rx_queues) { in otx2_cq_init()
863 aq->cq.drop = RQ_DROP_LVL_CQ(pfvf->hw.rq_skid, cq->cqe_cnt); in otx2_cq_init()
868 aq->cq.bpid = pfvf->bpid[0]; in otx2_cq_init()
871 aq->cq.bp = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); in otx2_cq_init()
879 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_cq_init()
888 struct otx2_nic *pfvf; in otx2_pool_refill_task() local
892 pfvf = wrk->pf; in otx2_pool_refill_task()
893 qidx = wrk - pfvf->refill_wrk; in otx2_pool_refill_task()
894 cq = &pfvf->qset.cq[qidx]; in otx2_pool_refill_task()
899 bufptr = otx2_alloc_rbuf(pfvf, rbpool); in otx2_pool_refill_task()
915 otx2_aura_freeptr(pfvf, qidx, bufptr + OTX2_HEAD_ROOM); in otx2_pool_refill_task()
921 int otx2_config_nix_queues(struct otx2_nic *pfvf) in otx2_config_nix_queues() argument
926 for (qidx = 0; qidx < pfvf->hw.rx_queues; qidx++) { in otx2_config_nix_queues()
927 u16 lpb_aura = otx2_get_pool_idx(pfvf, AURA_NIX_RQ, qidx); in otx2_config_nix_queues()
929 err = otx2_rq_init(pfvf, qidx, lpb_aura); in otx2_config_nix_queues()
935 for (qidx = 0; qidx < pfvf->hw.tx_queues; qidx++) { in otx2_config_nix_queues()
936 u16 sqb_aura = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); in otx2_config_nix_queues()
938 err = otx2_sq_init(pfvf, qidx, sqb_aura); in otx2_config_nix_queues()
944 for (qidx = 0; qidx < pfvf->qset.cq_cnt; qidx++) { in otx2_config_nix_queues()
945 err = otx2_cq_init(pfvf, qidx); in otx2_config_nix_queues()
951 pfvf->refill_wrk = devm_kcalloc(pfvf->dev, pfvf->qset.cq_cnt, in otx2_config_nix_queues()
953 if (!pfvf->refill_wrk) in otx2_config_nix_queues()
956 for (qidx = 0; qidx < pfvf->qset.cq_cnt; qidx++) { in otx2_config_nix_queues()
957 pfvf->refill_wrk[qidx].pf = pfvf; in otx2_config_nix_queues()
958 INIT_DELAYED_WORK(&pfvf->refill_wrk[qidx].pool_refill_work, in otx2_config_nix_queues()
964 int otx2_config_nix(struct otx2_nic *pfvf) in otx2_config_nix() argument
970 pfvf->qset.xqe_size = NIX_XQESZ_W16 ? 128 : 512; in otx2_config_nix()
973 nixlf = otx2_mbox_alloc_msg_nix_lf_alloc(&pfvf->mbox); in otx2_config_nix()
978 nixlf->rq_cnt = pfvf->hw.rx_queues; in otx2_config_nix()
979 nixlf->sq_cnt = pfvf->hw.tx_queues; in otx2_config_nix()
980 nixlf->cq_cnt = pfvf->qset.cq_cnt; in otx2_config_nix()
994 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_config_nix()
998 rsp = (struct nix_lf_alloc_rsp *)otx2_mbox_get_rsp(&pfvf->mbox.mbox, 0, in otx2_config_nix()
1009 void otx2_sq_free_sqbs(struct otx2_nic *pfvf) in otx2_sq_free_sqbs() argument
1011 struct otx2_qset *qset = &pfvf->qset; in otx2_sq_free_sqbs()
1012 struct otx2_hw *hw = &pfvf->hw; in otx2_sq_free_sqbs()
1025 pa = otx2_iova_to_phys(pfvf->iommu_domain, iova); in otx2_sq_free_sqbs()
1026 dma_unmap_page_attrs(pfvf->dev, iova, hw->sqb_size, in otx2_sq_free_sqbs()
1035 void otx2_free_aura_ptr(struct otx2_nic *pfvf, int type) in otx2_free_aura_ptr() argument
1041 pool_start = otx2_get_pool_idx(pfvf, type, 0); in otx2_free_aura_ptr()
1042 pool_end = pool_start + pfvf->hw.sqpool_cnt; in otx2_free_aura_ptr()
1043 size = pfvf->hw.sqb_size; in otx2_free_aura_ptr()
1046 pool_start = otx2_get_pool_idx(pfvf, type, 0); in otx2_free_aura_ptr()
1047 pool_end = pfvf->hw.rqpool_cnt; in otx2_free_aura_ptr()
1048 size = pfvf->rbsize; in otx2_free_aura_ptr()
1053 iova = otx2_aura_allocptr(pfvf, pool_id); in otx2_free_aura_ptr()
1058 pa = otx2_iova_to_phys(pfvf->iommu_domain, iova); in otx2_free_aura_ptr()
1059 dma_unmap_page_attrs(pfvf->dev, iova, size, in otx2_free_aura_ptr()
1063 iova = otx2_aura_allocptr(pfvf, pool_id); in otx2_free_aura_ptr()
1068 void otx2_aura_pool_free(struct otx2_nic *pfvf) in otx2_aura_pool_free() argument
1073 if (!pfvf->qset.pool) in otx2_aura_pool_free()
1076 for (pool_id = 0; pool_id < pfvf->hw.pool_cnt; pool_id++) { in otx2_aura_pool_free()
1077 pool = &pfvf->qset.pool[pool_id]; in otx2_aura_pool_free()
1078 qmem_free(pfvf->dev, pool->stack); in otx2_aura_pool_free()
1079 qmem_free(pfvf->dev, pool->fc_addr); in otx2_aura_pool_free()
1081 devm_kfree(pfvf->dev, pfvf->qset.pool); in otx2_aura_pool_free()
1082 pfvf->qset.pool = NULL; in otx2_aura_pool_free()
1085 static int otx2_aura_init(struct otx2_nic *pfvf, int aura_id, in otx2_aura_init() argument
1092 pool = &pfvf->qset.pool[pool_id]; in otx2_aura_init()
1098 err = qmem_alloc(pfvf->dev, &pool->fc_addr, 1, OTX2_ALIGN); in otx2_aura_init()
1104 aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_aura_init()
1107 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_aura_init()
1110 aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_aura_init()
1129 if (aura_id < pfvf->hw.rqpool_cnt) { in otx2_aura_init()
1131 aq->aura.nix0_bpid = pfvf->bpid[0]; in otx2_aura_init()
1143 static int otx2_pool_init(struct otx2_nic *pfvf, u16 pool_id, in otx2_pool_init() argument
1150 pool = &pfvf->qset.pool[pool_id]; in otx2_pool_init()
1152 err = qmem_alloc(pfvf->dev, &pool->stack, in otx2_pool_init()
1153 stack_pages, pfvf->hw.stack_pg_bytes); in otx2_pool_init()
1160 aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_pool_init()
1163 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_pool_init()
1165 qmem_free(pfvf->dev, pool->stack); in otx2_pool_init()
1168 aq = otx2_mbox_alloc_msg_npa_aq_enq(&pfvf->mbox); in otx2_pool_init()
1170 qmem_free(pfvf->dev, pool->stack); in otx2_pool_init()
1192 int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) in otx2_sq_aura_pool_init() argument
1195 struct otx2_qset *qset = &pfvf->qset; in otx2_sq_aura_pool_init()
1196 struct otx2_hw *hw = &pfvf->hw; in otx2_sq_aura_pool_init()
1215 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); in otx2_sq_aura_pool_init()
1217 err = otx2_aura_init(pfvf, pool_id, pool_id, num_sqbs); in otx2_sq_aura_pool_init()
1222 err = otx2_pool_init(pfvf, pool_id, stack_pages, in otx2_sq_aura_pool_init()
1229 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_sq_aura_pool_init()
1235 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_SQ, qidx); in otx2_sq_aura_pool_init()
1236 pool = &pfvf->qset.pool[pool_id]; in otx2_sq_aura_pool_init()
1245 bufptr = otx2_alloc_rbuf(pfvf, pool); in otx2_sq_aura_pool_init()
1248 otx2_aura_freeptr(pfvf, pool_id, bufptr); in otx2_sq_aura_pool_init()
1255 otx2_mbox_reset(&pfvf->mbox.mbox, 0); in otx2_sq_aura_pool_init()
1256 otx2_aura_pool_free(pfvf); in otx2_sq_aura_pool_init()
1260 int otx2_rq_aura_pool_init(struct otx2_nic *pfvf) in otx2_rq_aura_pool_init() argument
1262 struct otx2_hw *hw = &pfvf->hw; in otx2_rq_aura_pool_init()
1268 num_ptrs = pfvf->qset.rqe_cnt; in otx2_rq_aura_pool_init()
1274 pool_id = otx2_get_pool_idx(pfvf, AURA_NIX_RQ, rq); in otx2_rq_aura_pool_init()
1276 err = otx2_aura_init(pfvf, pool_id, pool_id, num_ptrs); in otx2_rq_aura_pool_init()
1281 err = otx2_pool_init(pfvf, pool_id, stack_pages, in otx2_rq_aura_pool_init()
1282 num_ptrs, pfvf->rbsize); in otx2_rq_aura_pool_init()
1288 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_rq_aura_pool_init()
1294 pool = &pfvf->qset.pool[pool_id]; in otx2_rq_aura_pool_init()
1296 bufptr = otx2_alloc_rbuf(pfvf, pool); in otx2_rq_aura_pool_init()
1299 otx2_aura_freeptr(pfvf, pool_id, in otx2_rq_aura_pool_init()
1306 otx2_mbox_reset(&pfvf->mbox.mbox, 0); in otx2_rq_aura_pool_init()
1307 otx2_aura_pool_free(pfvf); in otx2_rq_aura_pool_init()
1311 int otx2_config_npa(struct otx2_nic *pfvf) in otx2_config_npa() argument
1313 struct otx2_qset *qset = &pfvf->qset; in otx2_config_npa()
1315 struct otx2_hw *hw = &pfvf->hw; in otx2_config_npa()
1325 qset->pool = devm_kcalloc(pfvf->dev, hw->pool_cnt, in otx2_config_npa()
1331 npalf = otx2_mbox_alloc_msg_npa_lf_alloc(&pfvf->mbox); in otx2_config_npa()
1340 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_config_npa()
1364 int otx2_attach_npa_nix(struct otx2_nic *pfvf) in otx2_attach_npa_nix() argument
1370 mutex_lock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1372 attach = otx2_mbox_alloc_msg_attach_resources(&pfvf->mbox); in otx2_attach_npa_nix()
1374 mutex_unlock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1382 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_attach_npa_nix()
1384 mutex_unlock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1388 pfvf->nix_blkaddr = BLKADDR_NIX0; in otx2_attach_npa_nix()
1393 if (otx2_read64(pfvf, RVU_PF_BLOCK_ADDRX_DISC(BLKADDR_NIX1)) & 0x1FFULL) in otx2_attach_npa_nix()
1394 pfvf->nix_blkaddr = BLKADDR_NIX1; in otx2_attach_npa_nix()
1397 msix = otx2_mbox_alloc_msg_msix_offset(&pfvf->mbox); in otx2_attach_npa_nix()
1399 mutex_unlock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1403 err = otx2_sync_mbox_msg(&pfvf->mbox); in otx2_attach_npa_nix()
1405 mutex_unlock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1408 mutex_unlock(&pfvf->mbox.lock); in otx2_attach_npa_nix()
1410 if (pfvf->hw.npa_msixoff == MSIX_VECTOR_INVALID || in otx2_attach_npa_nix()
1411 pfvf->hw.nix_msixoff == MSIX_VECTOR_INVALID) { in otx2_attach_npa_nix()
1412 dev_err(pfvf->dev, in otx2_attach_npa_nix()
1440 dev_err(mbox->pfvf->dev, "%s failed to disable context\n", in otx2_ctx_disable()
1446 int otx2_nix_config_bp(struct otx2_nic *pfvf, bool enable) in otx2_nix_config_bp() argument
1451 req = otx2_mbox_alloc_msg_nix_bp_enable(&pfvf->mbox); in otx2_nix_config_bp()
1453 req = otx2_mbox_alloc_msg_nix_bp_disable(&pfvf->mbox); in otx2_nix_config_bp()
1462 return otx2_sync_mbox_msg(&pfvf->mbox); in otx2_nix_config_bp()
1466 void mbox_handler_cgx_stats(struct otx2_nic *pfvf, in mbox_handler_cgx_stats() argument
1472 pfvf->hw.cgx_rx_stats[id] = rsp->rx_stats[id]; in mbox_handler_cgx_stats()
1474 pfvf->hw.cgx_tx_stats[id] = rsp->tx_stats[id]; in mbox_handler_cgx_stats()
1490 void mbox_handler_npa_lf_alloc(struct otx2_nic *pfvf, in mbox_handler_npa_lf_alloc() argument
1493 pfvf->hw.stack_pg_ptrs = rsp->stack_pg_ptrs; in mbox_handler_npa_lf_alloc()
1494 pfvf->hw.stack_pg_bytes = rsp->stack_pg_bytes; in mbox_handler_npa_lf_alloc()
1498 void mbox_handler_nix_lf_alloc(struct otx2_nic *pfvf, in mbox_handler_nix_lf_alloc() argument
1501 pfvf->hw.sqb_size = rsp->sqb_size; in mbox_handler_nix_lf_alloc()
1502 pfvf->hw.rx_chan_base = rsp->rx_chan_base; in mbox_handler_nix_lf_alloc()
1503 pfvf->hw.tx_chan_base = rsp->tx_chan_base; in mbox_handler_nix_lf_alloc()
1504 pfvf->hw.lso_tsov4_idx = rsp->lso_tsov4_idx; in mbox_handler_nix_lf_alloc()
1505 pfvf->hw.lso_tsov6_idx = rsp->lso_tsov6_idx; in mbox_handler_nix_lf_alloc()
1509 void mbox_handler_msix_offset(struct otx2_nic *pfvf, in mbox_handler_msix_offset() argument
1512 pfvf->hw.npa_msixoff = rsp->npa_msixoff; in mbox_handler_msix_offset()
1513 pfvf->hw.nix_msixoff = rsp->nix_msixoff; in mbox_handler_msix_offset()
1517 void mbox_handler_nix_bp_enable(struct otx2_nic *pfvf, in mbox_handler_nix_bp_enable() argument
1524 pfvf->bpid[chan_id] = rsp->chan_bpid[chan] & 0x3FF; in mbox_handler_nix_bp_enable()
1529 void otx2_free_cints(struct otx2_nic *pfvf, int n) in otx2_free_cints() argument
1531 struct otx2_qset *qset = &pfvf->qset; in otx2_free_cints()
1532 struct otx2_hw *hw = &pfvf->hw; in otx2_free_cints()
1538 int vector = pci_irq_vector(pfvf->pdev, irq); in otx2_free_cints()
1546 void otx2_set_cints_affinity(struct otx2_nic *pfvf) in otx2_set_cints_affinity() argument
1548 struct otx2_hw *hw = &pfvf->hw; in otx2_set_cints_affinity()
1555 for (cint = 0; cint < pfvf->hw.cint_cnt; cint++, vec++) { in otx2_set_cints_affinity()
1561 irq = pci_irq_vector(pfvf->pdev, vec); in otx2_set_cints_affinity()
1572 otx2_mbox_up_handler_ ## _fn_name(struct otx2_nic *pfvf, \