Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2908295iog; Mon, 27 Jun 2022 05:33:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpl/Nv1ioU3ihcPLf/UK+wCKLMCcSVtsBV5nBFqiozqeK9gHi5hoYuMrM38yCU92ZjTHBo X-Received: by 2002:a17:907:9625:b0:726:3a61:224d with SMTP id gb37-20020a170907962500b007263a61224dmr12319951ejc.286.1656333186380; Mon, 27 Jun 2022 05:33:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333186; cv=none; d=google.com; s=arc-20160816; b=SnGgICjDqR3ZoxIi885Td3Ug6CoPdPgi3LuDW74+FmgbhXfOAzl/2+sEe7euJNsAIN yjo9MhQGL3taQCkP32PCCEpnkLhp+44k0Ck+V+8Pb43VNg58aqlNx3aYiXV3sBVx5n8w pGfc5QTjj3FV7PGe5CwEEeA+3bhpv9CYxh+favVIFXXDr71+X3EQvBhzs0YEjwCWi5z0 J40HRrIxkhInCKRLM9KlLeaqpZem5wYfpvB7dI7cCfWl7PfAfmKoJSWfYVQiJmNkDq3Z BmyN3B5KrZ0yeR6zG0WmxEDEpP0wuOceCmRZ2eGrXeOEzB6Qr0lQrJkkezgtyTIlP4YM K1Xw== 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=WClMAPeW5WeKOJfWzCJvC8vzWC7jfwj0yu/zWWgeO1Q=; b=ez6iA4SwKXX4i1OKtXoogfK9HsANNjrERlRP3W4z8fAmZHd/NbOuIvwYYGZa5vCzmO Mx4lgic2JZ+hNU2zgQVNqgPJTI6sKkVTcUdcOo8dnpA/unR1Ac4sQ95ks5njsQzbs1qJ KT0Z7+J8P659CwwTNY01mHvyn1DQdKNENqO9BjxWTp/Og0pjVA+JVK9iidPn5uRhCmGQ kZal+8sru46RqcpeI7EhiP34r4rzcxwflnEwtXxQfuBMyK7G6OjiEaTO0hH9bLIkdvJl Lh43VnOmEK0uE1sfJ6FrGRN11G2U7M6aC1YKR1dC02CtoZUYhPIYb7Ht8mhlgrVGdw8q 6KAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eKasqgIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a2-20020a1709066d4200b00722e7e8b484si10788120ejt.625.2022.06.27.05.32.41; Mon, 27 Jun 2022 05:33:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eKasqgIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235112AbiF0Ldr (ORCPT + 99 others); Mon, 27 Jun 2022 07:33:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235272AbiF0Lb5 (ORCPT ); Mon, 27 Jun 2022 07:31:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F972194; Mon, 27 Jun 2022 04:29:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B36E5614EC; Mon, 27 Jun 2022 11:29:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5C05C341C7; Mon, 27 Jun 2022 11:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329352; bh=YjnRasFIojLLIzPHUxVjdng4DpIWoFgETIHdtiiqFO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eKasqgINKd5ZaMBudpxZkOQHEaJQaY8kWfSbSfnX5HxR5yWDjRC7q33jf82+wDN9i ZDsFpXarltqPDXgNsKwnhDOSxy70F9/16WvpUQwgQFWWl0K1w2o6BpILtJL8hJoVkZ /lpMSEJrmfaKeWzcbMGKCT5zE0auE9xCd+zR3BwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai-Heng Feng , Tony Nguyen , Jakub Kicinski , Sasha Levin , Gurucharan Subject: [PATCH 5.4 30/60] igb: Make DMA faster when CPU is active on the PCIe link Date: Mon, 27 Jun 2022 13:21:41 +0200 Message-Id: <20220627111928.574105609@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kai-Heng Feng [ Upstream commit 4e0effd9007ea0be31f7488611eb3824b4541554 ] Intel I210 on some Intel Alder Lake platforms can only achieve ~750Mbps Tx speed via iperf. The RR2DCDELAY shows around 0x2xxx DMA delay, which will be significantly lower when 1) ASPM is disabled or 2) SoC package c-state stays above PC3. When the RR2DCDELAY is around 0x1xxx the Tx speed can reach to ~950Mbps. According to the I210 datasheet "8.26.1 PCIe Misc. Register - PCIEMISC", "DMA Idle Indication" doesn't seem to tie to DMA coalesce anymore, so set it to 1b for "DMA is considered idle when there is no Rx or Tx AND when there are no TLPs indicating that CPU is active detected on the PCIe link (such as the host executes CSR or Configuration register read or write operation)" and performing Tx should also fall under "active CPU on PCIe link" case. In addition to that, commit b6e0c419f040 ("igb: Move DMA Coalescing init code to separate function.") seems to wrongly changed from enabling E1000_PCIEMISC_LX_DECISION to disabling it, also fix that. Fixes: b6e0c419f040 ("igb: Move DMA Coalescing init code to separate function.") Signed-off-by: Kai-Heng Feng Tested-by: Gurucharan (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Link: https://lore.kernel.org/r/20220621221056.604304-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 26c8d09ad4dd..8734dfd001bb 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -9404,11 +9404,10 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) struct e1000_hw *hw = &adapter->hw; u32 dmac_thr; u16 hwm; + u32 reg; if (hw->mac.type > e1000_82580) { if (adapter->flags & IGB_FLAG_DMAC) { - u32 reg; - /* force threshold to 0. */ wr32(E1000_DMCTXTH, 0); @@ -9441,7 +9440,6 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) /* Disable BMC-to-OS Watchdog Enable */ if (hw->mac.type != e1000_i354) reg &= ~E1000_DMACR_DC_BMC2OSW_EN; - wr32(E1000_DMACR, reg); /* no lower threshold to disable @@ -9458,12 +9456,12 @@ static void igb_init_dmac(struct igb_adapter *adapter, u32 pba) */ wr32(E1000_DMCTXTH, (IGB_MIN_TXPBSIZE - (IGB_TX_BUF_4096 + adapter->max_frame_size)) >> 6); + } - /* make low power state decision controlled - * by DMA coal - */ + if (hw->mac.type >= e1000_i210 || + (adapter->flags & IGB_FLAG_DMAC)) { reg = rd32(E1000_PCIEMISC); - reg &= ~E1000_PCIEMISC_LX_DECISION; + reg |= E1000_PCIEMISC_LX_DECISION; wr32(E1000_PCIEMISC, reg); } /* endif adapter->dmac is not disabled */ } else if (hw->mac.type == e1000_82580) { -- 2.35.1