datapath: Remove vport MAC address configuration.
[sliver-openvswitch.git] / datapath / tunnel.h
index ef09162..7ff44f1 100644 (file)
@@ -42,6 +42,7 @@
 #define TNL_T_PROTO_GRE                0
 #define TNL_T_PROTO_GRE64      1
 #define TNL_T_PROTO_CAPWAP     2
+#define TNL_T_PROTO_VXLAN      3
 
 /* These flags are only needed when calling tnl_find_port(). */
 #define TNL_T_KEY_EXACT                (1 << 10)
@@ -55,8 +56,7 @@
 
 /* All public tunnel flags. */
 #define TNL_F_PUBLIC (TNL_F_CSUM | TNL_F_TOS_INHERIT | TNL_F_TTL_INHERIT | \
-                     TNL_F_DF_INHERIT | TNL_F_DF_DEFAULT | TNL_F_PMTUD | \
-                     TNL_F_IPSEC)
+                     TNL_F_DF_DEFAULT | TNL_F_IPSEC)
 
 /**
  * struct port_lookup_key - Tunnel port key, used as hash table key.
@@ -96,8 +96,6 @@ static inline void port_key_set_net(struct port_lookup_key *key, struct net *net
  * @rcu: RCU callback head for deferred destruction.
  * @seq: Sequence number for distinguishing configuration versions.
  * @tunnel_hlen: Tunnel header length.
- * @eth_addr: Source address for packets generated by tunnel itself
- * (e.g. ICMP fragmentation needed messages).
  * @out_key: Key to use on output, 0 if this tunnel has no fixed output key.
  * @flags: TNL_F_* flags.
  * @tos: IPv4 TOS value to use for tunnel, 0 if no fixed TOS.
@@ -109,13 +107,12 @@ struct tnl_mutable_config {
 
        unsigned seq;
 
-       unsigned char eth_addr[ETH_ALEN];
-
        /* Configured via OVS_TUNNEL_ATTR_* attributes. */
        __be64  out_key;
        u32     flags;
        u8      tos;
        u8      ttl;
+       __be16  dst_port;
 
        /* Multicast configuration. */
        int     mlink;
@@ -169,9 +166,7 @@ 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);
 
@@ -199,6 +194,31 @@ static inline void tnl_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
        tun_key->ipv4_tos = iph->tos;
        tun_key->ipv4_ttl = iph->ttl;
        tun_key->tun_flags = tun_flags;
+
+       /* clear struct padding. */
+       memset((unsigned char*) tun_key + OVS_TUNNEL_KEY_SIZE, 0,
+              sizeof(*tun_key) - OVS_TUNNEL_KEY_SIZE);
+}
+
+static inline void tnl_get_param(const struct tnl_mutable_config *mutable,
+                                const struct ovs_key_ipv4_tunnel *tun_key,
+                                u32 *flags,  __be64 *out_key)
+{
+       if (tun_key->ipv4_dst) {
+               *flags = 0;
+
+               if (tun_key->tun_flags & OVS_TNL_F_KEY)
+                       *flags = TNL_F_OUT_KEY_ACTION;
+               if (tun_key->tun_flags & OVS_TNL_F_CSUM)
+                       *flags |= TNL_F_CSUM;
+               *out_key = tun_key->tun_id;
+       } else {
+               *flags = mutable->flags;
+               if (mutable->flags & TNL_F_OUT_KEY_ACTION)
+                       *out_key = tun_key->tun_id;
+               else
+                       *out_key = mutable->out_key;
+       }
 }
 
 #endif /* tunnel.h */