From owner-svn-src-stable-10@freebsd.org Mon Dec 21 20:40:18 2015 Return-Path: Delivered-To: svn-src-stable-10@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 D548BA4E337; Mon, 21 Dec 2015 20:40:18 +0000 (UTC) (envelope-from jhb@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 A675711A0; Mon, 21 Dec 2015 20:40:18 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBLKeHQ0097046; Mon, 21 Dec 2015 20:40:17 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBLKeHHW097045; Mon, 21 Dec 2015 20:40:17 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201512212040.tBLKeHHW097045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Mon, 21 Dec 2015 20:40:17 +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: r292568 - stable/10/sys/dev/vmware/vmxnet3 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Dec 2015 20:40:18 -0000 Author: jhb Date: Mon Dec 21 20:40:17 2015 New Revision: 292568 URL: https://svnweb.freebsd.org/changeset/base/292568 Log: MFC 290948: Only use a power of 2 for the number of receive and transmit queues. Using other values causes VMXNET3_CMD_ENABLE to fail. The Linux driver also enforces this restriction. Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Mon Dec 21 20:36:01 2015 (r292567) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Mon Dec 21 20:40:17 2015 (r292568) @@ -511,6 +511,13 @@ vmxnet3_check_version(struct vmxnet3_sof return (0); } +static int +trunc_powerof2(int val) +{ + + return (1U << (fls(val) - 1)); +} + static void vmxnet3_initial_config(struct vmxnet3_softc *sc) { @@ -521,14 +528,14 @@ vmxnet3_initial_config(struct vmxnet3_so nqueue = VMXNET3_DEF_TX_QUEUES; if (nqueue > mp_ncpus) nqueue = mp_ncpus; - sc->vmx_max_ntxqueues = nqueue; + sc->vmx_max_ntxqueues = trunc_powerof2(nqueue); nqueue = vmxnet3_tunable_int(sc, "rxnqueue", vmxnet3_default_rxnqueue); if (nqueue > VMXNET3_MAX_RX_QUEUES || nqueue < 1) nqueue = VMXNET3_DEF_RX_QUEUES; if (nqueue > mp_ncpus) nqueue = mp_ncpus; - sc->vmx_max_nrxqueues = nqueue; + sc->vmx_max_nrxqueues = trunc_powerof2(nqueue); if (vmxnet3_tunable_int(sc, "mq_disable", vmxnet3_mq_disable)) { sc->vmx_max_nrxqueues = 1;