netprio_cgroup.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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/module.h>
  16. #include <linux/cgroup.h>
  17. #include <linux/hardirq.h>
  18. #include <linux/rcupdate.h>
  19. struct netprio_map {
  20. struct rcu_head rcu;
  21. u32 priomap_len;
  22. u32 priomap[];
  23. };
  24. #ifdef CONFIG_CGROUPS
  25. struct cgroup_netprio_state {
  26. struct cgroup_subsys_state css;
  27. u32 prioidx;
  28. };
  29. #ifndef CONFIG_NETPRIO_CGROUP
  30. extern int net_prio_subsys_id;
  31. #endif
  32. extern void sock_update_netprioidx(struct sock *sk);
  33. static inline struct cgroup_netprio_state
  34. *task_netprio_state(struct task_struct *p)
  35. {
  36. #if IS_ENABLED(CONFIG_NETPRIO_CGROUP)
  37. return container_of(task_subsys_state(p, net_prio_subsys_id),
  38. struct cgroup_netprio_state, css);
  39. #else
  40. return NULL;
  41. #endif
  42. }
  43. #else
  44. #define sock_update_netprioidx(sk)
  45. #endif
  46. #endif /* _NET_CLS_CGROUP_H */