1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Marvell OcteonTx2 RVU Admin Function driver
4 * Copyright (C) 2018 Marvell International Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
14 #include <linux/pci.h>
15 #include <net/devlink.h>
17 #include "rvu_struct.h"
18 #include "rvu_devlink.h"
25 #define PCI_DEVID_OCTEONTX2_RVU_AF 0xA065
26 #define PCI_DEVID_OCTEONTX2_LBK 0xA061
28 /* Subsystem Device ID */
29 #define PCI_SUBSYS_DEVID_96XX 0xB200
30 #define PCI_SUBSYS_DEVID_CN10K_A 0xB900
33 #define PCI_AF_REG_BAR_NUM 0
34 #define PCI_PF_REG_BAR_NUM 2
35 #define PCI_MBOX_BAR_NUM 4
38 #define MAX_NIX_BLKS 2
39 #define MAX_CPT_BLKS 2
42 #define RVU_PFVF_PF_SHIFT 10
43 #define RVU_PFVF_PF_MASK 0x3F
44 #define RVU_PFVF_FUNC_SHIFT 0
45 #define RVU_PFVF_FUNC_MASK 0x3FF
47 #ifdef CONFIG_DEBUG_FS
61 struct dentry *cgx_root;
68 struct dump_ctx npa_aura_ctx;
69 struct dump_ctx npa_pool_ctx;
70 struct dump_ctx nix_cq_ctx;
71 struct dump_ctx nix_rq_ctx;
72 struct dump_ctx nix_sq_ctx;
73 struct cpt_ctx cpt_ctx[MAX_CPT_BLKS];
80 struct work_struct work;
87 unsigned long *bmap; /* Pointer to resource bitmap */
88 u16 max; /* Max resource id or count */
93 struct admin_queue *aq; /* NIX/NPA AQ */
94 u16 *fn_map; /* LF to pcifunc mapping */
97 u8 addr; /* RVU_BLOCK_ADDR_E */
98 u8 type; /* RVU_BLOCK_TYPE_E */
106 unsigned char name[NAME_SIZE];
110 struct qmem *mce_ctx;
111 struct qmem *mcast_buf;
114 struct mutex mce_lock; /* Serialize MCE updates */
117 struct nix_mce_list {
118 struct hlist_head head;
123 /* layer metadata to uniquely identify a packet header field */
124 struct npc_layer_mdata {
132 /* Structure to represent a field present in the
133 * generated key. A key field may present anywhere and can
134 * be of any size in the generated key. Once this structure
135 * is populated for fields of interest then field's presence
136 * and location (if present) can be known.
138 struct npc_key_field {
139 /* Masks where all set bits indicate position
140 * of a field in the key
142 u64 kw_mask[NPC_MAX_KWS_IN_KEY];
143 /* Number of words in the key a field spans. If a field is
144 * of 16 bytes and key offset is 4 then the field will use
145 * 4 bytes in KW0, 8 bytes in KW1 and 4 bytes in KW2 and
146 * nr_kws will be 3(KW0, KW1 and KW2).
149 /* used by packet header fields */
150 struct npc_layer_mdata layer_mdata;
154 struct rsrc_bmap counters;
155 struct mutex lock; /* MCAM entries and counters update lock */
156 unsigned long *bmap; /* bitmap, 0 => bmap_entries */
157 unsigned long *bmap_reverse; /* Reverse bitmap, bmap_entries => 0 */
158 u16 bmap_entries; /* Number of unreserved MCAM entries */
159 u16 bmap_fcnt; /* MCAM entries free count */
164 u16 *entry2target_pffunc;
165 u8 keysize; /* MCAM keysize 112/224/448 bits */
166 u8 banks; /* Number of MCAM banks */
167 u8 banks_per_entry;/* Number of keywords in key */
168 u16 banksize; /* Number of MCAM entries in each bank */
169 u16 total_entries; /* Total number of MCAM entries */
170 u16 nixlf_offset; /* Offset of nixlf rsvd uncast entries */
171 u16 pf_offset; /* Offset of PF's rsvd bcast, promisc entries */
176 u16 rx_miss_act_cntr; /* Counter for RX MISS action */
177 /* fields present in the generated key */
178 struct npc_key_field tx_key_fields[NPC_KEY_FIELDS_MAX];
179 struct npc_key_field rx_key_fields[NPC_KEY_FIELDS_MAX];
182 struct list_head mcam_rules;
185 /* Structure for per RVU func info ie PF/VF */
187 bool npalf; /* Only one NPALF per RVU_FUNC */
188 bool nixlf; /* Only one NIXLF per RVU_FUNC */
196 /* Block LF's MSIX vector info */
197 struct rsrc_bmap msix; /* Bitmap for MSIX vector alloc */
198 #define MSIX_BLKLF(blkaddr, lf) (((blkaddr) << 8) | ((lf) & 0xFF))
199 u16 *msix_lfmap; /* Vector to block LF mapping */
202 struct qmem *aura_ctx;
203 struct qmem *pool_ctx;
204 struct qmem *npa_qints_ctx;
205 unsigned long *aura_bmap;
206 unsigned long *pool_bmap;
212 struct qmem *rss_ctx;
213 struct qmem *cq_ints_ctx;
214 struct qmem *nix_qints_ctx;
215 unsigned long *sq_bmap;
216 unsigned long *rq_bmap;
217 unsigned long *cq_bmap;
221 u8 rx_chan_cnt; /* total number of RX channels */
222 u8 tx_chan_cnt; /* total number of TX channels */
226 u8 mac_addr[ETH_ALEN]; /* MAC address of this PF/VF */
227 u8 default_mac[ETH_ALEN]; /* MAC address from FWdata */
229 /* Broadcast/Multicast/Promisc pkt replication info */
233 struct nix_mce_list bcast_mce_list;
234 struct nix_mce_list mcast_mce_list;
235 struct nix_mce_list promisc_mce_list;
238 struct rvu_npc_mcam_rule *def_ucast_rule;
240 bool cgx_in_use; /* this PF/VF using CGX? */
241 int cgx_users; /* number of cgx users - used only by PFs */
243 u8 nix_blkaddr; /* BLKADDR_NIX0/1 assigned to this PF */
244 u8 nix_rx_intf; /* NIX0_RX/NIX1_RX interface to NPC */
245 u8 nix_tx_intf; /* NIX0_TX/NIX1_TX interface to NPC */
246 u64 lmt_base_addr; /* Preseving the pcifunc's lmtst base addr*/
250 enum rvu_pfvf_flags {
251 NIXLF_INITIALIZED = 0,
257 #define RVU_CLEAR_VF_PERM ~GENMASK(PF_SET_VF_TRUSTED, PF_SET_VF_MAC)
260 struct rsrc_bmap schq;
262 #define NIX_TXSCHQ_FREE BIT_ULL(1)
263 #define NIX_TXSCHQ_CFG_DONE BIT_ULL(0)
264 #define TXSCH_MAP_FUNC(__pfvf_map) ((__pfvf_map) & 0xFFFF)
265 #define TXSCH_MAP_FLAGS(__pfvf_map) ((__pfvf_map) >> 16)
266 #define TXSCH_MAP(__func, __flags) (((__func) & 0xFFFF) | ((__flags) << 16))
267 #define TXSCH_SET_FLAG(__pfvf_map, flag) ((__pfvf_map) | ((flag) << 16))
271 struct nix_mark_format {
278 struct rsrc_bmap rsrc;
283 #define NIX_FLOW_KEY_ALG_MAX 32
284 u32 flowkey[NIX_FLOW_KEY_ALG_MAX];
294 #define NIX_TX_VTAG_DEF_MAX 0x400
295 struct rsrc_bmap rsrc;
297 struct mutex rsrc_lock; /* Serialize resource alloc/free */
300 struct nix_ipolicer {
301 struct rsrc_bmap band_prof;
310 struct nix_txsch txsch[NIX_TXSCH_LVL_CNT]; /* Tx schedulers */
311 struct nix_mcast mcast;
312 struct nix_flowkey flowkey;
313 struct nix_mark_format mark_format;
315 struct nix_txvlan txvlan;
316 struct nix_ipolicer *ipolicer;
319 /* RVU block's capabilities or functionality,
320 * which vary by silicon version/skew.
323 /* Transmit side supported functionality */
324 u8 nix_tx_aggr_lvl; /* Tx link's traffic aggregation level */
325 u16 nix_txsch_per_cgx_lmac; /* Max Q's transmitting to CGX LMAC */
326 u16 nix_txsch_per_lbk_lmac; /* Max Q's transmitting to LBK LMAC */
327 u16 nix_txsch_per_sdp_lmac; /* Max Q's transmitting to SDP LMAC */
328 bool nix_fixed_txschq_mapping; /* Schq mapping fixed or flexible */
329 bool nix_shaping; /* Is shaping and coloring supported */
330 bool nix_tx_link_bp; /* Can link backpressure TL queues ? */
331 bool nix_rx_multicast; /* Rx packet replication support */
332 bool per_pf_mbox_regs; /* PF mbox specified in per PF registers ? */
333 bool programmable_chans; /* Channels programmable ? */
338 u8 total_pfs; /* MAX RVU PFs HW supports */
339 u16 total_vfs; /* Max RVU VFs HW supports */
340 u16 max_vfs_per_pf; /* Max VFs that can be attached to a PF */
343 u16 cgx_chan_base; /* CGX base channel number */
344 u16 lbk_chan_base; /* LBK base channel number */
345 u16 sdp_chan_base; /* SDP base channel number */
346 u16 cpt_chan_base; /* CPT base channel number */
350 u8 cpt_links; /* Number of CPT links */
351 u8 npc_kpus; /* No of parser units */
352 u8 npc_pkinds; /* No of port kinds */
353 u8 npc_intfs; /* No of interfaces */
354 u8 npc_kpu_entries; /* No of KPU entries */
355 u16 npc_counters; /* No of match stats counters */
356 u32 lbk_bufsize; /* FIFO size supported by LBK */
357 bool npc_ext_set; /* Extended register set */
360 struct rvu_block block[BLK_COUNT]; /* Block info */
363 struct npc_pkind pkind;
364 struct npc_mcam mcam;
367 struct mbox_wq_info {
368 struct otx2_mbox mbox;
369 struct rvu_work *mbox_wrk;
371 struct otx2_mbox mbox_up;
372 struct rvu_work *mbox_wrk_up;
374 struct workqueue_struct *mbox_wq;
378 #define RVU_FWDATA_HEADER_MAGIC 0xCFDA /* Custom Firmware Data*/
379 #define RVU_FWDATA_VERSION 0x0001
381 u32 version; /* version id */
384 #define PF_MACNUM_MAX 32
385 #define VF_MACNUM_MAX 256
386 u64 pf_macs[PF_MACNUM_MAX];
387 u64 vf_macs[VF_MACNUM_MAX];
393 #define FWDATA_RESERVED_MEM 1023
394 u64 reserved[FWDATA_RESERVED_MEM];
396 #define CGX_LMACS_MAX 4
397 struct cgx_lmac_fwdata_s cgx_fw_data[CGX_MAX][CGX_LMACS_MAX];
398 /* Do not add new fields below this line */
403 /* KPU profile adapter structure gathering all KPU configuration data and abstracting out the
404 * source where it came from.
406 struct npc_kpu_profile_adapter {
409 const struct npc_lt_def_cfg *lt_def;
410 const struct npc_kpu_profile_action *ikpu; /* array[pkinds] */
411 const struct npc_kpu_profile *kpu; /* array[kpus] */
412 struct npc_mcam_kex *mkex;
419 void __iomem *afreg_base;
420 void __iomem *pfreg_base;
421 struct pci_dev *pdev;
423 struct rvu_hwinfo *hw;
425 struct rvu_pfvf *hwvf;
426 struct mutex rsrc_lock; /* Serialize resource alloc/free */
427 int vfs; /* Number of VFs attached to RVU */
428 int nix_blkaddr[MAX_NIX_BLKS];
431 struct mbox_wq_info afpf_wq_info;
432 struct mbox_wq_info afvf_wq_info;
435 struct rvu_work *flr_wrk;
436 struct workqueue_struct *flr_wq;
437 struct mutex flr_lock; /* Serialize FLRs */
443 dma_addr_t msix_base_iova;
444 u64 msixtr_base_phy; /* Register reset value */
447 #define PF_CGXMAP_BASE 1 /* PF 0 is reserved for RVU PF */
449 u8 cgx_cnt_max; /* CGX port count max */
450 u8 *pf2cgxlmac_map; /* pf to cgx_lmac map */
451 u16 *cgxlmac2pf_map; /* bitmap of mapped pfs for
452 * every cgx lmac port
454 unsigned long pf_notify_bmap; /* Flags for PF notification */
455 void **cgx_idmap; /* cgx id to cgx data map table */
456 struct work_struct cgx_evh_work;
457 struct workqueue_struct *cgx_evh_wq;
458 spinlock_t cgx_evq_lock; /* cgx event queue lock */
459 struct list_head cgx_evq_head; /* cgx event queue head */
460 struct mutex cgx_cfg_lock; /* serialize cgx configuration */
462 char mkex_pfl_name[MKEX_NAME_LEN]; /* Configured MKEX profile name */
463 char kpu_pfl_name[KPU_NAME_LEN]; /* Configured KPU profile name */
466 struct rvu_fwdata *fwdata;
468 size_t kpu_fwdata_sz;
469 void __iomem *kpu_prfl_addr;
472 struct npc_kpu_profile_adapter kpu;
476 #ifdef CONFIG_DEBUG_FS
477 struct rvu_debugfs rvu_dbg;
479 struct rvu_devlink *rvu_dl;
482 static inline void rvu_write64(struct rvu *rvu, u64 block, u64 offset, u64 val)
484 writeq(val, rvu->afreg_base + ((block << 28) | offset));
487 static inline u64 rvu_read64(struct rvu *rvu, u64 block, u64 offset)
489 return readq(rvu->afreg_base + ((block << 28) | offset));
492 static inline void rvupf_write64(struct rvu *rvu, u64 offset, u64 val)
494 writeq(val, rvu->pfreg_base + offset);
497 static inline u64 rvupf_read64(struct rvu *rvu, u64 offset)
499 return readq(rvu->pfreg_base + offset);
502 /* Silicon revisions */
503 static inline bool is_rvu_96xx_A0(struct rvu *rvu)
505 struct pci_dev *pdev = rvu->pdev;
507 return (pdev->revision == 0x00) &&
508 (pdev->subsystem_device == PCI_SUBSYS_DEVID_96XX);
511 static inline bool is_rvu_96xx_B0(struct rvu *rvu)
513 struct pci_dev *pdev = rvu->pdev;
515 return ((pdev->revision == 0x00) || (pdev->revision == 0x01)) &&
516 (pdev->subsystem_device == PCI_SUBSYS_DEVID_96XX);
519 /* REVID for PCIe devices.
520 * Bits 0..1: minor pass, bit 3..2: major pass
523 #define PCI_REVISION_ID_96XX 0x00
524 #define PCI_REVISION_ID_95XX 0x10
525 #define PCI_REVISION_ID_LOKI 0x20
526 #define PCI_REVISION_ID_98XX 0x30
527 #define PCI_REVISION_ID_95XXMM 0x40
529 static inline bool is_rvu_otx2(struct rvu *rvu)
531 struct pci_dev *pdev = rvu->pdev;
533 u8 midr = pdev->revision & 0xF0;
535 return (midr == PCI_REVISION_ID_96XX || midr == PCI_REVISION_ID_95XX ||
536 midr == PCI_REVISION_ID_LOKI || midr == PCI_REVISION_ID_98XX ||
537 midr == PCI_REVISION_ID_95XXMM);
540 static inline u16 rvu_nix_chan_cgx(struct rvu *rvu, u8 cgxid,
543 u64 nix_const = rvu_read64(rvu, BLKADDR_NIX0, NIX_AF_CONST);
544 u16 cgx_chans = nix_const & 0xFFULL;
545 struct rvu_hwinfo *hw = rvu->hw;
547 if (!hw->cap.programmable_chans)
548 return NIX_CHAN_CGX_LMAC_CHX(cgxid, lmacid, chan);
550 return rvu->hw->cgx_chan_base +
551 (cgxid * hw->lmac_per_cgx + lmacid) * cgx_chans + chan;
554 static inline u16 rvu_nix_chan_lbk(struct rvu *rvu, u8 lbkid,
557 u64 nix_const = rvu_read64(rvu, BLKADDR_NIX0, NIX_AF_CONST);
558 u16 lbk_chans = (nix_const >> 16) & 0xFFULL;
559 struct rvu_hwinfo *hw = rvu->hw;
561 if (!hw->cap.programmable_chans)
562 return NIX_CHAN_LBK_CHX(lbkid, chan);
564 return rvu->hw->lbk_chan_base + lbkid * lbk_chans + chan;
567 static inline u16 rvu_nix_chan_cpt(struct rvu *rvu, u8 chan)
569 return rvu->hw->cpt_chan_base + chan;
572 /* Function Prototypes
575 static inline bool is_afvf(u16 pcifunc)
577 return !(pcifunc & ~RVU_PFVF_FUNC_MASK);
580 static inline bool is_vf(u16 pcifunc)
582 return !!(pcifunc & RVU_PFVF_FUNC_MASK);
585 /* check if PF_FUNC is AF */
586 static inline bool is_pffunc_af(u16 pcifunc)
591 static inline bool is_rvu_fwdata_valid(struct rvu *rvu)
593 return (rvu->fwdata->header_magic == RVU_FWDATA_HEADER_MAGIC) &&
594 (rvu->fwdata->version == RVU_FWDATA_VERSION);
597 int rvu_alloc_bitmap(struct rsrc_bmap *rsrc);
598 int rvu_alloc_rsrc(struct rsrc_bmap *rsrc);
599 void rvu_free_rsrc(struct rsrc_bmap *rsrc, int id);
600 bool is_rsrc_free(struct rsrc_bmap *rsrc, int id);
601 int rvu_rsrc_free_count(struct rsrc_bmap *rsrc);
602 int rvu_alloc_rsrc_contig(struct rsrc_bmap *rsrc, int nrsrc);
603 bool rvu_rsrc_check_contig(struct rsrc_bmap *rsrc, int nrsrc);
604 u16 rvu_get_rsrc_mapcount(struct rvu_pfvf *pfvf, int blkaddr);
605 int rvu_get_pf(u16 pcifunc);
606 struct rvu_pfvf *rvu_get_pfvf(struct rvu *rvu, int pcifunc);
607 void rvu_get_pf_numvfs(struct rvu *rvu, int pf, int *numvfs, int *hwvf);
608 bool is_block_implemented(struct rvu_hwinfo *hw, int blkaddr);
609 bool is_pffunc_map_valid(struct rvu *rvu, u16 pcifunc, int blktype);
610 int rvu_get_lf(struct rvu *rvu, struct rvu_block *block, u16 pcifunc, u16 slot);
611 int rvu_lf_reset(struct rvu *rvu, struct rvu_block *block, int lf);
612 int rvu_get_blkaddr(struct rvu *rvu, int blktype, u16 pcifunc);
613 int rvu_poll_reg(struct rvu *rvu, u64 block, u64 offset, u64 mask, bool zero);
614 int rvu_get_num_lbk_chans(void);
616 /* RVU HW reg validation */
622 bool rvu_check_valid_reg(int regmap, int regblk, u64 reg);
624 /* NPA/NIX AQ APIs */
625 int rvu_aq_alloc(struct rvu *rvu, struct admin_queue **ad_queue,
626 int qsize, int inst_size, int res_size);
627 void rvu_aq_free(struct rvu *rvu, struct admin_queue *aq);
630 static inline bool is_pf_cgxmapped(struct rvu *rvu, u8 pf)
632 return (pf >= PF_CGXMAP_BASE && pf <= rvu->cgx_mapped_pfs);
635 static inline void rvu_get_cgx_lmac_id(u8 map, u8 *cgx_id, u8 *lmac_id)
637 *cgx_id = (map >> 4) & 0xF;
638 *lmac_id = (map & 0xF);
641 static inline bool is_cgx_vf(struct rvu *rvu, u16 pcifunc)
643 return ((pcifunc & RVU_PFVF_FUNC_MASK) &&
644 is_pf_cgxmapped(rvu, rvu_get_pf(pcifunc)));
647 #define M(_name, _id, fn_name, req, rsp) \
648 int rvu_mbox_handler_ ## fn_name(struct rvu *, struct req *, struct rsp *);
652 int rvu_cgx_init(struct rvu *rvu);
653 int rvu_cgx_exit(struct rvu *rvu);
654 void *rvu_cgx_pdata(u8 cgx_id, struct rvu *rvu);
655 int rvu_cgx_config_rxtx(struct rvu *rvu, u16 pcifunc, bool start);
656 void rvu_cgx_enadis_rx_bp(struct rvu *rvu, int pf, bool enable);
657 int rvu_cgx_start_stop_io(struct rvu *rvu, u16 pcifunc, bool start);
658 int rvu_cgx_nix_cuml_stats(struct rvu *rvu, void *cgxd, int lmac_id, int index,
659 int rxtxflag, u64 *stat);
660 void rvu_cgx_disable_dmac_entries(struct rvu *rvu, u16 pcifunc);
663 int rvu_npa_init(struct rvu *rvu);
664 void rvu_npa_freemem(struct rvu *rvu);
665 void rvu_npa_lf_teardown(struct rvu *rvu, u16 pcifunc, int npalf);
666 int rvu_npa_aq_enq_inst(struct rvu *rvu, struct npa_aq_enq_req *req,
667 struct npa_aq_enq_rsp *rsp);
670 bool is_nixlf_attached(struct rvu *rvu, u16 pcifunc);
671 int rvu_nix_init(struct rvu *rvu);
672 int rvu_nix_reserve_mark_format(struct rvu *rvu, struct nix_hw *nix_hw,
673 int blkaddr, u32 cfg);
674 void rvu_nix_freemem(struct rvu *rvu);
675 int rvu_get_nixlf_count(struct rvu *rvu);
676 void rvu_nix_lf_teardown(struct rvu *rvu, u16 pcifunc, int blkaddr, int npalf);
677 int nix_get_nixlf(struct rvu *rvu, u16 pcifunc, int *nixlf, int *nix_blkaddr);
678 int nix_update_mce_list(struct rvu *rvu, u16 pcifunc,
679 struct nix_mce_list *mce_list,
680 int mce_idx, int mcam_index, bool add);
681 void nix_get_mce_list(struct rvu *rvu, u16 pcifunc, int type,
682 struct nix_mce_list **mce_list, int *mce_idx);
683 struct nix_hw *get_nix_hw(struct rvu_hwinfo *hw, int blkaddr);
684 int rvu_get_next_nix_blkaddr(struct rvu *rvu, int blkaddr);
685 void rvu_nix_reset_mac(struct rvu_pfvf *pfvf, int pcifunc);
686 int nix_get_struct_ptrs(struct rvu *rvu, u16 pcifunc,
687 struct nix_hw **nix_hw, int *blkaddr);
688 int rvu_nix_setup_ratelimit_aggr(struct rvu *rvu, u16 pcifunc,
689 u16 rq_idx, u16 match_id);
690 int nix_aq_context_read(struct rvu *rvu, struct nix_hw *nix_hw,
691 struct nix_cn10k_aq_enq_req *aq_req,
692 struct nix_cn10k_aq_enq_rsp *aq_rsp,
693 u16 pcifunc, u8 ctype, u32 qidx);
696 int rvu_npc_init(struct rvu *rvu);
697 void rvu_npc_freemem(struct rvu *rvu);
698 int rvu_npc_get_pkind(struct rvu *rvu, u16 pf);
699 void rvu_npc_set_pkind(struct rvu *rvu, int pkind, struct rvu_pfvf *pfvf);
700 int npc_config_ts_kpuaction(struct rvu *rvu, int pf, u16 pcifunc, bool en);
701 void rvu_npc_install_ucast_entry(struct rvu *rvu, u16 pcifunc,
702 int nixlf, u64 chan, u8 *mac_addr);
703 void rvu_npc_install_promisc_entry(struct rvu *rvu, u16 pcifunc,
704 int nixlf, u64 chan, u8 chan_cnt);
705 void rvu_npc_enable_promisc_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
707 void rvu_npc_install_bcast_match_entry(struct rvu *rvu, u16 pcifunc,
708 int nixlf, u64 chan);
709 void rvu_npc_enable_bcast_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
711 void rvu_npc_install_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
713 void rvu_npc_enable_allmulti_entry(struct rvu *rvu, u16 pcifunc, int nixlf,
715 void npc_enadis_default_mce_entry(struct rvu *rvu, u16 pcifunc,
716 int nixlf, int type, bool enable);
717 void rvu_npc_disable_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
718 void rvu_npc_free_mcam_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
719 void rvu_npc_disable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
720 void rvu_npc_enable_default_entries(struct rvu *rvu, u16 pcifunc, int nixlf);
721 void rvu_npc_update_flowkey_alg_idx(struct rvu *rvu, u16 pcifunc, int nixlf,
722 int group, int alg_idx, int mcam_index);
723 void rvu_npc_get_mcam_entry_alloc_info(struct rvu *rvu, u16 pcifunc,
724 int blkaddr, int *alloc_cnt,
726 void rvu_npc_get_mcam_counter_alloc_info(struct rvu *rvu, u16 pcifunc,
727 int blkaddr, int *alloc_cnt,
729 bool is_npc_intf_tx(u8 intf);
730 bool is_npc_intf_rx(u8 intf);
731 bool is_npc_interface_valid(struct rvu *rvu, u8 intf);
732 int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64 nibble_ena);
733 int npc_mcam_verify_channel(struct rvu *rvu, u16 pcifunc, u8 intf, u16 channel);
734 int npc_flow_steering_init(struct rvu *rvu, int blkaddr);
735 const char *npc_get_field_name(u8 hdr);
736 int npc_get_bank(struct npc_mcam *mcam, int index);
737 void npc_mcam_enable_flows(struct rvu *rvu, u16 target);
738 void npc_mcam_disable_flows(struct rvu *rvu, u16 target);
739 void npc_enable_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
740 int blkaddr, int index, bool enable);
741 void npc_read_mcam_entry(struct rvu *rvu, struct npc_mcam *mcam,
742 int blkaddr, u16 src, struct mcam_entry *entry,
744 bool is_mac_feature_supported(struct rvu *rvu, int pf, int feature);
745 u32 rvu_cgx_get_fifolen(struct rvu *rvu);
746 void *rvu_first_cgx_pdata(struct rvu *rvu);
747 int cgxlmac_to_pf(struct rvu *rvu, int cgx_id, int lmac_id);
749 int npc_get_nixlf_mcam_index(struct npc_mcam *mcam, u16 pcifunc, int nixlf,
751 bool is_mcam_entry_enabled(struct rvu *rvu, struct npc_mcam *mcam, int blkaddr,
755 int rvu_cpt_lf_teardown(struct rvu *rvu, u16 pcifunc, int lf, int slot);
758 int rvu_set_channels_base(struct rvu *rvu);
759 void rvu_program_channels(struct rvu *rvu);
762 void rvu_reset_lmt_map_tbl(struct rvu *rvu, u16 pcifunc);
764 #ifdef CONFIG_DEBUG_FS
765 void rvu_dbg_init(struct rvu *rvu);
766 void rvu_dbg_exit(struct rvu *rvu);
768 static inline void rvu_dbg_init(struct rvu *rvu) {}
769 static inline void rvu_dbg_exit(struct rvu *rvu) {}