Message ID | 20230614140714.14443-6-florian.kauer@linutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1312554vqr; Wed, 14 Jun 2023 07:41:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ESodAgL9wmClpDXptjA5YupPPQzZct14Ru24EjEUNDdlVMeI1+u4r2xh+BrKcZqKtoE0G X-Received: by 2002:a05:6358:7018:b0:12b:dc0e:d33e with SMTP id 24-20020a056358701800b0012bdc0ed33emr6217233rwo.23.1686753708335; Wed, 14 Jun 2023 07:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686753708; cv=none; d=google.com; s=arc-20160816; b=vE8CcpOWOjDJH42oeLYeW9hEZIt5AcjQmkL5qw6Mfrd/mD/zrvP0MO8QjfQydNcrOy 3JyKYXxYG/7AZGYaULQk8UU+1zdC27hbXWHFwmpECJV9ISWfLsTL2qaLMtUUA1OnKFaq sgqNgVyGEjXgZEYN7FrbBFifYnFj/dyF+emBjzrvk9vqBJbu1sOUBWdx8NDfGtCKCiTm 4lSccwHkMOu616SFZQxOMUmbS8PIFWoVVBWmzps+h8VjWyELpGHYMtNmiXWB/acrB3sV CJJgRvi1u17cz3nW/QLFXoWhYSvMhnawssgfYCv2T+Y1gXC2jDzS6Pi3FDaewbyjwgY3 p7Cg== 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 :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=7hUQE7jx0fknKMAL9e6sfNn3hoeeuEK7E2AxmOK/Kq4=; b=TC7Wp5NlKZNJnsc4iMHhksCcpiK06fmD323se6b+ImQ6nznqa7frNDAVGjMle8eyx4 n+k96oxGUHKzV0nCP2t7NajmhAhmCCrUNoI5fLnsWAj+URvIyJcfLI0QVYzyHbp3P7AT A13Xox72zYZ6eIJaWLiq1fnojV3oh9hn0v5oN5ASxMphbbNkTw1peXrepRnhkXO+OXxt CBB4lgghQWa60SMTl9uB5jBiL8cClUn8Rvs+9SSen4IqKA2r9WZmajRdDtI/VT2Uo+TO maGRJrStg0XqsBKYT+meAm07BOAoQNW2KNMLXFdvVFRhtJc38T9o13AQbr4VZ/Uvkl7m AF7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=e1jQpj4m; dkim=neutral (no key) header.i=@linutronix.de header.b=Zp2JPID6; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k190-20020a636fc7000000b0054402b987ecsi10880796pgc.803.2023.06.14.07.41.12; Wed, 14 Jun 2023 07:41:48 -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=@linutronix.de header.s=2020 header.b=e1jQpj4m; dkim=neutral (no key) header.i=@linutronix.de header.b=Zp2JPID6; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245424AbjFNOHw (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Wed, 14 Jun 2023 10:07:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245382AbjFNOHh (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 14 Jun 2023 10:07:37 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22AF1BFD; Wed, 14 Jun 2023 07:07:35 -0700 (PDT) From: Florian Kauer <florian.kauer@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686751654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7hUQE7jx0fknKMAL9e6sfNn3hoeeuEK7E2AxmOK/Kq4=; b=e1jQpj4mpNOmUjLaTWrTqzJCKoe2XCIeX84UQxj8V+Ot1GjzyK4wF2ASVXOEk692Bue4FH RF58gFTXbaZbf5YM0srXUHwnnTSdsbvEtKVutDE4fZjqwpSfxclXybP9ChEfyK+k6hlcmD iE9nPwlA/d2G61e7QBFIQIFgKiIYkr/si5Tp4oje8P3Cxw/T2mde51yLfFKrI578U6LcVy LTvwFSJobm9cE/XYKDlOVi7YAsob56NxctFPKJ/TN8ru/S4o2OWm9tMnCdzRjkQ360zZzM aUlCS/ExREN7aG7u+9vnEW67tZoepFWuWuj1veN9j7I6KviTOd7oWFFEjHzbLw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686751654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7hUQE7jx0fknKMAL9e6sfNn3hoeeuEK7E2AxmOK/Kq4=; b=Zp2JPID67ZKSHdcUNmB9agCGcbNECGLtbWi+KbGEHVsxXJ21kzyORuLrlHdx8fSHFz8ZBM XPAv3YOD4EkoFkBg== To: Jesse Brandeburg <jesse.brandeburg@intel.com>, Tony Nguyen <anthony.l.nguyen@intel.com>, Vinicius Costa Gomes <vinicius.gomes@intel.com>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Tan Tee Min <tee.min.tan@linux.intel.com>, Muhammad Husaini Zulkifli <muhammad.husaini.zulkifli@intel.com>, Aravindhan Gunasekaran <aravindhan.gunasekaran@intel.com>, Malli C <mallikarjuna.chilakala@intel.com> Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kurt@linutronix.de, florian.kauer@linutronix.de Subject: [PATCH net-next 5/6] igc: Fix launchtime before start of cycle Date: Wed, 14 Jun 2023 16:07:13 +0200 Message-Id: <20230614140714.14443-6-florian.kauer@linutronix.de> In-Reply-To: <20230614140714.14443-1-florian.kauer@linutronix.de> References: <20230614140714.14443-1-florian.kauer@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768689456395029214?= X-GMAIL-MSGID: =?utf-8?q?1768689456395029214?= |
Series |
igc: Fix corner cases for TSN offload
|
|
Commit Message
Florian Kauer
June 14, 2023, 2:07 p.m. UTC
It is possible (verified on a running system) that frames are processed by igc_tx_launchtime with a txtime before the start of the cycle (baset_est). However, the result of txtime - baset_est is written into a u32, leading to a wrap around to a positive number. The following launchtime > 0 check will only branch to executing launchtime = 0 if launchtime is already 0. Fix it by using a s32 before checking launchtime > 0. Fixes: db0b124f02ba ("igc: Enhance Qbv scheduling by using first flag bit") Signed-off-by: Florian Kauer <florian.kauer@linutronix.de> Reviewed-by: Kurt Kanzenbach <kurt@linutronix.de> --- drivers/net/ethernet/intel/igc/igc_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 35ace8d338a5..ec8649751d19 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -1010,7 +1010,7 @@ static __le32 igc_tx_launchtime(struct igc_ring *ring, ktime_t txtime, ktime_t base_time = adapter->base_time; ktime_t now = ktime_get_clocktai(); ktime_t baset_est, end_of_cycle; - u32 launchtime; + s32 launchtime; s64 n; n = div64_s64(ktime_sub_ns(now, base_time), cycle_time);