From owner-svn-src-all@freebsd.org Fri Oct 23 01:36:55 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84EF3438301; Fri, 23 Oct 2020 01:36:55 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CHRfb2x0kz4jT9; Fri, 23 Oct 2020 01:36:55 +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 442AE1FEB7; Fri, 23 Oct 2020 01:36:55 +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 09N1at6Z045275; Fri, 23 Oct 2020 01:36:55 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09N1at21045274; Fri, 23 Oct 2020 01:36:55 GMT (envelope-from np@FreeBSD.org) Message-Id: <202010230136.09N1at21045274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 23 Oct 2020 01:36:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366958 - 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: 366958 X-SVN-Commit-Repository: base 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.33 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: Fri, 23 Oct 2020 01:36:55 -0000 Author: np Date: Fri Oct 23 01:36:54 2020 New Revision: 366958 URL: https://svnweb.freebsd.org/changeset/base/366958 Log: cxgbe(4): refine the values reported in if_ratelimit_query. - Get the number of classes from chip_params. - Get the number of ethofld tids from the firmware. - Do not let tcp_ratelimit allocate all traffic classes. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_sched.c Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:06:42 2020 (r366957) +++ head/sys/dev/cxgbe/t4_sched.c Fri Oct 23 01:36:54 2020 (r366958) @@ -903,34 +903,46 @@ cxgbe_rate_tag_free(struct m_snd_tag *mst) mtx_unlock(&cst->lock); } -#define CXGBE_MAX_FLOWS 4000 /* Testing show so far thats all this adapter can do */ -#define CXGBE_UNIQUE_RATE_COUNT 16 /* Number of unique rates that can be setup */ - void -cxgbe_ratelimit_query(struct ifnet *ifp __unused, - struct if_ratelimit_query_results *q) +cxgbe_ratelimit_query(struct ifnet *ifp, struct if_ratelimit_query_results *q) { - /* - * This is a skeleton and needs future work - * by the driver supporters. It should be - * enhanced to look at the specific type of - * interface and select approprate values - * for these settings. This example goes - * with an earlier card (t5), it has a maximum - * number of 16 rates that the first guys in - * select (thus the flags value RT_IS_SELECTABLE). - * If it was a fixed table then we would setup a - * const array (example mlx5). Note the card tested - * can only support reasonably 4000 flows before - * the adapter has issues with sending so here - * we limit the number of flows using hardware - * pacing to that number, other cards may - * be able to raise or eliminate this limit. - */ + struct vi_info *vi = ifp->if_softc; + struct adapter *sc = vi->adapter; + q->rate_table = NULL; q->flags = RT_IS_SELECTABLE; - q->max_flows = CXGBE_MAX_FLOWS; - q->number_of_rates = CXGBE_UNIQUE_RATE_COUNT; - q->min_segment_burst = 4; /* Driver emits 4 in a burst */ + /* + * Absolute max limits from the firmware configuration. Practical + * limits depend on the burstsize, pktsize (ifp->if_mtu ultimately) and + * the card's cclk. + */ + q->max_flows = sc->tids.netids; + q->number_of_rates = sc->chip_params->nsched_cls; + q->min_segment_burst = 4; /* matches PKTSCHED_BURST in the firmware. */ + +#if 1 + if (chip_id(sc) < CHELSIO_T6) { + /* Based on testing by rrs@ with a T580 at burstsize = 4. */ + MPASS(q->min_segment_burst == 4); + q->max_flows = max(4000, q->max_flows); + } else { + /* XXX: TBD, carried forward from T5 for now. */ + q->max_flows = max(4000, q->max_flows); + } + + /* + * XXX: tcp_ratelimit.c grabs all available rates on link-up before it + * even knows whether hw pacing will be used or not. This prevents + * other consumers like SO_MAX_PACING_RATE or those using cxgbetool or + * the private ioctls from using any of traffic classes. + * + * Underreport the number of rates to tcp_ratelimit so that it doesn't + * hog all of them. This can be removed if/when tcp_ratelimit switches + * to making its allocations on first-use rather than link-up. There is + * nothing wrong with one particular consumer reserving all the classes + * but it should do so only if it'll actually use hw rate limiting. + */ + q->number_of_rates /= 4; +#endif } #endif