VPORT_F_TUN_ID is last remaining flag, once we remove it, flags
field from vport-ops can be removed.  Since it does not complicate
much code, we decided to remove this flag.

Signed-off-by: Pravin B Shelar <[email protected]>
---
v3-v4:
 - Pass tun_key as param to ovs_vport_receive().

v1-v3:
New patch.
---
 datapath/tunnel.c             |    5 +++--
 datapath/tunnel.h             |    3 ++-
 datapath/vport-gre.c          |    5 +----
 datapath/vport-internal_dev.c |    2 +-
 datapath/vport-lisp.c         |    4 +---
 datapath/vport-netdev.c       |    2 +-
 datapath/vport-vxlan.c        |    4 +---
 datapath/vport.c              |    7 +++----
 datapath/vport.h              |    8 ++------
 9 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 8cf1c16..8c93e18 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -58,7 +58,8 @@
  * - skb->csum does not include the inner Ethernet header.
  * - The layer pointers are undefined.
  */
-void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb)
+void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb,
+                struct ovs_key_ipv4_tunnel *tun_key)
 {
        struct ethhdr *eh;
 
@@ -81,7 +82,7 @@ void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb)
                return;
        }
 
-       ovs_vport_receive(vport, skb);
+       ovs_vport_receive(vport, skb, tun_key);
 }
 
 static struct rtable *find_route(struct net *net,
diff --git a/datapath/tunnel.h b/datapath/tunnel.h
index 75a84d1..89c4e16 100644
--- a/datapath/tunnel.h
+++ b/datapath/tunnel.h
@@ -33,7 +33,8 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb,
                                      struct sk_buff *,
                                      int tunnel_hlen));
 
-void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb);
+void ovs_tnl_rcv(struct vport *vport, struct sk_buff *skb,
+                struct ovs_key_ipv4_tunnel *tun_key);
 u16 ovs_tnl_get_src_port(struct sk_buff *skb);
 
 static inline void tnl_tun_key_init(struct ovs_key_ipv4_tunnel *tun_key,
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index 1f046ae..add17d9 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -270,12 +270,11 @@ static int gre_rcv(struct sk_buff *skb)
        iph = ip_hdr(skb);
        tnl_flags = gre_flags_to_tunnel_flags(gre_flags, is_gre64);
        tnl_tun_key_init(&tun_key, iph, key, tnl_flags);
-       OVS_CB(skb)->tun_key = &tun_key;
 
        __skb_pull(skb, hdr_len);
        skb_postpull_rcsum(skb, skb_transport_header(skb), hdr_len + ETH_HLEN);
 
-       ovs_tnl_rcv(vport, skb);
+       ovs_tnl_rcv(vport, skb, &tun_key);
        return 0;
 
 error:
@@ -375,7 +374,6 @@ static int gre_tnl_send(struct vport *vport, struct sk_buff 
*skb)
 
 const struct vport_ops ovs_gre_vport_ops = {
        .type           = OVS_VPORT_TYPE_GRE,
-       .flags          = VPORT_F_TUN_ID,
        .create         = gre_create,
        .destroy        = gre_tnl_destroy,
        .get_name       = gre_get_name,
@@ -437,7 +435,6 @@ static int gre64_tnl_send(struct vport *vport, struct 
sk_buff *skb)
 
 const struct vport_ops ovs_gre64_vport_ops = {
        .type           = OVS_VPORT_TYPE_GRE64,
-       .flags          = VPORT_F_TUN_ID,
        .create         = gre64_create,
        .destroy        = gre64_tnl_destroy,
        .get_name       = gre_get_name,
diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
index 1b19bfc..9a159cd 100644
--- a/datapath/vport-internal_dev.c
+++ b/datapath/vport-internal_dev.c
@@ -94,7 +94,7 @@ static int internal_dev_xmit(struct sk_buff *skb, struct 
net_device *netdev)
        vlan_copy_skb_tci(skb);
 
        rcu_read_lock();
-       ovs_vport_receive(internal_dev_priv(netdev)->vport, skb);
+       ovs_vport_receive(internal_dev_priv(netdev)->vport, skb, NULL);
        rcu_read_unlock();
        return 0;
 }
diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c
index 554495d..ca2b441 100644
--- a/datapath/vport-lisp.c
+++ b/datapath/vport-lisp.c
@@ -219,7 +219,6 @@ static int lisp_rcv(struct sock *sk, struct sk_buff *skb)
        /* Save outer tunnel values */
        iph = ip_hdr(skb);
        tnl_tun_key_init(&tun_key, iph, key, OVS_TNL_F_KEY);
-       OVS_CB(skb)->tun_key = &tun_key;
 
        /* Drop non-IP inner packets */
        inner_iph = (struct iphdr *)(lisph + 1);
@@ -241,7 +240,7 @@ static int lisp_rcv(struct sock *sk, struct sk_buff *skb)
        ethh->h_source[0] = 0x02;
        ethh->h_proto = protocol;
 
-       ovs_tnl_rcv(vport_from_priv(lisp_port), skb);
+       ovs_tnl_rcv(vport_from_priv(lisp_port), skb, &tun_key);
        goto out;
 
 error:
@@ -390,7 +389,6 @@ static const char *lisp_get_name(const struct vport *vport)
 
 const struct vport_ops ovs_lisp_vport_ops = {
        .type           = OVS_VPORT_TYPE_LISP,
-       .flags          = VPORT_F_TUN_ID,
        .create         = lisp_tnl_create,
        .destroy        = lisp_tnl_destroy,
        .get_name       = lisp_get_name,
diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
index 9233f90..4e7342c 100644
--- a/datapath/vport-netdev.c
+++ b/datapath/vport-netdev.c
@@ -263,7 +263,7 @@ static void netdev_port_receive(struct vport *vport, struct 
sk_buff *skb)
 
        vlan_copy_skb_tci(skb);
 
-       ovs_vport_receive(vport, skb);
+       ovs_vport_receive(vport, skb, NULL);
        return;
 
 error:
diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
index 6a9ff26..d140c3b 100644
--- a/datapath/vport-vxlan.c
+++ b/datapath/vport-vxlan.c
@@ -137,9 +137,8 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
        /* Save outer tunnel values */
        iph = ip_hdr(skb);
        tnl_tun_key_init(&tun_key, iph, key, OVS_TNL_F_KEY);
-       OVS_CB(skb)->tun_key = &tun_key;
 
-       ovs_tnl_rcv(vport_from_priv(vxlan_vport), skb);
+       ovs_tnl_rcv(vport_from_priv(vxlan_vport), skb, &tun_key);
        goto out;
 
 error:
@@ -274,7 +273,6 @@ static const char *vxlan_get_name(const struct vport *vport)
 
 const struct vport_ops ovs_vxlan_vport_ops = {
        .type           = OVS_VPORT_TYPE_VXLAN,
-       .flags          = VPORT_F_TUN_ID,
        .create         = vxlan_tnl_create,
        .destroy        = vxlan_tnl_destroy,
        .get_name       = vxlan_get_name,
diff --git a/datapath/vport.c b/datapath/vport.c
index 6f2b2f6..93ab2b5 100644
--- a/datapath/vport.c
+++ b/datapath/vport.c
@@ -354,7 +354,8 @@ int ovs_vport_get_options(const struct vport *vport, struct 
sk_buff *skb)
  * skb->data should point to the Ethernet header.  The caller must have already
  * called compute_ip_summed() to initialize the checksumming fields.
  */
-void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
+void ovs_vport_receive(struct vport *vport, struct sk_buff *skb,
+                      struct ovs_key_ipv4_tunnel *tun_key)
 {
        struct pcpu_tstats *stats;
 
@@ -364,9 +365,7 @@ void ovs_vport_receive(struct vport *vport, struct sk_buff 
*skb)
        stats->rx_bytes += skb->len;
        u64_stats_update_end(&stats->syncp);
 
-       if (!(vport->ops->flags & VPORT_F_TUN_ID))
-               OVS_CB(skb)->tun_key = NULL;
-
+       OVS_CB(skb)->tun_key = tun_key;
        ovs_dp_process_received_packet(vport, skb);
 }
 
diff --git a/datapath/vport.h b/datapath/vport.h
index 075c804..9f7c50f 100644
--- a/datapath/vport.h
+++ b/datapath/vport.h
@@ -94,8 +94,6 @@ struct vport {
        struct ovs_vport_stats offset_stats;
 };
 
-#define VPORT_F_TUN_ID         (1 << 0) /* Sets OVS_CB(skb)->tun_id. */
-
 /**
  * struct vport_parms - parameters for creating a new vport
  *
@@ -121,8 +119,6 @@ struct vport_parms {
  * struct vport_ops - definition of a type of virtual port
  *
  * @type: %OVS_VPORT_TYPE_* value for this type of virtual port.
- * @flags: Flags of type VPORT_F_* that influence how the generic vport layer
- * handles this vport.
  * @create: Create a new vport configured as specified.  On success returns
  * a new vport allocated with ovs_vport_alloc(), otherwise an ERR_PTR() value.
  * @destroy: Destroys a vport.  Must call vport_free() on the vport but not
@@ -140,7 +136,6 @@ struct vport_parms {
  */
 struct vport_ops {
        enum ovs_vport_type type;
-       u32 flags;
 
        /* Called with ovs_mutex. */
        struct vport *(*create)(const struct vport_parms *);
@@ -199,7 +194,8 @@ static inline struct vport *vport_from_priv(const void 
*priv)
        return (struct vport *)(priv - ALIGN(sizeof(struct vport), 
VPORT_ALIGN));
 }
 
-void ovs_vport_receive(struct vport *, struct sk_buff *);
+void ovs_vport_receive(struct vport *, struct sk_buff *,
+                      struct ovs_key_ipv4_tunnel *);
 void ovs_vport_record_error(struct vport *, enum vport_err_type err_type);
 
 /* List of statically compiled vport implementations.  Don't forget to also
-- 
1.7.1

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to