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

Function pfe_get_gemac_if_proprties

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

Source from the content-addressed store, hash-verified

840}
841
842static int
843pfe_get_gemac_if_proprties(struct pfe *pfe,
844 __rte_unused const struct device_node *parent,
845 unsigned int port, unsigned int if_cnt,
846 struct ls1012a_pfe_platform_data *pdata)
847{
848 const struct device_node *gem = NULL;
849 size_t size;
850 unsigned int ii = 0, phy_id = 0;
851 const u32 *addr;
852 const void *mac_addr;
853
854 for (ii = 0; ii < if_cnt; ii++) {
855 gem = of_get_next_child(parent, gem);
856 if (!gem)
857 goto err;
858 addr = of_get_property(gem, "reg", &size);
859 if (addr && (rte_be_to_cpu_32((unsigned int)*addr) == port))
860 break;
861 }
862
863 if (ii >= if_cnt) {
864 PFE_PMD_ERR("Failed to find interface = %d", if_cnt);
865 goto err;
866 }
867
868 pdata->ls1012a_eth_pdata[port].gem_id = port;
869
870 mac_addr = of_get_mac_address(gem);
871
872 if (mac_addr) {
873 memcpy(pdata->ls1012a_eth_pdata[port].mac_addr, mac_addr,
874 ETH_ALEN);
875 }
876
877 addr = of_get_property(gem, "fsl,mdio-mux-val", &size);
878 if (!addr) {
879 PFE_PMD_ERR("Invalid mdio-mux-val....");
880 } else {
881 phy_id = rte_be_to_cpu_32((unsigned int)*addr);
882 pdata->ls1012a_eth_pdata[port].mdio_muxval = phy_id;
883 }
884 if (pdata->ls1012a_eth_pdata[port].phy_id < 32)
885 pfe->mdio_muxval[pdata->ls1012a_eth_pdata[port].phy_id] =
886 pdata->ls1012a_eth_pdata[port].mdio_muxval;
887
888 return 0;
889
890err:
891 return -1;
892}
893
894/* Parse integer from integer argument */
895static int

Callers 1

pmd_pfe_probeFunction · 0.85

Calls 4

of_get_next_childFunction · 0.85
of_get_propertyFunction · 0.85
of_get_mac_addressFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected