Lines Matching refs:ds
50 static int dsa_loop_setup_devlink_resources(struct dsa_switch *ds)
53 struct dsa_loop_priv *ps = ds->priv;
60 err = dsa_devlink_resource_register(ds, "VTU", ARRAY_SIZE(ps->vlans),
67 dsa_devlink_resource_occ_get_register(ds,
74 dsa_devlink_resources_unregister(ds);
78 static enum dsa_tag_protocol dsa_loop_get_protocol(struct dsa_switch *ds,
82 dev_dbg(ds->dev, "%s: port: %d\n", __func__, port);
87 static int dsa_loop_setup(struct dsa_switch *ds)
89 struct dsa_loop_priv *ps = ds->priv;
92 for (i = 0; i < ds->num_ports; i++)
96 dev_dbg(ds->dev, "%s\n", __func__);
98 return dsa_loop_setup_devlink_resources(ds);
101 static void dsa_loop_teardown(struct dsa_switch *ds)
103 dsa_devlink_resources_unregister(ds);
106 static int dsa_loop_get_sset_count(struct dsa_switch *ds, int port, int sset)
114 static void dsa_loop_get_strings(struct dsa_switch *ds, int port,
117 struct dsa_loop_priv *ps = ds->priv;
127 static void dsa_loop_get_ethtool_stats(struct dsa_switch *ds, int port,
130 struct dsa_loop_priv *ps = ds->priv;
137 static int dsa_loop_phy_read(struct dsa_switch *ds, int port, int regnum)
139 struct dsa_loop_priv *ps = ds->priv;
152 static int dsa_loop_phy_write(struct dsa_switch *ds, int port,
155 struct dsa_loop_priv *ps = ds->priv;
168 static int dsa_loop_port_bridge_join(struct dsa_switch *ds, int port,
173 dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
179 static void dsa_loop_port_bridge_leave(struct dsa_switch *ds, int port,
182 dev_dbg(ds->dev, "%s: port: %d, bridge: %s\n",
186 static void dsa_loop_port_stp_state_set(struct dsa_switch *ds, int port,
189 dev_dbg(ds->dev, "%s: port: %d, state: %d\n",
193 static int dsa_loop_port_vlan_filtering(struct dsa_switch *ds, int port,
197 dev_dbg(ds->dev, "%s: port: %d, vlan_filtering: %d\n",
203 static int dsa_loop_port_vlan_add(struct dsa_switch *ds, int port,
209 struct dsa_loop_priv *ps = ds->priv;
227 dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
236 static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
240 struct dsa_loop_priv *ps = ds->priv;
257 dev_dbg(ds->dev, "%s: port: %d vlan: %d, %stagged, pvid: %d\n",
264 static int dsa_loop_port_change_mtu(struct dsa_switch *ds, int port,
267 struct dsa_loop_priv *priv = ds->priv;
274 static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port)
312 struct dsa_switch *ds;
318 ds = devm_kzalloc(&mdiodev->dev, sizeof(*ds), GFP_KERNEL);
319 if (!ds)
322 ds->dev = &mdiodev->dev;
323 ds->num_ports = DSA_LOOP_NUM_PORTS;
335 ds->dev = &mdiodev->dev;
336 ds->ops = &dsa_loop_driver;
337 ds->priv = ps;
340 dev_set_drvdata(&mdiodev->dev, ds);
342 ret = dsa_register_switch(ds);
352 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
355 if (!ds)
358 ps = ds->priv;
360 dsa_unregister_switch(ds);
366 struct dsa_switch *ds = dev_get_drvdata(&mdiodev->dev);
368 if (!ds)
371 dsa_switch_shutdown(ds);