Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930525rwb; Mon, 15 Aug 2022 14:16:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR72PcohPp9dLiDqczUXnL+/Qmvv382N2smytOgbGS+ki+qiiYWwmEAGuicdheEaP4K9l/o3 X-Received: by 2002:a17:902:7596:b0:170:a235:b737 with SMTP id j22-20020a170902759600b00170a235b737mr19156238pll.118.1660598089243; Mon, 15 Aug 2022 14:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598089; cv=none; d=google.com; s=arc-20160816; b=WkuGIUnh3et4WKiun1Vj+pvb0/Lidn7qXEh1EoTT5FTU3WC/uNmDEXEFskUyMcMH6b csluqxvtxEvXQ5G2HAlP4vcucwWM3PyuEPTyh59GeQmnC5FETtXtBr8POt6GJlixWnkm WBeVlp6RBRcfHiKXsd2aYbF6djhEItv2n1MCnGvLixrqYRGt2pKuo25k5zxeg+OkrrIM Rwyog6zHSJLWuYfYvPxz9Yc+vZ1xXLaMwO8gqWRz7wvOvCRLmmsKAW3+w/11PALbvXII /EvoJrgurkAT4IZttxnlY4v9MEenv9mb7yhaJmTO1Je3hL26SUAVA+PWnR8FWHOyHzdD mqlA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YeZvWmokX0eGHHPlyTRkUARHtdhM3gh3iGhXqa21X6M=; b=hd32wZUunqGghUGHsPrw/wkKePCcIVDJ7E21Fdknl4hjcfQuQNfPRbg02Teu1QPszS lFH1NsH5sAF96o9QmsTNpcZ1TcSN0IGeuy63ZNpRAZ4qitsZvvRsz1W9xv5kp1M1eX3Q iruj45p+au0VxzlExr6Krl5ujDW4Wc+rE1R4OwG6w+vj/BkEH+zW7nETeoRxWoCLgBaa IhhUnrJYqaN4Zi0anjaHuRGjT5FrX2CHx6hS/B6lPVwoVWx0mYBpOu0ilBQ5ds23hITb 6jnqjZ2mh+FPtqLc94CLCd1OW2K7zx5Dui7Bo9njVjgyQLnKWn9xxI46pzSMMNuLPljr RuRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZlobHPjJ; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a655ac8000000b0041d67aea419si12157151pgt.149.2022.08.15.14.14.37; Mon, 15 Aug 2022 14:14:49 -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=@linuxfoundation.org header.s=korg header.b=ZlobHPjJ; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244197AbiHOVJj (ORCPT + 99 others); Mon, 15 Aug 2022 17:09:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244915AbiHOVFb (ORCPT ); Mon, 15 Aug 2022 17:05:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF9C9D5985; Mon, 15 Aug 2022 12:14:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E32C60EF0; Mon, 15 Aug 2022 19:14:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 107E2C433D6; Mon, 15 Aug 2022 19:14:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590898; bh=A8eKkdgs0YzVymdzU8dECFJ/F2mnGOelqyLESFLxkg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlobHPjJbJyUj7aggrQ4WqEt+h7413xB5O+NFXeev0KXOw3ID5qPSDuTns9vbn3rK IU9juZtqhjZ0zTXbW9jseeoQ512DjPENpCF5vYn60F669X4neXEjQm1SCVtGue/TxV 3qbhsojs1KhaNSQaQ9TM50H7JgvSyBA9/+1ymsi4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 0407/1095] net: dsa: felix: keep reference on entire tc-taprio config Date: Mon, 15 Aug 2022 19:56:46 +0200 Message-Id: <20220815180446.545983881@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Vladimir Oltean [ Upstream commit 1c9017e44af2eee94b1001af18c401ae440ad77c ] In a future change we will need to remember the entire tc-taprio config on all ports rather than just the base time, so use the taprio_offload_get() helper function to replace ocelot_port->base_time with ocelot_port->taprio. Signed-off-by: Vladimir Oltean Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/dsa/ocelot/felix_vsc9959.c | 23 +++++++++++++---------- include/soc/mscc/ocelot.h | 5 ++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index f21d9ff40af3..3d86f061802d 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1207,6 +1207,9 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, QSYS_TAG_CONFIG_INIT_GATE_STATE_M, QSYS_TAG_CONFIG, port); + taprio_offload_free(ocelot_port->taprio); + ocelot_port->taprio = NULL; + mutex_unlock(&ocelot->tas_lock); return 0; } @@ -1255,8 +1258,6 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, QSYS_TAG_CONFIG_SCH_TRAFFIC_QUEUES_M, QSYS_TAG_CONFIG, port); - ocelot_port->base_time = taprio->base_time; - vsc9959_new_base_time(ocelot, taprio->base_time, taprio->cycle_time, &base_ts); ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); @@ -1279,6 +1280,10 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, ret = readx_poll_timeout(vsc9959_tas_read_cfg_status, ocelot, val, !(val & QSYS_TAS_PARAM_CFG_CTRL_CONFIG_CHANGE), 10, 100000); + if (ret) + goto err; + + ocelot_port->taprio = taprio_offload_get(taprio); err: mutex_unlock(&ocelot->tas_lock); @@ -1288,17 +1293,18 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) { + struct tc_taprio_qopt_offload *taprio; struct ocelot_port *ocelot_port; struct timespec64 base_ts; - u64 cycletime; int port; u32 val; mutex_lock(&ocelot->tas_lock); for (port = 0; port < ocelot->num_phys_ports; port++) { - val = ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port); - if (!(val & QSYS_TAG_CONFIG_ENABLE)) + ocelot_port = ocelot->ports[port]; + taprio = ocelot_port->taprio; + if (!taprio) continue; ocelot_rmw(ocelot, @@ -1312,11 +1318,8 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) QSYS_TAG_CONFIG_INIT_GATE_STATE_M, QSYS_TAG_CONFIG, port); - cycletime = ocelot_read(ocelot, QSYS_PARAM_CFG_REG_4); - ocelot_port = ocelot->ports[port]; - - vsc9959_new_base_time(ocelot, ocelot_port->base_time, - cycletime, &base_ts); + vsc9959_new_base_time(ocelot, taprio->base_time, + taprio->cycle_time, &base_ts); ocelot_write(ocelot, base_ts.tv_nsec, QSYS_PARAM_CFG_REG_1); ocelot_write(ocelot, lower_32_bits(base_ts.tv_sec), diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index b944fc670c72..c90a9a2f77a9 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -659,6 +659,8 @@ struct ocelot_port { /* VLAN that untagged frames are classified to, on ingress */ const struct ocelot_bridge_vlan *pvid_vlan; + struct tc_taprio_qopt_offload *taprio; + phy_interface_t phy_mode; unsigned int ptp_skbs_in_flight; @@ -679,9 +681,6 @@ struct ocelot_port { int bridge_num; int speed; - - /* Store the AdminBaseTime of EST fetched from userspace. */ - s64 base_time; }; struct ocelot { -- 2.35.1