aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-11-20 00:53:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-20 01:42:41 -0500
commit656299f706e52e0409733d704c2761f1b12d6954 (patch)
treefcf2013d86e552eda9e9576acc58a32912c616f4 /net/8021q/vlan.c
parent5bc3eb7e2f0026f246d939851109df99e8e9f64a (diff)
vlan: convert to net_device_ops
Convert vlan devices and function pointers to net_device_ops. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r--net/8021q/vlan.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 72326b9c759c..41e8f65bd3f0 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -144,6 +144,7 @@ void unregister_vlan_dev(struct net_device *dev)
144{ 144{
145 struct vlan_dev_info *vlan = vlan_dev_info(dev); 145 struct vlan_dev_info *vlan = vlan_dev_info(dev);
146 struct net_device *real_dev = vlan->real_dev; 146 struct net_device *real_dev = vlan->real_dev;
147 const struct net_device_ops *ops = real_dev->netdev_ops;
147 struct vlan_group *grp; 148 struct vlan_group *grp;
148 u16 vlan_id = vlan->vlan_id; 149 u16 vlan_id = vlan->vlan_id;
149 150
@@ -156,7 +157,7 @@ void unregister_vlan_dev(struct net_device *dev)
156 * HW accelerating devices or SW vlan input packet processing. 157 * HW accelerating devices or SW vlan input packet processing.
157 */ 158 */
158 if (real_dev->features & NETIF_F_HW_VLAN_FILTER) 159 if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
159 real_dev->vlan_rx_kill_vid(real_dev, vlan_id); 160 ops->ndo_vlan_rx_kill_vid(real_dev, vlan_id);
160 161
161 vlan_group_set_device(grp, vlan_id, NULL); 162 vlan_group_set_device(grp, vlan_id, NULL);
162 grp->nr_vlans--; 163 grp->nr_vlans--;
@@ -170,7 +171,7 @@ void unregister_vlan_dev(struct net_device *dev)
170 vlan_gvrp_uninit_applicant(real_dev); 171 vlan_gvrp_uninit_applicant(real_dev);
171 172
172 if (real_dev->features & NETIF_F_HW_VLAN_RX) 173 if (real_dev->features & NETIF_F_HW_VLAN_RX)
173 real_dev->vlan_rx_register(real_dev, NULL); 174 ops->ndo_vlan_rx_register(real_dev, NULL);
174 175
175 hlist_del_rcu(&grp->hlist); 176 hlist_del_rcu(&grp->hlist);
176 177
@@ -205,21 +206,21 @@ static void vlan_transfer_operstate(const struct net_device *dev,
205 206
206int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) 207int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id)
207{ 208{
208 char *name = real_dev->name; 209 const char *name = real_dev->name;
210 const struct net_device_ops *ops = real_dev->netdev_ops;
209 211
210 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) { 212 if (real_dev->features & NETIF_F_VLAN_CHALLENGED) {
211 pr_info("8021q: VLANs not supported on %s\n", name); 213 pr_info("8021q: VLANs not supported on %s\n", name);
212 return -EOPNOTSUPP; 214 return -EOPNOTSUPP;
213 } 215 }
214 216
215 if ((real_dev->features & NETIF_F_HW_VLAN_RX) && 217 if ((real_dev->features & NETIF_F_HW_VLAN_RX) && !ops->ndo_vlan_rx_register) {
216 !real_dev->vlan_rx_register) {
217 pr_info("8021q: device %s has buggy VLAN hw accel\n", name); 218 pr_info("8021q: device %s has buggy VLAN hw accel\n", name);
218 return -EOPNOTSUPP; 219 return -EOPNOTSUPP;
219 } 220 }
220 221
221 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) && 222 if ((real_dev->features & NETIF_F_HW_VLAN_FILTER) &&
222 (!real_dev->vlan_rx_add_vid || !real_dev->vlan_rx_kill_vid)) { 223 (!ops->ndo_vlan_rx_add_vid || !ops->ndo_vlan_rx_kill_vid)) {
223 pr_info("8021q: Device %s has buggy VLAN hw accel\n", name); 224 pr_info("8021q: Device %s has buggy VLAN hw accel\n", name);
224 return -EOPNOTSUPP; 225 return -EOPNOTSUPP;
225 } 226 }
@@ -240,6 +241,7 @@ int register_vlan_dev(struct net_device *dev)
240{ 241{
241 struct vlan_dev_info *vlan = vlan_dev_info(dev); 242 struct vlan_dev_info *vlan = vlan_dev_info(dev);
242 struct net_device *real_dev = vlan->real_dev; 243 struct net_device *real_dev = vlan->real_dev;
244 const struct net_device_ops *ops = real_dev->netdev_ops;
243 u16 vlan_id = vlan->vlan_id; 245 u16 vlan_id = vlan->vlan_id;
244 struct vlan_group *grp, *ngrp = NULL; 246 struct vlan_group *grp, *ngrp = NULL;
245 int err; 247 int err;
@@ -275,9 +277,9 @@ int register_vlan_dev(struct net_device *dev)
275 grp->nr_vlans++; 277 grp->nr_vlans++;
276 278
277 if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX) 279 if (ngrp && real_dev->features & NETIF_F_HW_VLAN_RX)
278 real_dev->vlan_rx_register(real_dev, ngrp); 280 ops->ndo_vlan_rx_register(real_dev, ngrp);
279 if (real_dev->features & NETIF_F_HW_VLAN_FILTER) 281 if (real_dev->features & NETIF_F_HW_VLAN_FILTER)
280 real_dev->vlan_rx_add_vid(real_dev, vlan_id); 282 ops->ndo_vlan_rx_add_vid(real_dev, vlan_id);
281 283
282 return 0; 284 return 0;
283 285