From owner-svn-src-head@freebsd.org Mon Jan 23 04:47:40 2017 Return-Path: Delivered-To: svn-src-head@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 12B0ECBD349; Mon, 23 Jan 2017 04:47:40 +0000 (UTC) (envelope-from adrian@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 C7E78D25; Mon, 23 Jan 2017 04:47:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v0N4lc4h017917; Mon, 23 Jan 2017 04:47:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v0N4lcKj017916; Mon, 23 Jan 2017 04:47:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201701230447.v0N4lcKj017916@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 23 Jan 2017 04:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r312662 - head/sys/dev/ath X-SVN-Group: head 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.23 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: Mon, 23 Jan 2017 04:47:40 -0000 Author: adrian Date: Mon Jan 23 04:47:38 2017 New Revision: 312662 URL: https://svnweb.freebsd.org/changeset/base/312662 Log: [ath] modify cabq and per-node packet usage limits. * limit cabq to 64 - in practice if this stays at ath_txbuf then all buffers can be tied up by a very busy broadcast domain (eg ARP storm, way too much MDNS/NETBIOS). It's been like this in the freebsd-wifi-build AP project for the longest time. * Now that I figured out the hilarity inherent in aggregate forming and AR9380 EDMA work, change the per-node to 64 frames by default. I'll do some more work to shorten the queue latency introduced when doing data so TCP isn't so terrible, but it's now no longer /always/ tens of milliseconds of extra latency when doing active iperf tests. Notes: The reason for the extra latency is partly tx/rx taskqueue handling and scheduling, and partly due to a lack of airtime/QoS awareness of per-node traffic. Ideally we'd have different limits/priorities on the QoS/TID levels per node so say, voice/video data got a better share of buffer allocations over best effort/bulk data, but we currently don't implement that. It's not /hard/ to do, I just need to do it. Tested: * AR9380 (STA), AR9580 (hostap) - both with the relevant changes. TCP is now at around 180mbit with rate control and RTS protection enabled. UDP stays at 355mbit at MCS23, no HT protection. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Jan 23 04:30:08 2017 (r312661) +++ head/sys/dev/ath/if_ath.c Mon Jan 23 04:47:38 2017 (r312662) @@ -1028,12 +1028,16 @@ ath_attach(u_int16_t devid, struct ath_s * otherwise) to be transmitted. */ sc->sc_txq_data_minfree = 10; + /* - * Leave this as default to maintain legacy behaviour. - * Shortening the cabq/mcastq may end up causing some - * undesirable behaviour. + * Shorten this to 64 packets, or 1/4 ath_txbuf, whichever + * is smaller. + * + * Anything bigger can potentially see the cabq consume + * almost all buffers, starving everything else, only to + * see most fail to transmit in the given beacon interval. */ - sc->sc_txq_mcastq_maxdepth = ath_txbuf; + sc->sc_txq_mcastq_maxdepth = MIN(64, ath_txbuf / 4); /* * How deep can the node software TX queue get whilst it's asleep. @@ -1041,11 +1045,10 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_txq_node_psq_maxdepth = 16; /* - * Default the maximum queue depth for a given node - * to 1/4'th the TX buffers, or 64, whichever - * is larger. + * Default the maximum queue to to 1/4'th the TX buffers, or + * 64, whichever is smaller. */ - sc->sc_txq_node_maxdepth = MAX(64, ath_txbuf / 4); + sc->sc_txq_node_maxdepth = MIN(64, ath_txbuf / 4); /* Enable CABQ by default */ sc->sc_cabq_enable = 1;