Skip to content

Commit

Permalink
datapath: Shorten flow tunneling flags.
Browse files Browse the repository at this point in the history
The names for the flags used by flow based tunneling are pretty long.
This shortens them a little by removing the word FLOW, which is a
distinction that won't be meaningful in the near future.

Signed-off-by: Jesse Gross <[email protected]>
Acked-by: Kyle Mestery <[email protected]>
  • Loading branch information
jessegross committed Nov 7, 2012
1 parent 5c7f588 commit 49a4902
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions datapath/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,

if (!tun_key->ipv4_dst)
return -EINVAL;
if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
return -EINVAL;

tun_id = nla_get_be64(a[OVS_KEY_ATTR_TUN_ID]);
Expand Down Expand Up @@ -1223,23 +1223,23 @@ int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow, int key_len, const stru
tun_id = nla_get_be64(nla);

if (tun_key->ipv4_dst) {
if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
return -EINVAL;
if (tun_key->tun_id != tun_id)
return -EINVAL;
break;
}
tun_key->tun_id = tun_id;
tun_key->tun_flags |= OVS_FLOW_TNL_F_KEY;
tun_key->tun_flags |= OVS_TNL_F_KEY;

break;

case OVS_KEY_ATTR_IPV4_TUNNEL:
if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY) {
if (tun_key->tun_flags & OVS_TNL_F_KEY) {
tun_id = tun_key->tun_id;

memcpy(tun_key, nla_data(nla), sizeof(*tun_key));
if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
return -EINVAL;

if (tun_key->tun_id != tun_id)
Expand Down Expand Up @@ -1285,7 +1285,7 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
tun_key = nla_data(nla);
memcpy(tun_key, &swkey->phy.tun.tun_key, sizeof(*tun_key));
}
if ((swkey->phy.tun.tun_key.tun_flags & OVS_FLOW_TNL_F_KEY) &&
if ((swkey->phy.tun.tun_key.tun_flags & OVS_TNL_F_KEY) &&
nla_put_be64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun.tun_key.tun_id))
goto nla_put_failure;

Expand Down
2 changes: 1 addition & 1 deletion datapath/tunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ static bool check_mtu(struct sk_buff *skb,
if (OVS_CB(skb)->tun_key->ipv4_dst) {
df_inherit = false;
pmtud = false;
frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_FLOW_TNL_F_DONT_FRAGMENT ?
frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_TNL_F_DONT_FRAGMENT ?
htons(IP_DF) : 0;
} else {
df_inherit = mutable->flags & TNL_F_DF_INHERIT;
Expand Down
6 changes: 3 additions & 3 deletions datapath/vport-capwap.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ static void get_capwap_param(const struct tnl_mutable_config *mutable,
if (tun_key->ipv4_dst) {
*flags = 0;

if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY)
if (tun_key->tun_flags & OVS_TNL_F_KEY)
*flags = TNL_F_OUT_KEY_ACTION;
if (tun_key->tun_flags & OVS_FLOW_TNL_F_CSUM)
if (tun_key->tun_flags & OVS_TNL_F_CSUM)
*flags |= TNL_F_CSUM;
*out_key = tun_key->tun_id;
} else {
Expand Down Expand Up @@ -359,7 +359,7 @@ static int capwap_rcv(struct sock *sk, struct sk_buff *skb)
!(mutable->flags & TNL_F_IN_KEY_MATCH))
key_present = false;

tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_FLOW_TNL_F_KEY : 0);
tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_TNL_F_KEY : 0);
OVS_CB(skb)->tun_key = &tun_key;

ovs_tnl_rcv(vport, skb);
Expand Down
10 changes: 5 additions & 5 deletions datapath/vport-gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ static void get_gre_param(const struct tnl_mutable_config *mutable,
if (tun_key->ipv4_dst) {
*flags = 0;

if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY)
if (tun_key->tun_flags & OVS_TNL_F_KEY)
*flags = TNL_F_OUT_KEY_ACTION;
if (tun_key->tun_flags & OVS_FLOW_TNL_F_CSUM)
if (tun_key->tun_flags & OVS_TNL_F_CSUM)
*flags |= TNL_F_CSUM;
*tunnel_type = TNL_T_PROTO_GRE;
*out_key = tun_key->tun_id;
Expand Down Expand Up @@ -384,13 +384,13 @@ static u32 gre_flags_to_tunnel_flags(const struct tnl_mutable_config *mutable,

if (gre_flags & GRE_KEY) {
if (mutable->key.daddr && (mutable->flags & TNL_F_IN_KEY_MATCH))
tunnel_flags = OVS_FLOW_TNL_F_KEY;
tunnel_flags = OVS_TNL_F_KEY;
else if (!mutable->key.daddr)
tunnel_flags = OVS_FLOW_TNL_F_KEY;
tunnel_flags = OVS_TNL_F_KEY;
}

if (gre_flags & GRE_CSUM)
tunnel_flags |= OVS_FLOW_TNL_F_CSUM;
tunnel_flags |= OVS_TNL_F_CSUM;

return tunnel_flags;
}
Expand Down
6 changes: 3 additions & 3 deletions include/linux/openvswitch.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ struct ovs_key_nd {
};

/* Values for ovs_key_ipv4_tunnel->tun_flags */
#define OVS_FLOW_TNL_F_DONT_FRAGMENT (1 << 0)
#define OVS_FLOW_TNL_F_CSUM (1 << 1)
#define OVS_FLOW_TNL_F_KEY (1 << 2)
#define OVS_TNL_F_DONT_FRAGMENT (1 << 0)
#define OVS_TNL_F_CSUM (1 << 1)
#define OVS_TNL_F_KEY (1 << 2)

struct ovs_key_ipv4_tunnel {
__be64 tun_id;
Expand Down

0 comments on commit 49a4902

Please sign in to comment.