From owner-svn-src-all@freebsd.org Thu May 25 00:16:43 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01FE7D7BEF8; Thu, 25 May 2017 00:16:43 +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 mx1.freebsd.org (Postfix) with ESMTPS id B445F1346; Thu, 25 May 2017 00:16:42 +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 v4P0GffD099544; Thu, 25 May 2017 00:16:41 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4P0GfcJ099541; Thu, 25 May 2017 00:16:41 GMT (envelope-from np@FreeBSD.org) Message-Id: <201705250016.v4P0GfcJ099541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 25 May 2017 00:16:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r318840 - in stable/10/sys/dev/cxgbe: . common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 May 2017 00:16:43 -0000 Author: np Date: Thu May 25 00:16:41 2017 New Revision: 318840 URL: https://svnweb.freebsd.org/changeset/base/318840 Log: MFC r316971: cxgbe: Add a tunable to configure the SGE time scaler, which is available starting with T6. The values in the timer holdoff registers are multiplied by the scaling factor before use. dev...holdoff_timers shows the final values of the timers in microseconds. Sponsored by: Chelsio Communications Modified: stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/common/t4_hw.c stable/10/sys/dev/cxgbe/t4_sge.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Thu May 25 00:16:01 2017 (r318839) +++ stable/10/sys/dev/cxgbe/common/common.h Thu May 25 00:16:41 2017 (r318840) @@ -210,7 +210,7 @@ struct tp_rdma_stats { }; struct sge_params { - int timer_val[SGE_NTIMERS]; + int timer_val[SGE_NTIMERS]; /* final, scaled values */ int counter_val[SGE_NCOUNTERS]; int fl_starve_threshold; int fl_starve_threshold2; Modified: stable/10/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- stable/10/sys/dev/cxgbe/common/t4_hw.c Thu May 25 00:16:01 2017 (r318839) +++ stable/10/sys/dev/cxgbe/common/t4_hw.c Thu May 25 00:16:41 2017 (r318840) @@ -7904,7 +7904,7 @@ int t4_init_sge_params(struct adapter *a { u32 r; struct sge_params *sp = &adapter->params.sge; - unsigned i; + unsigned i, tscale = 1; r = t4_read_reg(adapter, A_SGE_INGRESS_RX_THRESHOLD); sp->counter_val[0] = G_THRESHOLD_0(r); @@ -7912,15 +7912,24 @@ int t4_init_sge_params(struct adapter *a sp->counter_val[2] = G_THRESHOLD_2(r); sp->counter_val[3] = G_THRESHOLD_3(r); + if (chip_id(adapter) >= CHELSIO_T6) { + r = t4_read_reg(adapter, A_SGE_ITP_CONTROL); + tscale = G_TSCALE(r); + if (tscale == 0) + tscale = 1; + else + tscale += 2; + } + r = t4_read_reg(adapter, A_SGE_TIMER_VALUE_0_AND_1); - sp->timer_val[0] = core_ticks_to_us(adapter, G_TIMERVALUE0(r)); - sp->timer_val[1] = core_ticks_to_us(adapter, G_TIMERVALUE1(r)); + sp->timer_val[0] = core_ticks_to_us(adapter, G_TIMERVALUE0(r)) * tscale; + sp->timer_val[1] = core_ticks_to_us(adapter, G_TIMERVALUE1(r)) * tscale; r = t4_read_reg(adapter, A_SGE_TIMER_VALUE_2_AND_3); - sp->timer_val[2] = core_ticks_to_us(adapter, G_TIMERVALUE2(r)); - sp->timer_val[3] = core_ticks_to_us(adapter, G_TIMERVALUE3(r)); + sp->timer_val[2] = core_ticks_to_us(adapter, G_TIMERVALUE2(r)) * tscale; + sp->timer_val[3] = core_ticks_to_us(adapter, G_TIMERVALUE3(r)) * tscale; r = t4_read_reg(adapter, A_SGE_TIMER_VALUE_4_AND_5); - sp->timer_val[4] = core_ticks_to_us(adapter, G_TIMERVALUE4(r)); - sp->timer_val[5] = core_ticks_to_us(adapter, G_TIMERVALUE5(r)); + sp->timer_val[4] = core_ticks_to_us(adapter, G_TIMERVALUE4(r)) * tscale; + sp->timer_val[5] = core_ticks_to_us(adapter, G_TIMERVALUE5(r)) * tscale; r = t4_read_reg(adapter, A_SGE_CONM_CTRL); sp->fl_starve_threshold = G_EGRTHRESHOLD(r) * 2 + 1; Modified: stable/10/sys/dev/cxgbe/t4_sge.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_sge.c Thu May 25 00:16:01 2017 (r318839) +++ stable/10/sys/dev/cxgbe/t4_sge.c Thu May 25 00:16:41 2017 (r318840) @@ -149,6 +149,13 @@ TUNABLE_INT("hw.cxgbe.largest_rx_cluster static int safest_rx_cluster = PAGE_SIZE; TUNABLE_INT("hw.cxgbe.safest_rx_cluster", &safest_rx_cluster); +/* + * The interrupt holdoff timers are multiplied by this value on T6+. + * 1 and 3-17 (both inclusive) are legal values. + */ +static int tscale = 1; +TUNABLE_INT("hw.cxgbe.tscale", &tscale); + struct txpkts { u_int wr_type; /* type 0 or type 1 */ u_int npkt; /* # of packets in this work request */ @@ -390,6 +397,12 @@ t4_sge_modload(void) cong_drop = 0; } + if (tscale != 1 && (tscale < 3 || tscale > 17)) { + printf("Invalid hw.cxgbe.tscale value (%d)," + " using 1 instead.\n", tscale); + tscale = 1; + } + extfree_refs = counter_u64_alloc(M_WAITOK); extfree_rels = counter_u64_alloc(M_WAITOK); counter_u64_zero(extfree_refs); @@ -582,6 +595,15 @@ t4_tweak_chip_settings(struct adapter *s V_TIMERVALUE5(us_to_core_ticks(sc, intr_timer[5])); t4_write_reg(sc, A_SGE_TIMER_VALUE_4_AND_5, v); + if (chip_id(sc) >= CHELSIO_T6) { + m = V_TSCALE(M_TSCALE); + if (tscale == 1) + v = 0; + else + v = V_TSCALE(tscale - 2); + t4_set_reg_field(sc, A_SGE_ITP_CONTROL, m, v); + } + /* 4K, 16K, 64K, 256K DDP "page sizes" */ v = V_HPZ0(0) | V_HPZ1(2) | V_HPZ2(4) | V_HPZ3(6); t4_write_reg(sc, A_ULP_RX_TDDP_PSZ, v);