Lines Matching full:ed
1186 static int fun_init_vports(struct fun_ethdev *ed, unsigned int n) in fun_init_vports() argument
1188 if (ed->num_vports) in fun_init_vports()
1191 ed->vport_info = kvcalloc(n, sizeof(*ed->vport_info), GFP_KERNEL); in fun_init_vports()
1192 if (!ed->vport_info) in fun_init_vports()
1194 ed->num_vports = n; in fun_init_vports()
1198 static void fun_free_vports(struct fun_ethdev *ed) in fun_free_vports() argument
1200 kvfree(ed->vport_info); in fun_free_vports()
1201 ed->vport_info = NULL; in fun_free_vports()
1202 ed->num_vports = 0; in fun_free_vports()
1205 static struct fun_vport_info *fun_get_vport(struct fun_ethdev *ed, in fun_get_vport() argument
1208 if (!ed->vport_info || vport >= ed->num_vports) in fun_get_vport()
1211 return ed->vport_info + vport; in fun_get_vport()
1219 struct fun_ethdev *ed = to_fun_ethdev(fdev); in fun_set_vf_mac() local
1226 mutex_lock(&ed->state_mutex); in fun_set_vf_mac()
1227 vi = fun_get_vport(ed, vf); in fun_set_vf_mac()
1237 mutex_unlock(&ed->state_mutex); in fun_set_vf_mac()
1247 struct fun_ethdev *ed = to_fun_ethdev(fdev); in fun_set_vf_vlan() local
1257 mutex_lock(&ed->state_mutex); in fun_set_vf_vlan()
1258 vi = fun_get_vport(ed, vf); in fun_set_vf_vlan()
1271 mutex_unlock(&ed->state_mutex); in fun_set_vf_vlan()
1281 struct fun_ethdev *ed = to_fun_ethdev(fdev); in fun_set_vf_rate() local
1288 mutex_lock(&ed->state_mutex); in fun_set_vf_rate()
1289 vi = fun_get_vport(ed, vf); in fun_set_vf_rate()
1298 mutex_unlock(&ed->state_mutex); in fun_set_vf_rate()
1306 struct fun_ethdev *ed = to_fun_ethdev(fp->fdev); in fun_get_vf_config() local
1309 mutex_lock(&ed->state_mutex); in fun_get_vf_config()
1310 vi = fun_get_vport(ed, vf); in fun_get_vf_config()
1323 mutex_unlock(&ed->state_mutex); in fun_get_vf_config()
1530 static int fun_max_qs(struct fun_ethdev *ed, unsigned int *ntx, in fun_max_qs() argument
1535 if (ed->num_ports > 1 || is_kdump_kernel()) { in fun_max_qs()
1541 neth = fun_get_res_count(&ed->fdev, FUN_ADMIN_OP_ETH); in fun_max_qs()
1552 *ntx = min(ed->nsqs_per_port - 1, num_online_cpus()); in fun_max_qs()
1707 static int fun_create_netdev(struct fun_ethdev *ed, unsigned int portid) in fun_create_netdev() argument
1709 struct fun_dev *fdev = &ed->fdev; in fun_create_netdev()
1715 rc = fun_max_qs(ed, &ntx, &nrx); in fun_create_netdev()
1726 fun_queue_defaults(netdev, ed->nsqs_per_port); in fun_create_netdev()
1798 ed->netdevs[portid] = netdev; in fun_create_netdev()
1805 ed->netdevs[portid] = NULL; in fun_create_netdev()
1835 static int fun_create_ports(struct fun_ethdev *ed, unsigned int nports) in fun_create_ports() argument
1837 struct fun_dev *fd = &ed->fdev; in fun_create_ports()
1841 ed->nsqs_per_port = min(fd->num_irqs - 1, in fun_create_ports()
1843 if (ed->nsqs_per_port < 2) { in fun_create_ports()
1848 ed->netdevs = kcalloc(nports, sizeof(*ed->netdevs), GFP_KERNEL); in fun_create_ports()
1849 if (!ed->netdevs) in fun_create_ports()
1852 ed->num_ports = nports; in fun_create_ports()
1854 rc = fun_create_netdev(ed, i); in fun_create_ports()
1863 fun_destroy_netdev(ed->netdevs[--i]); in fun_create_ports()
1864 kfree(ed->netdevs); in fun_create_ports()
1865 ed->netdevs = NULL; in fun_create_ports()
1866 ed->num_ports = 0; in fun_create_ports()
1870 static void fun_destroy_ports(struct fun_ethdev *ed) in fun_destroy_ports() argument
1874 for (i = 0; i < ed->num_ports; i++) in fun_destroy_ports()
1875 fun_destroy_netdev(ed->netdevs[i]); in fun_destroy_ports()
1877 kfree(ed->netdevs); in fun_destroy_ports()
1878 ed->netdevs = NULL; in fun_destroy_ports()
1879 ed->num_ports = 0; in fun_destroy_ports()
1882 static void fun_update_link_state(const struct fun_ethdev *ed, in fun_update_link_state() argument
1889 if (port_idx >= ed->num_ports) in fun_update_link_state()
1892 netdev = ed->netdevs[port_idx]; in fun_update_link_state()
1942 struct fun_ethdev *ed = to_fun_ethdev(fdev); in fun_service_cb() local
1946 fun_destroy_ports(ed); in fun_service_cb()
1952 if (rc < 0 || rc == ed->num_ports) in fun_service_cb()
1955 if (ed->num_ports) in fun_service_cb()
1956 fun_destroy_ports(ed); in fun_service_cb()
1958 fun_create_ports(ed, rc); in fun_service_cb()
1964 struct fun_ethdev *ed = to_fun_ethdev(fdev); in funeth_sriov_configure() local
1974 mutex_lock(&ed->state_mutex); in funeth_sriov_configure()
1975 fun_free_vports(ed); in funeth_sriov_configure()
1976 mutex_unlock(&ed->state_mutex); in funeth_sriov_configure()
1985 mutex_lock(&ed->state_mutex); in funeth_sriov_configure()
1986 rc = fun_init_vports(ed, nvfs); in funeth_sriov_configure()
1987 mutex_unlock(&ed->state_mutex); in funeth_sriov_configure()
2009 struct fun_ethdev *ed; in funeth_probe() local
2019 ed = devlink_priv(devlink); in funeth_probe()
2020 mutex_init(&ed->state_mutex); in funeth_probe()
2022 fdev = &ed->fdev; in funeth_probe()
2029 rc = fun_create_ports(ed, rc); in funeth_probe()
2040 mutex_destroy(&ed->state_mutex); in funeth_probe()
2049 struct fun_ethdev *ed; in funeth_remove() local
2051 ed = to_fun_ethdev(fdev); in funeth_remove()
2052 devlink = priv_to_devlink(ed); in funeth_remove()
2060 fun_destroy_ports(ed); in funeth_remove()
2062 mutex_destroy(&ed->state_mutex); in funeth_remove()