Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2537102pxj; Mon, 10 May 2021 05:26:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2dOuJ1ODwl/4VzZSmBpqdDt+teJ9dcVdZ7i19SBgUSBDj3UGoF6UjEsH0XarU2pCwk5xa X-Received: by 2002:a17:907:9612:: with SMTP id gb18mr25725450ejc.408.1620649590694; Mon, 10 May 2021 05:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620649590; cv=none; d=google.com; s=arc-20160816; b=YGmDW9G941cWgJIurJWK35TeXVHk1FxiiIA6zEitBp1etZA5z0IHvQvzZm+OqUFko+ yqfY6g9Rg7w2a5NdcSoKwKCDWodL338ZpvgM7vhKhkSkUS6rXORxenHikSACOH24GCRb j8Uxcoif/NKILAmWUvvSey8cBtigiRDDDvEwe7SSY1LvWvYNC0D6icyJiTxnpgk4sRM0 sera3X0p2nEp+zdBm0/Q8Kndr0nsZq1+C7Nkx34G1H6NP5QnxuSSChvOaDwpIx2LyBFs bmpZ4LZhFzCKFrow5+D7M9n6wp6Wd402tnnkHKkpC1yCZULe26zAFDDAqg7tneSLkP8/ S0RQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=UvqLle58hbQrYS8D+Qw3M/VyRDyS9/kql1bKzFA9u7k=; b=0NYxR4/V9XxFTcwDxgm8zAypIhz5pNzc46z9lI8TyeRh+uEHfwxTnEnH/77O3Dy3pH USZRVwbmE4II3Jd2fpiznrbVFj5CopDUWNDBpAj8jqk7RIcr1f+YJupGau02Fd4SUK1E E0Uoxk7lLcSl7DZ7pJpQoi7CpHugn7mA5MGsjCklHHyKP+kvcW08LqtbK2gE5q1I8UA4 CarKww570HsIsDx0HA3SsxUrJphP8BLdY/5SKJ5ApFy2mwy8Y7E8pOja50uIsIdIRFaZ L9T3XFFfUtJD2QLEyVfp8XRmzhOJKcnTgIvesGx8qeW86w45pGVHrPVTwA6lsb+RwzCQ YoMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=fARMSm9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ne10si13253478ejc.543.2021.05.10.05.26.06; Mon, 10 May 2021 05:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=fARMSm9T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343708AbhEJMOM (ORCPT + 99 others); Mon, 10 May 2021 08:14:12 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:52703 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236627AbhEJLIW (ORCPT ); Mon, 10 May 2021 07:08:22 -0400 Received: from mwalle01.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:fa59:71ff:fe9b:b851]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 757B022239; Mon, 10 May 2021 13:07:15 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1620644836; 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; bh=UvqLle58hbQrYS8D+Qw3M/VyRDyS9/kql1bKzFA9u7k=; b=fARMSm9TNGEW00ePDePRuLEWD6meuhM4gNJBexH8X5WahVhkjcmFtIsh/DkiZ1PZadJdlT l3/Z/XBwt3yGoJUb3z5w+Uw2QS8BKKV+qPLzxcQb5TNaW/2096auE7k6llCniolwJprYq+ ygS8YDrQqBviVGNwEKsF4vjWMF4yaD4= From: Michael Walle To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S . Miller" , Jakub Kicinski , Xiaoliang Yang , Michael Walle Subject: [PATCH net] net: dsa: felix: re-enable TAS guard band mode Date: Mon, 10 May 2021 13:07:08 +0200 Message-Id: <20210510110708.11504-1-michael@walle.cc> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam: Yes Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 316bcffe4479 ("net: dsa: felix: disable always guard band bit for TAS config") disabled the guard band and broke 802.3Qbv compliance. There are two issues here: (1) Without the guard band the end of the scheduling window could be overrun by a frame in transit. (2) Frames that don't fit into a configured window will still be sent. The reason for both issues is that the switch will schedule the _start_ of a frame transmission inside the predefined window without taking the length of the frame into account. Thus, we'll need the guard band which will close the gate early, so that a complete frame can still be sent. Revert the commit and add a note. For a lengthy discussion see [1]. [1] https://lore.kernel.org/netdev/c7618025da6723418c56a54fe4683bd7@walle.cc/ Fixes: 316bcffe4479 ("net: dsa: felix: disable always guard band bit for TAS config") Signed-off-by: Michael Walle --- drivers/net/dsa/ocelot/felix_vsc9959.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 2473bebe48e6..f966a253d1c7 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1227,12 +1227,17 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, if (taprio->num_entries > VSC9959_TAS_GCL_ENTRY_MAX) return -ERANGE; - /* Set port num and disable ALWAYS_GUARD_BAND_SCH_Q, which means set - * guard band to be implemented for nonschedule queues to schedule - * queues transition. + /* Enable guard band. The switch will schedule frames without taking + * their length into account. Thus we'll always need to enable the + * guard band which reserves the time of a maximum sized frame at the + * end of the time window. + * + * Although the ALWAYS_GUARD_BAND_SCH_Q bit is global for all ports, we + * need to set PORT_NUM, because subsequent writes to PARAM_CFG_REG_n + * operate on the port number. */ - ocelot_rmw(ocelot, - QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port), + ocelot_rmw(ocelot, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM(port) | + QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, QSYS_TAS_PARAM_CFG_CTRL_PORT_NUM_M | QSYS_TAS_PARAM_CFG_CTRL_ALWAYS_GUARD_BAND_SCH_Q, QSYS_TAS_PARAM_CFG_CTRL); -- 2.20.1