1*35b53f8cSChandrakanth patil /*- 2*35b53f8cSChandrakanth patil * Broadcom NetXtreme-C/E network driver. 3*35b53f8cSChandrakanth patil * 4*35b53f8cSChandrakanth patil * Copyright (c) 2016 Broadcom, All Rights Reserved. 5*35b53f8cSChandrakanth patil * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 6*35b53f8cSChandrakanth patil * 7*35b53f8cSChandrakanth patil * Redistribution and use in source and binary forms, with or without 8*35b53f8cSChandrakanth patil * modification, are permitted provided that the following conditions 9*35b53f8cSChandrakanth patil * are met: 10*35b53f8cSChandrakanth patil * 1. Redistributions of source code must retain the above copyright 11*35b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer. 12*35b53f8cSChandrakanth patil * 2. Redistributions in binary form must reproduce the above copyright 13*35b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer in the 14*35b53f8cSChandrakanth patil * documentation and/or other materials provided with the distribution. 15*35b53f8cSChandrakanth patil * 16*35b53f8cSChandrakanth patil * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 17*35b53f8cSChandrakanth patil * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*35b53f8cSChandrakanth patil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*35b53f8cSChandrakanth patil * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20*35b53f8cSChandrakanth patil * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21*35b53f8cSChandrakanth patil * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22*35b53f8cSChandrakanth patil * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23*35b53f8cSChandrakanth patil * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24*35b53f8cSChandrakanth patil * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25*35b53f8cSChandrakanth patil * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26*35b53f8cSChandrakanth patil * THE POSSIBILITY OF SUCH DAMAGE. 27*35b53f8cSChandrakanth patil */ 28*35b53f8cSChandrakanth patil 29*35b53f8cSChandrakanth patil #include <sys/types.h> 30*35b53f8cSChandrakanth patil #include <sys/sysctl.h> 31*35b53f8cSChandrakanth patil #include <sys/ctype.h> 32*35b53f8cSChandrakanth patil 33*35b53f8cSChandrakanth patil #include "bnxt.h" 34*35b53f8cSChandrakanth patil #include "bnxt_hwrm.h" 35*35b53f8cSChandrakanth patil #include "bnxt_sysctl.h" 36*35b53f8cSChandrakanth patil 37*35b53f8cSChandrakanth patil /* 38*35b53f8cSChandrakanth patil * We want to create: 39*35b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0 40*35b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0.txmbufs 41*35b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.rxq0 42*35b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0.rxmbufs 43*35b53f8cSChandrakanth patil * so the hwstats ctx list needs to be created in attach_post and populated 44*35b53f8cSChandrakanth patil * during init. 45*35b53f8cSChandrakanth patil * 46*35b53f8cSChandrakanth patil * Then, it needs to be cleaned up in stop. 47*35b53f8cSChandrakanth patil */ 48*35b53f8cSChandrakanth patil 49*35b53f8cSChandrakanth patil int 50*35b53f8cSChandrakanth patil bnxt_init_sysctl_ctx(struct bnxt_softc *softc) 51*35b53f8cSChandrakanth patil { 52*35b53f8cSChandrakanth patil struct sysctl_ctx_list *ctx; 53*35b53f8cSChandrakanth patil 54*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->hw_stats); 55*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 56*35b53f8cSChandrakanth patil softc->hw_stats_oid = SYSCTL_ADD_NODE(ctx, 57*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 58*35b53f8cSChandrakanth patil "hwstats", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "hardware statistics"); 59*35b53f8cSChandrakanth patil if (!softc->hw_stats_oid) { 60*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->hw_stats); 61*35b53f8cSChandrakanth patil return ENOMEM; 62*35b53f8cSChandrakanth patil } 63*35b53f8cSChandrakanth patil 64*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->ver_info->ver_ctx); 65*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 66*35b53f8cSChandrakanth patil softc->ver_info->ver_oid = SYSCTL_ADD_NODE(ctx, 67*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 68*35b53f8cSChandrakanth patil "ver", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 69*35b53f8cSChandrakanth patil "hardware/firmware version information"); 70*35b53f8cSChandrakanth patil if (!softc->ver_info->ver_oid) { 71*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->ver_info->ver_ctx); 72*35b53f8cSChandrakanth patil return ENOMEM; 73*35b53f8cSChandrakanth patil } 74*35b53f8cSChandrakanth patil 75*35b53f8cSChandrakanth patil if (BNXT_PF(softc)) { 76*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->nvm_info->nvm_ctx); 77*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 78*35b53f8cSChandrakanth patil softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, 79*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 80*35b53f8cSChandrakanth patil "nvram", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 81*35b53f8cSChandrakanth patil "nvram information"); 82*35b53f8cSChandrakanth patil if (!softc->nvm_info->nvm_oid) { 83*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 84*35b53f8cSChandrakanth patil return ENOMEM; 85*35b53f8cSChandrakanth patil } 86*35b53f8cSChandrakanth patil } 87*35b53f8cSChandrakanth patil 88*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->hw_lro_ctx); 89*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 90*35b53f8cSChandrakanth patil softc->hw_lro_oid = SYSCTL_ADD_NODE(ctx, 91*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 92*35b53f8cSChandrakanth patil "hw_lro", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "hardware lro"); 93*35b53f8cSChandrakanth patil if (!softc->hw_lro_oid) { 94*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->hw_lro_ctx); 95*35b53f8cSChandrakanth patil return ENOMEM; 96*35b53f8cSChandrakanth patil } 97*35b53f8cSChandrakanth patil 98*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->flow_ctrl_ctx); 99*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 100*35b53f8cSChandrakanth patil softc->flow_ctrl_oid = SYSCTL_ADD_NODE(ctx, 101*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 102*35b53f8cSChandrakanth patil "fc", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "flow ctrl"); 103*35b53f8cSChandrakanth patil if (!softc->flow_ctrl_oid) { 104*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->flow_ctrl_ctx); 105*35b53f8cSChandrakanth patil return ENOMEM; 106*35b53f8cSChandrakanth patil } 107*35b53f8cSChandrakanth patil 108*35b53f8cSChandrakanth patil sysctl_ctx_init(&softc->dcb_ctx); 109*35b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 110*35b53f8cSChandrakanth patil softc->dcb_oid = SYSCTL_ADD_NODE(ctx, 111*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 112*35b53f8cSChandrakanth patil "dcb", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "dcb"); 113*35b53f8cSChandrakanth patil if (!softc->dcb_oid) { 114*35b53f8cSChandrakanth patil sysctl_ctx_free(&softc->dcb_ctx); 115*35b53f8cSChandrakanth patil return ENOMEM; 116*35b53f8cSChandrakanth patil } 117*35b53f8cSChandrakanth patil 118*35b53f8cSChandrakanth patil return 0; 119*35b53f8cSChandrakanth patil } 120*35b53f8cSChandrakanth patil 121*35b53f8cSChandrakanth patil int 122*35b53f8cSChandrakanth patil bnxt_free_sysctl_ctx(struct bnxt_softc *softc) 123*35b53f8cSChandrakanth patil { 124*35b53f8cSChandrakanth patil int orc; 125*35b53f8cSChandrakanth patil int rc = 0; 126*35b53f8cSChandrakanth patil 127*35b53f8cSChandrakanth patil if (softc->hw_stats_oid != NULL) { 128*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->hw_stats); 129*35b53f8cSChandrakanth patil if (orc) 130*35b53f8cSChandrakanth patil rc = orc; 131*35b53f8cSChandrakanth patil else 132*35b53f8cSChandrakanth patil softc->hw_stats_oid = NULL; 133*35b53f8cSChandrakanth patil } 134*35b53f8cSChandrakanth patil if (softc->ver_info->ver_oid != NULL) { 135*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->ver_info->ver_ctx); 136*35b53f8cSChandrakanth patil if (orc) 137*35b53f8cSChandrakanth patil rc = orc; 138*35b53f8cSChandrakanth patil else 139*35b53f8cSChandrakanth patil softc->ver_info->ver_oid = NULL; 140*35b53f8cSChandrakanth patil } 141*35b53f8cSChandrakanth patil if (BNXT_PF(softc) && softc->nvm_info->nvm_oid != NULL) { 142*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 143*35b53f8cSChandrakanth patil if (orc) 144*35b53f8cSChandrakanth patil rc = orc; 145*35b53f8cSChandrakanth patil else 146*35b53f8cSChandrakanth patil softc->nvm_info->nvm_oid = NULL; 147*35b53f8cSChandrakanth patil } 148*35b53f8cSChandrakanth patil if (softc->hw_lro_oid != NULL) { 149*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->hw_lro_ctx); 150*35b53f8cSChandrakanth patil if (orc) 151*35b53f8cSChandrakanth patil rc = orc; 152*35b53f8cSChandrakanth patil else 153*35b53f8cSChandrakanth patil softc->hw_lro_oid = NULL; 154*35b53f8cSChandrakanth patil } 155*35b53f8cSChandrakanth patil 156*35b53f8cSChandrakanth patil if (softc->flow_ctrl_oid != NULL) { 157*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->flow_ctrl_ctx); 158*35b53f8cSChandrakanth patil if (orc) 159*35b53f8cSChandrakanth patil rc = orc; 160*35b53f8cSChandrakanth patil else 161*35b53f8cSChandrakanth patil softc->flow_ctrl_oid = NULL; 162*35b53f8cSChandrakanth patil } 163*35b53f8cSChandrakanth patil 164*35b53f8cSChandrakanth patil if (softc->dcb_oid != NULL) { 165*35b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->dcb_ctx); 166*35b53f8cSChandrakanth patil if (orc) 167*35b53f8cSChandrakanth patil rc = orc; 168*35b53f8cSChandrakanth patil else 169*35b53f8cSChandrakanth patil softc->dcb_oid = NULL; 170*35b53f8cSChandrakanth patil } 171*35b53f8cSChandrakanth patil 172*35b53f8cSChandrakanth patil return rc; 173*35b53f8cSChandrakanth patil } 174*35b53f8cSChandrakanth patil 175*35b53f8cSChandrakanth patil int 176*35b53f8cSChandrakanth patil bnxt_create_tx_sysctls(struct bnxt_softc *softc, int txr) 177*35b53f8cSChandrakanth patil { 178*35b53f8cSChandrakanth patil struct sysctl_oid *oid; 179*35b53f8cSChandrakanth patil struct ctx_hw_stats *tx_stats = (void *)softc->tx_stats[txr].idi_vaddr; 180*35b53f8cSChandrakanth patil char name[32]; 181*35b53f8cSChandrakanth patil char desc[64]; 182*35b53f8cSChandrakanth patil 183*35b53f8cSChandrakanth patil sprintf(name, "txq%d", txr); 184*35b53f8cSChandrakanth patil sprintf(desc, "transmit queue %d", txr); 185*35b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 186*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 187*35b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 188*35b53f8cSChandrakanth patil if (!oid) 189*35b53f8cSChandrakanth patil return ENOMEM; 190*35b53f8cSChandrakanth patil 191*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 192*35b53f8cSChandrakanth patil "ucast_pkts", CTLFLAG_RD, &tx_stats->tx_ucast_pkts, 193*35b53f8cSChandrakanth patil "unicast packets sent"); 194*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 195*35b53f8cSChandrakanth patil "mcast_pkts", CTLFLAG_RD, &tx_stats->tx_mcast_pkts, 196*35b53f8cSChandrakanth patil "multicast packets sent"); 197*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 198*35b53f8cSChandrakanth patil "bcast_pkts", CTLFLAG_RD, &tx_stats->tx_bcast_pkts, 199*35b53f8cSChandrakanth patil "broadcast packets sent"); 200*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 201*35b53f8cSChandrakanth patil "discard_pkts", CTLFLAG_RD, 202*35b53f8cSChandrakanth patil &tx_stats->tx_discard_pkts, "discarded transmit packets"); 203*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 204*35b53f8cSChandrakanth patil "error_pkts", CTLFLAG_RD, &tx_stats->tx_error_pkts, 205*35b53f8cSChandrakanth patil "Error transmit packets"); 206*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 207*35b53f8cSChandrakanth patil "ucast_bytes", CTLFLAG_RD, &tx_stats->tx_ucast_bytes, 208*35b53f8cSChandrakanth patil "unicast bytes sent"); 209*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 210*35b53f8cSChandrakanth patil "mcast_bytes", CTLFLAG_RD, &tx_stats->tx_mcast_bytes, 211*35b53f8cSChandrakanth patil "multicast bytes sent"); 212*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 213*35b53f8cSChandrakanth patil "bcast_bytes", CTLFLAG_RD, &tx_stats->tx_bcast_bytes, 214*35b53f8cSChandrakanth patil "broadcast bytes sent"); 215*35b53f8cSChandrakanth patil 216*35b53f8cSChandrakanth patil return 0; 217*35b53f8cSChandrakanth patil } 218*35b53f8cSChandrakanth patil 219*35b53f8cSChandrakanth patil int 220*35b53f8cSChandrakanth patil bnxt_create_port_stats_sysctls(struct bnxt_softc *softc) 221*35b53f8cSChandrakanth patil { 222*35b53f8cSChandrakanth patil struct sysctl_oid *oid; 223*35b53f8cSChandrakanth patil char name[32]; 224*35b53f8cSChandrakanth patil char desc[64]; 225*35b53f8cSChandrakanth patil 226*35b53f8cSChandrakanth patil sprintf(name, "port_stats"); 227*35b53f8cSChandrakanth patil sprintf(desc, "Port Stats"); 228*35b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 229*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 230*35b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 231*35b53f8cSChandrakanth patil if (!oid) 232*35b53f8cSChandrakanth patil return ENOMEM; 233*35b53f8cSChandrakanth patil 234*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 235*35b53f8cSChandrakanth patil "tx_64b_frames", CTLFLAG_RD, 236*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_64b_frames, "Transmitted 64b frames"); 237*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 238*35b53f8cSChandrakanth patil "tx_65b_127b_frames", CTLFLAG_RD, 239*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_65b_127b_frames, 240*35b53f8cSChandrakanth patil "Transmitted 65b 127b frames"); 241*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 242*35b53f8cSChandrakanth patil "tx_128b_255b_frames", CTLFLAG_RD, 243*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_128b_255b_frames, 244*35b53f8cSChandrakanth patil "Transmitted 128b 255b frames"); 245*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 246*35b53f8cSChandrakanth patil "tx_256b_511b_frames", CTLFLAG_RD, 247*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_256b_511b_frames, 248*35b53f8cSChandrakanth patil "Transmitted 256b 511b frames"); 249*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 250*35b53f8cSChandrakanth patil "tx_512b_1023b_frames", CTLFLAG_RD, 251*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_512b_1023b_frames, 252*35b53f8cSChandrakanth patil "Transmitted 512b 1023b frames"); 253*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 254*35b53f8cSChandrakanth patil "tx_1024b_1518b_frames", CTLFLAG_RD, 255*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_1024b_1518b_frames, 256*35b53f8cSChandrakanth patil "Transmitted 1024b 1518b frames"); 257*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 258*35b53f8cSChandrakanth patil "tx_good_vlan_frames", CTLFLAG_RD, 259*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_good_vlan_frames, 260*35b53f8cSChandrakanth patil "Transmitted good vlan frames"); 261*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 262*35b53f8cSChandrakanth patil "tx_1519b_2047b_frames", CTLFLAG_RD, 263*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_1519b_2047b_frames, 264*35b53f8cSChandrakanth patil "Transmitted 1519b 2047b frames"); 265*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 266*35b53f8cSChandrakanth patil "tx_2048b_4095b_frames", CTLFLAG_RD, 267*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_2048b_4095b_frames, 268*35b53f8cSChandrakanth patil "Transmitted 2048b 4095b frames"); 269*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 270*35b53f8cSChandrakanth patil "tx_4096b_9216b_frames", CTLFLAG_RD, 271*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_4096b_9216b_frames, 272*35b53f8cSChandrakanth patil "Transmitted 4096b 9216b frames"); 273*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 274*35b53f8cSChandrakanth patil "tx_9217b_16383b_frames", CTLFLAG_RD, 275*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_9217b_16383b_frames, 276*35b53f8cSChandrakanth patil "Transmitted 9217b 16383b frames"); 277*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 278*35b53f8cSChandrakanth patil "tx_good_frames", CTLFLAG_RD, 279*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_good_frames, "Transmitted good frames"); 280*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 281*35b53f8cSChandrakanth patil "tx_total_frames", CTLFLAG_RD, 282*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_total_frames, "Transmitted total frames"); 283*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 284*35b53f8cSChandrakanth patil "tx_ucast_frames", CTLFLAG_RD, 285*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_ucast_frames, "Transmitted ucast frames"); 286*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 287*35b53f8cSChandrakanth patil "tx_mcast_frames", CTLFLAG_RD, 288*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_mcast_frames, "Transmitted mcast frames"); 289*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 290*35b53f8cSChandrakanth patil "tx_bcast_frames", CTLFLAG_RD, 291*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_bcast_frames, "Transmitted bcast frames"); 292*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 293*35b53f8cSChandrakanth patil "tx_pause_frames", CTLFLAG_RD, 294*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pause_frames, "Transmitted pause frames"); 295*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 296*35b53f8cSChandrakanth patil "tx_pfc_frames", CTLFLAG_RD, 297*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_frames, "Transmitted pfc frames"); 298*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 299*35b53f8cSChandrakanth patil "tx_jabber_frames", CTLFLAG_RD, 300*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_jabber_frames, "Transmitted jabber frames"); 301*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 302*35b53f8cSChandrakanth patil "tx_fcs_err_frames", CTLFLAG_RD, 303*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_fcs_err_frames, 304*35b53f8cSChandrakanth patil "Transmitted fcs err frames"); 305*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 306*35b53f8cSChandrakanth patil "tx_err", CTLFLAG_RD, 307*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_err, "Transmitted err"); 308*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 309*35b53f8cSChandrakanth patil "tx_fifo_underruns", CTLFLAG_RD, 310*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_fifo_underruns, 311*35b53f8cSChandrakanth patil "Transmitted fifo underruns"); 312*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 313*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri0", CTLFLAG_RD, 314*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri0, 315*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri0"); 316*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 317*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri1", CTLFLAG_RD, 318*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri1, 319*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri1"); 320*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 321*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri2", CTLFLAG_RD, 322*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri2, 323*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri2"); 324*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 325*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri3", CTLFLAG_RD, 326*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri3, 327*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri3"); 328*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 329*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri4", CTLFLAG_RD, 330*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri4, 331*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri4"); 332*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 333*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri5", CTLFLAG_RD, 334*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri5, 335*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri5"); 336*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 337*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri6", CTLFLAG_RD, 338*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri6, 339*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri6"); 340*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 341*35b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri7", CTLFLAG_RD, 342*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri7, 343*35b53f8cSChandrakanth patil "Transmitted pfc ena frames pri7"); 344*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 345*35b53f8cSChandrakanth patil "tx_eee_lpi_events", CTLFLAG_RD, 346*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_eee_lpi_events, 347*35b53f8cSChandrakanth patil "Transmitted eee lpi events"); 348*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 349*35b53f8cSChandrakanth patil "tx_eee_lpi_duration", CTLFLAG_RD, 350*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_eee_lpi_duration, 351*35b53f8cSChandrakanth patil "Transmitted eee lpi duration"); 352*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 353*35b53f8cSChandrakanth patil "tx_llfc_logical_msgs", CTLFLAG_RD, 354*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_llfc_logical_msgs, 355*35b53f8cSChandrakanth patil "Transmitted llfc logical msgs"); 356*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 357*35b53f8cSChandrakanth patil "tx_hcfc_msgs", CTLFLAG_RD, 358*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_hcfc_msgs, "Transmitted hcfc msgs"); 359*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 360*35b53f8cSChandrakanth patil "tx_total_collisions", CTLFLAG_RD, 361*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_total_collisions, 362*35b53f8cSChandrakanth patil "Transmitted total collisions"); 363*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 364*35b53f8cSChandrakanth patil "tx_bytes", CTLFLAG_RD, 365*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_bytes, "Transmitted bytes"); 366*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 367*35b53f8cSChandrakanth patil "tx_xthol_frames", CTLFLAG_RD, 368*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_xthol_frames, "Transmitted xthol frames"); 369*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 370*35b53f8cSChandrakanth patil "tx_stat_discard", CTLFLAG_RD, 371*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_stat_discard, "Transmitted stat discard"); 372*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 373*35b53f8cSChandrakanth patil "tx_stat_error", CTLFLAG_RD, 374*35b53f8cSChandrakanth patil &softc->tx_port_stats->tx_stat_error, "Transmitted stat error"); 375*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 376*35b53f8cSChandrakanth patil "rx_64b_frames", CTLFLAG_RD, 377*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_64b_frames, "Received 64b frames"); 378*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 379*35b53f8cSChandrakanth patil "rx_65b_127b_frames", CTLFLAG_RD, 380*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_65b_127b_frames, "Received 65b 127b frames"); 381*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 382*35b53f8cSChandrakanth patil "rx_128b_255b_frames", CTLFLAG_RD, 383*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_128b_255b_frames, 384*35b53f8cSChandrakanth patil "Received 128b 255b frames"); 385*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 386*35b53f8cSChandrakanth patil "rx_256b_511b_frames", CTLFLAG_RD, 387*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_256b_511b_frames, 388*35b53f8cSChandrakanth patil "Received 256b 511b frames"); 389*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 390*35b53f8cSChandrakanth patil "rx_512b_1023b_frames", CTLFLAG_RD, 391*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_512b_1023b_frames, 392*35b53f8cSChandrakanth patil "Received 512b 1023b frames"); 393*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 394*35b53f8cSChandrakanth patil "rx_1024b_1518b_frames", CTLFLAG_RD, 395*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_1024b_1518b_frames, 396*35b53f8cSChandrakanth patil "Received 1024b 1518 frames"); 397*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 398*35b53f8cSChandrakanth patil "rx_good_vlan_frames", CTLFLAG_RD, 399*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_good_vlan_frames, 400*35b53f8cSChandrakanth patil "Received good vlan frames"); 401*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 402*35b53f8cSChandrakanth patil "rx_1519b_2047b_frames", CTLFLAG_RD, 403*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_1519b_2047b_frames, 404*35b53f8cSChandrakanth patil "Received 1519b 2047b frames"); 405*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 406*35b53f8cSChandrakanth patil "rx_2048b_4095b_frames", CTLFLAG_RD, 407*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_2048b_4095b_frames, 408*35b53f8cSChandrakanth patil "Received 2048b 4095b frames"); 409*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 410*35b53f8cSChandrakanth patil "rx_4096b_9216b_frames", CTLFLAG_RD, 411*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_4096b_9216b_frames, 412*35b53f8cSChandrakanth patil "Received 4096b 9216b frames"); 413*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 414*35b53f8cSChandrakanth patil "rx_9217b_16383b_frames", CTLFLAG_RD, 415*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_9217b_16383b_frames, 416*35b53f8cSChandrakanth patil "Received 9217b 16383b frames"); 417*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 418*35b53f8cSChandrakanth patil "rx_total_frames", CTLFLAG_RD, 419*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_total_frames, "Received total frames"); 420*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 421*35b53f8cSChandrakanth patil "rx_ucast_frames", CTLFLAG_RD, 422*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ucast_frames, "Received ucast frames"); 423*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 424*35b53f8cSChandrakanth patil "rx_mcast_frames", CTLFLAG_RD, 425*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_mcast_frames, "Received mcast frames"); 426*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 427*35b53f8cSChandrakanth patil "rx_bcast_frames", CTLFLAG_RD, 428*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_bcast_frames, "Received bcast frames"); 429*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 430*35b53f8cSChandrakanth patil "rx_fcs_err_frames", CTLFLAG_RD, 431*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_fcs_err_frames, "Received fcs err frames"); 432*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 433*35b53f8cSChandrakanth patil "rx_ctrl_frames", CTLFLAG_RD, 434*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ctrl_frames, "Received ctrl frames"); 435*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 436*35b53f8cSChandrakanth patil "rx_pause_frames", CTLFLAG_RD, 437*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pause_frames, "Received pause frames"); 438*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 439*35b53f8cSChandrakanth patil "rx_pfc_frames", CTLFLAG_RD, 440*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_frames, "Received pfc frames"); 441*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 442*35b53f8cSChandrakanth patil "rx_align_err_frames", CTLFLAG_RD, 443*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_align_err_frames, 444*35b53f8cSChandrakanth patil "Received align err frames"); 445*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 446*35b53f8cSChandrakanth patil "rx_ovrsz_frames", CTLFLAG_RD, 447*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ovrsz_frames, 448*35b53f8cSChandrakanth patil "Received ovrsz frames"); 449*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 450*35b53f8cSChandrakanth patil "rx_jbr_frames", CTLFLAG_RD, 451*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_jbr_frames, 452*35b53f8cSChandrakanth patil "Received jbr frames"); 453*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 454*35b53f8cSChandrakanth patil "rx_mtu_err_frames", CTLFLAG_RD, 455*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_mtu_err_frames, 456*35b53f8cSChandrakanth patil "Received mtu err frames"); 457*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 458*35b53f8cSChandrakanth patil "rx_tagged_frames", CTLFLAG_RD, 459*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_tagged_frames, 460*35b53f8cSChandrakanth patil "Received tagged frames"); 461*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 462*35b53f8cSChandrakanth patil "rx_double_tagged_frames", CTLFLAG_RD, 463*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_double_tagged_frames, 464*35b53f8cSChandrakanth patil "Received double tagged frames"); 465*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 466*35b53f8cSChandrakanth patil "rx_good_frames", CTLFLAG_RD, 467*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_good_frames, 468*35b53f8cSChandrakanth patil "Received good frames"); 469*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 470*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri0", CTLFLAG_RD, 471*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri0, 472*35b53f8cSChandrakanth patil "Received pfc ena frames pri0"); 473*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 474*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri1", CTLFLAG_RD, 475*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri1, 476*35b53f8cSChandrakanth patil "Received pfc ena frames pri1"); 477*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 478*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri2", CTLFLAG_RD, 479*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri2, 480*35b53f8cSChandrakanth patil "Received pfc ena frames pri2"); 481*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 482*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri3", CTLFLAG_RD, 483*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri3, 484*35b53f8cSChandrakanth patil "Received pfc ena frames pri3"); 485*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 486*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri4", CTLFLAG_RD, 487*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri4, 488*35b53f8cSChandrakanth patil "Received pfc ena frames pri4"); 489*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 490*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri5", CTLFLAG_RD, 491*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri5, 492*35b53f8cSChandrakanth patil "Received pfc ena frames pri5"); 493*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 494*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri6", CTLFLAG_RD, 495*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri6, 496*35b53f8cSChandrakanth patil "Received pfc ena frames pri6"); 497*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 498*35b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri7", CTLFLAG_RD, 499*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri7, 500*35b53f8cSChandrakanth patil "Received pfc ena frames pri7"); 501*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 502*35b53f8cSChandrakanth patil "rx_sch_crc_err_frames", CTLFLAG_RD, 503*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_sch_crc_err_frames, 504*35b53f8cSChandrakanth patil "Received sch crc err frames"); 505*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 506*35b53f8cSChandrakanth patil "rx_undrsz_frames", CTLFLAG_RD, 507*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_undrsz_frames, "Received undrsz frames"); 508*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 509*35b53f8cSChandrakanth patil "rx_eee_lpi_events", CTLFLAG_RD, 510*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_eee_lpi_events, "Received eee lpi events"); 511*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 512*35b53f8cSChandrakanth patil "rx_eee_lpi_duration", CTLFLAG_RD, 513*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_eee_lpi_duration, 514*35b53f8cSChandrakanth patil "Received eee lpi duration"); 515*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 516*35b53f8cSChandrakanth patil "rx_llfc_physical_msgs", CTLFLAG_RD, 517*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_physical_msgs, 518*35b53f8cSChandrakanth patil "Received llfc physical msgs"); 519*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 520*35b53f8cSChandrakanth patil "rx_llfc_logical_msgs", CTLFLAG_RD, 521*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_logical_msgs, 522*35b53f8cSChandrakanth patil "Received llfc logical msgs"); 523*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 524*35b53f8cSChandrakanth patil "rx_llfc_msgs_with_crc_err", CTLFLAG_RD, 525*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_msgs_with_crc_err, 526*35b53f8cSChandrakanth patil "Received llfc msgs with crc err"); 527*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 528*35b53f8cSChandrakanth patil "rx_hcfc_msgs", CTLFLAG_RD, 529*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_hcfc_msgs, "Received hcfc msgs"); 530*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 531*35b53f8cSChandrakanth patil "rx_hcfc_msgs_with_crc_err", CTLFLAG_RD, 532*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_hcfc_msgs_with_crc_err, 533*35b53f8cSChandrakanth patil "Received hcfc msgs with crc err"); 534*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 535*35b53f8cSChandrakanth patil "rx_bytes", CTLFLAG_RD, 536*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_bytes, "Received bytes"); 537*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 538*35b53f8cSChandrakanth patil "rx_runt_bytes", CTLFLAG_RD, 539*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_runt_bytes, "Received runt bytes"); 540*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 541*35b53f8cSChandrakanth patil "rx_runt_frames", CTLFLAG_RD, 542*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_runt_frames, "Received runt frames"); 543*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 544*35b53f8cSChandrakanth patil "rx_stat_discard", CTLFLAG_RD, 545*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_stat_discard, "Received stat discard"); 546*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 547*35b53f8cSChandrakanth patil "rx_stat_err", CTLFLAG_RD, 548*35b53f8cSChandrakanth patil &softc->rx_port_stats->rx_stat_err, "Received stat err"); 549*35b53f8cSChandrakanth patil 550*35b53f8cSChandrakanth patil if (BNXT_CHIP_P5(softc) && 551*35b53f8cSChandrakanth patil (softc->flags & BNXT_FLAG_FW_CAP_EXT_STATS)) { 552*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 553*35b53f8cSChandrakanth patil "tx_bytes_cos0", CTLFLAG_RD, 554*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos0, "Transmitted bytes count cos0"); 555*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 556*35b53f8cSChandrakanth patil "tx_packets_cos0", CTLFLAG_RD, 557*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos0, "Transmitted packets count cos0"); 558*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 559*35b53f8cSChandrakanth patil "tx_bytes_cos1", CTLFLAG_RD, 560*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos1, "Transmitted bytes count cos1"); 561*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 562*35b53f8cSChandrakanth patil "tx_packets_cos1", CTLFLAG_RD, 563*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos1, "Transmitted packets count cos1"); 564*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 565*35b53f8cSChandrakanth patil "tx_bytes_cos2", CTLFLAG_RD, 566*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos2, "Transmitted bytes count cos2"); 567*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 568*35b53f8cSChandrakanth patil "tx_packets_cos2", CTLFLAG_RD, 569*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos2, "Transmitted packets count cos2"); 570*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 571*35b53f8cSChandrakanth patil "tx_bytes_cos3", CTLFLAG_RD, 572*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos3, "Transmitted bytes count cos3"); 573*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 574*35b53f8cSChandrakanth patil "tx_packets_cos3", CTLFLAG_RD, 575*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos3, "Transmitted packets count cos3"); 576*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 577*35b53f8cSChandrakanth patil "tx_bytes_cos4", CTLFLAG_RD, 578*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos4, "Transmitted bytes count cos4"); 579*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 580*35b53f8cSChandrakanth patil "tx_packets_cos4", CTLFLAG_RD, 581*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos4, "Transmitted packets count cos4"); 582*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 583*35b53f8cSChandrakanth patil "tx_bytes_cos5", CTLFLAG_RD, 584*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos5, "Transmitted bytes count cos5"); 585*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 586*35b53f8cSChandrakanth patil "tx_packets_cos5", CTLFLAG_RD, 587*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos5, "Transmitted packets count cos5"); 588*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 589*35b53f8cSChandrakanth patil "tx_bytes_cos6", CTLFLAG_RD, 590*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos6, "Transmitted bytes count cos6"); 591*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 592*35b53f8cSChandrakanth patil "tx_packets_cos6", CTLFLAG_RD, 593*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos6, "Transmitted packets count cos6"); 594*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 595*35b53f8cSChandrakanth patil "tx_bytes_cos7", CTLFLAG_RD, 596*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos7, "Transmitted bytes count cos7"); 597*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 598*35b53f8cSChandrakanth patil "tx_packets_cos7", CTLFLAG_RD, 599*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos7, "Transmitted packets count cos7"); 600*35b53f8cSChandrakanth patil 601*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 602*35b53f8cSChandrakanth patil "pfc_pri0_tx_duration_us", CTLFLAG_RD, 603*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri0_tx_duration_us, "Time duration between" 604*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri0"); 605*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 606*35b53f8cSChandrakanth patil "pfc_pri0_tx_transitions", CTLFLAG_RD, 607*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri0_tx_transitions, "Num times transition" 608*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 609*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 610*35b53f8cSChandrakanth patil "pfc_pri1_tx_duration_us", CTLFLAG_RD, 611*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri1_tx_duration_us, "Time duration between" 612*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri1"); 613*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 614*35b53f8cSChandrakanth patil "pfc_pri1_tx_transitions", CTLFLAG_RD, 615*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri1_tx_transitions, "Num times transition" 616*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 617*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 618*35b53f8cSChandrakanth patil "pfc_pri2_tx_duration_us", CTLFLAG_RD, 619*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri2_tx_duration_us, "Time duration between" 620*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri2"); 621*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 622*35b53f8cSChandrakanth patil "pfc_pri2_tx_transitions", CTLFLAG_RD, 623*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri2_tx_transitions, "Num times transition" 624*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 625*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 626*35b53f8cSChandrakanth patil "pfc_pri3_tx_duration_us", CTLFLAG_RD, 627*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri3_tx_duration_us, "Time duration between" 628*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri3"); 629*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 630*35b53f8cSChandrakanth patil "pfc_pri3_tx_transitions", CTLFLAG_RD, 631*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri3_tx_transitions, "Num times transition" 632*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 633*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 634*35b53f8cSChandrakanth patil "pfc_pri4_tx_duration_us", CTLFLAG_RD, 635*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri4_tx_duration_us, "Time duration between" 636*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri4"); 637*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 638*35b53f8cSChandrakanth patil "pfc_pri4_tx_transitions", CTLFLAG_RD, 639*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri4_tx_transitions, "Num times transition" 640*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 641*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 642*35b53f8cSChandrakanth patil "pfc_pri5_tx_duration_us", CTLFLAG_RD, 643*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri5_tx_duration_us, "Time duration between" 644*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri5"); 645*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 646*35b53f8cSChandrakanth patil "pfc_pri5_tx_transitions", CTLFLAG_RD, 647*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri5_tx_transitions, "Num times transition" 648*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 649*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 650*35b53f8cSChandrakanth patil "pfc_pri6_tx_duration_us", CTLFLAG_RD, 651*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri6_tx_duration_us, "Time duration between" 652*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri6"); 653*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 654*35b53f8cSChandrakanth patil "pfc_pri6_tx_transitions", CTLFLAG_RD, 655*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri6_tx_transitions, "Num times transition" 656*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 657*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 658*35b53f8cSChandrakanth patil "pfc_pri7_tx_duration_us", CTLFLAG_RD, 659*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri7_tx_duration_us, "Time duration between" 660*35b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri7"); 661*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 662*35b53f8cSChandrakanth patil "pfc_pri7_tx_transitions", CTLFLAG_RD, 663*35b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri7_tx_transitions, "Num times transition" 664*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 665*35b53f8cSChandrakanth patil 666*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 667*35b53f8cSChandrakanth patil "link_down_events", CTLFLAG_RD, 668*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->link_down_events, "Num times link states down"); 669*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 670*35b53f8cSChandrakanth patil "continuous_pause_events", CTLFLAG_RD, 671*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->continuous_pause_events, "Num times pause events"); 672*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 673*35b53f8cSChandrakanth patil "resume_pause_events", CTLFLAG_RD, 674*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->resume_pause_events, "Num times pause events" 675*35b53f8cSChandrakanth patil "resumes"); 676*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 677*35b53f8cSChandrakanth patil "continuous_roce_pause_events", CTLFLAG_RD, 678*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->continuous_roce_pause_events, "Num times roce" 679*35b53f8cSChandrakanth patil "pause events"); 680*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 681*35b53f8cSChandrakanth patil "resume_roce_pause_events", CTLFLAG_RD, 682*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->resume_roce_pause_events, "Num times roce pause" 683*35b53f8cSChandrakanth patil "events resumes"); 684*35b53f8cSChandrakanth patil 685*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 686*35b53f8cSChandrakanth patil "rx_bytes_cos0", CTLFLAG_RD, 687*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos0, "Received bytes count cos0"); 688*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 689*35b53f8cSChandrakanth patil "rx_packets_cos0", CTLFLAG_RD, 690*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos0, "Received packets count cos0"); 691*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 692*35b53f8cSChandrakanth patil "rx_bytes_cos1", CTLFLAG_RD, 693*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos1, "Received bytes count cos1"); 694*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 695*35b53f8cSChandrakanth patil "rx_packets_cos1", CTLFLAG_RD, 696*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos1, "Received packets count cos1"); 697*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 698*35b53f8cSChandrakanth patil "rx_bytes_cos2", CTLFLAG_RD, 699*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos2, "Received bytes count cos2"); 700*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 701*35b53f8cSChandrakanth patil "rx_packets_cos2", CTLFLAG_RD, 702*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos2, "Received packets count cos2"); 703*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 704*35b53f8cSChandrakanth patil "rx_bytes_cos3", CTLFLAG_RD, 705*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos3, "Received bytes count cos3"); 706*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 707*35b53f8cSChandrakanth patil "rx_packets_cos3", CTLFLAG_RD, 708*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos3, "Received packets count cos3"); 709*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 710*35b53f8cSChandrakanth patil "rx_bytes_cos4", CTLFLAG_RD, 711*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos4, "Received bytes count cos4"); 712*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 713*35b53f8cSChandrakanth patil "rx_packets_cos4", CTLFLAG_RD, 714*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos4, "Received packets count cos4"); 715*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 716*35b53f8cSChandrakanth patil "rx_bytes_cos5", CTLFLAG_RD, 717*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos5, "Received bytes count cos5"); 718*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 719*35b53f8cSChandrakanth patil "rx_packets_cos5", CTLFLAG_RD, 720*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos5, "Received packets count cos5"); 721*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 722*35b53f8cSChandrakanth patil "rx_bytes_cos6", CTLFLAG_RD, 723*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos6, "Received bytes count cos6"); 724*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 725*35b53f8cSChandrakanth patil "rx_packets_cos6", CTLFLAG_RD, 726*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos6, "Received packets count cos6"); 727*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 728*35b53f8cSChandrakanth patil "rx_bytes_cos7", CTLFLAG_RD, 729*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos7, "Received bytes count cos7"); 730*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 731*35b53f8cSChandrakanth patil "rx_packets_cos7", CTLFLAG_RD, 732*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos7, "Received packets count cos7"); 733*35b53f8cSChandrakanth patil 734*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 735*35b53f8cSChandrakanth patil "pfc_pri0_rx_duration_us", CTLFLAG_RD, 736*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri0_rx_duration_us, "Time duration in receiving" 737*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 738*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 739*35b53f8cSChandrakanth patil "pfc_pri0_rx_transitions", CTLFLAG_RD, 740*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri0_rx_transitions, "Num times rx transition" 741*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 742*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 743*35b53f8cSChandrakanth patil "pfc_pri1_rx_duration_us", CTLFLAG_RD, 744*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri1_rx_duration_us, "Time duration in receiving" 745*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 746*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 747*35b53f8cSChandrakanth patil "pfc_pri1_rx_transitions", CTLFLAG_RD, 748*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri1_rx_transitions, "Num times rx transition" 749*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 750*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 751*35b53f8cSChandrakanth patil "pfc_pri2_rx_duration_us", CTLFLAG_RD, 752*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri2_rx_duration_us, "Time duration in receiving" 753*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 754*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 755*35b53f8cSChandrakanth patil "pfc_pri2_rx_transitions", CTLFLAG_RD, 756*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri2_rx_transitions, "Num times rx transition" 757*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 758*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 759*35b53f8cSChandrakanth patil "pfc_pri3_rx_duration_us", CTLFLAG_RD, 760*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri3_rx_duration_us, "Time duration in receiving" 761*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 762*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 763*35b53f8cSChandrakanth patil "pfc_pri3_rx_transitions", CTLFLAG_RD, 764*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri3_rx_transitions, "Num times rx transition" 765*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 766*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 767*35b53f8cSChandrakanth patil "pfc_pri4_rx_duration_us", CTLFLAG_RD, 768*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri4_rx_duration_us, "Time duration in receiving" 769*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 770*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 771*35b53f8cSChandrakanth patil "pfc_pri4_rx_transitions", CTLFLAG_RD, 772*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri4_rx_transitions, "Num times rx transition" 773*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 774*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 775*35b53f8cSChandrakanth patil "pfc_pri5_rx_duration_us", CTLFLAG_RD, 776*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri5_rx_duration_us, "Time duration in receiving" 777*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 778*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 779*35b53f8cSChandrakanth patil "pfc_pri5_rx_transitions", CTLFLAG_RD, 780*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri5_rx_transitions, "Num times rx transition" 781*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 782*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 783*35b53f8cSChandrakanth patil "pfc_pri6_rx_duration_us", CTLFLAG_RD, 784*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri6_rx_duration_us, "Time duration in receiving" 785*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 786*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 787*35b53f8cSChandrakanth patil "pfc_pri6_rx_transitions", CTLFLAG_RD, 788*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri6_rx_transitions, "Num times rx transition" 789*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 790*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 791*35b53f8cSChandrakanth patil "pfc_pri7_rx_duration_us", CTLFLAG_RD, 792*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri7_rx_duration_us, "Time duration in receiving" 793*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 794*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 795*35b53f8cSChandrakanth patil "pfc_pri7_rx_transitions", CTLFLAG_RD, 796*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri7_rx_transitions, "Num times rx transition" 797*35b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 798*35b53f8cSChandrakanth patil 799*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 800*35b53f8cSChandrakanth patil "rx_bits", CTLFLAG_RD, 801*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bits, "total number of received bits"); 802*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 803*35b53f8cSChandrakanth patil "rx_buffer_passed_threshold", CTLFLAG_RD, 804*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_buffer_passed_threshold, "num of events port" 805*35b53f8cSChandrakanth patil "buffer" 806*35b53f8cSChandrakanth patil "was over 85%"); 807*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 808*35b53f8cSChandrakanth patil "rx_pcs_symbol_err", CTLFLAG_RD, 809*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_pcs_symbol_err, "num of symbol errors wasn't" 810*35b53f8cSChandrakanth patil "corrected by FEC"); 811*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 812*35b53f8cSChandrakanth patil "rx_corrected_bits", CTLFLAG_RD, 813*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_corrected_bits, "num of bits corrected by FEC"); 814*35b53f8cSChandrakanth patil 815*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 816*35b53f8cSChandrakanth patil "rx_discard_bytes_cos0", CTLFLAG_RD, 817*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos0, "num of rx discard bytes" 818*35b53f8cSChandrakanth patil "count on cos0"); 819*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 820*35b53f8cSChandrakanth patil "rx_discard_packets_cos0", CTLFLAG_RD, 821*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos0, "num of rx discard packets" 822*35b53f8cSChandrakanth patil "count on cos0"); 823*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 824*35b53f8cSChandrakanth patil "rx_discard_bytes_cos1", CTLFLAG_RD, 825*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos1, "num of rx discard bytes" 826*35b53f8cSChandrakanth patil "count on cos1"); 827*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 828*35b53f8cSChandrakanth patil "rx_discard_packets_cos1", CTLFLAG_RD, 829*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos1, "num of rx discard packets" 830*35b53f8cSChandrakanth patil "count on cos1"); 831*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 832*35b53f8cSChandrakanth patil "rx_discard_bytes_cos2", CTLFLAG_RD, 833*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos2, "num of rx discard bytes" 834*35b53f8cSChandrakanth patil "count on cos2"); 835*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 836*35b53f8cSChandrakanth patil "rx_discard_packets_cos2", CTLFLAG_RD, 837*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos2, "num of rx discard packets" 838*35b53f8cSChandrakanth patil "count on cos2"); 839*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 840*35b53f8cSChandrakanth patil "rx_discard_bytes_cos3", CTLFLAG_RD, 841*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos3, "num of rx discard bytes" 842*35b53f8cSChandrakanth patil "count on cos3"); 843*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 844*35b53f8cSChandrakanth patil "rx_discard_packets_cos3", CTLFLAG_RD, 845*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos3, "num of rx discard packets" 846*35b53f8cSChandrakanth patil "count on cos3"); 847*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 848*35b53f8cSChandrakanth patil "rx_discard_bytes_cos4", CTLFLAG_RD, 849*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos4, "num of rx discard bytes" 850*35b53f8cSChandrakanth patil "count on cos4"); 851*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 852*35b53f8cSChandrakanth patil "rx_discard_packets_cos4", CTLFLAG_RD, 853*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos4, "num of rx discard packets" 854*35b53f8cSChandrakanth patil "count on cos4"); 855*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 856*35b53f8cSChandrakanth patil "rx_discard_bytes_cos5", CTLFLAG_RD, 857*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos5, "num of rx discard bytes" 858*35b53f8cSChandrakanth patil "count on cos5"); 859*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 860*35b53f8cSChandrakanth patil "rx_discard_packets_cos5", CTLFLAG_RD, 861*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos5, "num of rx discard packets" 862*35b53f8cSChandrakanth patil "count on cos5"); 863*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 864*35b53f8cSChandrakanth patil "rx_discard_bytes_cos6", CTLFLAG_RD, 865*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos6, "num of rx discard bytes" 866*35b53f8cSChandrakanth patil "count on cos6"); 867*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 868*35b53f8cSChandrakanth patil "rx_discard_packets_cos6", CTLFLAG_RD, 869*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos6, "num of rx discard packets" 870*35b53f8cSChandrakanth patil "count on cos6"); 871*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 872*35b53f8cSChandrakanth patil "rx_discard_bytes_cos7", CTLFLAG_RD, 873*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos7, "num of rx discard bytes" 874*35b53f8cSChandrakanth patil "count on cos7"); 875*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 876*35b53f8cSChandrakanth patil "rx_discard_packets_cos7", CTLFLAG_RD, 877*35b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos7, "num of rx discard packets" 878*35b53f8cSChandrakanth patil "count on cos7"); 879*35b53f8cSChandrakanth patil } 880*35b53f8cSChandrakanth patil 881*35b53f8cSChandrakanth patil 882*35b53f8cSChandrakanth patil return 0; 883*35b53f8cSChandrakanth patil } 884*35b53f8cSChandrakanth patil 885*35b53f8cSChandrakanth patil int 886*35b53f8cSChandrakanth patil bnxt_create_rx_sysctls(struct bnxt_softc *softc, int rxr) 887*35b53f8cSChandrakanth patil { 888*35b53f8cSChandrakanth patil struct sysctl_oid *oid; 889*35b53f8cSChandrakanth patil struct ctx_hw_stats *rx_stats = (void *)softc->rx_stats[rxr].idi_vaddr; 890*35b53f8cSChandrakanth patil char name[32]; 891*35b53f8cSChandrakanth patil char desc[64]; 892*35b53f8cSChandrakanth patil 893*35b53f8cSChandrakanth patil sprintf(name, "rxq%d", rxr); 894*35b53f8cSChandrakanth patil sprintf(desc, "receive queue %d", rxr); 895*35b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 896*35b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 897*35b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 898*35b53f8cSChandrakanth patil if (!oid) 899*35b53f8cSChandrakanth patil return ENOMEM; 900*35b53f8cSChandrakanth patil 901*35b53f8cSChandrakanth patil if (BNXT_CHIP_P5(softc)) 902*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 903*35b53f8cSChandrakanth patil "nq_num_ints", CTLFLAG_RD, &softc->nq_rings[rxr].int_count, 904*35b53f8cSChandrakanth patil "Num Interrupts"); 905*35b53f8cSChandrakanth patil else 906*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 907*35b53f8cSChandrakanth patil "rq_num_ints", CTLFLAG_RD, &softc->rx_cp_rings[rxr].int_count, 908*35b53f8cSChandrakanth patil "Num Interrupts"); 909*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 910*35b53f8cSChandrakanth patil "ucast_pkts", CTLFLAG_RD, &rx_stats->rx_ucast_pkts, 911*35b53f8cSChandrakanth patil "unicast packets received"); 912*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 913*35b53f8cSChandrakanth patil "mcast_pkts", CTLFLAG_RD, &rx_stats->rx_mcast_pkts, 914*35b53f8cSChandrakanth patil "multicast packets received"); 915*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 916*35b53f8cSChandrakanth patil "bcast_pkts", CTLFLAG_RD, &rx_stats->rx_bcast_pkts, 917*35b53f8cSChandrakanth patil "broadcast packets received"); 918*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 919*35b53f8cSChandrakanth patil "discard_pkts", CTLFLAG_RD, 920*35b53f8cSChandrakanth patil &rx_stats->rx_discard_pkts, "discarded receive packets"); 921*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 922*35b53f8cSChandrakanth patil "error_pkts", CTLFLAG_RD, &rx_stats->rx_error_pkts, 923*35b53f8cSChandrakanth patil "Error receive packets"); 924*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 925*35b53f8cSChandrakanth patil "ucast_bytes", CTLFLAG_RD, &rx_stats->rx_ucast_bytes, 926*35b53f8cSChandrakanth patil "unicast bytes received"); 927*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 928*35b53f8cSChandrakanth patil "mcast_bytes", CTLFLAG_RD, &rx_stats->rx_mcast_bytes, 929*35b53f8cSChandrakanth patil "multicast bytes received"); 930*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 931*35b53f8cSChandrakanth patil "bcast_bytes", CTLFLAG_RD, &rx_stats->rx_bcast_bytes, 932*35b53f8cSChandrakanth patil "broadcast bytes received"); 933*35b53f8cSChandrakanth patil 934*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 935*35b53f8cSChandrakanth patil "tpa_pkts", CTLFLAG_RD, &rx_stats->tpa_pkts, 936*35b53f8cSChandrakanth patil "TPA packets"); 937*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 938*35b53f8cSChandrakanth patil "tpa_bytes", CTLFLAG_RD, &rx_stats->tpa_bytes, 939*35b53f8cSChandrakanth patil "TPA bytes"); 940*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 941*35b53f8cSChandrakanth patil "tpa_events", CTLFLAG_RD, &rx_stats->tpa_events, 942*35b53f8cSChandrakanth patil "TPA events"); 943*35b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 944*35b53f8cSChandrakanth patil "tpa_aborts", CTLFLAG_RD, &rx_stats->tpa_aborts, 945*35b53f8cSChandrakanth patil "TPA aborts"); 946*35b53f8cSChandrakanth patil 947*35b53f8cSChandrakanth patil return 0; 948*35b53f8cSChandrakanth patil } 949*35b53f8cSChandrakanth patil 950*35b53f8cSChandrakanth patil static char *bnxt_chip_type[] = { 951*35b53f8cSChandrakanth patil "ASIC", 952*35b53f8cSChandrakanth patil "FPGA", 953*35b53f8cSChandrakanth patil "Palladium", 954*35b53f8cSChandrakanth patil "Unknown" 955*35b53f8cSChandrakanth patil }; 956*35b53f8cSChandrakanth patil #define MAX_CHIP_TYPE 3 957*35b53f8cSChandrakanth patil 958*35b53f8cSChandrakanth patil static char *bnxt_parse_pkglog(int desired_field, uint8_t *data, size_t datalen) 959*35b53f8cSChandrakanth patil { 960*35b53f8cSChandrakanth patil char *retval = NULL; 961*35b53f8cSChandrakanth patil char *p; 962*35b53f8cSChandrakanth patil char *value; 963*35b53f8cSChandrakanth patil int field = 0; 964*35b53f8cSChandrakanth patil 965*35b53f8cSChandrakanth patil if (datalen < 1) 966*35b53f8cSChandrakanth patil return NULL; 967*35b53f8cSChandrakanth patil /* null-terminate the log data (removing last '\n'): */ 968*35b53f8cSChandrakanth patil data[datalen - 1] = 0; 969*35b53f8cSChandrakanth patil for (p = data; *p != 0; p++) { 970*35b53f8cSChandrakanth patil field = 0; 971*35b53f8cSChandrakanth patil retval = NULL; 972*35b53f8cSChandrakanth patil while (*p != 0 && *p != '\n') { 973*35b53f8cSChandrakanth patil value = p; 974*35b53f8cSChandrakanth patil while (*p != 0 && *p != '\t' && *p != '\n') 975*35b53f8cSChandrakanth patil p++; 976*35b53f8cSChandrakanth patil if (field == desired_field) 977*35b53f8cSChandrakanth patil retval = value; 978*35b53f8cSChandrakanth patil if (*p != '\t') 979*35b53f8cSChandrakanth patil break; 980*35b53f8cSChandrakanth patil *p = 0; 981*35b53f8cSChandrakanth patil field++; 982*35b53f8cSChandrakanth patil p++; 983*35b53f8cSChandrakanth patil } 984*35b53f8cSChandrakanth patil if (*p == 0) 985*35b53f8cSChandrakanth patil break; 986*35b53f8cSChandrakanth patil *p = 0; 987*35b53f8cSChandrakanth patil } 988*35b53f8cSChandrakanth patil return retval; 989*35b53f8cSChandrakanth patil } 990*35b53f8cSChandrakanth patil 991*35b53f8cSChandrakanth patil static int 992*35b53f8cSChandrakanth patil bnxt_package_ver_sysctl(SYSCTL_HANDLER_ARGS) 993*35b53f8cSChandrakanth patil { 994*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 995*35b53f8cSChandrakanth patil struct iflib_dma_info dma_data; 996*35b53f8cSChandrakanth patil char *pkglog = NULL; 997*35b53f8cSChandrakanth patil char *p; 998*35b53f8cSChandrakanth patil char unk[] = "<unknown>"; 999*35b53f8cSChandrakanth patil char *buf = unk; 1000*35b53f8cSChandrakanth patil int rc; 1001*35b53f8cSChandrakanth patil uint16_t ordinal = BNX_DIR_ORDINAL_FIRST; 1002*35b53f8cSChandrakanth patil uint16_t index; 1003*35b53f8cSChandrakanth patil uint32_t data_len; 1004*35b53f8cSChandrakanth patil 1005*35b53f8cSChandrakanth patil rc = bnxt_hwrm_nvm_find_dir_entry(softc, BNX_DIR_TYPE_PKG_LOG, 1006*35b53f8cSChandrakanth patil &ordinal, BNX_DIR_EXT_NONE, &index, false, 1007*35b53f8cSChandrakanth patil HWRM_NVM_FIND_DIR_ENTRY_INPUT_OPT_ORDINAL_EQ, 1008*35b53f8cSChandrakanth patil &data_len, NULL, NULL); 1009*35b53f8cSChandrakanth patil dma_data.idi_vaddr = NULL; 1010*35b53f8cSChandrakanth patil if (rc == 0 && data_len) { 1011*35b53f8cSChandrakanth patil rc = iflib_dma_alloc(softc->ctx, data_len, &dma_data, 1012*35b53f8cSChandrakanth patil BUS_DMA_NOWAIT); 1013*35b53f8cSChandrakanth patil if (rc == 0) { 1014*35b53f8cSChandrakanth patil rc = bnxt_hwrm_nvm_read(softc, index, 0, data_len, 1015*35b53f8cSChandrakanth patil &dma_data); 1016*35b53f8cSChandrakanth patil if (rc == 0) { 1017*35b53f8cSChandrakanth patil pkglog = dma_data.idi_vaddr; 1018*35b53f8cSChandrakanth patil p = bnxt_parse_pkglog(BNX_PKG_LOG_FIELD_IDX_PKG_VERSION, pkglog, data_len); 1019*35b53f8cSChandrakanth patil if (p && *p != 0 && isdigit(*p)) 1020*35b53f8cSChandrakanth patil buf = p; 1021*35b53f8cSChandrakanth patil } 1022*35b53f8cSChandrakanth patil } else 1023*35b53f8cSChandrakanth patil dma_data.idi_vaddr = NULL; 1024*35b53f8cSChandrakanth patil } 1025*35b53f8cSChandrakanth patil 1026*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, 0, req); 1027*35b53f8cSChandrakanth patil if (dma_data.idi_vaddr) 1028*35b53f8cSChandrakanth patil iflib_dma_free(&dma_data); 1029*35b53f8cSChandrakanth patil return rc; 1030*35b53f8cSChandrakanth patil } 1031*35b53f8cSChandrakanth patil 1032*35b53f8cSChandrakanth patil static int 1033*35b53f8cSChandrakanth patil bnxt_hwrm_min_ver_sysctl(SYSCTL_HANDLER_ARGS) 1034*35b53f8cSChandrakanth patil { 1035*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1036*35b53f8cSChandrakanth patil char buf[16]; 1037*35b53f8cSChandrakanth patil uint8_t newver[3]; 1038*35b53f8cSChandrakanth patil int rc; 1039*35b53f8cSChandrakanth patil 1040*35b53f8cSChandrakanth patil sprintf(buf, "%hhu.%hhu.%hhu", softc->ver_info->hwrm_min_major, 1041*35b53f8cSChandrakanth patil softc->ver_info->hwrm_min_minor, softc->ver_info->hwrm_min_update); 1042*35b53f8cSChandrakanth patil 1043*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1044*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1045*35b53f8cSChandrakanth patil return rc; 1046*35b53f8cSChandrakanth patil if (sscanf(buf, "%hhu.%hhu.%hhu%*c", &newver[0], &newver[1], 1047*35b53f8cSChandrakanth patil &newver[2]) != 3) 1048*35b53f8cSChandrakanth patil return EINVAL; 1049*35b53f8cSChandrakanth patil softc->ver_info->hwrm_min_major = newver[0]; 1050*35b53f8cSChandrakanth patil softc->ver_info->hwrm_min_minor = newver[1]; 1051*35b53f8cSChandrakanth patil softc->ver_info->hwrm_min_update = newver[2]; 1052*35b53f8cSChandrakanth patil bnxt_check_hwrm_version(softc); 1053*35b53f8cSChandrakanth patil 1054*35b53f8cSChandrakanth patil return rc; 1055*35b53f8cSChandrakanth patil } 1056*35b53f8cSChandrakanth patil 1057*35b53f8cSChandrakanth patil int 1058*35b53f8cSChandrakanth patil bnxt_create_ver_sysctls(struct bnxt_softc *softc) 1059*35b53f8cSChandrakanth patil { 1060*35b53f8cSChandrakanth patil struct bnxt_ver_info *vi = softc->ver_info; 1061*35b53f8cSChandrakanth patil struct sysctl_oid *oid = vi->ver_oid; 1062*35b53f8cSChandrakanth patil 1063*35b53f8cSChandrakanth patil if (!oid) 1064*35b53f8cSChandrakanth patil return ENOMEM; 1065*35b53f8cSChandrakanth patil 1066*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1067*35b53f8cSChandrakanth patil "hwrm_if", CTLFLAG_RD, vi->hwrm_if_ver, 0, 1068*35b53f8cSChandrakanth patil "HWRM interface version"); 1069*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1070*35b53f8cSChandrakanth patil "driver_hwrm_if", CTLFLAG_RD, vi->driver_hwrm_if_ver, 0, 1071*35b53f8cSChandrakanth patil "HWRM firmware version"); 1072*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1073*35b53f8cSChandrakanth patil "hwrm_fw", CTLFLAG_RD, vi->hwrm_fw_ver, 0, 1074*35b53f8cSChandrakanth patil "HWRM firmware version"); 1075*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1076*35b53f8cSChandrakanth patil "mgmt_fw", CTLFLAG_RD, vi->mgmt_fw_ver, 0, 1077*35b53f8cSChandrakanth patil "management firmware version"); 1078*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1079*35b53f8cSChandrakanth patil "netctrl_fw", CTLFLAG_RD, vi->netctrl_fw_ver, 0, 1080*35b53f8cSChandrakanth patil "network control firmware version"); 1081*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1082*35b53f8cSChandrakanth patil "roce_fw", CTLFLAG_RD, vi->roce_fw_ver, 0, 1083*35b53f8cSChandrakanth patil "RoCE firmware version"); 1084*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1085*35b53f8cSChandrakanth patil "fw_ver", CTLFLAG_RD, vi->fw_ver_str, 0, 1086*35b53f8cSChandrakanth patil "Firmware version"); 1087*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1088*35b53f8cSChandrakanth patil "phy", CTLFLAG_RD, vi->phy_ver, 0, 1089*35b53f8cSChandrakanth patil "PHY version"); 1090*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1091*35b53f8cSChandrakanth patil "hwrm_fw_name", CTLFLAG_RD, vi->hwrm_fw_name, 0, 1092*35b53f8cSChandrakanth patil "HWRM firmware name"); 1093*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1094*35b53f8cSChandrakanth patil "mgmt_fw_name", CTLFLAG_RD, vi->mgmt_fw_name, 0, 1095*35b53f8cSChandrakanth patil "management firmware name"); 1096*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1097*35b53f8cSChandrakanth patil "netctrl_fw_name", CTLFLAG_RD, vi->netctrl_fw_name, 0, 1098*35b53f8cSChandrakanth patil "network control firmware name"); 1099*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1100*35b53f8cSChandrakanth patil "roce_fw_name", CTLFLAG_RD, vi->roce_fw_name, 0, 1101*35b53f8cSChandrakanth patil "RoCE firmware name"); 1102*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1103*35b53f8cSChandrakanth patil "phy_vendor", CTLFLAG_RD, vi->phy_vendor, 0, 1104*35b53f8cSChandrakanth patil "PHY vendor name"); 1105*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1106*35b53f8cSChandrakanth patil "phy_partnumber", CTLFLAG_RD, vi->phy_partnumber, 0, 1107*35b53f8cSChandrakanth patil "PHY vendor part number"); 1108*35b53f8cSChandrakanth patil SYSCTL_ADD_U16(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1109*35b53f8cSChandrakanth patil "chip_num", CTLFLAG_RD, &vi->chip_num, 0, "chip number"); 1110*35b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1111*35b53f8cSChandrakanth patil "chip_rev", CTLFLAG_RD, &vi->chip_rev, 0, "chip revision"); 1112*35b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1113*35b53f8cSChandrakanth patil "chip_metal", CTLFLAG_RD, &vi->chip_metal, 0, "chip metal number"); 1114*35b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1115*35b53f8cSChandrakanth patil "chip_bond_id", CTLFLAG_RD, &vi->chip_bond_id, 0, 1116*35b53f8cSChandrakanth patil "chip bond id"); 1117*35b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1118*35b53f8cSChandrakanth patil "chip_type", CTLFLAG_RD, vi->chip_type > MAX_CHIP_TYPE ? 1119*35b53f8cSChandrakanth patil bnxt_chip_type[MAX_CHIP_TYPE] : bnxt_chip_type[vi->chip_type], 0, 1120*35b53f8cSChandrakanth patil "RoCE firmware name"); 1121*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1122*35b53f8cSChandrakanth patil "package_ver", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 1123*35b53f8cSChandrakanth patil softc, 0, bnxt_package_ver_sysctl, "A", 1124*35b53f8cSChandrakanth patil "currently installed package version"); 1125*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1126*35b53f8cSChandrakanth patil "hwrm_min_ver", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1127*35b53f8cSChandrakanth patil softc, 0, bnxt_hwrm_min_ver_sysctl, "A", 1128*35b53f8cSChandrakanth patil "minimum hwrm API vesion to support"); 1129*35b53f8cSChandrakanth patil 1130*35b53f8cSChandrakanth patil return 0; 1131*35b53f8cSChandrakanth patil } 1132*35b53f8cSChandrakanth patil 1133*35b53f8cSChandrakanth patil int 1134*35b53f8cSChandrakanth patil bnxt_create_nvram_sysctls(struct bnxt_nvram_info *ni) 1135*35b53f8cSChandrakanth patil { 1136*35b53f8cSChandrakanth patil struct sysctl_oid *oid = ni->nvm_oid; 1137*35b53f8cSChandrakanth patil 1138*35b53f8cSChandrakanth patil if (!oid) 1139*35b53f8cSChandrakanth patil return ENOMEM; 1140*35b53f8cSChandrakanth patil 1141*35b53f8cSChandrakanth patil SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1142*35b53f8cSChandrakanth patil "mfg_id", CTLFLAG_RD, &ni->mfg_id, 0, "manufacturer id"); 1143*35b53f8cSChandrakanth patil SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1144*35b53f8cSChandrakanth patil "device_id", CTLFLAG_RD, &ni->device_id, 0, "device id"); 1145*35b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1146*35b53f8cSChandrakanth patil "sector_size", CTLFLAG_RD, &ni->sector_size, 0, "sector size"); 1147*35b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1148*35b53f8cSChandrakanth patil "size", CTLFLAG_RD, &ni->size, 0, "nvram total size"); 1149*35b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1150*35b53f8cSChandrakanth patil "reserved_size", CTLFLAG_RD, &ni->reserved_size, 0, 1151*35b53f8cSChandrakanth patil "total reserved space"); 1152*35b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1153*35b53f8cSChandrakanth patil "available_size", CTLFLAG_RD, &ni->available_size, 0, 1154*35b53f8cSChandrakanth patil "total available space"); 1155*35b53f8cSChandrakanth patil 1156*35b53f8cSChandrakanth patil return 0; 1157*35b53f8cSChandrakanth patil } 1158*35b53f8cSChandrakanth patil 1159*35b53f8cSChandrakanth patil static int 1160*35b53f8cSChandrakanth patil bnxt_rss_key_sysctl(SYSCTL_HANDLER_ARGS) 1161*35b53f8cSChandrakanth patil { 1162*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1163*35b53f8cSChandrakanth patil char buf[HW_HASH_KEY_SIZE*2+1] = {0}; 1164*35b53f8cSChandrakanth patil char *p; 1165*35b53f8cSChandrakanth patil int i; 1166*35b53f8cSChandrakanth patil int rc; 1167*35b53f8cSChandrakanth patil 1168*35b53f8cSChandrakanth patil for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) 1169*35b53f8cSChandrakanth patil p += sprintf(p, "%02x", softc->vnic_info.rss_hash_key[i]); 1170*35b53f8cSChandrakanth patil 1171*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1172*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1173*35b53f8cSChandrakanth patil return rc; 1174*35b53f8cSChandrakanth patil 1175*35b53f8cSChandrakanth patil if (strspn(buf, "0123456789abcdefABCDEF") != (HW_HASH_KEY_SIZE * 2)) 1176*35b53f8cSChandrakanth patil return EINVAL; 1177*35b53f8cSChandrakanth patil 1178*35b53f8cSChandrakanth patil for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) { 1179*35b53f8cSChandrakanth patil if (sscanf(p, "%02hhx", &softc->vnic_info.rss_hash_key[i]) != 1) 1180*35b53f8cSChandrakanth patil return EINVAL; 1181*35b53f8cSChandrakanth patil p += 2; 1182*35b53f8cSChandrakanth patil } 1183*35b53f8cSChandrakanth patil 1184*35b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 1185*35b53f8cSChandrakanth patil bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 1186*35b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type); 1187*35b53f8cSChandrakanth patil 1188*35b53f8cSChandrakanth patil return rc; 1189*35b53f8cSChandrakanth patil } 1190*35b53f8cSChandrakanth patil 1191*35b53f8cSChandrakanth patil static const char *bnxt_hash_types[] = {"ipv4", "tcp_ipv4", "udp_ipv4", "ipv6", 1192*35b53f8cSChandrakanth patil "tcp_ipv6", "udp_ipv6", NULL}; 1193*35b53f8cSChandrakanth patil 1194*35b53f8cSChandrakanth patil static int bnxt_get_rss_type_str_bit(char *str) 1195*35b53f8cSChandrakanth patil { 1196*35b53f8cSChandrakanth patil int i; 1197*35b53f8cSChandrakanth patil 1198*35b53f8cSChandrakanth patil for (i=0; bnxt_hash_types[i]; i++) 1199*35b53f8cSChandrakanth patil if (strcmp(bnxt_hash_types[i], str) == 0) 1200*35b53f8cSChandrakanth patil return i; 1201*35b53f8cSChandrakanth patil 1202*35b53f8cSChandrakanth patil return -1; 1203*35b53f8cSChandrakanth patil } 1204*35b53f8cSChandrakanth patil 1205*35b53f8cSChandrakanth patil static int 1206*35b53f8cSChandrakanth patil bnxt_rss_type_sysctl(SYSCTL_HANDLER_ARGS) 1207*35b53f8cSChandrakanth patil { 1208*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1209*35b53f8cSChandrakanth patil char buf[256] = {0}; 1210*35b53f8cSChandrakanth patil char *p; 1211*35b53f8cSChandrakanth patil char *next; 1212*35b53f8cSChandrakanth patil int rc; 1213*35b53f8cSChandrakanth patil int type; 1214*35b53f8cSChandrakanth patil int bit; 1215*35b53f8cSChandrakanth patil 1216*35b53f8cSChandrakanth patil for (type = softc->vnic_info.rss_hash_type; type; 1217*35b53f8cSChandrakanth patil type &= ~(1<<bit)) { 1218*35b53f8cSChandrakanth patil bit = ffs(type) - 1; 1219*35b53f8cSChandrakanth patil if (bit >= sizeof(bnxt_hash_types) / sizeof(const char *)) 1220*35b53f8cSChandrakanth patil continue; 1221*35b53f8cSChandrakanth patil if (type != softc->vnic_info.rss_hash_type) 1222*35b53f8cSChandrakanth patil strcat(buf, ","); 1223*35b53f8cSChandrakanth patil strcat(buf, bnxt_hash_types[bit]); 1224*35b53f8cSChandrakanth patil } 1225*35b53f8cSChandrakanth patil 1226*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1227*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1228*35b53f8cSChandrakanth patil return rc; 1229*35b53f8cSChandrakanth patil 1230*35b53f8cSChandrakanth patil for (type = 0, next = buf, p = strsep(&next, " ,"); p; 1231*35b53f8cSChandrakanth patil p = strsep(&next, " ,")) { 1232*35b53f8cSChandrakanth patil bit = bnxt_get_rss_type_str_bit(p); 1233*35b53f8cSChandrakanth patil if (bit == -1) 1234*35b53f8cSChandrakanth patil return EINVAL; 1235*35b53f8cSChandrakanth patil type |= 1<<bit; 1236*35b53f8cSChandrakanth patil } 1237*35b53f8cSChandrakanth patil if (type != softc->vnic_info.rss_hash_type) { 1238*35b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type = type; 1239*35b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 1240*35b53f8cSChandrakanth patil bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 1241*35b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type); 1242*35b53f8cSChandrakanth patil } 1243*35b53f8cSChandrakanth patil 1244*35b53f8cSChandrakanth patil return rc; 1245*35b53f8cSChandrakanth patil } 1246*35b53f8cSChandrakanth patil 1247*35b53f8cSChandrakanth patil static int 1248*35b53f8cSChandrakanth patil bnxt_rx_stall_sysctl(SYSCTL_HANDLER_ARGS) { 1249*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1250*35b53f8cSChandrakanth patil int rc; 1251*35b53f8cSChandrakanth patil int val; 1252*35b53f8cSChandrakanth patil 1253*35b53f8cSChandrakanth patil if (softc == NULL) 1254*35b53f8cSChandrakanth patil return EBUSY; 1255*35b53f8cSChandrakanth patil 1256*35b53f8cSChandrakanth patil val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_BD_STALL); 1257*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1258*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1259*35b53f8cSChandrakanth patil return rc; 1260*35b53f8cSChandrakanth patil 1261*35b53f8cSChandrakanth patil if (val) 1262*35b53f8cSChandrakanth patil softc->vnic_info.flags |= BNXT_VNIC_FLAG_BD_STALL; 1263*35b53f8cSChandrakanth patil else 1264*35b53f8cSChandrakanth patil softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_BD_STALL; 1265*35b53f8cSChandrakanth patil 1266*35b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 1267*35b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 1268*35b53f8cSChandrakanth patil 1269*35b53f8cSChandrakanth patil return rc; 1270*35b53f8cSChandrakanth patil } 1271*35b53f8cSChandrakanth patil 1272*35b53f8cSChandrakanth patil static int 1273*35b53f8cSChandrakanth patil bnxt_vlan_strip_sysctl(SYSCTL_HANDLER_ARGS) { 1274*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1275*35b53f8cSChandrakanth patil int rc; 1276*35b53f8cSChandrakanth patil int val; 1277*35b53f8cSChandrakanth patil 1278*35b53f8cSChandrakanth patil if (softc == NULL) 1279*35b53f8cSChandrakanth patil return EBUSY; 1280*35b53f8cSChandrakanth patil 1281*35b53f8cSChandrakanth patil val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_VLAN_STRIP); 1282*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1283*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1284*35b53f8cSChandrakanth patil return rc; 1285*35b53f8cSChandrakanth patil 1286*35b53f8cSChandrakanth patil if (val) 1287*35b53f8cSChandrakanth patil softc->vnic_info.flags |= BNXT_VNIC_FLAG_VLAN_STRIP; 1288*35b53f8cSChandrakanth patil else 1289*35b53f8cSChandrakanth patil softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_VLAN_STRIP; 1290*35b53f8cSChandrakanth patil 1291*35b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 1292*35b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 1293*35b53f8cSChandrakanth patil 1294*35b53f8cSChandrakanth patil return rc; 1295*35b53f8cSChandrakanth patil } 1296*35b53f8cSChandrakanth patil 1297*35b53f8cSChandrakanth patil static int 1298*35b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs(SYSCTL_HANDLER_ARGS) { 1299*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1300*35b53f8cSChandrakanth patil int rc; 1301*35b53f8cSChandrakanth patil int val; 1302*35b53f8cSChandrakanth patil 1303*35b53f8cSChandrakanth patil if (softc == NULL) 1304*35b53f8cSChandrakanth patil return EBUSY; 1305*35b53f8cSChandrakanth patil 1306*35b53f8cSChandrakanth patil val = softc->rx_coal_usecs; 1307*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1308*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1309*35b53f8cSChandrakanth patil return rc; 1310*35b53f8cSChandrakanth patil 1311*35b53f8cSChandrakanth patil softc->rx_coal_usecs = val; 1312*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1313*35b53f8cSChandrakanth patil 1314*35b53f8cSChandrakanth patil return rc; 1315*35b53f8cSChandrakanth patil } 1316*35b53f8cSChandrakanth patil 1317*35b53f8cSChandrakanth patil static int 1318*35b53f8cSChandrakanth patil bnxt_set_coal_rx_frames(SYSCTL_HANDLER_ARGS) { 1319*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1320*35b53f8cSChandrakanth patil int rc; 1321*35b53f8cSChandrakanth patil int val; 1322*35b53f8cSChandrakanth patil 1323*35b53f8cSChandrakanth patil if (softc == NULL) 1324*35b53f8cSChandrakanth patil return EBUSY; 1325*35b53f8cSChandrakanth patil 1326*35b53f8cSChandrakanth patil val = softc->rx_coal_frames; 1327*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1328*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1329*35b53f8cSChandrakanth patil return rc; 1330*35b53f8cSChandrakanth patil 1331*35b53f8cSChandrakanth patil softc->rx_coal_frames = val; 1332*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1333*35b53f8cSChandrakanth patil 1334*35b53f8cSChandrakanth patil return rc; 1335*35b53f8cSChandrakanth patil } 1336*35b53f8cSChandrakanth patil 1337*35b53f8cSChandrakanth patil static int 1338*35b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs_irq(SYSCTL_HANDLER_ARGS) { 1339*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1340*35b53f8cSChandrakanth patil int rc; 1341*35b53f8cSChandrakanth patil int val; 1342*35b53f8cSChandrakanth patil 1343*35b53f8cSChandrakanth patil if (softc == NULL) 1344*35b53f8cSChandrakanth patil return EBUSY; 1345*35b53f8cSChandrakanth patil 1346*35b53f8cSChandrakanth patil val = softc->rx_coal_usecs_irq; 1347*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1348*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1349*35b53f8cSChandrakanth patil return rc; 1350*35b53f8cSChandrakanth patil 1351*35b53f8cSChandrakanth patil softc->rx_coal_usecs_irq = val; 1352*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1353*35b53f8cSChandrakanth patil 1354*35b53f8cSChandrakanth patil return rc; 1355*35b53f8cSChandrakanth patil } 1356*35b53f8cSChandrakanth patil 1357*35b53f8cSChandrakanth patil static int 1358*35b53f8cSChandrakanth patil bnxt_set_coal_rx_frames_irq(SYSCTL_HANDLER_ARGS) { 1359*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1360*35b53f8cSChandrakanth patil int rc; 1361*35b53f8cSChandrakanth patil int val; 1362*35b53f8cSChandrakanth patil 1363*35b53f8cSChandrakanth patil if (softc == NULL) 1364*35b53f8cSChandrakanth patil return EBUSY; 1365*35b53f8cSChandrakanth patil 1366*35b53f8cSChandrakanth patil val = softc->rx_coal_frames_irq; 1367*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1368*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1369*35b53f8cSChandrakanth patil return rc; 1370*35b53f8cSChandrakanth patil 1371*35b53f8cSChandrakanth patil softc->rx_coal_frames_irq = val; 1372*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1373*35b53f8cSChandrakanth patil 1374*35b53f8cSChandrakanth patil return rc; 1375*35b53f8cSChandrakanth patil } 1376*35b53f8cSChandrakanth patil 1377*35b53f8cSChandrakanth patil static int 1378*35b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs(SYSCTL_HANDLER_ARGS) { 1379*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1380*35b53f8cSChandrakanth patil int rc; 1381*35b53f8cSChandrakanth patil int val; 1382*35b53f8cSChandrakanth patil 1383*35b53f8cSChandrakanth patil if (softc == NULL) 1384*35b53f8cSChandrakanth patil return EBUSY; 1385*35b53f8cSChandrakanth patil 1386*35b53f8cSChandrakanth patil val = softc->tx_coal_usecs; 1387*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1388*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1389*35b53f8cSChandrakanth patil return rc; 1390*35b53f8cSChandrakanth patil 1391*35b53f8cSChandrakanth patil softc->tx_coal_usecs = val; 1392*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1393*35b53f8cSChandrakanth patil 1394*35b53f8cSChandrakanth patil return rc; 1395*35b53f8cSChandrakanth patil } 1396*35b53f8cSChandrakanth patil 1397*35b53f8cSChandrakanth patil static int 1398*35b53f8cSChandrakanth patil bnxt_set_coal_tx_frames(SYSCTL_HANDLER_ARGS) { 1399*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1400*35b53f8cSChandrakanth patil int rc; 1401*35b53f8cSChandrakanth patil int val; 1402*35b53f8cSChandrakanth patil 1403*35b53f8cSChandrakanth patil if (softc == NULL) 1404*35b53f8cSChandrakanth patil return EBUSY; 1405*35b53f8cSChandrakanth patil 1406*35b53f8cSChandrakanth patil val = softc->tx_coal_frames; 1407*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1408*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1409*35b53f8cSChandrakanth patil return rc; 1410*35b53f8cSChandrakanth patil 1411*35b53f8cSChandrakanth patil softc->tx_coal_frames = val; 1412*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1413*35b53f8cSChandrakanth patil 1414*35b53f8cSChandrakanth patil return rc; 1415*35b53f8cSChandrakanth patil } 1416*35b53f8cSChandrakanth patil 1417*35b53f8cSChandrakanth patil static int 1418*35b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs_irq(SYSCTL_HANDLER_ARGS) { 1419*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1420*35b53f8cSChandrakanth patil int rc; 1421*35b53f8cSChandrakanth patil int val; 1422*35b53f8cSChandrakanth patil 1423*35b53f8cSChandrakanth patil if (softc == NULL) 1424*35b53f8cSChandrakanth patil return EBUSY; 1425*35b53f8cSChandrakanth patil 1426*35b53f8cSChandrakanth patil val = softc->tx_coal_usecs_irq; 1427*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1428*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1429*35b53f8cSChandrakanth patil return rc; 1430*35b53f8cSChandrakanth patil 1431*35b53f8cSChandrakanth patil softc->tx_coal_usecs_irq = val; 1432*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1433*35b53f8cSChandrakanth patil 1434*35b53f8cSChandrakanth patil return rc; 1435*35b53f8cSChandrakanth patil } 1436*35b53f8cSChandrakanth patil 1437*35b53f8cSChandrakanth patil static int 1438*35b53f8cSChandrakanth patil bnxt_set_coal_tx_frames_irq(SYSCTL_HANDLER_ARGS) { 1439*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1440*35b53f8cSChandrakanth patil int rc; 1441*35b53f8cSChandrakanth patil int val; 1442*35b53f8cSChandrakanth patil 1443*35b53f8cSChandrakanth patil if (softc == NULL) 1444*35b53f8cSChandrakanth patil return EBUSY; 1445*35b53f8cSChandrakanth patil 1446*35b53f8cSChandrakanth patil val = softc->tx_coal_frames_irq; 1447*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1448*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1449*35b53f8cSChandrakanth patil return rc; 1450*35b53f8cSChandrakanth patil 1451*35b53f8cSChandrakanth patil softc->tx_coal_frames_irq = val; 1452*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 1453*35b53f8cSChandrakanth patil 1454*35b53f8cSChandrakanth patil return rc; 1455*35b53f8cSChandrakanth patil } 1456*35b53f8cSChandrakanth patil 1457*35b53f8cSChandrakanth patil int 1458*35b53f8cSChandrakanth patil bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) 1459*35b53f8cSChandrakanth patil { 1460*35b53f8cSChandrakanth patil struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(softc->dev); 1461*35b53f8cSChandrakanth patil struct sysctl_oid_list *children; 1462*35b53f8cSChandrakanth patil 1463*35b53f8cSChandrakanth patil children = SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)); 1464*35b53f8cSChandrakanth patil 1465*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_key", 1466*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1467*35b53f8cSChandrakanth patil bnxt_rss_key_sysctl, "A", "RSS key"); 1468*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_type", 1469*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1470*35b53f8cSChandrakanth patil bnxt_rss_type_sysctl, "A", "RSS type bits"); 1471*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rx_stall", 1472*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1473*35b53f8cSChandrakanth patil bnxt_rx_stall_sysctl, "I", 1474*35b53f8cSChandrakanth patil "buffer rx packets in hardware until the host posts new buffers"); 1475*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "vlan_strip", 1476*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1477*35b53f8cSChandrakanth patil bnxt_vlan_strip_sysctl, "I", "strip VLAN tag in the RX path"); 1478*35b53f8cSChandrakanth patil SYSCTL_ADD_CONST_STRING(ctx, children, OID_AUTO, "if_name", CTLFLAG_RD, 1479*35b53f8cSChandrakanth patil if_name(iflib_get_ifp(softc->ctx)), "interface name"); 1480*35b53f8cSChandrakanth patil 1481*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs", 1482*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1483*35b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs, "I", "interrupt coalescing Rx Usecs"); 1484*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames", 1485*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1486*35b53f8cSChandrakanth patil bnxt_set_coal_rx_frames, "I", "interrupt coalescing Rx Frames"); 1487*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs_irq", 1488*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1489*35b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs_irq, "I", 1490*35b53f8cSChandrakanth patil "interrupt coalescing Rx Usecs IRQ"); 1491*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames_irq", 1492*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1493*35b53f8cSChandrakanth patil bnxt_set_coal_rx_frames_irq, "I", 1494*35b53f8cSChandrakanth patil "interrupt coalescing Rx Frames IRQ"); 1495*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs", 1496*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1497*35b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs, "I", "interrupt coalescing Tx Usces"); 1498*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames", 1499*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1500*35b53f8cSChandrakanth patil bnxt_set_coal_tx_frames, "I", "interrupt coalescing Tx Frames"); 1501*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs_irq", 1502*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1503*35b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs_irq, "I", 1504*35b53f8cSChandrakanth patil "interrupt coalescing Tx Usecs IRQ"); 1505*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", 1506*35b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1507*35b53f8cSChandrakanth patil bnxt_set_coal_tx_frames_irq, "I", 1508*35b53f8cSChandrakanth patil "interrupt coalescing Tx Frames IRQ"); 1509*35b53f8cSChandrakanth patil SYSCTL_ADD_U32(ctx, children, OID_AUTO, "flags", CTLFLAG_RD, 1510*35b53f8cSChandrakanth patil &softc->flags, 0, "flags"); 1511*35b53f8cSChandrakanth patil SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fw_cap", CTLFLAG_RD, 1512*35b53f8cSChandrakanth patil &softc->fw_cap, 0, "FW caps"); 1513*35b53f8cSChandrakanth patil 1514*35b53f8cSChandrakanth patil return 0; 1515*35b53f8cSChandrakanth patil } 1516*35b53f8cSChandrakanth patil 1517*35b53f8cSChandrakanth patil #define BNXT_HW_LRO_FN(fn_name, arg) \ 1518*35b53f8cSChandrakanth patil static int \ 1519*35b53f8cSChandrakanth patil fn_name(SYSCTL_HANDLER_ARGS) { \ 1520*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; \ 1521*35b53f8cSChandrakanth patil int rc; \ 1522*35b53f8cSChandrakanth patil int val; \ 1523*35b53f8cSChandrakanth patil \ 1524*35b53f8cSChandrakanth patil if (softc == NULL) \ 1525*35b53f8cSChandrakanth patil return EBUSY; \ 1526*35b53f8cSChandrakanth patil \ 1527*35b53f8cSChandrakanth patil val = softc->hw_lro.arg; \ 1528*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); \ 1529*35b53f8cSChandrakanth patil if (rc || !req->newptr) \ 1530*35b53f8cSChandrakanth patil return rc; \ 1531*35b53f8cSChandrakanth patil \ 1532*35b53f8cSChandrakanth patil if ((if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)) \ 1533*35b53f8cSChandrakanth patil return EBUSY; \ 1534*35b53f8cSChandrakanth patil \ 1535*35b53f8cSChandrakanth patil if (!(softc->flags & BNXT_FLAG_TPA)) \ 1536*35b53f8cSChandrakanth patil return EINVAL; \ 1537*35b53f8cSChandrakanth patil \ 1538*35b53f8cSChandrakanth patil softc->hw_lro.arg = val; \ 1539*35b53f8cSChandrakanth patil bnxt_validate_hw_lro_settings(softc); \ 1540*35b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_tpa_cfg(softc); \ 1541*35b53f8cSChandrakanth patil \ 1542*35b53f8cSChandrakanth patil return rc; \ 1543*35b53f8cSChandrakanth patil } 1544*35b53f8cSChandrakanth patil 1545*35b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_enable_disable, enable) 1546*35b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_mode, is_mode_gro) 1547*35b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_agg_segs, max_agg_segs) 1548*35b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_aggs, max_aggs) 1549*35b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_min_agg_len, min_agg_len) 1550*35b53f8cSChandrakanth patil 1551*35b53f8cSChandrakanth patil #define BNXT_FLOW_CTRL_FN(fn_name, arg) \ 1552*35b53f8cSChandrakanth patil static int \ 1553*35b53f8cSChandrakanth patil fn_name(SYSCTL_HANDLER_ARGS) { \ 1554*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; \ 1555*35b53f8cSChandrakanth patil int rc; \ 1556*35b53f8cSChandrakanth patil int val; \ 1557*35b53f8cSChandrakanth patil \ 1558*35b53f8cSChandrakanth patil if (softc == NULL) \ 1559*35b53f8cSChandrakanth patil return EBUSY; \ 1560*35b53f8cSChandrakanth patil \ 1561*35b53f8cSChandrakanth patil val = softc->link_info.flow_ctrl.arg; \ 1562*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); \ 1563*35b53f8cSChandrakanth patil if (rc || !req->newptr) \ 1564*35b53f8cSChandrakanth patil return rc; \ 1565*35b53f8cSChandrakanth patil \ 1566*35b53f8cSChandrakanth patil if (val) \ 1567*35b53f8cSChandrakanth patil val = 1; \ 1568*35b53f8cSChandrakanth patil \ 1569*35b53f8cSChandrakanth patil if (softc->link_info.flow_ctrl.arg != val) { \ 1570*35b53f8cSChandrakanth patil softc->link_info.flow_ctrl.arg = val; \ 1571*35b53f8cSChandrakanth patil rc = bnxt_hwrm_set_link_setting(softc, true, false, false);\ 1572*35b53f8cSChandrakanth patil rc = bnxt_hwrm_port_phy_qcfg(softc); \ 1573*35b53f8cSChandrakanth patil } \ 1574*35b53f8cSChandrakanth patil \ 1575*35b53f8cSChandrakanth patil return rc; \ 1576*35b53f8cSChandrakanth patil } 1577*35b53f8cSChandrakanth patil 1578*35b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_tx, tx) 1579*35b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_rx, rx) 1580*35b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_autoneg, autoneg) 1581*35b53f8cSChandrakanth patil int 1582*35b53f8cSChandrakanth patil bnxt_create_pause_fc_sysctls(struct bnxt_softc *softc) 1583*35b53f8cSChandrakanth patil { 1584*35b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->flow_ctrl_oid; 1585*35b53f8cSChandrakanth patil 1586*35b53f8cSChandrakanth patil if (!oid) 1587*35b53f8cSChandrakanth patil return ENOMEM; 1588*35b53f8cSChandrakanth patil 1589*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1590*35b53f8cSChandrakanth patil "tx", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1591*35b53f8cSChandrakanth patil bnxt_flow_ctrl_tx, "A", "Enable or Disable Tx Flow Ctrl: 0 / 1"); 1592*35b53f8cSChandrakanth patil 1593*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1594*35b53f8cSChandrakanth patil "rx", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 1595*35b53f8cSChandrakanth patil bnxt_flow_ctrl_rx, "A", "Enable or Disable Tx Flow Ctrl: 0 / 1"); 1596*35b53f8cSChandrakanth patil 1597*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1598*35b53f8cSChandrakanth patil "autoneg", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 1599*35b53f8cSChandrakanth patil 0, bnxt_flow_ctrl_autoneg, "A", 1600*35b53f8cSChandrakanth patil "Enable or Disable Autoneg Flow Ctrl: 0 / 1"); 1601*35b53f8cSChandrakanth patil 1602*35b53f8cSChandrakanth patil return 0; 1603*35b53f8cSChandrakanth patil } 1604*35b53f8cSChandrakanth patil 1605*35b53f8cSChandrakanth patil int 1606*35b53f8cSChandrakanth patil bnxt_create_hw_lro_sysctls(struct bnxt_softc *softc) 1607*35b53f8cSChandrakanth patil { 1608*35b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->hw_lro_oid; 1609*35b53f8cSChandrakanth patil 1610*35b53f8cSChandrakanth patil if (!oid) 1611*35b53f8cSChandrakanth patil return ENOMEM; 1612*35b53f8cSChandrakanth patil 1613*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1614*35b53f8cSChandrakanth patil "enable", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 1615*35b53f8cSChandrakanth patil 0, bnxt_hw_lro_enable_disable, "A", 1616*35b53f8cSChandrakanth patil "Enable or Disable HW LRO: 0 / 1"); 1617*35b53f8cSChandrakanth patil 1618*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1619*35b53f8cSChandrakanth patil "gro_mode", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 1620*35b53f8cSChandrakanth patil 0, bnxt_hw_lro_set_mode, "A", 1621*35b53f8cSChandrakanth patil "Set mode: 1 = GRO mode, 0 = RSC mode"); 1622*35b53f8cSChandrakanth patil 1623*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1624*35b53f8cSChandrakanth patil "max_agg_segs", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1625*35b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_max_agg_segs, "A", 1626*35b53f8cSChandrakanth patil "Set Max Agg Seg Value (unit is Log2): " 1627*35b53f8cSChandrakanth patil "0 (= 1 seg) / 1 (= 2 segs) / ... / 31 (= 2^31 segs)"); 1628*35b53f8cSChandrakanth patil 1629*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1630*35b53f8cSChandrakanth patil "max_aggs", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1631*35b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_max_aggs, "A", 1632*35b53f8cSChandrakanth patil "Set Max Aggs Value (unit is Log2): " 1633*35b53f8cSChandrakanth patil "0 (= 1 agg) / 1 (= 2 aggs) / ... / 7 (= 2^7 segs)"); 1634*35b53f8cSChandrakanth patil 1635*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1636*35b53f8cSChandrakanth patil "min_agg_len", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 1637*35b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_min_agg_len, "A", 1638*35b53f8cSChandrakanth patil "Min Agg Len: 1 to 9000"); 1639*35b53f8cSChandrakanth patil 1640*35b53f8cSChandrakanth patil return 0; 1641*35b53f8cSChandrakanth patil } 1642*35b53f8cSChandrakanth patil 1643*35b53f8cSChandrakanth patil static int 1644*35b53f8cSChandrakanth patil bnxt_dcb_dcbx_cap(SYSCTL_HANDLER_ARGS) 1645*35b53f8cSChandrakanth patil { 1646*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1647*35b53f8cSChandrakanth patil int val; 1648*35b53f8cSChandrakanth patil int rc; 1649*35b53f8cSChandrakanth patil 1650*35b53f8cSChandrakanth patil if (softc == NULL) 1651*35b53f8cSChandrakanth patil return EBUSY; 1652*35b53f8cSChandrakanth patil 1653*35b53f8cSChandrakanth patil val = bnxt_dcb_getdcbx(softc); 1654*35b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 1655*35b53f8cSChandrakanth patil if (rc || !req->newptr) 1656*35b53f8cSChandrakanth patil return rc; 1657*35b53f8cSChandrakanth patil 1658*35b53f8cSChandrakanth patil bnxt_dcb_setdcbx(softc, val); 1659*35b53f8cSChandrakanth patil 1660*35b53f8cSChandrakanth patil return rc; 1661*35b53f8cSChandrakanth patil } 1662*35b53f8cSChandrakanth patil 1663*35b53f8cSChandrakanth patil static char 1664*35b53f8cSChandrakanth patil bnxt_ets_tsa_to_str(struct bnxt_softc *softc, uint32_t tc) 1665*35b53f8cSChandrakanth patil { 1666*35b53f8cSChandrakanth patil switch (softc->ieee_ets->tc_tsa[tc]) { 1667*35b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_TSA_STRICT: 1668*35b53f8cSChandrakanth patil return 's'; 1669*35b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_TSA_ETS: 1670*35b53f8cSChandrakanth patil return 'e'; 1671*35b53f8cSChandrakanth patil default: 1672*35b53f8cSChandrakanth patil return 'X'; 1673*35b53f8cSChandrakanth patil 1674*35b53f8cSChandrakanth patil } 1675*35b53f8cSChandrakanth patil } 1676*35b53f8cSChandrakanth patil 1677*35b53f8cSChandrakanth patil static uint32_t 1678*35b53f8cSChandrakanth patil bnxt_ets_str_to_tsa(char tsa_str) 1679*35b53f8cSChandrakanth patil { 1680*35b53f8cSChandrakanth patil switch (tsa_str) { 1681*35b53f8cSChandrakanth patil case 's': 1682*35b53f8cSChandrakanth patil return BNXT_IEEE_8021QAZ_TSA_STRICT; 1683*35b53f8cSChandrakanth patil case 'e': 1684*35b53f8cSChandrakanth patil return BNXT_IEEE_8021QAZ_TSA_ETS; 1685*35b53f8cSChandrakanth patil default: 1686*35b53f8cSChandrakanth patil return -1; 1687*35b53f8cSChandrakanth patil } 1688*35b53f8cSChandrakanth patil } 1689*35b53f8cSChandrakanth patil 1690*35b53f8cSChandrakanth patil static int 1691*35b53f8cSChandrakanth patil bnxt_ets_get_val(struct bnxt_softc *softc, uint32_t type, uint32_t tc) 1692*35b53f8cSChandrakanth patil { 1693*35b53f8cSChandrakanth patil switch (type) { 1694*35b53f8cSChandrakanth patil case BNXT_TYPE_ETS_TSA: 1695*35b53f8cSChandrakanth patil if (softc->ieee_ets) 1696*35b53f8cSChandrakanth patil return softc->ieee_ets->tc_tsa[tc]; 1697*35b53f8cSChandrakanth patil break; 1698*35b53f8cSChandrakanth patil case BNXT_TYPE_ETS_PRI2TC: 1699*35b53f8cSChandrakanth patil if (softc->ieee_ets) 1700*35b53f8cSChandrakanth patil return softc->ieee_ets->prio_tc[tc]; 1701*35b53f8cSChandrakanth patil break; 1702*35b53f8cSChandrakanth patil case BNXT_TYPE_ETS_TCBW: 1703*35b53f8cSChandrakanth patil if (softc->ieee_ets) 1704*35b53f8cSChandrakanth patil return softc->ieee_ets->tc_tx_bw[tc]; 1705*35b53f8cSChandrakanth patil break; 1706*35b53f8cSChandrakanth patil default: 1707*35b53f8cSChandrakanth patil break; 1708*35b53f8cSChandrakanth patil } 1709*35b53f8cSChandrakanth patil 1710*35b53f8cSChandrakanth patil return -1; 1711*35b53f8cSChandrakanth patil } 1712*35b53f8cSChandrakanth patil 1713*35b53f8cSChandrakanth patil static void 1714*35b53f8cSChandrakanth patil bnxt_pfc_get_string(struct bnxt_softc *softc, char *buf, struct bnxt_ieee_pfc *pfc) 1715*35b53f8cSChandrakanth patil { 1716*35b53f8cSChandrakanth patil uint32_t i; 1717*35b53f8cSChandrakanth patil bool found = false; 1718*35b53f8cSChandrakanth patil 1719*35b53f8cSChandrakanth patil for (i = 0; i < BNXT_IEEE_8021QAZ_MAX_TCS; i++) { 1720*35b53f8cSChandrakanth patil if (pfc->pfc_en & (1 << i)) { 1721*35b53f8cSChandrakanth patil if (found) 1722*35b53f8cSChandrakanth patil buf += sprintf(buf, ", "); 1723*35b53f8cSChandrakanth patil buf += sprintf(buf, "%d", i); 1724*35b53f8cSChandrakanth patil found = true; 1725*35b53f8cSChandrakanth patil } 1726*35b53f8cSChandrakanth patil } 1727*35b53f8cSChandrakanth patil 1728*35b53f8cSChandrakanth patil if (!found) 1729*35b53f8cSChandrakanth patil buf += sprintf(buf, "none"); 1730*35b53f8cSChandrakanth patil } 1731*35b53f8cSChandrakanth patil 1732*35b53f8cSChandrakanth patil static char *bnxt_get_tlv_selector_str(uint8_t selector) 1733*35b53f8cSChandrakanth patil { 1734*35b53f8cSChandrakanth patil switch (selector) { 1735*35b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_ETHERTYPE: 1736*35b53f8cSChandrakanth patil return "Ethertype"; 1737*35b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_DGRAM: 1738*35b53f8cSChandrakanth patil return "UDP or DCCP"; 1739*35b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_DSCP: 1740*35b53f8cSChandrakanth patil return "DSCP"; 1741*35b53f8cSChandrakanth patil default: 1742*35b53f8cSChandrakanth patil return "Unknown"; 1743*35b53f8cSChandrakanth patil } 1744*35b53f8cSChandrakanth patil } 1745*35b53f8cSChandrakanth patil 1746*35b53f8cSChandrakanth patil static void 1747*35b53f8cSChandrakanth patil bnxt_app_tlv_get_string(struct bnxt_softc *softc, char *buf, 1748*35b53f8cSChandrakanth patil struct bnxt_dcb_app *app, int num) 1749*35b53f8cSChandrakanth patil { 1750*35b53f8cSChandrakanth patil uint32_t i; 1751*35b53f8cSChandrakanth patil 1752*35b53f8cSChandrakanth patil if (!num) { 1753*35b53f8cSChandrakanth patil buf += sprintf(buf, " None"); 1754*35b53f8cSChandrakanth patil return; 1755*35b53f8cSChandrakanth patil } 1756*35b53f8cSChandrakanth patil 1757*35b53f8cSChandrakanth patil buf += sprintf(buf, "\n"); 1758*35b53f8cSChandrakanth patil for (i = 0; i < num; i++) { 1759*35b53f8cSChandrakanth patil buf += sprintf(buf, "\tAPP#%0d:\tpri: %d,\tSel: %d,\t%s: %d\n", 1760*35b53f8cSChandrakanth patil i, 1761*35b53f8cSChandrakanth patil app[i].priority, 1762*35b53f8cSChandrakanth patil app[i].selector, 1763*35b53f8cSChandrakanth patil bnxt_get_tlv_selector_str(app[i].selector), 1764*35b53f8cSChandrakanth patil app[i].protocol); 1765*35b53f8cSChandrakanth patil } 1766*35b53f8cSChandrakanth patil } 1767*35b53f8cSChandrakanth patil 1768*35b53f8cSChandrakanth patil static void 1769*35b53f8cSChandrakanth patil bnxt_ets_get_string(struct bnxt_softc *softc, char *buf) 1770*35b53f8cSChandrakanth patil { 1771*35b53f8cSChandrakanth patil uint32_t type, i; 1772*35b53f8cSChandrakanth patil 1773*35b53f8cSChandrakanth patil type = BNXT_TYPE_ETS_TSA; 1774*35b53f8cSChandrakanth patil for (type = 0; type < BNXT_TYPE_ETS_MAX; type++) { 1775*35b53f8cSChandrakanth patil for (i = 0; i < BNXT_IEEE_8021QAZ_MAX_TCS; i++) { 1776*35b53f8cSChandrakanth patil if (i == 0) 1777*35b53f8cSChandrakanth patil buf += sprintf(buf, "%s:", BNXT_ETS_TYPE_STR[type]); 1778*35b53f8cSChandrakanth patil 1779*35b53f8cSChandrakanth patil if (!softc->ieee_ets) 1780*35b53f8cSChandrakanth patil buf += sprintf(buf, "x"); 1781*35b53f8cSChandrakanth patil else if (type == BNXT_TYPE_ETS_TSA) 1782*35b53f8cSChandrakanth patil buf += sprintf(buf, "%c", bnxt_ets_tsa_to_str(softc, i)); 1783*35b53f8cSChandrakanth patil else 1784*35b53f8cSChandrakanth patil buf += sprintf(buf, "%d", bnxt_ets_get_val(softc, type, i)); 1785*35b53f8cSChandrakanth patil 1786*35b53f8cSChandrakanth patil if (i != BNXT_IEEE_8021QAZ_MAX_TCS - 1) 1787*35b53f8cSChandrakanth patil buf += sprintf(buf, ","); 1788*35b53f8cSChandrakanth patil } 1789*35b53f8cSChandrakanth patil if (type != BNXT_TYPE_ETS_MAX - 1) 1790*35b53f8cSChandrakanth patil buf += sprintf(buf, "#"); 1791*35b53f8cSChandrakanth patil } 1792*35b53f8cSChandrakanth patil } 1793*35b53f8cSChandrakanth patil 1794*35b53f8cSChandrakanth patil static int 1795*35b53f8cSChandrakanth patil bnxt_dcb_list_app(SYSCTL_HANDLER_ARGS) 1796*35b53f8cSChandrakanth patil { 1797*35b53f8cSChandrakanth patil struct bnxt_dcb_app app[128] = {0}; 1798*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1799*35b53f8cSChandrakanth patil int rc, num_inputs = 0; 1800*35b53f8cSChandrakanth patil char *buf; 1801*35b53f8cSChandrakanth patil 1802*35b53f8cSChandrakanth patil if (softc == NULL) 1803*35b53f8cSChandrakanth patil return EBUSY; 1804*35b53f8cSChandrakanth patil 1805*35b53f8cSChandrakanth patil #define BNXT_APP_TLV_STR_LEN 4096 1806*35b53f8cSChandrakanth patil buf = malloc(BNXT_APP_TLV_STR_LEN, M_DEVBUF, M_NOWAIT | M_ZERO); 1807*35b53f8cSChandrakanth patil if (!buf) 1808*35b53f8cSChandrakanth patil return ENOMEM; 1809*35b53f8cSChandrakanth patil 1810*35b53f8cSChandrakanth patil bnxt_dcb_ieee_listapp(softc, app, &num_inputs); 1811*35b53f8cSChandrakanth patil bnxt_app_tlv_get_string(softc, buf, app, num_inputs); 1812*35b53f8cSChandrakanth patil 1813*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, BNXT_APP_TLV_STR_LEN, req); 1814*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1815*35b53f8cSChandrakanth patil goto end; 1816*35b53f8cSChandrakanth patil 1817*35b53f8cSChandrakanth patil end: 1818*35b53f8cSChandrakanth patil free(buf, M_DEVBUF); 1819*35b53f8cSChandrakanth patil return rc; 1820*35b53f8cSChandrakanth patil } 1821*35b53f8cSChandrakanth patil 1822*35b53f8cSChandrakanth patil static int 1823*35b53f8cSChandrakanth patil bnxt_dcb_del_app(SYSCTL_HANDLER_ARGS) 1824*35b53f8cSChandrakanth patil { 1825*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1826*35b53f8cSChandrakanth patil struct bnxt_dcb_app app = {0}; 1827*35b53f8cSChandrakanth patil char buf[256] = {0}; 1828*35b53f8cSChandrakanth patil int rc, num_inputs; 1829*35b53f8cSChandrakanth patil 1830*35b53f8cSChandrakanth patil if (softc == NULL) 1831*35b53f8cSChandrakanth patil return EBUSY; 1832*35b53f8cSChandrakanth patil 1833*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1834*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1835*35b53f8cSChandrakanth patil return rc; 1836*35b53f8cSChandrakanth patil 1837*35b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hd", &app.priority, &app.selector, &app.protocol); 1838*35b53f8cSChandrakanth patil 1839*35b53f8cSChandrakanth patil if (num_inputs != 3) { 1840*35b53f8cSChandrakanth patil device_printf(softc->dev, 1841*35b53f8cSChandrakanth patil "Invalid app tlv syntax, inputs = %d\n", num_inputs); 1842*35b53f8cSChandrakanth patil return EINVAL; 1843*35b53f8cSChandrakanth patil } 1844*35b53f8cSChandrakanth patil 1845*35b53f8cSChandrakanth patil bnxt_dcb_ieee_delapp(softc, &app); 1846*35b53f8cSChandrakanth patil 1847*35b53f8cSChandrakanth patil return rc; 1848*35b53f8cSChandrakanth patil } 1849*35b53f8cSChandrakanth patil static int 1850*35b53f8cSChandrakanth patil bnxt_dcb_set_app(SYSCTL_HANDLER_ARGS) 1851*35b53f8cSChandrakanth patil { 1852*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1853*35b53f8cSChandrakanth patil struct bnxt_dcb_app app = {0}; 1854*35b53f8cSChandrakanth patil char buf[256] = {0}; 1855*35b53f8cSChandrakanth patil int rc, num_inputs; 1856*35b53f8cSChandrakanth patil 1857*35b53f8cSChandrakanth patil if (softc == NULL) 1858*35b53f8cSChandrakanth patil return EBUSY; 1859*35b53f8cSChandrakanth patil 1860*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1861*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1862*35b53f8cSChandrakanth patil return rc; 1863*35b53f8cSChandrakanth patil 1864*35b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hd", &app.priority, &app.selector, &app.protocol); 1865*35b53f8cSChandrakanth patil 1866*35b53f8cSChandrakanth patil if (num_inputs != 3) { 1867*35b53f8cSChandrakanth patil device_printf(softc->dev, 1868*35b53f8cSChandrakanth patil "Invalid app tlv syntax, inputs = %d\n", num_inputs); 1869*35b53f8cSChandrakanth patil return EINVAL; 1870*35b53f8cSChandrakanth patil } 1871*35b53f8cSChandrakanth patil 1872*35b53f8cSChandrakanth patil bnxt_dcb_ieee_setapp(softc, &app); 1873*35b53f8cSChandrakanth patil 1874*35b53f8cSChandrakanth patil return rc; 1875*35b53f8cSChandrakanth patil } 1876*35b53f8cSChandrakanth patil 1877*35b53f8cSChandrakanth patil static int 1878*35b53f8cSChandrakanth patil bnxt_dcb_pfc(SYSCTL_HANDLER_ARGS) 1879*35b53f8cSChandrakanth patil { 1880*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1881*35b53f8cSChandrakanth patil struct bnxt_ieee_pfc pfc = {0}; 1882*35b53f8cSChandrakanth patil int rc, i, num_inputs; 1883*35b53f8cSChandrakanth patil char buf[256] = {0}; 1884*35b53f8cSChandrakanth patil int pri_mask = 0; 1885*35b53f8cSChandrakanth patil char pri[8]; 1886*35b53f8cSChandrakanth patil 1887*35b53f8cSChandrakanth patil if (softc == NULL) 1888*35b53f8cSChandrakanth patil return EBUSY; 1889*35b53f8cSChandrakanth patil 1890*35b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_getpfc(softc, &pfc); 1891*35b53f8cSChandrakanth patil if (!rc) 1892*35b53f8cSChandrakanth patil bnxt_pfc_get_string(softc, buf, &pfc); 1893*35b53f8cSChandrakanth patil else 1894*35b53f8cSChandrakanth patil sprintf(buf, "## getpfc failed with error %d ##", rc); 1895*35b53f8cSChandrakanth patil 1896*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1897*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1898*35b53f8cSChandrakanth patil return rc; 1899*35b53f8cSChandrakanth patil 1900*35b53f8cSChandrakanth patil /* Check for 'none' string first */ 1901*35b53f8cSChandrakanth patil if (sscanf(buf, "%s", buf) == 1) { 1902*35b53f8cSChandrakanth patil if (strncmp(buf, "none", 8) == 0) { 1903*35b53f8cSChandrakanth patil goto configure; 1904*35b53f8cSChandrakanth patil } 1905*35b53f8cSChandrakanth patil } 1906*35b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu", 1907*35b53f8cSChandrakanth patil &pri[0], &pri[1], &pri[2], &pri[3], &pri[4], 1908*35b53f8cSChandrakanth patil &pri[5], &pri[6], &pri[7]); 1909*35b53f8cSChandrakanth patil 1910*35b53f8cSChandrakanth patil if (num_inputs < 1 || num_inputs > 8) { 1911*35b53f8cSChandrakanth patil device_printf(softc->dev, 1912*35b53f8cSChandrakanth patil "Invalid pfc syntax, inputs = %d\n", num_inputs); 1913*35b53f8cSChandrakanth patil return EINVAL; 1914*35b53f8cSChandrakanth patil } 1915*35b53f8cSChandrakanth patil 1916*35b53f8cSChandrakanth patil for (i = 0; i < num_inputs; i++) { 1917*35b53f8cSChandrakanth patil if (pri[i] > 7 || pri[i] < 0) { 1918*35b53f8cSChandrakanth patil device_printf(softc->dev, 1919*35b53f8cSChandrakanth patil "Invalid priority %d. Valid priorties are " 1920*35b53f8cSChandrakanth patil "from 0 to 7 and string \"none\".\n", pri[i]); 1921*35b53f8cSChandrakanth patil return EINVAL; 1922*35b53f8cSChandrakanth patil } 1923*35b53f8cSChandrakanth patil 1924*35b53f8cSChandrakanth patil pri_mask |= (1 << pri[i]) & 0xFF; 1925*35b53f8cSChandrakanth patil } 1926*35b53f8cSChandrakanth patil 1927*35b53f8cSChandrakanth patil configure: 1928*35b53f8cSChandrakanth patil pfc.pfc_en = pri_mask; 1929*35b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_setpfc(softc, &pfc); 1930*35b53f8cSChandrakanth patil if (rc) 1931*35b53f8cSChandrakanth patil device_printf(softc->dev, 1932*35b53f8cSChandrakanth patil "setpfc failed with status %d\n", rc); 1933*35b53f8cSChandrakanth patil return rc; 1934*35b53f8cSChandrakanth patil } 1935*35b53f8cSChandrakanth patil 1936*35b53f8cSChandrakanth patil static int 1937*35b53f8cSChandrakanth patil bnxt_dcb_ets(SYSCTL_HANDLER_ARGS) 1938*35b53f8cSChandrakanth patil { 1939*35b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 1940*35b53f8cSChandrakanth patil struct bnxt_ieee_ets ets = {0}; 1941*35b53f8cSChandrakanth patil int rc = 0, i, num_inputs; 1942*35b53f8cSChandrakanth patil char buf[256] = {0}; 1943*35b53f8cSChandrakanth patil char tsa[8]; 1944*35b53f8cSChandrakanth patil 1945*35b53f8cSChandrakanth patil if (softc == NULL) 1946*35b53f8cSChandrakanth patil return EBUSY; 1947*35b53f8cSChandrakanth patil 1948*35b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_getets(softc, &ets); 1949*35b53f8cSChandrakanth patil if (!rc) 1950*35b53f8cSChandrakanth patil bnxt_ets_get_string(softc, buf); 1951*35b53f8cSChandrakanth patil else 1952*35b53f8cSChandrakanth patil sprintf(buf, "## getets failed with error %d ##", rc); 1953*35b53f8cSChandrakanth patil 1954*35b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1955*35b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 1956*35b53f8cSChandrakanth patil return rc; 1957*35b53f8cSChandrakanth patil 1958*35b53f8cSChandrakanth patil num_inputs = sscanf(buf, "tsa:%c,%c,%c,%c,%c,%c,%c,%c#" 1959*35b53f8cSChandrakanth patil "pri2tc:%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu#" 1960*35b53f8cSChandrakanth patil "tcbw:%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu", 1961*35b53f8cSChandrakanth patil &tsa[0], &tsa[1], &tsa[2], &tsa[3], &tsa[4], &tsa[5], &tsa[6], &tsa[7], 1962*35b53f8cSChandrakanth patil &ets.prio_tc[0], &ets.prio_tc[1], &ets.prio_tc[2], &ets.prio_tc[3], 1963*35b53f8cSChandrakanth patil &ets.prio_tc[4], &ets.prio_tc[5], &ets.prio_tc[6], &ets.prio_tc[7], 1964*35b53f8cSChandrakanth patil &ets.tc_tx_bw[0], &ets.tc_tx_bw[1], &ets.tc_tx_bw[2], &ets.tc_tx_bw[3], 1965*35b53f8cSChandrakanth patil &ets.tc_tx_bw[4], &ets.tc_tx_bw[5], &ets.tc_tx_bw[6], &ets.tc_tx_bw[7]); 1966*35b53f8cSChandrakanth patil 1967*35b53f8cSChandrakanth patil if (num_inputs != 24) 1968*35b53f8cSChandrakanth patil return EINVAL; 1969*35b53f8cSChandrakanth patil 1970*35b53f8cSChandrakanth patil for ( i= 0; i < 8; i++) 1971*35b53f8cSChandrakanth patil ets.tc_tsa[i] = bnxt_ets_str_to_tsa(tsa[i]); 1972*35b53f8cSChandrakanth patil 1973*35b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_setets(softc, &ets); 1974*35b53f8cSChandrakanth patil 1975*35b53f8cSChandrakanth patil return rc; 1976*35b53f8cSChandrakanth patil } 1977*35b53f8cSChandrakanth patil 1978*35b53f8cSChandrakanth patil int 1979*35b53f8cSChandrakanth patil bnxt_create_dcb_sysctls(struct bnxt_softc *softc) 1980*35b53f8cSChandrakanth patil { 1981*35b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->dcb_oid; 1982*35b53f8cSChandrakanth patil 1983*35b53f8cSChandrakanth patil if (!oid) 1984*35b53f8cSChandrakanth patil return ENOMEM; 1985*35b53f8cSChandrakanth patil 1986*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 1987*35b53f8cSChandrakanth patil "dcbx_cap", CTLTYPE_INT | CTLFLAG_RWTUN, softc, 1988*35b53f8cSChandrakanth patil 0, bnxt_dcb_dcbx_cap, "A", 1989*35b53f8cSChandrakanth patil "Enable or Disable LRO: 0 / 1"); 1990*35b53f8cSChandrakanth patil 1991*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "ets", 1992*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN, softc, 0, 1993*35b53f8cSChandrakanth patil bnxt_dcb_ets, "A", "Enhanced Transmission Selection (ETS)"); 1994*35b53f8cSChandrakanth patil 1995*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "pfc", 1996*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN, softc, 0, 1997*35b53f8cSChandrakanth patil bnxt_dcb_pfc, "A", "Enhanced Transmission Selection (ETS)"); 1998*35b53f8cSChandrakanth patil 1999*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "set_apptlv", 2000*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_WR, softc, 0, 2001*35b53f8cSChandrakanth patil bnxt_dcb_set_app, "A", "Set App TLV"); 2002*35b53f8cSChandrakanth patil 2003*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "del_apptlv", 2004*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_WR, softc, 0, 2005*35b53f8cSChandrakanth patil bnxt_dcb_del_app, "A", "Delete App TLV"); 2006*35b53f8cSChandrakanth patil 2007*35b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "list_apptlv", 2008*35b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RD, softc, 0, 2009*35b53f8cSChandrakanth patil bnxt_dcb_list_app, "A", "List all App TLVs"); 2010*35b53f8cSChandrakanth patil 2011*35b53f8cSChandrakanth patil return 0; 2012*35b53f8cSChandrakanth patil } 2013*35b53f8cSChandrakanth patil 2014*35b53f8cSChandrakanth patil int 2015*35b53f8cSChandrakanth patil bnxt_create_config_sysctls_post(struct bnxt_softc *softc) 2016*35b53f8cSChandrakanth patil { 2017*35b53f8cSChandrakanth patil /* Nothing for now, meant for future expansion */ 2018*35b53f8cSChandrakanth patil return 0; 2019*35b53f8cSChandrakanth patil } 2020