2 * net/dsa/dsa_priv.h - Hardware switch handling
3 * Copyright (c) 2008 Marvell Semiconductor
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
14 #include <linux/list.h>
15 #include <linux/phy.h>
16 #include <linux/timer.h>
17 #include <linux/workqueue.h>
22 * Configuration data for the platform device that owns
23 * this dsa switch instance.
25 struct dsa_platform_data *pd;
28 * References to network device and mii bus to use.
30 struct net_device *master_netdev;
31 struct mii_bus *master_mii_bus;
34 * The used switch driver and frame tagging type.
36 struct dsa_switch_driver *drv;
40 * Slave mii_bus and devices for the individual ports.
44 struct mii_bus *slave_mii_bus;
45 struct net_device *ports[DSA_MAX_PORTS];
50 struct work_struct link_poll_work;
51 struct timer_list link_poll_timer;
54 struct dsa_slave_priv {
55 struct net_device *dev;
56 struct dsa_switch *parent;
58 struct phy_device *phy;
61 struct dsa_switch_driver {
62 struct list_head list;
70 char *(*probe)(struct mii_bus *bus, int sw_addr);
71 int (*setup)(struct dsa_switch *ds);
72 int (*set_addr)(struct dsa_switch *ds, u8 *addr);
75 * Access to the switch's PHY registers.
77 int (*phy_read)(struct dsa_switch *ds, int port, int regnum);
78 int (*phy_write)(struct dsa_switch *ds, int port,
82 * Link state polling and IRQ handling.
84 void (*poll_link)(struct dsa_switch *ds);
87 * ethtool hardware statistics.
89 void (*get_strings)(struct dsa_switch *ds, int port, uint8_t *data);
90 void (*get_ethtool_stats)(struct dsa_switch *ds,
91 int port, uint64_t *data);
92 int (*get_sset_count)(struct dsa_switch *ds);
96 extern char dsa_driver_version[];
97 void register_switch_driver(struct dsa_switch_driver *type);
98 void unregister_switch_driver(struct dsa_switch_driver *type);
101 void dsa_slave_mii_bus_init(struct dsa_switch *ds);
102 struct net_device *dsa_slave_create(struct dsa_switch *ds,
103 struct device *parent,
104 int port, char *name);
107 int dsa_xmit(struct sk_buff *skb, struct net_device *dev);
110 int edsa_xmit(struct sk_buff *skb, struct net_device *dev);
113 int trailer_xmit(struct sk_buff *skb, struct net_device *dev);