From patchwork Wed Aug 25 13:58:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Kanzenbach X-Patchwork-Id: 12457663 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 C1D37C4320A for ; Wed, 25 Aug 2021 13:58:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A71706103E for ; Wed, 25 Aug 2021 13:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240182AbhHYN7d (ORCPT ); Wed, 25 Aug 2021 09:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232058AbhHYN73 (ORCPT ); Wed, 25 Aug 2021 09:59:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5FB2C0613CF for ; Wed, 25 Aug 2021 06:58:43 -0700 (PDT) From: Kurt Kanzenbach DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1629899921; 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=PmAigCY/2C2mbmbfA09witnGDE+mfM3JgDAyON82MKY=; b=tQCmKA/86gH8Nfq6z4MpxN5D7CBlEopmIOQQd2Qtv0a5TByyRhjBVEZXlfPqXjkUMhakzt HL6g/T9whWoghZ2aCBUxu/lmczCDHTzH7mAppjOPO3xqCjdJslxpgB1ATHK1hMF/3eN4bQ asPmvZ5DfxLa+TeY9H5qPHnkZ69es003lxnGFhAJ0ggdYQsSlvSxRluAIO5JAGRXldsIEr yS7sTA6PcAMCdr0UqKsXD+jbc1K1l+tOM0bFaGXdkhA3iRf2NZsHwuIXCQgas2N+yKHrO9 8OTqgWU8fqsRIXGCK/9Z+QDIqFGBXYJ5N7OHjZq9kZQi7Qr0aRNzhsXxLu1mQg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1629899921; 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=PmAigCY/2C2mbmbfA09witnGDE+mfM3JgDAyON82MKY=; b=xnMv/q2KHTBsozwulRNXiF/u5MEzxC7SXlxsBuowy6RdzLFhBzIHMe9SHuoqCkajUrbgeq jxTnni0puKnkbeDw== To: "David S. Miller" , Jakub Kicinski Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, Sebastian Andrzej Siewior , Kurt Kanzenbach Subject: [PATCH net 1/2] net: dsa: hellcreek: Fix incorrect setting of GCL Date: Wed, 25 Aug 2021 15:58:12 +0200 Message-Id: <20210825135813.73436-2-kurt@linutronix.de> In-Reply-To: <20210825135813.73436-1-kurt@linutronix.de> References: <20210825135813.73436-1-kurt@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Currently the gate control list which is programmed into the hardware is incorrect resulting in wrong traffic schedules. The problem is the loop variables are incremented before they are referenced. Therefore, move the increment to the end of the loop. Fixes: 24dfc6eb39b2 ("net: dsa: hellcreek: Add TAPRIO offloading support") Signed-off-by: Kurt Kanzenbach Reviewed-by: Florian Fainelli --- drivers/net/dsa/hirschmann/hellcreek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c index 5c54ae1be62c..b57aea92684b 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1472,9 +1472,6 @@ static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port, u16 data; u8 gates; - cur++; - next++; - if (i == schedule->num_entries) gates = initial->gate_mask ^ cur->gate_mask; @@ -1503,6 +1500,9 @@ static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port, (initial->gate_mask << TR_GCLCMD_INIT_GATE_STATES_SHIFT); hellcreek_write(hellcreek, data, TR_GCLCMD); + + cur++; + next++; } } From patchwork Wed Aug 25 13:58:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Kanzenbach X-Patchwork-Id: 12457659 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 D6FDEC4338F for ; Wed, 25 Aug 2021 13:58:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBEE96103E for ; Wed, 25 Aug 2021 13:58:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239489AbhHYN7a (ORCPT ); Wed, 25 Aug 2021 09:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbhHYN73 (ORCPT ); Wed, 25 Aug 2021 09:59:29 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D040EC0613C1 for ; Wed, 25 Aug 2021 06:58:43 -0700 (PDT) From: Kurt Kanzenbach DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1629899922; 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=hnKxVxMcrbxTMNFgtEeld5ECw0NHcwpheIy5KClTOx0=; b=YhhPb0blXrA96ti8J0/p4PUzNY1TmfAC4mRAUYhomm26RNiEN8HNRSUmI1bHnrh4kRUZQM 2cKV+IzPH1wliA8MurBYKXWUaEvPats1gDzF9uC7mG5B4fBR8SAH0S4oOeeU0Mg/ZdgJ5i gFllVIhQpVKqSxKqCeOgJc9yYDCwsRymFoTESvdohuVBoDR7URS4l9tYKgzD/FqAAtjuhI T90oj5TLp+sazqSlk1T5x48jxGgkuiOtGNF8nI8YyN14JSN8d1NlDa42NGQbf5nM+7k1R9 jaMsh2pqxum7mG9y04NjDg37sffLSo94rG1QxsENgfVa8ZTO9VqZ/qU6yyMgFQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1629899922; 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=hnKxVxMcrbxTMNFgtEeld5ECw0NHcwpheIy5KClTOx0=; b=Je6I1Eft2BeQlNvhJIQVHBMkfANJM+/ym0QIhr2SQ7u5h3i+SR9L11wq/tcq3Xp9PqFfSn RZr9rW7DEB76+nBw== To: "David S. Miller" , Jakub Kicinski Cc: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , netdev@vger.kernel.org, Sebastian Andrzej Siewior , Kurt Kanzenbach Subject: [PATCH net 2/2] net: dsa: hellcreek: Adjust schedule look ahead window Date: Wed, 25 Aug 2021 15:58:13 +0200 Message-Id: <20210825135813.73436-3-kurt@linutronix.de> In-Reply-To: <20210825135813.73436-1-kurt@linutronix.de> References: <20210825135813.73436-1-kurt@linutronix.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Traffic schedules can only be started up to eight seconds within the future. Therefore, the driver periodically checks every two seconds whether the admin base time provided by the user is inside that window. If so the schedule is started. Otherwise the check is deferred. However, according to the programming manual the look ahead window size should be four - not eight - seconds. By using the proposed value of four seconds starting a schedule at a specified admin base time actually works as expected. Fixes: 24dfc6eb39b2 ("net: dsa: hellcreek: Add TAPRIO offloading support") Signed-off-by: Kurt Kanzenbach Reviewed-by: Florian Fainelli --- drivers/net/dsa/hirschmann/hellcreek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c index b57aea92684b..7062db6a083c 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -1550,7 +1550,7 @@ static bool hellcreek_schedule_startable(struct hellcreek *hellcreek, int port) /* Calculate difference to admin base time */ base_time_ns = ktime_to_ns(hellcreek_port->current_schedule->base_time); - return base_time_ns - current_ns < (s64)8 * NSEC_PER_SEC; + return base_time_ns - current_ns < (s64)4 * NSEC_PER_SEC; } static void hellcreek_start_schedule(struct hellcreek *hellcreek, int port)