| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * 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
 | 
					
						
							| 
									
										
										
										
											2013-12-29 17:27:11 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | #include <linux/cgroup.h>
 | 
					
						
							|  |  |  | #include <linux/hardirq.h>
 | 
					
						
							|  |  |  | #include <linux/rcupdate.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-29 17:27:11 +01:00
										 |  |  | #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
 | 
					
						
							| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | struct netprio_map { | 
					
						
							|  |  |  | 	struct rcu_head rcu; | 
					
						
							|  |  |  | 	u32 priomap_len; | 
					
						
							|  |  |  | 	u32 priomap[]; | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-07-31 17:31:39 -07:00
										 |  |  | void sock_update_netprioidx(struct sock *sk); | 
					
						
							| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-02-10 05:43:38 +00:00
										 |  |  | static inline u32 task_netprioidx(struct task_struct *p) | 
					
						
							| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2012-11-22 07:32:47 -08:00
										 |  |  | 	struct cgroup_subsys_state *css; | 
					
						
							| 
									
										
										
										
											2012-02-10 05:43:38 +00:00
										 |  |  | 	u32 idx; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	rcu_read_lock(); | 
					
						
							| 
									
										
										
										
											2014-02-08 10:36:58 -05:00
										 |  |  | 	css = task_css(p, net_prio_cgrp_id); | 
					
						
							| 
									
										
										
										
											2012-11-22 07:32:47 -08:00
										 |  |  | 	idx = css->cgroup->id; | 
					
						
							| 
									
										
										
										
											2012-02-10 05:43:38 +00:00
										 |  |  | 	rcu_read_unlock(); | 
					
						
							|  |  |  | 	return idx; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2013-12-29 17:27:11 +01:00
										 |  |  | #else /* !CONFIG_CGROUP_NET_PRIO */
 | 
					
						
							| 
									
										
										
										
											2012-02-10 05:43:38 +00:00
										 |  |  | static inline u32 task_netprioidx(struct task_struct *p) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-08 20:03:47 +00:00
										 |  |  | #define sock_update_netprioidx(sk)
 | 
					
						
							| 
									
										
										
										
											2012-09-12 16:12:03 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-12-29 17:27:11 +01:00
										 |  |  | #endif /* CONFIG_CGROUP_NET_PRIO */
 | 
					
						
							| 
									
										
										
										
											2011-11-22 05:10:51 +00:00
										 |  |  | #endif  /* _NET_CLS_CGROUP_H */
 |