Lines Matching refs:dev
19 static int dsa_master_get_regs_len(struct net_device *dev) in dsa_master_get_regs_len() argument
21 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_regs_len()
29 len = ops->get_regs_len(dev); in dsa_master_get_regs_len()
48 static void dsa_master_get_regs(struct net_device *dev, in dsa_master_get_regs() argument
51 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_regs()
60 len = ops->get_regs_len(dev); in dsa_master_get_regs()
64 ops->get_regs(dev, regs, data); in dsa_master_get_regs()
83 static void dsa_master_get_ethtool_stats(struct net_device *dev, in dsa_master_get_ethtool_stats() argument
87 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_ethtool_stats()
94 count = ops->get_sset_count(dev, ETH_SS_STATS); in dsa_master_get_ethtool_stats()
95 ops->get_ethtool_stats(dev, stats, data); in dsa_master_get_ethtool_stats()
102 static void dsa_master_get_ethtool_phy_stats(struct net_device *dev, in dsa_master_get_ethtool_phy_stats() argument
106 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_ethtool_phy_stats()
112 if (dev->phydev && !ops->get_ethtool_phy_stats) { in dsa_master_get_ethtool_phy_stats()
113 count = phy_ethtool_get_sset_count(dev->phydev); in dsa_master_get_ethtool_phy_stats()
115 phy_ethtool_get_stats(dev->phydev, stats, data); in dsa_master_get_ethtool_phy_stats()
117 count = ops->get_sset_count(dev, ETH_SS_PHY_STATS); in dsa_master_get_ethtool_phy_stats()
118 ops->get_ethtool_phy_stats(dev, stats, data); in dsa_master_get_ethtool_phy_stats()
128 static int dsa_master_get_sset_count(struct net_device *dev, int sset) in dsa_master_get_sset_count() argument
130 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_sset_count()
135 if (sset == ETH_SS_PHY_STATS && dev->phydev && in dsa_master_get_sset_count()
137 count = phy_ethtool_get_sset_count(dev->phydev); in dsa_master_get_sset_count()
139 count = ops->get_sset_count(dev, sset); in dsa_master_get_sset_count()
150 static void dsa_master_get_strings(struct net_device *dev, uint32_t stringset, in dsa_master_get_strings() argument
153 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_get_strings()
166 if (stringset == ETH_SS_PHY_STATS && dev->phydev && in dsa_master_get_strings()
168 mcount = phy_ethtool_get_sset_count(dev->phydev); in dsa_master_get_strings()
172 phy_ethtool_get_strings(dev->phydev, data); in dsa_master_get_strings()
174 mcount = ops->get_sset_count(dev, stringset); in dsa_master_get_strings()
177 ops->get_strings(dev, stringset, data); in dsa_master_get_strings()
201 int __dsa_master_hwtstamp_validate(struct net_device *dev, in __dsa_master_hwtstamp_validate() argument
205 struct dsa_port *cpu_dp = dev->dsa_ptr; in __dsa_master_hwtstamp_validate()
223 static int dsa_master_ethtool_setup(struct net_device *dev) in dsa_master_ethtool_setup() argument
225 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_ethtool_setup()
229 if (netif_is_lag_master(dev)) in dsa_master_ethtool_setup()
232 ops = devm_kzalloc(ds->dev, sizeof(*ops), GFP_KERNEL); in dsa_master_ethtool_setup()
236 cpu_dp->orig_ethtool_ops = dev->ethtool_ops; in dsa_master_ethtool_setup()
247 dev->ethtool_ops = ops; in dsa_master_ethtool_setup()
252 static void dsa_master_ethtool_teardown(struct net_device *dev) in dsa_master_ethtool_teardown() argument
254 struct dsa_port *cpu_dp = dev->dsa_ptr; in dsa_master_ethtool_teardown()
256 if (netif_is_lag_master(dev)) in dsa_master_ethtool_teardown()
259 dev->ethtool_ops = cpu_dp->orig_ethtool_ops; in dsa_master_ethtool_teardown()
268 static void dsa_master_set_promiscuity(struct net_device *dev, int inc) in dsa_master_set_promiscuity() argument
270 const struct dsa_device_ops *ops = dev->dsa_ptr->tag_ops; in dsa_master_set_promiscuity()
272 if ((dev->priv_flags & IFF_UNICAST_FLT) && !ops->promisc_on_master) in dsa_master_set_promiscuity()
277 dev_set_promiscuity(dev, inc); in dsa_master_set_promiscuity()
283 struct net_device *dev = to_net_dev(d); in tagging_show() local
284 struct dsa_port *cpu_dp = dev->dsa_ptr; in tagging_show()
295 struct net_device *dev = to_net_dev(d); in tagging_store() local
296 struct dsa_port *cpu_dp = dev->dsa_ptr; in tagging_store()
349 static void dsa_master_reset_mtu(struct net_device *dev) in dsa_master_reset_mtu() argument
353 err = dev_set_mtu(dev, ETH_DATA_LEN); in dsa_master_reset_mtu()
355 netdev_dbg(dev, in dsa_master_reset_mtu()
359 int dsa_master_setup(struct net_device *dev, struct dsa_port *cpu_dp) in dsa_master_setup() argument
369 if (!netif_is_lag_master(dev)) { in dsa_master_setup()
370 consumer_link = device_link_add(ds->dev, dev->dev.parent, in dsa_master_setup()
373 netdev_err(dev, in dsa_master_setup()
375 dev_name(ds->dev)); in dsa_master_setup()
382 ret = dev_set_mtu(dev, mtu); in dsa_master_setup()
384 netdev_warn(dev, "error %d setting MTU to %d to include DSA overhead\n", in dsa_master_setup()
393 dev->dsa_ptr = cpu_dp; in dsa_master_setup()
395 dsa_master_set_promiscuity(dev, 1); in dsa_master_setup()
397 ret = dsa_master_ethtool_setup(dev); in dsa_master_setup()
401 ret = sysfs_create_group(&dev->dev.kobj, &dsa_group); in dsa_master_setup()
408 dsa_master_ethtool_teardown(dev); in dsa_master_setup()
410 dsa_master_set_promiscuity(dev, -1); in dsa_master_setup()
414 void dsa_master_teardown(struct net_device *dev) in dsa_master_teardown() argument
416 sysfs_remove_group(&dev->dev.kobj, &dsa_group); in dsa_master_teardown()
417 dsa_master_ethtool_teardown(dev); in dsa_master_teardown()
418 dsa_master_reset_mtu(dev); in dsa_master_teardown()
419 dsa_master_set_promiscuity(dev, -1); in dsa_master_teardown()
421 dev->dsa_ptr = NULL; in dsa_master_teardown()