The branch main has been updated by ssaxena:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=d36b36621a9c0f785ebea495c57e975b8a526b67

commit d36b36621a9c0f785ebea495c57e975b8a526b67
Author:     Chandrakanth Patil <[email protected]>
AuthorDate: 2024-03-06 13:20:28 +0000
Commit:     Sumit Saxena <[email protected]>
CommitDate: 2024-03-07 19:16:39 +0000

    if_bnxt: Implementation of Extended Port Hardware Stats Support for THOR 
Controller
    
    The newly added port extended hardware statistics are now accessible to
    users through the sysctl interface. Also, Few obsolete stats are removed
    and few stats are renamed.
    
    Reviewed by:            imp
    Approved by:            imp
    Differential revision:  https://reviews.freebsd.org/D42957
---
 sys/dev/bnxt/bnxt.h           |  20 +-
 sys/dev/bnxt/bnxt_hwrm.c      |  28 ++-
 sys/dev/bnxt/bnxt_hwrm.h      |   1 +
 sys/dev/bnxt/bnxt_sysctl.c    | 457 +++++++++++++++++++++++++++++++-----------
 sys/dev/bnxt/hsi_struct_def.h |   2 +-
 sys/dev/bnxt/if_bnxt.c        |  48 ++++-
 6 files changed, 419 insertions(+), 137 deletions(-)

diff --git a/sys/dev/bnxt/bnxt.h b/sys/dev/bnxt/bnxt.h
index 73122f82c7ad..a5c607dbe247 100644
--- a/sys/dev/bnxt/bnxt.h
+++ b/sys/dev/bnxt/bnxt.h
@@ -671,13 +671,14 @@ struct bnxt_softc {
        struct bnxt_bar_info    hwrm_bar;
        struct bnxt_bar_info    doorbell_bar;
        struct bnxt_link_info   link_info;
-#define BNXT_FLAG_VF           0x0001
-#define BNXT_FLAG_NPAR         0x0002
-#define BNXT_FLAG_WOL_CAP      0x0004
-#define BNXT_FLAG_SHORT_CMD    0x0008
-#define BNXT_FLAG_FW_CAP_NEW_RM 0x0010
-#define BNXT_FLAG_CHIP_P5      0x0020
-#define BNXT_FLAG_TPA          0x0040
+#define BNXT_FLAG_VF                           0x0001
+#define BNXT_FLAG_NPAR                         0x0002
+#define BNXT_FLAG_WOL_CAP                      0x0004
+#define BNXT_FLAG_SHORT_CMD                    0x0008
+#define BNXT_FLAG_FW_CAP_NEW_RM                        0x0010
+#define BNXT_FLAG_CHIP_P5                      0x0020
+#define BNXT_FLAG_TPA                          0x0040
+#define BNXT_FLAG_FW_CAP_EXT_STATS             0x0080
        uint32_t                flags;
 #define BNXT_STATE_LINK_CHANGE  (0)
 #define BNXT_STATE_MAX         (BNXT_STATE_LINK_CHANGE + 1)
@@ -714,6 +715,11 @@ struct bnxt_softc {
        struct rx_port_stats    *rx_port_stats;
        struct tx_port_stats    *tx_port_stats;
 
+       struct iflib_dma_info   hw_tx_port_stats_ext;
+       struct iflib_dma_info   hw_rx_port_stats_ext;
+       struct tx_port_stats_ext *tx_port_stats_ext;
+       struct rx_port_stats_ext *rx_port_stats_ext;
+
        int                     num_cp_rings;
 
        struct bnxt_cp_ring     *nq_rings;
diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c
index 88ba185e2c27..38e6c0db670f 100644
--- a/sys/dev/bnxt/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_hwrm.c
@@ -550,7 +550,7 @@ bnxt_hwrm_passthrough(struct bnxt_softc *softc, void *req, 
uint32_t req_len,
        input->resp_addr = htole64(softc->hwrm_cmd_resp.idi_paddr);
        BNXT_HWRM_LOCK(softc);
        old_timeo = softc->hwrm_cmd_timeo;
-       if (input->req_type == HWRM_NVM_INSTALL_UPDATE) 
+       if (input->req_type == HWRM_NVM_INSTALL_UPDATE)
                softc->hwrm_cmd_timeo = BNXT_NVM_TIMEO;
        else
                softc->hwrm_cmd_timeo = max(app_timeout, softc->hwrm_cmd_timeo);
@@ -694,7 +694,8 @@ bnxt_hwrm_ver_get(struct bnxt_softc *softc)
        softc->hwrm_cmd_timeo = le16toh(resp->def_req_timeout);
        if (!softc->hwrm_cmd_timeo)
                softc->hwrm_cmd_timeo = DFLT_HWRM_CMD_TIMEOUT;
-       
+
+
        dev_caps_cfg = le32toh(resp->dev_caps_cfg);
        if ((dev_caps_cfg & 
HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_SUPPORTED) &&
            (dev_caps_cfg & 
HWRM_VER_GET_OUTPUT_DEV_CAPS_CFG_SHORT_CMD_REQUIRED))
@@ -777,6 +778,9 @@ bnxt_hwrm_func_qcaps(struct bnxt_softc *softc)
        if (resp->flags &
            htole32(HWRM_FUNC_QCAPS_OUTPUT_FLAGS_WOL_MAGICPKT_SUPPORTED))
                softc->flags |= BNXT_FLAG_WOL_CAP;
+       if (resp->flags &
+           htole32(HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED))
+               softc->flags |= BNXT_FLAG_FW_CAP_EXT_STATS;
 
        func->fw_fid = le16toh(resp->fid);
        memcpy(func->mac_addr, resp->mac_address, ETHER_ADDR_LEN);
@@ -1408,6 +1412,26 @@ bnxt_hwrm_port_qstats(struct bnxt_softc *softc)
        return rc;
 }
 
+void
+bnxt_hwrm_port_qstats_ext(struct bnxt_softc *softc)
+{
+       struct hwrm_port_qstats_ext_input req = {0};
+
+       bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_PORT_QSTATS_EXT);
+
+       req.port_id = htole16(softc->pf.port_id);
+       req.tx_stat_size = htole16(sizeof(struct tx_port_stats_ext));
+       req.rx_stat_size = htole16(sizeof(struct rx_port_stats_ext));
+       req.rx_stat_host_addr = htole64(softc->hw_rx_port_stats_ext.idi_paddr);
+       req.tx_stat_host_addr = htole64(softc->hw_tx_port_stats_ext.idi_paddr);
+
+       BNXT_HWRM_LOCK(softc);
+       _hwrm_send_message(softc, &req, sizeof(req));
+       BNXT_HWRM_UNLOCK(softc);
+
+       return;
+}
+
 int
 bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt_softc *softc,
     struct bnxt_vnic_info *vnic)
diff --git a/sys/dev/bnxt/bnxt_hwrm.h b/sys/dev/bnxt/bnxt_hwrm.h
index e016677707ce..6dd015a15d40 100644
--- a/sys/dev/bnxt/bnxt_hwrm.h
+++ b/sys/dev/bnxt/bnxt_hwrm.h
@@ -64,6 +64,7 @@ int bnxt_hwrm_stat_ctx_alloc(struct bnxt_softc *softc, struct 
bnxt_cp_ring *cpr,
     uint64_t paddr);
 int bnxt_hwrm_stat_ctx_free(struct bnxt_softc *softc, struct bnxt_cp_ring 
*cpr);
 int bnxt_hwrm_port_qstats(struct bnxt_softc *softc);
+void bnxt_hwrm_port_qstats_ext(struct bnxt_softc *softc);
 int bnxt_hwrm_ring_grp_alloc(struct bnxt_softc *softc,
     struct bnxt_grp_info *grp);
 int bnxt_hwrm_ring_grp_free(struct bnxt_softc *softc, struct bnxt_grp_info 
*gr);
diff --git a/sys/dev/bnxt/bnxt_sysctl.c b/sys/dev/bnxt/bnxt_sysctl.c
index 971754029afd..09e79a72f68f 100644
--- a/sys/dev/bnxt/bnxt_sysctl.c
+++ b/sys/dev/bnxt/bnxt_sysctl.c
@@ -233,17 +233,17 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            &softc->tx_port_stats->tx_512b_1023b_frames,
            "Transmitted 512b 1023b frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_1024b_1518_frames", CTLFLAG_RD,
+           "tx_1024b_1518b_frames", CTLFLAG_RD,
            &softc->tx_port_stats->tx_1024b_1518b_frames,
-           "Transmitted 1024b 1518 frames");
+           "Transmitted 1024b 1518b frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "tx_good_vlan_frames", CTLFLAG_RD,
            &softc->tx_port_stats->tx_good_vlan_frames,
            "Transmitted good vlan frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_1519b_2047_frames", CTLFLAG_RD,
+           "tx_1519b_2047b_frames", CTLFLAG_RD,
            &softc->tx_port_stats->tx_1519b_2047b_frames,
-           "Transmitted 1519b 2047 frames");
+           "Transmitted 1519b 2047b frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "tx_2048b_4095b_frames", CTLFLAG_RD,
            &softc->tx_port_stats->tx_2048b_4095b_frames,
@@ -284,53 +284,9 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            "tx_fcs_err_frames", CTLFLAG_RD,
            &softc->tx_port_stats->tx_fcs_err_frames,
            "Transmitted fcs err frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_control_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_control_frames,
-           "Transmitted control frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_oversz_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_oversz_frames, "Transmitted oversz 
frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_single_dfrl_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_single_dfrl_frames,
-           "Transmitted single dfrl frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_multi_dfrl_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_multi_dfrl_frames,
-           "Transmitted multi dfrl frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_single_coll_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_single_coll_frames,
-           "Transmitted single coll frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_multi_coll_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_multi_coll_frames,
-           "Transmitted multi coll frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_late_coll_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_late_coll_frames,
-           "Transmitted late coll frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_excessive_coll_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_excessive_coll_frames,
-           "Transmitted excessive coll frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_frag_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_frag_frames, "Transmitted frag frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "tx_err", CTLFLAG_RD,
            &softc->tx_port_stats->tx_err, "Transmitted err");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_tagged_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_tagged_frames, "Transmitted tagged 
frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_dbl_tagged_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_dbl_tagged_frames,
-           "Transmitted dbl tagged frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "tx_runt_frames", CTLFLAG_RD,
-           &softc->tx_port_stats->tx_runt_frames, "Transmitted runt frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "tx_fifo_underruns", CTLFLAG_RD,
            &softc->tx_port_stats->tx_fifo_underruns,
@@ -417,7 +373,7 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            &softc->rx_port_stats->rx_512b_1023b_frames,
            "Received 512b 1023b frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_1024b_1518_frames", CTLFLAG_RD,
+           "rx_1024b_1518b_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_1024b_1518b_frames,
            "Received 1024b 1518 frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
@@ -464,34 +420,10 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_pfc_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_pfc_frames, "Received pfc frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_unsupported_opcode_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_unsupported_opcode_frames,
-           "Received unsupported opcode frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_unsupported_da_pausepfc_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_unsupported_da_pausepfc_frames,
-           "Received unsupported da pausepfc frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_wrong_sa_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_wrong_sa_frames,
-           "Received wrong sa frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_align_err_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_align_err_frames,
            "Received align err frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_oor_len_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_oor_len_frames,
-           "Received oor len frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_code_err_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_code_err_frames,
-           "Received code err frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_false_carrier_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_false_carrier_frames,
-           "Received false carrier frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_ovrsz_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_ovrsz_frames,
@@ -504,14 +436,6 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            "rx_mtu_err_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_mtu_err_frames,
            "Received mtu err frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_match_crc_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_match_crc_frames,
-           "Received match crc frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_promiscuous_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_promiscuous_frames,
-           "Received promiscuous frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_tagged_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_tagged_frames,
@@ -520,46 +444,10 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            "rx_double_tagged_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_double_tagged_frames,
            "Received double tagged frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_trunc_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_trunc_frames,
-           "Received trunc frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_good_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_good_frames,
            "Received good frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri0", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri0,
-           "Received pfc xon2xoff frames pri0");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri1", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri1,
-           "Received pfc xon2xoff frames pri1");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri2", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri2,
-           "Received pfc xon2xoff frames pri2");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri3", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri3,
-           "Received pfc xon2xoff frames pri3");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri4", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri4,
-           "Received pfc xon2xoff frames pri4");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri5", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri5,
-           "Received pfc xon2xoff frames pri5");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri6", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri6,
-           "Received pfc xon2xoff frames pri6");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_pfc_xon2xoff_frames_pri7", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_pfc_xon2xoff_frames_pri7,
-           "Received pfc xon2xoff frames pri7");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_pfc_ena_frames_pri0", CTLFLAG_RD,
            &softc->rx_port_stats->rx_pfc_ena_frames_pri0,
@@ -599,9 +487,6 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_undrsz_frames", CTLFLAG_RD,
            &softc->rx_port_stats->rx_undrsz_frames, "Received undrsz frames");
-       SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
-           "rx_frag_frames", CTLFLAG_RD,
-           &softc->rx_port_stats->rx_frag_frames, "Received frag frames");
        SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), OID_AUTO,
            "rx_eee_lpi_events", CTLFLAG_RD,
            &softc->rx_port_stats->rx_eee_lpi_events, "Received eee lpi 
events");
@@ -644,6 +529,338 @@ bnxt_create_port_stats_sysctls(struct bnxt_softc *softc)
            "rx_stat_err", CTLFLAG_RD,
            &softc->rx_port_stats->rx_stat_err, "Received stat err");
 
+       if (BNXT_CHIP_P5(softc) &&
+           (softc->flags & BNXT_FLAG_FW_CAP_EXT_STATS)) {
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos0", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos0, "Transmitted 
bytes count cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos0", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos0, "Transmitted 
packets count cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos1", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos1, "Transmitted 
bytes count cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos1", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos1, "Transmitted 
packets count cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos2", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos2, "Transmitted 
bytes count cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos2", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos2, "Transmitted 
packets count cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos3", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos3, "Transmitted 
bytes count cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos3", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos3, "Transmitted 
packets count cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos4", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos4, "Transmitted 
bytes count cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos4", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos4, "Transmitted 
packets count cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos5", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos5, "Transmitted 
bytes count cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos5", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos5, "Transmitted 
packets count cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos6", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos6, "Transmitted 
bytes count cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos6", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos6, "Transmitted 
packets count cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_bytes_cos7", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_bytes_cos7, "Transmitted 
bytes count cos7");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "tx_packets_cos7", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->tx_packets_cos7, "Transmitted 
packets count cos7");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri0_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri0_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri0_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri0_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri1_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri1_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri1_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri1_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri2_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri2_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri2_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri2_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri3_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri3_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri3_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri3_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri4_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri4_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri4_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri4_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri5_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri5_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri5_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri5_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri6_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri6_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri6_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri6_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri7_tx_duration_us", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri7_tx_duration_us, "Time 
duration between"
+                   "XON to XOFF and XOFF to XON for pri7");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri7_tx_transitions", CTLFLAG_RD,
+                   &softc->tx_port_stats_ext->pfc_pri7_tx_transitions, "Num 
times transition"
+                   "between XON to XOFF and XOFF to XON for pri7");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "link_down_events", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->link_down_events, "Num times 
link states down");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "continuous_pause_events", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->continuous_pause_events, "Num 
times pause events");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "resume_pause_events", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->resume_pause_events, "Num times 
pause events"
+                   "resumes");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "continuous_roce_pause_events", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->continuous_roce_pause_events, 
"Num times roce"
+                   "pause events");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "resume_roce_pause_events", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->resume_roce_pause_events, "Num 
times roce pause"
+                   "events resumes");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos0", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos0, "Received bytes 
count cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos0", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos0, "Received 
packets count cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos1", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos1, "Received bytes 
count cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos1", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos1, "Received 
packets count cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos2", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos2, "Received bytes 
count cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos2", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos2, "Received 
packets count cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos3", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos3, "Received bytes 
count cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos3", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos3, "Received 
packets count cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos4", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos4, "Received bytes 
count cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos4", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos4, "Received 
packets count cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos5", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos5, "Received bytes 
count cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos5", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos5, "Received 
packets count cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos6", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos6, "Received bytes 
count cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos6", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos6, "Received 
packets count cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bytes_cos7", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bytes_cos7, "Received bytes 
count cos7");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_packets_cos7", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_packets_cos7, "Received 
packets count cos7");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri0_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri0_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri0_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri0_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri1_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri1_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri1_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri1_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri2_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri2_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri2_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri2_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri3_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri3_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri3_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri3_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri4_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri4_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri4_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri4_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri5_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri5_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri5_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri5_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri6_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri6_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri6_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri6_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri7_rx_duration_us", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri7_rx_duration_us, "Time 
duration in receiving"
+                   "between XON to XOFF and XOFF to XON for pri7");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "pfc_pri7_rx_transitions", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->pfc_pri7_rx_transitions, "Num 
times rx transition"
+                   "between XON to XOFF and XOFF to XON for pri7");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_bits", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_bits, "total number of 
received bits");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_buffer_passed_threshold", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_buffer_passed_threshold, "num 
of events port"
+                   "buffer"
+                   "was over 85%");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_pcs_symbol_err", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_pcs_symbol_err, "num of 
symbol errors wasn't"
+                   "corrected by FEC");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_corrected_bits", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_corrected_bits, "num of bits 
corrected by FEC");
+
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos0", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos0, "num of 
rx discard bytes"
+                   "count on cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos0", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos0, "num of 
rx discard packets"
+                   "count on cos0");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos1", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos1, "num of 
rx discard bytes"
+                   "count on cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos1", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos1, "num of 
rx discard packets"
+                   "count on cos1");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos2", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos2, "num of 
rx discard bytes"
+                   "count on cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos2", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos2, "num of 
rx discard packets"
+                   "count on cos2");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos3", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos3, "num of 
rx discard bytes"
+                   "count on cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos3", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos3, "num of 
rx discard packets"
+                   "count on cos3");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos4", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos4, "num of 
rx discard bytes"
+                   "count on cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos4", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos4, "num of 
rx discard packets"
+                   "count on cos4");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos5", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos5, "num of 
rx discard bytes"
+                   "count on cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos5", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos5, "num of 
rx discard packets"
+                   "count on cos5");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos6", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos6, "num of 
rx discard bytes"
+                   "count on cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos6", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos6, "num of 
rx discard packets"
+                   "count on cos6");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_bytes_cos7", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_bytes_cos7, "num of 
rx discard bytes"
+                   "count on cos7");
+               SYSCTL_ADD_QUAD(&softc->hw_stats, SYSCTL_CHILDREN(oid), 
OID_AUTO,
+                   "rx_discard_packets_cos7", CTLFLAG_RD,
+                   &softc->rx_port_stats_ext->rx_discard_packets_cos7, "num of 
rx discard packets"
+                   "count on cos7");
+       }
+
+
        return 0;
 }
 
diff --git a/sys/dev/bnxt/hsi_struct_def.h b/sys/dev/bnxt/hsi_struct_def.h
index d2097ca1ca33..12b112c42ca7 100644
--- a/sys/dev/bnxt/hsi_struct_def.h
+++ b/sys/dev/bnxt/hsi_struct_def.h
@@ -800,7 +800,7 @@ typedef struct cmd_nums {
        #define HWRM_FUNC_VLAN_QCFG                     UINT32_C(0x34)
        #define HWRM_QUEUE_PFCENABLE_QCFG               UINT32_C(0x35)
        #define HWRM_QUEUE_PFCENABLE_CFG                UINT32_C(0x36)
-       #define HWRM_QUEUE_PRI2COS_QCFG         UINT32_C(0x37)
+       #define HWRM_QUEUE_PRI2COS_QCFG                 UINT32_C(0x37)
        #define HWRM_QUEUE_PRI2COS_CFG                  UINT32_C(0x38)
        #define HWRM_QUEUE_COS2BW_QCFG                  UINT32_C(0x39)
        #define HWRM_QUEUE_COS2BW_CFG                   UINT32_C(0x3a)
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index 238c0729cdaf..e4a14aa954f5 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -499,6 +499,8 @@ bnxt_queues_free(if_ctx_t ctx)
                iflib_dma_free(&softc->rx_stats[i]);
        iflib_dma_free(&softc->hw_tx_port_stats);
        iflib_dma_free(&softc->hw_rx_port_stats);
+       iflib_dma_free(&softc->hw_tx_port_stats_ext);
+       iflib_dma_free(&softc->hw_rx_port_stats_ext);
        free(softc->grp_info, M_DEVBUF);
        free(softc->ag_rings, M_DEVBUF);
        free(softc->rx_rings, M_DEVBUF);
@@ -573,9 +575,9 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
        bus_dmamap_sync(softc->hw_rx_port_stats.idi_tag,
             softc->hw_rx_port_stats.idi_map, BUS_DMASYNC_PREREAD);
 
+
        rc = iflib_dma_alloc(ctx, sizeof(struct tx_port_stats) + 
BNXT_PORT_STAT_PADDING,
            &softc->hw_tx_port_stats, 0);
-
        if (rc)
                goto hw_port_tx_stats_alloc_fail;
 
@@ -585,6 +587,26 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
        softc->rx_port_stats = (void *) softc->hw_rx_port_stats.idi_vaddr;
        softc->tx_port_stats = (void *) softc->hw_tx_port_stats.idi_vaddr;
 
+
+       rc = iflib_dma_alloc(ctx, sizeof(struct rx_port_stats_ext),
+               &softc->hw_rx_port_stats_ext, 0);
+       if (rc)
+               goto hw_port_rx_stats_ext_alloc_fail;
+
+       bus_dmamap_sync(softc->hw_rx_port_stats_ext.idi_tag,
+           softc->hw_rx_port_stats_ext.idi_map, BUS_DMASYNC_PREREAD);
+
+       rc = iflib_dma_alloc(ctx, sizeof(struct tx_port_stats_ext),
+               &softc->hw_tx_port_stats_ext, 0);
+       if (rc)
+               goto hw_port_tx_stats_ext_alloc_fail;
+
+       bus_dmamap_sync(softc->hw_tx_port_stats_ext.idi_tag,
+           softc->hw_tx_port_stats_ext.idi_map, BUS_DMASYNC_PREREAD);
+
+       softc->rx_port_stats_ext = (void *) 
softc->hw_rx_port_stats_ext.idi_vaddr;
+       softc->tx_port_stats_ext = (void *) 
softc->hw_tx_port_stats_ext.idi_vaddr;
+
        for (i = 0; i < nrxqsets; i++) {
                /* Allocation the completion ring */
                softc->rx_cp_rings[i].stats_ctx_id = HWRM_NA_SIGNATURE;
@@ -653,7 +675,7 @@ bnxt_rx_queues_alloc(if_ctx_t ctx, caddr_t *vaddrs,
          * HWRM every sec with which firmware timeouts can happen
          */
        if (BNXT_PF(softc))
-               bnxt_create_port_stats_sysctls(softc);
+               bnxt_create_port_stats_sysctls(softc);
 
        /* And finally, the VNIC */
        softc->vnic_info.id = (uint16_t)HWRM_NA_SIGNATURE;
@@ -699,16 +721,24 @@ rss_grp_alloc_fail:
        iflib_dma_free(&softc->vnic_info.rss_hash_key_tbl);
 rss_hash_alloc_fail:
        iflib_dma_free(&softc->vnic_info.mc_list);
-tpa_alloc_fail:
 mc_list_alloc_fail:
-       for (i = i - 1; i >= 0; i--)
-               free(softc->rx_rings[i].tpa_start, M_DEVBUF);
+       for (i = i - 1; i >= 0; i--) {
+               if (softc->rx_rings[i].tpa_start)
+                       free(softc->rx_rings[i].tpa_start, M_DEVBUF);
+       }
+tpa_alloc_fail:
+       iflib_dma_free(&softc->hw_tx_port_stats_ext);
+hw_port_tx_stats_ext_alloc_fail:
+       iflib_dma_free(&softc->hw_rx_port_stats_ext);
+hw_port_rx_stats_ext_alloc_fail:
        iflib_dma_free(&softc->hw_tx_port_stats);
 hw_port_tx_stats_alloc_fail:
        iflib_dma_free(&softc->hw_rx_port_stats);
 hw_port_rx_stats_alloc_fail:
-       for (i = i - 1; i >= 0; i--)
-               iflib_dma_free(&softc->rx_stats[i]);
+       for (i=0; i < nrxqsets; i++) {
+               if (softc->rx_stats[i].idi_vaddr)
+                       iflib_dma_free(&softc->rx_stats[i]);
+       }
 hw_stats_alloc_fail:
        free(softc->grp_info, M_DEVBUF);
 grp_alloc_fail:
@@ -2207,6 +2237,10 @@ bnxt_update_admin_status(if_ctx_t ctx)
 
        bnxt_hwrm_port_qstats(softc);
 
+       if (BNXT_CHIP_P5(softc) &&
+           (softc->flags & BNXT_FLAG_FW_CAP_EXT_STATS))
+               bnxt_hwrm_port_qstats_ext(softc);
+
        if (BNXT_CHIP_P5(softc)) {
                struct ifmediareq ifmr;
 

Reply via email to