/*
 * Copyright (c) 2016, Amir Vadai <amir@vadai.me>
 * Copyright (c) 2016, Mellanox Technologies. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifndef __NET_TC_TUNNEL_KEY_H
#define __NET_TC_TUNNEL_KEY_H

#include <net/act_api.h>
#include <linux/tc_act/tc_tunnel_key.h>
#include <net/dst_metadata.h>

struct tcf_tunnel_key_params {
	struct rcu_head		rcu;
	int			tcft_action;
	int			action;
	struct metadata_dst     *tcft_enc_metadata;
};

struct tcf_tunnel_key {
	struct tc_action	      common;
	struct tcf_tunnel_key_params __rcu *params;
};

#define to_tunnel_key(a) ((struct tcf_tunnel_key *)a)

static inline bool is_tcf_tunnel_set(const struct tc_action *a)
{
#ifdef CONFIG_NET_CLS_ACT
	struct tcf_tunnel_key *t = to_tunnel_key(a);
	struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);

	if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
		return params->tcft_action == TCA_TUNNEL_KEY_ACT_SET;
#endif
	return false;
}

static inline bool is_tcf_tunnel_release(const struct tc_action *a)
{
#ifdef CONFIG_NET_CLS_ACT
	struct tcf_tunnel_key *t = to_tunnel_key(a);
	struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);

	if (a->ops && a->ops->type == TCA_ACT_TUNNEL_KEY)
		return params->tcft_action == TCA_TUNNEL_KEY_ACT_RELEASE;
#endif
	return false;
}

static inline struct ip_tunnel_info *tcf_tunnel_info(const struct tc_action *a)
{
#ifdef CONFIG_NET_CLS_ACT
	struct tcf_tunnel_key *t = to_tunnel_key(a);
	struct tcf_tunnel_key_params *params = rtnl_dereference(t->params);

	return &params->tcft_enc_metadata->u.tun_info;
#else
	return NULL;
#endif
}
#endif /* __NET_TC_TUNNEL_KEY_H */
ate-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>tree</a><a class='active' href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/virtio/ringtest/main.h'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='3efa70d78f218e4c9276b0bac0545e5184c1c47b'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>virtio</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>ringtest</a>/<a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>main.h</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='3efa70d78f218e4c9276b0bac0545e5184c1c47b'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>David S. Miller &lt;davem@davemloft.net&gt;</td><td class='right'>2017-02-07 16:29:30 -0500</td></tr>
<tr><th>committer</th><td>David S. Miller &lt;davem@davemloft.net&gt;</td><td class='right'>2017-02-07 16:29:30 -0500</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>3efa70d78f218e4c9276b0bac0545e5184c1c47b</a> (<a href='/cgit.cgi/linux/net-next.git/patch/tools/virtio/ringtest/main.h?id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>f4abe2f05e173023d2a262afd4aebb1e89fe6985</a> /<a href='/cgit.cgi/linux/net-next.git/tree/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>tools/virtio/ringtest/main.h</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=76e0e70e6452b971a69cc9794ff4a6715c11f7f2'>76e0e70e6452b971a69cc9794ff4a6715c11f7f2</a> (<a href='/cgit.cgi/linux/net-next.git/diff/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b&amp;id2=76e0e70e6452b971a69cc9794ff4a6715c11f7f2'>diff</a>)</td></tr><tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=926af6273fc683cd98cd0ce7bf0d04a02eed6742'>926af6273fc683cd98cd0ce7bf0d04a02eed6742</a> (<a href='/cgit.cgi/linux/net-next.git/diff/tools/virtio/ringtest/main.h?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b&amp;id2=926af6273fc683cd98cd0ce7bf0d04a02eed6742'>diff</a>)</td></tr></table>
<div class='commit-subject'>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</div><div class='commit-msg'>The conflict was an interaction between a bug fix in the
netvsc driver in 'net' and an optimization of the RX path
in 'net-next'.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&amp;id=3efa70d78f218e4c9276b0bac0545e5184c1c47b'>Diffstat</a> (limited to 'tools/virtio/ringtest/main.h')</div><table summary='diffstat' class='diffstat'>