diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2011-11-25 09:32:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-26 14:48:14 -0500 |
commit | cf50dcc24f82a6dc2bce523eec2a979eb1b106e2 (patch) | |
tree | 579bd064fc0ee8475ca5c8e5d5f6295b82247c3a | |
parent | 6dec4ac4ee1ad894dc0e9647cd3e180f93fc353c (diff) |
dsa: Change dsa_uses_{dsa, trailer}_tags() into inline functions
eth_type_trans() will use these functions if DSA is enabled, which
blocks building DSA as a module.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/linux/netdevice.h | 2 | ||||
-rw-r--r-- | include/net/dsa.h | 53 | ||||
-rw-r--r-- | net/dsa/dsa.c | 23 | ||||
-rw-r--r-- | net/dsa/dsa_priv.h | 33 |
4 files changed, 52 insertions, 59 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 999bb264fe27..63721a69804c 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1080,7 +1080,7 @@ struct net_device { | |||
1080 | struct vlan_group __rcu *vlgrp; /* VLAN group */ | 1080 | struct vlan_group __rcu *vlgrp; /* VLAN group */ |
1081 | #endif | 1081 | #endif |
1082 | #ifdef CONFIG_NET_DSA | 1082 | #ifdef CONFIG_NET_DSA |
1083 | void *dsa_ptr; /* dsa specific data */ | 1083 | struct dsa_switch_tree *dsa_ptr; /* dsa specific data */ |
1084 | #endif | 1084 | #endif |
1085 | void *atalk_ptr; /* AppleTalk link */ | 1085 | void *atalk_ptr; /* AppleTalk link */ |
1086 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ | 1086 | struct in_device __rcu *ip_ptr; /* IPv4 specific data */ |
diff --git a/include/net/dsa.h b/include/net/dsa.h index 839f768f9e35..32a1b49e8a8c 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -11,6 +11,9 @@ | |||
11 | #ifndef __LINUX_NET_DSA_H | 11 | #ifndef __LINUX_NET_DSA_H |
12 | #define __LINUX_NET_DSA_H | 12 | #define __LINUX_NET_DSA_H |
13 | 13 | ||
14 | #include <linux/timer.h> | ||
15 | #include <linux/workqueue.h> | ||
16 | |||
14 | #define DSA_MAX_SWITCHES 4 | 17 | #define DSA_MAX_SWITCHES 4 |
15 | #define DSA_MAX_PORTS 12 | 18 | #define DSA_MAX_PORTS 12 |
16 | 19 | ||
@@ -54,8 +57,54 @@ struct dsa_platform_data { | |||
54 | struct dsa_chip_data *chip; | 57 | struct dsa_chip_data *chip; |
55 | }; | 58 | }; |
56 | 59 | ||
57 | extern bool dsa_uses_dsa_tags(void *dsa_ptr); | 60 | struct dsa_switch_tree { |
58 | extern bool dsa_uses_trailer_tags(void *dsa_ptr); | 61 | /* |
62 | * Configuration data for the platform device that owns | ||
63 | * this dsa switch tree instance. | ||
64 | */ | ||
65 | struct dsa_platform_data *pd; | ||
66 | |||
67 | /* | ||
68 | * Reference to network device to use, and which tagging | ||
69 | * protocol to use. | ||
70 | */ | ||
71 | struct net_device *master_netdev; | ||
72 | __be16 tag_protocol; | ||
73 | |||
74 | /* | ||
75 | * The switch and port to which the CPU is attached. | ||
76 | */ | ||
77 | s8 cpu_switch; | ||
78 | s8 cpu_port; | ||
79 | |||
80 | /* | ||
81 | * Link state polling. | ||
82 | */ | ||
83 | int link_poll_needed; | ||
84 | struct work_struct link_poll_work; | ||
85 | struct timer_list link_poll_timer; | ||
86 | |||
87 | /* | ||
88 | * Data for the individual switch chips. | ||
89 | */ | ||
90 | struct dsa_switch *ds[DSA_MAX_SWITCHES]; | ||
91 | }; | ||
92 | |||
93 | /* | ||
94 | * The original DSA tag format and some other tag formats have no | ||
95 | * ethertype, which means that we need to add a little hack to the | ||
96 | * networking receive path to make sure that received frames get | ||
97 | * the right ->protocol assigned to them when one of those tag | ||
98 | * formats is in use. | ||
99 | */ | ||
100 | static inline bool dsa_uses_dsa_tags(struct dsa_switch_tree *dst) | ||
101 | { | ||
102 | return !!(dst->tag_protocol == htons(ETH_P_DSA)); | ||
103 | } | ||
59 | 104 | ||
105 | static inline bool dsa_uses_trailer_tags(struct dsa_switch_tree *dst) | ||
106 | { | ||
107 | return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); | ||
108 | } | ||
60 | 109 | ||
61 | #endif | 110 | #endif |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 0dc1589343c3..66f5c0460cd3 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -199,29 +199,6 @@ static void dsa_switch_destroy(struct dsa_switch *ds) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | 201 | ||
202 | /* hooks for ethertype-less tagging formats *********************************/ | ||
203 | /* | ||
204 | * The original DSA tag format and some other tag formats have no | ||
205 | * ethertype, which means that we need to add a little hack to the | ||
206 | * networking receive path to make sure that received frames get | ||
207 | * the right ->protocol assigned to them when one of those tag | ||
208 | * formats is in use. | ||
209 | */ | ||
210 | bool dsa_uses_dsa_tags(void *dsa_ptr) | ||
211 | { | ||
212 | struct dsa_switch_tree *dst = dsa_ptr; | ||
213 | |||
214 | return !!(dst->tag_protocol == htons(ETH_P_DSA)); | ||
215 | } | ||
216 | |||
217 | bool dsa_uses_trailer_tags(void *dsa_ptr) | ||
218 | { | ||
219 | struct dsa_switch_tree *dst = dsa_ptr; | ||
220 | |||
221 | return !!(dst->tag_protocol == htons(ETH_P_TRAILER)); | ||
222 | } | ||
223 | |||
224 | |||
225 | /* link polling *************************************************************/ | 202 | /* link polling *************************************************************/ |
226 | static void dsa_link_poll_work(struct work_struct *ugly) | 203 | static void dsa_link_poll_work(struct work_struct *ugly) |
227 | { | 204 | { |
diff --git a/net/dsa/dsa_priv.h b/net/dsa/dsa_priv.h index 4b0ea0540442..a45186cb6daf 100644 --- a/net/dsa/dsa_priv.h +++ b/net/dsa/dsa_priv.h | |||
@@ -48,39 +48,6 @@ struct dsa_switch { | |||
48 | struct net_device *ports[DSA_MAX_PORTS]; | 48 | struct net_device *ports[DSA_MAX_PORTS]; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | struct dsa_switch_tree { | ||
52 | /* | ||
53 | * Configuration data for the platform device that owns | ||
54 | * this dsa switch tree instance. | ||
55 | */ | ||
56 | struct dsa_platform_data *pd; | ||
57 | |||
58 | /* | ||
59 | * Reference to network device to use, and which tagging | ||
60 | * protocol to use. | ||
61 | */ | ||
62 | struct net_device *master_netdev; | ||
63 | __be16 tag_protocol; | ||
64 | |||
65 | /* | ||
66 | * The switch and port to which the CPU is attached. | ||
67 | */ | ||
68 | s8 cpu_switch; | ||
69 | s8 cpu_port; | ||
70 | |||
71 | /* | ||
72 | * Link state polling. | ||
73 | */ | ||
74 | int link_poll_needed; | ||
75 | struct work_struct link_poll_work; | ||
76 | struct timer_list link_poll_timer; | ||
77 | |||
78 | /* | ||
79 | * Data for the individual switch chips. | ||
80 | */ | ||
81 | struct dsa_switch *ds[DSA_MAX_SWITCHES]; | ||
82 | }; | ||
83 | |||
84 | static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) | 51 | static inline bool dsa_is_cpu_port(struct dsa_switch *ds, int p) |
85 | { | 52 | { |
86 | return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); | 53 | return !!(ds->index == ds->dst->cpu_switch && p == ds->dst->cpu_port); |