Lines Matching refs:slave_dev
2474 static int dsa_slave_phy_connect(struct net_device *slave_dev, int addr, in dsa_slave_phy_connect() argument
2477 struct dsa_port *dp = dsa_slave_to_port(slave_dev); in dsa_slave_phy_connect()
2480 slave_dev->phydev = mdiobus_get_phy(ds->slave_mii_bus, addr); in dsa_slave_phy_connect()
2481 if (!slave_dev->phydev) { in dsa_slave_phy_connect()
2482 netdev_err(slave_dev, "no phy at %d\n", addr); in dsa_slave_phy_connect()
2486 slave_dev->phydev->dev_flags |= flags; in dsa_slave_phy_connect()
2488 return phylink_connect_phy(dp->pl, slave_dev->phydev); in dsa_slave_phy_connect()
2491 static int dsa_slave_phy_setup(struct net_device *slave_dev) in dsa_slave_phy_setup() argument
2493 struct dsa_port *dp = dsa_slave_to_port(slave_dev); in dsa_slave_phy_setup()
2499 dp->pl_config.dev = &slave_dev->dev; in dsa_slave_phy_setup()
2523 ret = dsa_slave_phy_connect(slave_dev, dp->index, phy_flags); in dsa_slave_phy_setup()
2526 netdev_err(slave_dev, "failed to connect to PHY: %pe\n", in dsa_slave_phy_setup()
2562 int dsa_slave_suspend(struct net_device *slave_dev) in dsa_slave_suspend() argument
2564 struct dsa_port *dp = dsa_slave_to_port(slave_dev); in dsa_slave_suspend()
2566 if (!netif_running(slave_dev)) in dsa_slave_suspend()
2569 netif_device_detach(slave_dev); in dsa_slave_suspend()
2578 int dsa_slave_resume(struct net_device *slave_dev) in dsa_slave_resume() argument
2580 struct dsa_port *dp = dsa_slave_to_port(slave_dev); in dsa_slave_resume()
2582 if (!netif_running(slave_dev)) in dsa_slave_resume()
2585 netif_device_attach(slave_dev); in dsa_slave_resume()
2598 struct net_device *slave_dev; in dsa_slave_create() local
2615 slave_dev = alloc_netdev_mqs(sizeof(struct dsa_slave_priv), name, in dsa_slave_create()
2618 if (slave_dev == NULL) in dsa_slave_create()
2621 slave_dev->rtnl_link_ops = &dsa_link_ops; in dsa_slave_create()
2622 slave_dev->ethtool_ops = &dsa_slave_ethtool_ops; in dsa_slave_create()
2624 slave_dev->dcbnl_ops = &dsa_slave_dcbnl_ops; in dsa_slave_create()
2627 eth_hw_addr_set(slave_dev, port->mac); in dsa_slave_create()
2629 eth_hw_addr_inherit(slave_dev, master); in dsa_slave_create()
2630 slave_dev->priv_flags |= IFF_NO_QUEUE; in dsa_slave_create()
2632 slave_dev->priv_flags |= IFF_UNICAST_FLT; in dsa_slave_create()
2633 slave_dev->netdev_ops = &dsa_slave_netdev_ops; in dsa_slave_create()
2635 slave_dev->max_mtu = ds->ops->port_max_mtu(ds, port->index); in dsa_slave_create()
2636 SET_NETDEV_DEVTYPE(slave_dev, &dsa_type); in dsa_slave_create()
2638 SET_NETDEV_DEV(slave_dev, port->ds->dev); in dsa_slave_create()
2639 SET_NETDEV_DEVLINK_PORT(slave_dev, &port->devlink_port); in dsa_slave_create()
2640 slave_dev->dev.of_node = port->dn; in dsa_slave_create()
2641 slave_dev->vlan_features = master->vlan_features; in dsa_slave_create()
2643 p = netdev_priv(slave_dev); in dsa_slave_create()
2644 slave_dev->tstats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats); in dsa_slave_create()
2645 if (!slave_dev->tstats) { in dsa_slave_create()
2646 free_netdev(slave_dev); in dsa_slave_create()
2650 ret = gro_cells_init(&p->gcells, slave_dev); in dsa_slave_create()
2656 port->slave = slave_dev; in dsa_slave_create()
2657 dsa_slave_setup_tagger(slave_dev); in dsa_slave_create()
2659 netif_carrier_off(slave_dev); in dsa_slave_create()
2661 ret = dsa_slave_phy_setup(slave_dev); in dsa_slave_create()
2663 netdev_err(slave_dev, in dsa_slave_create()
2671 ret = dsa_slave_change_mtu(slave_dev, ETH_DATA_LEN); in dsa_slave_create()
2676 ret = register_netdevice(slave_dev); in dsa_slave_create()
2679 ret, slave_dev->name); in dsa_slave_create()
2685 ret = dsa_slave_dcbnl_init(slave_dev); in dsa_slave_create()
2687 netdev_err(slave_dev, in dsa_slave_create()
2695 ret = netdev_upper_dev_link(master, slave_dev, NULL); in dsa_slave_create()
2705 unregister_netdev(slave_dev); in dsa_slave_create()
2714 free_percpu(slave_dev->tstats); in dsa_slave_create()
2715 free_netdev(slave_dev); in dsa_slave_create()
2720 void dsa_slave_destroy(struct net_device *slave_dev) in dsa_slave_destroy() argument
2722 struct net_device *master = dsa_slave_to_master(slave_dev); in dsa_slave_destroy()
2723 struct dsa_port *dp = dsa_slave_to_port(slave_dev); in dsa_slave_destroy()
2724 struct dsa_slave_priv *p = netdev_priv(slave_dev); in dsa_slave_destroy()
2726 netif_carrier_off(slave_dev); in dsa_slave_destroy()
2728 netdev_upper_dev_unlink(master, slave_dev); in dsa_slave_destroy()
2729 unregister_netdevice(slave_dev); in dsa_slave_destroy()
2735 free_percpu(slave_dev->tstats); in dsa_slave_destroy()
2736 free_netdev(slave_dev); in dsa_slave_destroy()