Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46fa062a authored by Jiri Benc's avatar Jiri Benc Committed by David S. Miller
Browse files

ip_tunnels: convert the mode field of ip_tunnel_info to flags



The mode field holds a single bit of information only (whether the
ip_tunnel_info struct is for rx or tx). Change the mode field to bit flags.
This allows more mode flags to be added.

Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Acked-by: default avatarAlexei Starovoitov <ast@plumgrid.com>
Acked-by: default avatarThomas Graf <tgraf@suug.ch>
Acked-by: default avatarPravin B Shelar <pshelar@nicira.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f6d3c192
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -623,7 +623,7 @@ static netdev_tx_t geneve_xmit(struct sk_buff *skb, struct net_device *dev)

	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;
		}
+1 −1
Original line number Diff line number Diff line
@@ -2113,7 +2113,7 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
	}

	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;
	}
+0 −1
Original line number Diff line number Diff line
@@ -59,7 +59,6 @@ static inline struct metadata_dst *tun_rx_dst(__be16 flags,
		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;
+2 −7
Original line number Diff line number Diff line
@@ -50,13 +50,8 @@ struct ip_tunnel_key {
	__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;
+1 −1
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
	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;
Loading