]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - net/dsa/dsa_priv.h
net: dsa: add FDB notifier
[mirror_ubuntu-bionic-kernel.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,
52c96f9d
VD
25};
26
1faabf74
VD
27/* DSA_NOTIFIER_AGEING_TIME */
28struct dsa_notifier_ageing_time_info {
29 struct switchdev_trans *trans;
30 unsigned int ageing_time;
31 int sw_index;
32};
33
52c96f9d
VD
34/* DSA_NOTIFIER_BRIDGE_* */
35struct dsa_notifier_bridge_info {
36 struct net_device *br;
37 int sw_index;
38 int port;
39};
40
685fb6a4
VD
41/* DSA_NOTIFIER_FDB_* */
42struct dsa_notifier_fdb_info {
43 const struct switchdev_obj_port_fdb *fdb;
44 struct switchdev_trans *trans;
45 int sw_index;
46 int port;
47};
48
5075314e 49struct dsa_device_ops {
4ed70ce9 50 struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev);
a86d8bec
FF
51 struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,
52 struct packet_type *pt,
53 struct net_device *orig_dev);
5075314e 54};
91da11f8 55
91da11f8 56struct dsa_slave_priv {
4ed70ce9 57 struct sk_buff * (*xmit)(struct sk_buff *skb,
5075314e 58 struct net_device *dev);
e84665c9 59
afdcf151
VD
60 /* DSA port data, such as switch, port index, etc. */
61 struct dsa_port *dp;
e84665c9
LB
62
63 /*
64 * The phylib phy_device pointer for the PHY connected
65 * to this port.
66 */
91da11f8 67 struct phy_device *phy;
0d8bcdd3
FF
68 phy_interface_t phy_interface;
69 int old_link;
70 int old_pause;
71 int old_duplex;
b73adef6 72
04ff53f9
FF
73#ifdef CONFIG_NET_POLL_CONTROLLER
74 struct netpoll *netpoll;
75#endif
f50f2127
FF
76
77 /* TC context */
78 struct list_head mall_tc_list;
91da11f8
LB
79};
80
91da11f8 81/* dsa.c */
9b8e895c 82int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
293784a8
FF
83 struct dsa_port *dport, int port);
84void dsa_cpu_dsa_destroy(struct dsa_port *dport);
39a7f2a4 85const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
0c73c523
FF
86int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
87void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
91da11f8 88
a6a71f19
VD
89/* legacy.c */
90int dsa_legacy_register(void);
91void dsa_legacy_unregister(void);
92
a40c175b
VD
93/* port.c */
94int dsa_port_set_state(struct dsa_port *dp, u8 state,
95 struct switchdev_trans *trans);
96void dsa_port_set_state_now(struct dsa_port *dp, u8 state);
cfbed329
VD
97int dsa_port_bridge_join(struct dsa_port *dp, struct net_device *br);
98void dsa_port_bridge_leave(struct dsa_port *dp, struct net_device *br);
4d61d304
VD
99int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
100 struct switchdev_trans *trans);
d87bd94e
VD
101int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
102 struct switchdev_trans *trans);
d1cffff0
VD
103int dsa_port_fdb_add(struct dsa_port *dp,
104 const struct switchdev_obj_port_fdb *fdb,
105 struct switchdev_trans *trans);
106int dsa_port_fdb_del(struct dsa_port *dp,
107 const struct switchdev_obj_port_fdb *fdb);
108int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,
109 switchdev_obj_dump_cb_t *cb);
3a9afea3
VD
110int dsa_port_mdb_add(struct dsa_port *dp,
111 const struct switchdev_obj_port_mdb *mdb,
112 struct switchdev_trans *trans);
113int dsa_port_mdb_del(struct dsa_port *dp,
114 const struct switchdev_obj_port_mdb *mdb);
115int dsa_port_mdb_dump(struct dsa_port *dp, struct switchdev_obj_port_mdb *mdb,
116 switchdev_obj_dump_cb_t *cb);
076e7133
VD
117int dsa_port_vlan_add(struct dsa_port *dp,
118 const struct switchdev_obj_port_vlan *vlan,
119 struct switchdev_trans *trans);
120int dsa_port_vlan_del(struct dsa_port *dp,
121 const struct switchdev_obj_port_vlan *vlan);
122int dsa_port_vlan_dump(struct dsa_port *dp,
123 struct switchdev_obj_port_vlan *vlan,
124 switchdev_obj_dump_cb_t *cb);
a40c175b 125
91da11f8 126/* slave.c */
5075314e 127extern const struct dsa_device_ops notag_netdev_ops;
91da11f8 128void dsa_slave_mii_bus_init(struct dsa_switch *ds);
af42192c 129void dsa_cpu_port_ethtool_init(struct ethtool_ops *ops);
d87d6f44 130int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
83c0afae 131 int port, const char *name);
cda5c15b 132void dsa_slave_destroy(struct net_device *slave_dev);
24462549
FF
133int dsa_slave_suspend(struct net_device *slave_dev);
134int dsa_slave_resume(struct net_device *slave_dev);
88e4f0ca
VD
135int dsa_slave_register_notifier(void);
136void dsa_slave_unregister_notifier(void);
91da11f8 137
f515f192
VD
138/* switch.c */
139int dsa_switch_register_notifier(struct dsa_switch *ds);
140void dsa_switch_unregister_notifier(struct dsa_switch *ds);
141
eb7b7211
AL
142/* tag_brcm.c */
143extern const struct dsa_device_ops brcm_netdev_ops;
144
cf85d08f 145/* tag_dsa.c */
3e8a72d1 146extern const struct dsa_device_ops dsa_netdev_ops;
cf85d08f 147
91da11f8 148/* tag_edsa.c */
3e8a72d1 149extern const struct dsa_device_ops edsa_netdev_ops;
91da11f8 150
eb7b7211
AL
151/* tag_lan9303.c */
152extern const struct dsa_device_ops lan9303_netdev_ops;
396138f0 153
eb7b7211
AL
154/* tag_mtk.c */
155extern const struct dsa_device_ops mtk_netdev_ops;
5037d532 156
cafdc45c
JC
157/* tag_qca.c */
158extern const struct dsa_device_ops qca_netdev_ops;
91da11f8 159
eb7b7211
AL
160/* tag_trailer.c */
161extern const struct dsa_device_ops trailer_netdev_ops;
e8fe177a 162
91da11f8 163#endif