/*
 * Copyright (c) 2014 Jiri Pirko <jiri@resnulli.us>
 *
 * 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_VLAN_H
#define __NET_TC_VLAN_H

#include <net/act_api.h>
#include <linux/tc_act/tc_vlan.h>

#define VLAN_F_POP		0x1
#define VLAN_F_PUSH		0x2

struct tcf_vlan {
	struct tc_action	common;
	int			tcfv_action;
	u16			tcfv_push_vid;
	__be16			tcfv_push_proto;
	u8			tcfv_push_prio;
};
#define to_vlan(a) ((struct tcf_vlan *)a)

static inline bool is_tcf_vlan(const struct tc_action *a)
{
#ifdef CONFIG_NET_CLS_ACT
	if (a->ops && a->ops->type == TCA_ACT_VLAN)
		return true;
#endif
	return false;
}

static inline u32 tcf_vlan_action(const struct tc_action *a)
{
	return to_vlan(a)->tcfv_action;
}

static inline u16 tcf_vlan_push_vid(const struct tc_action *a)
{
	return to_vlan(a)->tcfv_push_vid;
}

static inline __be16 tcf_vlan_push_proto(const struct tc_action *a)
{
	return to_vlan(a)->tcfv_push_proto;
}

#endif /* __NET_TC_VLAN_H */
alue='nds-private-remove'>nds-private-remove</option>
<option value='packet-loop-back'>packet-loop-back</option>
<option value='packet-rx-pump-back'>packet-rx-pump-back</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>net-next plumbings</td><td class='sub right'>Tobias Klauser</td></tr></table>
<table class='tabs'><tr><td>
<a href='/cgit.cgi/linux/net-next.git/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>refs</a><a href='/cgit.cgi/linux/net-next.git/log/net/sched/cls_matchall.c'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>tree</a><a class='active' href='/cgit.cgi/linux/net-next.git/commit/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/net/sched/cls_matchall.c'>
<input type='hidden' name='id' value='fd62d9f5c575f0792f150109f1fd24a0d4b3f854'/><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/?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/net?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>net</a>/<a href='/cgit.cgi/linux/net-next.git/commit/net/sched?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>sched</a>/<a href='/cgit.cgi/linux/net-next.git/commit/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>cls_matchall.c</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='id' value='fd62d9f5c575f0792f150109f1fd24a0d4b3f854'/><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>Yotam Gigi &lt;yotamg@mellanox.com&gt;</td><td class='right'>2017-01-31 15:14:29 +0200</td></tr>
<tr><th>committer</th><td>David S. Miller &lt;davem@davemloft.net&gt;</td><td class='right'>2017-02-01 11:57:33 -0500</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>fd62d9f5c575f0792f150109f1fd24a0d4b3f854</a> (<a href='/cgit.cgi/linux/net-next.git/patch/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>d040d634401cf38fcb447c13aff26d0f492a82a1</a> /<a href='/cgit.cgi/linux/net-next.git/tree/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>net/sched/cls_matchall.c</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/net/sched/cls_matchall.c?id=4993b39ab04b083ff6ee1147e7e7f120feb6bf7f'>4993b39ab04b083ff6ee1147e7e7f120feb6bf7f</a> (<a href='/cgit.cgi/linux/net-next.git/diff/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854&amp;id2=4993b39ab04b083ff6ee1147e7e7f120feb6bf7f'>diff</a>)</td></tr></table>
<div class='commit-subject'>net/sched: matchall: Fix configuration race</div><div class='commit-msg'>In the current version, the matchall internal state is split into two
structs: cls_matchall_head and cls_matchall_filter. This makes little
sense, as matchall instance supports only one filter, and there is no
situation where one exists and the other does not. In addition, that led
to some races when filter was deleted while packet was processed.

Unify that two structs into one, thus simplifying the process of matchall
creation and deletion. As a result, the new, delete and get callbacks have
a dummy implementation where all the work is done in destroy and change
callbacks, as was done in cls_cgroup.

Fixes: bf3994d2ed31 ("net/sched: introduce Match-all classifier")
Reported-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Signed-off-by: Yotam Gigi &lt;yotamg@mellanox.com&gt;
Acked-by: Jiri Pirko &lt;jiri@mellanox.com&gt;
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/?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>Diffstat</a> (limited to 'net/sched/cls_matchall.c')</div><table summary='diffstat' class='diffstat'><tr><td class='mode'>-rw-r--r--</td><td class='upd'><a href='/cgit.cgi/linux/net-next.git/diff/net/sched/cls_matchall.c?id=fd62d9f5c575f0792f150109f1fd24a0d4b3f854'>net/sched/cls_matchall.c</a></td><td class='right'>127</td><td class='graph'><table summary='file diffstat' width='100%'><tr><td class='add' style='width: 35.4%;'/><td class='rem' style='width: 64.6%;'/><td class='none' style='width: 0.0%;'/></tr></table></td></tr>
</table><div class='diffstat-summary'>1 files changed, 45 insertions, 82 deletions</div><table summary='diff' class='diff'><tr><td><div class='head'>diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c