diff options
author | Patrick McHardy <kaber@trash.net> | 2008-01-21 03:26:07 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:08:32 -0500 |
commit | 9dfebcc6479c55c001e4bb5fe7cc16b6799c43a7 (patch) | |
tree | d933aad54aa6025d0394b48a4a816867c1333e3e /net/8021q/vlan_dev.c | |
parent | af30151709bcace1ca844d4bb8b7e2e392ff81eb (diff) |
[VLAN]: Turn VLAN_DEV_INFO into inline function
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_dev.c')
-rw-r--r-- | net/8021q/vlan_dev.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c index 756a71c1f4a5..a846559da85e 100644 --- a/net/8021q/vlan_dev.c +++ b/net/8021q/vlan_dev.c | |||
@@ -72,7 +72,7 @@ static int vlan_dev_rebuild_header(struct sk_buff *skb) | |||
72 | 72 | ||
73 | static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) | 73 | static inline struct sk_buff *vlan_check_reorder_header(struct sk_buff *skb) |
74 | { | 74 | { |
75 | if (VLAN_DEV_INFO(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) { | 75 | if (vlan_dev_info(skb->dev)->flags & VLAN_FLAG_REORDER_HDR) { |
76 | if (skb_shared(skb) || skb_cloned(skb)) { | 76 | if (skb_shared(skb) || skb_cloned(skb)) { |
77 | struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); | 77 | struct sk_buff *nskb = skb_copy(skb, GFP_ATOMIC); |
78 | kfree_skb(skb); | 78 | kfree_skb(skb); |
@@ -290,7 +290,7 @@ static inline unsigned short vlan_dev_get_egress_qos_mask(struct net_device* dev | |||
290 | struct sk_buff* skb) | 290 | struct sk_buff* skb) |
291 | { | 291 | { |
292 | struct vlan_priority_tci_mapping *mp = | 292 | struct vlan_priority_tci_mapping *mp = |
293 | VLAN_DEV_INFO(dev)->egress_priority_map[(skb->priority & 0xF)]; | 293 | vlan_dev_info(dev)->egress_priority_map[(skb->priority & 0xF)]; |
294 | 294 | ||
295 | while (mp) { | 295 | while (mp) { |
296 | if (mp->priority == skb->priority) { | 296 | if (mp->priority == skb->priority) { |
@@ -324,7 +324,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
324 | struct net_device *vdev = dev; /* save this for the bottom of the method */ | 324 | struct net_device *vdev = dev; /* save this for the bottom of the method */ |
325 | 325 | ||
326 | pr_debug("%s: skb: %p type: %hx len: %u vlan_id: %hx, daddr: %p\n", | 326 | pr_debug("%s: skb: %p type: %hx len: %u vlan_id: %hx, daddr: %p\n", |
327 | __FUNCTION__, skb, type, len, VLAN_DEV_INFO(dev)->vlan_id, daddr); | 327 | __FUNCTION__, skb, type, len, vlan_dev_info(dev)->vlan_id, daddr); |
328 | 328 | ||
329 | /* build vlan header only if re_order_header flag is NOT set. This | 329 | /* build vlan header only if re_order_header flag is NOT set. This |
330 | * fixes some programs that get confused when they see a VLAN device | 330 | * fixes some programs that get confused when they see a VLAN device |
@@ -334,7 +334,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
334 | * header shuffling in the hard_start_xmit. Users can turn off this | 334 | * header shuffling in the hard_start_xmit. Users can turn off this |
335 | * REORDER behaviour with the vconfig tool. | 335 | * REORDER behaviour with the vconfig tool. |
336 | */ | 336 | */ |
337 | if (!(VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR)) | 337 | if (!(vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR)) |
338 | build_vlan_header = 1; | 338 | build_vlan_header = 1; |
339 | 339 | ||
340 | if (build_vlan_header) { | 340 | if (build_vlan_header) { |
@@ -349,7 +349,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
349 | * VLAN ID 12 bits (low bits) | 349 | * VLAN ID 12 bits (low bits) |
350 | * | 350 | * |
351 | */ | 351 | */ |
352 | veth_TCI = VLAN_DEV_INFO(dev)->vlan_id; | 352 | veth_TCI = vlan_dev_info(dev)->vlan_id; |
353 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 353 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); |
354 | 354 | ||
355 | vhdr->h_vlan_TCI = htons(veth_TCI); | 355 | vhdr->h_vlan_TCI = htons(veth_TCI); |
@@ -374,7 +374,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
374 | if (saddr == NULL) | 374 | if (saddr == NULL) |
375 | saddr = dev->dev_addr; | 375 | saddr = dev->dev_addr; |
376 | 376 | ||
377 | dev = VLAN_DEV_INFO(dev)->real_dev; | 377 | dev = vlan_dev_info(dev)->real_dev; |
378 | 378 | ||
379 | /* MPLS can send us skbuffs w/out enough space. This check will grow the | 379 | /* MPLS can send us skbuffs w/out enough space. This check will grow the |
380 | * skb if it doesn't have enough headroom. Not a beautiful solution, so | 380 | * skb if it doesn't have enough headroom. Not a beautiful solution, so |
@@ -395,7 +395,7 @@ static int vlan_dev_hard_header(struct sk_buff *skb, struct net_device *dev, | |||
395 | stats->tx_dropped++; | 395 | stats->tx_dropped++; |
396 | return -ENOMEM; | 396 | return -ENOMEM; |
397 | } | 397 | } |
398 | VLAN_DEV_INFO(vdev)->cnt_inc_headroom_on_tx++; | 398 | vlan_dev_info(vdev)->cnt_inc_headroom_on_tx++; |
399 | pr_debug("%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name); | 399 | pr_debug("%s: %s: had to grow skb.\n", __FUNCTION__, vdev->name); |
400 | } | 400 | } |
401 | 401 | ||
@@ -430,12 +430,12 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
430 | */ | 430 | */ |
431 | 431 | ||
432 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) || | 432 | if (veth->h_vlan_proto != htons(ETH_P_8021Q) || |
433 | VLAN_DEV_INFO(dev)->flags & VLAN_FLAG_REORDER_HDR) { | 433 | vlan_dev_info(dev)->flags & VLAN_FLAG_REORDER_HDR) { |
434 | int orig_headroom = skb_headroom(skb); | 434 | int orig_headroom = skb_headroom(skb); |
435 | unsigned short veth_TCI; | 435 | unsigned short veth_TCI; |
436 | 436 | ||
437 | /* This is not a VLAN frame...but we can fix that! */ | 437 | /* This is not a VLAN frame...but we can fix that! */ |
438 | VLAN_DEV_INFO(dev)->cnt_encap_on_xmit++; | 438 | vlan_dev_info(dev)->cnt_encap_on_xmit++; |
439 | 439 | ||
440 | pr_debug("%s: proto to encap: 0x%hx\n", | 440 | pr_debug("%s: proto to encap: 0x%hx\n", |
441 | __FUNCTION__, htons(veth->h_vlan_proto)); | 441 | __FUNCTION__, htons(veth->h_vlan_proto)); |
@@ -445,7 +445,7 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
445 | * CFI 1 bit | 445 | * CFI 1 bit |
446 | * VLAN ID 12 bits (low bits) | 446 | * VLAN ID 12 bits (low bits) |
447 | */ | 447 | */ |
448 | veth_TCI = VLAN_DEV_INFO(dev)->vlan_id; | 448 | veth_TCI = vlan_dev_info(dev)->vlan_id; |
449 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 449 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); |
450 | 450 | ||
451 | skb = __vlan_put_tag(skb, veth_TCI); | 451 | skb = __vlan_put_tag(skb, veth_TCI); |
@@ -455,7 +455,7 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
455 | } | 455 | } |
456 | 456 | ||
457 | if (orig_headroom < VLAN_HLEN) { | 457 | if (orig_headroom < VLAN_HLEN) { |
458 | VLAN_DEV_INFO(dev)->cnt_inc_headroom_on_tx++; | 458 | vlan_dev_info(dev)->cnt_inc_headroom_on_tx++; |
459 | } | 459 | } |
460 | } | 460 | } |
461 | 461 | ||
@@ -472,7 +472,7 @@ static int vlan_dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
472 | stats->tx_packets++; /* for statics only */ | 472 | stats->tx_packets++; /* for statics only */ |
473 | stats->tx_bytes += skb->len; | 473 | stats->tx_bytes += skb->len; |
474 | 474 | ||
475 | skb->dev = VLAN_DEV_INFO(dev)->real_dev; | 475 | skb->dev = vlan_dev_info(dev)->real_dev; |
476 | dev_queue_xmit(skb); | 476 | dev_queue_xmit(skb); |
477 | 477 | ||
478 | return 0; | 478 | return 0; |
@@ -490,14 +490,14 @@ static int vlan_dev_hwaccel_hard_start_xmit(struct sk_buff *skb, | |||
490 | * CFI 1 bit | 490 | * CFI 1 bit |
491 | * VLAN ID 12 bits (low bits) | 491 | * VLAN ID 12 bits (low bits) |
492 | */ | 492 | */ |
493 | veth_TCI = VLAN_DEV_INFO(dev)->vlan_id; | 493 | veth_TCI = vlan_dev_info(dev)->vlan_id; |
494 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); | 494 | veth_TCI |= vlan_dev_get_egress_qos_mask(dev, skb); |
495 | skb = __vlan_hwaccel_put_tag(skb, veth_TCI); | 495 | skb = __vlan_hwaccel_put_tag(skb, veth_TCI); |
496 | 496 | ||
497 | stats->tx_packets++; | 497 | stats->tx_packets++; |
498 | stats->tx_bytes += skb->len; | 498 | stats->tx_bytes += skb->len; |
499 | 499 | ||
500 | skb->dev = VLAN_DEV_INFO(dev)->real_dev; | 500 | skb->dev = vlan_dev_info(dev)->real_dev; |
501 | dev_queue_xmit(skb); | 501 | dev_queue_xmit(skb); |
502 | 502 | ||
503 | return 0; | 503 | return 0; |
@@ -508,7 +508,7 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) | |||
508 | /* TODO: gotta make sure the underlying layer can handle it, | 508 | /* TODO: gotta make sure the underlying layer can handle it, |
509 | * maybe an IFF_VLAN_CAPABLE flag for devices? | 509 | * maybe an IFF_VLAN_CAPABLE flag for devices? |
510 | */ | 510 | */ |
511 | if (VLAN_DEV_INFO(dev)->real_dev->mtu < new_mtu) | 511 | if (vlan_dev_info(dev)->real_dev->mtu < new_mtu) |
512 | return -ERANGE; | 512 | return -ERANGE; |
513 | 513 | ||
514 | dev->mtu = new_mtu; | 514 | dev->mtu = new_mtu; |
@@ -519,7 +519,7 @@ static int vlan_dev_change_mtu(struct net_device *dev, int new_mtu) | |||
519 | void vlan_dev_set_ingress_priority(const struct net_device *dev, | 519 | void vlan_dev_set_ingress_priority(const struct net_device *dev, |
520 | u32 skb_prio, short vlan_prio) | 520 | u32 skb_prio, short vlan_prio) |
521 | { | 521 | { |
522 | struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); | 522 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
523 | 523 | ||
524 | if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio) | 524 | if (vlan->ingress_priority_map[vlan_prio & 0x7] && !skb_prio) |
525 | vlan->nr_ingress_mappings--; | 525 | vlan->nr_ingress_mappings--; |
@@ -532,7 +532,7 @@ void vlan_dev_set_ingress_priority(const struct net_device *dev, | |||
532 | int vlan_dev_set_egress_priority(const struct net_device *dev, | 532 | int vlan_dev_set_egress_priority(const struct net_device *dev, |
533 | u32 skb_prio, short vlan_prio) | 533 | u32 skb_prio, short vlan_prio) |
534 | { | 534 | { |
535 | struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); | 535 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
536 | struct vlan_priority_tci_mapping *mp = NULL; | 536 | struct vlan_priority_tci_mapping *mp = NULL; |
537 | struct vlan_priority_tci_mapping *np; | 537 | struct vlan_priority_tci_mapping *np; |
538 | u32 vlan_qos = (vlan_prio << 13) & 0xE000; | 538 | u32 vlan_qos = (vlan_prio << 13) & 0xE000; |
@@ -573,9 +573,9 @@ int vlan_dev_set_vlan_flag(const struct net_device *dev, | |||
573 | /* verify flag is supported */ | 573 | /* verify flag is supported */ |
574 | if (flag == VLAN_FLAG_REORDER_HDR) { | 574 | if (flag == VLAN_FLAG_REORDER_HDR) { |
575 | if (flag_val) { | 575 | if (flag_val) { |
576 | VLAN_DEV_INFO(dev)->flags |= VLAN_FLAG_REORDER_HDR; | 576 | vlan_dev_info(dev)->flags |= VLAN_FLAG_REORDER_HDR; |
577 | } else { | 577 | } else { |
578 | VLAN_DEV_INFO(dev)->flags &= ~VLAN_FLAG_REORDER_HDR; | 578 | vlan_dev_info(dev)->flags &= ~VLAN_FLAG_REORDER_HDR; |
579 | } | 579 | } |
580 | return 0; | 580 | return 0; |
581 | } | 581 | } |
@@ -584,17 +584,17 @@ int vlan_dev_set_vlan_flag(const struct net_device *dev, | |||
584 | 584 | ||
585 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result) | 585 | void vlan_dev_get_realdev_name(const struct net_device *dev, char *result) |
586 | { | 586 | { |
587 | strncpy(result, VLAN_DEV_INFO(dev)->real_dev->name, 23); | 587 | strncpy(result, vlan_dev_info(dev)->real_dev->name, 23); |
588 | } | 588 | } |
589 | 589 | ||
590 | void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result) | 590 | void vlan_dev_get_vid(const struct net_device *dev, unsigned short *result) |
591 | { | 591 | { |
592 | *result = VLAN_DEV_INFO(dev)->vlan_id; | 592 | *result = vlan_dev_info(dev)->vlan_id; |
593 | } | 593 | } |
594 | 594 | ||
595 | static int vlan_dev_open(struct net_device *dev) | 595 | static int vlan_dev_open(struct net_device *dev) |
596 | { | 596 | { |
597 | struct vlan_dev_info *vlan = VLAN_DEV_INFO(dev); | 597 | struct vlan_dev_info *vlan = vlan_dev_info(dev); |
598 | struct net_device *real_dev = vlan->real_dev; | 598 | struct net_device *real_dev = vlan->real_dev; |
599 | int err; | 599 | int err; |
600 | 600 | ||
@@ -618,7 +618,7 @@ static int vlan_dev_open(struct net_device *dev) | |||
618 | 618 | ||
619 | static int vlan_dev_stop(struct net_device *dev) | 619 | static int vlan_dev_stop(struct net_device *dev) |
620 | { | 620 | { |
621 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 621 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
622 | 622 | ||
623 | dev_mc_unsync(real_dev, dev); | 623 | dev_mc_unsync(real_dev, dev); |
624 | if (dev->flags & IFF_ALLMULTI) | 624 | if (dev->flags & IFF_ALLMULTI) |
@@ -634,7 +634,7 @@ static int vlan_dev_stop(struct net_device *dev) | |||
634 | 634 | ||
635 | static int vlan_dev_set_mac_address(struct net_device *dev, void *p) | 635 | static int vlan_dev_set_mac_address(struct net_device *dev, void *p) |
636 | { | 636 | { |
637 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 637 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
638 | struct sockaddr *addr = p; | 638 | struct sockaddr *addr = p; |
639 | int err; | 639 | int err; |
640 | 640 | ||
@@ -660,7 +660,7 @@ out: | |||
660 | 660 | ||
661 | static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | 661 | static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) |
662 | { | 662 | { |
663 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 663 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
664 | struct ifreq ifrr; | 664 | struct ifreq ifrr; |
665 | int err = -EOPNOTSUPP; | 665 | int err = -EOPNOTSUPP; |
666 | 666 | ||
@@ -684,7 +684,7 @@ static int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
684 | 684 | ||
685 | static void vlan_dev_change_rx_flags(struct net_device *dev, int change) | 685 | static void vlan_dev_change_rx_flags(struct net_device *dev, int change) |
686 | { | 686 | { |
687 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 687 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
688 | 688 | ||
689 | if (change & IFF_ALLMULTI) | 689 | if (change & IFF_ALLMULTI) |
690 | dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1); | 690 | dev_set_allmulti(real_dev, dev->flags & IFF_ALLMULTI ? 1 : -1); |
@@ -694,7 +694,7 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change) | |||
694 | 694 | ||
695 | static void vlan_dev_set_multicast_list(struct net_device *vlan_dev) | 695 | static void vlan_dev_set_multicast_list(struct net_device *vlan_dev) |
696 | { | 696 | { |
697 | dev_mc_sync(VLAN_DEV_INFO(vlan_dev)->real_dev, vlan_dev); | 697 | dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev); |
698 | } | 698 | } |
699 | 699 | ||
700 | /* | 700 | /* |
@@ -712,7 +712,7 @@ static const struct header_ops vlan_header_ops = { | |||
712 | 712 | ||
713 | static int vlan_dev_init(struct net_device *dev) | 713 | static int vlan_dev_init(struct net_device *dev) |
714 | { | 714 | { |
715 | struct net_device *real_dev = VLAN_DEV_INFO(dev)->real_dev; | 715 | struct net_device *real_dev = vlan_dev_info(dev)->real_dev; |
716 | int subclass = 0; | 716 | int subclass = 0; |
717 | 717 | ||
718 | /* IFF_BROADCAST|IFF_MULTICAST; ??? */ | 718 | /* IFF_BROADCAST|IFF_MULTICAST; ??? */ |