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) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) NETIF Msg Level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) ===============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) The design of the network interface message level setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) History
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) -------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  The design of the debugging message interface was guided and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  constrained by backwards compatibility previous practice.  It is useful
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  to understand the history and evolution in order to understand current
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  practice and relate it to older driver source code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  From the beginning of Linux, each network device driver has had a local
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  integer variable that controls the debug message level.  The message
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  level ranged from 0 to 7, and monotonically increased in verbosity.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  The message level was not precisely defined past level 3, but were
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  always implemented within +-1 of the specified level.  Drivers tended
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  to shed the more verbose level messages as they matured.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)    - 0  Minimal messages, only essential information on fatal errors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)    - 1  Standard messages, initialization status.  No run-time messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)    - 2  Special media selection messages, generally timer-driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)    - 3  Interface starts and stops, including normal status messages
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)    - 4  Tx and Rx frame error messages, and abnormal driver operation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)    - 5  Tx packet queue information, interrupt events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)    - 6  Status on each completed Tx packet and received Rx packets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)    - 7  Initial contents of Tx and Rx packets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  Initially this message level variable was uniquely named in each driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  e.g. "lance_debug", so that a kernel symbolic debugger could locate and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)  modify the setting.  When kernel modules became common, the variables
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)  were consistently renamed to "debug" and allowed to be set as a module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)  parameter.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)  This approach worked well.  However there is always a demand for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)  additional features.  Over the years the following emerged as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)  reasonable and easily implemented enhancements
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)    - Using an ioctl() call to modify the level.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)    - Per-interface rather than per-driver message level setting.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)    - More selective control over the type of messages emitted.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  The netif_msg recommendation adds these features with only a minor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  complexity and code size increase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)  The recommendation is the following points
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)   - Retaining the per-driver integer variable "debug" as a module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)     parameter with a default level of '1'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)   - Adding a per-interface private variable named "msg_enable".  The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)     variable is a bit map rather than a level, and is initialized as::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)        1 << debug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)     Or more precisely::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	debug < 0 ? 0 : 1 << min(sizeof(int)-1, debug)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)     Messages should changes from::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)       if (debug > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	   printk(MSG_DEBUG "%s: ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)     to::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)       if (np->msg_enable & NETIF_MSG_LINK)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	   printk(MSG_DEBUG "%s: ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) The set of message levels is named
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)   =========   ===================	============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)   Old level   Name			Bit position
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)   =========   ===================	============
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)     0         NETIF_MSG_DRV		0x0001
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)     1         NETIF_MSG_PROBE		0x0002
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)     2         NETIF_MSG_LINK		0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)     2         NETIF_MSG_TIMER		0x0004
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)     3         NETIF_MSG_IFDOWN		0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)     3         NETIF_MSG_IFUP		0x0008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)     4         NETIF_MSG_RX_ERR		0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)     4         NETIF_MSG_TX_ERR		0x0010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)     5         NETIF_MSG_TX_QUEUED	0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)     5         NETIF_MSG_INTR		0x0020
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)     6         NETIF_MSG_TX_DONE		0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)     6         NETIF_MSG_RX_STATUS	0x0040
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)     7         NETIF_MSG_PKTDATA		0x0080
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)   =========   ===================	============