~james-page/ubuntu/saucy/openvswitch/1.12-snapshot

« back to all changes in this revision

Viewing changes to datapath/tunnel.h

  • Committer: James Page
  • Date: 2013-08-21 10:16:57 UTC
  • mfrom: (1.1.20)
  • Revision ID: james.page@canonical.com-20130821101657-3o0z0qeiv5zkwlzi
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "flow.h"
27
27
#include "vport.h"
28
28
 
29
 
struct tnl_ops {
30
 
        u8 ipproto;             /* The IP protocol for the tunnel. */
31
 
 
32
 
        /*
33
 
         * Returns the length of the tunnel header that will be added in
34
 
         * build_header() (i.e. excludes the IP header).
35
 
         */
36
 
        int (*hdr_len)(const struct ovs_key_ipv4_tunnel *);
37
 
        /*
38
 
        * Builds header for given SKB.  Space will have already been
39
 
        * allocated at the start of the packet equal
40
 
        * to sizeof(struct iphdr) + value returned by hdr_len().
41
 
        */
42
 
        void (*build_header)(const struct vport *, struct sk_buff *,
43
 
                             int tunnel_hlen);
44
 
};
45
 
 
46
 
struct tnl_vport {
47
 
        struct rcu_head rcu;
48
 
 
49
 
        __be16 dst_port;
50
 
        char name[IFNAMSIZ];
51
 
        const struct tnl_ops *tnl_ops;
52
 
};
53
 
 
54
 
struct vport *ovs_tnl_create(const struct vport_parms *, const struct vport_ops *,
55
 
                             const struct tnl_ops *);
56
 
void ovs_tnl_destroy(struct vport *);
57
 
 
58
 
const char *ovs_tnl_get_name(const struct vport *vport);
59
 
int ovs_tnl_send(struct vport *vport, struct sk_buff *skb);
60
 
void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb);
 
29
struct rtable *find_route(struct net *net,
 
30
                          __be32 *saddr, __be32 daddr, u8 ipproto,
 
31
                          u8 tos, u32 skb_mark);
 
32
 
61
33
u16 ovs_tnl_get_src_port(struct sk_buff *skb);
62
34
 
63
 
static inline struct tnl_vport *tnl_vport_priv(const struct vport *vport)
64
 
{
65
 
        return vport_priv(vport);
66
 
}
 
35
int ovs_tnl_send(struct vport *vport, struct sk_buff *skb,
 
36
                 u8 ipproto, int tunnel_hlen,
 
37
                 void (*build_header)(const struct vport *,
 
38
                                      struct sk_buff *,
 
39
                                      int tunnel_hlen));
 
40
 
 
41
void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb,
 
42
                 struct ovs_key_ipv4_tunnel *tun_key);
67
43
 
68
44
static inline void tnl_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
69
 
                                    const struct iphdr *iph, __be64 tun_id, u32 tun_flags)
 
45
                                         const struct iphdr *iph, __be64 tun_id,
 
46
                                         __be16 tun_flags)
70
47
{
71
48
        tun_key->tun_id = tun_id;
72
49
        tun_key->ipv4_src = iph->saddr;
80
57
               sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
81
58
}
82
59
 
83
 
#endif /* tunnel.h */
 
60
#endif /* TUNNEL_H */