- /* Configured via OVS_TUNNEL_ATTR_* attributes. */
- __be64 out_key;
- u32 flags;
- u8 tos;
- u8 ttl;
- __be16 dst_port;
-
- /* Multicast configuration. */
- int mlink;
-};
-
-struct tnl_ops {
- u32 tunnel_type; /* Put the TNL_T_PROTO_* type in here. */
- u8 ipproto; /* The IP protocol for the tunnel. */
-
- /*
- * Returns the length of the tunnel header that will be added in
- * build_header() (i.e. excludes the IP header). Returns a negative
- * error code if the configuration is invalid.
- */
- int (*hdr_len)(const struct tnl_mutable_config *,
- const struct ovs_key_ipv4_tunnel *);
- /*
- * Returns a linked list of SKBs with tunnel headers (multiple
- * packets may be generated in the event of fragmentation). Space
- * will have already been allocated at the start of the packet equal
- * to sizeof(struct iphdr) + value returned by hdr_len(). The IP
- * header will have already been constructed.
- */
- struct sk_buff *(*build_header)(const struct vport *,
- const struct tnl_mutable_config *,
- struct dst_entry *, struct sk_buff *,
- int tunnel_hlen);
-};
-
-struct tnl_vport {
- struct rcu_head rcu;
- struct hlist_node hash_node;
-
- char name[IFNAMSIZ];
- const struct tnl_ops *tnl_ops;
-
- struct tnl_mutable_config __rcu *mutable;
-
- /*
- * ID of last fragment sent (for tunnel protocols with direct support
- * fragmentation). If the protocol relies on IP fragmentation then
- * this is not needed.
- */
- atomic_t frag_id;
-};
-
-struct vport *ovs_tnl_create(const struct vport_parms *, const struct vport_ops *,
- const struct tnl_ops *);
-void ovs_tnl_destroy(struct vport *);
-
-int ovs_tnl_set_options(struct vport *, struct nlattr *);
-int ovs_tnl_get_options(const struct vport *, struct sk_buff *);
-
-int ovs_tnl_set_addr(struct vport *vport, const unsigned char *addr);
-const char *ovs_tnl_get_name(const struct vport *vport);
-const unsigned char *ovs_tnl_get_addr(const struct vport *vport);
-int ovs_tnl_send(struct vport *vport, struct sk_buff *skb);
-void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb);
-
-struct vport *ovs_tnl_find_port(struct net *net, __be32 saddr, __be32 daddr,
- __be64 key, int tunnel_type,
- const struct tnl_mutable_config **mutable);
-bool ovs_tnl_frag_needed(struct vport *vport,
- const struct tnl_mutable_config *mutable,
- struct sk_buff *skb, unsigned int mtu);
-void ovs_tnl_free_linked_skbs(struct sk_buff *skb);
-
-int ovs_tnl_init(void);
-void ovs_tnl_exit(void);
-static inline struct tnl_vport *tnl_vport_priv(const struct vport *vport)
-{
- return vport_priv(vport);
-}