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

Function pfe_eth_init

dpdk/drivers/net/pfe/pfe_ethdev.c:753–840  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

751};
752
753static int
754pfe_eth_init(struct rte_vdev_device *vdev, struct pfe *pfe, int id)
755{
756 struct rte_eth_dev *eth_dev = NULL;
757 struct pfe_eth_priv_s *priv = NULL;
758 struct ls1012a_eth_platform_data *einfo;
759 struct ls1012a_pfe_platform_data *pfe_info;
760 struct rte_ether_addr addr;
761 int err;
762
763 eth_dev = rte_eth_vdev_allocate(vdev, sizeof(*priv));
764 if (eth_dev == NULL)
765 return -ENOMEM;
766
767 /* Extract platform data */
768 pfe_info = (struct ls1012a_pfe_platform_data *)&pfe->platform_data;
769 if (!pfe_info) {
770 PFE_PMD_ERR("pfe missing additional platform data");
771 err = -ENODEV;
772 goto err0;
773 }
774
775 einfo = (struct ls1012a_eth_platform_data *)pfe_info->ls1012a_eth_pdata;
776
777 /* einfo never be NULL, but no harm in having this check */
778 if (!einfo) {
779 PFE_PMD_ERR("pfe missing additional gemacs platform data");
780 err = -ENODEV;
781 goto err0;
782 }
783
784 priv = eth_dev->data->dev_private;
785 priv->ndev = eth_dev;
786 priv->id = einfo[id].gem_id;
787 priv->pfe = pfe;
788
789 pfe->eth.eth_priv[id] = priv;
790
791 /* Set the info in the priv to the current info */
792 priv->einfo = &einfo[id];
793 priv->EMAC_baseaddr = cbus_emac_base[id];
794 priv->PHY_baseaddr = cbus_emac_base[id];
795 priv->GPI_baseaddr = cbus_gpi_base[id];
796
797#define HIF_GEMAC_TMUQ_BASE 6
798 priv->low_tmu_q = HIF_GEMAC_TMUQ_BASE + (id * 2);
799 priv->high_tmu_q = priv->low_tmu_q + 1;
800
801 rte_spinlock_init(&priv->lock);
802
803 /* Copy the station address into the dev structure, */
804 eth_dev->data->mac_addrs = rte_zmalloc("mac_addr",
805 ETHER_ADDR_LEN * PFE_MAX_MACS, 0);
806 if (eth_dev->data->mac_addrs == NULL) {
807 PFE_PMD_ERR("Failed to allocate mem %d to store MAC addresses",
808 ETHER_ADDR_LEN * PFE_MAX_MACS);
809 err = -ENOMEM;
810 goto err0;

Callers 1

pmd_pfe_probeFunction · 0.85

Calls 11

rte_eth_vdev_allocateFunction · 0.85
rte_spinlock_initFunction · 0.85
rte_zmallocFunction · 0.85
pfe_dev_set_mac_addrFunction · 0.85
rte_ether_addr_copyFunction · 0.85
pfe_eth_stopFunction · 0.85
pfe_gemac_initFunction · 0.85
pfe_eth_open_cdevFunction · 0.85
rte_eth_dev_release_portFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected