Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
[linux-2.6/mini2440.git] / net / dsa / dsa_priv.h
blob7063378a1ebf04559eadc46b3e2e42b89764c4bf
1 /*
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.
9 */
11 #ifndef __DSA_PRIV_H
12 #define __DSA_PRIV_H
14 #include <linux/list.h>
15 #include <linux/phy.h>
16 #include <linux/timer.h>
17 #include <linux/workqueue.h>
18 #include <net/dsa.h>
20 struct dsa_switch {
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;
37 __be16 tag_protocol;
40 * Slave mii_bus and devices for the individual ports.
42 int cpu_port;
43 u32 valid_port_mask;
44 struct mii_bus *slave_mii_bus;
45 struct net_device *ports[DSA_MAX_PORTS];
48 * Link state polling.
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;
57 int port;
58 struct phy_device *phy;
61 struct dsa_switch_driver {
62 struct list_head list;
64 __be16 tag_protocol;
65 int priv_size;
68 * Probing and setup.
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,
79 int regnum, u16 val);
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);
95 /* dsa.c */
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);
100 /* slave.c */
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);
106 /* tag_dsa.c */
107 int dsa_xmit(struct sk_buff *skb, struct net_device *dev);
109 /* tag_edsa.c */
110 int edsa_xmit(struct sk_buff *skb, struct net_device *dev);
112 /* tag_trailer.c */
113 int trailer_xmit(struct sk_buff *skb, struct net_device *dev);
116 #endif