/*
 * netprio_cgroup.h			Control Group Priority set
 *
 *
 * Authors:	Neil Horman <nhorman@tuxdriver.com>
 *
 * 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 _NETPRIO_CGROUP_H
#define _NETPRIO_CGROUP_H

#include <linux/cgroup.h>
#include <linux/hardirq.h>
#include <linux/rcupdate.h>

#if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
struct netprio_map {
	struct rcu_head rcu;
	u32 priomap_len;
	u32 priomap[];
};

static inline u32 task_netprioidx(struct task_struct *p)
{
	struct cgroup_subsys_state *css;
	u32 idx;

	rcu_read_lock();
	css = task_css(p, net_prio_cgrp_id);
	idx = css->cgroup->id;
	rcu_read_unlock();
	return idx;
}

static inline void sock_update_netprioidx(struct sock_cgroup_data *skcd)
{
	if (in_interrupt())
		return;

	sock_cgroup_set_prioidx(skcd, task_netprioidx(current));
}

#else /* !CONFIG_CGROUP_NET_PRIO */

static inline u32 task_netprioidx(struct task_struct *p)
{
	return 0;
}

static inline void sock_update_netprioidx(struct sock_cgroup_data *skcd)
{
}

#endif /* CONFIG_CGROUP_NET_PRIO */
#endif  /* _NET_CLS_CGROUP_H */
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=b91e055c57e45131470d4935e4a726bd65b14580'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86/util/intel-pt.c'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/perf/arch/x86/util/intel-pt.c?id=b91e055c57e45131470d4935e4a726bd65b14580'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/arch/x86/util/intel-pt.c?id=b91e055c57e45131470d4935e4a726bd65b14580'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/arch/x86/util/intel-pt.c?id=b91e055c57e45131470d4935e4a726bd65b14580'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86/util/intel-pt.c'>
<input type='hidden' name='id' value='b91e055c57e45131470d4935e4a726bd65b14580'/><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/log/?id=b91e055c57e45131470d4935e4a726bd65b14580'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=b91e055c57e45131470d4935e4a726bd65b14580'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf?id=b91e055c57e45131470d4935e4a726bd65b14580'>perf</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch?id=b91e055c57e45131470d4935e4a726bd65b14580'>arch</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86?id=b91e055c57e45131470d4935e4a726bd65b14580'>x86</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86/util?id=b91e055c57e45131470d4935e4a726bd65b14580'>util</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86/util/intel-pt.c?id=b91e055c57e45131470d4935e4a726bd65b14580'>intel-pt.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/x86/util/intel-pt.c?id=b91e055c57e45131470d4935e4a726bd65b14580&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>