Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp909961pxb; Wed, 1 Sep 2021 12:27:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaBdPzx00WiGSBxc5jPvE5sXvvpWvmOPVXId+La7quGUxWuS8M/heW0UJsfOiwCpBIZMTs X-Received: by 2002:a17:906:3a57:: with SMTP id a23mr1160399ejf.469.1630524479568; Wed, 01 Sep 2021 12:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630524479; cv=none; d=google.com; s=arc-20160816; b=u1p0JvYjF8myDI6GjIdWty68+kjVTeR7RumwFW3NWO0aqs4WpGFZ8XlBpaw76MCRJE zGTmkEOHm5NI8/n9ld2yAwmCta9lY39VgACykFguefepxjGC6/8uDytgGmnROYkLq2El jbl34rTkRczL0rPbtIuUlE+YWhJSNiefXERgGPtIe4nJbBt62lCnbhTFQH86MpXtnYeO ycYU3x82UzvxRa7XrXirU/B7Wj6yASPo+Cgy0RO81NxHB9Th2DICQ0qPmFioQCwz20pT d9lQO0aCX5QTjEYPqkKjHdUDhTmiU60ZChSq7qEgVRz7WcNy1dAuYrsXdd/w+gt5D2Kg GxYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=qHVOkDSOQeAPls7W4tGnBH8GRaYEt4w17+pg21bWCBs=; b=GTmMGG3kldz0nCMxeM3VaDgbAauVVaokU+wiYjnkGO/zT1b43K7onoCzLvY+ceYq+l /QE8+ZbIDPrAoME3Qr+/7/p1ERhj88+AM3UquIxYycOBmB4iA/8RE/LNIjGBSMv+HzMf AoE3iZHVQc9Wa68SkPihIPKV2g/+ZzpIuCIA6ou/s1PYSgoss+PALEZDYwfXoNRRmWOZ bK+MrPk2f8giKM4O6tM4ss8/Ln1xp+OSUb36C6ygwMx2iFcE8L4LCGclEk1paSi8hS1v wcJerXAsRtVkpUHq97VHnU0fOLhrcUFu2/tq8apzEVz4ayKLvuUdqxGdelRv50StkNun /zew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PlPdsHXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bv8si649860ejb.87.2021.09.01.12.27.36; Wed, 01 Sep 2021 12:27:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PlPdsHXL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244625AbhIAMav (ORCPT + 99 others); Wed, 1 Sep 2021 08:30:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:59274 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244096AbhIAM35 (ORCPT ); Wed, 1 Sep 2021 08:29:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 632A061054; Wed, 1 Sep 2021 12:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1630499340; bh=cbWYir7BZ3xKm7Ngcz2YovVbdRdSO19bIc6LqlEhCCs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlPdsHXLm25FAK9/pFhV/jRIffcYlTWH4IHzBXGRps7QzkwRiuCOH7XG7VrVpILSd /HGjsmJ2ipHeq+J+3RfVhhyU4bIX/iXfSh2/yOBqIDzVDaD1UYii/eJ5q37npDUN5F xQHuxYtxQjIEry+rWg//0JKIEA808r2NnaUUDSq0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yee Li , Sasha Neftin , Dvora Fuxbrumer , Tony Nguyen , Sasha Levin Subject: [PATCH 4.14 08/23] e1000e: Fix the max snoop/no-snoop latency for 10M Date: Wed, 1 Sep 2021 14:26:53 +0200 Message-Id: <20210901122250.054793101@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210901122249.786673285@linuxfoundation.org> References: <20210901122249.786673285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sasha Neftin [ Upstream commit 44a13a5d99c71bf9e1676d9e51679daf4d7b3d73 ] We should decode the latency and the max_latency before directly compare. The latency should be presented as lat_enc = scale x value: lat_enc_d = (lat_enc & 0x0x3ff) x (1U << (5*((max_ltr_enc & 0x1c00) >> 10))) Fixes: cf8fb73c23aa ("e1000e: add support for LTR on I217/I218") Suggested-by: Yee Li Signed-off-by: Sasha Neftin Tested-by: Dvora Fuxbrumer Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/e1000e/ich8lan.c | 14 +++++++++++++- drivers/net/ethernet/intel/e1000e/ich8lan.h | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c index 1e990f9dd379..9d5fe4ea9cee 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.c +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c @@ -1013,6 +1013,8 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) { u32 reg = link << (E1000_LTRV_REQ_SHIFT + E1000_LTRV_NOSNOOP_SHIFT) | link << E1000_LTRV_REQ_SHIFT | E1000_LTRV_SEND; + u16 max_ltr_enc_d = 0; /* maximum LTR decoded by platform */ + u16 lat_enc_d = 0; /* latency decoded */ u16 lat_enc = 0; /* latency encoded */ if (link) { @@ -1066,7 +1068,17 @@ static s32 e1000_platform_pm_pch_lpt(struct e1000_hw *hw, bool link) E1000_PCI_LTR_CAP_LPT + 2, &max_nosnoop); max_ltr_enc = max_t(u16, max_snoop, max_nosnoop); - if (lat_enc > max_ltr_enc) + lat_enc_d = (lat_enc & E1000_LTRV_VALUE_MASK) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((lat_enc & E1000_LTRV_SCALE_MASK) + >> E1000_LTRV_SCALE_SHIFT))); + + max_ltr_enc_d = (max_ltr_enc & E1000_LTRV_VALUE_MASK) * + (1U << (E1000_LTRV_SCALE_FACTOR * + ((max_ltr_enc & E1000_LTRV_SCALE_MASK) + >> E1000_LTRV_SCALE_SHIFT))); + + if (lat_enc_d > max_ltr_enc_d) lat_enc = max_ltr_enc; } diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.h b/drivers/net/ethernet/intel/e1000e/ich8lan.h index 88df80c0894b..e32012d39827 100644 --- a/drivers/net/ethernet/intel/e1000e/ich8lan.h +++ b/drivers/net/ethernet/intel/e1000e/ich8lan.h @@ -292,8 +292,11 @@ /* Latency Tolerance Reporting */ #define E1000_LTRV 0x000F8 +#define E1000_LTRV_VALUE_MASK 0x000003FF #define E1000_LTRV_SCALE_MAX 5 #define E1000_LTRV_SCALE_FACTOR 5 +#define E1000_LTRV_SCALE_SHIFT 10 +#define E1000_LTRV_SCALE_MASK 0x00001C00 #define E1000_LTRV_REQ_SHIFT 15 #define E1000_LTRV_NOSNOOP_SHIFT 16 #define E1000_LTRV_SEND (1 << 30) -- 2.30.2