History

vxlan: combine VXLAN_FLOWBASED into VXLAN_COLLECT_METADATA

IFLA_VXLAN_FLOWBASED is useless without IFLA_VXLAN_COLLECT_METADATA, so combine them into single IFLA_VXLAN_COLLECT_METADATA flag. 'flowbased' doesn't convey real meaning of the vxlan tunnel mode. This mode can be used by routing, tc+bpf and ovs. Only ovs is strictly flow based, so 'collect metadata' is a better name for this tunnel mode.

Alexei Starovoitov committed 11 years ago

Commit da8b43c1 parent e03c5124 files · +8 −16Browse files

Unified · Split

4 files
  1. drivers/net/vxlan.c +6 −11
  2. include/net/vxlan.h +1 −3
  3. include/uapi/linux/if_link.h +0 −1
  4. net/openvswitch/vport-vxlan.c +1 −1
drivers/net/vxlan.c+6−11
@@ -1141,7 +1141,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, · 1140 unmodified lines
1141 union vxlan_addr *remote_ip;1141 union vxlan_addr *remote_ip;
1142 1142
1143 /* For flow based devices, map all packets to VNI 0 */1143 /* For flow based devices, map all packets to VNI 0 */
1144 if (vs->flags & VXLAN_F_FLOW_BASED)1144 if (vs->flags & VXLAN_F_COLLECT_METADATA)
1145 vni = 0;1145 vni = 0;
1146 1146
1147 /* Is this VNI defined? */1147 /* Is this VNI defined? */
@@ -1183,7 +1183,7 @@ static void vxlan_rcv(struct vxlan_sock *vs, struct sk_buff *skb, · 35 unmodified lines
1183 1183
1184 skb_reset_network_header(skb);1184 skb_reset_network_header(skb);
1185 /* In flow-based mode, GBP is carried in dst_metadata */1185 /* In flow-based mode, GBP is carried in dst_metadata */
1186 if (!(vs->flags & VXLAN_F_FLOW_BASED))1186 if (!(vs->flags & VXLAN_F_COLLECT_METADATA))
1187 skb->mark = md->gbp;1187 skb->mark = md->gbp;
1188 1188
1189 if (oip6)1189 if (oip6)
@@ -2129,7 +2129,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev) · 939 unmodified lines
2129#endif2129#endif
2130 }2130 }
2131 2131
2132 if (vxlan->flags & VXLAN_F_FLOW_BASED &&2132 if (vxlan->flags & VXLAN_F_COLLECT_METADATA &&
2133 info && info->mode == IP_TUNNEL_INFO_TX) {2133 info && info->mode == IP_TUNNEL_INFO_TX) {
2134 vxlan_xmit_one(skb, dev, NULL, false);2134 vxlan_xmit_one(skb, dev, NULL, false);
2135 return NETDEV_TX_OK;2135 return NETDEV_TX_OK;
@@ -2462,7 +2462,6 @@ static const struct nla_policy vxlan_policy[IFLA_VXLAN_MAX + 1] = { · 326 unmodified lines
2462 [IFLA_VXLAN_RSC] = { .type = NLA_U8 },2462 [IFLA_VXLAN_RSC] = { .type = NLA_U8 },
2463 [IFLA_VXLAN_L2MISS] = { .type = NLA_U8 },2463 [IFLA_VXLAN_L2MISS] = { .type = NLA_U8 },
2464 [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 },2464 [IFLA_VXLAN_L3MISS] = { .type = NLA_U8 },
2465 [IFLA_VXLAN_FLOWBASED] = { .type = NLA_U8 },
2466 [IFLA_VXLAN_COLLECT_METADATA] = { .type = NLA_U8 },2465 [IFLA_VXLAN_COLLECT_METADATA] = { .type = NLA_U8 },
2467 [IFLA_VXLAN_PORT] = { .type = NLA_U16 },2466 [IFLA_VXLAN_PORT] = { .type = NLA_U16 },
2468 [IFLA_VXLAN_UDP_CSUM] = { .type = NLA_U8 },2467 [IFLA_VXLAN_UDP_CSUM] = { .type = NLA_U8 },
@@ -2814,10 +2813,6 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev, · 345 unmodified lines
2814 if (data[IFLA_VXLAN_LIMIT])2813 if (data[IFLA_VXLAN_LIMIT])
2815 conf.addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]);2814 conf.addrmax = nla_get_u32(data[IFLA_VXLAN_LIMIT]);
2816 2815
2817 if (data[IFLA_VXLAN_FLOWBASED] &&
2818 nla_get_u8(data[IFLA_VXLAN_FLOWBASED]))
2819 conf.flags |= VXLAN_F_FLOW_BASED;
2820
2821 if (data[IFLA_VXLAN_COLLECT_METADATA] &&2816 if (data[IFLA_VXLAN_COLLECT_METADATA] &&
2822 nla_get_u8(data[IFLA_VXLAN_COLLECT_METADATA]))2817 nla_get_u8(data[IFLA_VXLAN_COLLECT_METADATA]))
2823 conf.flags |= VXLAN_F_COLLECT_METADATA;2818 conf.flags |= VXLAN_F_COLLECT_METADATA;
@@ -2903,7 +2898,7 @@ static size_t vxlan_get_size(const struct net_device *dev) · 79 unmodified lines
2903 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_RSC */2898 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_RSC */
2904 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_L2MISS */2899 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_L2MISS */
2905 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_L3MISS */2900 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_L3MISS */
2906 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_FLOWBASED */2901 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_COLLECT_METADATA */
2907 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_AGEING */2902 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_AGEING */
2908 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LIMIT */2903 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LIMIT */
2909 nla_total_size(sizeof(struct ifla_vxlan_port_range)) +2904 nla_total_size(sizeof(struct ifla_vxlan_port_range)) +
@@ -2970,8 +2965,8 @@ static int vxlan_fill_info(struct sk_buff *skb, const struct net_device *dev) · 60 unmodified lines
2970 !!(vxlan->flags & VXLAN_F_L2MISS)) ||2965 !!(vxlan->flags & VXLAN_F_L2MISS)) ||
2971 nla_put_u8(skb, IFLA_VXLAN_L3MISS,2966 nla_put_u8(skb, IFLA_VXLAN_L3MISS,
2972 !!(vxlan->flags & VXLAN_F_L3MISS)) ||2967 !!(vxlan->flags & VXLAN_F_L3MISS)) ||
2973 nla_put_u8(skb, IFLA_VXLAN_FLOWBASED,2968 nla_put_u8(skb, IFLA_VXLAN_COLLECT_METADATA,
2974 !!(vxlan->flags & VXLAN_F_FLOW_BASED)) ||2969 !!(vxlan->flags & VXLAN_F_COLLECT_METADATA)) ||
2975 nla_put_u32(skb, IFLA_VXLAN_AGEING, vxlan->cfg.age_interval) ||2970 nla_put_u32(skb, IFLA_VXLAN_AGEING, vxlan->cfg.age_interval) ||
2976 nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->cfg.addrmax) ||2971 nla_put_u32(skb, IFLA_VXLAN_LIMIT, vxlan->cfg.addrmax) ||
2977 nla_put_be16(skb, IFLA_VXLAN_PORT, vxlan->cfg.dst_port) ||2972 nla_put_be16(skb, IFLA_VXLAN_PORT, vxlan->cfg.dst_port) ||
include/net/vxlan.h+1−3
@@ -181,7 +181,6 @@ struct vxlan_dev { · 180 unmodified lines
181#define VXLAN_F_GBP 0x800181#define VXLAN_F_GBP 0x800
182#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000182#define VXLAN_F_REMCSUM_NOPARTIAL 0x1000
183#define VXLAN_F_COLLECT_METADATA 0x2000183#define VXLAN_F_COLLECT_METADATA 0x2000
184#define VXLAN_F_FLOW_BASED 0x4000
185 184
186/* Flags that are used in the receive path. These flags must match in185/* Flags that are used in the receive path. These flags must match in
187 * order for a socket to be shareable186 * order for a socket to be shareable
@@ -190,8 +189,7 @@ struct vxlan_dev { · 2 unmodified lines
190 VXLAN_F_UDP_ZERO_CSUM6_RX | \189 VXLAN_F_UDP_ZERO_CSUM6_RX | \
191 VXLAN_F_REMCSUM_RX | \190 VXLAN_F_REMCSUM_RX | \
192 VXLAN_F_REMCSUM_NOPARTIAL | \191 VXLAN_F_REMCSUM_NOPARTIAL | \
193 VXLAN_F_COLLECT_METADATA | \192 VXLAN_F_COLLECT_METADATA)
194 VXLAN_F_FLOW_BASED)
195 193
196struct net_device *vxlan_dev_create(struct net *net, const char *name,194struct net_device *vxlan_dev_create(struct net *net, const char *name,
197 u8 name_assign_type, struct vxlan_config *conf);195 u8 name_assign_type, struct vxlan_config *conf);
include/uapi/linux/if_link.h+0−1
@@ -382,7 +382,6 @@ enum { · 381 unmodified lines
382 IFLA_VXLAN_REMCSUM_RX,382 IFLA_VXLAN_REMCSUM_RX,
383 IFLA_VXLAN_GBP,383 IFLA_VXLAN_GBP,
384 IFLA_VXLAN_REMCSUM_NOPARTIAL,384 IFLA_VXLAN_REMCSUM_NOPARTIAL,
385 IFLA_VXLAN_FLOWBASED,
386 IFLA_VXLAN_COLLECT_METADATA,385 IFLA_VXLAN_COLLECT_METADATA,
387 __IFLA_VXLAN_MAX386 __IFLA_VXLAN_MAX
388};387};
net/openvswitch/vport-vxlan.c+1−1
@@ -90,7 +90,7 @@ static struct vport *vxlan_tnl_create(const struct vport_parms *parms) · 89 unmodified lines
90 int err;90 int err;
91 struct vxlan_config conf = {91 struct vxlan_config conf = {
92 .no_share = true,92 .no_share = true,
93 .flags = VXLAN_F_FLOW_BASED | VXLAN_F_COLLECT_METADATA,93 .flags = VXLAN_F_COLLECT_METADATA,
94 };94 };
95 95
96 if (!options) {96 if (!options) {