]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - net/dsa/dsa_priv.h
net: dsa: Move skb_unshare() to dsa_switch_rcv()
[mirror_ubuntu-jammy-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>
5075314e
AD
17
18struct dsa_device_ops {
4ed70ce9 19 struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev);
5075314e
AD
20 int (*rcv)(struct sk_buff *skb, struct net_device *dev,
21 struct packet_type *pt, struct net_device *orig_dev);
22};
91da11f8 23
91da11f8 24struct dsa_slave_priv {
4ed70ce9 25 struct sk_buff * (*xmit)(struct sk_buff *skb,
5075314e 26 struct net_device *dev);
e84665c9 27
afdcf151
VD
28 /* DSA port data, such as switch, port index, etc. */
29 struct dsa_port *dp;
e84665c9
LB
30
31 /*
32 * The phylib phy_device pointer for the PHY connected
33 * to this port.
34 */
91da11f8 35 struct phy_device *phy;
0d8bcdd3
FF
36 phy_interface_t phy_interface;
37 int old_link;
38 int old_pause;
39 int old_duplex;
b73adef6 40
04ff53f9
FF
41#ifdef CONFIG_NET_POLL_CONTROLLER
42 struct netpoll *netpoll;
43#endif
f50f2127
FF
44
45 /* TC context */
46 struct list_head mall_tc_list;
91da11f8
LB
47};
48
91da11f8 49/* dsa.c */
9b8e895c 50int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
293784a8
FF
51 struct dsa_port *dport, int port);
52void dsa_cpu_dsa_destroy(struct dsa_port *dport);
39a7f2a4 53const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
0c73c523
FF
54int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
55void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
91da11f8
LB
56
57/* slave.c */
5075314e 58extern const struct dsa_device_ops notag_netdev_ops;
91da11f8 59void dsa_slave_mii_bus_init(struct dsa_switch *ds);
af42192c 60void dsa_cpu_port_ethtool_init(struct ethtool_ops *ops);
d87d6f44 61int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
83c0afae 62 int port, const char *name);
cda5c15b 63void dsa_slave_destroy(struct net_device *slave_dev);
24462549
FF
64int dsa_slave_suspend(struct net_device *slave_dev);
65int dsa_slave_resume(struct net_device *slave_dev);
88e4f0ca
VD
66int dsa_slave_register_notifier(void);
67void dsa_slave_unregister_notifier(void);
91da11f8 68
f515f192
VD
69/* switch.c */
70int dsa_switch_register_notifier(struct dsa_switch *ds);
71void dsa_switch_unregister_notifier(struct dsa_switch *ds);
72
cf85d08f 73/* tag_dsa.c */
3e8a72d1 74extern const struct dsa_device_ops dsa_netdev_ops;
cf85d08f 75
91da11f8 76/* tag_edsa.c */
3e8a72d1 77extern const struct dsa_device_ops edsa_netdev_ops;
91da11f8 78
396138f0 79/* tag_trailer.c */
3e8a72d1 80extern const struct dsa_device_ops trailer_netdev_ops;
396138f0 81
5037d532
FF
82/* tag_brcm.c */
83extern const struct dsa_device_ops brcm_netdev_ops;
84
cafdc45c
JC
85/* tag_qca.c */
86extern const struct dsa_device_ops qca_netdev_ops;
91da11f8 87
5cd8985a
SW
88/* tag_mtk.c */
89extern const struct dsa_device_ops mtk_netdev_ops;
90
91da11f8 91#endif