From owner-svn-src-all@freebsd.org Mon May 22 08:17:09 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 19D9DD78499; Mon, 22 May 2017 08:17:09 +0000 (UTC) (envelope-from hselasky@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 D11C4180E; Mon, 22 May 2017 08:17:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v4M8H7BP088086; Mon, 22 May 2017 08:17:07 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4M8H72i088084; Mon, 22 May 2017 08:17:07 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201705220817.v4M8H72i088084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 22 May 2017 08:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r318627 - stable/11/sys/ofed/drivers/net/mlx4 X-SVN-Group: stable-11 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: Mon, 22 May 2017 08:17:09 -0000 Author: hselasky Date: Mon May 22 08:17:07 2017 New Revision: 318627 URL: https://svnweb.freebsd.org/changeset/base/318627 Log: MFC r318531: mlx4: Use the CQ quota for SRIOV when creating completion EQs When creating EQs to handle CQ completion events for the PF or for VFs, we create enough EQE entries to handle completions for the max number of CQs that can use that EQ. When SRIOV is activated, the max number of CQs a VF (or the PF) can obtain is its CQ quota (determined by the Hypervisor resource tracker). Therefore, when creating an EQ, the number of EQE entries that the VF should request for that EQ is the CQ quota value (and not the total number of CQs available in the firmware). Under SRIOV, the PF, also must use its CQ quota, because the resource tracker also controls how many CQs the PF can obtain. Using the firmware total CQs instead of the CQ quota when creating EQs resulted wasting MTT entries, due to allocating more EQEs than were needed. Sponsored by: Mellanox Technologies Modified: stable/11/sys/ofed/drivers/net/mlx4/eq.c stable/11/sys/ofed/drivers/net/mlx4/main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/ofed/drivers/net/mlx4/eq.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/eq.c Mon May 22 06:29:20 2017 (r318626) +++ stable/11/sys/ofed/drivers/net/mlx4/eq.c Mon May 22 08:17:07 2017 (r318627) @@ -1169,8 +1169,7 @@ int mlx4_init_eq_table(struct mlx4_dev * } for (i = 0; i < dev->caps.num_comp_vectors; ++i) { - err = mlx4_create_eq(dev, dev->caps.num_cqs - - dev->caps.reserved_cqs + + err = mlx4_create_eq(dev, dev->quotas.cq + MLX4_NUM_SPARE_EQE, (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, &priv->eq_table.eq[i]); @@ -1190,8 +1189,7 @@ int mlx4_init_eq_table(struct mlx4_dev * for (i = dev->caps.num_comp_vectors + 1; i < dev->caps.num_comp_vectors + dev->caps.comp_pool + 1; ++i) { - err = mlx4_create_eq(dev, dev->caps.num_cqs - - dev->caps.reserved_cqs + + err = mlx4_create_eq(dev, dev->quotas.cq + MLX4_NUM_SPARE_EQE, (dev->flags & MLX4_FLAG_MSI_X) ? i : 0, &priv->eq_table.eq[i]); Modified: stable/11/sys/ofed/drivers/net/mlx4/main.c ============================================================================== --- stable/11/sys/ofed/drivers/net/mlx4/main.c Mon May 22 06:29:20 2017 (r318626) +++ stable/11/sys/ofed/drivers/net/mlx4/main.c Mon May 22 08:17:07 2017 (r318627) @@ -3446,6 +3446,8 @@ slave_start: goto err_free_eq; } + mlx4_init_quotas(dev); + err = mlx4_setup_hca(dev); if (err == -EBUSY && (dev->flags & MLX4_FLAG_MSI_X) && !mlx4_is_mfunc(dev)) { @@ -3459,7 +3461,6 @@ slave_start: if (err) goto err_steer; - mlx4_init_quotas(dev); mlx4_init_hca_info(dev); for (port = 1; port <= dev->caps.num_ports; port++) {