• Home
  • Raw
  • Download

Lines Matching refs:rvu

20 static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req,
71 bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc) in is_nixlf_attached() argument
73 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in is_nixlf_attached()
76 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in is_nixlf_attached()
82 int rvu_get_nixlf_count(struct rvu *rvu) in rvu_get_nixlf_count() argument
87 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0); in rvu_get_nixlf_count()
90 block = &rvu->hw->block[blkaddr]; in rvu_get_nixlf_count()
94 int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr) in nix_get_nixlf() argument
96 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in nix_get_nixlf()
97 struct rvu_hwinfo *hw = rvu->hw; in nix_get_nixlf()
100 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in nix_get_nixlf()
104 *nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0); in nix_get_nixlf()
141 static void nix_rx_sync(struct rvu *rvu, int blkaddr) in nix_rx_sync() argument
146 rvu_write64(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0)); in nix_rx_sync()
147 err = rvu_poll_reg(rvu, blkaddr, NIX_AF_RX_SW_SYNC, BIT_ULL(0), true); in nix_rx_sync()
149 dev_err(rvu->dev, "NIX RX software sync failed\n"); in nix_rx_sync()
152 static bool is_valid_txschq(struct rvu *rvu, int blkaddr, in is_valid_txschq() argument
155 struct rvu_hwinfo *hw = rvu->hw; in is_valid_txschq()
160 nix_hw = get_nix_hw(rvu->hw, blkaddr); in is_valid_txschq()
169 mutex_lock(&rvu->rsrc_lock); in is_valid_txschq()
171 mutex_unlock(&rvu->rsrc_lock); in is_valid_txschq()
187 static int nix_interface_init(struct rvu *rvu, u16 pcifunc, int type, int nixlf) in nix_interface_init() argument
189 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in nix_interface_init()
195 if (!is_pf_cgxmapped(rvu, pf) && type != NIX_INTF_TYPE_LBK) in nix_interface_init()
200 pfvf->cgx_lmac = rvu->pf2cgxlmac_map[pf]; in nix_interface_init()
203 pkind = rvu_npc_get_pkind(rvu, pf); in nix_interface_init()
205 dev_err(rvu->dev, in nix_interface_init()
213 cgx_set_pkind(rvu_cgx_pdata(cgx_id, rvu), lmac_id, pkind); in nix_interface_init()
214 rvu_npc_set_pkind(rvu, pkind, pfvf); in nix_interface_init()
218 cgx_lmac_set_pause_frm(rvu_cgx_pdata(cgx_id, rvu), in nix_interface_init()
231 if (rvu->hw->lbk_links > 1) in nix_interface_init()
244 rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf, in nix_interface_init()
252 rvu_npc_install_ucast_entry(rvu, pcifunc, nixlf, in nix_interface_init()
256 err = nix_update_bcast_mce_list(rvu, pcifunc, true); in nix_interface_init()
258 dev_err(rvu->dev, in nix_interface_init()
264 rvu_npc_install_bcast_match_entry(rvu, pcifunc, in nix_interface_init()
272 static void nix_interface_deinit(struct rvu *rvu, u16 pcifunc, u8 nixlf) in nix_interface_deinit() argument
274 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in nix_interface_deinit()
282 err = nix_update_bcast_mce_list(rvu, pcifunc, false); in nix_interface_deinit()
284 dev_err(rvu->dev, in nix_interface_deinit()
290 rvu_npc_disable_mcam_entries(rvu, pcifunc, nixlf); in nix_interface_deinit()
293 int rvu_mbox_handler_nix_bp_disable(struct rvu *rvu, in rvu_mbox_handler_nix_bp_disable() argument
305 if (!is_pf_cgxmapped(rvu, pf) && type != NIX_INTF_TYPE_LBK) in rvu_mbox_handler_nix_bp_disable()
308 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_bp_disable()
309 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_bp_disable()
313 cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan)); in rvu_mbox_handler_nix_bp_disable()
314 rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan), in rvu_mbox_handler_nix_bp_disable()
320 static int rvu_nix_get_bpid(struct rvu *rvu, struct nix_bp_cfg_req *req, in rvu_nix_get_bpid() argument
324 struct rvu_hwinfo *hw = rvu->hw; in rvu_nix_get_bpid()
330 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, req->hdr.pcifunc); in rvu_nix_get_bpid()
331 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST); in rvu_nix_get_bpid()
337 pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); in rvu_nix_get_bpid()
379 int rvu_mbox_handler_nix_bp_enable(struct rvu *rvu, in rvu_mbox_handler_nix_bp_enable() argument
394 if (!is_pf_cgxmapped(rvu, pf) && type != NIX_INTF_TYPE_LBK) in rvu_mbox_handler_nix_bp_enable()
397 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_bp_enable()
398 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_bp_enable()
400 bpid_base = rvu_nix_get_bpid(rvu, req, type, chan_id); in rvu_mbox_handler_nix_bp_enable()
406 dev_warn(rvu->dev, "Fail to enable backpressure\n"); in rvu_mbox_handler_nix_bp_enable()
410 cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan)); in rvu_mbox_handler_nix_bp_enable()
411 rvu_write64(rvu, blkaddr, NIX_AF_RX_CHANX_CFG(chan), in rvu_mbox_handler_nix_bp_enable()
414 bpid = rvu_nix_get_bpid(rvu, req, type, chan_id); in rvu_mbox_handler_nix_bp_enable()
429 static void nix_setup_lso_tso_l3(struct rvu *rvu, int blkaddr, in nix_setup_lso_tso_l3() argument
440 rvu_write64(rvu, blkaddr, in nix_setup_lso_tso_l3()
453 rvu_write64(rvu, blkaddr, in nix_setup_lso_tso_l3()
458 static void nix_setup_lso_tso_l4(struct rvu *rvu, int blkaddr, in nix_setup_lso_tso_l4() argument
468 rvu_write64(rvu, blkaddr, in nix_setup_lso_tso_l4()
477 rvu_write64(rvu, blkaddr, in nix_setup_lso_tso_l4()
482 static void nix_setup_lso(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr) in nix_setup_lso() argument
487 cfg = (rvu_read64(rvu, blkaddr, NIX_AF_CONST1) >> 48) & 0xFF; in nix_setup_lso()
491 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LSO_CFG); in nix_setup_lso()
497 rvu_write64(rvu, blkaddr, NIX_AF_LSO_CFG, cfg | BIT_ULL(63)); in nix_setup_lso()
504 nix_setup_lso_tso_l3(rvu, blkaddr, idx, true, &fidx); in nix_setup_lso()
505 nix_setup_lso_tso_l4(rvu, blkaddr, idx, &fidx); in nix_setup_lso()
509 rvu_write64(rvu, blkaddr, in nix_setup_lso()
517 nix_setup_lso_tso_l3(rvu, blkaddr, idx, false, &fidx); in nix_setup_lso()
518 nix_setup_lso_tso_l4(rvu, blkaddr, idx, &fidx); in nix_setup_lso()
522 rvu_write64(rvu, blkaddr, in nix_setup_lso()
528 static void nix_ctx_free(struct rvu *rvu, struct rvu_pfvf *pfvf) in nix_ctx_free() argument
534 qmem_free(rvu->dev, pfvf->rq_ctx); in nix_ctx_free()
536 qmem_free(rvu->dev, pfvf->sq_ctx); in nix_ctx_free()
538 qmem_free(rvu->dev, pfvf->cq_ctx); in nix_ctx_free()
540 qmem_free(rvu->dev, pfvf->rss_ctx); in nix_ctx_free()
542 qmem_free(rvu->dev, pfvf->nix_qints_ctx); in nix_ctx_free()
544 qmem_free(rvu->dev, pfvf->cq_ints_ctx); in nix_ctx_free()
557 static int nixlf_rss_ctx_init(struct rvu *rvu, int blkaddr, in nixlf_rss_ctx_init() argument
570 err = qmem_alloc(rvu->dev, &pfvf->rss_ctx, num_indices, hwctx_size); in nixlf_rss_ctx_init()
574 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RSS_BASE(nixlf), in nixlf_rss_ctx_init()
578 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RSS_CFG(nixlf), in nixlf_rss_ctx_init()
584 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RSS_GRPX(nixlf, grp), in nixlf_rss_ctx_init()
589 static int nix_aq_enqueue_wait(struct rvu *rvu, struct rvu_block *block, in nix_aq_enqueue_wait() argument
600 reg = rvu_read64(rvu, block->addr, NIX_AF_AQ_STATUS); in nix_aq_enqueue_wait()
610 rvu_write64(rvu, block->addr, NIX_AF_AQ_DOOR, 1); in nix_aq_enqueue_wait()
626 static int rvu_nix_aq_enq_inst(struct rvu *rvu, struct nix_aq_enq_req *req, in rvu_nix_aq_enq_inst() argument
629 struct rvu_hwinfo *hw = rvu->hw; in rvu_nix_aq_enq_inst()
640 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_nix_aq_enq_inst()
647 dev_warn(rvu->dev, "%s: NIX AQ not initialized\n", __func__); in rvu_nix_aq_enq_inst()
651 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_nix_aq_enq_inst()
652 nixlf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_nix_aq_enq_inst()
676 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_RSS_CFG(nixlf)); in rvu_nix_aq_enq_inst()
682 cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_MCAST_CFG); in rvu_nix_aq_enq_inst()
706 if (!is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_SMQ, in rvu_nix_aq_enq_inst()
775 rc = nix_aq_enqueue_wait(rvu, block, &inst); in rvu_nix_aq_enq_inst()
861 static int nix_lf_hwctx_disable(struct rvu *rvu, struct hwctx_disable_req *req) in nix_lf_hwctx_disable() argument
863 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc); in nix_lf_hwctx_disable()
903 rc = rvu_nix_aq_enq_inst(rvu, &aq_req, NULL); in nix_lf_hwctx_disable()
906 dev_err(rvu->dev, "Failed to disable %s:%d context\n", in nix_lf_hwctx_disable()
915 static int nix_lf_hwctx_lockdown(struct rvu *rvu, struct nix_aq_enq_req *req) in nix_lf_hwctx_lockdown() argument
932 err = rvu_nix_aq_enq_inst(rvu, &lock_ctx_req, NULL); in nix_lf_hwctx_lockdown()
934 dev_err(rvu->dev, in nix_lf_hwctx_lockdown()
941 int rvu_mbox_handler_nix_aq_enq(struct rvu *rvu, in rvu_mbox_handler_nix_aq_enq() argument
947 err = rvu_nix_aq_enq_inst(rvu, req, rsp); in rvu_mbox_handler_nix_aq_enq()
949 err = nix_lf_hwctx_lockdown(rvu, req); in rvu_mbox_handler_nix_aq_enq()
954 int rvu_mbox_handler_nix_aq_enq(struct rvu *rvu, in rvu_mbox_handler_nix_aq_enq() argument
958 return rvu_nix_aq_enq_inst(rvu, req, rsp); in rvu_mbox_handler_nix_aq_enq()
962 int rvu_mbox_handler_nix_hwctx_disable(struct rvu *rvu, in rvu_mbox_handler_nix_hwctx_disable() argument
966 return nix_lf_hwctx_disable(rvu, req); in rvu_mbox_handler_nix_hwctx_disable()
969 int rvu_mbox_handler_nix_lf_alloc(struct rvu *rvu, in rvu_mbox_handler_nix_lf_alloc() argument
974 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_nix_lf_alloc()
987 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_lf_alloc()
988 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_lf_alloc()
993 nixlf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_mbox_handler_nix_lf_alloc()
1002 if (!is_pffunc_map_valid(rvu, req->npa_func, BLKTYPE_NPA)) in rvu_mbox_handler_nix_lf_alloc()
1011 if (!is_pffunc_map_valid(rvu, req->sso_func, BLKTYPE_SSO)) in rvu_mbox_handler_nix_lf_alloc()
1029 err = rvu_lf_reset(rvu, block, nixlf); in rvu_mbox_handler_nix_lf_alloc()
1031 dev_err(rvu->dev, "Failed to reset NIX%d LF%d\n", in rvu_mbox_handler_nix_lf_alloc()
1036 ctx_cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST3); in rvu_mbox_handler_nix_lf_alloc()
1040 err = qmem_alloc(rvu->dev, &pfvf->rq_ctx, req->rq_cnt, hwctx_size); in rvu_mbox_handler_nix_lf_alloc()
1048 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RQS_BASE(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1053 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RQS_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1057 err = qmem_alloc(rvu->dev, &pfvf->sq_ctx, req->sq_cnt, hwctx_size); in rvu_mbox_handler_nix_lf_alloc()
1065 rvu_write64(rvu, blkaddr, NIX_AF_LFX_SQS_BASE(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1069 rvu_write64(rvu, blkaddr, NIX_AF_LFX_SQS_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1073 err = qmem_alloc(rvu->dev, &pfvf->cq_ctx, req->cq_cnt, hwctx_size); in rvu_mbox_handler_nix_lf_alloc()
1081 rvu_write64(rvu, blkaddr, NIX_AF_LFX_CQS_BASE(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1085 rvu_write64(rvu, blkaddr, NIX_AF_LFX_CQS_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1089 err = nixlf_rss_ctx_init(rvu, blkaddr, pfvf, nixlf, req->rss_sz, in rvu_mbox_handler_nix_lf_alloc()
1095 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2); in rvu_mbox_handler_nix_lf_alloc()
1098 err = qmem_alloc(rvu->dev, &pfvf->cq_ints_ctx, qints, hwctx_size); in rvu_mbox_handler_nix_lf_alloc()
1102 rvu_write64(rvu, blkaddr, NIX_AF_LFX_CINTS_BASE(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1105 rvu_write64(rvu, blkaddr, NIX_AF_LFX_CINTS_CFG(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1109 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2); in rvu_mbox_handler_nix_lf_alloc()
1112 err = qmem_alloc(rvu->dev, &pfvf->nix_qints_ctx, qints, hwctx_size); in rvu_mbox_handler_nix_lf_alloc()
1116 rvu_write64(rvu, blkaddr, NIX_AF_LFX_QINTS_BASE(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1118 rvu_write64(rvu, blkaddr, NIX_AF_LFX_QINTS_CFG(nixlf), in rvu_mbox_handler_nix_lf_alloc()
1126 rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1129 rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_CFG2(nixlf), BIT_ULL(0)); in rvu_mbox_handler_nix_lf_alloc()
1138 rvu_write64(rvu, blkaddr, NIX_AF_LFX_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1141 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf), req->rx_cfg); in rvu_mbox_handler_nix_lf_alloc()
1145 rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_PARSE_CFG(nixlf), cfg); in rvu_mbox_handler_nix_lf_alloc()
1148 err = nix_interface_init(rvu, pcifunc, intf, nixlf); in rvu_mbox_handler_nix_lf_alloc()
1153 rvu_npc_disable_default_entries(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_lf_alloc()
1158 nix_ctx_free(rvu, pfvf); in rvu_mbox_handler_nix_lf_alloc()
1166 cfg = rvu_read64(rvu, blkaddr, NIX_AF_SQ_CONST); in rvu_mbox_handler_nix_lf_alloc()
1175 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); in rvu_mbox_handler_nix_lf_alloc()
1179 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST2); in rvu_mbox_handler_nix_lf_alloc()
1185 int rvu_mbox_handler_nix_lf_free(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_lf_free() argument
1188 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_nix_lf_free()
1194 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_lf_free()
1195 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_lf_free()
1200 nixlf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_mbox_handler_nix_lf_free()
1204 nix_interface_deinit(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_lf_free()
1207 err = rvu_lf_reset(rvu, block, nixlf); in rvu_mbox_handler_nix_lf_free()
1209 dev_err(rvu->dev, "Failed to reset NIX%d LF%d\n", in rvu_mbox_handler_nix_lf_free()
1214 nix_ctx_free(rvu, pfvf); in rvu_mbox_handler_nix_lf_free()
1219 int rvu_mbox_handler_nix_mark_format_cfg(struct rvu *rvu, in rvu_mbox_handler_nix_mark_format_cfg() argument
1229 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_mark_format_cfg()
1230 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_mark_format_cfg()
1234 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_mark_format_cfg()
1243 rc = rvu_nix_reserve_mark_format(rvu, nix_hw, blkaddr, cfg); in rvu_mbox_handler_nix_mark_format_cfg()
1245 dev_err(rvu->dev, "No mark_format_ctl for (pf:%d, vf:%d)", in rvu_mbox_handler_nix_mark_format_cfg()
1257 static void nix_reset_tx_shaping(struct rvu *rvu, int blkaddr, in nix_reset_tx_shaping() argument
1284 cfg = rvu_read64(rvu, blkaddr, cir_reg); in nix_reset_tx_shaping()
1285 rvu_write64(rvu, blkaddr, cir_reg, cfg & ~BIT_ULL(0)); in nix_reset_tx_shaping()
1289 cfg = rvu_read64(rvu, blkaddr, pir_reg); in nix_reset_tx_shaping()
1290 rvu_write64(rvu, blkaddr, pir_reg, cfg & ~BIT_ULL(0)); in nix_reset_tx_shaping()
1293 static void nix_reset_tx_linkcfg(struct rvu *rvu, int blkaddr, in nix_reset_tx_linkcfg() argument
1296 struct rvu_hwinfo *hw = rvu->hw; in nix_reset_tx_linkcfg()
1304 rvu_write64(rvu, blkaddr, NIX_AF_TL4X_SDP_LINK_CFG(schq), 0x00); in nix_reset_tx_linkcfg()
1311 rvu_write64(rvu, blkaddr, in nix_reset_tx_linkcfg()
1315 static int nix_get_tx_link(struct rvu *rvu, u16 pcifunc) in nix_get_tx_link() argument
1317 struct rvu_hwinfo *hw = rvu->hw; in nix_get_tx_link()
1323 } else if (is_pf_cgxmapped(rvu, pf)) { in nix_get_tx_link()
1324 rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); in nix_get_tx_link()
1332 static void nix_get_txschq_range(struct rvu *rvu, u16 pcifunc, in nix_get_txschq_range() argument
1335 struct rvu_hwinfo *hw = rvu->hw; in nix_get_txschq_range()
1341 } else if (is_pf_cgxmapped(rvu, pf)) { /* CGX links */ in nix_get_txschq_range()
1351 static int nix_check_txschq_alloc_req(struct rvu *rvu, int lvl, u16 pcifunc, in nix_check_txschq_alloc_req() argument
1355 struct rvu_hwinfo *hw = rvu->hw; in nix_check_txschq_alloc_req()
1366 link = nix_get_tx_link(rvu, pcifunc); in nix_check_txschq_alloc_req()
1377 nix_get_txschq_range(rvu, pcifunc, link, &start, &end); in nix_check_txschq_alloc_req()
1400 static void nix_txsch_alloc(struct rvu *rvu, struct nix_txsch *txsch, in nix_txsch_alloc() argument
1404 struct rvu_hwinfo *hw = rvu->hw; in nix_txsch_alloc()
1484 int rvu_mbox_handler_nix_txsch_alloc(struct rvu *rvu, in rvu_mbox_handler_nix_txsch_alloc() argument
1488 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_nix_txsch_alloc()
1498 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_txsch_alloc()
1499 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_txsch_alloc()
1503 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_txsch_alloc()
1507 mutex_lock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txsch_alloc()
1513 rc = nix_check_txschq_alloc_req(rvu, lvl, pcifunc, nix_hw, req); in rvu_mbox_handler_nix_txsch_alloc()
1529 link = nix_get_tx_link(rvu, pcifunc); in rvu_mbox_handler_nix_txsch_alloc()
1535 nix_get_txschq_range(rvu, pcifunc, link, &start, &end); in rvu_mbox_handler_nix_txsch_alloc()
1541 nix_txsch_alloc(rvu, txsch, rsp, lvl, start, end); in rvu_mbox_handler_nix_txsch_alloc()
1549 nix_reset_tx_linkcfg(rvu, blkaddr, lvl, schq); in rvu_mbox_handler_nix_txsch_alloc()
1550 nix_reset_tx_shaping(rvu, blkaddr, lvl, schq); in rvu_mbox_handler_nix_txsch_alloc()
1558 nix_reset_tx_linkcfg(rvu, blkaddr, lvl, schq); in rvu_mbox_handler_nix_txsch_alloc()
1559 nix_reset_tx_shaping(rvu, blkaddr, lvl, schq); in rvu_mbox_handler_nix_txsch_alloc()
1565 rsp->link_cfg_lvl = rvu_read64(rvu, blkaddr, in rvu_mbox_handler_nix_txsch_alloc()
1572 mutex_unlock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txsch_alloc()
1576 static void nix_smq_flush(struct rvu *rvu, int blkaddr, in nix_smq_flush() argument
1585 if (is_pf_cgxmapped(rvu, pf)) { in nix_smq_flush()
1586 rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id, &lmac_id); in nix_smq_flush()
1587 restore_tx_en = !cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), in nix_smq_flush()
1591 cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(smq)); in nix_smq_flush()
1594 rvu_write64(rvu, blkaddr, NIX_AF_SMQX_CFG(smq), cfg); in nix_smq_flush()
1599 rvu_cgx_enadis_rx_bp(rvu, pf, false); in nix_smq_flush()
1602 err = rvu_poll_reg(rvu, blkaddr, in nix_smq_flush()
1605 dev_err(rvu->dev, in nix_smq_flush()
1608 rvu_cgx_enadis_rx_bp(rvu, pf, true); in nix_smq_flush()
1611 cgx_lmac_tx_enable(rvu_cgx_pdata(cgx_id, rvu), lmac_id, false); in nix_smq_flush()
1614 static int nix_txschq_free(struct rvu *rvu, u16 pcifunc) in nix_txschq_free() argument
1617 struct rvu_hwinfo *hw = rvu->hw; in nix_txschq_free()
1621 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in nix_txschq_free()
1625 nix_hw = get_nix_hw(rvu->hw, blkaddr); in nix_txschq_free()
1629 nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0); in nix_txschq_free()
1634 mutex_lock(&rvu->rsrc_lock); in nix_txschq_free()
1643 nix_reset_tx_linkcfg(rvu, blkaddr, lvl, schq); in nix_txschq_free()
1652 nix_smq_flush(rvu, blkaddr, schq, pcifunc, nixlf); in nix_txschq_free()
1671 mutex_unlock(&rvu->rsrc_lock); in nix_txschq_free()
1674 rvu_write64(rvu, blkaddr, NIX_AF_NDC_TX_SYNC, BIT_ULL(12) | nixlf); in nix_txschq_free()
1675 err = rvu_poll_reg(rvu, blkaddr, NIX_AF_NDC_TX_SYNC, BIT_ULL(12), true); in nix_txschq_free()
1677 dev_err(rvu->dev, "NDC-TX sync failed for NIXLF %d\n", nixlf); in nix_txschq_free()
1682 static int nix_txschq_free_one(struct rvu *rvu, in nix_txschq_free_one() argument
1685 struct rvu_hwinfo *hw = rvu->hw; in nix_txschq_free_one()
1692 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in nix_txschq_free_one()
1696 nix_hw = get_nix_hw(rvu->hw, blkaddr); in nix_txschq_free_one()
1700 nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], pcifunc, 0); in nix_txschq_free_one()
1712 mutex_lock(&rvu->rsrc_lock); in nix_txschq_free_one()
1715 mutex_unlock(&rvu->rsrc_lock); in nix_txschq_free_one()
1723 nix_smq_flush(rvu, blkaddr, schq, pcifunc, nixlf); in nix_txschq_free_one()
1728 mutex_unlock(&rvu->rsrc_lock); in nix_txschq_free_one()
1734 int rvu_mbox_handler_nix_txsch_free(struct rvu *rvu, in rvu_mbox_handler_nix_txsch_free() argument
1739 return nix_txschq_free(rvu, req->hdr.pcifunc); in rvu_mbox_handler_nix_txsch_free()
1741 return nix_txschq_free_one(rvu, req); in rvu_mbox_handler_nix_txsch_free()
1744 static bool is_txschq_hierarchy_valid(struct rvu *rvu, u16 pcifunc, int blkaddr, in is_txschq_hierarchy_valid() argument
1755 if (!is_valid_txschq(rvu, blkaddr, lvl, pcifunc, schq)) in is_txschq_hierarchy_valid()
1761 !is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_TL4, pcifunc, parent)) in is_txschq_hierarchy_valid()
1766 !is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_TL3, pcifunc, parent)) in is_txschq_hierarchy_valid()
1771 !is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_TL2, pcifunc, parent)) in is_txschq_hierarchy_valid()
1776 !is_valid_txschq(rvu, blkaddr, NIX_TXSCH_LVL_TL1, pcifunc, parent)) in is_txschq_hierarchy_valid()
1818 static void nix_tl1_default_cfg(struct rvu *rvu, struct nix_hw *nix_hw, in nix_tl1_default_cfg() argument
1824 schq = nix_get_tx_link(rvu, pcifunc); in nix_tl1_default_cfg()
1829 rvu_write64(rvu, blkaddr, NIX_AF_TL1X_TOPOLOGY(schq), in nix_tl1_default_cfg()
1831 rvu_write64(rvu, blkaddr, NIX_AF_TL1X_SCHEDULE(schq), in nix_tl1_default_cfg()
1833 rvu_write64(rvu, blkaddr, NIX_AF_TL1X_CIR(schq), 0x00); in nix_tl1_default_cfg()
1837 int rvu_mbox_handler_nix_txschq_cfg(struct rvu *rvu, in rvu_mbox_handler_nix_txschq_cfg() argument
1841 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_nix_txschq_cfg()
1854 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_txschq_cfg()
1858 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_txschq_cfg()
1867 mutex_lock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txschq_cfg()
1869 nix_tl1_default_cfg(rvu, nix_hw, pcifunc, blkaddr); in rvu_mbox_handler_nix_txschq_cfg()
1870 mutex_unlock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txschq_cfg()
1879 if (!is_txschq_hierarchy_valid(rvu, pcifunc, blkaddr, in rvu_mbox_handler_nix_txschq_cfg()
1889 nixlf = rvu_get_lf(rvu, &hw->block[blkaddr], in rvu_mbox_handler_nix_txschq_cfg()
1907 mutex_lock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txschq_cfg()
1910 mutex_unlock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_txschq_cfg()
1919 nix_smq_flush(rvu, blkaddr, schq, pcifunc, nixlf); in rvu_mbox_handler_nix_txschq_cfg()
1922 rvu_write64(rvu, blkaddr, reg, regval); in rvu_mbox_handler_nix_txschq_cfg()
1928 static int nix_rx_vtag_cfg(struct rvu *rvu, int nixlf, int blkaddr, in nix_rx_vtag_cfg() argument
1941 rvu_write64(rvu, blkaddr, in nix_rx_vtag_cfg()
1946 int rvu_mbox_handler_nix_vtag_cfg(struct rvu *rvu, in rvu_mbox_handler_nix_vtag_cfg() argument
1953 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_vtag_cfg()
1958 err = nix_rx_vtag_cfg(rvu, nixlf, blkaddr, req); in rvu_mbox_handler_nix_vtag_cfg()
1969 static int nix_setup_mce(struct rvu *rvu, int mce, u8 op, in nix_setup_mce() argument
1990 err = rvu_nix_aq_enq_inst(rvu, &aq_req, NULL); in nix_setup_mce()
1992 dev_err(rvu->dev, "Failed to setup Bcast MCE for PF%d:VF%d\n", in nix_setup_mce()
2038 int nix_update_bcast_mce_list(struct rvu *rvu, u16 pcifunc, bool add) in nix_update_bcast_mce_list() argument
2052 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in nix_update_bcast_mce_list()
2056 nix_hw = get_nix_hw(rvu->hw, blkaddr); in nix_update_bcast_mce_list()
2063 pfvf = rvu_get_pfvf(rvu, pcifunc & ~RVU_PFVF_FUNC_MASK); in nix_update_bcast_mce_list()
2068 dev_err(rvu->dev, in nix_update_bcast_mce_list()
2083 rvu_npc_enable_bcast_entry(rvu, pcifunc, false); in nix_update_bcast_mce_list()
2096 err = nix_setup_mce(rvu, idx, NIX_AQ_INSTOP_WRITE, in nix_update_bcast_mce_list()
2109 static int nix_setup_bcast_tables(struct rvu *rvu, struct nix_hw *nix_hw) in nix_setup_bcast_tables() argument
2118 for (pf = 1; pf < (rvu->cgx_mapped_pfs + 1); pf++) { in nix_setup_bcast_tables()
2119 cfg = rvu_read64(rvu, BLKADDR_RVUM, RVU_PRIV_PFX_CFG(pf)); in nix_setup_bcast_tables()
2126 pfvf = &rvu->pf[pf]; in nix_setup_bcast_tables()
2141 err = nix_setup_mce(rvu, pfvf->bcast_mce_idx + idx, in nix_setup_bcast_tables()
2151 static int nix_setup_mcast(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr) in nix_setup_mcast() argument
2154 struct rvu_hwinfo *hw = rvu->hw; in nix_setup_mcast()
2157 size = (rvu_read64(rvu, blkaddr, NIX_AF_CONST3) >> 16) & 0x0F; in nix_setup_mcast()
2161 err = qmem_alloc(rvu->dev, &mcast->mce_ctx, in nix_setup_mcast()
2166 rvu_write64(rvu, blkaddr, NIX_AF_RX_MCAST_BASE, in nix_setup_mcast()
2170 rvu_write64(rvu, blkaddr, NIX_AF_RX_MCAST_CFG, in nix_setup_mcast()
2174 size = rvu_read64(rvu, blkaddr, NIX_AF_MC_MIRROR_CONST) & 0xFFFF; in nix_setup_mcast()
2175 err = qmem_alloc(rvu->dev, &mcast->mcast_buf, in nix_setup_mcast()
2180 rvu_write64(rvu, blkaddr, NIX_AF_RX_MCAST_BUF_BASE, in nix_setup_mcast()
2186 rvu_write64(rvu, blkaddr, NIX_AF_RX_MCAST_BUF_CFG, in nix_setup_mcast()
2192 return nix_setup_bcast_tables(rvu, nix_hw); in nix_setup_mcast()
2195 static int nix_setup_txschq(struct rvu *rvu, struct nix_hw *nix_hw, int blkaddr) in nix_setup_txschq() argument
2224 cfg = rvu_read64(rvu, blkaddr, reg); in nix_setup_txschq()
2233 txsch->pfvf_map = devm_kcalloc(rvu->dev, txsch->schq.max, in nix_setup_txschq()
2243 int rvu_nix_reserve_mark_format(struct rvu *rvu, struct nix_hw *nix_hw, in rvu_nix_reserve_mark_format() argument
2255 rvu_write64(rvu, blkaddr, NIX_AF_MARK_FORMATX_CTL(fmt_idx), cfg); in rvu_nix_reserve_mark_format()
2261 static int nix_af_mark_format_setup(struct rvu *rvu, struct nix_hw *nix_hw, in nix_af_mark_format_setup() argument
2278 total = (rvu_read64(rvu, blkaddr, NIX_AF_PSE_CONST) & 0xFF00) >> 8; in nix_af_mark_format_setup()
2280 nix_hw->mark_format.cfg = devm_kcalloc(rvu->dev, total, sizeof(u32), in nix_af_mark_format_setup()
2285 rc = rvu_nix_reserve_mark_format(rvu, nix_hw, blkaddr, cfgs[i]); in nix_af_mark_format_setup()
2287 dev_err(rvu->dev, "Err %d in setup mark format %d\n", in nix_af_mark_format_setup()
2294 int rvu_mbox_handler_nix_stats_rst(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_stats_rst() argument
2301 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_stats_rst()
2306 stats = rvu_read64(rvu, blkaddr, NIX_AF_CONST1); in rvu_mbox_handler_nix_stats_rst()
2310 rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_STATX(nixlf, i), 0); in rvu_mbox_handler_nix_stats_rst()
2314 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RX_STATX(nixlf, i), 0); in rvu_mbox_handler_nix_stats_rst()
2562 static int reserve_flowkey_alg_idx(struct rvu *rvu, int blkaddr, u32 flow_cfg) in reserve_flowkey_alg_idx() argument
2568 hw = get_nix_hw(rvu->hw, blkaddr); in reserve_flowkey_alg_idx()
2583 rvu_write64(rvu, blkaddr, in reserve_flowkey_alg_idx()
2595 int rvu_mbox_handler_nix_rss_flowkey_cfg(struct rvu *rvu, in rvu_mbox_handler_nix_rss_flowkey_cfg() argument
2604 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_rss_flowkey_cfg()
2608 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_rss_flowkey_cfg()
2615 alg_idx = reserve_flowkey_alg_idx(rvu, blkaddr, in rvu_mbox_handler_nix_rss_flowkey_cfg()
2621 rvu_npc_update_flowkey_alg_idx(rvu, pcifunc, nixlf, req->group, in rvu_mbox_handler_nix_rss_flowkey_cfg()
2626 static int nix_rx_flowkey_alg_cfg(struct rvu *rvu, int blkaddr) in nix_rx_flowkey_alg_cfg() argument
2634 rvu_write64(rvu, blkaddr, in nix_rx_flowkey_alg_cfg()
2641 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2648 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2654 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2660 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2667 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2674 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2681 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2688 rc = reserve_flowkey_alg_idx(rvu, blkaddr, flowkey_cfg); in nix_rx_flowkey_alg_cfg()
2695 int rvu_mbox_handler_nix_set_mac_addr(struct rvu *rvu, in rvu_mbox_handler_nix_set_mac_addr() argument
2703 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_set_mac_addr()
2707 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_set_mac_addr()
2711 rvu_npc_install_ucast_entry(rvu, pcifunc, nixlf, in rvu_mbox_handler_nix_set_mac_addr()
2714 rvu_npc_update_rxvlan(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_set_mac_addr()
2719 int rvu_mbox_handler_nix_get_mac_addr(struct rvu *rvu, in rvu_mbox_handler_nix_get_mac_addr() argument
2726 if (!is_nixlf_attached(rvu, pcifunc)) in rvu_mbox_handler_nix_get_mac_addr()
2729 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_get_mac_addr()
2736 int rvu_mbox_handler_nix_set_rx_mode(struct rvu *rvu, struct nix_rx_mode *req, in rvu_mbox_handler_nix_set_rx_mode() argument
2744 err = nix_get_nixlf(rvu, pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_set_rx_mode()
2748 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_set_rx_mode()
2758 rvu_npc_disable_promisc_entry(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_set_rx_mode()
2760 rvu_npc_install_promisc_entry(rvu, pcifunc, nixlf, in rvu_mbox_handler_nix_set_rx_mode()
2763 rvu_npc_update_rxvlan(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_set_rx_mode()
2768 static void nix_find_link_frs(struct rvu *rvu, in nix_find_link_frs() argument
2778 pfvf = rvu_get_pfvf(rvu, pcifunc); in nix_find_link_frs()
2787 rvu_get_pf_numvfs(rvu, pf, &numvfs, &hwvf); in nix_find_link_frs()
2791 pfvf = &rvu->hwvf[hwvf + vf]; in nix_find_link_frs()
2800 pfvf = &rvu->pf[pf]; in nix_find_link_frs()
2813 int rvu_mbox_handler_nix_set_hw_frs(struct rvu *rvu, struct nix_frs_cfg *req, in rvu_mbox_handler_nix_set_hw_frs() argument
2816 struct rvu_hwinfo *hw = rvu->hw; in rvu_mbox_handler_nix_set_hw_frs()
2825 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_set_hw_frs()
2829 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_set_hw_frs()
2845 mutex_lock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_set_hw_frs()
2849 cfg = rvu_read64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq)); in rvu_mbox_handler_nix_set_hw_frs()
2853 rvu_write64(rvu, blkaddr, NIX_AF_SMQX_CFG(schq), cfg); in rvu_mbox_handler_nix_set_hw_frs()
2855 mutex_unlock(&rvu->rsrc_lock); in rvu_mbox_handler_nix_set_hw_frs()
2867 if (is_pf_cgxmapped(rvu, pf)) { in rvu_mbox_handler_nix_set_hw_frs()
2869 rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx, &lmac); in rvu_mbox_handler_nix_set_hw_frs()
2881 nix_find_link_frs(rvu, req, pcifunc); in rvu_mbox_handler_nix_set_hw_frs()
2883 cfg = rvu_read64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link)); in rvu_mbox_handler_nix_set_hw_frs()
2887 rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link), cfg); in rvu_mbox_handler_nix_set_hw_frs()
2894 CGX_FIFO_LEN / cgx_get_lmac_cnt(rvu_cgx_pdata(cgx, rvu)); in rvu_mbox_handler_nix_set_hw_frs()
2895 cfg = rvu_read64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link)); in rvu_mbox_handler_nix_set_hw_frs()
2898 rvu_write64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link), cfg); in rvu_mbox_handler_nix_set_hw_frs()
2902 int rvu_mbox_handler_nix_rxvlan_alloc(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_rxvlan_alloc() argument
2918 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_rxvlan_alloc()
2926 err = rvu_mbox_handler_npc_mcam_alloc_entry(rvu, &alloc_req, in rvu_mbox_handler_nix_rxvlan_alloc()
2932 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_rxvlan_alloc()
2938 nixlf = rvu_get_lf(rvu, &rvu->hw->block[blkaddr], pcifunc, 0); in rvu_mbox_handler_nix_rxvlan_alloc()
2948 err = rvu_npc_update_rxvlan(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_rxvlan_alloc()
2956 rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, rsp); in rvu_mbox_handler_nix_rxvlan_alloc()
2961 int rvu_mbox_handler_nix_set_rx_cfg(struct rvu *rvu, struct nix_rx_cfg *req, in rvu_mbox_handler_nix_set_rx_cfg() argument
2967 err = nix_get_nixlf(rvu, req->hdr.pcifunc, &nixlf, &blkaddr); in rvu_mbox_handler_nix_set_rx_cfg()
2971 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf)); in rvu_mbox_handler_nix_set_rx_cfg()
2988 rvu_write64(rvu, blkaddr, NIX_AF_LFX_RX_CFG(nixlf), cfg); in rvu_mbox_handler_nix_set_rx_cfg()
2993 static void nix_link_config(struct rvu *rvu, int blkaddr) in nix_link_config() argument
2995 struct rvu_hwinfo *hw = rvu->hw; in nix_link_config()
3006 rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link), in nix_link_config()
3012 rvu_write64(rvu, blkaddr, NIX_AF_RX_LINKX_CFG(link), in nix_link_config()
3020 lmac_cnt = cgx_get_lmac_cnt(rvu_cgx_pdata(cgx, rvu)); in nix_link_config()
3026 rvu_write64(rvu, blkaddr, in nix_link_config()
3038 rvu_write64(rvu, blkaddr, in nix_link_config()
3043 static int nix_calibrate_x2p(struct rvu *rvu, int blkaddr) in nix_calibrate_x2p() argument
3049 rvu_write64(rvu, blkaddr, NIX_AF_CFG, in nix_calibrate_x2p()
3050 rvu_read64(rvu, blkaddr, NIX_AF_CFG) | BIT_ULL(9)); in nix_calibrate_x2p()
3052 err = rvu_poll_reg(rvu, blkaddr, in nix_calibrate_x2p()
3055 dev_err(rvu->dev, "NIX X2P bus calibration failed\n"); in nix_calibrate_x2p()
3059 status = rvu_read64(rvu, blkaddr, NIX_AF_STATUS); in nix_calibrate_x2p()
3061 for (idx = 0; idx < rvu->cgx_cnt_max; idx++) { in nix_calibrate_x2p()
3063 if (!rvu_cgx_pdata(idx, rvu) || in nix_calibrate_x2p()
3066 dev_err(rvu->dev, in nix_calibrate_x2p()
3073 dev_err(rvu->dev, in nix_calibrate_x2p()
3079 rvu_write64(rvu, blkaddr, NIX_AF_CFG, in nix_calibrate_x2p()
3080 rvu_read64(rvu, blkaddr, NIX_AF_CFG) & ~BIT_ULL(9)); in nix_calibrate_x2p()
3082 dev_err(rvu->dev, in nix_calibrate_x2p()
3089 static int nix_aq_init(struct rvu *rvu, struct rvu_block *block) in nix_aq_init() argument
3095 cfg = rvu_read64(rvu, block->addr, NIX_AF_CFG); in nix_aq_init()
3098 rvu_write64(rvu, block->addr, NIX_AF_CFG, cfg); in nix_aq_init()
3101 rvu_write64(rvu, block->addr, NIX_AF_CFG, cfg); in nix_aq_init()
3105 cfg = rvu_read64(rvu, block->addr, NIX_AF_NDC_CFG); in nix_aq_init()
3111 rvu_write64(rvu, block->addr, NIX_AF_NDC_CFG, cfg); in nix_aq_init()
3117 err = rvu_aq_alloc(rvu, &block->aq, in nix_aq_init()
3123 rvu_write64(rvu, block->addr, NIX_AF_AQ_CFG, AQ_SIZE); in nix_aq_init()
3124 rvu_write64(rvu, block->addr, in nix_aq_init()
3129 int rvu_nix_init(struct rvu *rvu) in rvu_nix_init() argument
3132 struct rvu_hwinfo *hw = rvu->hw; in rvu_nix_init()
3137 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0); in rvu_nix_init()
3142 if (is_rvu_96xx_B0(rvu)) { in rvu_nix_init()
3147 rvu_write64(rvu, blkaddr, NIX_AF_CFG, in rvu_nix_init()
3148 rvu_read64(rvu, blkaddr, NIX_AF_CFG) | 0x40ULL); in rvu_nix_init()
3151 rvu_write64(rvu, blkaddr, NIX_AF_PSE_CHANNEL_LEVEL, 0x01); in rvu_nix_init()
3157 cfg = rvu_read64(rvu, blkaddr, NIX_AF_SQM_DBG_CTL_STATUS); in rvu_nix_init()
3159 rvu_write64(rvu, blkaddr, NIX_AF_SQM_DBG_CTL_STATUS, cfg); in rvu_nix_init()
3162 ltdefs = rvu->kpu.lt_def; in rvu_nix_init()
3164 err = nix_calibrate_x2p(rvu, blkaddr); in rvu_nix_init()
3169 cfg = rvu_read64(rvu, blkaddr, NIX_AF_CONST); in rvu_nix_init()
3177 err = nix_aq_init(rvu, block); in rvu_nix_init()
3182 rvu_write64(rvu, blkaddr, NIX_AF_CINT_DELAY, 0x0ULL); in rvu_nix_init()
3185 hw->nix0 = devm_kzalloc(rvu->dev, in rvu_nix_init()
3190 err = nix_setup_txschq(rvu, hw->nix0, blkaddr); in rvu_nix_init()
3194 err = nix_af_mark_format_setup(rvu, hw->nix0, blkaddr); in rvu_nix_init()
3198 err = nix_setup_mcast(rvu, hw->nix0, blkaddr); in rvu_nix_init()
3203 nix_setup_lso(rvu, hw->nix0, blkaddr); in rvu_nix_init()
3209 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OL2, in rvu_nix_init()
3212 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OIP4, in rvu_nix_init()
3215 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IIP4, in rvu_nix_init()
3218 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OIP6, in rvu_nix_init()
3221 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IIP6, in rvu_nix_init()
3224 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OTCP, in rvu_nix_init()
3227 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_ITCP, in rvu_nix_init()
3230 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OUDP, in rvu_nix_init()
3233 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_IUDP, in rvu_nix_init()
3236 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_OSCTP, in rvu_nix_init()
3239 rvu_write64(rvu, blkaddr, NIX_AF_RX_DEF_ISCTP, in rvu_nix_init()
3243 err = nix_rx_flowkey_alg_cfg(rvu, blkaddr); in rvu_nix_init()
3248 nix_link_config(rvu, blkaddr); in rvu_nix_init()
3251 rvu_write64(rvu, blkaddr, NIX_AF_RX_CFG, BIT_ULL(0)); in rvu_nix_init()
3256 void rvu_nix_freemem(struct rvu *rvu) in rvu_nix_freemem() argument
3258 struct rvu_hwinfo *hw = rvu->hw; in rvu_nix_freemem()
3265 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, 0); in rvu_nix_freemem()
3270 rvu_aq_free(rvu, block->aq); in rvu_nix_freemem()
3273 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_nix_freemem()
3283 qmem_free(rvu->dev, mcast->mce_ctx); in rvu_nix_freemem()
3284 qmem_free(rvu->dev, mcast->mcast_buf); in rvu_nix_freemem()
3289 int rvu_mbox_handler_nix_lf_start_rx(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_lf_start_rx() argument
3295 err = nix_get_nixlf(rvu, pcifunc, &nixlf, NULL); in rvu_mbox_handler_nix_lf_start_rx()
3299 rvu_npc_enable_default_entries(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_lf_start_rx()
3301 return rvu_cgx_start_stop_io(rvu, pcifunc, true); in rvu_mbox_handler_nix_lf_start_rx()
3304 int rvu_mbox_handler_nix_lf_stop_rx(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_lf_stop_rx() argument
3310 err = nix_get_nixlf(rvu, pcifunc, &nixlf, NULL); in rvu_mbox_handler_nix_lf_stop_rx()
3314 rvu_npc_disable_default_entries(rvu, pcifunc, nixlf); in rvu_mbox_handler_nix_lf_stop_rx()
3316 return rvu_cgx_start_stop_io(rvu, pcifunc, false); in rvu_mbox_handler_nix_lf_stop_rx()
3319 void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int nixlf) in rvu_nix_lf_teardown() argument
3321 struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_nix_lf_teardown()
3328 nix_interface_deinit(rvu, pcifunc, nixlf); in rvu_nix_lf_teardown()
3329 nix_rx_sync(rvu, blkaddr); in rvu_nix_lf_teardown()
3330 nix_txschq_free(rvu, pcifunc); in rvu_nix_lf_teardown()
3332 rvu_cgx_start_stop_io(rvu, pcifunc, false); in rvu_nix_lf_teardown()
3336 err = nix_lf_hwctx_disable(rvu, &ctx_req); in rvu_nix_lf_teardown()
3338 dev_err(rvu->dev, "SQ ctx disable failed\n"); in rvu_nix_lf_teardown()
3343 err = nix_lf_hwctx_disable(rvu, &ctx_req); in rvu_nix_lf_teardown()
3345 dev_err(rvu->dev, "RQ ctx disable failed\n"); in rvu_nix_lf_teardown()
3350 err = nix_lf_hwctx_disable(rvu, &ctx_req); in rvu_nix_lf_teardown()
3352 dev_err(rvu->dev, "CQ ctx disable failed\n"); in rvu_nix_lf_teardown()
3355 nix_ctx_free(rvu, pfvf); in rvu_nix_lf_teardown()
3360 static int rvu_nix_lf_ptp_tx_cfg(struct rvu *rvu, u16 pcifunc, bool enable) in rvu_nix_lf_ptp_tx_cfg() argument
3362 struct rvu_hwinfo *hw = rvu->hw; in rvu_nix_lf_ptp_tx_cfg()
3368 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_nix_lf_ptp_tx_cfg()
3373 nixlf = rvu_get_lf(rvu, block, pcifunc, 0); in rvu_nix_lf_ptp_tx_cfg()
3377 cfg = rvu_read64(rvu, blkaddr, NIX_AF_LFX_TX_CFG(nixlf)); in rvu_nix_lf_ptp_tx_cfg()
3384 rvu_write64(rvu, blkaddr, NIX_AF_LFX_TX_CFG(nixlf), cfg); in rvu_nix_lf_ptp_tx_cfg()
3389 int rvu_mbox_handler_nix_lf_ptp_tx_enable(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_lf_ptp_tx_enable() argument
3392 return rvu_nix_lf_ptp_tx_cfg(rvu, req->hdr.pcifunc, true); in rvu_mbox_handler_nix_lf_ptp_tx_enable()
3395 int rvu_mbox_handler_nix_lf_ptp_tx_disable(struct rvu *rvu, struct msg_req *req, in rvu_mbox_handler_nix_lf_ptp_tx_disable() argument
3398 return rvu_nix_lf_ptp_tx_cfg(rvu, req->hdr.pcifunc, false); in rvu_mbox_handler_nix_lf_ptp_tx_disable()
3401 int rvu_mbox_handler_nix_lso_format_cfg(struct rvu *rvu, in rvu_mbox_handler_nix_lso_format_cfg() argument
3411 pfvf = rvu_get_pfvf(rvu, pcifunc); in rvu_mbox_handler_nix_lso_format_cfg()
3412 blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc); in rvu_mbox_handler_nix_lso_format_cfg()
3416 nix_hw = get_nix_hw(rvu->hw, blkaddr); in rvu_mbox_handler_nix_lso_format_cfg()
3423 reg = rvu_read64(rvu, blkaddr, in rvu_mbox_handler_nix_lso_format_cfg()
3445 rvu_write64(rvu, blkaddr, in rvu_mbox_handler_nix_lso_format_cfg()