mirror of
https://github.com/openvswitch/ovs
synced 2025-10-23 14:57:06 +00:00
datapath: Kill VPORT_F_TUN_ID vport flag.
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 <pshelar@nicira.com> Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -138,7 +134,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 *);
|
||||
@@ -196,7 +191,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
|
||||
|
||||
Reference in New Issue
Block a user