Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) Network priority cgroup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) =======================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) The Network priority cgroup provides an interface to allow an administrator to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) dynamically set the priority of network traffic generated by various
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) applications
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) Nominally, an application would set the priority of its traffic via the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) SO_PRIORITY socket option.  This however, is not always possible because:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 1) The application may not have been coded to set this value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 2) The priority of application traffic is often a site-specific administrative
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)    decision rather than an application defined one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) This cgroup allows an administrator to assign a process to a group which defines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) the priority of egress traffic on a given interface. Network priority groups can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) be created by first mounting the cgroup filesystem::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	# mount -t cgroup -onet_prio none /sys/fs/cgroup/net_prio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) With the above step, the initial group acting as the parent accounting group
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) becomes visible at '/sys/fs/cgroup/net_prio'.  This group includes all tasks in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) the system. '/sys/fs/cgroup/net_prio/tasks' lists the tasks in this cgroup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Each net_prio cgroup contains two files that are subsystem specific
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) net_prio.prioidx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)   This file is read-only, and is simply informative.  It contains a unique
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)   integer value that the kernel uses as an internal representation of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)   cgroup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) net_prio.ifpriomap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)   This file contains a map of the priorities assigned to traffic originating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)   from processes in this group and egressing the system on various interfaces.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)   It contains a list of tuples in the form <ifname priority>.  Contents of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)   file can be modified by echoing a string into the file using the same tuple
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)   format. For example::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	echo "eth0 5" > /sys/fs/cgroups/net_prio/iscsi/net_prio.ifpriomap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) This command would force any traffic originating from processes belonging to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) iscsi net_prio cgroup and egressing on interface eth0 to have the priority of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) said traffic set to the value 5. The parent accounting group also has a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) writeable 'net_prio.ifpriomap' file that can be used to set a system default
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) priority.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) Priorities are set immediately prior to queueing a frame to the device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) queueing discipline (qdisc) so priorities will be assigned prior to the hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) queue selection being made.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) One usage for the net_prio cgroup is with mqprio qdisc allowing application
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) traffic to be steered to hardware/driver based traffic classes. These mappings
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) can then be managed by administrators or other networking protocols such as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) DCBX.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) A new net_prio cgroup inherits the parent's configuration.