dsa_priv.h 2.8 KB
Newer Older
1 2
/*
 * net/dsa/dsa_priv.h - Hardware switch handling
3
 * Copyright (c) 2008-2009 Marvell Semiconductor
4 5 6 7 8 9 10 11 12 13 14
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __DSA_PRIV_H
#define __DSA_PRIV_H

#include <linux/phy.h>
15
#include <linux/netdevice.h>
16
#include <linux/netpoll.h>
17
#include <net/dsa.h>
18 19

struct dsa_device_ops {
20
	struct sk_buff *(*xmit)(struct sk_buff *skb, struct net_device *dev);
21 22 23
	struct sk_buff *(*rcv)(struct sk_buff *skb, struct net_device *dev,
			       struct packet_type *pt,
			       struct net_device *orig_dev);
24
};
25 26

struct dsa_slave_priv {
27
	struct sk_buff *	(*xmit)(struct sk_buff *skb,
28
					struct net_device *dev);
29

30 31
	/* DSA port data, such as switch, port index, etc. */
	struct dsa_port		*dp;
32 33 34 35 36

	/*
	 * The phylib phy_device pointer for the PHY connected
	 * to this port.
	 */
37
	struct phy_device	*phy;
38 39 40 41
	phy_interface_t		phy_interface;
	int			old_link;
	int			old_pause;
	int			old_duplex;
42

43 44 45
#ifdef CONFIG_NET_POLL_CONTROLLER
	struct netpoll		*netpoll;
#endif
46 47 48

	/* TC context */
	struct list_head	mall_tc_list;
49 50 51
};

/* dsa.c */
52
int dsa_cpu_dsa_setup(struct dsa_switch *ds, struct device *dev,
53 54
		      struct dsa_port *dport, int port);
void dsa_cpu_dsa_destroy(struct dsa_port *dport);
55
const struct dsa_device_ops *dsa_resolve_tag_protocol(int tag_protocol);
56 57
int dsa_cpu_port_ethtool_setup(struct dsa_switch *ds);
void dsa_cpu_port_ethtool_restore(struct dsa_switch *ds);
58

V
Vivien Didelot 已提交
59 60 61 62
/* legacy.c */
int dsa_legacy_register(void);
void dsa_legacy_unregister(void);

63
/* slave.c */
64
extern const struct dsa_device_ops notag_netdev_ops;
65
void dsa_slave_mii_bus_init(struct dsa_switch *ds);
66
void dsa_cpu_port_ethtool_init(struct ethtool_ops *ops);
67
int dsa_slave_create(struct dsa_switch *ds, struct device *parent,
68
		     int port, const char *name);
69
void dsa_slave_destroy(struct net_device *slave_dev);
70 71
int dsa_slave_suspend(struct net_device *slave_dev);
int dsa_slave_resume(struct net_device *slave_dev);
72 73
int dsa_slave_register_notifier(void);
void dsa_slave_unregister_notifier(void);
74

V
Vivien Didelot 已提交
75 76 77 78
/* switch.c */
int dsa_switch_register_notifier(struct dsa_switch *ds);
void dsa_switch_unregister_notifier(struct dsa_switch *ds);

79 80 81
/* tag_brcm.c */
extern const struct dsa_device_ops brcm_netdev_ops;

82
/* tag_dsa.c */
83
extern const struct dsa_device_ops dsa_netdev_ops;
84

85
/* tag_edsa.c */
86
extern const struct dsa_device_ops edsa_netdev_ops;
87

88 89
/* tag_lan9303.c */
extern const struct dsa_device_ops lan9303_netdev_ops;
90

91 92
/* tag_mtk.c */
extern const struct dsa_device_ops mtk_netdev_ops;
93

94 95
/* tag_qca.c */
extern const struct dsa_device_ops qca_netdev_ops;
96

97 98
/* tag_trailer.c */
extern const struct dsa_device_ops trailer_netdev_ops;
99

100
#endif