135b53f8cSChandrakanth patil /*- 235b53f8cSChandrakanth patil * Broadcom NetXtreme-C/E network driver. 335b53f8cSChandrakanth patil * 435b53f8cSChandrakanth patil * Copyright (c) 2016 Broadcom, All Rights Reserved. 535b53f8cSChandrakanth patil * The term Broadcom refers to Broadcom Limited and/or its subsidiaries 635b53f8cSChandrakanth patil * 735b53f8cSChandrakanth patil * Redistribution and use in source and binary forms, with or without 835b53f8cSChandrakanth patil * modification, are permitted provided that the following conditions 935b53f8cSChandrakanth patil * are met: 1035b53f8cSChandrakanth patil * 1. Redistributions of source code must retain the above copyright 1135b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer. 1235b53f8cSChandrakanth patil * 2. Redistributions in binary form must reproduce the above copyright 1335b53f8cSChandrakanth patil * notice, this list of conditions and the following disclaimer in the 1435b53f8cSChandrakanth patil * documentation and/or other materials provided with the distribution. 1535b53f8cSChandrakanth patil * 1635b53f8cSChandrakanth patil * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' 1735b53f8cSChandrakanth patil * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1835b53f8cSChandrakanth patil * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1935b53f8cSChandrakanth patil * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 2035b53f8cSChandrakanth patil * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2135b53f8cSChandrakanth patil * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2235b53f8cSChandrakanth patil * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2335b53f8cSChandrakanth patil * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2435b53f8cSChandrakanth patil * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2535b53f8cSChandrakanth patil * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 2635b53f8cSChandrakanth patil * THE POSSIBILITY OF SUCH DAMAGE. 2735b53f8cSChandrakanth patil */ 2835b53f8cSChandrakanth patil 2935b53f8cSChandrakanth patil #include <sys/types.h> 3035b53f8cSChandrakanth patil #include <sys/sysctl.h> 3135b53f8cSChandrakanth patil #include <sys/ctype.h> 32c9965974SChandrakanth patil #include <linux/delay.h> 3335b53f8cSChandrakanth patil 3435b53f8cSChandrakanth patil #include "bnxt.h" 3535b53f8cSChandrakanth patil #include "bnxt_hwrm.h" 3635b53f8cSChandrakanth patil #include "bnxt_sysctl.h" 3735b53f8cSChandrakanth patil 38c9965974SChandrakanth patil DEFINE_MUTEX(tmp_mutex); /* mutex lock for driver */ 39c9965974SChandrakanth patil extern void bnxt_fw_reset(struct bnxt_softc *bp); 40c9965974SChandrakanth patil extern void bnxt_queue_sp_work(struct bnxt_softc *bp); 41c9965974SChandrakanth patil extern void 42c9965974SChandrakanth patil process_nq(struct bnxt_softc *softc, uint16_t nqid); 4335b53f8cSChandrakanth patil /* 4435b53f8cSChandrakanth patil * We want to create: 4535b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0 4635b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0.txmbufs 4735b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.rxq0 4835b53f8cSChandrakanth patil * dev.bnxt.0.hwstats.txq0.rxmbufs 4935b53f8cSChandrakanth patil * so the hwstats ctx list needs to be created in attach_post and populated 5035b53f8cSChandrakanth patil * during init. 5135b53f8cSChandrakanth patil * 5235b53f8cSChandrakanth patil * Then, it needs to be cleaned up in stop. 5335b53f8cSChandrakanth patil */ 5435b53f8cSChandrakanth patil 5535b53f8cSChandrakanth patil int 5635b53f8cSChandrakanth patil bnxt_init_sysctl_ctx(struct bnxt_softc *softc) 5735b53f8cSChandrakanth patil { 5835b53f8cSChandrakanth patil struct sysctl_ctx_list *ctx; 5935b53f8cSChandrakanth patil 6035b53f8cSChandrakanth patil sysctl_ctx_init(&softc->hw_stats); 6135b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 6235b53f8cSChandrakanth patil softc->hw_stats_oid = SYSCTL_ADD_NODE(ctx, 6335b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 6435b53f8cSChandrakanth patil "hwstats", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "hardware statistics"); 6535b53f8cSChandrakanth patil if (!softc->hw_stats_oid) { 6635b53f8cSChandrakanth patil sysctl_ctx_free(&softc->hw_stats); 6735b53f8cSChandrakanth patil return ENOMEM; 6835b53f8cSChandrakanth patil } 6935b53f8cSChandrakanth patil 7035b53f8cSChandrakanth patil sysctl_ctx_init(&softc->ver_info->ver_ctx); 7135b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 7235b53f8cSChandrakanth patil softc->ver_info->ver_oid = SYSCTL_ADD_NODE(ctx, 7335b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 7435b53f8cSChandrakanth patil "ver", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 7535b53f8cSChandrakanth patil "hardware/firmware version information"); 7635b53f8cSChandrakanth patil if (!softc->ver_info->ver_oid) { 7735b53f8cSChandrakanth patil sysctl_ctx_free(&softc->ver_info->ver_ctx); 7835b53f8cSChandrakanth patil return ENOMEM; 7935b53f8cSChandrakanth patil } 8035b53f8cSChandrakanth patil 8135b53f8cSChandrakanth patil if (BNXT_PF(softc)) { 8235b53f8cSChandrakanth patil sysctl_ctx_init(&softc->nvm_info->nvm_ctx); 8335b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 8435b53f8cSChandrakanth patil softc->nvm_info->nvm_oid = SYSCTL_ADD_NODE(ctx, 8535b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 8635b53f8cSChandrakanth patil "nvram", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, 8735b53f8cSChandrakanth patil "nvram information"); 8835b53f8cSChandrakanth patil if (!softc->nvm_info->nvm_oid) { 8935b53f8cSChandrakanth patil sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 9035b53f8cSChandrakanth patil return ENOMEM; 9135b53f8cSChandrakanth patil } 9235b53f8cSChandrakanth patil } 9335b53f8cSChandrakanth patil 9435b53f8cSChandrakanth patil sysctl_ctx_init(&softc->hw_lro_ctx); 9535b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 9635b53f8cSChandrakanth patil softc->hw_lro_oid = SYSCTL_ADD_NODE(ctx, 9735b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 9835b53f8cSChandrakanth patil "hw_lro", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "hardware lro"); 9935b53f8cSChandrakanth patil if (!softc->hw_lro_oid) { 10035b53f8cSChandrakanth patil sysctl_ctx_free(&softc->hw_lro_ctx); 10135b53f8cSChandrakanth patil return ENOMEM; 10235b53f8cSChandrakanth patil } 10335b53f8cSChandrakanth patil 10435b53f8cSChandrakanth patil sysctl_ctx_init(&softc->flow_ctrl_ctx); 10535b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 10635b53f8cSChandrakanth patil softc->flow_ctrl_oid = SYSCTL_ADD_NODE(ctx, 10735b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 10835b53f8cSChandrakanth patil "fc", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "flow ctrl"); 10935b53f8cSChandrakanth patil if (!softc->flow_ctrl_oid) { 11035b53f8cSChandrakanth patil sysctl_ctx_free(&softc->flow_ctrl_ctx); 11135b53f8cSChandrakanth patil return ENOMEM; 11235b53f8cSChandrakanth patil } 11335b53f8cSChandrakanth patil 11435b53f8cSChandrakanth patil sysctl_ctx_init(&softc->dcb_ctx); 11535b53f8cSChandrakanth patil ctx = device_get_sysctl_ctx(softc->dev); 11635b53f8cSChandrakanth patil softc->dcb_oid = SYSCTL_ADD_NODE(ctx, 11735b53f8cSChandrakanth patil SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)), OID_AUTO, 118*0bc672b3SZhenlei Huang "dcb", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "Data Center Bridging"); 11935b53f8cSChandrakanth patil if (!softc->dcb_oid) { 12035b53f8cSChandrakanth patil sysctl_ctx_free(&softc->dcb_ctx); 12135b53f8cSChandrakanth patil return ENOMEM; 12235b53f8cSChandrakanth patil } 12335b53f8cSChandrakanth patil 12435b53f8cSChandrakanth patil return 0; 12535b53f8cSChandrakanth patil } 12635b53f8cSChandrakanth patil 12735b53f8cSChandrakanth patil int 12835b53f8cSChandrakanth patil bnxt_free_sysctl_ctx(struct bnxt_softc *softc) 12935b53f8cSChandrakanth patil { 13035b53f8cSChandrakanth patil int orc; 13135b53f8cSChandrakanth patil int rc = 0; 13235b53f8cSChandrakanth patil 13335b53f8cSChandrakanth patil if (softc->hw_stats_oid != NULL) { 13435b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->hw_stats); 13535b53f8cSChandrakanth patil if (orc) 13635b53f8cSChandrakanth patil rc = orc; 13735b53f8cSChandrakanth patil else 13835b53f8cSChandrakanth patil softc->hw_stats_oid = NULL; 13935b53f8cSChandrakanth patil } 14035b53f8cSChandrakanth patil if (softc->ver_info->ver_oid != NULL) { 14135b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->ver_info->ver_ctx); 14235b53f8cSChandrakanth patil if (orc) 14335b53f8cSChandrakanth patil rc = orc; 14435b53f8cSChandrakanth patil else 14535b53f8cSChandrakanth patil softc->ver_info->ver_oid = NULL; 14635b53f8cSChandrakanth patil } 14735b53f8cSChandrakanth patil if (BNXT_PF(softc) && softc->nvm_info->nvm_oid != NULL) { 14835b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->nvm_info->nvm_ctx); 14935b53f8cSChandrakanth patil if (orc) 15035b53f8cSChandrakanth patil rc = orc; 15135b53f8cSChandrakanth patil else 15235b53f8cSChandrakanth patil softc->nvm_info->nvm_oid = NULL; 15335b53f8cSChandrakanth patil } 15435b53f8cSChandrakanth patil if (softc->hw_lro_oid != NULL) { 15535b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->hw_lro_ctx); 15635b53f8cSChandrakanth patil if (orc) 15735b53f8cSChandrakanth patil rc = orc; 15835b53f8cSChandrakanth patil else 15935b53f8cSChandrakanth patil softc->hw_lro_oid = NULL; 16035b53f8cSChandrakanth patil } 16135b53f8cSChandrakanth patil 16235b53f8cSChandrakanth patil if (softc->flow_ctrl_oid != NULL) { 16335b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->flow_ctrl_ctx); 16435b53f8cSChandrakanth patil if (orc) 16535b53f8cSChandrakanth patil rc = orc; 16635b53f8cSChandrakanth patil else 16735b53f8cSChandrakanth patil softc->flow_ctrl_oid = NULL; 16835b53f8cSChandrakanth patil } 16935b53f8cSChandrakanth patil 17035b53f8cSChandrakanth patil if (softc->dcb_oid != NULL) { 17135b53f8cSChandrakanth patil orc = sysctl_ctx_free(&softc->dcb_ctx); 17235b53f8cSChandrakanth patil if (orc) 17335b53f8cSChandrakanth patil rc = orc; 17435b53f8cSChandrakanth patil else 17535b53f8cSChandrakanth patil softc->dcb_oid = NULL; 17635b53f8cSChandrakanth patil } 17735b53f8cSChandrakanth patil 17835b53f8cSChandrakanth patil return rc; 17935b53f8cSChandrakanth patil } 18035b53f8cSChandrakanth patil 18135b53f8cSChandrakanth patil int 18235b53f8cSChandrakanth patil bnxt_create_tx_sysctls(struct bnxt_softc *softc, int txr) 18335b53f8cSChandrakanth patil { 18435b53f8cSChandrakanth patil struct sysctl_oid *oid; 18535b53f8cSChandrakanth patil struct ctx_hw_stats *tx_stats = (void *)softc->tx_stats[txr].idi_vaddr; 18635b53f8cSChandrakanth patil char name[32]; 18735b53f8cSChandrakanth patil char desc[64]; 18835b53f8cSChandrakanth patil 18935b53f8cSChandrakanth patil sprintf(name, "txq%d", txr); 19035b53f8cSChandrakanth patil sprintf(desc, "transmit queue %d", txr); 19135b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 19235b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 19335b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 19435b53f8cSChandrakanth patil if (!oid) 19535b53f8cSChandrakanth patil return ENOMEM; 19635b53f8cSChandrakanth patil 19735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 19835b53f8cSChandrakanth patil "ucast_pkts", CTLFLAG_RD, &tx_stats->tx_ucast_pkts, 19935b53f8cSChandrakanth patil "unicast packets sent"); 20035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 20135b53f8cSChandrakanth patil "mcast_pkts", CTLFLAG_RD, &tx_stats->tx_mcast_pkts, 20235b53f8cSChandrakanth patil "multicast packets sent"); 20335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 20435b53f8cSChandrakanth patil "bcast_pkts", CTLFLAG_RD, &tx_stats->tx_bcast_pkts, 20535b53f8cSChandrakanth patil "broadcast packets sent"); 20635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 20735b53f8cSChandrakanth patil "discard_pkts", CTLFLAG_RD, 20835b53f8cSChandrakanth patil &tx_stats->tx_discard_pkts, "discarded transmit packets"); 20935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 21035b53f8cSChandrakanth patil "error_pkts", CTLFLAG_RD, &tx_stats->tx_error_pkts, 21135b53f8cSChandrakanth patil "Error transmit packets"); 21235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 21335b53f8cSChandrakanth patil "ucast_bytes", CTLFLAG_RD, &tx_stats->tx_ucast_bytes, 21435b53f8cSChandrakanth patil "unicast bytes sent"); 21535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 21635b53f8cSChandrakanth patil "mcast_bytes", CTLFLAG_RD, &tx_stats->tx_mcast_bytes, 21735b53f8cSChandrakanth patil "multicast bytes sent"); 21835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 21935b53f8cSChandrakanth patil "bcast_bytes", CTLFLAG_RD, &tx_stats->tx_bcast_bytes, 22035b53f8cSChandrakanth patil "broadcast bytes sent"); 22135b53f8cSChandrakanth patil 22235b53f8cSChandrakanth patil return 0; 22335b53f8cSChandrakanth patil } 22435b53f8cSChandrakanth patil 22535b53f8cSChandrakanth patil int 22635b53f8cSChandrakanth patil bnxt_create_port_stats_sysctls(struct bnxt_softc *softc) 22735b53f8cSChandrakanth patil { 22835b53f8cSChandrakanth patil struct sysctl_oid *oid; 22935b53f8cSChandrakanth patil char name[32]; 23035b53f8cSChandrakanth patil char desc[64]; 23135b53f8cSChandrakanth patil 23235b53f8cSChandrakanth patil sprintf(name, "port_stats"); 23335b53f8cSChandrakanth patil sprintf(desc, "Port Stats"); 23435b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 23535b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 23635b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 23735b53f8cSChandrakanth patil if (!oid) 23835b53f8cSChandrakanth patil return ENOMEM; 23935b53f8cSChandrakanth patil 24035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 24135b53f8cSChandrakanth patil "tx_64b_frames", CTLFLAG_RD, 24235b53f8cSChandrakanth patil &softc->tx_port_stats->tx_64b_frames, "Transmitted 64b frames"); 24335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 24435b53f8cSChandrakanth patil "tx_65b_127b_frames", CTLFLAG_RD, 24535b53f8cSChandrakanth patil &softc->tx_port_stats->tx_65b_127b_frames, 24635b53f8cSChandrakanth patil "Transmitted 65b 127b frames"); 24735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 24835b53f8cSChandrakanth patil "tx_128b_255b_frames", CTLFLAG_RD, 24935b53f8cSChandrakanth patil &softc->tx_port_stats->tx_128b_255b_frames, 25035b53f8cSChandrakanth patil "Transmitted 128b 255b frames"); 25135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 25235b53f8cSChandrakanth patil "tx_256b_511b_frames", CTLFLAG_RD, 25335b53f8cSChandrakanth patil &softc->tx_port_stats->tx_256b_511b_frames, 25435b53f8cSChandrakanth patil "Transmitted 256b 511b frames"); 25535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 25635b53f8cSChandrakanth patil "tx_512b_1023b_frames", CTLFLAG_RD, 25735b53f8cSChandrakanth patil &softc->tx_port_stats->tx_512b_1023b_frames, 25835b53f8cSChandrakanth patil "Transmitted 512b 1023b frames"); 25935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 26035b53f8cSChandrakanth patil "tx_1024b_1518b_frames", CTLFLAG_RD, 26135b53f8cSChandrakanth patil &softc->tx_port_stats->tx_1024b_1518b_frames, 26235b53f8cSChandrakanth patil "Transmitted 1024b 1518b frames"); 26335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 26435b53f8cSChandrakanth patil "tx_good_vlan_frames", CTLFLAG_RD, 26535b53f8cSChandrakanth patil &softc->tx_port_stats->tx_good_vlan_frames, 26635b53f8cSChandrakanth patil "Transmitted good vlan frames"); 26735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 26835b53f8cSChandrakanth patil "tx_1519b_2047b_frames", CTLFLAG_RD, 26935b53f8cSChandrakanth patil &softc->tx_port_stats->tx_1519b_2047b_frames, 27035b53f8cSChandrakanth patil "Transmitted 1519b 2047b frames"); 27135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 27235b53f8cSChandrakanth patil "tx_2048b_4095b_frames", CTLFLAG_RD, 27335b53f8cSChandrakanth patil &softc->tx_port_stats->tx_2048b_4095b_frames, 27435b53f8cSChandrakanth patil "Transmitted 2048b 4095b frames"); 27535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 27635b53f8cSChandrakanth patil "tx_4096b_9216b_frames", CTLFLAG_RD, 27735b53f8cSChandrakanth patil &softc->tx_port_stats->tx_4096b_9216b_frames, 27835b53f8cSChandrakanth patil "Transmitted 4096b 9216b frames"); 27935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 28035b53f8cSChandrakanth patil "tx_9217b_16383b_frames", CTLFLAG_RD, 28135b53f8cSChandrakanth patil &softc->tx_port_stats->tx_9217b_16383b_frames, 28235b53f8cSChandrakanth patil "Transmitted 9217b 16383b frames"); 28335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 28435b53f8cSChandrakanth patil "tx_good_frames", CTLFLAG_RD, 28535b53f8cSChandrakanth patil &softc->tx_port_stats->tx_good_frames, "Transmitted good frames"); 28635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 28735b53f8cSChandrakanth patil "tx_total_frames", CTLFLAG_RD, 28835b53f8cSChandrakanth patil &softc->tx_port_stats->tx_total_frames, "Transmitted total frames"); 28935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 29035b53f8cSChandrakanth patil "tx_ucast_frames", CTLFLAG_RD, 29135b53f8cSChandrakanth patil &softc->tx_port_stats->tx_ucast_frames, "Transmitted ucast frames"); 29235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 29335b53f8cSChandrakanth patil "tx_mcast_frames", CTLFLAG_RD, 29435b53f8cSChandrakanth patil &softc->tx_port_stats->tx_mcast_frames, "Transmitted mcast frames"); 29535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 29635b53f8cSChandrakanth patil "tx_bcast_frames", CTLFLAG_RD, 29735b53f8cSChandrakanth patil &softc->tx_port_stats->tx_bcast_frames, "Transmitted bcast frames"); 29835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 29935b53f8cSChandrakanth patil "tx_pause_frames", CTLFLAG_RD, 30035b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pause_frames, "Transmitted pause frames"); 30135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 30235b53f8cSChandrakanth patil "tx_pfc_frames", CTLFLAG_RD, 30335b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_frames, "Transmitted pfc frames"); 30435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 30535b53f8cSChandrakanth patil "tx_jabber_frames", CTLFLAG_RD, 30635b53f8cSChandrakanth patil &softc->tx_port_stats->tx_jabber_frames, "Transmitted jabber frames"); 30735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 30835b53f8cSChandrakanth patil "tx_fcs_err_frames", CTLFLAG_RD, 30935b53f8cSChandrakanth patil &softc->tx_port_stats->tx_fcs_err_frames, 31035b53f8cSChandrakanth patil "Transmitted fcs err frames"); 31135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 31235b53f8cSChandrakanth patil "tx_err", CTLFLAG_RD, 31335b53f8cSChandrakanth patil &softc->tx_port_stats->tx_err, "Transmitted err"); 31435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 31535b53f8cSChandrakanth patil "tx_fifo_underruns", CTLFLAG_RD, 31635b53f8cSChandrakanth patil &softc->tx_port_stats->tx_fifo_underruns, 31735b53f8cSChandrakanth patil "Transmitted fifo underruns"); 31835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 31935b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri0", CTLFLAG_RD, 32035b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri0, 32135b53f8cSChandrakanth patil "Transmitted pfc ena frames pri0"); 32235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 32335b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri1", CTLFLAG_RD, 32435b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri1, 32535b53f8cSChandrakanth patil "Transmitted pfc ena frames pri1"); 32635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 32735b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri2", CTLFLAG_RD, 32835b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri2, 32935b53f8cSChandrakanth patil "Transmitted pfc ena frames pri2"); 33035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 33135b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri3", CTLFLAG_RD, 33235b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri3, 33335b53f8cSChandrakanth patil "Transmitted pfc ena frames pri3"); 33435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 33535b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri4", CTLFLAG_RD, 33635b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri4, 33735b53f8cSChandrakanth patil "Transmitted pfc ena frames pri4"); 33835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 33935b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri5", CTLFLAG_RD, 34035b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri5, 34135b53f8cSChandrakanth patil "Transmitted pfc ena frames pri5"); 34235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 34335b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri6", CTLFLAG_RD, 34435b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri6, 34535b53f8cSChandrakanth patil "Transmitted pfc ena frames pri6"); 34635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 34735b53f8cSChandrakanth patil "tx_pfc_ena_frames_pri7", CTLFLAG_RD, 34835b53f8cSChandrakanth patil &softc->tx_port_stats->tx_pfc_ena_frames_pri7, 34935b53f8cSChandrakanth patil "Transmitted pfc ena frames pri7"); 35035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 35135b53f8cSChandrakanth patil "tx_eee_lpi_events", CTLFLAG_RD, 35235b53f8cSChandrakanth patil &softc->tx_port_stats->tx_eee_lpi_events, 35335b53f8cSChandrakanth patil "Transmitted eee lpi events"); 35435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 35535b53f8cSChandrakanth patil "tx_eee_lpi_duration", CTLFLAG_RD, 35635b53f8cSChandrakanth patil &softc->tx_port_stats->tx_eee_lpi_duration, 35735b53f8cSChandrakanth patil "Transmitted eee lpi duration"); 35835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 35935b53f8cSChandrakanth patil "tx_llfc_logical_msgs", CTLFLAG_RD, 36035b53f8cSChandrakanth patil &softc->tx_port_stats->tx_llfc_logical_msgs, 36135b53f8cSChandrakanth patil "Transmitted llfc logical msgs"); 36235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 36335b53f8cSChandrakanth patil "tx_hcfc_msgs", CTLFLAG_RD, 36435b53f8cSChandrakanth patil &softc->tx_port_stats->tx_hcfc_msgs, "Transmitted hcfc msgs"); 36535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 36635b53f8cSChandrakanth patil "tx_total_collisions", CTLFLAG_RD, 36735b53f8cSChandrakanth patil &softc->tx_port_stats->tx_total_collisions, 36835b53f8cSChandrakanth patil "Transmitted total collisions"); 36935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 37035b53f8cSChandrakanth patil "tx_bytes", CTLFLAG_RD, 37135b53f8cSChandrakanth patil &softc->tx_port_stats->tx_bytes, "Transmitted bytes"); 37235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 37335b53f8cSChandrakanth patil "tx_xthol_frames", CTLFLAG_RD, 37435b53f8cSChandrakanth patil &softc->tx_port_stats->tx_xthol_frames, "Transmitted xthol frames"); 37535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 37635b53f8cSChandrakanth patil "tx_stat_discard", CTLFLAG_RD, 37735b53f8cSChandrakanth patil &softc->tx_port_stats->tx_stat_discard, "Transmitted stat discard"); 37835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 37935b53f8cSChandrakanth patil "tx_stat_error", CTLFLAG_RD, 38035b53f8cSChandrakanth patil &softc->tx_port_stats->tx_stat_error, "Transmitted stat error"); 38135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 38235b53f8cSChandrakanth patil "rx_64b_frames", CTLFLAG_RD, 38335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_64b_frames, "Received 64b frames"); 38435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 38535b53f8cSChandrakanth patil "rx_65b_127b_frames", CTLFLAG_RD, 38635b53f8cSChandrakanth patil &softc->rx_port_stats->rx_65b_127b_frames, "Received 65b 127b frames"); 38735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 38835b53f8cSChandrakanth patil "rx_128b_255b_frames", CTLFLAG_RD, 38935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_128b_255b_frames, 39035b53f8cSChandrakanth patil "Received 128b 255b frames"); 39135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 39235b53f8cSChandrakanth patil "rx_256b_511b_frames", CTLFLAG_RD, 39335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_256b_511b_frames, 39435b53f8cSChandrakanth patil "Received 256b 511b frames"); 39535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 39635b53f8cSChandrakanth patil "rx_512b_1023b_frames", CTLFLAG_RD, 39735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_512b_1023b_frames, 39835b53f8cSChandrakanth patil "Received 512b 1023b frames"); 39935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 40035b53f8cSChandrakanth patil "rx_1024b_1518b_frames", CTLFLAG_RD, 40135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_1024b_1518b_frames, 40235b53f8cSChandrakanth patil "Received 1024b 1518 frames"); 40335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 40435b53f8cSChandrakanth patil "rx_good_vlan_frames", CTLFLAG_RD, 40535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_good_vlan_frames, 40635b53f8cSChandrakanth patil "Received good vlan frames"); 40735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 40835b53f8cSChandrakanth patil "rx_1519b_2047b_frames", CTLFLAG_RD, 40935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_1519b_2047b_frames, 41035b53f8cSChandrakanth patil "Received 1519b 2047b frames"); 41135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 41235b53f8cSChandrakanth patil "rx_2048b_4095b_frames", CTLFLAG_RD, 41335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_2048b_4095b_frames, 41435b53f8cSChandrakanth patil "Received 2048b 4095b frames"); 41535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 41635b53f8cSChandrakanth patil "rx_4096b_9216b_frames", CTLFLAG_RD, 41735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_4096b_9216b_frames, 41835b53f8cSChandrakanth patil "Received 4096b 9216b frames"); 41935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 42035b53f8cSChandrakanth patil "rx_9217b_16383b_frames", CTLFLAG_RD, 42135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_9217b_16383b_frames, 42235b53f8cSChandrakanth patil "Received 9217b 16383b frames"); 42335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 42435b53f8cSChandrakanth patil "rx_total_frames", CTLFLAG_RD, 42535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_total_frames, "Received total frames"); 42635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 42735b53f8cSChandrakanth patil "rx_ucast_frames", CTLFLAG_RD, 42835b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ucast_frames, "Received ucast frames"); 42935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 43035b53f8cSChandrakanth patil "rx_mcast_frames", CTLFLAG_RD, 43135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_mcast_frames, "Received mcast frames"); 43235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 43335b53f8cSChandrakanth patil "rx_bcast_frames", CTLFLAG_RD, 43435b53f8cSChandrakanth patil &softc->rx_port_stats->rx_bcast_frames, "Received bcast frames"); 43535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 43635b53f8cSChandrakanth patil "rx_fcs_err_frames", CTLFLAG_RD, 43735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_fcs_err_frames, "Received fcs err frames"); 43835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 43935b53f8cSChandrakanth patil "rx_ctrl_frames", CTLFLAG_RD, 44035b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ctrl_frames, "Received ctrl frames"); 44135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 44235b53f8cSChandrakanth patil "rx_pause_frames", CTLFLAG_RD, 44335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pause_frames, "Received pause frames"); 44435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 44535b53f8cSChandrakanth patil "rx_pfc_frames", CTLFLAG_RD, 44635b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_frames, "Received pfc frames"); 44735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 44835b53f8cSChandrakanth patil "rx_align_err_frames", CTLFLAG_RD, 44935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_align_err_frames, 45035b53f8cSChandrakanth patil "Received align err frames"); 45135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 45235b53f8cSChandrakanth patil "rx_ovrsz_frames", CTLFLAG_RD, 45335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_ovrsz_frames, 45435b53f8cSChandrakanth patil "Received ovrsz frames"); 45535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 45635b53f8cSChandrakanth patil "rx_jbr_frames", CTLFLAG_RD, 45735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_jbr_frames, 45835b53f8cSChandrakanth patil "Received jbr frames"); 45935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 46035b53f8cSChandrakanth patil "rx_mtu_err_frames", CTLFLAG_RD, 46135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_mtu_err_frames, 46235b53f8cSChandrakanth patil "Received mtu err frames"); 46335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 46435b53f8cSChandrakanth patil "rx_tagged_frames", CTLFLAG_RD, 46535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_tagged_frames, 46635b53f8cSChandrakanth patil "Received tagged frames"); 46735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 46835b53f8cSChandrakanth patil "rx_double_tagged_frames", CTLFLAG_RD, 46935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_double_tagged_frames, 47035b53f8cSChandrakanth patil "Received double tagged frames"); 47135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 47235b53f8cSChandrakanth patil "rx_good_frames", CTLFLAG_RD, 47335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_good_frames, 47435b53f8cSChandrakanth patil "Received good frames"); 47535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 47635b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri0", CTLFLAG_RD, 47735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri0, 47835b53f8cSChandrakanth patil "Received pfc ena frames pri0"); 47935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 48035b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri1", CTLFLAG_RD, 48135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri1, 48235b53f8cSChandrakanth patil "Received pfc ena frames pri1"); 48335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 48435b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri2", CTLFLAG_RD, 48535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri2, 48635b53f8cSChandrakanth patil "Received pfc ena frames pri2"); 48735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 48835b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri3", CTLFLAG_RD, 48935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri3, 49035b53f8cSChandrakanth patil "Received pfc ena frames pri3"); 49135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 49235b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri4", CTLFLAG_RD, 49335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri4, 49435b53f8cSChandrakanth patil "Received pfc ena frames pri4"); 49535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 49635b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri5", CTLFLAG_RD, 49735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri5, 49835b53f8cSChandrakanth patil "Received pfc ena frames pri5"); 49935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 50035b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri6", CTLFLAG_RD, 50135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri6, 50235b53f8cSChandrakanth patil "Received pfc ena frames pri6"); 50335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 50435b53f8cSChandrakanth patil "rx_pfc_ena_frames_pri7", CTLFLAG_RD, 50535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_pfc_ena_frames_pri7, 50635b53f8cSChandrakanth patil "Received pfc ena frames pri7"); 50735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 50835b53f8cSChandrakanth patil "rx_sch_crc_err_frames", CTLFLAG_RD, 50935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_sch_crc_err_frames, 51035b53f8cSChandrakanth patil "Received sch crc err frames"); 51135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 51235b53f8cSChandrakanth patil "rx_undrsz_frames", CTLFLAG_RD, 51335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_undrsz_frames, "Received undrsz frames"); 51435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 51535b53f8cSChandrakanth patil "rx_eee_lpi_events", CTLFLAG_RD, 51635b53f8cSChandrakanth patil &softc->rx_port_stats->rx_eee_lpi_events, "Received eee lpi events"); 51735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 51835b53f8cSChandrakanth patil "rx_eee_lpi_duration", CTLFLAG_RD, 51935b53f8cSChandrakanth patil &softc->rx_port_stats->rx_eee_lpi_duration, 52035b53f8cSChandrakanth patil "Received eee lpi duration"); 52135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 52235b53f8cSChandrakanth patil "rx_llfc_physical_msgs", CTLFLAG_RD, 52335b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_physical_msgs, 52435b53f8cSChandrakanth patil "Received llfc physical msgs"); 52535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 52635b53f8cSChandrakanth patil "rx_llfc_logical_msgs", CTLFLAG_RD, 52735b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_logical_msgs, 52835b53f8cSChandrakanth patil "Received llfc logical msgs"); 52935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 53035b53f8cSChandrakanth patil "rx_llfc_msgs_with_crc_err", CTLFLAG_RD, 53135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_llfc_msgs_with_crc_err, 53235b53f8cSChandrakanth patil "Received llfc msgs with crc err"); 53335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 53435b53f8cSChandrakanth patil "rx_hcfc_msgs", CTLFLAG_RD, 53535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_hcfc_msgs, "Received hcfc msgs"); 53635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 53735b53f8cSChandrakanth patil "rx_hcfc_msgs_with_crc_err", CTLFLAG_RD, 53835b53f8cSChandrakanth patil &softc->rx_port_stats->rx_hcfc_msgs_with_crc_err, 53935b53f8cSChandrakanth patil "Received hcfc msgs with crc err"); 54035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 54135b53f8cSChandrakanth patil "rx_bytes", CTLFLAG_RD, 54235b53f8cSChandrakanth patil &softc->rx_port_stats->rx_bytes, "Received bytes"); 54335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 54435b53f8cSChandrakanth patil "rx_runt_bytes", CTLFLAG_RD, 54535b53f8cSChandrakanth patil &softc->rx_port_stats->rx_runt_bytes, "Received runt bytes"); 54635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 54735b53f8cSChandrakanth patil "rx_runt_frames", CTLFLAG_RD, 54835b53f8cSChandrakanth patil &softc->rx_port_stats->rx_runt_frames, "Received runt frames"); 54935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 55035b53f8cSChandrakanth patil "rx_stat_discard", CTLFLAG_RD, 55135b53f8cSChandrakanth patil &softc->rx_port_stats->rx_stat_discard, "Received stat discard"); 55235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 55335b53f8cSChandrakanth patil "rx_stat_err", CTLFLAG_RD, 55435b53f8cSChandrakanth patil &softc->rx_port_stats->rx_stat_err, "Received stat err"); 55535b53f8cSChandrakanth patil 55635b53f8cSChandrakanth patil if (BNXT_CHIP_P5(softc) && 55735b53f8cSChandrakanth patil (softc->flags & BNXT_FLAG_FW_CAP_EXT_STATS)) { 55835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 55935b53f8cSChandrakanth patil "tx_bytes_cos0", CTLFLAG_RD, 56035b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos0, "Transmitted bytes count cos0"); 56135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 56235b53f8cSChandrakanth patil "tx_packets_cos0", CTLFLAG_RD, 56335b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos0, "Transmitted packets count cos0"); 56435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 56535b53f8cSChandrakanth patil "tx_bytes_cos1", CTLFLAG_RD, 56635b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos1, "Transmitted bytes count cos1"); 56735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 56835b53f8cSChandrakanth patil "tx_packets_cos1", CTLFLAG_RD, 56935b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos1, "Transmitted packets count cos1"); 57035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 57135b53f8cSChandrakanth patil "tx_bytes_cos2", CTLFLAG_RD, 57235b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos2, "Transmitted bytes count cos2"); 57335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 57435b53f8cSChandrakanth patil "tx_packets_cos2", CTLFLAG_RD, 57535b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos2, "Transmitted packets count cos2"); 57635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 57735b53f8cSChandrakanth patil "tx_bytes_cos3", CTLFLAG_RD, 57835b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos3, "Transmitted bytes count cos3"); 57935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 58035b53f8cSChandrakanth patil "tx_packets_cos3", CTLFLAG_RD, 58135b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos3, "Transmitted packets count cos3"); 58235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 58335b53f8cSChandrakanth patil "tx_bytes_cos4", CTLFLAG_RD, 58435b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos4, "Transmitted bytes count cos4"); 58535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 58635b53f8cSChandrakanth patil "tx_packets_cos4", CTLFLAG_RD, 58735b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos4, "Transmitted packets count cos4"); 58835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 58935b53f8cSChandrakanth patil "tx_bytes_cos5", CTLFLAG_RD, 59035b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos5, "Transmitted bytes count cos5"); 59135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 59235b53f8cSChandrakanth patil "tx_packets_cos5", CTLFLAG_RD, 59335b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos5, "Transmitted packets count cos5"); 59435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 59535b53f8cSChandrakanth patil "tx_bytes_cos6", CTLFLAG_RD, 59635b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos6, "Transmitted bytes count cos6"); 59735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 59835b53f8cSChandrakanth patil "tx_packets_cos6", CTLFLAG_RD, 59935b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos6, "Transmitted packets count cos6"); 60035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 60135b53f8cSChandrakanth patil "tx_bytes_cos7", CTLFLAG_RD, 60235b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_bytes_cos7, "Transmitted bytes count cos7"); 60335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 60435b53f8cSChandrakanth patil "tx_packets_cos7", CTLFLAG_RD, 60535b53f8cSChandrakanth patil &softc->tx_port_stats_ext->tx_packets_cos7, "Transmitted packets count cos7"); 60635b53f8cSChandrakanth patil 60735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 608032899b5SChandrakanth patil "tx_bytes_pri0", CTLFLAG_RD, 609032899b5SChandrakanth patil &softc->tx_bytes_pri[0], "Transmitted bytes count pri0"); 610032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 611032899b5SChandrakanth patil "tx_packets_pri0", CTLFLAG_RD, 612032899b5SChandrakanth patil &softc->tx_packets_pri[0], "Transmitted packets count pri0"); 613032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 614032899b5SChandrakanth patil "tx_bytes_pri1", CTLFLAG_RD, 615032899b5SChandrakanth patil &softc->tx_bytes_pri[1], "Transmitted bytes count pri1"); 616032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 617032899b5SChandrakanth patil "tx_packets_pri1", CTLFLAG_RD, 618032899b5SChandrakanth patil &softc->tx_packets_pri[1], "Transmitted packets count pri1"); 619032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 620032899b5SChandrakanth patil "tx_bytes_pri2", CTLFLAG_RD, 621032899b5SChandrakanth patil &softc->tx_bytes_pri[2], "Transmitted bytes count pri2"); 622032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 623032899b5SChandrakanth patil "tx_packets_pri2", CTLFLAG_RD, 624032899b5SChandrakanth patil &softc->tx_packets_pri[2], "Transmitted packets count pri2"); 625032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 626032899b5SChandrakanth patil "tx_bytes_pri3", CTLFLAG_RD, 627032899b5SChandrakanth patil &softc->tx_bytes_pri[3], "Transmitted bytes count pri3"); 628032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 629032899b5SChandrakanth patil "tx_packets_pri3", CTLFLAG_RD, 630032899b5SChandrakanth patil &softc->tx_packets_pri[3], "Transmitted packets count pri3"); 631032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 632032899b5SChandrakanth patil "tx_bytes_pri4", CTLFLAG_RD, 633032899b5SChandrakanth patil &softc->tx_bytes_pri[4], "Transmitted bytes count pri4"); 634032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 635032899b5SChandrakanth patil "tx_packets_pri4", CTLFLAG_RD, 636032899b5SChandrakanth patil &softc->tx_packets_pri[4], "Transmitted packets count pri4"); 637032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 638032899b5SChandrakanth patil "tx_bytes_pri5", CTLFLAG_RD, 639032899b5SChandrakanth patil &softc->tx_bytes_pri[5], "Transmitted bytes count pri5"); 640032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 641032899b5SChandrakanth patil "tx_packets_pri5", CTLFLAG_RD, 642032899b5SChandrakanth patil &softc->tx_packets_pri[5], "Transmitted packets count pri5"); 643032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 644032899b5SChandrakanth patil "tx_bytes_pri6", CTLFLAG_RD, 645032899b5SChandrakanth patil &softc->tx_bytes_pri[6], "Transmitted bytes count pri6"); 646032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 647032899b5SChandrakanth patil "tx_packets_pri6", CTLFLAG_RD, 648032899b5SChandrakanth patil &softc->tx_packets_pri[6], "Transmitted packets count pri6"); 649032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 650032899b5SChandrakanth patil "tx_bytes_pri7", CTLFLAG_RD, 651032899b5SChandrakanth patil &softc->tx_bytes_pri[7], "Transmitted bytes count pri7"); 652032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 653032899b5SChandrakanth patil "tx_packets_pri7", CTLFLAG_RD, 654032899b5SChandrakanth patil &softc->tx_packets_pri[7], "Transmitted packets count pri7"); 655032899b5SChandrakanth patil 656032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 65735b53f8cSChandrakanth patil "pfc_pri0_tx_duration_us", CTLFLAG_RD, 65835b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri0_tx_duration_us, "Time duration between" 65935b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri0"); 66035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 66135b53f8cSChandrakanth patil "pfc_pri0_tx_transitions", CTLFLAG_RD, 66235b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri0_tx_transitions, "Num times transition" 66335b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 66435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 66535b53f8cSChandrakanth patil "pfc_pri1_tx_duration_us", CTLFLAG_RD, 66635b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri1_tx_duration_us, "Time duration between" 66735b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri1"); 66835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 66935b53f8cSChandrakanth patil "pfc_pri1_tx_transitions", CTLFLAG_RD, 67035b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri1_tx_transitions, "Num times transition" 67135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 67235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 67335b53f8cSChandrakanth patil "pfc_pri2_tx_duration_us", CTLFLAG_RD, 67435b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri2_tx_duration_us, "Time duration between" 67535b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri2"); 67635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 67735b53f8cSChandrakanth patil "pfc_pri2_tx_transitions", CTLFLAG_RD, 67835b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri2_tx_transitions, "Num times transition" 67935b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 68035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 68135b53f8cSChandrakanth patil "pfc_pri3_tx_duration_us", CTLFLAG_RD, 68235b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri3_tx_duration_us, "Time duration between" 68335b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri3"); 68435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 68535b53f8cSChandrakanth patil "pfc_pri3_tx_transitions", CTLFLAG_RD, 68635b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri3_tx_transitions, "Num times transition" 68735b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 68835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 68935b53f8cSChandrakanth patil "pfc_pri4_tx_duration_us", CTLFLAG_RD, 69035b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri4_tx_duration_us, "Time duration between" 69135b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri4"); 69235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 69335b53f8cSChandrakanth patil "pfc_pri4_tx_transitions", CTLFLAG_RD, 69435b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri4_tx_transitions, "Num times transition" 69535b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 69635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 69735b53f8cSChandrakanth patil "pfc_pri5_tx_duration_us", CTLFLAG_RD, 69835b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri5_tx_duration_us, "Time duration between" 69935b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri5"); 70035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 70135b53f8cSChandrakanth patil "pfc_pri5_tx_transitions", CTLFLAG_RD, 70235b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri5_tx_transitions, "Num times transition" 70335b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 70435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 70535b53f8cSChandrakanth patil "pfc_pri6_tx_duration_us", CTLFLAG_RD, 70635b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri6_tx_duration_us, "Time duration between" 70735b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri6"); 70835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 70935b53f8cSChandrakanth patil "pfc_pri6_tx_transitions", CTLFLAG_RD, 71035b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri6_tx_transitions, "Num times transition" 71135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 71235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 71335b53f8cSChandrakanth patil "pfc_pri7_tx_duration_us", CTLFLAG_RD, 71435b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri7_tx_duration_us, "Time duration between" 71535b53f8cSChandrakanth patil "XON to XOFF and XOFF to XON for pri7"); 71635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 71735b53f8cSChandrakanth patil "pfc_pri7_tx_transitions", CTLFLAG_RD, 71835b53f8cSChandrakanth patil &softc->tx_port_stats_ext->pfc_pri7_tx_transitions, "Num times transition" 71935b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 72035b53f8cSChandrakanth patil 72135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 72235b53f8cSChandrakanth patil "link_down_events", CTLFLAG_RD, 72335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->link_down_events, "Num times link states down"); 72435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 72535b53f8cSChandrakanth patil "continuous_pause_events", CTLFLAG_RD, 72635b53f8cSChandrakanth patil &softc->rx_port_stats_ext->continuous_pause_events, "Num times pause events"); 72735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 72835b53f8cSChandrakanth patil "resume_pause_events", CTLFLAG_RD, 72935b53f8cSChandrakanth patil &softc->rx_port_stats_ext->resume_pause_events, "Num times pause events" 73035b53f8cSChandrakanth patil "resumes"); 73135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 73235b53f8cSChandrakanth patil "continuous_roce_pause_events", CTLFLAG_RD, 73335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->continuous_roce_pause_events, "Num times roce" 73435b53f8cSChandrakanth patil "pause events"); 73535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 73635b53f8cSChandrakanth patil "resume_roce_pause_events", CTLFLAG_RD, 73735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->resume_roce_pause_events, "Num times roce pause" 73835b53f8cSChandrakanth patil "events resumes"); 73935b53f8cSChandrakanth patil 74035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 74135b53f8cSChandrakanth patil "rx_bytes_cos0", CTLFLAG_RD, 74235b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos0, "Received bytes count cos0"); 74335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 74435b53f8cSChandrakanth patil "rx_packets_cos0", CTLFLAG_RD, 74535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos0, "Received packets count cos0"); 74635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 74735b53f8cSChandrakanth patil "rx_bytes_cos1", CTLFLAG_RD, 74835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos1, "Received bytes count cos1"); 74935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 75035b53f8cSChandrakanth patil "rx_packets_cos1", CTLFLAG_RD, 75135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos1, "Received packets count cos1"); 75235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 75335b53f8cSChandrakanth patil "rx_bytes_cos2", CTLFLAG_RD, 75435b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos2, "Received bytes count cos2"); 75535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 75635b53f8cSChandrakanth patil "rx_packets_cos2", CTLFLAG_RD, 75735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos2, "Received packets count cos2"); 75835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 75935b53f8cSChandrakanth patil "rx_bytes_cos3", CTLFLAG_RD, 76035b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos3, "Received bytes count cos3"); 76135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 76235b53f8cSChandrakanth patil "rx_packets_cos3", CTLFLAG_RD, 76335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos3, "Received packets count cos3"); 76435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 76535b53f8cSChandrakanth patil "rx_bytes_cos4", CTLFLAG_RD, 76635b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos4, "Received bytes count cos4"); 76735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 76835b53f8cSChandrakanth patil "rx_packets_cos4", CTLFLAG_RD, 76935b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos4, "Received packets count cos4"); 77035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 77135b53f8cSChandrakanth patil "rx_bytes_cos5", CTLFLAG_RD, 77235b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos5, "Received bytes count cos5"); 77335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 77435b53f8cSChandrakanth patil "rx_packets_cos5", CTLFLAG_RD, 77535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos5, "Received packets count cos5"); 77635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 77735b53f8cSChandrakanth patil "rx_bytes_cos6", CTLFLAG_RD, 77835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos6, "Received bytes count cos6"); 77935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 78035b53f8cSChandrakanth patil "rx_packets_cos6", CTLFLAG_RD, 78135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos6, "Received packets count cos6"); 78235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 78335b53f8cSChandrakanth patil "rx_bytes_cos7", CTLFLAG_RD, 78435b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bytes_cos7, "Received bytes count cos7"); 78535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 78635b53f8cSChandrakanth patil "rx_packets_cos7", CTLFLAG_RD, 78735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_packets_cos7, "Received packets count cos7"); 78835b53f8cSChandrakanth patil 78935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 790032899b5SChandrakanth patil "rx_bytes_pri0", CTLFLAG_RD, 791032899b5SChandrakanth patil &softc->rx_bytes_pri[0], "Received bytes count pri0"); 792032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 793032899b5SChandrakanth patil "rx_packets_pri0", CTLFLAG_RD, 794032899b5SChandrakanth patil &softc->rx_packets_pri[0], "Received packets count pri0"); 795032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 796032899b5SChandrakanth patil "rx_bytes_pri1", CTLFLAG_RD, 797032899b5SChandrakanth patil &softc->rx_bytes_pri[1], "Received bytes count pri1"); 798032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 799032899b5SChandrakanth patil "rx_packets_pri1", CTLFLAG_RD, 800032899b5SChandrakanth patil &softc->rx_packets_pri[1], "Received packets count pri1"); 801032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 802032899b5SChandrakanth patil "rx_bytes_pri2", CTLFLAG_RD, 803032899b5SChandrakanth patil &softc->rx_bytes_pri[2], "Received bytes count pri2"); 804032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 805032899b5SChandrakanth patil "rx_packets_pri2", CTLFLAG_RD, 806032899b5SChandrakanth patil &softc->rx_packets_pri[2], "Received packets count pri2"); 807032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 808032899b5SChandrakanth patil "rx_bytes_pri3", CTLFLAG_RD, 809032899b5SChandrakanth patil &softc->rx_bytes_pri[3], "Received bytes count pri3"); 810032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 811032899b5SChandrakanth patil "rx_packets_pri3", CTLFLAG_RD, 812032899b5SChandrakanth patil &softc->rx_packets_pri[3], "Received packets count pri3"); 813032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 814032899b5SChandrakanth patil "rx_bytes_pri4", CTLFLAG_RD, 815032899b5SChandrakanth patil &softc->rx_bytes_pri[4], "Received bytes count pri4"); 816032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 817032899b5SChandrakanth patil "rx_packets_pri4", CTLFLAG_RD, 818032899b5SChandrakanth patil &softc->rx_packets_pri[4], "Received packets count pri4"); 819032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 820032899b5SChandrakanth patil "rx_bytes_pri5", CTLFLAG_RD, 821032899b5SChandrakanth patil &softc->rx_bytes_pri[5], "Received bytes count pri5"); 822032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 823032899b5SChandrakanth patil "rx_packets_pri5", CTLFLAG_RD, 824032899b5SChandrakanth patil &softc->rx_packets_pri[5], "Received packets count pri5"); 825032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 826032899b5SChandrakanth patil "rx_bytes_pri6", CTLFLAG_RD, 827032899b5SChandrakanth patil &softc->rx_bytes_pri[6], "Received bytes count pri6"); 828032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 829032899b5SChandrakanth patil "rx_packets_pri6", CTLFLAG_RD, 830032899b5SChandrakanth patil &softc->rx_packets_pri[6], "Received packets count pri6"); 831032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 832032899b5SChandrakanth patil "rx_bytes_pri7", CTLFLAG_RD, 833032899b5SChandrakanth patil &softc->rx_bytes_pri[7], "Received bytes count pri7"); 834032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 835032899b5SChandrakanth patil "rx_packets_pri7", CTLFLAG_RD, 836032899b5SChandrakanth patil &softc->rx_packets_pri[7], "Received packets count pri7"); 837032899b5SChandrakanth patil 838032899b5SChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 83935b53f8cSChandrakanth patil "pfc_pri0_rx_duration_us", CTLFLAG_RD, 84035b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri0_rx_duration_us, "Time duration in receiving" 84135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 84235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 84335b53f8cSChandrakanth patil "pfc_pri0_rx_transitions", CTLFLAG_RD, 84435b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri0_rx_transitions, "Num times rx transition" 84535b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri0"); 84635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 84735b53f8cSChandrakanth patil "pfc_pri1_rx_duration_us", CTLFLAG_RD, 84835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri1_rx_duration_us, "Time duration in receiving" 84935b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 85035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 85135b53f8cSChandrakanth patil "pfc_pri1_rx_transitions", CTLFLAG_RD, 85235b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri1_rx_transitions, "Num times rx transition" 85335b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri1"); 85435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 85535b53f8cSChandrakanth patil "pfc_pri2_rx_duration_us", CTLFLAG_RD, 85635b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri2_rx_duration_us, "Time duration in receiving" 85735b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 85835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 85935b53f8cSChandrakanth patil "pfc_pri2_rx_transitions", CTLFLAG_RD, 86035b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri2_rx_transitions, "Num times rx transition" 86135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri2"); 86235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 86335b53f8cSChandrakanth patil "pfc_pri3_rx_duration_us", CTLFLAG_RD, 86435b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri3_rx_duration_us, "Time duration in receiving" 86535b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 86635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 86735b53f8cSChandrakanth patil "pfc_pri3_rx_transitions", CTLFLAG_RD, 86835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri3_rx_transitions, "Num times rx transition" 86935b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri3"); 87035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 87135b53f8cSChandrakanth patil "pfc_pri4_rx_duration_us", CTLFLAG_RD, 87235b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri4_rx_duration_us, "Time duration in receiving" 87335b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 87435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 87535b53f8cSChandrakanth patil "pfc_pri4_rx_transitions", CTLFLAG_RD, 87635b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri4_rx_transitions, "Num times rx transition" 87735b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri4"); 87835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 87935b53f8cSChandrakanth patil "pfc_pri5_rx_duration_us", CTLFLAG_RD, 88035b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri5_rx_duration_us, "Time duration in receiving" 88135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 88235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 88335b53f8cSChandrakanth patil "pfc_pri5_rx_transitions", CTLFLAG_RD, 88435b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri5_rx_transitions, "Num times rx transition" 88535b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri5"); 88635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 88735b53f8cSChandrakanth patil "pfc_pri6_rx_duration_us", CTLFLAG_RD, 88835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri6_rx_duration_us, "Time duration in receiving" 88935b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 89035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 89135b53f8cSChandrakanth patil "pfc_pri6_rx_transitions", CTLFLAG_RD, 89235b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri6_rx_transitions, "Num times rx transition" 89335b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri6"); 89435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 89535b53f8cSChandrakanth patil "pfc_pri7_rx_duration_us", CTLFLAG_RD, 89635b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri7_rx_duration_us, "Time duration in receiving" 89735b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 89835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 89935b53f8cSChandrakanth patil "pfc_pri7_rx_transitions", CTLFLAG_RD, 90035b53f8cSChandrakanth patil &softc->rx_port_stats_ext->pfc_pri7_rx_transitions, "Num times rx transition" 90135b53f8cSChandrakanth patil "between XON to XOFF and XOFF to XON for pri7"); 90235b53f8cSChandrakanth patil 90335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 90435b53f8cSChandrakanth patil "rx_bits", CTLFLAG_RD, 90535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_bits, "total number of received bits"); 90635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 90735b53f8cSChandrakanth patil "rx_buffer_passed_threshold", CTLFLAG_RD, 90835b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_buffer_passed_threshold, "num of events port" 90935b53f8cSChandrakanth patil "buffer" 91035b53f8cSChandrakanth patil "was over 85%"); 91135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 91235b53f8cSChandrakanth patil "rx_pcs_symbol_err", CTLFLAG_RD, 91335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_pcs_symbol_err, "num of symbol errors wasn't" 91435b53f8cSChandrakanth patil "corrected by FEC"); 91535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 91635b53f8cSChandrakanth patil "rx_corrected_bits", CTLFLAG_RD, 91735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_corrected_bits, "num of bits corrected by FEC"); 91835b53f8cSChandrakanth patil 91935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 92035b53f8cSChandrakanth patil "rx_discard_bytes_cos0", CTLFLAG_RD, 92135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos0, "num of rx discard bytes" 92235b53f8cSChandrakanth patil "count on cos0"); 92335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 92435b53f8cSChandrakanth patil "rx_discard_packets_cos0", CTLFLAG_RD, 92535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos0, "num of rx discard packets" 92635b53f8cSChandrakanth patil "count on cos0"); 92735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 92835b53f8cSChandrakanth patil "rx_discard_bytes_cos1", CTLFLAG_RD, 92935b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos1, "num of rx discard bytes" 93035b53f8cSChandrakanth patil "count on cos1"); 93135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 93235b53f8cSChandrakanth patil "rx_discard_packets_cos1", CTLFLAG_RD, 93335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos1, "num of rx discard packets" 93435b53f8cSChandrakanth patil "count on cos1"); 93535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 93635b53f8cSChandrakanth patil "rx_discard_bytes_cos2", CTLFLAG_RD, 93735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos2, "num of rx discard bytes" 93835b53f8cSChandrakanth patil "count on cos2"); 93935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 94035b53f8cSChandrakanth patil "rx_discard_packets_cos2", CTLFLAG_RD, 94135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos2, "num of rx discard packets" 94235b53f8cSChandrakanth patil "count on cos2"); 94335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 94435b53f8cSChandrakanth patil "rx_discard_bytes_cos3", CTLFLAG_RD, 94535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos3, "num of rx discard bytes" 94635b53f8cSChandrakanth patil "count on cos3"); 94735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 94835b53f8cSChandrakanth patil "rx_discard_packets_cos3", CTLFLAG_RD, 94935b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos3, "num of rx discard packets" 95035b53f8cSChandrakanth patil "count on cos3"); 95135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 95235b53f8cSChandrakanth patil "rx_discard_bytes_cos4", CTLFLAG_RD, 95335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos4, "num of rx discard bytes" 95435b53f8cSChandrakanth patil "count on cos4"); 95535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 95635b53f8cSChandrakanth patil "rx_discard_packets_cos4", CTLFLAG_RD, 95735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos4, "num of rx discard packets" 95835b53f8cSChandrakanth patil "count on cos4"); 95935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 96035b53f8cSChandrakanth patil "rx_discard_bytes_cos5", CTLFLAG_RD, 96135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos5, "num of rx discard bytes" 96235b53f8cSChandrakanth patil "count on cos5"); 96335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 96435b53f8cSChandrakanth patil "rx_discard_packets_cos5", CTLFLAG_RD, 96535b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos5, "num of rx discard packets" 96635b53f8cSChandrakanth patil "count on cos5"); 96735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 96835b53f8cSChandrakanth patil "rx_discard_bytes_cos6", CTLFLAG_RD, 96935b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos6, "num of rx discard bytes" 97035b53f8cSChandrakanth patil "count on cos6"); 97135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 97235b53f8cSChandrakanth patil "rx_discard_packets_cos6", CTLFLAG_RD, 97335b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos6, "num of rx discard packets" 97435b53f8cSChandrakanth patil "count on cos6"); 97535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 97635b53f8cSChandrakanth patil "rx_discard_bytes_cos7", CTLFLAG_RD, 97735b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_bytes_cos7, "num of rx discard bytes" 97835b53f8cSChandrakanth patil "count on cos7"); 97935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 98035b53f8cSChandrakanth patil "rx_discard_packets_cos7", CTLFLAG_RD, 98135b53f8cSChandrakanth patil &softc->rx_port_stats_ext->rx_discard_packets_cos7, "num of rx discard packets" 98235b53f8cSChandrakanth patil "count on cos7"); 98335b53f8cSChandrakanth patil } 98435b53f8cSChandrakanth patil 98535b53f8cSChandrakanth patil 98635b53f8cSChandrakanth patil return 0; 98735b53f8cSChandrakanth patil } 98835b53f8cSChandrakanth patil 98935b53f8cSChandrakanth patil int 99035b53f8cSChandrakanth patil bnxt_create_rx_sysctls(struct bnxt_softc *softc, int rxr) 99135b53f8cSChandrakanth patil { 99235b53f8cSChandrakanth patil struct sysctl_oid *oid; 99335b53f8cSChandrakanth patil struct ctx_hw_stats *rx_stats = (void *)softc->rx_stats[rxr].idi_vaddr; 99435b53f8cSChandrakanth patil char name[32]; 99535b53f8cSChandrakanth patil char desc[64]; 99635b53f8cSChandrakanth patil 99735b53f8cSChandrakanth patil sprintf(name, "rxq%d", rxr); 99835b53f8cSChandrakanth patil sprintf(desc, "receive queue %d", rxr); 99935b53f8cSChandrakanth patil oid = SYSCTL_ADD_NODE(&softc->hw_stats, 100035b53f8cSChandrakanth patil SYSCTL_CHILDREN(softc->hw_stats_oid), OID_AUTO, name, 100135b53f8cSChandrakanth patil CTLFLAG_RD | CTLFLAG_MPSAFE, 0, desc); 100235b53f8cSChandrakanth patil if (!oid) 100335b53f8cSChandrakanth patil return ENOMEM; 100435b53f8cSChandrakanth patil 100535b53f8cSChandrakanth patil if (BNXT_CHIP_P5(softc)) 100635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 100735b53f8cSChandrakanth patil "nq_num_ints", CTLFLAG_RD, &softc->nq_rings[rxr].int_count, 100835b53f8cSChandrakanth patil "Num Interrupts"); 100935b53f8cSChandrakanth patil else 101035b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 101135b53f8cSChandrakanth patil "rq_num_ints", CTLFLAG_RD, &softc->rx_cp_rings[rxr].int_count, 101235b53f8cSChandrakanth patil "Num Interrupts"); 101335b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 101435b53f8cSChandrakanth patil "ucast_pkts", CTLFLAG_RD, &rx_stats->rx_ucast_pkts, 101535b53f8cSChandrakanth patil "unicast packets received"); 101635b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 101735b53f8cSChandrakanth patil "mcast_pkts", CTLFLAG_RD, &rx_stats->rx_mcast_pkts, 101835b53f8cSChandrakanth patil "multicast packets received"); 101935b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 102035b53f8cSChandrakanth patil "bcast_pkts", CTLFLAG_RD, &rx_stats->rx_bcast_pkts, 102135b53f8cSChandrakanth patil "broadcast packets received"); 102235b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 102335b53f8cSChandrakanth patil "discard_pkts", CTLFLAG_RD, 102435b53f8cSChandrakanth patil &rx_stats->rx_discard_pkts, "discarded receive packets"); 102535b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 102635b53f8cSChandrakanth patil "error_pkts", CTLFLAG_RD, &rx_stats->rx_error_pkts, 102735b53f8cSChandrakanth patil "Error receive packets"); 102835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 102935b53f8cSChandrakanth patil "ucast_bytes", CTLFLAG_RD, &rx_stats->rx_ucast_bytes, 103035b53f8cSChandrakanth patil "unicast bytes received"); 103135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 103235b53f8cSChandrakanth patil "mcast_bytes", CTLFLAG_RD, &rx_stats->rx_mcast_bytes, 103335b53f8cSChandrakanth patil "multicast bytes received"); 103435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 103535b53f8cSChandrakanth patil "bcast_bytes", CTLFLAG_RD, &rx_stats->rx_bcast_bytes, 103635b53f8cSChandrakanth patil "broadcast bytes received"); 103735b53f8cSChandrakanth patil 103835b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 103935b53f8cSChandrakanth patil "tpa_pkts", CTLFLAG_RD, &rx_stats->tpa_pkts, 104035b53f8cSChandrakanth patil "TPA packets"); 104135b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 104235b53f8cSChandrakanth patil "tpa_bytes", CTLFLAG_RD, &rx_stats->tpa_bytes, 104335b53f8cSChandrakanth patil "TPA bytes"); 104435b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 104535b53f8cSChandrakanth patil "tpa_events", CTLFLAG_RD, &rx_stats->tpa_events, 104635b53f8cSChandrakanth patil "TPA events"); 104735b53f8cSChandrakanth patil SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO, 104835b53f8cSChandrakanth patil "tpa_aborts", CTLFLAG_RD, &rx_stats->tpa_aborts, 104935b53f8cSChandrakanth patil "TPA aborts"); 105035b53f8cSChandrakanth patil 105135b53f8cSChandrakanth patil return 0; 105235b53f8cSChandrakanth patil } 105335b53f8cSChandrakanth patil 105435b53f8cSChandrakanth patil static char *bnxt_chip_type[] = { 105535b53f8cSChandrakanth patil "ASIC", 105635b53f8cSChandrakanth patil "FPGA", 105735b53f8cSChandrakanth patil "Palladium", 105835b53f8cSChandrakanth patil "Unknown" 105935b53f8cSChandrakanth patil }; 106035b53f8cSChandrakanth patil #define MAX_CHIP_TYPE 3 106135b53f8cSChandrakanth patil 106235b53f8cSChandrakanth patil static char *bnxt_parse_pkglog(int desired_field, uint8_t *data, size_t datalen) 106335b53f8cSChandrakanth patil { 106435b53f8cSChandrakanth patil char *retval = NULL; 106535b53f8cSChandrakanth patil char *p; 106635b53f8cSChandrakanth patil char *value; 106735b53f8cSChandrakanth patil int field = 0; 106835b53f8cSChandrakanth patil 106935b53f8cSChandrakanth patil if (datalen < 1) 107035b53f8cSChandrakanth patil return NULL; 107135b53f8cSChandrakanth patil /* null-terminate the log data (removing last '\n'): */ 107235b53f8cSChandrakanth patil data[datalen - 1] = 0; 107335b53f8cSChandrakanth patil for (p = data; *p != 0; p++) { 107435b53f8cSChandrakanth patil field = 0; 107535b53f8cSChandrakanth patil retval = NULL; 107635b53f8cSChandrakanth patil while (*p != 0 && *p != '\n') { 107735b53f8cSChandrakanth patil value = p; 107835b53f8cSChandrakanth patil while (*p != 0 && *p != '\t' && *p != '\n') 107935b53f8cSChandrakanth patil p++; 108035b53f8cSChandrakanth patil if (field == desired_field) 108135b53f8cSChandrakanth patil retval = value; 108235b53f8cSChandrakanth patil if (*p != '\t') 108335b53f8cSChandrakanth patil break; 108435b53f8cSChandrakanth patil *p = 0; 108535b53f8cSChandrakanth patil field++; 108635b53f8cSChandrakanth patil p++; 108735b53f8cSChandrakanth patil } 108835b53f8cSChandrakanth patil if (*p == 0) 108935b53f8cSChandrakanth patil break; 109035b53f8cSChandrakanth patil *p = 0; 109135b53f8cSChandrakanth patil } 109235b53f8cSChandrakanth patil return retval; 109335b53f8cSChandrakanth patil } 109435b53f8cSChandrakanth patil 109535b53f8cSChandrakanth patil static int 109635b53f8cSChandrakanth patil bnxt_package_ver_sysctl(SYSCTL_HANDLER_ARGS) 109735b53f8cSChandrakanth patil { 109835b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 109935b53f8cSChandrakanth patil struct iflib_dma_info dma_data; 110035b53f8cSChandrakanth patil char *pkglog = NULL; 110135b53f8cSChandrakanth patil char *p; 110235b53f8cSChandrakanth patil char unk[] = "<unknown>"; 110335b53f8cSChandrakanth patil char *buf = unk; 110435b53f8cSChandrakanth patil int rc; 110535b53f8cSChandrakanth patil uint16_t ordinal = BNX_DIR_ORDINAL_FIRST; 110635b53f8cSChandrakanth patil uint16_t index; 110735b53f8cSChandrakanth patil uint32_t data_len; 110835b53f8cSChandrakanth patil 110935b53f8cSChandrakanth patil rc = bnxt_hwrm_nvm_find_dir_entry(softc, BNX_DIR_TYPE_PKG_LOG, 111035b53f8cSChandrakanth patil &ordinal, BNX_DIR_EXT_NONE, &index, false, 111135b53f8cSChandrakanth patil HWRM_NVM_FIND_DIR_ENTRY_INPUT_OPT_ORDINAL_EQ, 111235b53f8cSChandrakanth patil &data_len, NULL, NULL); 111335b53f8cSChandrakanth patil dma_data.idi_vaddr = NULL; 111435b53f8cSChandrakanth patil if (rc == 0 && data_len) { 111535b53f8cSChandrakanth patil rc = iflib_dma_alloc(softc->ctx, data_len, &dma_data, 111635b53f8cSChandrakanth patil BUS_DMA_NOWAIT); 111735b53f8cSChandrakanth patil if (rc == 0) { 111835b53f8cSChandrakanth patil rc = bnxt_hwrm_nvm_read(softc, index, 0, data_len, 111935b53f8cSChandrakanth patil &dma_data); 112035b53f8cSChandrakanth patil if (rc == 0) { 112135b53f8cSChandrakanth patil pkglog = dma_data.idi_vaddr; 112235b53f8cSChandrakanth patil p = bnxt_parse_pkglog(BNX_PKG_LOG_FIELD_IDX_PKG_VERSION, pkglog, data_len); 112335b53f8cSChandrakanth patil if (p && *p != 0 && isdigit(*p)) 112435b53f8cSChandrakanth patil buf = p; 112535b53f8cSChandrakanth patil } 112635b53f8cSChandrakanth patil } else 112735b53f8cSChandrakanth patil dma_data.idi_vaddr = NULL; 112835b53f8cSChandrakanth patil } 112935b53f8cSChandrakanth patil 113035b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, 0, req); 113135b53f8cSChandrakanth patil if (dma_data.idi_vaddr) 113235b53f8cSChandrakanth patil iflib_dma_free(&dma_data); 113335b53f8cSChandrakanth patil return rc; 113435b53f8cSChandrakanth patil } 113535b53f8cSChandrakanth patil 113635b53f8cSChandrakanth patil static int 113735b53f8cSChandrakanth patil bnxt_hwrm_min_ver_sysctl(SYSCTL_HANDLER_ARGS) 113835b53f8cSChandrakanth patil { 113935b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 114035b53f8cSChandrakanth patil char buf[16]; 114135b53f8cSChandrakanth patil uint8_t newver[3]; 114235b53f8cSChandrakanth patil int rc; 114335b53f8cSChandrakanth patil 114435b53f8cSChandrakanth patil sprintf(buf, "%hhu.%hhu.%hhu", softc->ver_info->hwrm_min_major, 114535b53f8cSChandrakanth patil softc->ver_info->hwrm_min_minor, softc->ver_info->hwrm_min_update); 114635b53f8cSChandrakanth patil 114735b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 114835b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 114935b53f8cSChandrakanth patil return rc; 115035b53f8cSChandrakanth patil if (sscanf(buf, "%hhu.%hhu.%hhu%*c", &newver[0], &newver[1], 115135b53f8cSChandrakanth patil &newver[2]) != 3) 115235b53f8cSChandrakanth patil return EINVAL; 115335b53f8cSChandrakanth patil softc->ver_info->hwrm_min_major = newver[0]; 115435b53f8cSChandrakanth patil softc->ver_info->hwrm_min_minor = newver[1]; 115535b53f8cSChandrakanth patil softc->ver_info->hwrm_min_update = newver[2]; 115635b53f8cSChandrakanth patil bnxt_check_hwrm_version(softc); 115735b53f8cSChandrakanth patil 115835b53f8cSChandrakanth patil return rc; 115935b53f8cSChandrakanth patil } 116035b53f8cSChandrakanth patil 116135b53f8cSChandrakanth patil int 116235b53f8cSChandrakanth patil bnxt_create_ver_sysctls(struct bnxt_softc *softc) 116335b53f8cSChandrakanth patil { 116435b53f8cSChandrakanth patil struct bnxt_ver_info *vi = softc->ver_info; 116535b53f8cSChandrakanth patil struct sysctl_oid *oid = vi->ver_oid; 116635b53f8cSChandrakanth patil 116735b53f8cSChandrakanth patil if (!oid) 116835b53f8cSChandrakanth patil return ENOMEM; 116935b53f8cSChandrakanth patil 117035b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 117135b53f8cSChandrakanth patil "hwrm_if", CTLFLAG_RD, vi->hwrm_if_ver, 0, 117235b53f8cSChandrakanth patil "HWRM interface version"); 117335b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 117435b53f8cSChandrakanth patil "driver_hwrm_if", CTLFLAG_RD, vi->driver_hwrm_if_ver, 0, 117535b53f8cSChandrakanth patil "HWRM firmware version"); 117635b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 117735b53f8cSChandrakanth patil "mgmt_fw", CTLFLAG_RD, vi->mgmt_fw_ver, 0, 117835b53f8cSChandrakanth patil "management firmware version"); 117935b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 118035b53f8cSChandrakanth patil "netctrl_fw", CTLFLAG_RD, vi->netctrl_fw_ver, 0, 118135b53f8cSChandrakanth patil "network control firmware version"); 118235b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 118335b53f8cSChandrakanth patil "roce_fw", CTLFLAG_RD, vi->roce_fw_ver, 0, 118435b53f8cSChandrakanth patil "RoCE firmware version"); 118535b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 118635b53f8cSChandrakanth patil "fw_ver", CTLFLAG_RD, vi->fw_ver_str, 0, 118735b53f8cSChandrakanth patil "Firmware version"); 118835b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 118935b53f8cSChandrakanth patil "phy", CTLFLAG_RD, vi->phy_ver, 0, 119035b53f8cSChandrakanth patil "PHY version"); 119135b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 119235b53f8cSChandrakanth patil "hwrm_fw_name", CTLFLAG_RD, vi->hwrm_fw_name, 0, 119335b53f8cSChandrakanth patil "HWRM firmware name"); 119435b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 119535b53f8cSChandrakanth patil "mgmt_fw_name", CTLFLAG_RD, vi->mgmt_fw_name, 0, 119635b53f8cSChandrakanth patil "management firmware name"); 119735b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 119835b53f8cSChandrakanth patil "netctrl_fw_name", CTLFLAG_RD, vi->netctrl_fw_name, 0, 119935b53f8cSChandrakanth patil "network control firmware name"); 120035b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 120135b53f8cSChandrakanth patil "roce_fw_name", CTLFLAG_RD, vi->roce_fw_name, 0, 120235b53f8cSChandrakanth patil "RoCE firmware name"); 120335b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 120435b53f8cSChandrakanth patil "phy_vendor", CTLFLAG_RD, vi->phy_vendor, 0, 120535b53f8cSChandrakanth patil "PHY vendor name"); 120635b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 120735b53f8cSChandrakanth patil "phy_partnumber", CTLFLAG_RD, vi->phy_partnumber, 0, 120835b53f8cSChandrakanth patil "PHY vendor part number"); 120935b53f8cSChandrakanth patil SYSCTL_ADD_U16(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 121035b53f8cSChandrakanth patil "chip_num", CTLFLAG_RD, &vi->chip_num, 0, "chip number"); 121135b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 121235b53f8cSChandrakanth patil "chip_rev", CTLFLAG_RD, &vi->chip_rev, 0, "chip revision"); 121335b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 121435b53f8cSChandrakanth patil "chip_metal", CTLFLAG_RD, &vi->chip_metal, 0, "chip metal number"); 121535b53f8cSChandrakanth patil SYSCTL_ADD_U8(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 121635b53f8cSChandrakanth patil "chip_bond_id", CTLFLAG_RD, &vi->chip_bond_id, 0, 121735b53f8cSChandrakanth patil "chip bond id"); 121835b53f8cSChandrakanth patil SYSCTL_ADD_STRING(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 121935b53f8cSChandrakanth patil "chip_type", CTLFLAG_RD, vi->chip_type > MAX_CHIP_TYPE ? 122035b53f8cSChandrakanth patil bnxt_chip_type[MAX_CHIP_TYPE] : bnxt_chip_type[vi->chip_type], 0, 122135b53f8cSChandrakanth patil "RoCE firmware name"); 122235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 122335b53f8cSChandrakanth patil "package_ver", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, 122435b53f8cSChandrakanth patil softc, 0, bnxt_package_ver_sysctl, "A", 122535b53f8cSChandrakanth patil "currently installed package version"); 122635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&vi->ver_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 122735b53f8cSChandrakanth patil "hwrm_min_ver", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 122835b53f8cSChandrakanth patil softc, 0, bnxt_hwrm_min_ver_sysctl, "A", 122935b53f8cSChandrakanth patil "minimum hwrm API vesion to support"); 123035b53f8cSChandrakanth patil 123135b53f8cSChandrakanth patil return 0; 123235b53f8cSChandrakanth patil } 123335b53f8cSChandrakanth patil 123435b53f8cSChandrakanth patil int 123535b53f8cSChandrakanth patil bnxt_create_nvram_sysctls(struct bnxt_nvram_info *ni) 123635b53f8cSChandrakanth patil { 123735b53f8cSChandrakanth patil struct sysctl_oid *oid = ni->nvm_oid; 123835b53f8cSChandrakanth patil 123935b53f8cSChandrakanth patil if (!oid) 124035b53f8cSChandrakanth patil return ENOMEM; 124135b53f8cSChandrakanth patil 124235b53f8cSChandrakanth patil SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 124335b53f8cSChandrakanth patil "mfg_id", CTLFLAG_RD, &ni->mfg_id, 0, "manufacturer id"); 124435b53f8cSChandrakanth patil SYSCTL_ADD_U16(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 124535b53f8cSChandrakanth patil "device_id", CTLFLAG_RD, &ni->device_id, 0, "device id"); 124635b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 124735b53f8cSChandrakanth patil "sector_size", CTLFLAG_RD, &ni->sector_size, 0, "sector size"); 124835b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 124935b53f8cSChandrakanth patil "size", CTLFLAG_RD, &ni->size, 0, "nvram total size"); 125035b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 125135b53f8cSChandrakanth patil "reserved_size", CTLFLAG_RD, &ni->reserved_size, 0, 125235b53f8cSChandrakanth patil "total reserved space"); 125335b53f8cSChandrakanth patil SYSCTL_ADD_U32(&ni->nvm_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 125435b53f8cSChandrakanth patil "available_size", CTLFLAG_RD, &ni->available_size, 0, 125535b53f8cSChandrakanth patil "total available space"); 125635b53f8cSChandrakanth patil 125735b53f8cSChandrakanth patil return 0; 125835b53f8cSChandrakanth patil } 125935b53f8cSChandrakanth patil 126035b53f8cSChandrakanth patil static int 126135b53f8cSChandrakanth patil bnxt_rss_key_sysctl(SYSCTL_HANDLER_ARGS) 126235b53f8cSChandrakanth patil { 126335b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 126435b53f8cSChandrakanth patil char buf[HW_HASH_KEY_SIZE*2+1] = {0}; 126535b53f8cSChandrakanth patil char *p; 126635b53f8cSChandrakanth patil int i; 126735b53f8cSChandrakanth patil int rc; 126835b53f8cSChandrakanth patil 126935b53f8cSChandrakanth patil for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) 127035b53f8cSChandrakanth patil p += sprintf(p, "%02x", softc->vnic_info.rss_hash_key[i]); 127135b53f8cSChandrakanth patil 127235b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 127335b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 127435b53f8cSChandrakanth patil return rc; 127535b53f8cSChandrakanth patil 127635b53f8cSChandrakanth patil if (strspn(buf, "0123456789abcdefABCDEF") != (HW_HASH_KEY_SIZE * 2)) 127735b53f8cSChandrakanth patil return EINVAL; 127835b53f8cSChandrakanth patil 127935b53f8cSChandrakanth patil for (p = buf, i=0; i<HW_HASH_KEY_SIZE; i++) { 128035b53f8cSChandrakanth patil if (sscanf(p, "%02hhx", &softc->vnic_info.rss_hash_key[i]) != 1) 128135b53f8cSChandrakanth patil return EINVAL; 128235b53f8cSChandrakanth patil p += 2; 128335b53f8cSChandrakanth patil } 128435b53f8cSChandrakanth patil 128535b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 128635b53f8cSChandrakanth patil bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 128735b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type); 128835b53f8cSChandrakanth patil 128935b53f8cSChandrakanth patil return rc; 129035b53f8cSChandrakanth patil } 129135b53f8cSChandrakanth patil 129235b53f8cSChandrakanth patil static const char *bnxt_hash_types[] = {"ipv4", "tcp_ipv4", "udp_ipv4", "ipv6", 129335b53f8cSChandrakanth patil "tcp_ipv6", "udp_ipv6", NULL}; 129435b53f8cSChandrakanth patil 129535b53f8cSChandrakanth patil static int bnxt_get_rss_type_str_bit(char *str) 129635b53f8cSChandrakanth patil { 129735b53f8cSChandrakanth patil int i; 129835b53f8cSChandrakanth patil 129935b53f8cSChandrakanth patil for (i=0; bnxt_hash_types[i]; i++) 130035b53f8cSChandrakanth patil if (strcmp(bnxt_hash_types[i], str) == 0) 130135b53f8cSChandrakanth patil return i; 130235b53f8cSChandrakanth patil 130335b53f8cSChandrakanth patil return -1; 130435b53f8cSChandrakanth patil } 130535b53f8cSChandrakanth patil 130635b53f8cSChandrakanth patil static int 130735b53f8cSChandrakanth patil bnxt_rss_type_sysctl(SYSCTL_HANDLER_ARGS) 130835b53f8cSChandrakanth patil { 130935b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 131035b53f8cSChandrakanth patil char buf[256] = {0}; 131135b53f8cSChandrakanth patil char *p; 131235b53f8cSChandrakanth patil char *next; 131335b53f8cSChandrakanth patil int rc; 131435b53f8cSChandrakanth patil int type; 131535b53f8cSChandrakanth patil int bit; 131635b53f8cSChandrakanth patil 131735b53f8cSChandrakanth patil for (type = softc->vnic_info.rss_hash_type; type; 131835b53f8cSChandrakanth patil type &= ~(1<<bit)) { 131935b53f8cSChandrakanth patil bit = ffs(type) - 1; 132035b53f8cSChandrakanth patil if (bit >= sizeof(bnxt_hash_types) / sizeof(const char *)) 132135b53f8cSChandrakanth patil continue; 132235b53f8cSChandrakanth patil if (type != softc->vnic_info.rss_hash_type) 132335b53f8cSChandrakanth patil strcat(buf, ","); 132435b53f8cSChandrakanth patil strcat(buf, bnxt_hash_types[bit]); 132535b53f8cSChandrakanth patil } 132635b53f8cSChandrakanth patil 132735b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 132835b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 132935b53f8cSChandrakanth patil return rc; 133035b53f8cSChandrakanth patil 133135b53f8cSChandrakanth patil for (type = 0, next = buf, p = strsep(&next, " ,"); p; 133235b53f8cSChandrakanth patil p = strsep(&next, " ,")) { 133335b53f8cSChandrakanth patil bit = bnxt_get_rss_type_str_bit(p); 133435b53f8cSChandrakanth patil if (bit == -1) 133535b53f8cSChandrakanth patil return EINVAL; 133635b53f8cSChandrakanth patil type |= 1<<bit; 133735b53f8cSChandrakanth patil } 133835b53f8cSChandrakanth patil if (type != softc->vnic_info.rss_hash_type) { 133935b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type = type; 134035b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 134135b53f8cSChandrakanth patil bnxt_hwrm_rss_cfg(softc, &softc->vnic_info, 134235b53f8cSChandrakanth patil softc->vnic_info.rss_hash_type); 134335b53f8cSChandrakanth patil } 134435b53f8cSChandrakanth patil 134535b53f8cSChandrakanth patil return rc; 134635b53f8cSChandrakanth patil } 134735b53f8cSChandrakanth patil 134835b53f8cSChandrakanth patil static int 134935b53f8cSChandrakanth patil bnxt_rx_stall_sysctl(SYSCTL_HANDLER_ARGS) { 135035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 135135b53f8cSChandrakanth patil int rc; 135235b53f8cSChandrakanth patil int val; 135335b53f8cSChandrakanth patil 135435b53f8cSChandrakanth patil if (softc == NULL) 135535b53f8cSChandrakanth patil return EBUSY; 135635b53f8cSChandrakanth patil 135735b53f8cSChandrakanth patil val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_BD_STALL); 135835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 135935b53f8cSChandrakanth patil if (rc || !req->newptr) 136035b53f8cSChandrakanth patil return rc; 136135b53f8cSChandrakanth patil 136235b53f8cSChandrakanth patil if (val) 136335b53f8cSChandrakanth patil softc->vnic_info.flags |= BNXT_VNIC_FLAG_BD_STALL; 136435b53f8cSChandrakanth patil else 136535b53f8cSChandrakanth patil softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_BD_STALL; 136635b53f8cSChandrakanth patil 136735b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 136835b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 136935b53f8cSChandrakanth patil 137035b53f8cSChandrakanth patil return rc; 137135b53f8cSChandrakanth patil } 137235b53f8cSChandrakanth patil 137335b53f8cSChandrakanth patil static int 137435b53f8cSChandrakanth patil bnxt_vlan_strip_sysctl(SYSCTL_HANDLER_ARGS) { 137535b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 137635b53f8cSChandrakanth patil int rc; 137735b53f8cSChandrakanth patil int val; 137835b53f8cSChandrakanth patil 137935b53f8cSChandrakanth patil if (softc == NULL) 138035b53f8cSChandrakanth patil return EBUSY; 138135b53f8cSChandrakanth patil 138235b53f8cSChandrakanth patil val = (bool)(softc->vnic_info.flags & BNXT_VNIC_FLAG_VLAN_STRIP); 138335b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 138435b53f8cSChandrakanth patil if (rc || !req->newptr) 138535b53f8cSChandrakanth patil return rc; 138635b53f8cSChandrakanth patil 138735b53f8cSChandrakanth patil if (val) 138835b53f8cSChandrakanth patil softc->vnic_info.flags |= BNXT_VNIC_FLAG_VLAN_STRIP; 138935b53f8cSChandrakanth patil else 139035b53f8cSChandrakanth patil softc->vnic_info.flags &= ~BNXT_VNIC_FLAG_VLAN_STRIP; 139135b53f8cSChandrakanth patil 139235b53f8cSChandrakanth patil if (if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING) 139335b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_cfg(softc, &softc->vnic_info); 139435b53f8cSChandrakanth patil 139535b53f8cSChandrakanth patil return rc; 139635b53f8cSChandrakanth patil } 139735b53f8cSChandrakanth patil 139835b53f8cSChandrakanth patil static int 139935b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs(SYSCTL_HANDLER_ARGS) { 140035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 140135b53f8cSChandrakanth patil int rc; 140235b53f8cSChandrakanth patil int val; 140335b53f8cSChandrakanth patil 140435b53f8cSChandrakanth patil if (softc == NULL) 140535b53f8cSChandrakanth patil return EBUSY; 140635b53f8cSChandrakanth patil 140735b53f8cSChandrakanth patil val = softc->rx_coal_usecs; 140835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 140935b53f8cSChandrakanth patil if (rc || !req->newptr) 141035b53f8cSChandrakanth patil return rc; 141135b53f8cSChandrakanth patil 141235b53f8cSChandrakanth patil softc->rx_coal_usecs = val; 141335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 141435b53f8cSChandrakanth patil 141535b53f8cSChandrakanth patil return rc; 141635b53f8cSChandrakanth patil } 141735b53f8cSChandrakanth patil 141835b53f8cSChandrakanth patil static int 141935b53f8cSChandrakanth patil bnxt_set_coal_rx_frames(SYSCTL_HANDLER_ARGS) { 142035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 142135b53f8cSChandrakanth patil int rc; 142235b53f8cSChandrakanth patil int val; 142335b53f8cSChandrakanth patil 142435b53f8cSChandrakanth patil if (softc == NULL) 142535b53f8cSChandrakanth patil return EBUSY; 142635b53f8cSChandrakanth patil 142735b53f8cSChandrakanth patil val = softc->rx_coal_frames; 142835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 142935b53f8cSChandrakanth patil if (rc || !req->newptr) 143035b53f8cSChandrakanth patil return rc; 143135b53f8cSChandrakanth patil 143235b53f8cSChandrakanth patil softc->rx_coal_frames = val; 143335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 143435b53f8cSChandrakanth patil 143535b53f8cSChandrakanth patil return rc; 143635b53f8cSChandrakanth patil } 143735b53f8cSChandrakanth patil 143835b53f8cSChandrakanth patil static int 143935b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs_irq(SYSCTL_HANDLER_ARGS) { 144035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 144135b53f8cSChandrakanth patil int rc; 144235b53f8cSChandrakanth patil int val; 144335b53f8cSChandrakanth patil 144435b53f8cSChandrakanth patil if (softc == NULL) 144535b53f8cSChandrakanth patil return EBUSY; 144635b53f8cSChandrakanth patil 144735b53f8cSChandrakanth patil val = softc->rx_coal_usecs_irq; 144835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 144935b53f8cSChandrakanth patil if (rc || !req->newptr) 145035b53f8cSChandrakanth patil return rc; 145135b53f8cSChandrakanth patil 145235b53f8cSChandrakanth patil softc->rx_coal_usecs_irq = val; 145335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 145435b53f8cSChandrakanth patil 145535b53f8cSChandrakanth patil return rc; 145635b53f8cSChandrakanth patil } 145735b53f8cSChandrakanth patil 145835b53f8cSChandrakanth patil static int 145935b53f8cSChandrakanth patil bnxt_set_coal_rx_frames_irq(SYSCTL_HANDLER_ARGS) { 146035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 146135b53f8cSChandrakanth patil int rc; 146235b53f8cSChandrakanth patil int val; 146335b53f8cSChandrakanth patil 146435b53f8cSChandrakanth patil if (softc == NULL) 146535b53f8cSChandrakanth patil return EBUSY; 146635b53f8cSChandrakanth patil 146735b53f8cSChandrakanth patil val = softc->rx_coal_frames_irq; 146835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 146935b53f8cSChandrakanth patil if (rc || !req->newptr) 147035b53f8cSChandrakanth patil return rc; 147135b53f8cSChandrakanth patil 147235b53f8cSChandrakanth patil softc->rx_coal_frames_irq = val; 147335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 147435b53f8cSChandrakanth patil 147535b53f8cSChandrakanth patil return rc; 147635b53f8cSChandrakanth patil } 147735b53f8cSChandrakanth patil 147835b53f8cSChandrakanth patil static int 147935b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs(SYSCTL_HANDLER_ARGS) { 148035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 148135b53f8cSChandrakanth patil int rc; 148235b53f8cSChandrakanth patil int val; 148335b53f8cSChandrakanth patil 148435b53f8cSChandrakanth patil if (softc == NULL) 148535b53f8cSChandrakanth patil return EBUSY; 148635b53f8cSChandrakanth patil 148735b53f8cSChandrakanth patil val = softc->tx_coal_usecs; 148835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 148935b53f8cSChandrakanth patil if (rc || !req->newptr) 149035b53f8cSChandrakanth patil return rc; 149135b53f8cSChandrakanth patil 149235b53f8cSChandrakanth patil softc->tx_coal_usecs = val; 149335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 149435b53f8cSChandrakanth patil 149535b53f8cSChandrakanth patil return rc; 149635b53f8cSChandrakanth patil } 149735b53f8cSChandrakanth patil 149835b53f8cSChandrakanth patil static int 149935b53f8cSChandrakanth patil bnxt_set_coal_tx_frames(SYSCTL_HANDLER_ARGS) { 150035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 150135b53f8cSChandrakanth patil int rc; 150235b53f8cSChandrakanth patil int val; 150335b53f8cSChandrakanth patil 150435b53f8cSChandrakanth patil if (softc == NULL) 150535b53f8cSChandrakanth patil return EBUSY; 150635b53f8cSChandrakanth patil 150735b53f8cSChandrakanth patil val = softc->tx_coal_frames; 150835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 150935b53f8cSChandrakanth patil if (rc || !req->newptr) 151035b53f8cSChandrakanth patil return rc; 151135b53f8cSChandrakanth patil 151235b53f8cSChandrakanth patil softc->tx_coal_frames = val; 151335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 151435b53f8cSChandrakanth patil 151535b53f8cSChandrakanth patil return rc; 151635b53f8cSChandrakanth patil } 151735b53f8cSChandrakanth patil 151835b53f8cSChandrakanth patil static int 151935b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs_irq(SYSCTL_HANDLER_ARGS) { 152035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 152135b53f8cSChandrakanth patil int rc; 152235b53f8cSChandrakanth patil int val; 152335b53f8cSChandrakanth patil 152435b53f8cSChandrakanth patil if (softc == NULL) 152535b53f8cSChandrakanth patil return EBUSY; 152635b53f8cSChandrakanth patil 152735b53f8cSChandrakanth patil val = softc->tx_coal_usecs_irq; 152835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 152935b53f8cSChandrakanth patil if (rc || !req->newptr) 153035b53f8cSChandrakanth patil return rc; 153135b53f8cSChandrakanth patil 153235b53f8cSChandrakanth patil softc->tx_coal_usecs_irq = val; 153335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 153435b53f8cSChandrakanth patil 153535b53f8cSChandrakanth patil return rc; 153635b53f8cSChandrakanth patil } 153735b53f8cSChandrakanth patil 153835b53f8cSChandrakanth patil static int 153935b53f8cSChandrakanth patil bnxt_set_coal_tx_frames_irq(SYSCTL_HANDLER_ARGS) { 154035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 154135b53f8cSChandrakanth patil int rc; 154235b53f8cSChandrakanth patil int val; 154335b53f8cSChandrakanth patil 154435b53f8cSChandrakanth patil if (softc == NULL) 154535b53f8cSChandrakanth patil return EBUSY; 154635b53f8cSChandrakanth patil 154735b53f8cSChandrakanth patil val = softc->tx_coal_frames_irq; 154835b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 154935b53f8cSChandrakanth patil if (rc || !req->newptr) 155035b53f8cSChandrakanth patil return rc; 155135b53f8cSChandrakanth patil 155235b53f8cSChandrakanth patil softc->tx_coal_frames_irq = val; 155335b53f8cSChandrakanth patil rc = bnxt_hwrm_set_coal(softc); 155435b53f8cSChandrakanth patil 155535b53f8cSChandrakanth patil return rc; 155635b53f8cSChandrakanth patil } 155735b53f8cSChandrakanth patil 1558c9965974SChandrakanth patil static 1559c9965974SChandrakanth patil void simulate_reset(struct bnxt_softc *bp, char *fwcli_string) 1560c9965974SChandrakanth patil { 1561c9965974SChandrakanth patil struct hwrm_dbg_fw_cli_input req = {0}; 1562c9965974SChandrakanth patil int rc = 0; 1563c9965974SChandrakanth patil 1564c9965974SChandrakanth patil bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_DBG_FW_CLI); 1565c9965974SChandrakanth patil req.cmpl_ring = -1; 1566c9965974SChandrakanth patil req.target_id = -1; 1567c9965974SChandrakanth patil req.cli_cmd_len = strlen(fwcli_string); 1568c9965974SChandrakanth patil req.host_buf_len = 64 * 1024; 1569c9965974SChandrakanth patil strcpy((char *)req.cli_cmd, fwcli_string); 1570c9965974SChandrakanth patil 1571c9965974SChandrakanth patil BNXT_HWRM_LOCK(bp); 1572c9965974SChandrakanth patil rc = _hwrm_send_message(bp, &req, sizeof(req)); 1573c9965974SChandrakanth patil if (rc) { 1574c9965974SChandrakanth patil device_printf(bp->dev, " Manual FW fault failed, rc:%x\n", rc); 1575c9965974SChandrakanth patil } 1576c9965974SChandrakanth patil BNXT_HWRM_UNLOCK(bp); 1577c9965974SChandrakanth patil } 1578c9965974SChandrakanth patil 1579c9965974SChandrakanth patil static int 1580c9965974SChandrakanth patil bnxt_reset_ctrl(SYSCTL_HANDLER_ARGS) { 1581c9965974SChandrakanth patil struct bnxt_softc *softc = arg1; 1582c9965974SChandrakanth patil int rc = 0; 1583c9965974SChandrakanth patil char buf[50] = {0}; 1584c9965974SChandrakanth patil 1585c9965974SChandrakanth patil if (softc == NULL) 1586c9965974SChandrakanth patil return EBUSY; 1587c9965974SChandrakanth patil 1588c9965974SChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 1589c9965974SChandrakanth patil if (rc || req->newptr == NULL) 1590c9965974SChandrakanth patil return rc; 1591c9965974SChandrakanth patil 1592c9965974SChandrakanth patil if (BNXT_CHIP_P5(softc)) 1593c9965974SChandrakanth patil simulate_reset(softc, buf); 1594c9965974SChandrakanth patil 1595c9965974SChandrakanth patil return rc; 1596c9965974SChandrakanth patil } 1597c9965974SChandrakanth patil 159835b53f8cSChandrakanth patil int 159935b53f8cSChandrakanth patil bnxt_create_config_sysctls_pre(struct bnxt_softc *softc) 160035b53f8cSChandrakanth patil { 160135b53f8cSChandrakanth patil struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(softc->dev); 160235b53f8cSChandrakanth patil struct sysctl_oid_list *children; 160335b53f8cSChandrakanth patil 160435b53f8cSChandrakanth patil children = SYSCTL_CHILDREN(device_get_sysctl_tree(softc->dev)); 160535b53f8cSChandrakanth patil 160635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_key", 160735b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 160835b53f8cSChandrakanth patil bnxt_rss_key_sysctl, "A", "RSS key"); 160935b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rss_type", 161035b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 161135b53f8cSChandrakanth patil bnxt_rss_type_sysctl, "A", "RSS type bits"); 161235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "rx_stall", 161335b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 161435b53f8cSChandrakanth patil bnxt_rx_stall_sysctl, "I", 161535b53f8cSChandrakanth patil "buffer rx packets in hardware until the host posts new buffers"); 161635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "vlan_strip", 161735b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 161835b53f8cSChandrakanth patil bnxt_vlan_strip_sysctl, "I", "strip VLAN tag in the RX path"); 161935b53f8cSChandrakanth patil SYSCTL_ADD_CONST_STRING(ctx, children, OID_AUTO, "if_name", CTLFLAG_RD, 162035b53f8cSChandrakanth patil if_name(iflib_get_ifp(softc->ctx)), "interface name"); 162135b53f8cSChandrakanth patil 162235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs", 162335b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 162435b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs, "I", "interrupt coalescing Rx Usecs"); 162535b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames", 162635b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 162735b53f8cSChandrakanth patil bnxt_set_coal_rx_frames, "I", "interrupt coalescing Rx Frames"); 162835b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_usecs_irq", 162935b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 163035b53f8cSChandrakanth patil bnxt_set_coal_rx_usecs_irq, "I", 163135b53f8cSChandrakanth patil "interrupt coalescing Rx Usecs IRQ"); 163235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_rx_frames_irq", 163335b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 163435b53f8cSChandrakanth patil bnxt_set_coal_rx_frames_irq, "I", 163535b53f8cSChandrakanth patil "interrupt coalescing Rx Frames IRQ"); 163635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs", 163735b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 163835b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs, "I", "interrupt coalescing Tx Usces"); 163935b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames", 164035b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 164135b53f8cSChandrakanth patil bnxt_set_coal_tx_frames, "I", "interrupt coalescing Tx Frames"); 164235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_usecs_irq", 164335b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 164435b53f8cSChandrakanth patil bnxt_set_coal_tx_usecs_irq, "I", 164535b53f8cSChandrakanth patil "interrupt coalescing Tx Usecs IRQ"); 164635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "intr_coal_tx_frames_irq", 164735b53f8cSChandrakanth patil CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 164835b53f8cSChandrakanth patil bnxt_set_coal_tx_frames_irq, "I", 164935b53f8cSChandrakanth patil "interrupt coalescing Tx Frames IRQ"); 165035b53f8cSChandrakanth patil SYSCTL_ADD_U32(ctx, children, OID_AUTO, "flags", CTLFLAG_RD, 165135b53f8cSChandrakanth patil &softc->flags, 0, "flags"); 165235b53f8cSChandrakanth patil SYSCTL_ADD_U64(ctx, children, OID_AUTO, "fw_cap", CTLFLAG_RD, 165335b53f8cSChandrakanth patil &softc->fw_cap, 0, "FW caps"); 165435b53f8cSChandrakanth patil 1655c9965974SChandrakanth patil SYSCTL_ADD_PROC(ctx, children, OID_AUTO, 1656c9965974SChandrakanth patil "reset_ctrl", CTLTYPE_STRING | CTLFLAG_RWTUN, softc, 1657c9965974SChandrakanth patil 0, bnxt_reset_ctrl, "A", 1658c9965974SChandrakanth patil "Issue controller reset: 0 / 1"); 165935b53f8cSChandrakanth patil return 0; 166035b53f8cSChandrakanth patil } 166135b53f8cSChandrakanth patil 166235b53f8cSChandrakanth patil #define BNXT_HW_LRO_FN(fn_name, arg) \ 166335b53f8cSChandrakanth patil static int \ 166435b53f8cSChandrakanth patil fn_name(SYSCTL_HANDLER_ARGS) { \ 166535b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; \ 166635b53f8cSChandrakanth patil int rc; \ 166735b53f8cSChandrakanth patil int val; \ 166835b53f8cSChandrakanth patil \ 166935b53f8cSChandrakanth patil if (softc == NULL) \ 167035b53f8cSChandrakanth patil return EBUSY; \ 167135b53f8cSChandrakanth patil \ 167235b53f8cSChandrakanth patil val = softc->hw_lro.arg; \ 167335b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); \ 167435b53f8cSChandrakanth patil if (rc || !req->newptr) \ 167535b53f8cSChandrakanth patil return rc; \ 167635b53f8cSChandrakanth patil \ 167735b53f8cSChandrakanth patil if ((if_getdrvflags(iflib_get_ifp(softc->ctx)) & IFF_DRV_RUNNING)) \ 167835b53f8cSChandrakanth patil return EBUSY; \ 167935b53f8cSChandrakanth patil \ 168035b53f8cSChandrakanth patil if (!(softc->flags & BNXT_FLAG_TPA)) \ 168135b53f8cSChandrakanth patil return EINVAL; \ 168235b53f8cSChandrakanth patil \ 168335b53f8cSChandrakanth patil softc->hw_lro.arg = val; \ 168435b53f8cSChandrakanth patil bnxt_validate_hw_lro_settings(softc); \ 168535b53f8cSChandrakanth patil rc = bnxt_hwrm_vnic_tpa_cfg(softc); \ 168635b53f8cSChandrakanth patil \ 168735b53f8cSChandrakanth patil return rc; \ 168835b53f8cSChandrakanth patil } 168935b53f8cSChandrakanth patil 169035b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_enable_disable, enable) 169135b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_mode, is_mode_gro) 169235b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_agg_segs, max_agg_segs) 169335b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_max_aggs, max_aggs) 169435b53f8cSChandrakanth patil BNXT_HW_LRO_FN(bnxt_hw_lro_set_min_agg_len, min_agg_len) 169535b53f8cSChandrakanth patil 169635b53f8cSChandrakanth patil #define BNXT_FLOW_CTRL_FN(fn_name, arg) \ 169735b53f8cSChandrakanth patil static int \ 169835b53f8cSChandrakanth patil fn_name(SYSCTL_HANDLER_ARGS) { \ 169935b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; \ 170035b53f8cSChandrakanth patil int rc; \ 170135b53f8cSChandrakanth patil int val; \ 170235b53f8cSChandrakanth patil \ 170335b53f8cSChandrakanth patil if (softc == NULL) \ 170435b53f8cSChandrakanth patil return EBUSY; \ 170535b53f8cSChandrakanth patil \ 170635b53f8cSChandrakanth patil val = softc->link_info.flow_ctrl.arg; \ 170735b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); \ 170835b53f8cSChandrakanth patil if (rc || !req->newptr) \ 170935b53f8cSChandrakanth patil return rc; \ 171035b53f8cSChandrakanth patil \ 171135b53f8cSChandrakanth patil if (val) \ 171235b53f8cSChandrakanth patil val = 1; \ 171335b53f8cSChandrakanth patil \ 171435b53f8cSChandrakanth patil if (softc->link_info.flow_ctrl.arg != val) { \ 171535b53f8cSChandrakanth patil softc->link_info.flow_ctrl.arg = val; \ 171635b53f8cSChandrakanth patil rc = bnxt_hwrm_set_link_setting(softc, true, false, false);\ 171735b53f8cSChandrakanth patil rc = bnxt_hwrm_port_phy_qcfg(softc); \ 171835b53f8cSChandrakanth patil } \ 171935b53f8cSChandrakanth patil \ 172035b53f8cSChandrakanth patil return rc; \ 172135b53f8cSChandrakanth patil } 172235b53f8cSChandrakanth patil 172335b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_tx, tx) 172435b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_rx, rx) 172535b53f8cSChandrakanth patil BNXT_FLOW_CTRL_FN(bnxt_flow_ctrl_autoneg, autoneg) 172635b53f8cSChandrakanth patil int 172735b53f8cSChandrakanth patil bnxt_create_pause_fc_sysctls(struct bnxt_softc *softc) 172835b53f8cSChandrakanth patil { 172935b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->flow_ctrl_oid; 173035b53f8cSChandrakanth patil 173135b53f8cSChandrakanth patil if (!oid) 173235b53f8cSChandrakanth patil return ENOMEM; 173335b53f8cSChandrakanth patil 173435b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 173535b53f8cSChandrakanth patil "tx", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 173635b53f8cSChandrakanth patil bnxt_flow_ctrl_tx, "A", "Enable or Disable Tx Flow Ctrl: 0 / 1"); 173735b53f8cSChandrakanth patil 173835b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 173935b53f8cSChandrakanth patil "rx", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 0, 174035b53f8cSChandrakanth patil bnxt_flow_ctrl_rx, "A", "Enable or Disable Tx Flow Ctrl: 0 / 1"); 174135b53f8cSChandrakanth patil 174235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->flow_ctrl_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 174335b53f8cSChandrakanth patil "autoneg", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 174435b53f8cSChandrakanth patil 0, bnxt_flow_ctrl_autoneg, "A", 174535b53f8cSChandrakanth patil "Enable or Disable Autoneg Flow Ctrl: 0 / 1"); 174635b53f8cSChandrakanth patil 174735b53f8cSChandrakanth patil return 0; 174835b53f8cSChandrakanth patil } 174935b53f8cSChandrakanth patil 175035b53f8cSChandrakanth patil int 175135b53f8cSChandrakanth patil bnxt_create_hw_lro_sysctls(struct bnxt_softc *softc) 175235b53f8cSChandrakanth patil { 175335b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->hw_lro_oid; 175435b53f8cSChandrakanth patil 175535b53f8cSChandrakanth patil if (!oid) 175635b53f8cSChandrakanth patil return ENOMEM; 175735b53f8cSChandrakanth patil 175835b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 175935b53f8cSChandrakanth patil "enable", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 176035b53f8cSChandrakanth patil 0, bnxt_hw_lro_enable_disable, "A", 176135b53f8cSChandrakanth patil "Enable or Disable HW LRO: 0 / 1"); 176235b53f8cSChandrakanth patil 176335b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 176435b53f8cSChandrakanth patil "gro_mode", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, softc, 176535b53f8cSChandrakanth patil 0, bnxt_hw_lro_set_mode, "A", 176635b53f8cSChandrakanth patil "Set mode: 1 = GRO mode, 0 = RSC mode"); 176735b53f8cSChandrakanth patil 176835b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 176935b53f8cSChandrakanth patil "max_agg_segs", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 177035b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_max_agg_segs, "A", 177135b53f8cSChandrakanth patil "Set Max Agg Seg Value (unit is Log2): " 177235b53f8cSChandrakanth patil "0 (= 1 seg) / 1 (= 2 segs) / ... / 31 (= 2^31 segs)"); 177335b53f8cSChandrakanth patil 177435b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 177535b53f8cSChandrakanth patil "max_aggs", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 177635b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_max_aggs, "A", 177735b53f8cSChandrakanth patil "Set Max Aggs Value (unit is Log2): " 177835b53f8cSChandrakanth patil "0 (= 1 agg) / 1 (= 2 aggs) / ... / 7 (= 2^7 segs)"); 177935b53f8cSChandrakanth patil 178035b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->hw_lro_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 178135b53f8cSChandrakanth patil "min_agg_len", CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, 178235b53f8cSChandrakanth patil softc, 0, bnxt_hw_lro_set_min_agg_len, "A", 178335b53f8cSChandrakanth patil "Min Agg Len: 1 to 9000"); 178435b53f8cSChandrakanth patil 178535b53f8cSChandrakanth patil return 0; 178635b53f8cSChandrakanth patil } 178735b53f8cSChandrakanth patil 178835b53f8cSChandrakanth patil static int 178935b53f8cSChandrakanth patil bnxt_dcb_dcbx_cap(SYSCTL_HANDLER_ARGS) 179035b53f8cSChandrakanth patil { 179135b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 179235b53f8cSChandrakanth patil int val; 179335b53f8cSChandrakanth patil int rc; 179435b53f8cSChandrakanth patil 179535b53f8cSChandrakanth patil if (softc == NULL) 179635b53f8cSChandrakanth patil return EBUSY; 179735b53f8cSChandrakanth patil 179835b53f8cSChandrakanth patil val = bnxt_dcb_getdcbx(softc); 179935b53f8cSChandrakanth patil rc = sysctl_handle_int(oidp, &val, 0, req); 180035b53f8cSChandrakanth patil if (rc || !req->newptr) 180135b53f8cSChandrakanth patil return rc; 180235b53f8cSChandrakanth patil 180335b53f8cSChandrakanth patil bnxt_dcb_setdcbx(softc, val); 180435b53f8cSChandrakanth patil 180535b53f8cSChandrakanth patil return rc; 180635b53f8cSChandrakanth patil } 180735b53f8cSChandrakanth patil 180835b53f8cSChandrakanth patil static char 180935b53f8cSChandrakanth patil bnxt_ets_tsa_to_str(struct bnxt_softc *softc, uint32_t tc) 181035b53f8cSChandrakanth patil { 181135b53f8cSChandrakanth patil switch (softc->ieee_ets->tc_tsa[tc]) { 181235b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_TSA_STRICT: 181335b53f8cSChandrakanth patil return 's'; 181435b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_TSA_ETS: 181535b53f8cSChandrakanth patil return 'e'; 181635b53f8cSChandrakanth patil default: 181735b53f8cSChandrakanth patil return 'X'; 181835b53f8cSChandrakanth patil 181935b53f8cSChandrakanth patil } 182035b53f8cSChandrakanth patil } 182135b53f8cSChandrakanth patil 182235b53f8cSChandrakanth patil static uint32_t 182335b53f8cSChandrakanth patil bnxt_ets_str_to_tsa(char tsa_str) 182435b53f8cSChandrakanth patil { 182535b53f8cSChandrakanth patil switch (tsa_str) { 182635b53f8cSChandrakanth patil case 's': 182735b53f8cSChandrakanth patil return BNXT_IEEE_8021QAZ_TSA_STRICT; 182835b53f8cSChandrakanth patil case 'e': 182935b53f8cSChandrakanth patil return BNXT_IEEE_8021QAZ_TSA_ETS; 183035b53f8cSChandrakanth patil default: 183135b53f8cSChandrakanth patil return -1; 183235b53f8cSChandrakanth patil } 183335b53f8cSChandrakanth patil } 183435b53f8cSChandrakanth patil 183535b53f8cSChandrakanth patil static int 183635b53f8cSChandrakanth patil bnxt_ets_get_val(struct bnxt_softc *softc, uint32_t type, uint32_t tc) 183735b53f8cSChandrakanth patil { 183835b53f8cSChandrakanth patil switch (type) { 183935b53f8cSChandrakanth patil case BNXT_TYPE_ETS_TSA: 184035b53f8cSChandrakanth patil if (softc->ieee_ets) 184135b53f8cSChandrakanth patil return softc->ieee_ets->tc_tsa[tc]; 184235b53f8cSChandrakanth patil break; 184335b53f8cSChandrakanth patil case BNXT_TYPE_ETS_PRI2TC: 184435b53f8cSChandrakanth patil if (softc->ieee_ets) 184535b53f8cSChandrakanth patil return softc->ieee_ets->prio_tc[tc]; 184635b53f8cSChandrakanth patil break; 184735b53f8cSChandrakanth patil case BNXT_TYPE_ETS_TCBW: 184835b53f8cSChandrakanth patil if (softc->ieee_ets) 184935b53f8cSChandrakanth patil return softc->ieee_ets->tc_tx_bw[tc]; 185035b53f8cSChandrakanth patil break; 185135b53f8cSChandrakanth patil default: 185235b53f8cSChandrakanth patil break; 185335b53f8cSChandrakanth patil } 185435b53f8cSChandrakanth patil 185535b53f8cSChandrakanth patil return -1; 185635b53f8cSChandrakanth patil } 185735b53f8cSChandrakanth patil 185835b53f8cSChandrakanth patil static void 185935b53f8cSChandrakanth patil bnxt_pfc_get_string(struct bnxt_softc *softc, char *buf, struct bnxt_ieee_pfc *pfc) 186035b53f8cSChandrakanth patil { 186135b53f8cSChandrakanth patil uint32_t i; 186235b53f8cSChandrakanth patil bool found = false; 186335b53f8cSChandrakanth patil 186435b53f8cSChandrakanth patil for (i = 0; i < BNXT_IEEE_8021QAZ_MAX_TCS; i++) { 186535b53f8cSChandrakanth patil if (pfc->pfc_en & (1 << i)) { 186635b53f8cSChandrakanth patil if (found) 186735b53f8cSChandrakanth patil buf += sprintf(buf, ", "); 186835b53f8cSChandrakanth patil buf += sprintf(buf, "%d", i); 186935b53f8cSChandrakanth patil found = true; 187035b53f8cSChandrakanth patil } 187135b53f8cSChandrakanth patil } 187235b53f8cSChandrakanth patil 187335b53f8cSChandrakanth patil if (!found) 187435b53f8cSChandrakanth patil buf += sprintf(buf, "none"); 187535b53f8cSChandrakanth patil } 187635b53f8cSChandrakanth patil 187735b53f8cSChandrakanth patil static char *bnxt_get_tlv_selector_str(uint8_t selector) 187835b53f8cSChandrakanth patil { 187935b53f8cSChandrakanth patil switch (selector) { 188035b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_ETHERTYPE: 188135b53f8cSChandrakanth patil return "Ethertype"; 188235b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_DGRAM: 188335b53f8cSChandrakanth patil return "UDP or DCCP"; 188435b53f8cSChandrakanth patil case BNXT_IEEE_8021QAZ_APP_SEL_DSCP: 188535b53f8cSChandrakanth patil return "DSCP"; 188635b53f8cSChandrakanth patil default: 188735b53f8cSChandrakanth patil return "Unknown"; 188835b53f8cSChandrakanth patil } 188935b53f8cSChandrakanth patil } 189035b53f8cSChandrakanth patil 189135b53f8cSChandrakanth patil static void 189235b53f8cSChandrakanth patil bnxt_app_tlv_get_string(struct bnxt_softc *softc, char *buf, 189335b53f8cSChandrakanth patil struct bnxt_dcb_app *app, int num) 189435b53f8cSChandrakanth patil { 189535b53f8cSChandrakanth patil uint32_t i; 189635b53f8cSChandrakanth patil 189735b53f8cSChandrakanth patil if (!num) { 189835b53f8cSChandrakanth patil buf += sprintf(buf, " None"); 189935b53f8cSChandrakanth patil return; 190035b53f8cSChandrakanth patil } 190135b53f8cSChandrakanth patil 190235b53f8cSChandrakanth patil buf += sprintf(buf, "\n"); 190335b53f8cSChandrakanth patil for (i = 0; i < num; i++) { 190435b53f8cSChandrakanth patil buf += sprintf(buf, "\tAPP#%0d:\tpri: %d,\tSel: %d,\t%s: %d\n", 190535b53f8cSChandrakanth patil i, 190635b53f8cSChandrakanth patil app[i].priority, 190735b53f8cSChandrakanth patil app[i].selector, 190835b53f8cSChandrakanth patil bnxt_get_tlv_selector_str(app[i].selector), 190935b53f8cSChandrakanth patil app[i].protocol); 191035b53f8cSChandrakanth patil } 191135b53f8cSChandrakanth patil } 191235b53f8cSChandrakanth patil 191335b53f8cSChandrakanth patil static void 191435b53f8cSChandrakanth patil bnxt_ets_get_string(struct bnxt_softc *softc, char *buf) 191535b53f8cSChandrakanth patil { 191635b53f8cSChandrakanth patil uint32_t type, i; 191735b53f8cSChandrakanth patil 191835b53f8cSChandrakanth patil type = BNXT_TYPE_ETS_TSA; 191935b53f8cSChandrakanth patil for (type = 0; type < BNXT_TYPE_ETS_MAX; type++) { 192035b53f8cSChandrakanth patil for (i = 0; i < BNXT_IEEE_8021QAZ_MAX_TCS; i++) { 192135b53f8cSChandrakanth patil if (i == 0) 192235b53f8cSChandrakanth patil buf += sprintf(buf, "%s:", BNXT_ETS_TYPE_STR[type]); 192335b53f8cSChandrakanth patil 192435b53f8cSChandrakanth patil if (!softc->ieee_ets) 192535b53f8cSChandrakanth patil buf += sprintf(buf, "x"); 192635b53f8cSChandrakanth patil else if (type == BNXT_TYPE_ETS_TSA) 192735b53f8cSChandrakanth patil buf += sprintf(buf, "%c", bnxt_ets_tsa_to_str(softc, i)); 192835b53f8cSChandrakanth patil else 192935b53f8cSChandrakanth patil buf += sprintf(buf, "%d", bnxt_ets_get_val(softc, type, i)); 193035b53f8cSChandrakanth patil 193135b53f8cSChandrakanth patil if (i != BNXT_IEEE_8021QAZ_MAX_TCS - 1) 193235b53f8cSChandrakanth patil buf += sprintf(buf, ","); 193335b53f8cSChandrakanth patil } 193435b53f8cSChandrakanth patil if (type != BNXT_TYPE_ETS_MAX - 1) 193535b53f8cSChandrakanth patil buf += sprintf(buf, "#"); 193635b53f8cSChandrakanth patil } 193735b53f8cSChandrakanth patil } 193835b53f8cSChandrakanth patil 193935b53f8cSChandrakanth patil static int 194035b53f8cSChandrakanth patil bnxt_dcb_list_app(SYSCTL_HANDLER_ARGS) 194135b53f8cSChandrakanth patil { 194235b53f8cSChandrakanth patil struct bnxt_dcb_app app[128] = {0}; 194335b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 194435b53f8cSChandrakanth patil int rc, num_inputs = 0; 194535b53f8cSChandrakanth patil char *buf; 194635b53f8cSChandrakanth patil 194735b53f8cSChandrakanth patil if (softc == NULL) 194835b53f8cSChandrakanth patil return EBUSY; 194935b53f8cSChandrakanth patil 195035b53f8cSChandrakanth patil #define BNXT_APP_TLV_STR_LEN 4096 195135b53f8cSChandrakanth patil buf = malloc(BNXT_APP_TLV_STR_LEN, M_DEVBUF, M_NOWAIT | M_ZERO); 195235b53f8cSChandrakanth patil if (!buf) 195335b53f8cSChandrakanth patil return ENOMEM; 195435b53f8cSChandrakanth patil 19553de231b4SZhenlei Huang bnxt_dcb_ieee_listapp(softc, app, nitems(app), &num_inputs); 195635b53f8cSChandrakanth patil bnxt_app_tlv_get_string(softc, buf, app, num_inputs); 195735b53f8cSChandrakanth patil 195835b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, BNXT_APP_TLV_STR_LEN, req); 195935b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 196035b53f8cSChandrakanth patil goto end; 196135b53f8cSChandrakanth patil 196235b53f8cSChandrakanth patil end: 196335b53f8cSChandrakanth patil free(buf, M_DEVBUF); 196435b53f8cSChandrakanth patil return rc; 196535b53f8cSChandrakanth patil } 196635b53f8cSChandrakanth patil 196735b53f8cSChandrakanth patil static int 196835b53f8cSChandrakanth patil bnxt_dcb_del_app(SYSCTL_HANDLER_ARGS) 196935b53f8cSChandrakanth patil { 197035b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 197135b53f8cSChandrakanth patil struct bnxt_dcb_app app = {0}; 197235b53f8cSChandrakanth patil char buf[256] = {0}; 197335b53f8cSChandrakanth patil int rc, num_inputs; 197435b53f8cSChandrakanth patil 197535b53f8cSChandrakanth patil if (softc == NULL) 197635b53f8cSChandrakanth patil return EBUSY; 197735b53f8cSChandrakanth patil 197835b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 197935b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 198035b53f8cSChandrakanth patil return rc; 198135b53f8cSChandrakanth patil 198235b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hd", &app.priority, &app.selector, &app.protocol); 198335b53f8cSChandrakanth patil 198435b53f8cSChandrakanth patil if (num_inputs != 3) { 198535b53f8cSChandrakanth patil device_printf(softc->dev, 198635b53f8cSChandrakanth patil "Invalid app tlv syntax, inputs = %d\n", num_inputs); 198735b53f8cSChandrakanth patil return EINVAL; 198835b53f8cSChandrakanth patil } 198935b53f8cSChandrakanth patil 199035b53f8cSChandrakanth patil bnxt_dcb_ieee_delapp(softc, &app); 199135b53f8cSChandrakanth patil 199235b53f8cSChandrakanth patil return rc; 199335b53f8cSChandrakanth patil } 199435b53f8cSChandrakanth patil static int 199535b53f8cSChandrakanth patil bnxt_dcb_set_app(SYSCTL_HANDLER_ARGS) 199635b53f8cSChandrakanth patil { 199735b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 199835b53f8cSChandrakanth patil struct bnxt_dcb_app app = {0}; 199935b53f8cSChandrakanth patil char buf[256] = {0}; 200035b53f8cSChandrakanth patil int rc, num_inputs; 200135b53f8cSChandrakanth patil 200235b53f8cSChandrakanth patil if (softc == NULL) 200335b53f8cSChandrakanth patil return EBUSY; 200435b53f8cSChandrakanth patil 200535b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 200635b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 200735b53f8cSChandrakanth patil return rc; 200835b53f8cSChandrakanth patil 200935b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hd", &app.priority, &app.selector, &app.protocol); 201035b53f8cSChandrakanth patil 201135b53f8cSChandrakanth patil if (num_inputs != 3) { 201235b53f8cSChandrakanth patil device_printf(softc->dev, 201335b53f8cSChandrakanth patil "Invalid app tlv syntax, inputs = %d\n", num_inputs); 201435b53f8cSChandrakanth patil return EINVAL; 201535b53f8cSChandrakanth patil } 201635b53f8cSChandrakanth patil 201735b53f8cSChandrakanth patil bnxt_dcb_ieee_setapp(softc, &app); 201835b53f8cSChandrakanth patil 201935b53f8cSChandrakanth patil return rc; 202035b53f8cSChandrakanth patil } 202135b53f8cSChandrakanth patil 202235b53f8cSChandrakanth patil static int 202335b53f8cSChandrakanth patil bnxt_dcb_pfc(SYSCTL_HANDLER_ARGS) 202435b53f8cSChandrakanth patil { 202535b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 202635b53f8cSChandrakanth patil struct bnxt_ieee_pfc pfc = {0}; 202735b53f8cSChandrakanth patil int rc, i, num_inputs; 202835b53f8cSChandrakanth patil char buf[256] = {0}; 202935b53f8cSChandrakanth patil int pri_mask = 0; 203035b53f8cSChandrakanth patil char pri[8]; 203135b53f8cSChandrakanth patil 203235b53f8cSChandrakanth patil if (softc == NULL) 203335b53f8cSChandrakanth patil return EBUSY; 203435b53f8cSChandrakanth patil 203535b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_getpfc(softc, &pfc); 203635b53f8cSChandrakanth patil if (!rc) 203735b53f8cSChandrakanth patil bnxt_pfc_get_string(softc, buf, &pfc); 203835b53f8cSChandrakanth patil else 203935b53f8cSChandrakanth patil sprintf(buf, "## getpfc failed with error %d ##", rc); 204035b53f8cSChandrakanth patil 204135b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 204235b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 204335b53f8cSChandrakanth patil return rc; 204435b53f8cSChandrakanth patil 204535b53f8cSChandrakanth patil /* Check for 'none' string first */ 204635b53f8cSChandrakanth patil if (sscanf(buf, "%s", buf) == 1) { 204735b53f8cSChandrakanth patil if (strncmp(buf, "none", 8) == 0) { 204835b53f8cSChandrakanth patil goto configure; 204935b53f8cSChandrakanth patil } 205035b53f8cSChandrakanth patil } 205135b53f8cSChandrakanth patil num_inputs = sscanf(buf, "%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu", 205235b53f8cSChandrakanth patil &pri[0], &pri[1], &pri[2], &pri[3], &pri[4], 205335b53f8cSChandrakanth patil &pri[5], &pri[6], &pri[7]); 205435b53f8cSChandrakanth patil 205535b53f8cSChandrakanth patil if (num_inputs < 1 || num_inputs > 8) { 205635b53f8cSChandrakanth patil device_printf(softc->dev, 205735b53f8cSChandrakanth patil "Invalid pfc syntax, inputs = %d\n", num_inputs); 205835b53f8cSChandrakanth patil return EINVAL; 205935b53f8cSChandrakanth patil } 206035b53f8cSChandrakanth patil 206135b53f8cSChandrakanth patil for (i = 0; i < num_inputs; i++) { 206235b53f8cSChandrakanth patil if (pri[i] > 7 || pri[i] < 0) { 206335b53f8cSChandrakanth patil device_printf(softc->dev, 206435b53f8cSChandrakanth patil "Invalid priority %d. Valid priorties are " 206535b53f8cSChandrakanth patil "from 0 to 7 and string \"none\".\n", pri[i]); 206635b53f8cSChandrakanth patil return EINVAL; 206735b53f8cSChandrakanth patil } 206835b53f8cSChandrakanth patil 206935b53f8cSChandrakanth patil pri_mask |= (1 << pri[i]) & 0xFF; 207035b53f8cSChandrakanth patil } 207135b53f8cSChandrakanth patil 207235b53f8cSChandrakanth patil configure: 207335b53f8cSChandrakanth patil pfc.pfc_en = pri_mask; 207435b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_setpfc(softc, &pfc); 207535b53f8cSChandrakanth patil if (rc) 207635b53f8cSChandrakanth patil device_printf(softc->dev, 207735b53f8cSChandrakanth patil "setpfc failed with status %d\n", rc); 207835b53f8cSChandrakanth patil return rc; 207935b53f8cSChandrakanth patil } 208035b53f8cSChandrakanth patil 208135b53f8cSChandrakanth patil static int 208235b53f8cSChandrakanth patil bnxt_dcb_ets(SYSCTL_HANDLER_ARGS) 208335b53f8cSChandrakanth patil { 208435b53f8cSChandrakanth patil struct bnxt_softc *softc = arg1; 208535b53f8cSChandrakanth patil struct bnxt_ieee_ets ets = {0}; 208635b53f8cSChandrakanth patil int rc = 0, i, num_inputs; 208735b53f8cSChandrakanth patil char buf[256] = {0}; 208835b53f8cSChandrakanth patil char tsa[8]; 208935b53f8cSChandrakanth patil 209035b53f8cSChandrakanth patil if (softc == NULL) 209135b53f8cSChandrakanth patil return EBUSY; 209235b53f8cSChandrakanth patil 209335b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_getets(softc, &ets); 209435b53f8cSChandrakanth patil if (!rc) 209535b53f8cSChandrakanth patil bnxt_ets_get_string(softc, buf); 209635b53f8cSChandrakanth patil else 209735b53f8cSChandrakanth patil sprintf(buf, "## getets failed with error %d ##", rc); 209835b53f8cSChandrakanth patil 209935b53f8cSChandrakanth patil rc = sysctl_handle_string(oidp, buf, sizeof(buf), req); 210035b53f8cSChandrakanth patil if (rc || req->newptr == NULL) 210135b53f8cSChandrakanth patil return rc; 210235b53f8cSChandrakanth patil 210335b53f8cSChandrakanth patil num_inputs = sscanf(buf, "tsa:%c,%c,%c,%c,%c,%c,%c,%c#" 210435b53f8cSChandrakanth patil "pri2tc:%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu#" 210535b53f8cSChandrakanth patil "tcbw:%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu,%hhu", 210635b53f8cSChandrakanth patil &tsa[0], &tsa[1], &tsa[2], &tsa[3], &tsa[4], &tsa[5], &tsa[6], &tsa[7], 210735b53f8cSChandrakanth patil &ets.prio_tc[0], &ets.prio_tc[1], &ets.prio_tc[2], &ets.prio_tc[3], 210835b53f8cSChandrakanth patil &ets.prio_tc[4], &ets.prio_tc[5], &ets.prio_tc[6], &ets.prio_tc[7], 210935b53f8cSChandrakanth patil &ets.tc_tx_bw[0], &ets.tc_tx_bw[1], &ets.tc_tx_bw[2], &ets.tc_tx_bw[3], 211035b53f8cSChandrakanth patil &ets.tc_tx_bw[4], &ets.tc_tx_bw[5], &ets.tc_tx_bw[6], &ets.tc_tx_bw[7]); 211135b53f8cSChandrakanth patil 211235b53f8cSChandrakanth patil if (num_inputs != 24) 211335b53f8cSChandrakanth patil return EINVAL; 211435b53f8cSChandrakanth patil 211535b53f8cSChandrakanth patil for ( i= 0; i < 8; i++) 211635b53f8cSChandrakanth patil ets.tc_tsa[i] = bnxt_ets_str_to_tsa(tsa[i]); 211735b53f8cSChandrakanth patil 211835b53f8cSChandrakanth patil rc = bnxt_dcb_ieee_setets(softc, &ets); 211935b53f8cSChandrakanth patil 212035b53f8cSChandrakanth patil return rc; 212135b53f8cSChandrakanth patil } 212235b53f8cSChandrakanth patil 212335b53f8cSChandrakanth patil int 212435b53f8cSChandrakanth patil bnxt_create_dcb_sysctls(struct bnxt_softc *softc) 212535b53f8cSChandrakanth patil { 212635b53f8cSChandrakanth patil struct sysctl_oid *oid = softc->dcb_oid; 212735b53f8cSChandrakanth patil 212835b53f8cSChandrakanth patil if (!oid) 212935b53f8cSChandrakanth patil return ENOMEM; 213035b53f8cSChandrakanth patil 213135b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, 213235b53f8cSChandrakanth patil "dcbx_cap", CTLTYPE_INT | CTLFLAG_RWTUN, softc, 213335b53f8cSChandrakanth patil 0, bnxt_dcb_dcbx_cap, "A", 2134*0bc672b3SZhenlei Huang "Enable DCB Capability Exchange Protocol (DCBX) capabilities"); 213535b53f8cSChandrakanth patil 213635b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "ets", 213735b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN, softc, 0, 213835b53f8cSChandrakanth patil bnxt_dcb_ets, "A", "Enhanced Transmission Selection (ETS)"); 213935b53f8cSChandrakanth patil 214035b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "pfc", 214135b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RWTUN, softc, 0, 214235b53f8cSChandrakanth patil bnxt_dcb_pfc, "A", "Enhanced Transmission Selection (ETS)"); 214335b53f8cSChandrakanth patil 214435b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "set_apptlv", 214535b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_WR, softc, 0, 214635b53f8cSChandrakanth patil bnxt_dcb_set_app, "A", "Set App TLV"); 214735b53f8cSChandrakanth patil 214835b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "del_apptlv", 214935b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_WR, softc, 0, 215035b53f8cSChandrakanth patil bnxt_dcb_del_app, "A", "Delete App TLV"); 215135b53f8cSChandrakanth patil 215235b53f8cSChandrakanth patil SYSCTL_ADD_PROC(&softc->dcb_ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "list_apptlv", 215335b53f8cSChandrakanth patil CTLTYPE_STRING | CTLFLAG_RD, softc, 0, 215435b53f8cSChandrakanth patil bnxt_dcb_list_app, "A", "List all App TLVs"); 215535b53f8cSChandrakanth patil 215635b53f8cSChandrakanth patil return 0; 215735b53f8cSChandrakanth patil } 215835b53f8cSChandrakanth patil 215935b53f8cSChandrakanth patil int 216035b53f8cSChandrakanth patil bnxt_create_config_sysctls_post(struct bnxt_softc *softc) 216135b53f8cSChandrakanth patil { 216235b53f8cSChandrakanth patil /* Nothing for now, meant for future expansion */ 216335b53f8cSChandrakanth patil return 0; 216435b53f8cSChandrakanth patil } 2165