Lines Matching refs:nix

58 int npc_lf_setup(struct nix *nix)  in npc_lf_setup()  argument
62 err = npc_lf_admin_setup(nix); in npc_lf_setup()
104 int npa_lf_setup(struct nix *nix) in npa_lf_setup() argument
106 struct rvu_pf *rvu = dev_get_priv(nix->dev); in npa_lf_setup()
107 struct nix_af *nix_af = nix->nix_af; in npa_lf_setup()
127 nix->npa = npa; in npa_lf_setup()
175 err = npa_lf_admin_setup(npa, nix->lf, (dma_addr_t)npa->aura_ctx); in npa_lf_setup()
178 __func__, nix->lf); in npa_lf_setup()
196 err = npa_attach_aura(nix_af, nix->lf, aura, idx); in npa_lf_setup()
214 err = npa_attach_pool(nix_af, nix->lf, pool, idx); in npa_lf_setup()
241 int npa_lf_shutdown(struct nix *nix) in npa_lf_shutdown() argument
243 struct npa *npa = nix->npa; in npa_lf_shutdown()
247 err = npa_lf_admin_shutdown(nix->nix_af, nix->lf, NPA_POOL_COUNT); in npa_lf_shutdown()
268 int nix_lf_setup(struct nix *nix) in nix_lf_setup() argument
270 struct nix_af *nix_af = nix->nix_af; in nix_lf_setup()
275 nix->rq_ctx_base = nix_memalloc(nix->rq_cnt, nix_af->rq_ctx_sz, in nix_lf_setup()
277 if (!nix->rq_ctx_base) in nix_lf_setup()
279 memset(nix->rq_ctx_base, 0, nix_af->rq_ctx_sz); in nix_lf_setup()
282 nix->sq_ctx_base = nix_memalloc(nix->sq_cnt, nix_af->sq_ctx_sz, in nix_lf_setup()
284 if (!nix->sq_ctx_base) in nix_lf_setup()
286 memset(nix->sq_ctx_base, 0, nix_af->sq_ctx_sz); in nix_lf_setup()
289 nix->cq_ctx_base = nix_memalloc(nix->cq_cnt, nix_af->cq_ctx_sz, in nix_lf_setup()
291 if (!nix->cq_ctx_base) in nix_lf_setup()
293 memset(nix->cq_ctx_base, 0, nix_af->cq_ctx_sz * NIX_CQ_COUNT); in nix_lf_setup()
296 err = qmem_alloc(&nix->cq[idx], CQ_ENTRIES, CQ_ENTRY_SIZE); in nix_lf_setup()
302 nix->qint_base = nix_memalloc(nix_af->qints, nix_af->qint_ctx_sz, in nix_lf_setup()
304 if (!nix->qint_base) in nix_lf_setup()
307 nix->cint_base = nix_memalloc(nix_af->cints, nix_af->cint_ctx_sz, in nix_lf_setup()
309 if (!nix->cint_base) in nix_lf_setup()
312 nix->rss_base = nix_memalloc(nix->rss_grps, nix_af->rsse_ctx_sz, in nix_lf_setup()
314 if (!nix->rss_base) in nix_lf_setup()
317 err = nix_lf_admin_setup(nix); in nix_lf_setup()
326 if (nix->rq_ctx_base) in nix_lf_setup()
327 free(nix->rq_ctx_base); in nix_lf_setup()
328 nix->rq_ctx_base = NULL; in nix_lf_setup()
329 if (nix->rq_ctx_base) in nix_lf_setup()
330 free(nix->rq_ctx_base); in nix_lf_setup()
331 nix->rq_ctx_base = NULL; in nix_lf_setup()
332 if (nix->sq_ctx_base) in nix_lf_setup()
333 free(nix->sq_ctx_base); in nix_lf_setup()
334 nix->sq_ctx_base = NULL; in nix_lf_setup()
335 if (nix->cq_ctx_base) in nix_lf_setup()
336 free(nix->cq_ctx_base); in nix_lf_setup()
337 nix->cq_ctx_base = NULL; in nix_lf_setup()
340 qmem_free(&nix->cq[idx]); in nix_lf_setup()
345 int nix_lf_shutdown(struct nix *nix) in nix_lf_shutdown() argument
347 struct nix_af *nix_af = nix->nix_af; in nix_lf_shutdown()
351 err = nix_lf_admin_shutdown(nix_af, nix->lf, nix->cq_cnt, in nix_lf_shutdown()
352 nix->rq_cnt, nix->sq_cnt); in nix_lf_shutdown()
358 if (nix->rq_ctx_base) in nix_lf_shutdown()
359 free(nix->rq_ctx_base); in nix_lf_shutdown()
360 nix->rq_ctx_base = NULL; in nix_lf_shutdown()
361 if (nix->rq_ctx_base) in nix_lf_shutdown()
362 free(nix->rq_ctx_base); in nix_lf_shutdown()
363 nix->rq_ctx_base = NULL; in nix_lf_shutdown()
364 if (nix->sq_ctx_base) in nix_lf_shutdown()
365 free(nix->sq_ctx_base); in nix_lf_shutdown()
366 nix->sq_ctx_base = NULL; in nix_lf_shutdown()
367 if (nix->cq_ctx_base) in nix_lf_shutdown()
368 free(nix->cq_ctx_base); in nix_lf_shutdown()
369 nix->cq_ctx_base = NULL; in nix_lf_shutdown()
372 qmem_free(&nix->cq[index]); in nix_lf_shutdown()
374 debug("%s: nix lf %d reset --\n", __func__, nix->lf); in nix_lf_shutdown()
378 struct nix *nix_lf_alloc(struct udevice *dev) in nix_lf_alloc()
381 struct nix *nix; in nix_lf_alloc() local
389 nix = (struct nix *)calloc(1, sizeof(*nix)); in nix_lf_alloc()
390 if (!nix) { in nix_lf_alloc()
394 nix->nix_af = rvu_af->nix_af; in nix_lf_alloc()
398 nix->nix_base = rvu->pf_base + block_addr.u; in nix_lf_alloc()
401 nix->npc_base = rvu->pf_base + block_addr.u; in nix_lf_alloc()
404 nix->lmt_base = rvu->pf_base + block_addr.u; in nix_lf_alloc()
408 nix->pf_func = pf_func.u; in nix_lf_alloc()
409 nix->lf = rvu->nix_lfid; in nix_lf_alloc()
410 nix->pf = rvu->pfid; in nix_lf_alloc()
411 nix->dev = dev; in nix_lf_alloc()
412 nix->sq_cnt = 1; in nix_lf_alloc()
413 nix->rq_cnt = 1; in nix_lf_alloc()
414 nix->rss_grps = 1; in nix_lf_alloc()
415 nix->cq_cnt = 2; in nix_lf_alloc()
416 nix->xqe_sz = NIX_CQE_SIZE_W16; in nix_lf_alloc()
418 nix->lmac = nix_get_cgx_lmac(nix->pf); in nix_lf_alloc()
419 if (!nix->lmac) { in nix_lf_alloc()
421 __func__, nix->pf); in nix_lf_alloc()
422 free(nix); in nix_lf_alloc()
425 nix->lmac->link_num = in nix_lf_alloc()
426 NIX_LINK_E_CGXX_LMACX(nix->lmac->cgx->cgx_id, in nix_lf_alloc()
427 nix->lmac->lmac_id); in nix_lf_alloc()
428 nix->lmac->chan_num = in nix_lf_alloc()
429 NIX_CHAN_E_CGXX_LMACX_CHX(nix->lmac->cgx->cgx_id, in nix_lf_alloc()
430 nix->lmac->lmac_id, 0); in nix_lf_alloc()
432 nix->lmac->pknd = nix->lmac->link_num; in nix_lf_alloc()
434 cgx_lmac_set_pkind(nix->lmac, nix->lmac->lmac_id, nix->lmac->pknd); in nix_lf_alloc()
436 nix->lmac->cgx->cgx_id, nix->lmac->lmac_id); in nix_lf_alloc()
438 nix->lmac->link_num, nix->lmac->chan_num, nix->lmac->pknd); in nix_lf_alloc()
440 err = npa_lf_setup(nix); in nix_lf_alloc()
444 err = npc_lf_setup(nix); in nix_lf_alloc()
448 err = nix_lf_setup(nix); in nix_lf_alloc()
452 return nix; in nix_lf_alloc()
464 u64 nix_cq_op_status(struct nix *nix, u64 cq_id) in nix_cq_op_status() argument
467 s64 *reg = nix->nix_base + NIXX_LF_CQ_OP_STATUS(); in nix_cq_op_status()
474 static inline void nix_write_lmt(struct nix *nix, void *buffer, in nix_write_lmt() argument
479 u64 *lmt_ptr = lmt_store_ptr(nix); in nix_write_lmt()
482 debug("%s lmt_ptr %p %p\n", __func__, nix->lmt_base, lmt_ptr); in nix_write_lmt()
490 void nix_cqe_tx_pkt_handler(struct nix *nix, void *cqe) in nix_cqe_tx_pkt_handler() argument
501 nix_pf_reg_write(nix, NIXX_LF_CQ_OP_DOOR(), in nix_cqe_tx_pkt_handler()
508 struct nix *nix = rvu->nix; in nix_lf_flush_tx() local
511 void *cq_tx_base = nix->cq[NIX_CQ_TX].base; in nix_lf_flush_tx()
515 op_status.u = nix_cq_op_status(nix, NIX_CQ_TX); in nix_lf_flush_tx()
518 head &= (nix->cq[NIX_CQ_TX].qsize - 1); in nix_lf_flush_tx()
519 tail &= (nix->cq[NIX_CQ_TX].qsize - 1); in nix_lf_flush_tx()
523 cqe = cq_tx_base + head * nix->cq[NIX_CQ_TX].entry_sz; in nix_lf_flush_tx()
524 nix_cqe_tx_pkt_handler(nix, cqe); in nix_lf_flush_tx()
525 op_status.u = nix_cq_op_status(nix, NIX_CQ_TX); in nix_lf_flush_tx()
528 head &= (nix->cq[NIX_CQ_TX].qsize - 1); in nix_lf_flush_tx()
529 tail &= (nix->cq[NIX_CQ_TX].qsize - 1); in nix_lf_flush_tx()
537 struct nix *nix = rvu->nix; in nix_lf_xmit() local
546 packet = (void *)npa_aura_op_alloc(nix->npa, NPA_POOL_TX); in nix_lf_xmit()
579 nix_write_lmt(nix, &tx_dr, (dr_sz - 1) * 2); in nix_lf_xmit()
581 result = lmt_submit((u64)(nix->nix_base + in nix_lf_xmit()
593 struct nix *nix = rvu->nix; in nix_lf_flush_rx() local
595 void *cq_rx_base = nix->cq[NIX_CQ_RX].base; in nix_lf_flush_rx()
599 u32 rx_cqe_sz = nix->cq[NIX_CQ_RX].entry_sz; in nix_lf_flush_rx()
603 op_status.u = nix_cq_op_status(nix, NIX_CQ_RX); in nix_lf_flush_rx()
606 head &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_flush_rx()
607 tail &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_flush_rx()
620 st128(nix->npa->npa_base + NPA_LF_AURA_OP_FREE0(), in nix_lf_flush_rx()
624 nix_pf_reg_write(nix, NIXX_LF_CQ_OP_DOOR(), in nix_lf_flush_rx()
627 op_status.u = nix_cq_op_status(nix, NIX_CQ_RX); in nix_lf_flush_rx()
630 head &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_flush_rx()
631 tail &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_flush_rx()
639 struct nix *nix = rvu->nix; in nix_lf_free_pkt() local
643 st128(nix->npa->npa_base + NPA_LF_AURA_OP_FREE0(), (u64)pkt, in nix_lf_free_pkt()
645 nix_pf_reg_write(nix, NIXX_LF_CQ_OP_DOOR(), in nix_lf_free_pkt()
655 struct nix *nix = rvu->nix; in nix_lf_recv() local
657 void *cq_rx_base = nix->cq[NIX_CQ_RX].base; in nix_lf_recv()
666 op_status.u = nix_cq_op_status(nix, NIX_CQ_RX); in nix_lf_recv()
669 head &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_recv()
670 tail &= (nix->cq[NIX_CQ_RX].qsize - 1); in nix_lf_recv()
676 nix->cq[NIX_CQ_RX].entry_sz); in nix_lf_recv()
677 cqe = cq_rx_base + head * nix->cq[NIX_CQ_RX].entry_sz; in nix_lf_recv()
729 struct nix *nix = rvu->nix; in nix_lf_setup_mac() local
737 if (memcmp(nix->lmac->mac_addr, pdata->enetaddr, ARP_HLEN)) { in nix_lf_setup_mac()
738 memcpy(nix->lmac->mac_addr, pdata->enetaddr, 6); in nix_lf_setup_mac()
741 cgx_lmac_mac_filter_setup(nix->lmac); in nix_lf_setup_mac()
746 debug("%s: lMAC %pM\n", __func__, nix->lmac->mac_addr); in nix_lf_setup_mac()
756 struct nix *nix = rvu->nix; in nix_lf_halt() local
758 cgx_lmac_rx_tx_enable(nix->lmac, nix->lmac->lmac_id, false); in nix_lf_halt()
770 struct nix *nix = rvu->nix; in nix_lf_init() local
771 struct lmac *lmac = nix->lmac; in nix_lf_init()
815 struct nix *nix = rvu->nix; in nix_get_cgx_lmac_id() local
816 struct lmac *lmac = nix->lmac; in nix_get_cgx_lmac_id()
825 struct nix *nix = rvu->nix; in nix_print_mac_info() local
826 struct lmac *lmac = nix->lmac; in nix_print_mac_info()