1 /*- 2 * Broadcom NetXtreme-C/E network driver. 3 * 4 * Copyright (c) 2016 Broadcom, All Rights Reserved. 5 * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #include <sys/cdefs.h> 30 __FBSDID("$FreeBSD$"); 31 32 #include <sys/types.h> 33 #include <sys/sysctl.h> 34 35 #include "bnxt.h" 36 #include "bnxt_hwrm.h" 37 #include "bnxt_sysctl.h" 38 39 static int bnxt_vlan_only_sysctl(SYSCTL_HANDLER_ARGS); 40 /* 41 * We want to create: 42 * dev.bnxt.0.hwstats.txq0 43 * dev.bnxt.0.hwstats.txq0.txmbufs 44 * dev.bnxt.0.hwstats.rxq0 45 * dev.bnxt.0.hwstats.txq0.rxmbufs 46 * so the hwstats ctx list needs to be created in attach_post and populated 47 * during init. 48 * 49 * Then, it needs to be cleaned up in stop. 50 */ 51 52 int 53 bnxt_init_sysctl_ctx(struct bnxt_softc *softc) 54 { 55 struct sysctl_ctx_list *ctx; 56 57 sysctl_ctx_init(&softc->hw_stats); 58 ctx = device_get_sysctl_ctx(softc->dev); 59 softc->hw_stats_oid = SYSCTL_ADD_NODE(ctx, 60 SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 61 "hwstats", CTLFLAG_RD, 0, "hardware statistics"); 62 if (!softc->hw_stats_oid) { 63 sysctl_ctx_free(&softc->hw_stats); 64 return ENOMEM; 65 } 66 67 sysctl_ctx_init(&softc->ver_info->ver_ctx); 68 ctx = device_get_sysctl_ctx(softc->dev); 69 softc->ver_info->ver_oid = SYSCTL_ADD_NODE(ctx, 70 SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 71 "ver", CTLFLAG_RD, 0, "hardware/firmware version information"); 72 if (!softc->ver_info->ver_oid) { 73 sysctl_ctx_free(&softc->ver_info->ver_ctx); 74 return ENOMEM; 75 } 76 77 sysctl_ctx_init(&softc->nvm_info->nvm_ctx); 78 ctx = device_get_sysctl_ctx(softc->dev); 79 softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, 80 SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 81 "nvram", CTLFLAG_RD, 0, "nvram information"); 82 if (!softc->nvm_info->nvm_oid) { 83 sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 84 return ENOMEM; 85 } 86 87 return 0; 88 } 89 90 int 91 bnxt_free_sysctl_ctx(struct bnxt_softc *softc) 92 { 93 int orc; 94 int rc = 0; 95 96 if (softc->hw_stats_oid != NULL) { 97 orc = sysctl_ctx_free(&softc->hw_stats); 98 if (orc) 99 rc = orc; 100 else 101 softc->hw_stats_oid = NULL; 102 } 103 if (softc->ver_info->ver_oid != NULL) { 104 orc = sysctl_ctx_free(&softc->ver_info->ver_ctx); 105 if (orc) 106 rc = orc; 107 else 108 softc->ver_info->ver_oid = NULL; 109 } 110 if (softc->nvm_info->nvm_oid != NULL) { 111 orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 112 if (orc) 113 rc = orc; 114 else 115 softc->nvm_info->nvm_oid = NULL; 116 } 117 118 return rc; 119 } 120 121 int 122 bnxt_create_tx_sysctls(struct bnxt_softc *softc, int txr) 123 { 124 struct sysctl_oid *oid; 125 struct ctx_hw_stats *tx_stats = (void *)softc->tx_stats.idi_vaddr; 126 char name[32]; 127 char desc[64]; 128 129 sprintf(name, "txq%d", txr); 130 sprintf(desc, "transmit queue %d", txr); 131 oid = SYSCTL_ADD_NODE(&softc->hw_stats, 132 SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, CTLFLAG_RD, 0, 133 desc); 134 if (!oid) 135 return ENOMEM; 136 137 138 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 139 "ucast_pkts", CTLFLAG_RD, &tx_stats[txr].tx_ucast_pkts, 140 "unicast packets sent"); 141 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 142 "mcast_pkts", CTLFLAG_RD, &tx_stats[txr].tx_mcast_pkts, 143 "multicast packets sent"); 144 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 145 "bcast_pkts", CTLFLAG_RD, &tx_stats[txr].tx_bcast_pkts, 146 "broadcast packets sent"); 147 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 148 "discard_pkts", CTLFLAG_RD, 149 &tx_stats[txr].tx_discard_pkts, "discarded transmit packets"); 150 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 151 "drop_pkts", CTLFLAG_RD, &tx_stats[txr].tx_drop_pkts, 152 "dropped transmit packets"); 153 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 154 "ucast_bytes", CTLFLAG_RD, &tx_stats[txr].tx_ucast_bytes, 155 "unicast bytes sent"); 156 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 157 "mcast_bytes", CTLFLAG_RD, &tx_stats[txr].tx_mcast_bytes, 158 "multicast bytes sent"); 159 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 160 "bcast_bytes", CTLFLAG_RD, &tx_stats[txr].tx_bcast_bytes, 161 "broadcast bytes sent"); 162 163 return 0; 164 } 165 166 int 167 bnxt_create_port_stats_sysctls(struct bnxt_softc *softc) 168 { 169 struct sysctl_oid *oid; 170 char name[32]; 171 char desc[64]; 172 173 sprintf(name, "port_stats"); 174 sprintf(desc, "Port Stats"); 175 oid = SYSCTL_ADD_NODE(&softc->hw_stats, 176 SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, CTLFLAG_RD, 0, 177 desc); 178 if (!oid) 179 return ENOMEM; 180 181 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 182 "tx_64b_frames", CTLFLAG_RD, 183 &softc->tx_port_stats->tx_64b_frames, "Transmitted 64b frames"); 184 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 185 "tx_65b_127b_frames", CTLFLAG_RD, 186 &softc->tx_port_stats->tx_65b_127b_frames, 187 "Transmitted 65b 127b frames"); 188 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 189 "tx_128b_255b_frames", CTLFLAG_RD, 190 &softc->tx_port_stats->tx_128b_255b_frames, 191 "Transmitted 128b 255b frames"); 192 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 193 "tx_256b_511b_frames", CTLFLAG_RD, 194 &softc->tx_port_stats->tx_256b_511b_frames, 195 "Transmitted 256b 511b frames"); 196 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 197 "tx_512b_1023b_frames", CTLFLAG_RD, 198 &softc->tx_port_stats->tx_512b_1023b_frames, 199 "Transmitted 512b 1023b frames"); 200 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 201 "tx_1024b_1518_frames", CTLFLAG_RD, 202 &softc->tx_port_stats->tx_1024b_1518_frames, 203 "Transmitted 1024b 1518 frames"); 204 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 205 "tx_good_vlan_frames", CTLFLAG_RD, 206 &softc->tx_port_stats->tx_good_vlan_frames, 207 "Transmitted good vlan frames"); 208 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 209 "tx_1519b_2047_frames", CTLFLAG_RD, 210 &softc->tx_port_stats->tx_1519b_2047_frames, 211 "Transmitted 1519b 2047 frames"); 212 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 213 "tx_2048b_4095b_frames", CTLFLAG_RD, 214 &softc->tx_port_stats->tx_2048b_4095b_frames, 215 "Transmitted 2048b 4095b frames"); 216 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 217 "tx_4096b_9216b_frames", CTLFLAG_RD, 218 &softc->tx_port_stats->tx_4096b_9216b_frames, 219 "Transmitted 4096b 9216b frames"); 220 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 221 "tx_9217b_16383b_frames", CTLFLAG_RD, 222 &softc->tx_port_stats->tx_9217b_16383b_frames, 223 "Transmitted 9217b 16383b frames"); 224 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 225 "tx_good_frames", CTLFLAG_RD, 226 &softc->tx_port_stats->tx_good_frames, "Transmitted good frames"); 227 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 228 "tx_total_frames", CTLFLAG_RD, 229 &softc->tx_port_stats->tx_total_frames, "Transmitted total frames"); 230 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 231 "tx_ucast_frames", CTLFLAG_RD, 232 &softc->tx_port_stats->tx_ucast_frames, "Transmitted ucast frames"); 233 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 234 "tx_mcast_frames", CTLFLAG_RD, 235 &softc->tx_port_stats->tx_mcast_frames, "Transmitted mcast frames"); 236 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 237 "tx_bcast_frames", CTLFLAG_RD, 238 &softc->tx_port_stats->tx_bcast_frames, "Transmitted bcast frames"); 239 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 240 "tx_pause_frames", CTLFLAG_RD, 241 &softc->tx_port_stats->tx_pause_frames, "Transmitted pause frames"); 242 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 243 "tx_pfc_frames", CTLFLAG_RD, 244 &softc->tx_port_stats->tx_pfc_frames, "Transmitted pfc frames"); 245 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 246 "tx_jabber_frames", CTLFLAG_RD, 247 &softc->tx_port_stats->tx_jabber_frames, "Transmitted jabber frames"); 248 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 249 "tx_fcs_err_frames", CTLFLAG_RD, 250 &softc->tx_port_stats->tx_fcs_err_frames, 251 "Transmitted fcs err frames"); 252 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 253 "tx_control_frames", CTLFLAG_RD, 254 &softc->tx_port_stats->tx_control_frames, 255 "Transmitted control frames"); 256 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 257 "tx_oversz_frames", CTLFLAG_RD, 258 &softc->tx_port_stats->tx_oversz_frames, "Transmitted oversz frames"); 259 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 260 "tx_single_dfrl_frames", CTLFLAG_RD, 261 &softc->tx_port_stats->tx_single_dfrl_frames, 262 "Transmitted single dfrl frames"); 263 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 264 "tx_multi_dfrl_frames", CTLFLAG_RD, 265 &softc->tx_port_stats->tx_multi_dfrl_frames, 266 "Transmitted multi dfrl frames"); 267 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 268 "tx_single_coll_frames", CTLFLAG_RD, 269 &softc->tx_port_stats->tx_single_coll_frames, 270 "Transmitted single coll frames"); 271 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 272 "tx_multi_coll_frames", CTLFLAG_RD, 273 &softc->tx_port_stats->tx_multi_coll_frames, 274 "Transmitted multi coll frames"); 275 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 276 "tx_late_coll_frames", CTLFLAG_RD, 277 &softc->tx_port_stats->tx_late_coll_frames, 278 "Transmitted late coll frames"); 279 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 280 "tx_excessive_coll_frames", CTLFLAG_RD, 281 &softc->tx_port_stats->tx_excessive_coll_frames, 282 "Transmitted excessive coll frames"); 283 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 284 "tx_frag_frames", CTLFLAG_RD, 285 &softc->tx_port_stats->tx_frag_frames, "Transmitted frag frames"); 286 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 287 "tx_err", CTLFLAG_RD, 288 &softc->tx_port_stats->tx_err, "Transmitted err"); 289 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 290 "tx_tagged_frames", CTLFLAG_RD, 291 &softc->tx_port_stats->tx_tagged_frames, "Transmitted tagged frames"); 292 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 293 "tx_dbl_tagged_frames", CTLFLAG_RD, 294 &softc->tx_port_stats->tx_dbl_tagged_frames, 295 "Transmitted dbl tagged frames"); 296 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 297 "tx_runt_frames", CTLFLAG_RD, 298 &softc->tx_port_stats->tx_runt_frames, "Transmitted runt frames"); 299 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 300 "tx_fifo_underruns", CTLFLAG_RD, 301 &softc->tx_port_stats->tx_fifo_underruns, 302 "Transmitted fifo underruns"); 303 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 304 "tx_pfc_ena_frames_pri0", CTLFLAG_RD, 305 &softc->tx_port_stats->tx_pfc_ena_frames_pri0, 306 "Transmitted pfc ena frames pri0"); 307 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 308 "tx_pfc_ena_frames_pri1", CTLFLAG_RD, 309 &softc->tx_port_stats->tx_pfc_ena_frames_pri1, 310 "Transmitted pfc ena frames pri1"); 311 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 312 "tx_pfc_ena_frames_pri2", CTLFLAG_RD, 313 &softc->tx_port_stats->tx_pfc_ena_frames_pri2, 314 "Transmitted pfc ena frames pri2"); 315 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 316 "tx_pfc_ena_frames_pri3", CTLFLAG_RD, 317 &softc->tx_port_stats->tx_pfc_ena_frames_pri3, 318 "Transmitted pfc ena frames pri3"); 319 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 320 "tx_pfc_ena_frames_pri4", CTLFLAG_RD, 321 &softc->tx_port_stats->tx_pfc_ena_frames_pri4, 322 "Transmitted pfc ena frames pri4"); 323 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 324 "tx_pfc_ena_frames_pri5", CTLFLAG_RD, 325 &softc->tx_port_stats->tx_pfc_ena_frames_pri5, 326 "Transmitted pfc ena frames pri5"); 327 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 328 "tx_pfc_ena_frames_pri6", CTLFLAG_RD, 329 &softc->tx_port_stats->tx_pfc_ena_frames_pri6, 330 "Transmitted pfc ena frames pri6"); 331 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 332 "tx_pfc_ena_frames_pri7", CTLFLAG_RD, 333 &softc->tx_port_stats->tx_pfc_ena_frames_pri7, 334 "Transmitted pfc ena frames pri7"); 335 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 336 "tx_eee_lpi_events", CTLFLAG_RD, 337 &softc->tx_port_stats->tx_eee_lpi_events, 338 "Transmitted eee lpi events"); 339 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 340 "tx_eee_lpi_duration", CTLFLAG_RD, 341 &softc->tx_port_stats->tx_eee_lpi_duration, 342 "Transmitted eee lpi duration"); 343 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 344 "tx_llfc_logical_msgs", CTLFLAG_RD, 345 &softc->tx_port_stats->tx_llfc_logical_msgs, 346 "Transmitted llfc logical msgs"); 347 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 348 "tx_hcfc_msgs", CTLFLAG_RD, 349 &softc->tx_port_stats->tx_hcfc_msgs, "Transmitted hcfc msgs"); 350 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 351 "tx_total_collisions", CTLFLAG_RD, 352 &softc->tx_port_stats->tx_total_collisions, 353 "Transmitted total collisions"); 354 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 355 "tx_bytes", CTLFLAG_RD, 356 &softc->tx_port_stats->tx_bytes, "Transmitted bytes"); 357 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 358 "tx_xthol_frames", CTLFLAG_RD, 359 &softc->tx_port_stats->tx_xthol_frames, "Transmitted xthol frames"); 360 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 361 "tx_stat_discard", CTLFLAG_RD, 362 &softc->tx_port_stats->tx_stat_discard, "Transmitted stat discard"); 363 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 364 "tx_stat_error", CTLFLAG_RD, 365 &softc->tx_port_stats->tx_stat_error, "Transmitted stat error"); 366 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 367 "rx_64b_frames", CTLFLAG_RD, 368 &softc->rx_port_stats->rx_64b_frames, "Received 64b frames"); 369 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 370 "rx_65b_127b_frames", CTLFLAG_RD, 371 &softc->rx_port_stats->rx_65b_127b_frames, "Received 65b 127b frames"); 372 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 373 "rx_128b_255b_frames", CTLFLAG_RD, 374 &softc->rx_port_stats->rx_128b_255b_frames, 375 "Received 128b 255b frames"); 376 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 377 "rx_256b_511b_frames", CTLFLAG_RD, 378 &softc->rx_port_stats->rx_256b_511b_frames, 379 "Received 256b 511b frames"); 380 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 381 "rx_512b_1023b_frames", CTLFLAG_RD, 382 &softc->rx_port_stats->rx_512b_1023b_frames, 383 "Received 512b 1023b frames"); 384 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 385 "rx_1024b_1518_frames", CTLFLAG_RD, 386 &softc->rx_port_stats->rx_1024b_1518_frames, 387 "Received 1024b 1518 frames"); 388 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 389 "rx_good_vlan_frames", CTLFLAG_RD, 390 &softc->rx_port_stats->rx_good_vlan_frames, 391 "Received good vlan frames"); 392 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 393 "rx_1519b_2047b_frames", CTLFLAG_RD, 394 &softc->rx_port_stats->rx_1519b_2047b_frames, 395 "Received 1519b 2047b frames"); 396 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 397 "rx_2048b_4095b_frames", CTLFLAG_RD, 398 &softc->rx_port_stats->rx_2048b_4095b_frames, 399 "Received 2048b 4095b frames"); 400 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 401 "rx_4096b_9216b_frames", CTLFLAG_RD, 402 &softc->rx_port_stats->rx_4096b_9216b_frames, 403 "Received 4096b 9216b frames"); 404 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 405 "rx_9217b_16383b_frames", CTLFLAG_RD, 406 &softc->rx_port_stats->rx_9217b_16383b_frames, 407 "Received 9217b 16383b frames"); 408 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 409 "rx_total_frames", CTLFLAG_RD, 410 &softc->rx_port_stats->rx_total_frames, "Received total frames"); 411 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 412 "rx_ucast_frames", CTLFLAG_RD, 413 &softc->rx_port_stats->rx_ucast_frames, "Received ucast frames"); 414 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 415 "rx_mcast_frames", CTLFLAG_RD, 416 &softc->rx_port_stats->rx_mcast_frames, "Received mcast frames"); 417 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 418 "rx_bcast_frames", CTLFLAG_RD, 419 &softc->rx_port_stats->rx_bcast_frames, "Received bcast frames"); 420 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 421 "rx_fcs_err_frames", CTLFLAG_RD, 422 &softc->rx_port_stats->rx_fcs_err_frames, "Received fcs err frames"); 423 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 424 "rx_ctrl_frames", CTLFLAG_RD, 425 &softc->rx_port_stats->rx_ctrl_frames, "Received ctrl frames"); 426 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 427 "rx_pause_frames", CTLFLAG_RD, 428 &softc->rx_port_stats->rx_pause_frames, "Received pause frames"); 429 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 430 "rx_pfc_frames", CTLFLAG_RD, 431 &softc->rx_port_stats->rx_pfc_frames, "Received pfc frames"); 432 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 433 "rx_unsupported_opcode_frames", CTLFLAG_RD, 434 &softc->rx_port_stats->rx_unsupported_opcode_frames, 435 "Received unsupported opcode frames"); 436 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 437 "rx_unsupported_da_pausepfc_frames", CTLFLAG_RD, 438 &softc->rx_port_stats->rx_unsupported_da_pausepfc_frames, 439 "Received unsupported da pausepfc frames"); 440 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 441 "rx_wrong_sa_frames", CTLFLAG_RD, 442 &softc->rx_port_stats->rx_wrong_sa_frames, 443 "Received wrong sa frames"); 444 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 445 "rx_align_err_frames", CTLFLAG_RD, 446 &softc->rx_port_stats->rx_align_err_frames, 447 "Received align err frames"); 448 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 449 "rx_oor_len_frames", CTLFLAG_RD, 450 &softc->rx_port_stats->rx_oor_len_frames, 451 "Received oor len frames"); 452 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 453 "rx_code_err_frames", CTLFLAG_RD, 454 &softc->rx_port_stats->rx_code_err_frames, 455 "Received code err frames"); 456 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 457 "rx_false_carrier_frames", CTLFLAG_RD, 458 &softc->rx_port_stats->rx_false_carrier_frames, 459 "Received false carrier frames"); 460 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 461 "rx_ovrsz_frames", CTLFLAG_RD, 462 &softc->rx_port_stats->rx_ovrsz_frames, 463 "Received ovrsz frames"); 464 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 465 "rx_jbr_frames", CTLFLAG_RD, 466 &softc->rx_port_stats->rx_jbr_frames, 467 "Received jbr frames"); 468 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 469 "rx_mtu_err_frames", CTLFLAG_RD, 470 &softc->rx_port_stats->rx_mtu_err_frames, 471 "Received mtu err frames"); 472 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 473 "rx_match_crc_frames", CTLFLAG_RD, 474 &softc->rx_port_stats->rx_match_crc_frames, 475 "Received match crc frames"); 476 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 477 "rx_promiscuous_frames", CTLFLAG_RD, 478 &softc->rx_port_stats->rx_promiscuous_frames, 479 "Received promiscuous frames"); 480 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 481 "rx_tagged_frames", CTLFLAG_RD, 482 &softc->rx_port_stats->rx_tagged_frames, 483 "Received tagged frames"); 484 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 485 "rx_double_tagged_frames", CTLFLAG_RD, 486 &softc->rx_port_stats->rx_double_tagged_frames, 487 "Received double tagged frames"); 488 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 489 "rx_trunc_frames", CTLFLAG_RD, 490 &softc->rx_port_stats->rx_trunc_frames, 491 "Received trunc frames"); 492 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 493 "rx_good_frames", CTLFLAG_RD, 494 &softc->rx_port_stats->rx_good_frames, 495 "Received good frames"); 496 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 497 "rx_pfc_xon2xoff_frames_pri0", CTLFLAG_RD, 498 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri0, 499 "Received pfc xon2xoff frames pri0"); 500 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 501 "rx_pfc_xon2xoff_frames_pri1", CTLFLAG_RD, 502 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri1, 503 "Received pfc xon2xoff frames pri1"); 504 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 505 "rx_pfc_xon2xoff_frames_pri2", CTLFLAG_RD, 506 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri2, 507 "Received pfc xon2xoff frames pri2"); 508 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 509 "rx_pfc_xon2xoff_frames_pri3", CTLFLAG_RD, 510 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri3, 511 "Received pfc xon2xoff frames pri3"); 512 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 513 "rx_pfc_xon2xoff_frames_pri4", CTLFLAG_RD, 514 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri4, 515 "Received pfc xon2xoff frames pri4"); 516 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 517 "rx_pfc_xon2xoff_frames_pri5", CTLFLAG_RD, 518 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri5, 519 "Received pfc xon2xoff frames pri5"); 520 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 521 "rx_pfc_xon2xoff_frames_pri6", CTLFLAG_RD, 522 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri6, 523 "Received pfc xon2xoff frames pri6"); 524 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 525 "rx_pfc_xon2xoff_frames_pri7", CTLFLAG_RD, 526 &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri7, 527 "Received pfc xon2xoff frames pri7"); 528 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 529 "rx_pfc_ena_frames_pri0", CTLFLAG_RD, 530 &softc->rx_port_stats->rx_pfc_ena_frames_pri0, 531 "Received pfc ena frames pri0"); 532 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 533 "rx_pfc_ena_frames_pri1", CTLFLAG_RD, 534 &softc->rx_port_stats->rx_pfc_ena_frames_pri1, 535 "Received pfc ena frames pri1"); 536 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 537 "rx_pfc_ena_frames_pri2", CTLFLAG_RD, 538 &softc->rx_port_stats->rx_pfc_ena_frames_pri2, 539 "Received pfc ena frames pri2"); 540 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 541 "rx_pfc_ena_frames_pri3", CTLFLAG_RD, 542 &softc->rx_port_stats->rx_pfc_ena_frames_pri3, 543 "Received pfc ena frames pri3"); 544 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 545 "rx_pfc_ena_frames_pri4", CTLFLAG_RD, 546 &softc->rx_port_stats->rx_pfc_ena_frames_pri4, 547 "Received pfc ena frames pri4"); 548 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 549 "rx_pfc_ena_frames_pri5", CTLFLAG_RD, 550 &softc->rx_port_stats->rx_pfc_ena_frames_pri5, 551 "Received pfc ena frames pri5"); 552 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 553 "rx_pfc_ena_frames_pri6", CTLFLAG_RD, 554 &softc->rx_port_stats->rx_pfc_ena_frames_pri6, 555 "Received pfc ena frames pri6"); 556 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 557 "rx_pfc_ena_frames_pri7", CTLFLAG_RD, 558 &softc->rx_port_stats->rx_pfc_ena_frames_pri7, 559 "Received pfc ena frames pri7"); 560 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 561 "rx_sch_crc_err_frames", CTLFLAG_RD, 562 &softc->rx_port_stats->rx_sch_crc_err_frames, 563 "Received sch crc err frames"); 564 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 565 "rx_undrsz_frames", CTLFLAG_RD, 566 &softc->rx_port_stats->rx_undrsz_frames, "Received undrsz frames"); 567 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 568 "rx_frag_frames", CTLFLAG_RD, 569 &softc->rx_port_stats->rx_frag_frames, "Received frag frames"); 570 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 571 "rx_eee_lpi_events", CTLFLAG_RD, 572 &softc->rx_port_stats->rx_eee_lpi_events, "Received eee lpi events"); 573 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 574 "rx_eee_lpi_duration", CTLFLAG_RD, 575 &softc->rx_port_stats->rx_eee_lpi_duration, 576 "Received eee lpi duration"); 577 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 578 "rx_llfc_physical_msgs", CTLFLAG_RD, 579 &softc->rx_port_stats->rx_llfc_physical_msgs, 580 "Received llfc physical msgs"); 581 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 582 "rx_llfc_logical_msgs", CTLFLAG_RD, 583 &softc->rx_port_stats->rx_llfc_logical_msgs, 584 "Received llfc logical msgs"); 585 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 586 "rx_llfc_msgs_with_crc_err", CTLFLAG_RD, 587 &softc->rx_port_stats->rx_llfc_msgs_with_crc_err, 588 "Received llfc msgs with crc err"); 589 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 590 "rx_hcfc_msgs", CTLFLAG_RD, 591 &softc->rx_port_stats->rx_hcfc_msgs, "Received hcfc msgs"); 592 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 593 "rx_hcfc_msgs_with_crc_err", CTLFLAG_RD, 594 &softc->rx_port_stats->rx_hcfc_msgs_with_crc_err, 595 "Received hcfc msgs with crc err"); 596 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 597 "rx_bytes", CTLFLAG_RD, 598 &softc->rx_port_stats->rx_bytes, "Received bytes"); 599 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 600 "rx_runt_bytes", CTLFLAG_RD, 601 &softc->rx_port_stats->rx_runt_bytes, "Received runt bytes"); 602 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 603 "rx_runt_frames", CTLFLAG_RD, 604 &softc->rx_port_stats->rx_runt_frames, "Received runt frames"); 605 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 606 "rx_stat_discard", CTLFLAG_RD, 607 &softc->rx_port_stats->rx_stat_discard, "Received stat discard"); 608 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 609 "rx_stat_err", CTLFLAG_RD, 610 &softc->rx_port_stats->rx_stat_err, "Received stat err"); 611 612 return 0; 613 } 614 615 616 int 617 bnxt_create_rx_sysctls(struct bnxt_softc *softc, int rxr) 618 { 619 struct sysctl_oid *oid; 620 struct ctx_hw_stats *rx_stats = (void *)softc->rx_stats.idi_vaddr; 621 char name[32]; 622 char desc[64]; 623 624 sprintf(name, "rxq%d", rxr); 625 sprintf(desc, "receive queue %d", rxr); 626 oid = SYSCTL_ADD_NODE(&softc->hw_stats, 627 SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, CTLFLAG_RD, 0, 628 desc); 629 if (!oid) 630 return ENOMEM; 631 632 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 633 "ucast_pkts", CTLFLAG_RD, &rx_stats[rxr].rx_ucast_pkts, 634 "unicast packets received"); 635 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 636 "mcast_pkts", CTLFLAG_RD, &rx_stats[rxr].rx_mcast_pkts, 637 "multicast packets received"); 638 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 639 "bcast_pkts", CTLFLAG_RD, &rx_stats[rxr].rx_bcast_pkts, 640 "broadcast packets received"); 641 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 642 "discard_pkts", CTLFLAG_RD, 643 &rx_stats[rxr].rx_discard_pkts, "discarded receive packets"); 644 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 645 "drop_pkts", CTLFLAG_RD, &rx_stats[rxr].rx_drop_pkts, 646 "dropped receive packets"); 647 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 648 "ucast_bytes", CTLFLAG_RD, &rx_stats[rxr].rx_ucast_bytes, 649 "unicast bytes received"); 650 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 651 "mcast_bytes", CTLFLAG_RD, &rx_stats[rxr].rx_mcast_bytes, 652 "multicast bytes received"); 653 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 654 "bcast_bytes", CTLFLAG_RD, &rx_stats[rxr].rx_bcast_bytes, 655 "broadcast bytes received"); 656 657 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 658 "tpa_pkts", CTLFLAG_RD, &rx_stats[rxr].tpa_pkts, 659 "TPA packets"); 660 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 661 "tpa_bytes", CTLFLAG_RD, &rx_stats[rxr].tpa_bytes, 662 "TPA bytes"); 663 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 664 "tpa_events", CTLFLAG_RD, &rx_stats[rxr].tpa_events, 665 "TPA events"); 666 SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 667 "tpa_aborts", CTLFLAG_RD, &rx_stats[rxr].tpa_aborts, 668 "TPA aborts"); 669 670 return 0; 671 } 672 673 static char *bnxt_chip_type[] = { 674 "ASIC", 675 "FPGA", 676 "Palladium", 677 "Unknown" 678 }; 679 #define MAX_CHIP_TYPE 3 680 681 static int 682 bnxt_package_ver_sysctl(SYSCTL_HANDLER_ARGS) 683 { 684 struct bnxt_softc *softc = arg1; 685 struct iflib_dma_info dma_data; 686 char *pkglog = NULL; 687 char *p; 688 char *next; 689 char unk[] = "<unknown>"; 690 char *buf = unk; 691 int rc; 692 int field; 693 uint16_t ordinal = BNX_DIR_ORDINAL_FIRST; 694 uint16_t index; 695 uint32_t data_len; 696 697 rc = bnxt_hwrm_nvm_find_dir_entry(softc, BNX_DIR_TYPE_PKG_LOG, 698 &ordinal, BNX_DIR_EXT_NONE, &index, false, 699 HWRM_NVM_FIND_DIR_ENTRY_INPUT_OPT_ORDINAL_EQ, 700 &data_len, NULL, NULL); 701 dma_data.idi_vaddr = NULL; 702 if (rc == 0 && data_len) { 703 rc = iflib_dma_alloc(softc->ctx, data_len, &dma_data, 704 BUS_DMA_NOWAIT); 705 if (rc == 0) { 706 rc = bnxt_hwrm_nvm_read(softc, index, 0, data_len, 707 &dma_data); 708 if (rc == 0) { 709 pkglog = dma_data.idi_vaddr; 710 /* NULL terminate (removes last \n) */ 711 pkglog[data_len-1] = 0; 712 713 /* Set p = start of last line */ 714 p = strrchr(pkglog, '\n'); 715 if (p == NULL) 716 p = pkglog; 717 718 /* Now find the correct tab delimited field */ 719 for (field = 0, next = p, 720 p = strsep(&next, "\t"); 721 field < 722 BNX_PKG_LOG_FIELD_IDX_PKG_VERSION && p; 723 p = strsep(&next, "\t")) { 724 field++; 725 } 726 if (field == BNX_PKG_LOG_FIELD_IDX_PKG_VERSION) 727 buf = p; 728 } 729 } 730 else 731 dma_data.idi_vaddr = NULL; 732 } 733 734 rc = sysctl_handle_string(oidp, buf, 0, req); 735 if (dma_data.idi_vaddr) 736 iflib_dma_free(&dma_data); 737 return rc; 738 } 739 740 static int 741 bnxt_hwrm_min_ver_sysctl(SYSCTL_HANDLER_ARGS) 742 { 743 struct bnxt_softc *softc = arg1; 744 char buf[16]; 745 uint8_t newver[3]; 746 int rc; 747 748 sprintf(buf, "%hhu.%hhu.%hhu", softc->ver_info->hwrm_min_major, 749 softc->ver_info->hwrm_min_minor, softc->ver_info->hwrm_min_update); 750 751 rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 752 if (rc || req->newptr == NULL) 753 return rc; 754 if (sscanf(buf, "%hhu.%hhu.%hhu%*c", &newver[0], &newver[1], 755 &newver[2]) != 3) 756 return EINVAL; 757 softc->ver_info->hwrm_min_major = newver[0]; 758 softc->ver_info->hwrm_min_minor = newver[1]; 759 softc->ver_info->hwrm_min_update = newver[2]; 760 bnxt_check_hwrm_version(softc); 761 762 return rc; 763 } 764 765 int 766 bnxt_create_ver_sysctls(struct bnxt_softc *softc) 767 { 768 struct bnxt_ver_info *vi = softc->ver_info; 769 struct sysctl_oid *oid = vi->ver_oid; 770 771 if (!oid) 772 return ENOMEM; 773 774 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 775 "hwrm_if", CTLFLAG_RD, vi->hwrm_if_ver, 0, 776 "HWRM interface version"); 777 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 778 "driver_hwrm_if", CTLFLAG_RD, vi->driver_hwrm_if_ver, 0, 779 "HWRM firmware version"); 780 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 781 "hwrm_fw", CTLFLAG_RD, vi->hwrm_fw_ver, 0, 782 "HWRM firmware version"); 783 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 784 "mgmt_fw", CTLFLAG_RD, vi->mgmt_fw_ver, 0, 785 "management firmware version"); 786 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 787 "netctrl_fw", CTLFLAG_RD, vi->netctrl_fw_ver, 0, 788 "network control firmware version"); 789 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 790 "roce_fw", CTLFLAG_RD, vi->roce_fw_ver, 0, 791 "RoCE firmware version"); 792 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 793 "phy", CTLFLAG_RD, vi->phy_ver, 0, 794 "PHY version"); 795 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 796 "hwrm_fw_name", CTLFLAG_RD, vi->hwrm_fw_name, 0, 797 "HWRM firmware name"); 798 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 799 "mgmt_fw_name", CTLFLAG_RD, vi->mgmt_fw_name, 0, 800 "management firmware name"); 801 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 802 "netctrl_fw_name", CTLFLAG_RD, vi->netctrl_fw_name, 0, 803 "network control firmware name"); 804 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 805 "roce_fw_name", CTLFLAG_RD, vi->roce_fw_name, 0, 806 "RoCE firmware name"); 807 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 808 "phy_vendor", CTLFLAG_RD, vi->phy_vendor, 0, 809 "PHY vendor name"); 810 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 811 "phy_partnumber", CTLFLAG_RD, vi->phy_partnumber, 0, 812 "PHY vendor part number"); 813 SYSCTL_ADD_U16(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 814 "chip_num", CTLFLAG_RD, &vi->chip_num, 0, "chip number"); 815 SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 816 "chip_rev", CTLFLAG_RD, &vi->chip_rev, 0, "chip revision"); 817 SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 818 "chip_metal", CTLFLAG_RD, &vi->chip_metal, 0, "chip metal number"); 819 SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 820 "chip_bond_id", CTLFLAG_RD, &vi->chip_bond_id, 0, 821 "chip bond id"); 822 SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 823 "chip_type", CTLFLAG_RD, vi->chip_type > MAX_CHIP_TYPE ? 824 bnxt_chip_type[MAX_CHIP_TYPE] : bnxt_chip_type[vi->chip_type], 0, 825 "RoCE firmware name"); 826 SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 827 "package_ver", CTLTYPE_STRING|CTLFLAG_RD, softc, 0, 828 bnxt_package_ver_sysctl, "A", 829 "currently installed package version"); 830 SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 831 "hwrm_min_ver", CTLTYPE_STRING|CTLFLAG_RWTUN, softc, 0, 832 bnxt_hwrm_min_ver_sysctl, "A", 833 "minimum hwrm API vesion to support"); 834 835 return 0; 836 } 837 838 int 839 bnxt_create_nvram_sysctls(struct bnxt_nvram_info *ni) 840 { 841 struct sysctl_oid *oid = ni->nvm_oid; 842 843 if (!oid) 844 return ENOMEM; 845 846 SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 847 "mfg_id", CTLFLAG_RD, &ni->mfg_id, 0, "manufacturer id"); 848 SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 849 "device_id", CTLFLAG_RD, &ni->device_id, 0, "device id"); 850 SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 851 "sector_size", CTLFLAG_RD, &ni->sector_size, 0, "sector size"); 852 SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 853 "size", CTLFLAG_RD, &ni->size, 0, "nvram total size"); 854 SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 855 "reserved_size", CTLFLAG_RD, &ni->reserved_size, 0, 856 "total reserved space"); 857 SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 858 "available_size", CTLFLAG_RD, &ni->available_size, 0, 859 "total available space"); 860 861 return 0; 862 } 863 864 static int 865 bnxt_rss_key_sysctl(SYSCTL_HANDLER_ARGS) 866 { 867 struct bnxt_softc *softc = arg1; 868 char buf[HW_HASH_KEY_SIZE*2+1] = {0}; 869 char *p; 870 int i; 871 int rc; 872 873 for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) 874 p += sprintf(p, "%02x", softc->vnic_info.rss_hash_key[i]); 875 876 rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 877 if (rc || req->newptr == NULL) 878 return rc; 879 880 if (strspn(buf, "0123456789abcdefABCDEF") != (HW_HASH_KEY_SIZE * 2)) 881 return EINVAL; 882 883 for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) { 884 if (sscanf(p, "%02hhx", &softc->vnic_info.rss_hash_key[i]) != 1) 885 return EINVAL; 886 p += 2; 887 } 888 889 if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 890 bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 891 softc->vnic_info.rss_hash_type); 892 893 return rc; 894 } 895 896 static const char *bnxt_hash_types[] = {"ipv4", "tcp_ipv4", "udp_ipv4", "ipv6", 897 "tcp_ipv6", "udp_ipv6", NULL}; 898 899 static int bnxt_get_rss_type_str_bit(char *str) 900 { 901 int i; 902 903 for (i=0; bnxt_hash_types[i]; i++) 904 if (strcmp(bnxt_hash_types[i], str) == 0) 905 return i; 906 907 return -1; 908 } 909 910 static int 911 bnxt_rss_type_sysctl(SYSCTL_HANDLER_ARGS) 912 { 913 struct bnxt_softc *softc = arg1; 914 char buf[256] = {0}; 915 char *p; 916 char *next; 917 int rc; 918 int type; 919 int bit; 920 921 for (type = softc->vnic_info.rss_hash_type; type; 922 type &= ~(1<<bit)) { 923 bit = ffs(type) - 1; 924 if (bit >= sizeof(bnxt_hash_types) / sizeof(const char *)) 925 continue; 926 if (type != softc->vnic_info.rss_hash_type) 927 strcat(buf, ","); 928 strcat(buf, bnxt_hash_types[bit]); 929 } 930 931 rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 932 if (rc || req->newptr == NULL) 933 return rc; 934 935 for (type = 0, next = buf, p = strsep(&next, " ,"); p; 936 p = strsep(&next, " ,")) { 937 bit = bnxt_get_rss_type_str_bit(p); 938 if (bit == -1) 939 return EINVAL; 940 type |= 1<<bit; 941 } 942 if (type != softc->vnic_info.rss_hash_type) { 943 softc->vnic_info.rss_hash_type = type; 944 if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 945 bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 946 softc->vnic_info.rss_hash_type); 947 } 948 949 return rc; 950 } 951 952 static int 953 bnxt_rx_stall_sysctl(SYSCTL_HANDLER_ARGS) { 954 struct bnxt_softc *softc = arg1; 955 int rc; 956 int val; 957 958 if (softc == NULL) 959 return EBUSY; 960 961 val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_BD_STALL); 962 rc = sysctl_handle_int(oidp, &val, 0, req); 963 if (rc || !req->newptr) 964 return rc; 965 966 if (val) 967 softc->vnic_info.flags |= BNXT_VNIC_FLAG_BD_STALL; 968 else 969 softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_BD_STALL; 970 971 if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 972 rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 973 974 return rc; 975 } 976 977 static int 978 bnxt_vlan_strip_sysctl(SYSCTL_HANDLER_ARGS) { 979 struct bnxt_softc *softc = arg1; 980 int rc; 981 int val; 982 983 if (softc == NULL) 984 return EBUSY; 985 986 val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_VLAN_STRIP); 987 rc = sysctl_handle_int(oidp, &val, 0, req); 988 if (rc || !req->newptr) 989 return rc; 990 991 if (val) 992 softc->vnic_info.flags |= BNXT_VNIC_FLAG_VLAN_STRIP; 993 else 994 softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_VLAN_STRIP; 995 996 if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 997 rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 998 999 return rc; 1000 } 1001 1002 static int 1003 bnxt_set_coal_rx_usecs(SYSCTL_HANDLER_ARGS) { 1004 struct bnxt_softc *softc = arg1; 1005 int rc; 1006 int val; 1007 1008 if (softc == NULL) 1009 return EBUSY; 1010 1011 val = softc->rx_coal_usecs; 1012 rc = sysctl_handle_int(oidp, &val, 0, req); 1013 if (rc || !req->newptr) 1014 return rc; 1015 1016 softc->rx_coal_usecs = val; 1017 rc = bnxt_hwrm_set_coal(softc); 1018 1019 return rc; 1020 } 1021 1022 static int 1023 bnxt_set_coal_rx_frames(SYSCTL_HANDLER_ARGS) { 1024 struct bnxt_softc *softc = arg1; 1025 int rc; 1026 int val; 1027 1028 if (softc == NULL) 1029 return EBUSY; 1030 1031 val = softc->rx_coal_frames; 1032 rc = sysctl_handle_int(oidp, &val, 0, req); 1033 if (rc || !req->newptr) 1034 return rc; 1035 1036 softc->rx_coal_frames = val; 1037 rc = bnxt_hwrm_set_coal(softc); 1038 1039 return rc; 1040 } 1041 1042 static int 1043 bnxt_set_coal_rx_usecs_irq(SYSCTL_HANDLER_ARGS) { 1044 struct bnxt_softc *softc = arg1; 1045 int rc; 1046 int val; 1047 1048 if (softc == NULL) 1049 return EBUSY; 1050 1051 val = softc->rx_coal_usecs_irq; 1052 rc = sysctl_handle_int(oidp, &val, 0, req); 1053 if (rc || !req->newptr) 1054 return rc; 1055 1056 softc->rx_coal_usecs_irq = val; 1057 rc = bnxt_hwrm_set_coal(softc); 1058 1059 return rc; 1060 } 1061 1062 static int 1063 bnxt_set_coal_rx_frames_irq(SYSCTL_HANDLER_ARGS) { 1064 struct bnxt_softc *softc = arg1; 1065 int rc; 1066 int val; 1067 1068 if (softc == NULL) 1069 return EBUSY; 1070 1071 val = softc->rx_coal_frames_irq; 1072 rc = sysctl_handle_int(oidp, &val, 0, req); 1073 if (rc || !req->newptr) 1074 return rc; 1075 1076 softc->rx_coal_frames_irq = val; 1077 rc = bnxt_hwrm_set_coal(softc); 1078 1079 return rc; 1080 } 1081 1082 static int 1083 bnxt_set_coal_tx_usecs(SYSCTL_HANDLER_ARGS) { 1084 struct bnxt_softc *softc = arg1; 1085 int rc; 1086 int val; 1087 1088 if (softc == NULL) 1089 return EBUSY; 1090 1091 val = softc->tx_coal_usecs; 1092 rc = sysctl_handle_int(oidp, &val, 0, req); 1093 if (rc || !req->newptr) 1094 return rc; 1095 1096 softc->tx_coal_usecs = val; 1097 rc = bnxt_hwrm_set_coal(softc); 1098 1099 return rc; 1100 } 1101 1102 static int 1103 bnxt_set_coal_tx_frames(SYSCTL_HANDLER_ARGS) { 1104 struct bnxt_softc *softc = arg1; 1105 int rc; 1106 int val; 1107 1108 if (softc == NULL) 1109 return EBUSY; 1110 1111 val = softc->tx_coal_frames; 1112 rc = sysctl_handle_int(oidp, &val, 0, req); 1113 if (rc || !req->newptr) 1114 return rc; 1115 1116 softc->tx_coal_frames = val; 1117 rc = bnxt_hwrm_set_coal(softc); 1118 1119 return rc; 1120 } 1121 1122 static int 1123 bnxt_set_coal_tx_usecs_irq(SYSCTL_HANDLER_ARGS) { 1124 struct bnxt_softc *softc = arg1; 1125 int rc; 1126 int val; 1127 1128 if (softc == NULL) 1129 return EBUSY; 1130 1131 val = softc->tx_coal_usecs_irq; 1132 rc = sysctl_handle_int(oidp, &val, 0, req); 1133 if (rc || !req->newptr) 1134 return rc; 1135 1136 softc->tx_coal_usecs_irq = val; 1137 rc = bnxt_hwrm_set_coal(softc); 1138 1139 return rc; 1140 } 1141 1142 static int 1143 bnxt_set_coal_tx_frames_irq(SYSCTL_HANDLER_ARGS) { 1144 struct bnxt_softc *softc = arg1; 1145 int rc; 1146 int val; 1147 1148 if (softc == NULL) 1149 return EBUSY; 1150 1151 val = softc->tx_coal_frames_irq; 1152 rc = sysctl_handle_int(oidp, &val, 0, req); 1153 if (rc || !req->newptr) 1154 return rc; 1155 1156 softc->tx_coal_frames_irq = val; 1157 rc = bnxt_hwrm_set_coal(softc); 1158 1159 return rc; 1160 } 1161 1162 int 1163 bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) 1164 { 1165 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(softc->dev); 1166 struct sysctl_oid_list *children; 1167 1168 children = SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev));; 1169 1170 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_key", 1171 CTLTYPE_STRING|CTLFLAG_RWTUN, softc, 0, bnxt_rss_key_sysctl, "A", 1172 "RSS key"); 1173 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_type", 1174 CTLTYPE_STRING|CTLFLAG_RWTUN, softc, 0, bnxt_rss_type_sysctl, "A", 1175 "RSS type bits"); 1176 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rx_stall", 1177 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_rx_stall_sysctl, "I", 1178 "buffer rx packets in hardware until the host posts new buffers"); 1179 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "vlan_strip", 1180 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_vlan_strip_sysctl, "I", 1181 "strip VLAN tag in the RX path"); 1182 SYSCTL_ADD_STRING(ctx, children, OID_AUTO, "if_name", CTLFLAG_RD, 1183 iflib_get_ifp(softc->ctx)->if_xname, 0, "interface name"); 1184 1185 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs", 1186 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs, 1187 "I", "interrupt coalescing Rx Usecs"); 1188 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames", 1189 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames, 1190 "I", "interrupt coalescing Rx Frames"); 1191 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs_irq", 1192 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_usecs_irq, 1193 "I", "interrupt coalescing Rx Usecs IRQ"); 1194 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames_irq", 1195 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_rx_frames_irq, 1196 "I", "interrupt coalescing Rx Frames IRQ"); 1197 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs", 1198 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs, 1199 "I", "interrupt coalescing Tx Usces"); 1200 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames", 1201 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames, 1202 "I", "interrupt coalescing Tx Frames"); 1203 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs_irq", 1204 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_usecs_irq, 1205 "I", "interrupt coalescing Tx Usecs IRQ"); 1206 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", 1207 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_set_coal_tx_frames_irq, 1208 "I", "interrupt coalescing Tx Frames IRQ"); 1209 1210 return 0; 1211 } 1212 1213 static int 1214 bnxt_vlan_only_sysctl(SYSCTL_HANDLER_ARGS) { 1215 struct bnxt_softc *softc = arg1; 1216 int rc; 1217 int val; 1218 1219 if (softc == NULL) 1220 return EBUSY; 1221 1222 val = softc->vnic_info.vlan_only; 1223 rc = sysctl_handle_int(oidp, &val, 0, req); 1224 if (rc || !req->newptr) 1225 return rc; 1226 1227 if (val) 1228 val = 1; 1229 1230 if (val != softc->vnic_info.vlan_only) { 1231 softc->vnic_info.vlan_only = val; 1232 if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 1233 rc = bnxt_hwrm_cfa_l2_set_rx_mask(softc, 1234 &softc->vnic_info); 1235 } 1236 1237 return rc; 1238 } 1239 1240 int 1241 bnxt_create_config_sysctls_post(struct bnxt_softc *softc) 1242 { 1243 struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(softc->dev); 1244 struct sysctl_oid_list *children; 1245 1246 children = SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev));; 1247 1248 SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "vlan_only", 1249 CTLTYPE_INT|CTLFLAG_RWTUN, softc, 0, bnxt_vlan_only_sysctl, "I", 1250 "require vlan tag on received packets when vlan is enabled"); 1251 1252 return 0; 1253 } 1254