]> Git Repo - linux.git/blame - net/dsa/dsa_priv.h
net: dsa: better scoping of slave functions
[linux.git] / net / dsa / dsa_priv.h
CommitLineData
91da11f8
LB
1/*
2 * net/dsa/dsa_priv.h - Hardware switch handling
e84665c9 3 * Copyright (c) 2008-2009 Marvell Semiconductor
91da11f8
LB
4 *
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 */
10
11#ifndef __DSA_PRIV_H
12#define __DSA_PRIV_H
13
91da11f8 14#include <linux/phy.h>
5075314e 15#include <linux/netdevice.h>
04ff53f9 16#include <linux/netpoll.h>
ea5dd34b 17#include <net/dsa.h>
5075314e 18
52c96f9d 19enum {
1faabf74 20 DSA_NOTIFIER_AGEING_TIME,
52c96f9d
VD
21 DSA_NOTIFIER_BRIDGE_JOIN,
22 DSA_NOTIFIER_BRIDGE_LEAVE,
685fb6a4
VD
23 DSA_NOTIFIER_FDB_ADD,
24 DSA_NOTIFIER_FDB_DEL,
8ae5bcdc
VD
25 DSA_NOTIFIER_MDB_ADD,
26 DSA_NOTIFIER_MDB_DEL,
d0c627b8
VD
27 DSA_NOTIFIER_VLAN_ADD,
28 DSA_NOTIFIER_VLAN_DEL,
52c96f9d
VD
29};
30
1faabf74
VD
31/* DSA_NOTIFIER_AGEING_TIME */
32struct dsa_notifier_ageing_time_info {
33 struct switchdev_trans *trans;
34 unsigned int ageing_time;
1faabf74
VD
35};
36
52c96f9d
VD
37/* DSA_NOTIFIER_BRIDGE_* */
38struct dsa_notifier_bridge_info {
39 struct net_device *br;
40 int sw_index;
41 int port;
42};
43
685fb6a4
VD
44/* DSA_NOTIFIER_FDB_* */
45struct dsa_notifier_fdb_info {
685fb6a4
VD
46 int sw_index;
47 int port;
2acf4e6a
AS
48 const unsigned char *addr;
49 u16 vid;
685fb6a4
VD
50};
51
8ae5bcdc
VD
52/* DSA_NOTIFIER_MDB_* */
53struct dsa_notifier_mdb_info {
54 const struct switchdev_obj_port_mdb *mdb;
55 struct switchdev_trans *trans;
56 int sw_index;
57 int port;
58};
59
d0c627b8
VD
60/* DSA_NOTIFIER_VLAN_* */
61struct dsa_notifier_vlan_info {
62 const struct switchdev_obj_port_vlan *vlan;
63 struct switchdev_trans *trans;
64 int sw_index;
65 int port;
66};
67
91da11f8 68struct dsa_slave_priv {
73a7ece8 69 /* Copy of dp->ds->dst->tag_ops->xmit for faster access in hot path */
4ed70ce9 70 struct sk_buff * (*xmit)(struct sk_buff *skb,
5075314e 71 struct net_device *dev);
e84665c9 72
5f6b4e14 73 struct pcpu_sw_netstats *stats64;
f613ed66 74
afdcf151
VD
75 /* DSA port data, such as switch, port index, etc. */
76 struct dsa_port *dp;
e84665c9
LB
77
78 /*
79 * The phylib phy_device pointer for the PHY connected
80 * to this port.
81 */
91da11f8 82 struct phy_device *phy;
0d8bcdd3
FF
83 phy_interface_t phy_interface;
84 int old_link;
85 int old_pause;
86 int old_duplex;
b73adef6 87
04ff53f9
FF
88#ifdef CONFIG_NET_POLL_CONTROLLER
89 struct netpoll *netpoll;
90#endif
f50f2127
FF
91
92 /* TC context */
93 struct list_head mall_tc_list;
91da11f8
LB
94};
95
91da11f8 96/* dsa.c */
47d0dcc3 97int dsa_cpu_dsa_setup(struct dsa_port *port);
293784a8 98void dsa_cpu_dsa_destroy(struct dsa_port *dport);
39a7f2a4 99const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
c9eb3e0f 100bool dsa_schedule_work(struct work_struct *work);
91da11f8 101
a6a71f19
VD
102/* legacy.c */
103int dsa_legacy_register(void);
104void dsa_legacy_unregister(void);
37b8da1a
AS
105int dsa_legacy_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
106 struct net_device *dev,
107 const unsigned char *addr, u16 vid,
108 u16 flags);
109int dsa_legacy_fdb_del(struct ndmsg *ndm, struct nlattr *tb[],
110 struct net_device *dev,
111 const unsigned char *addr, u16 vid);
a6a71f19 112
f2f23566
VD
113/* master.c */
114int dsa_master_ethtool_setup(struct net_device *dev);
115void dsa_master_ethtool_restore(struct net_device *dev);
116
a40c175b
VD
117/* port.c */
118int dsa_port_set_state(struct dsa_port *dp, u8 state,
119 struct switchdev_trans *trans);
120void dsa_port_set_state_now(struct dsa_port *dp, u8 state);
cfbed329
VD
121int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br);
122void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
4d61d304
VD
123int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
124 struct switchdev_trans *trans);
d87bd94e
VD
125int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
126 struct switchdev_trans *trans);
2acf4e6a
AS
127int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
128 u16 vid);
129int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
130 u16 vid);
3a9afea3
VD
131int dsa_port_mdb_add(struct dsa_port *dp,
132 const struct switchdev_obj_port_mdb *mdb,
133 struct switchdev_trans *trans);
134int dsa_port_mdb_del(struct dsa_port *dp,
135 const struct switchdev_obj_port_mdb *mdb);
076e7133
VD
136int dsa_port_vlan_add(struct dsa_port *dp,
137 const struct switchdev_obj_port_vlan *vlan,
138 struct switchdev_trans *trans);
139int dsa_port_vlan_del(struct dsa_port *dp,
140 const struct switchdev_obj_port_vlan *vlan);
91da11f8 141/* slave.c */
5075314e 142extern const struct dsa_device_ops notag_netdev_ops;
91da11f8 143void dsa_slave_mii_bus_init(struct dsa_switch *ds);
4cfbf09c 144int dsa_slave_create(struct dsa_port *port, const char *name);
cda5c15b 145void dsa_slave_destroy(struct net_device *slave_dev);
24462549
FF
146int dsa_slave_suspend(struct net_device *slave_dev);
147int dsa_slave_resume(struct net_device *slave_dev);
88e4f0ca
VD
148int dsa_slave_register_notifier(void);
149void dsa_slave_unregister_notifier(void);
91da11f8 150
f515f192
VD
151/* switch.c */
152int dsa_switch_register_notifier(struct dsa_switch *ds);
153void dsa_switch_unregister_notifier(struct dsa_switch *ds);
154
eb7b7211
AL
155/* tag_brcm.c */
156extern const struct dsa_device_ops brcm_netdev_ops;
157
cf85d08f 158/* tag_dsa.c */
3e8a72d1 159extern const struct dsa_device_ops dsa_netdev_ops;
cf85d08f 160
91da11f8 161/* tag_edsa.c */
3e8a72d1 162extern const struct dsa_device_ops edsa_netdev_ops;
91da11f8 163
8b8010fb
WH
164/* tag_ksz.c */
165extern const struct dsa_device_ops ksz_netdev_ops;
166
eb7b7211
AL
167/* tag_lan9303.c */
168extern const struct dsa_device_ops lan9303_netdev_ops;
396138f0 169
eb7b7211
AL
170/* tag_mtk.c */
171extern const struct dsa_device_ops mtk_netdev_ops;
5037d532 172
cafdc45c
JC
173/* tag_qca.c */
174extern const struct dsa_device_ops qca_netdev_ops;
91da11f8 175
eb7b7211
AL
176/* tag_trailer.c */
177extern const struct dsa_device_ops trailer_netdev_ops;
e8fe177a 178
6d3c8c0d
FF
179static inline struct net_device *dsa_master_netdev(struct dsa_slave_priv *p)
180{
a29342e7 181 return p->dp->cpu_dp->netdev;
6d3c8c0d
FF
182}
183
3cc9f257
FF
184static inline struct dsa_port *dsa_get_cpu_port(struct dsa_switch_tree *dst)
185{
186 return dst->cpu_dp;
187}
188
91da11f8 189#endif
This page took 0.577196 seconds and 4 git commands to generate.