MCPcopy Create free account
hub / github.com/F-Stack/f-stack / roc_cpt_dev_init

Function roc_cpt_dev_init

dpdk/drivers/common/cnxk/roc_cpt.c:736–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

734}
735
736int
737roc_cpt_dev_init(struct roc_cpt *roc_cpt)
738{
739 struct plt_pci_device *pci_dev;
740 uint16_t nb_lf_avail;
741 struct dev *dev;
742 struct cpt *cpt;
743 int rc;
744
745 if (roc_cpt == NULL || roc_cpt->pci_dev == NULL)
746 return -EINVAL;
747
748 PLT_STATIC_ASSERT(sizeof(struct cpt) <= ROC_CPT_MEM_SZ);
749
750 cpt = roc_cpt_to_cpt_priv(roc_cpt);
751 memset(cpt, 0, sizeof(*cpt));
752 pci_dev = roc_cpt->pci_dev;
753 dev = &cpt->dev;
754
755 /* Initialize device */
756 rc = dev_init(dev, pci_dev);
757 if (rc) {
758 plt_err("Failed to init roc device");
759 return rc;
760 }
761
762 cpt->pci_dev = pci_dev;
763 roc_cpt->lmt_base = dev->lmt_base;
764
765 rc = cpt_hardware_caps_get(dev, roc_cpt);
766 if (rc) {
767 plt_err("Could not determine hardware capabilities");
768 goto fail;
769 }
770
771 rc = cpt_available_lfs_get(&cpt->dev, &nb_lf_avail);
772 if (rc) {
773 plt_err("Could not get available lfs");
774 goto fail;
775 }
776
777 /* Reserve 1 CPT LF for inline inbound */
778 nb_lf_avail = PLT_MIN(nb_lf_avail, (uint16_t)(ROC_CPT_MAX_LFS - 1));
779
780 roc_cpt->nb_lf_avail = nb_lf_avail;
781
782 dev->roc_cpt = roc_cpt;
783
784 /* Set it to idev if not already present */
785 if (!roc_idev_cpt_get())
786 roc_idev_cpt_set(roc_cpt);
787
788 return 0;
789
790fail:
791 dev_fini(dev, pci_dev);
792 return rc;
793}

Callers 2

cn10k_cpt_pci_probeFunction · 0.85
cn9k_cpt_pci_probeFunction · 0.85

Calls 8

roc_cpt_to_cpt_privFunction · 0.85
memsetFunction · 0.85
dev_initFunction · 0.85
cpt_hardware_caps_getFunction · 0.85
cpt_available_lfs_getFunction · 0.85
roc_idev_cpt_getFunction · 0.85
roc_idev_cpt_setFunction · 0.85
dev_finiFunction · 0.85

Tested by

no test coverage detected