~ubuntu-branches/ubuntu/raring/openvswitch/raring-proposed

« back to all changes in this revision

Viewing changes to .pc/0002-datapath-Use-ETH_ALEN-instead-of-VLAN_ETH_ALEN.patch/datapath/linux/compat/include/linux/if_vlan.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-01-16 11:22:40 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20130116112240-2qbokf0tzcev5eu7
Tags: 1.9.0~git20130115.ca71f5b-0ubuntu1
* New upstream snapshot based on branch-1.9:
  - d/patches: Dropped all previous patches as all found upstream.
  - d/*: Synced packaging with upstream packaging changes.
  - d/control: Add libtool to BD's to support use of snapshot.
* Fix compatibility with Linux 3.8 (LP: #1098650):
  - d/p/support-linux-3.8.patch:
    Accept Linux 3.8 as a compatible kernel version.
  - d/p/linux-Makefile.main.in-acinclude-preparation-for-lin.patch:
    Adjust autoconf checks to correctly detect new kernel header file names.
* Fix python test issues caused by long UNIX socket paths:
  - d/p/handle-unix-socket-long-paths.patch:
    Workaround long UNIX socket paths by using /proc/self/fd on Linux.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __LINUX_IF_VLAN_WRAPPER_H
2
 
#define __LINUX_IF_VLAN_WRAPPER_H 1
3
 
 
4
 
#include_next <linux/if_vlan.h>
5
 
#include <linux/skbuff.h>
6
 
 
7
 
/*
8
 
 * The behavior of __vlan_put_tag() has changed over time:
9
 
 *
10
 
 *      - In 2.6.26 and earlier, it adjusted both MAC and network header
11
 
 *        pointers.  (The latter didn't make any sense.)
12
 
 *
13
 
 *      - In 2.6.27 and 2.6.28, it did not adjust any header pointers at all.
14
 
 *
15
 
 *      - In 2.6.29 and later, it adjusts the MAC header pointer only.
16
 
 *
17
 
 * This is the version from 2.6.33.  We unconditionally substitute this version
18
 
 * to avoid the need to guess whether the version in the kernel tree is
19
 
 * acceptable.
20
 
 */
21
 
#define __vlan_put_tag rpl_vlan_put_tag
22
 
static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci)
23
 
{
24
 
        struct vlan_ethhdr *veth;
25
 
 
26
 
        if (skb_cow_head(skb, VLAN_HLEN) < 0) {
27
 
                kfree_skb(skb);
28
 
                return NULL;
29
 
        }
30
 
        veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN);
31
 
 
32
 
        /* Move the mac addresses to the beginning of the new header. */
33
 
        memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN);
34
 
        skb->mac_header -= VLAN_HLEN;
35
 
 
36
 
        /* first, the ethernet type */
37
 
        veth->h_vlan_proto = htons(ETH_P_8021Q);
38
 
 
39
 
        /* now, the TCI */
40
 
        veth->h_vlan_TCI = htons(vlan_tci);
41
 
 
42
 
        skb->protocol = htons(ETH_P_8021Q);
43
 
 
44
 
        return skb;
45
 
}
46
 
 
47
 
 
48
 
/* All of these were introduced in a single commit preceding 2.6.33, so
49
 
 * presumably all of them or none of them are present. */
50
 
#ifndef VLAN_PRIO_MASK
51
 
#define VLAN_PRIO_MASK          0xe000 /* Priority Code Point */
52
 
#define VLAN_PRIO_SHIFT         13
53
 
#define VLAN_CFI_MASK           0x1000 /* Canonical Format Indicator */
54
 
#define VLAN_TAG_PRESENT        VLAN_CFI_MASK
55
 
#endif
56
 
 
57
 
/* This function is not exported from kernel. OVS Upstreaming patch will
58
 
 * fix that. */
59
 
static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vhdr)
60
 
{
61
 
        __be16 proto;
62
 
        unsigned char *rawp;
63
 
 
64
 
        /*
65
 
         * Was a VLAN packet, grab the encapsulated protocol, which the layer
66
 
         * three protocols care about.
67
 
         */
68
 
 
69
 
        proto = vhdr->h_vlan_encapsulated_proto;
70
 
        if (ntohs(proto) >= 1536) {
71
 
                skb->protocol = proto;
72
 
                return;
73
 
        }
74
 
 
75
 
        rawp = skb->data;
76
 
        if (*(unsigned short *) rawp == 0xFFFF)
77
 
                /*
78
 
                 * This is a magic hack to spot IPX packets. Older Novell
79
 
                 * breaks the protocol design and runs IPX over 802.3 without
80
 
                 * an 802.2 LLC layer. We look for FFFF which isn't a used
81
 
                 * 802.2 SSAP/DSAP. This won't work for fault tolerant netware
82
 
                 * but does for the rest.
83
 
                 */
84
 
                skb->protocol = htons(ETH_P_802_3);
85
 
        else
86
 
                /*
87
 
                 * Real 802.2 LLC
88
 
                 */
89
 
                skb->protocol = htons(ETH_P_802_2);
90
 
}
91
 
#endif  /* linux/if_vlan.h wrapper */