Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp176899imd; Wed, 31 Oct 2018 16:52:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5ew14SnJJrB003CN+CspLITnQXcTeXd+mD+h6PzSYFsAnbIXl7uJy8EyROHjLIykJPv1tgV X-Received: by 2002:a63:4b18:: with SMTP id y24-v6mr5187359pga.181.1541029927667; Wed, 31 Oct 2018 16:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541029927; cv=none; d=google.com; s=arc-20160816; b=Zfo8JWvurnadDoDicHs7rpS5hV8vEo1pYqP/b5LjibBY9YlWm3jV6Y6H7g8ckRH9kj Hs+7wn73rMCTtBRhUvoOu1GdO/06+QMq6TyUJYi/x4KOOz0rKLfL57+OAFxrNOwcF2pX YQeevugT3sJnS3mpww0RzE6qR9dckA9frI571yXquD1DTVWajdLDeQObGcQlsOUJCe/3 dx1oGGzF5HDps+5KEKQRzepkngW5cM2QyUVLDCxvswf8Uh0M5otR7wfUh1VaT91zeBiV Xs/2mc0DSbufMB/JT3B+STBGgMh82XLdK2NKJ0RXIlgdQk/rgWpCbM+eMoUv5TwjdlSi 9fpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=w65vyFWxDjhd0ViZj33bNxl/3a3yiWPUo7DUPmqyPMM=; b=hcFBMkcDhMMiZUBIkEIzO4aIWrkgpjmsLdyiU9rPAjb49L35NET3ype+szeLjTcMsc R+Z4w6P7uQFY/o59Q9qwzfGUQcLeXUPJAdDDGq2K6TXNC4L7kzZAxvmUZVVPuLA0BrJa LtaNj5PIiIb2yoxCMq6y+0b7liYJ001Z9XODBl1Fyr6PPkfq1Fi4eBexNEAvMUUzEjWr BG5pX5c+sIfSRqs9s2d+9Jg2/SSW/7o0ouksX6fW0dQq/qNXoaYnV+PtJ7GeJW3cTzYg U2jmIEHvcZHeqrrl/Al5nmYyvM/kZJHZKG5E6+diyJipxOq/w1LsyozEIIbiSkUZnhBm aRwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xG7nEwEj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e10-v6si27879842pgo.44.2018.10.31.16.51.53; Wed, 31 Oct 2018 16:52:07 -0700 (PDT) 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=xG7nEwEj; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728427AbeKAIvs (ORCPT + 99 others); Thu, 1 Nov 2018 04:51:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:53504 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728027AbeKAIGc (ORCPT ); Thu, 1 Nov 2018 04:06:32 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E065B20838; Wed, 31 Oct 2018 23:06:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027181; bh=BIKq4n+gURLFxyvCTj/QsOYBWbIJ3UANALOFQtZrNzU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xG7nEwEjCGl3E4g7sxpMHKP/Z6dNGe4Fyj6ORxVlnPfCmSIB1lLHfDarCjt9l4trV KBdsC/6gG+YGP+Cwnmdgs+DlBWjLBTfj1cNa67k/b68b1qbnWr9Vuqadf8dWHCTrMi iw50fCxkWaAddWqorLvLCN1GAeP4bwfngYtgSbK8= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bruce Allan , Anirudh Venkataramanan , Jeff Kirsher , Sasha Levin Subject: [PATCH AUTOSEL 4.19 043/146] ice: fix changing of ring descriptor size (ethtool -G) Date: Wed, 31 Oct 2018 19:03:58 -0400 Message-Id: <20181031230541.28822-43-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bruce Allan [ Upstream commit f934bb9b8b6136edd261b2dc2c9ad4dbc39ffc66 ] rx_mini_pending was set to an incorrect value. This was causing EINVAL to always be returned to 'ethtool -G'. The driver does not support mini or jumbo rings so the respective settings should be zero. Also, change the valid range of the number of descriptors in the rings to make the code simpler and easier for users to understand (this removes the valid settings of 8 and 16). Add a system log message indicating when the number is rounded-up from what the user specifies with the 'ethtool -G' command (i.e. when it is not a multiple of 32), and update the log message when a user-provided value is out of range to also indicate the stride. Signed-off-by: Bruce Allan Signed-off-by: Anirudh Venkataramanan Tested-by: Andrew Bowers Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice.h | 4 ++-- drivers/net/ethernet/intel/ice/ice_ethtool.c | 17 ++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h index 868f4a1d0f72..67591722c625 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -39,9 +39,9 @@ extern const char ice_drv_ver[]; #define ICE_BAR0 0 #define ICE_DFLT_NUM_DESC 128 -#define ICE_MIN_NUM_DESC 8 -#define ICE_MAX_NUM_DESC 8160 #define ICE_REQ_DESC_MULTIPLE 32 +#define ICE_MIN_NUM_DESC ICE_REQ_DESC_MULTIPLE +#define ICE_MAX_NUM_DESC 8160 #define ICE_DFLT_TRAFFIC_CLASS BIT(0) #define ICE_INT_NAME_STR_LEN (IFNAMSIZ + 16) #define ICE_ETHTOOL_FWVER_LEN 32 diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c index c71a9b528d6d..9d6754f65a1a 100644 --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c @@ -478,9 +478,11 @@ ice_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) ring->tx_max_pending = ICE_MAX_NUM_DESC; ring->rx_pending = vsi->rx_rings[0]->count; ring->tx_pending = vsi->tx_rings[0]->count; - ring->rx_mini_pending = ICE_MIN_NUM_DESC; + + /* Rx mini and jumbo rings are not supported */ ring->rx_mini_max_pending = 0; ring->rx_jumbo_max_pending = 0; + ring->rx_mini_pending = 0; ring->rx_jumbo_pending = 0; } @@ -498,14 +500,23 @@ ice_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) ring->tx_pending < ICE_MIN_NUM_DESC || ring->rx_pending > ICE_MAX_NUM_DESC || ring->rx_pending < ICE_MIN_NUM_DESC) { - netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d]\n", + netdev_err(netdev, "Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n", ring->tx_pending, ring->rx_pending, - ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC); + ICE_MIN_NUM_DESC, ICE_MAX_NUM_DESC, + ICE_REQ_DESC_MULTIPLE); return -EINVAL; } new_tx_cnt = ALIGN(ring->tx_pending, ICE_REQ_DESC_MULTIPLE); + if (new_tx_cnt != ring->tx_pending) + netdev_info(netdev, + "Requested Tx descriptor count rounded up to %d\n", + new_tx_cnt); new_rx_cnt = ALIGN(ring->rx_pending, ICE_REQ_DESC_MULTIPLE); + if (new_rx_cnt != ring->rx_pending) + netdev_info(netdev, + "Requested Rx descriptor count rounded up to %d\n", + new_rx_cnt); /* if nothing to do return success */ if (new_tx_cnt == vsi->tx_rings[0]->count && -- 2.17.1