diff options
Diffstat (limited to 'net/8021q/vlan.c')
-rw-r--r-- | net/8021q/vlan.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index f0e335aa20df..41e8f65bd3f0 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c | |||
@@ -46,10 +46,10 @@ int vlan_net_id; | |||
46 | /* Our listing of VLAN group(s) */ | 46 | /* Our listing of VLAN group(s) */ |
47 | static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; | 47 | static struct hlist_head vlan_group_hash[VLAN_GRP_HASH_SIZE]; |
48 | 48 | ||
49 | static char vlan_fullname[] = "802.1Q VLAN Support"; | 49 | const char vlan_fullname[] = "802.1Q VLAN Support"; |
50 | static char vlan_version[] = DRV_VERSION; | 50 | const char vlan_version[] = DRV_VERSION; |
51 | static char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; | 51 | static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>"; |
52 | static char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; | 52 | static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>"; |
53 | 53 | ||
54 | static struct packet_type vlan_packet_type = { | 54 | static struct packet_type vlan_packet_type = { |
55 | .type = __constant_htons(ETH_P_8021Q), | 55 | .type = __constant_htons(ETH_P_8021Q), |
@@ -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 | ||
206 | int vlan_check_real_dev(struct net_device *real_dev, u16 vlan_id) | 207 | int 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 | ||