netprio_cgroup.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * netprio_cgroup.h Control Group Priority set
  3. *
  4. *
  5. * Authors: Neil Horman <nhorman@tuxdriver.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the Free
  9. * Software Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. */
  13. #ifndef _NETPRIO_CGROUP_H
  14. #define _NETPRIO_CGROUP_H
  15. #include <linux/cgroup.h>
  16. #include <linux/hardirq.h>
  17. #include <linux/rcupdate.h>
  18. struct netprio_map {
  19. struct rcu_head rcu;
  20. u32 priomap_len;
  21. u32 priomap[];
  22. };
  23. #ifdef CONFIG_CGROUPS
  24. struct cgroup_netprio_state {
  25. struct cgroup_subsys_state css;
  26. u32 prioidx;
  27. };
  28. #ifndef CONFIG_NETPRIO_CGROUP
  29. extern int net_prio_subsys_id;
  30. #endif
  31. extern void sock_update_netprioidx(struct sock *sk);
  32. static inline struct cgroup_netprio_state
  33. *task_netprio_state(struct task_struct *p)
  34. {
  35. #if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
  36. return container_of(task_subsys_state(p, net_prio_subsys_id),
  37. struct cgroup_netprio_state, css);
  38. #else
  39. return NULL;
  40. #endif
  41. }
  42. #else
  43. #define sock_update_netprioidx(sk)
  44. #endif
  45. #endif /* _NET_CLS_CGROUP_H */