xref: /freebsd/sys/dev/ice/ice_common_sysctls.h (revision a6deeaa2fb3b28a61ae56a85f2275f67fcf23262)
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*  Copyright (c) 2024, Intel Corporation
3  *  All rights reserved.
4  *
5  *  Redistribution and use in source and binary forms, with or without
6  *  modification, are permitted provided that the following conditions are met:
7  *
8  *   1. Redistributions of source code must retain the above copyright notice,
9  *      this list of conditions and the following disclaimer.
10  *
11  *   2. Redistributions in binary form must reproduce the above copyright
12  *      notice, this list of conditions and the following disclaimer in the
13  *      documentation and/or other materials provided with the distribution.
14  *
15  *   3. Neither the name of the Intel Corporation nor the names of its
16  *      contributors may be used to endorse or promote products derived from
17  *      this software without specific prior written permission.
18  *
19  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  *  POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /**
33  * @file ice_common_sysctls.h
34  * @brief driver wide sysctls not related to the iflib stack
35  *
36  * Contains static sysctl values which are driver wide and configure all
37  * devices of the driver at once.
38  *
39  * Device specific sysctls are setup by functions in ice_lib.c
40  */
41 
42 #ifndef _ICE_COMMON_SYSCTLS_H_
43 #define _ICE_COMMON_SYSCTLS_H_
44 
45 #include <sys/sysctl.h>
46 
47 /**
48  * @var ice_enable_irdma
49  * @brief boolean indicating if the iRDMA client interface is enabled
50  *
51  * Global sysctl variable indicating whether the RDMA client interface feature
52  * is enabled.
53  */
54 bool ice_enable_irdma = true;
55 
56 /**
57  * @var ice_enable_tx_fc_filter
58  * @brief boolean indicating if the Tx Flow Control filter should be enabled
59  *
60  * Global sysctl variable indicating whether the Tx Flow Control filters
61  * should be enabled. If true, Ethertype 0x8808 packets will be dropped if
62  * they come from non-HW sources. If false, packets coming from software will
63  * not be dropped. Leave this on if unless you must send flow control frames
64  * (or other control frames) from software.
65  *
66  * @remark each PF has a separate sysctl which can override this value.
67  */
68 bool ice_enable_tx_fc_filter = true;
69 
70 /**
71  * @var ice_enable_tx_lldp_filter
72  * @brief boolean indicating if the Tx LLDP filter should be enabled
73  *
74  * Global sysctl variable indicating whether the Tx Flow Control filters
75  * should be enabled. If true, Ethertype 0x88cc packets will be dropped if
76  * they come from non-HW sources. If false, packets coming from software will
77  * not be dropped. Leave this on if unless you must send LLDP frames from
78  * software.
79  *
80  * @remark each PF has a separate sysctl which can override this value.
81  */
82 bool ice_enable_tx_lldp_filter = true;
83 
84 /**
85  * @var ice_enable_health_events
86  * @brief boolean indicating if health status events from the FW should be reported
87  *
88  * Global sysctl variable indicating whether the Health Status events from the
89  * FW should be enabled. If true, if an event occurs, the driver will print out
90  * a message with a description of the event and possible actions to take.
91  *
92  * @remark each PF has a separate sysctl which can override this value.
93  */
94 bool ice_enable_health_events = true;
95 
96 #ifdef PCI_IOV
97 /**
98  * @var ice_mdd_auto_reset_vf
99  * @brief reconstruct and release a VF after a malicious-driver reset
100  *
101  * Global default for automatically reconstructing and releasing a VF after
102  * hardware reports a malicious-driver event and the driver resets it. Leave
103  * this disabled unless availability is more important than keeping a
104  * persistently faulty VF blocked.
105  *
106  * @remark each PF has a separate sysctl which can override this value.
107  */
108 bool ice_mdd_auto_reset_vf = false;
109 #endif
110 
111 /**
112  * @var ice_tx_balance_en
113  * @brief boolean permitting the 5-layer scheduler topology enablement
114  *
115  * Global sysctl variable indicating whether the driver will allow the
116  * 5-layer scheduler topology feature to be enabled. It's _not_
117  * specifically enabling the feature, just allowing it depending on what
118  * the DDP package allows.
119  */
120 bool ice_tx_balance_en = true;
121 
122 /**
123  * @var ice_rdma_max_msix
124  * @brief maximum number of MSI-X vectors to reserve for RDMA interface
125  *
126  * Global sysctl variable indicating the maximum number of MSI-X vectors to
127  * reserve for a single RDMA interface.
128  */
129 static uint16_t ice_rdma_max_msix = ICE_RDMA_MAX_MSIX;
130 
131 /* sysctls marked as tunable, (i.e. with the CTLFLAG_TUN set) will
132  * automatically load tunable values, without the need to manually create the
133  * TUNABLE definition.
134  *
135  * This works since at least FreeBSD 11, and was backported into FreeBSD 10
136  * before the FreeBSD 10.1-RELEASE.
137  *
138  * If the tunable needs a custom loader, mark the SYSCTL as CTLFLAG_NOFETCH,
139  * and create the tunable manually.
140  */
141 
142 static SYSCTL_NODE(_hw, OID_AUTO, ice, CTLFLAG_RD, 0, "ICE driver parameters");
143 
144 static SYSCTL_NODE(_hw_ice, OID_AUTO, debug, ICE_CTLFLAG_DEBUG | CTLFLAG_RD, 0,
145 		   "ICE driver debug parameters");
146 
147 SYSCTL_BOOL(_hw_ice, OID_AUTO, enable_health_events, CTLFLAG_RDTUN,
148 	    &ice_enable_health_events, 0,
149 	    "Enable FW health event reporting globally");
150 
151 #ifdef PCI_IOV
152 SYSCTL_BOOL(_hw_ice, OID_AUTO, mdd_auto_reset_vf, CTLFLAG_RDTUN,
153 	    &ice_mdd_auto_reset_vf, 0,
154 	    "Automatically restore VFs after an MDD reset");
155 #endif
156 
157 SYSCTL_BOOL(_hw_ice, OID_AUTO, irdma, CTLFLAG_RDTUN, &ice_enable_irdma, 0,
158 	    "Enable iRDMA client interface");
159 
160 SYSCTL_U16(_hw_ice, OID_AUTO, rdma_max_msix, CTLFLAG_RDTUN, &ice_rdma_max_msix,
161 	   0, "Maximum number of MSI-X vectors to reserve per RDMA interface");
162 
163 SYSCTL_BOOL(_hw_ice_debug, OID_AUTO, enable_tx_fc_filter, CTLFLAG_RDTUN,
164 	    &ice_enable_tx_fc_filter, 0,
165 	    "Drop Ethertype 0x8808 control frames originating from non-HW sources");
166 
167 SYSCTL_BOOL(_hw_ice_debug, OID_AUTO, enable_tx_lldp_filter, CTLFLAG_RDTUN,
168 	    &ice_enable_tx_lldp_filter, 0,
169 	    "Drop Ethertype 0x88cc LLDP frames originating from non-HW sources");
170 
171 SYSCTL_BOOL(_hw_ice_debug, OID_AUTO, tx_balance_en, CTLFLAG_RWTUN,
172 	    &ice_tx_balance_en, 0,
173 	    "Enable 5-layer scheduler topology");
174 
175 #endif /* _ICE_COMMON_SYSCTLS_H_ */
176