netprio_cgroup.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #if IS_ENABLED(CONFIG_CGROUP_NET_PRIO)
  19. struct netprio_map {
  20. struct rcu_head rcu;
  21. u32 priomap_len;
  22. u32 priomap[];
  23. };
  24. void sock_update_netprioidx(struct sock *sk);
  25. static inline u32 task_netprioidx(struct task_struct *p)
  26. {
  27. struct cgroup_subsys_state *css;
  28. u32 idx;
  29. rcu_read_lock();
  30. css = task_css(p, net_prio_cgrp_id);
  31. idx = css->cgroup->id;
  32. rcu_read_unlock();
  33. return idx;
  34. }
  35. #else /* !CONFIG_CGROUP_NET_PRIO */
  36. static inline u32 task_netprioidx(struct task_struct *p)
  37. {
  38. return 0;
  39. }
  40. #define sock_update_netprioidx(sk)
  41. #endif /* CONFIG_CGROUP_NET_PRIO */
  42. #endif /* _NET_CLS_CGROUP_H */