Author: np
Date: Tue Sep 22 03:06:36 2020
New Revision: 365991
URL: https://svnweb.freebsd.org/changeset/base/365991

Log:
  cxgbe(4): add counters for mbuf pullups and defrags.
  
  MFC after:    3 days
  Sponsored by: Chelsio Communications

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

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Tue Sep 22 02:22:37 2020        (r365990)
+++ head/sys/dev/cxgbe/t4_sge.c Tue Sep 22 03:06:36 2020        (r365991)
@@ -204,6 +204,15 @@ static int lro_mbufs = 0;
 SYSCTL_INT(_hw_cxgbe, OID_AUTO, lro_mbufs, CTLFLAG_RDTUN, &lro_mbufs, 0,
     "Enable presorting of LRO frames");
 
+static counter_u64_t pullups;
+SYSCTL_COUNTER_U64(_hw_cxgbe, OID_AUTO, pullups, CTLFLAG_RD, &pullups,
+    "Number of mbuf pullups performed");
+
+static counter_u64_t defrags;
+SYSCTL_COUNTER_U64(_hw_cxgbe, OID_AUTO, defrags, CTLFLAG_RD, &defrags,
+    "Number of mbuf defrags performed");
+
+
 static int service_iq(struct sge_iq *, int);
 static int service_iq_fl(struct sge_iq *, int);
 static struct mbuf *get_fl_payload(struct adapter *, struct sge_fl *, 
uint32_t);
@@ -535,8 +544,12 @@ t4_sge_modload(void)
 
        extfree_refs = counter_u64_alloc(M_WAITOK);
        extfree_rels = counter_u64_alloc(M_WAITOK);
+       pullups = counter_u64_alloc(M_WAITOK);
+       defrags = counter_u64_alloc(M_WAITOK);
        counter_u64_zero(extfree_refs);
        counter_u64_zero(extfree_rels);
+       counter_u64_zero(pullups);
+       counter_u64_zero(defrags);
 
        t4_init_shared_cpl_handlers();
        t4_register_cpl_handler(CPL_FW4_MSG, handle_fw_msg);
@@ -556,6 +569,8 @@ t4_sge_modunload(void)
 
        counter_u64_free(extfree_refs);
        counter_u64_free(extfree_rels);
+       counter_u64_free(pullups);
+       counter_u64_free(defrags);
 }
 
 uint64_t
@@ -2714,16 +2729,22 @@ restart:
        }
 #endif
        if (nsegs > max_nsegs_allowed(m0)) {
-               if (defragged++ > 0 || (m = m_defrag(m0, M_NOWAIT)) == NULL) {
+               if (defragged++ > 0) {
                        rc = EFBIG;
                        goto fail;
                }
+               counter_u64_add(defrags, 1);
+               if ((m = m_defrag(m0, M_NOWAIT)) == NULL) {
+                       rc = ENOMEM;
+                       goto fail;
+               }
                *mp = m0 = m;   /* update caller's copy after defrag */
                goto restart;
        }
 
        if (__predict_false(nsegs > 2 && m0->m_pkthdr.len <= MHLEN &&
            !(cflags & MC_NOMAP))) {
+               counter_u64_add(pullups, 1);
                m0 = m_pullup(m0, m0->m_pkthdr.len);
                if (m0 == NULL) {
                        /* Should have left well enough alone. */
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to