From owner-svn-src-head@freebsd.org Fri Jun 15 21:23:04 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B45E2101D2E7; Fri, 15 Jun 2018 21:23:04 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 698C3844B3; Fri, 15 Jun 2018 21:23:04 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB1A1CF5F; Fri, 15 Jun 2018 21:23:04 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w5FLN4V6069035; Fri, 15 Jun 2018 21:23:04 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w5FLN4Zt069034; Fri, 15 Jun 2018 21:23:04 GMT (envelope-from np@FreeBSD.org) Message-Id: <201806152123.w5FLN4Zt069034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 15 Jun 2018 21:23:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335241 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 335241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jun 2018 21:23:05 -0000 Author: np Date: Fri Jun 15 21:23:03 2018 New Revision: 335241 URL: https://svnweb.freebsd.org/changeset/base/335241 Log: cxgbe(4): Track the number of received frames separately from the number of descriptors processed. Add the ability to gather a certain maximum number of frames in the driver's rx before waking up netmap rx. If there aren't enough frames then netmap rx will be woken up as usual. hw.cxgbe.nm_rx_nframes Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Fri Jun 15 21:07:14 2018 (r335240) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Jun 15 21:23:03 2018 (r335241) @@ -72,6 +72,10 @@ int rx_ndesc = 256; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_rx_ndesc, CTLFLAG_RWTUN, &rx_ndesc, 0, "# of rx descriptors after which the hw cidx is updated."); +int rx_nframes = 64; +SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_rx_nframes, CTLFLAG_RWTUN, + &rx_nframes, 0, "max # of frames received before waking up netmap rx."); + int holdoff_tmr_idx = 2; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_holdoff_tmr_idx, CTLFLAG_RWTUN, &holdoff_tmr_idx, 0, "Holdoff timer index for netmap rx queues."); @@ -938,10 +942,12 @@ t4_nm_intr(void *arg) struct iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx]; const void *cpl; uint32_t lq; - u_int n = 0, work = 0; + u_int work = 0; uint8_t opcode; uint32_t fl_cidx = atomic_load_acq_32(&nm_rxq->fl_cidx); u_int fl_credits = fl_cidx & 7; + u_int ndesc = 0; /* desc processed since last cidx update */ + u_int nframes = 0; /* frames processed since last netmap wakeup */ while ((d->rsp.u.type_gen & F_RSPD_GEN) == nm_rxq->iq_gen) { @@ -953,10 +959,6 @@ t4_nm_intr(void *arg) switch (G_RSPD_TYPE(d->rsp.u.type_gen)) { case X_RSPD_TYPE_FLBUF: - if (black_hole != 2) { - /* No buffer packing so new buf every time */ - MPASS(lq & F_RSPD_NEWBUF); - } /* fall through */ @@ -975,9 +977,13 @@ t4_nm_intr(void *arg) ring->slot[fl_cidx].len = G_RSPD_LEN(lq) - sc->params.sge.fl_pktshift; ring->slot[fl_cidx].flags = 0; - fl_cidx += (lq & F_RSPD_NEWBUF) ? 1 : 0; - fl_credits += (lq & F_RSPD_NEWBUF) ? 1 : 0; - if (__predict_false(fl_cidx == nm_rxq->fl_sidx)) + nframes++; + if (!(lq & F_RSPD_NEWBUF)) { + MPASS(black_hole == 2); + break; + } + fl_credits++; + if (__predict_false(++fl_cidx == nm_rxq->fl_sidx)) fl_cidx = 0; break; default: @@ -1003,8 +1009,13 @@ t4_nm_intr(void *arg) nm_rxq->iq_gen ^= F_RSPD_GEN; } - if (__predict_false(++n == rx_ndesc)) { + if (__predict_false(++nframes == rx_nframes) && !black_hole) { atomic_store_rel_32(&nm_rxq->fl_cidx, fl_cidx); + netmap_rx_irq(ifp, nm_rxq->nid, &work); + nframes = 0; + } + + if (__predict_false(++ndesc == rx_ndesc)) { if (black_hole && fl_credits >= 8) { fl_credits /= 8; IDXINCR(nm_rxq->fl_pidx, fl_credits * 8, @@ -1012,14 +1023,12 @@ t4_nm_intr(void *arg) t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(fl_credits)); fl_credits = fl_cidx & 7; - } else if (!black_hole) { - netmap_rx_irq(ifp, nm_rxq->nid, &work); - MPASS(work != 0); } t4_write_reg(sc, sc->sge_gts_reg, - V_CIDXINC(n) | V_INGRESSQID(nm_rxq->iq_cntxt_id) | + V_CIDXINC(ndesc) | + V_INGRESSQID(nm_rxq->iq_cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(X_TIMERREG_UPDATE_CIDX))); - n = 0; + ndesc = 0; } } @@ -1029,10 +1038,10 @@ t4_nm_intr(void *arg) IDXINCR(nm_rxq->fl_pidx, fl_credits * 8, nm_rxq->fl_sidx); t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(fl_credits)); - } else + } else if (nframes > 0) netmap_rx_irq(ifp, nm_rxq->nid, &work); - t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(n) | + t4_write_reg(sc, sc->sge_gts_reg, V_CIDXINC(ndesc) | V_INGRESSQID((u32)nm_rxq->iq_cntxt_id) | V_SEINTARM(V_QINTR_TIMER_IDX(holdoff_tmr_idx))); }