From patchwork Tue Jan 19 00:40:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinicius Costa Gomes X-Patchwork-Id: 12028481 X-Patchwork-Delegate: kuba@kernel.org 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 EFD32C433E0 for ; Tue, 19 Jan 2021 00:42:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4F232225C for ; Tue, 19 Jan 2021 00:42:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391371AbhASAmI (ORCPT ); Mon, 18 Jan 2021 19:42:08 -0500 Received: from mga09.intel.com ([134.134.136.24]:38531 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391079AbhASAlt (ORCPT ); Mon, 18 Jan 2021 19:41:49 -0500 IronPort-SDR: Slg/xgOLDzXHo7kZymF1wobJKSZixeJdJb//HLzxcyvnUtmlfRwkTez3GEw6YWdZ/Ef2WcFqML uTXCC+JkSuoA== X-IronPort-AV: E=McAfee;i="6000,8403,9868"; a="179011264" X-IronPort-AV: E=Sophos;i="5.79,357,1602572400"; d="scan'208";a="179011264" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 16:40:54 -0800 IronPort-SDR: QZSJrKENayqnnMspYJoz4fxLDekgzyytlj8vot2EsqqKPDZa3urdDUgiSGo/37+qiRQyYvGlUo LNLblCTgfMKQ== X-IronPort-AV: E=Sophos;i="5.79,357,1602572400"; d="scan'208";a="426285778" Received: from cemillan-mobl.amr.corp.intel.com (HELO localhost.localdomain) ([10.212.57.184]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Jan 2021 16:40:52 -0800 From: Vinicius Costa Gomes To: netdev@vger.kernel.org Cc: Vinicius Costa Gomes , jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, kuba@kernel.org, m-karicheri2@ti.com, vladimir.oltean@nxp.com, Jose.Abreu@synopsys.com, po.liu@nxp.com, intel-wired-lan@lists.osuosl.org, anthony.l.nguyen@intel.com, mkubecek@suse.cz Subject: [PATCH net-next v2 5/8] igc: Avoid TX Hangs because long cycles Date: Mon, 18 Jan 2021 16:40:25 -0800 Message-Id: <20210119004028.2809425-6-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210119004028.2809425-1-vinicius.gomes@intel.com> References: <20210119004028.2809425-1-vinicius.gomes@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Avoid possible TX Hangs caused by using long Qbv cycles. In some cases, using long cycles (more than 1 second) can cause transmissions to be blocked for that time. As the TX Hang timeout is close to 1 second, we may need to reduce the cycle time to something more reasonable: the value chosen is 1ms. Signed-off-by: Vinicius Costa Gomes --- drivers/net/ethernet/intel/igc/igc_main.c | 4 ++-- drivers/net/ethernet/intel/igc/igc_tsn.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index afd6a62da29d..f1b31fa04734 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -4693,12 +4693,12 @@ static int igc_save_launchtime_params(struct igc_adapter *adapter, int queue, if (adapter->base_time) return 0; - adapter->cycle_time = NSEC_PER_SEC; + adapter->cycle_time = NSEC_PER_MSEC; for (i = 0; i < adapter->num_tx_queues; i++) { ring = adapter->tx_ring[i]; ring->start_time = 0; - ring->end_time = NSEC_PER_SEC; + ring->end_time = NSEC_PER_MSEC; } return 0; diff --git a/drivers/net/ethernet/intel/igc/igc_tsn.c b/drivers/net/ethernet/intel/igc/igc_tsn.c index 38451cf05ac6..f5a5527adb21 100644 --- a/drivers/net/ethernet/intel/igc/igc_tsn.c +++ b/drivers/net/ethernet/intel/igc/igc_tsn.c @@ -54,11 +54,11 @@ static int igc_tsn_disable_offload(struct igc_adapter *adapter) wr32(IGC_TXQCTL(i), 0); wr32(IGC_STQT(i), 0); - wr32(IGC_ENDQT(i), NSEC_PER_SEC); + wr32(IGC_ENDQT(i), NSEC_PER_MSEC); } - wr32(IGC_QBVCYCLET_S, NSEC_PER_SEC); - wr32(IGC_QBVCYCLET, NSEC_PER_SEC); + wr32(IGC_QBVCYCLET_S, NSEC_PER_MSEC); + wr32(IGC_QBVCYCLET, NSEC_PER_MSEC); adapter->flags &= ~IGC_FLAG_TSN_QBV_ENABLED;