Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp722579ybl; Fri, 24 Jan 2020 08:23:05 -0800 (PST) X-Google-Smtp-Source: APXvYqw4Ud3UWy1f+HpQcGgWe0HZBkhAH8Evcq/A7z44OD4XcIJ+pYXgQ2iYvNJQvtXRnuvqitvx X-Received: by 2002:aca:5490:: with SMTP id i138mr2510197oib.69.1579882984816; Fri, 24 Jan 2020 08:23:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579882984; cv=none; d=google.com; s=arc-20160816; b=MY3ePNLXD2Xawgu2rlR0grFo5Qeehl6hGXc0pgBBeuUYO09oabjjLjtgQZj8DRD/7H DSThiriZVkglAdWc59HeBR/pdMFlxgzfUEeLA9O6kdE9dZ4+hgfeKvxlHhdBxlpVMVUR pPGxNj7jl2lLuhbBshLEChDivQlXO5OuxTu6zEX10i12hKx2teMryNxGRQBT2KH6GjI7 cn1ebUc34gVloD2LmjbvTxeHfYmVXawk1MGVfjugeuU3vwQy3Pj97spBrudoXBMTjXHo eVWEr3f+dc4VbaZsrgjj6zKBDOO41iSRK40hW/AsPD50mOIGSr9NuZAyCUwZy2xbARU0 czEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8wT+2I2+UDq1kvwGr8LWiHjJpbefg+GQTCcXrlxOW5U=; b=okfzN1Hhx7yTSdacn0CAeCgw7mjg9xU//ofFwOJpdlU9+LGhlxEaOu56cHERwgVq9F JgrKnWVcWHLqvgOm0djJIU79jlpEOy4dp0dI5T0/iib81UNpx1AGYXWRG4QE1qjmu+eg BqYS7nbLlP4qdKr2GPxpZPp+npEVACYpmMvf5/h6+r/I8HWEQW8Kq2+OBJf3M07GrYuC X7jreg7HBJsg+tnju//iVnp8zvnbxEiwGLYp/skBYhVShW8AfV5iOFatebW1Xq1jT8Mg iiyaCE/EVMyIqKLZm3nsSAWiFKgw8SFPuVmlLTAZNaoqQAaVE7wWg3zCqfeoRp+O3FwJ PfQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TbG0KQpm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f25si3023450otl.36.2020.01.24.08.22.53; Fri, 24 Jan 2020 08:23:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TbG0KQpm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389548AbgAXLHk (ORCPT + 99 others); Fri, 24 Jan 2020 06:07:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:42804 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732427AbgAXLHe (ORCPT ); Fri, 24 Jan 2020 06:07:34 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 59FD72071A; Fri, 24 Jan 2020 11:07:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864053; bh=JpbGFaVqvCFMCutViGa8QSn9JWFJ0c7Uuy6gghZq4iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TbG0KQpmSqWsNLEPT8YqOrDdDJwYdeY1Ku6ygiPQU5uuRjKPK8Yd9QBcrbtrAXf9u AxSY6O1dXPprpmN8t1mGDWwFymCeoZ0qeMaTwMxC99Pu7cAqA7csn8Xvq3GutrphOf pOLVm9RRVewv7etYWl1LILsgJ0LfiZzXXjSGiLCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huazhong Tan , Peng Li , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 145/639] net: hns3: fix bug of ethtool_ops.get_channels for VF Date: Fri, 24 Jan 2020 10:25:15 +0100 Message-Id: <20200124093105.406619516@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan [ Upstream commit 8be7362186bd5ccb5f6f72be49751ad2778e2636 ] The current code returns the number of all queues that can be used and the number of queues that have been allocated, which is incorrect. What should be returned is the number of queues allocated for each enabled TC and the number of queues that can be allocated. This patch fixes it. Fixes: 849e46077689 ("net: hns3: add ethtool_ops.get_channels support for VF") Signed-off-by: Huazhong Tan Signed-off-by: Peng Li Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 67db19709deaa..fd5375b5991bb 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -1957,7 +1957,8 @@ static u32 hclgevf_get_max_channels(struct hclgevf_dev *hdev) struct hnae3_handle *nic = &hdev->nic; struct hnae3_knic_private_info *kinfo = &nic->kinfo; - return min_t(u32, hdev->rss_size_max * kinfo->num_tc, hdev->num_tqps); + return min_t(u32, hdev->rss_size_max, + hdev->num_tqps / kinfo->num_tc); } /** @@ -1978,7 +1979,7 @@ static void hclgevf_get_channels(struct hnae3_handle *handle, ch->max_combined = hclgevf_get_max_channels(hdev); ch->other_count = 0; ch->max_other = 0; - ch->combined_count = hdev->num_tqps; + ch->combined_count = handle->kinfo.rss_size; } static void hclgevf_get_tqps_and_rss_info(struct hnae3_handle *handle, -- 2.20.1