aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_dev.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-12-07 23:11:15 -0500
committerDavid S. Miller <davem@davemloft.net>2011-12-08 19:51:30 -0500
commit7da82c06ded105bf601bfa0eafc92e84eb0ceeed (patch)
tree68d8787014addfab287626fcf36446437df9c7aa /net/8021q/vlan_dev.c
parent6626873980475f303367f7b709f4703b571cf854 (diff)
vlan: rename vlan_dev_info to vlan_dev_priv
As this structure is priv, name it approprietely. Also for pointer to it use name "vlan". Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r--net/8021q/vlan_dev.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 2b5fcde1f629..3b4db82b016f 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -72,7 +72,7 @@ vlan_dev_get_egress_qos_mask(struct net_device *dev, struct sk_buff *skb)
72{ 72{
73 struct vlan_priority_tci_mapping *mp; 73 struct vlan_priority_tci_mapping *mp;
74 74
75 mp = vlan_dev_info(dev)->egress_priority_map[(skb->priority & 0xF)]; 75 mp = vlan_dev_priv(dev)->egress_priority_map[(skb->priority & 0xF)];
76 while (mp) { 76 while (mp) {
77 if (mp->priority == skb->priority) { 77 if (mp->priority == skb->priority) {
78 return mp->vlan_qos; /* This should already be shifted 78 return mp->vlan_qos; /* This should already be shifted
@@ -103,10 +103,10 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
103 u16 vlan_tci = 0; 103 u16 vlan_tci = 0;
104 int rc; 104 int rc;
105 105
106 if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR)) { 106 if (!(vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR)) {
107 vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN); 107 vhdr = (struct vlan_hdr *) skb_push(skb, VLAN_HLEN);
108 108
109 vlan_tci = vlan_dev_info(dev)->vlan_id; 109 vlan_tci = vlan_dev_priv(dev)->vlan_id;
110 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); 110 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
111 vhdr->h_vlan_TCI = htons(vlan_tci); 111 vhdr->h_vlan_TCI = htons(vlan_tci);
112 112
@@ -129,7 +129,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev,
129 saddr = dev->dev_addr; 129 saddr = dev->dev_addr;
130 130
131 /* Now make the underlying real hard header */ 131 /* Now make the underlying real hard header */
132 dev = vlan_dev_info(dev)->real_dev; 132 dev = vlan_dev_priv(dev)->real_dev;
133 rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen); 133 rc = dev_hard_header(skb, dev, type, daddr, saddr, len + vhdrlen);
134 if (rc > 0) 134 if (rc > 0)
135 rc += vhdrlen; 135 rc += vhdrlen;
@@ -149,27 +149,27 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
149 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs... 149 * OTHER THINGS LIKE FDDI/TokenRing/802.3 SNAPs...
150 */ 150 */
151 if (veth->h_vlan_proto != htons(ETH_P_8021Q) || 151 if (veth->h_vlan_proto != htons(ETH_P_8021Q) ||
152 vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) { 152 vlan_dev_priv(dev)->flags & VLAN_FLAG_REORDER_HDR) {
153 u16 vlan_tci; 153 u16 vlan_tci;
154 vlan_tci = vlan_dev_info(dev)->vlan_id; 154 vlan_tci = vlan_dev_priv(dev)->vlan_id;
155 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb); 155 vlan_tci |= vlan_dev_get_egress_qos_mask(dev, skb);
156 skb = __vlan_hwaccel_put_tag(skb, vlan_tci); 156 skb = __vlan_hwaccel_put_tag(skb, vlan_tci);
157 } 157 }
158 158
159 skb_set_dev(skb, vlan_dev_info(dev)->real_dev); 159 skb_set_dev(skb, vlan_dev_priv(dev)->real_dev);
160 len = skb->len; 160 len = skb->len;
161 ret = dev_queue_xmit(skb); 161 ret = dev_queue_xmit(skb);
162 162
163 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) { 163 if (likely(ret == NET_XMIT_SUCCESS || ret == NET_XMIT_CN)) {
164 struct vlan_pcpu_stats *stats; 164 struct vlan_pcpu_stats *stats;
165 165
166 stats = this_cpu_ptr(vlan_dev_info(dev)->vlan_pcpu_stats); 166 stats = this_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats);
167 u64_stats_update_begin(&stats->syncp); 167 u64_stats_update_begin(&stats->syncp);
168 stats->tx_packets++; 168 stats->tx_packets++;
169 stats->tx_bytes += len; 169 stats->tx_bytes += len;
170 u64_stats_update_end(&stats->syncp); 170 u64_stats_update_end(&stats->syncp);
171 } else { 171 } else {
172 this_cpu_inc(vlan_dev_info(dev)->vlan_pcpu_stats->tx_dropped); 172 this_cpu_inc(vlan_dev_priv(dev)->vlan_pcpu_stats->tx_dropped);
173 } 173 }
174 174
175 return ret; 175 return ret;
@@ -180,7 +180,7 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
180 /* TODO: gotta make sure the underlying layer can handle it, 180 /* TODO: gotta make sure the underlying layer can handle it,
181 * maybe an IFF_VLAN_CAPABLE flag for devices? 181 * maybe an IFF_VLAN_CAPABLE flag for devices?
182 */ 182 */
183 if (vlan_dev_info(dev)->real_dev->mtu < new_mtu) 183 if (vlan_dev_priv(dev)->real_dev->mtu < new_mtu)
184 return -ERANGE; 184 return -ERANGE;
185 185
186 dev->mtu = new_mtu; 186 dev->mtu = new_mtu;
@@ -191,7 +191,7 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu)
191void vlan_dev_set_ingress_priority(const struct net_device *dev, 191void vlan_dev_set_ingress_priority(const struct net_device *dev,
192 u32 skb_prio, u16 vlan_prio) 192 u32 skb_prio, u16 vlan_prio)
193{ 193{
194 struct vlan_dev_info *vlan = vlan_dev_info(dev); 194 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
195 195
196 if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio) 196 if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio)
197 vlan->nr_ingress_mappings--; 197 vlan->nr_ingress_mappings--;
@@ -204,7 +204,7 @@ void vlan_dev_set_ingress_priority(const struct net_device *dev,
204int vlan_dev_set_egress_priority(const struct net_device *dev, 204int vlan_dev_set_egress_priority(const struct net_device *dev,
205 u32 skb_prio, u16 vlan_prio) 205 u32 skb_prio, u16 vlan_prio)
206{ 206{
207 struct vlan_dev_info *vlan = vlan_dev_info(dev); 207 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
208 struct vlan_priority_tci_mapping *mp = NULL; 208 struct vlan_priority_tci_mapping *mp = NULL;
209 struct vlan_priority_tci_mapping *np; 209 struct vlan_priority_tci_mapping *np;
210 u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK; 210 u32 vlan_qos = (vlan_prio << VLAN_PRIO_SHIFT) & VLAN_PRIO_MASK;
@@ -241,7 +241,7 @@ int vlan_dev_set_egress_priority(const struct net_device *dev,
241/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */ 241/* Flags are defined in the vlan_flags enum in include/linux/if_vlan.h file. */
242int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask) 242int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
243{ 243{
244 struct vlan_dev_info *vlan = vlan_dev_info(dev); 244 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
245 u32 old_flags = vlan->flags; 245 u32 old_flags = vlan->flags;
246 246
247 if (mask & ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP | 247 if (mask & ~(VLAN_FLAG_REORDER_HDR | VLAN_FLAG_GVRP |
@@ -261,12 +261,12 @@ int vlan_dev_change_flags(const struct net_device *dev, u32 flags, u32 mask)
261 261
262void vlan_dev_get_realdev_name(const struct net_device *dev, char *result) 262void vlan_dev_get_realdev_name(const struct net_device *dev, char *result)
263{ 263{
264 strncpy(result, vlan_dev_info(dev)->real_dev->name, 23); 264 strncpy(result, vlan_dev_priv(dev)->real_dev->name, 23);
265} 265}
266 266
267static int vlan_dev_open(struct net_device *dev) 267static int vlan_dev_open(struct net_device *dev)
268{ 268{
269 struct vlan_dev_info *vlan = vlan_dev_info(dev); 269 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
270 struct net_device *real_dev = vlan->real_dev; 270 struct net_device *real_dev = vlan->real_dev;
271 int err; 271 int err;
272 272
@@ -313,7 +313,7 @@ out:
313 313
314static int vlan_dev_stop(struct net_device *dev) 314static int vlan_dev_stop(struct net_device *dev)
315{ 315{
316 struct vlan_dev_info *vlan = vlan_dev_info(dev); 316 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
317 struct net_device *real_dev = vlan->real_dev; 317 struct net_device *real_dev = vlan->real_dev;
318 318
319 dev_mc_unsync(real_dev, dev); 319 dev_mc_unsync(real_dev, dev);
@@ -332,7 +332,7 @@ static int vlan_dev_stop(struct net_device *dev)
332 332
333static int vlan_dev_set_mac_address(struct net_device *dev, void *p) 333static int vlan_dev_set_mac_address(struct net_device *dev, void *p)
334{ 334{
335 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 335 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
336 struct sockaddr *addr = p; 336 struct sockaddr *addr = p;
337 int err; 337 int err;
338 338
@@ -358,7 +358,7 @@ out:
358 358
359static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 359static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
360{ 360{
361 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 361 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
362 const struct net_device_ops *ops = real_dev->netdev_ops; 362 const struct net_device_ops *ops = real_dev->netdev_ops;
363 struct ifreq ifrr; 363 struct ifreq ifrr;
364 int err = -EOPNOTSUPP; 364 int err = -EOPNOTSUPP;
@@ -383,7 +383,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
383 383
384static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa) 384static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)
385{ 385{
386 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 386 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
387 const struct net_device_ops *ops = real_dev->netdev_ops; 387 const struct net_device_ops *ops = real_dev->netdev_ops;
388 int err = 0; 388 int err = 0;
389 389
@@ -397,7 +397,7 @@ static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa)
397static int vlan_dev_fcoe_ddp_setup(struct net_device *dev, u16 xid, 397static int vlan_dev_fcoe_ddp_setup(struct net_device *dev, u16 xid,
398 struct scatterlist *sgl, unsigned int sgc) 398 struct scatterlist *sgl, unsigned int sgc)
399{ 399{
400 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 400 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
401 const struct net_device_ops *ops = real_dev->netdev_ops; 401 const struct net_device_ops *ops = real_dev->netdev_ops;
402 int rc = 0; 402 int rc = 0;
403 403
@@ -409,7 +409,7 @@ static int vlan_dev_fcoe_ddp_setup(struct net_device *dev, u16 xid,
409 409
410static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid) 410static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid)
411{ 411{
412 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 412 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
413 const struct net_device_ops *ops = real_dev->netdev_ops; 413 const struct net_device_ops *ops = real_dev->netdev_ops;
414 int len = 0; 414 int len = 0;
415 415
@@ -421,7 +421,7 @@ static int vlan_dev_fcoe_ddp_done(struct net_device *dev, u16 xid)
421 421
422static int vlan_dev_fcoe_enable(struct net_device *dev) 422static int vlan_dev_fcoe_enable(struct net_device *dev)
423{ 423{
424 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 424 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
425 const struct net_device_ops *ops = real_dev->netdev_ops; 425 const struct net_device_ops *ops = real_dev->netdev_ops;
426 int rc = -EINVAL; 426 int rc = -EINVAL;
427 427
@@ -432,7 +432,7 @@ static int vlan_dev_fcoe_enable(struct net_device *dev)
432 432
433static int vlan_dev_fcoe_disable(struct net_device *dev) 433static int vlan_dev_fcoe_disable(struct net_device *dev)
434{ 434{
435 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 435 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
436 const struct net_device_ops *ops = real_dev->netdev_ops; 436 const struct net_device_ops *ops = real_dev->netdev_ops;
437 int rc = -EINVAL; 437 int rc = -EINVAL;
438 438
@@ -443,7 +443,7 @@ static int vlan_dev_fcoe_disable(struct net_device *dev)
443 443
444static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type) 444static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type)
445{ 445{
446 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 446 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
447 const struct net_device_ops *ops = real_dev->netdev_ops; 447 const struct net_device_ops *ops = real_dev->netdev_ops;
448 int rc = -EINVAL; 448 int rc = -EINVAL;
449 449
@@ -455,7 +455,7 @@ static int vlan_dev_fcoe_get_wwn(struct net_device *dev, u64 *wwn, int type)
455static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid, 455static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid,
456 struct scatterlist *sgl, unsigned int sgc) 456 struct scatterlist *sgl, unsigned int sgc)
457{ 457{
458 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 458 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
459 const struct net_device_ops *ops = real_dev->netdev_ops; 459 const struct net_device_ops *ops = real_dev->netdev_ops;
460 int rc = 0; 460 int rc = 0;
461 461
@@ -468,7 +468,7 @@ static int vlan_dev_fcoe_ddp_target(struct net_device *dev, u16 xid,
468 468
469static void vlan_dev_change_rx_flags(struct net_device *dev, int change) 469static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
470{ 470{
471 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 471 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
472 472
473 if (dev->flags & IFF_UP) { 473 if (dev->flags & IFF_UP) {
474 if (change & IFF_ALLMULTI) 474 if (change & IFF_ALLMULTI)
@@ -480,8 +480,8 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
480 480
481static void vlan_dev_set_rx_mode(struct net_device *vlan_dev) 481static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
482{ 482{
483 dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); 483 dev_mc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
484 dev_uc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); 484 dev_uc_sync(vlan_dev_priv(vlan_dev)->real_dev, vlan_dev);
485} 485}
486 486
487/* 487/*
@@ -519,7 +519,7 @@ static const struct net_device_ops vlan_netdev_ops;
519 519
520static int vlan_dev_init(struct net_device *dev) 520static int vlan_dev_init(struct net_device *dev)
521{ 521{
522 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 522 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
523 int subclass = 0; 523 int subclass = 0;
524 524
525 netif_carrier_off(dev); 525 netif_carrier_off(dev);
@@ -568,8 +568,8 @@ static int vlan_dev_init(struct net_device *dev)
568 568
569 vlan_dev_set_lockdep_class(dev, subclass); 569 vlan_dev_set_lockdep_class(dev, subclass);
570 570
571 vlan_dev_info(dev)->vlan_pcpu_stats = alloc_percpu(struct vlan_pcpu_stats); 571 vlan_dev_priv(dev)->vlan_pcpu_stats = alloc_percpu(struct vlan_pcpu_stats);
572 if (!vlan_dev_info(dev)->vlan_pcpu_stats) 572 if (!vlan_dev_priv(dev)->vlan_pcpu_stats)
573 return -ENOMEM; 573 return -ENOMEM;
574 574
575 return 0; 575 return 0;
@@ -578,7 +578,7 @@ static int vlan_dev_init(struct net_device *dev)
578static void vlan_dev_uninit(struct net_device *dev) 578static void vlan_dev_uninit(struct net_device *dev)
579{ 579{
580 struct vlan_priority_tci_mapping *pm; 580 struct vlan_priority_tci_mapping *pm;
581 struct vlan_dev_info *vlan = vlan_dev_info(dev); 581 struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
582 int i; 582 int i;
583 583
584 free_percpu(vlan->vlan_pcpu_stats); 584 free_percpu(vlan->vlan_pcpu_stats);
@@ -594,7 +594,7 @@ static void vlan_dev_uninit(struct net_device *dev)
594static netdev_features_t vlan_dev_fix_features(struct net_device *dev, 594static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
595 netdev_features_t features) 595 netdev_features_t features)
596{ 596{
597 struct net_device *real_dev = vlan_dev_info(dev)->real_dev; 597 struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
598 u32 old_features = features; 598 u32 old_features = features;
599 599
600 features &= real_dev->vlan_features; 600 features &= real_dev->vlan_features;
@@ -610,7 +610,7 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
610static int vlan_ethtool_get_settings(struct net_device *dev, 610static int vlan_ethtool_get_settings(struct net_device *dev,
611 struct ethtool_cmd *cmd) 611 struct ethtool_cmd *cmd)
612{ 612{
613 const struct vlan_dev_info *vlan = vlan_dev_info(dev); 613 const struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
614 614
615 return __ethtool_get_settings(vlan->real_dev, cmd); 615 return __ethtool_get_settings(vlan->real_dev, cmd);
616} 616}
@@ -626,7 +626,7 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev,
626static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) 626static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
627{ 627{
628 628
629 if (vlan_dev_info(dev)->vlan_pcpu_stats) { 629 if (vlan_dev_priv(dev)->vlan_pcpu_stats) {
630 struct vlan_pcpu_stats *p; 630 struct vlan_pcpu_stats *p;
631 u32 rx_errors = 0, tx_dropped = 0; 631 u32 rx_errors = 0, tx_dropped = 0;
632 int i; 632 int i;
@@ -635,7 +635,7 @@ static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, st
635 u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes; 635 u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes;
636 unsigned int start; 636 unsigned int start;
637 637
638 p = per_cpu_ptr(vlan_dev_info(dev)->vlan_pcpu_stats, i); 638 p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
639 do { 639 do {
640 start = u64_stats_fetch_begin_bh(&p->syncp); 640 start = u64_stats_fetch_begin_bh(&p->syncp);
641 rxpackets = p->rx_packets; 641 rxpackets = p->rx_packets;