From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94CACC2D0CE for ; Sun, 29 Dec 2019 18:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 656A0207FF for ; Sun, 29 Dec 2019 18:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642526; bh=kQCJ1CGG0XjTRC2oSuq4B1B38huGDZTAd4kGmk8mnCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=e3p5GjKJc+PJqT4TnscBbC2mT86KZcuUBYBYpM0xdVojkzzqGWRpTrVRHiiY7Eqeq snSISIwlK0CJfUtkzjfRn2aETvKsPhhv8BPawfx7q88ab2PmdvoCAi7GbyYhhqsfJ2 N7gU2EXF51L+MMFDibpnzBflldcGw0sV6p/RfN/o= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732901AbfL2RzX (ORCPT ); Sun, 29 Dec 2019 12:55:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:43992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732895AbfL2RzX (ORCPT ); Sun, 29 Dec 2019 12:55:23 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 1C815206A4; Sun, 29 Dec 2019 17:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642122; bh=kQCJ1CGG0XjTRC2oSuq4B1B38huGDZTAd4kGmk8mnCo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LAEtH8dBqMATXNVTqB5uQq/gCp2lZmayjP5MI6StovNBUBrJd7PybAwXIFtBrcVNG o7ZHGTXlNnnxeqsfpP2I4qopXb8mF0OYqH5uWuDg+yRWg/Jk0ADcxaupbn9/t/pxMg B69W1ktFOkyEvisMumvU2y6LatYCqhlWjDy3j3fw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brett Creeley , Andrew Bowers , Jeff Kirsher , Sasha Levin Subject: [PATCH 5.4 351/434] ice: Fix setting coalesce to handle DCB configuration Date: Sun, 29 Dec 2019 18:26:44 +0100 Message-Id: <20191229172725.286507970@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Brett Creeley [ Upstream commit e25f9152bc07de534b2b590ce6c052ea25dd8900 ] Currently there can be a case where a DCB map is applied and there are more interrupt vectors (vsi->num_q_vectors) than Rx queues (vsi->num_rxq) and Tx queues (vsi->num_txq). If we try to set coalesce settings in this case it will report a false failure. Fix this by checking if vector index is valid with respect to the number of Tx and Rx queues configured. Signed-off-by: Brett Creeley Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ethtool.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index 7e23034df955..1fe9f6050635 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -3368,10 +3368,17 @@ __ice_set_coalesce(struct net_device *netdev, struct ethtool_coalesce *ec, struct ice_vsi *vsi = np->vsi; if (q_num < 0) { - int i; + int v_idx; + + ice_for_each_q_vector(vsi, v_idx) { + /* In some cases if DCB is configured the num_[rx|tx]q + * can be less than vsi->num_q_vectors. This check + * accounts for that so we don't report a false failure + */ + if (v_idx >= vsi->num_rxq && v_idx >= vsi->num_txq) + goto set_complete; - ice_for_each_q_vector(vsi, i) { - if (ice_set_q_coalesce(vsi, ec, i)) + if (ice_set_q_coalesce(vsi, ec, v_idx)) return -EINVAL; } goto set_complete; -- 2.20.1