Author: np
Date: Sun Sep 11 17:57:53 2016
New Revision: 305703
URL: https://svnweb.freebsd.org/changeset/base/305703

Log:
  cxgbe(4): Deal with the slightly different SGE_STAT_CFG in T6.
  
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c        Sun Sep 11 17:51:17 2016        
(r305702)
+++ head/sys/dev/cxgbe/t4_main.c        Sun Sep 11 17:57:53 2016        
(r305703)
@@ -2027,11 +2027,11 @@ t4_map_bar_2(struct adapter *sc)
        }
        sc->udbs_base = rman_get_virtual(sc->udbs_res);
 
-       if (is_t5(sc)) {
+       if (chip_id(sc) >= CHELSIO_T5) {
                setbit(&sc->doorbells, DOORBELL_UDB);
 #if defined(__i386__) || defined(__amd64__)
                if (t5_write_combine) {
-                       int rc;
+                       int rc, mode;
 
                        /*
                         * Enable write combining on BAR2.  This is the
@@ -2054,8 +2054,9 @@ t4_map_bar_2(struct adapter *sc)
                                    rc);
                        }
 
+                       mode = is_t5(sc) ? V_STATMODE(0) : V_T6_STATMODE(0);
                        t4_write_reg(sc, A_SGE_STAT_CFG,
-                           V_STATSOURCE_T5(7) | V_STATMODE(0));
+                           V_STATSOURCE_T5(7) | mode);
                }
 #endif
        }
@@ -7472,6 +7473,8 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS)
        struct sbuf *sb;
        int rc, v;
 
+       MPASS(chip_id(sc) >= CHELSIO_T5);
+
        rc = sysctl_wire_old_buffer(req, 0);
        if (rc != 0)
                return (rc);
@@ -7482,14 +7485,19 @@ sysctl_wcwr_stats(SYSCTL_HANDLER_ARGS)
 
        v = t4_read_reg(sc, A_SGE_STAT_CFG);
        if (G_STATSOURCE_T5(v) == 7) {
-               if (G_STATMODE(v) == 0) {
+               int mode;
+
+               mode = is_t5(sc) ? G_STATMODE(v) : G_T6_STATMODE(v);
+               if (mode == 0) {
                        sbuf_printf(sb, "total %d, incomplete %d",
                            t4_read_reg(sc, A_SGE_STAT_TOTAL),
                            t4_read_reg(sc, A_SGE_STAT_MATCH));
-               } else if (G_STATMODE(v) == 1) {
+               } else if (mode == 1) {
                        sbuf_printf(sb, "total %d, data overflow %d",
                            t4_read_reg(sc, A_SGE_STAT_TOTAL),
                            t4_read_reg(sc, A_SGE_STAT_MATCH));
+               } else {
+                       sbuf_printf(sb, "unknown mode %d", mode);
                }
        }
        rc = sbuf_finish(sb);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to