From patchwork Wed Jun 14 14:07:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Kauer X-Patchwork-Id: 107962 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1288051vqr; Wed, 14 Jun 2023 07:09:08 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57F0K33Jno7iXJx4jdIz4mW6otX+F0e42kK1qyMRIbJeacd5E/Jx8d0QQbhb1zbQJ914Zc X-Received: by 2002:a17:902:eecc:b0:1af:b957:718b with SMTP id h12-20020a170902eecc00b001afb957718bmr10972825plb.39.1686751748306; Wed, 14 Jun 2023 07:09:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686751748; cv=none; d=google.com; s=arc-20160816; b=x3fEWGkMQXaiU42K6GjFqdBd5PihSvRLWmLIO6oIkjmp7ikOBDxsPOL1bEGK/3O7YL tbrAGTW0P3jHQdXPXuNLsr7iQK/5KxZH3B5bS8ikwL8VfrPuMf15OyvsAPSz5uUbLt01 vGKiJbTXh6Q8V0fmY0wzWgKrAg1DZFNGeeQNWLKlt2EL9Y2ub19J8KTr7aEXyhGNXnvL xOdKZtDt+SEW6DtpCBaU+XxAqje5u2uhVVsoCcOPlPveLZwpObclMqLoM3iT6Lt6nkOm sFJI547XLnrgaKWuuLIcwQp7UuYGR+JWuSyfU4aW8EWlvrrcSKTBhGI6vJcbJlhV3gqo MNng== 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=x6Htu7np35GOzuU2rwqMOLnSJ2z47YfJkRbHy1TCsl0=; b=X8mNMgA8q7Tx1yu6Ds+U0f1VF+BB0V3DWYJrqaT/gZwMst8Db3n1iXyctAeN1xmPer A40S7qmj4XOqzsGnyyuCtxUUdWR+nEkxiTYZTBf6sGDBC+RZ06u8D2niHaofPk3X1ZSP Ch57KA0GqAEFNuzDGuI65E2yMYi9T4Kx/QMueoVHzo4Nqs6joEngLgN5Pqmk8ayfTcz9 B56W7TmR8ueYrBqkjVt27Z10msZNmZhoRqVpKIBj4yMhgMciAycFyqJzK0YWBfvXsEnj yVTCXSpxLMTuZkFmyJnI/67JHX9UMxqG/OwKZFcq2A0hYE7LnjVDOTUlTFu6fIMDU51h G3NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1+8JZxpl; dkim=neutral (no key) header.i=@linutronix.de; 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 c1-20020a170902d48100b001b3f4e1762asi3058732plg.490.2023.06.14.07.08.22; Wed, 14 Jun 2023 07:09:08 -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=1+8JZxpl; dkim=neutral (no key) header.i=@linutronix.de; 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 S245407AbjFNOHo (ORCPT + 99 others); Wed, 14 Jun 2023 10:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245370AbjFNOHe (ORCPT ); Wed, 14 Jun 2023 10:07:34 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E5EECD; Wed, 14 Jun 2023 07:07:33 -0700 (PDT) From: Florian Kauer DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1686751651; 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=x6Htu7np35GOzuU2rwqMOLnSJ2z47YfJkRbHy1TCsl0=; b=1+8JZxple640L2i78OWj0AT4lW7BSRG5mTek6g1HCJErHIPJWpbpZbA8770+hU+H+m0tNb c9BnZ8Psh4CSh/9fzNZmdOxxeQ2hs3QOXMSxanhaAq7kgy8pyfqTNpd9Pkk8zVadW2EqGg EHQnvyIaPn/G1d5Uws7atr6Ma3KiSfbQ8PQ6+j/C7XxECFdHZtDqNkZ7XoW90Oy36m5gGm NDleKInVyFDzlbfFnAK6BXpJrUyKA/ggBwhnEwJbDOWCVgZ5XKbGumlrZckJHJ+B59NqtC vykd4w1CGkQtniToM4Nce/jXtkl0xIgA8tz4o8zkfydewwK0vEH42Qg5/ID54w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1686751651; 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=x6Htu7np35GOzuU2rwqMOLnSJ2z47YfJkRbHy1TCsl0=; b=slM6BJwhD6d50c957awDJHQXUZNZ9MEQweTUaWR3uNdodBTiBsjm6mW1Cvxg+B6E0s8OkD 9nYgz1dY/rUvzFBg== To: Jesse Brandeburg , Tony Nguyen , Vinicius Costa Gomes , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Tan Tee Min , Muhammad Husaini Zulkifli , Aravindhan Gunasekaran , Malli C 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 3/6] igc: Handle already enabled taprio offload for basetime 0 Date: Wed, 14 Jun 2023 16:07:11 +0200 Message-Id: <20230614140714.14443-4-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 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768687401491670684?= X-GMAIL-MSGID: =?utf-8?q?1768687401491670684?= Since commit e17090eb2494 ("igc: allow BaseTime 0 enrollment for Qbv") it is possible to enable taprio offload with a basetime of 0. However, the check if taprio offload is already enabled (and thus -EALREADY should be returned for igc_save_qbv_schedule) still relied on adapter->base_time > 0. This can be reproduced as follows: # TAPRIO offload (flags == 0x2) and base-time = 0 sudo tc qdisc replace dev enp1s0 parent root handle 100 stab overhead 24 taprio \ num_tc 1 \ map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ queues 1@0 \ base-time 0 \ sched-entry S 01 300000 \ flags 0x2 # The second call should fail with "Error: Device failed to setup taprio offload." # But that only happens if base-time was != 0 sudo tc qdisc replace dev enp1s0 parent root handle 100 stab overhead 24 taprio \ num_tc 1 \ map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 \ queues 1@0 \ base-time 0 \ sched-entry S 01 300000 \ flags 0x2 Fixes: e17090eb2494 ("igc: allow BaseTime 0 enrollment for Qbv") Signed-off-by: Florian Kauer Reviewed-by: Kurt Kanzenbach --- 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 122158b321d5..35ace8d338a5 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -6123,7 +6123,7 @@ static int igc_save_qbv_schedule(struct igc_adapter *adapter, if (qopt->base_time < 0) return -ERANGE; - if (igc_is_device_id_i225(hw) && adapter->base_time) + if (igc_is_device_id_i225(hw) && adapter->taprio_offload_enable) return -EALREADY; if (!validate_schedule(adapter, qopt))