if (geneve->collect_md) {
info = skb_tunnel_info(skb);
- if (unlikely(info && info->mode != IP_TUNNEL_INFO_TX)) {
+ if (unlikely(info && !(info->mode & IP_TUNNEL_INFO_TX))) {
netdev_dbg(dev, "no tunnel metadata\n");
goto tx_error;
}
}
if (vxlan->flags & VXLAN_F_COLLECT_METADATA &&
- info && info->mode == IP_TUNNEL_INFO_TX) {
+ info && info->mode & IP_TUNNEL_INFO_TX) {
vxlan_xmit_one(skb, dev, NULL, false);
return NETDEV_TX_OK;
}
return NULL;
info = &tun_dst->u.tun_info;
- info->mode = IP_TUNNEL_INFO_RX;
info->key.tun_flags = flags;
info->key.tun_id = tunnel_id;
info->key.tp_src = 0;
__be16 tp_dst;
};
-/* Indicates whether the tunnel info structure represents receive
- * or transmit tunnel parameters.
- */
-enum {
- IP_TUNNEL_INFO_RX,
- IP_TUNNEL_INFO_TX,
-};
+/* Flags for ip_tunnel_info mode. */
+#define IP_TUNNEL_INFO_TX 0x01 /* represents tx tunnel parameters */
struct ip_tunnel_info {
struct ip_tunnel_key key;
int err;
tun_info = skb_tunnel_info(skb);
- if (unlikely(!tun_info || tun_info->mode != IP_TUNNEL_INFO_TX))
+ if (unlikely(!tun_info || !(tun_info->mode & IP_TUNNEL_INFO_TX)))
goto err_free_skb;
key = &tun_info->key;
*/
tun_info = skb_tunnel_info(skb);
- if (tun_info && tun_info->mode == IP_TUNNEL_INFO_RX)
+ if (tun_info && !(tun_info->mode & IP_TUNNEL_INFO_TX))
fl4.flowi4_tun_key.tun_id = tun_info->key.tun_id;
else
fl4.flowi4_tun_key.tun_id = 0;
};
tun_info = skb_tunnel_info(skb);
- if (tun_info && tun_info->mode == IP_TUNNEL_INFO_RX)
+ if (tun_info && !(tun_info->mode & IP_TUNNEL_INFO_TX))
fl6.flowi6_tun_key.tun_id = tun_info->key.tun_id;
skb_dst_drop(skb);
skb_dst_set(skb, ip6_route_input_lookup(net, skb->dev, &fl6, flags));