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

Function pfe_hif_init

dpdk/drivers/net/pfe/pfe_hif.c:783–837  ·  view source on GitHub ↗

* pfe_hif_init * This function initializes the baseaddresses and irq, etc. */

Source from the content-addressed store, hash-verified

781 * This function initializes the baseaddresses and irq, etc.
782 */
783int
784pfe_hif_init(struct pfe *pfe)
785{
786 struct pfe_hif *hif = &pfe->hif;
787 int err;
788
789 PMD_INIT_FUNC_TRACE();
790
791#if defined(LS1012A_PFE_RESET_WA)
792 pfe_hif_rx_idle(hif);
793#endif
794
795 err = pfe_hif_alloc_descr(hif);
796 if (err)
797 goto err0;
798
799 rte_spinlock_init(&hif->tx_lock);
800 rte_spinlock_init(&hif->lock);
801
802 gpi_enable(HGPI_BASE_ADDR);
803 if (getenv("PFE_INTR_SUPPORT")) {
804 struct epoll_event epoll_ev;
805 int event_fd = -1, epoll_fd, pfe_cdev_fd;
806
807 pfe_cdev_fd = open(PFE_CDEV_PATH, O_RDWR);
808 if (pfe_cdev_fd < 0) {
809 PFE_PMD_WARN("Unable to open PFE device file (%s).",
810 PFE_CDEV_PATH);
811 pfe->cdev_fd = PFE_CDEV_INVALID_FD;
812 return -1;
813 }
814 pfe->cdev_fd = pfe_cdev_fd;
815
816 event_fd = eventfd(0, EFD_NONBLOCK);
817 /* hif interrupt enable */
818 err = ioctl(pfe->cdev_fd, PFE_CDEV_HIF_INTR_EN, &event_fd);
819 if (err) {
820 PFE_PMD_ERR("ioctl failed for intr enable err: %d",
821 errno);
822 goto err0;
823 }
824 epoll_fd = epoll_create(1);
825 epoll_ev.events = EPOLLIN | EPOLLPRI | EPOLLET;
826 epoll_ev.data.fd = event_fd;
827 err = epoll_ctl(epoll_fd, EPOLL_CTL_ADD, event_fd, &epoll_ev);
828 if (err < 0) {
829 PFE_PMD_ERR("epoll_ctl failed with err = %d", errno);
830 goto err0;
831 }
832 pfe->hif.epoll_fd = epoll_fd;
833 }
834 return 0;
835err0:
836 return err;
837}
838
839/* pfe_hif_exit- */
840void

Callers 1

pmd_pfe_probeFunction · 0.85

Calls 8

pfe_hif_rx_idleFunction · 0.85
pfe_hif_alloc_descrFunction · 0.85
rte_spinlock_initFunction · 0.85
gpi_enableFunction · 0.85
eventfdClass · 0.85
epoll_createFunction · 0.85
epoll_ctlFunction · 0.85
ioctlFunction · 0.50

Tested by

no test coverage detected