From patchwork Wed Jul 5 10:44:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13301944 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB8D363C3 for ; Wed, 5 Jul 2023 10:44:46 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2042.outbound.protection.outlook.com [40.107.21.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B88EE10CF; Wed, 5 Jul 2023 03:44:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V+rU1679MwY3OZ5O4z8UPg1BcoDuhVPOoaHuNWAe/guEyngOY05XP6HvNVJ4oN34k7xrxqtLyECy0rMLPmn1WnGSQo4uRDRalfKrH6QCGRHjSVn27j5nh43ZHxQll7bM01UdTGd2kCbXZB6TMd5lBSAGGX3053Rz6fA0i9azLTcO0fZwTJmwCNIcOMzoinlPOR4WnTrBqT1gfGotj++bncGtB0hI2Hl6hK3NZhHhnY7yXANFGLtIGxhM5okosOd2GUBbjxXOWGwJuzCFP5iHhcmZE29CV9mE4CG4DH9Wbk+2IS/sDLgqCIDASkJ+QdOxyhhirKKp//GDsDKxtuyxrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mBPz7j0LflvGe/+o7Y5uEJUU07u0+Htbq/FRh6y5ajI=; b=EjK9M1TqY3diU0TpbUPUhhWKRAFCeBL7/EHpcNgHzXT32oLCPXwOXPY1rW9lzilBVa4h6iHn8LEhbxCjtdNIMmsCi/tvz86GR8yApmPWmz/pCagLAHtazYnAm/+Uk4o6t7TKjtQRLflZphJn1s4DI86goy3VZU3fC8/jnD21Txg4oofObsRcxWXvSnqoaKtWz/msdHUzDLsAqTluSSQEcCR4acWFsHvmKySQj/1DG9DeDS0s34M46UTrnoA7R43acC1k9fC28HRSEHG3PdhgDee8dnrWl+7sLEonU1QyAO9I+Xek9y64pCoOGizFOarUkjNwb/04c3t7s3agAiQaHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mBPz7j0LflvGe/+o7Y5uEJUU07u0+Htbq/FRh6y5ajI=; b=d4zBjCBYOEENBbbe2yhUJJ7Rz71GlXROctafqw/bsJrHYo8eJCcGSYH9jJaOMcJWRg8iLU9IOfs153MwXXyZyCFcD6Jq2IB1ZwVoCfZgwiRR43w7WZNwG/IXuyKfxezmVuoLCxkCdZkCVk7JSU1otl955iHuZ/ROQPMuV4frq3c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DBBPR04MB7658.eurprd04.prod.outlook.com (2603:10a6:10:20d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 10:44:41 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850%6]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 10:44:41 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Xiaoliang Yang , linux-kernel@vger.kernel.org Subject: [PATCH net 1/3] net: mscc: ocelot: extend ocelot->fwd_domain_lock to cover ocelot->tas_lock Date: Wed, 5 Jul 2023 13:44:20 +0300 Message-Id: <20230705104422.49025-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230705104422.49025-1-vladimir.oltean@nxp.com> References: <20230705104422.49025-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P190CA0066.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::9) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DBBPR04MB7658:EE_ X-MS-Office365-Filtering-Correlation-Id: fd4b71da-bf59-46a0-30f2-08db7d44d649 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VTaAw7R2z1wDNStkOLsGNLnTx1tIdgp01jtC9vTPY73qXku+fFBw0N2tQNG/QyAJBuHvEvbW0ciTD4/EmywyzcwbqvjBHQZISK7KlWohi+i1Koa/LJWviX0cPzlCqEQgvX1NZ3zcXoMNU7eLcVK0wndeh3+OphLAbKZt+puMTHNX+vPhdEnkBAHG0ibSbIvF9bbk44YjkJY0zKOKblctbXo9zGdRmAQlTLZSiyZtCYbIpUNI2mAiR5reGVvghkK42+/YQJEsJ9KCuPS5XRykPdvpB97Ovo/QpDETH1hhP8Iu4qY15bYD6URffmUdkHzq8zqFRJ8/gj+9LCCllv4Ocm5p6cIb5TxosldY3OBiUymKAQpQlVoCqG7DX4SuiS6lfL0y6TkSw+0PWZf6eKC61lLJcHFhmXrqRZymiSZhfYiTOgV1Csxqits/DSVVangVVNg7bHn5feZOtLooQVbJOqYmQxNknU7MUlemG6SAiHZ2fT3eQ7JIh2WWqW3pjsRBRIDDGTIoTB2tkjZSuV97XwObjw8xq0oDGCCgVbERoXHDtKjBHKA/5zvtmhdYlwtHPygX3r8YZYGG2+W3zIknZnTGPQ0xQ6pjxMiS38oaNCShdvPsaOamS9TjUuie5pIt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(451199021)(41300700001)(478600001)(6512007)(54906003)(86362001)(52116002)(38350700002)(38100700002)(6666004)(6486002)(4326008)(36756003)(316002)(83380400001)(6916009)(66946007)(66556008)(66476007)(2906002)(8936002)(8676002)(2616005)(5660300002)(186003)(7416002)(44832011)(6506007)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: e9Yck8awXRyqp+NXQZYsCjNpaBg2Fjcb5plxr9EzOiQJRnObybUmfQPucaUm3LZu0qvIn/QUb9fmDGO7qm8WyUk31KkwM2oBNiR2HflcpBqQkbAfypppm8RO8pWpcfTQCB2eyqYjcHBPJ3FOnvhtzlj4R+NcGnW/ko830La9BVt6FTL3rufQwJb7Lu3bgE2CU1vaKePX7mYG72vq0d0lbhPbchjnV4J6xw4R/eLl2f6bZqIVQZd1oAMoFCX5/6KQOCi2szPFE5QC+9NXv345lx6Vvt3bz/OtMjPg4OxuS1c/VBwshr7Tz03ehW2XUZNmaDXGA6Zqobt8fKR3s8U+oFzKinpVIraeMuqpfJo9EvFIgbqoWtNUZ7/WyLL4s+6krKG1x1fO5k6shp72S4b/u3Qg74B2tGABeYnVuQj5crRXCY3kzi/HKlVQV2AzNdhLXrrIZTLy/f/RKuUz4dsfPqnc7zpWNV7Wvrq1p+wxCfWV0af8sR06OpRkxg4wTvhgBjc61sszHNx0oMqzJvdZWLqkKtwMxpWHUjL843IKUfunX8N5eDIWGwnWoTxxnLgCUcfDyliEO2hkTsKVOJ+AjKHB2g9ylsZjKIa5WiXjH/n6SJH4CYah3TGDLXT+/T7s+Bcgv0RAtbBXsb5bpckJNopTvI+yV1heSwmZm0RqN5MnvGm0vjH2vQX7OKIDUmE7hRH1rVxFczmkukxHzU/c6vVjIDQFJg5miCwQFwndkoETKnftNdgRObUFBxwhTnIyEP4pNyFZq2bzrxunKJaFhkPWZXKsoFxz9Xow81QI8SsjOfTBGk37IWLyAcpa9y+Vvyhe4fPrP6LFwdyyO5rVQPR1V2SVcfz1dACbOBI7r6spqjvZgJJvuJL2bnDX4YSqHCPTYkcEqgY+iGnS0K2GdRINIWB+coC6YrAkOeugSv0K12gIb5AqE4V8n9xpW588wD4h6p2UF1MNerbt6eAh3iUvlYlQxZbmYsipDmsycTWJ2tzrPP4PkK/CzT+unA9t2RA1xn11n8F7Dxy9QaxJY+XEYwcr9yk4/Wwy/A62gTvAvCeuXVoO3WuFeHoVOR82hJObCMZW8hNxWnXj6YwCvU82d7rgwEKcVDZMzAPGPh+SmjfeN65Hu89U1EX48S1WQhZ+avWeWiGNkhp1239W5VZ822190swSlXBL6Mf8Bo1L0grPsgXDOOJ41WdBIFidAzUU+cYBmRBE1rcwC5bvHd1OU6g6crs8spEOjLkVwzt9qwsb6F335llm01zFx2uQ2aBFwIloJmVIdjBxZhwul5qlnmAYXIS9zOr3jteZv7msTkVM1yLc3QX5n3NXxIhz3Tvj3ZkaIIkzp3nJVfQR9Fv25UztQukC6xNm8avIzJdgzTwZasCpoDEdQ0H9UsPXnGie5tGJmCJjw4bZXHUJQcNM5NTJvyR6ZQOWLyXezhjiNJCkpNjBoY+YxeYAqb8qhvH+tIX/6ppxVb6hpQ65z2pHMbFTl0e6OK8WSvnSrJeXgeDJo3lqlbK3TsIGQo9bul5njZDXpd8AGG0M1Z7witnHXFuH7VTP/t10QiQeTJwFgP1HlsOKFHuUYrh5FU3+An4a2jlVMZ7fRN75NVlAtg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd4b71da-bf59-46a0-30f2-08db7d44d649 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 10:44:41.0872 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6sb3X/y+Kh6EJgZ6FVl1eGHqWNR0xKC8TXJiV/GkU0Dorhhi4xR7Qn01oJfC/5lmgzNFdagAhqExPbinf4rCPQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7658 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 X-Patchwork-Delegate: kuba@kernel.org In a future commit we will have to call vsc9959_tas_guard_bands_update() from ocelot_port_update_active_preemptible_tcs(), and that will be impossible due to the AB/BA locking dependencies between ocelot->tas_lock and ocelot->fwd_domain_lock. Just like we did in commit 3ff468ef987e ("net: mscc: ocelot: remove struct ocelot_mm_state :: lock"), the only solution is to expand the scope of ocelot->fwd_domain_lock for it to also serialize changes made to the Time-Aware Shaper, because those will have to result in a recalculation of cut-through TCs, which is something that depends on the forwarding domain. Signed-off-by: Vladimir Oltean Reviewed-by: Simon Horman --- drivers/net/dsa/ocelot/felix.c | 4 +-- drivers/net/dsa/ocelot/felix_vsc9959.c | 36 ++++++++++++++++---------- drivers/net/ethernet/mscc/ocelot.c | 1 - drivers/net/ethernet/mscc/ocelot_mm.c | 7 ++--- include/soc/mscc/ocelot.h | 8 +++--- 5 files changed, 30 insertions(+), 26 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 70c0e2b1936b..0c1207613aa4 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1790,12 +1790,12 @@ static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu) ocelot_port_set_maxlen(ocelot, port, new_mtu); - mutex_lock(&ocelot->tas_lock); + mutex_lock(&ocelot->fwd_domain_lock); if (ocelot_port->taprio && felix->info->tas_guard_bands_update) felix->info->tas_guard_bands_update(ocelot, port); - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); return 0; } diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index bb39fedd46c7..56b8bcac9690 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1217,7 +1217,7 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) u8 tas_speed; int tc; - lockdep_assert_held(&ocelot->tas_lock); + lockdep_assert_held(&ocelot->fwd_domain_lock); taprio = ocelot_port->taprio; @@ -1259,8 +1259,6 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) vsc9959_tas_min_gate_lengths(taprio, min_gate_len); - mutex_lock(&ocelot->fwd_domain_lock); - for (tc = 0; tc < OCELOT_NUM_TC; tc++) { u32 requested_max_sdu = vsc9959_tas_tc_max_sdu(taprio, tc); u64 remaining_gate_len_ps; @@ -1323,8 +1321,6 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) ocelot_write_rix(ocelot, maxlen, QSYS_PORT_MAX_SDU, port); ocelot->ops->cut_through_fwd(ocelot); - - mutex_unlock(&ocelot->fwd_domain_lock); } static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, @@ -1351,7 +1347,7 @@ static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, break; } - mutex_lock(&ocelot->tas_lock); + mutex_lock(&ocelot->fwd_domain_lock); ocelot_rmw_rix(ocelot, QSYS_TAG_CONFIG_LINK_SPEED(tas_speed), @@ -1361,7 +1357,7 @@ static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, if (ocelot_port->taprio) vsc9959_tas_guard_bands_update(ocelot, port); - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); } static void vsc9959_new_base_time(struct ocelot *ocelot, ktime_t base_time, @@ -1409,7 +1405,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, int ret, i; u32 val; - mutex_lock(&ocelot->tas_lock); + mutex_lock(&ocelot->fwd_domain_lock); if (taprio->cmd == TAPRIO_CMD_DESTROY) { ocelot_port_mqprio(ocelot, port, &taprio->mqprio); @@ -1421,7 +1417,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, vsc9959_tas_guard_bands_update(ocelot, port); - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); return 0; } else if (taprio->cmd != TAPRIO_CMD_REPLACE) { ret = -EOPNOTSUPP; @@ -1504,7 +1500,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, ocelot_port->taprio = taprio_offload_get(taprio); vsc9959_tas_guard_bands_update(ocelot, port); - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); return 0; @@ -1512,7 +1508,7 @@ static int vsc9959_qos_port_tas_set(struct ocelot *ocelot, int port, taprio->mqprio.qopt.num_tc = 0; ocelot_port_mqprio(ocelot, port, &taprio->mqprio); err_unlock: - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); return ret; } @@ -1525,7 +1521,7 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) int port; u32 val; - mutex_lock(&ocelot->tas_lock); + mutex_lock(&ocelot->fwd_domain_lock); for (port = 0; port < ocelot->num_phys_ports; port++) { ocelot_port = ocelot->ports[port]; @@ -1563,7 +1559,7 @@ static void vsc9959_tas_clock_adjust(struct ocelot *ocelot) QSYS_TAG_CONFIG_ENABLE, QSYS_TAG_CONFIG, port); } - mutex_unlock(&ocelot->tas_lock); + mutex_unlock(&ocelot->fwd_domain_lock); } static int vsc9959_qos_port_cbs_set(struct dsa_switch *ds, int port, @@ -1634,6 +1630,18 @@ static int vsc9959_qos_query_caps(struct tc_query_caps_base *base) } } +static int vsc9959_qos_port_mqprio(struct ocelot *ocelot, int port, + struct tc_mqprio_qopt_offload *mqprio) +{ + int ret; + + mutex_lock(&ocelot->fwd_domain_lock); + ret = ocelot_port_mqprio(ocelot, port, mqprio); + mutex_unlock(&ocelot->fwd_domain_lock); + + return ret; +} + static int vsc9959_port_setup_tc(struct dsa_switch *ds, int port, enum tc_setup_type type, void *type_data) @@ -1646,7 +1654,7 @@ static int vsc9959_port_setup_tc(struct dsa_switch *ds, int port, case TC_SETUP_QDISC_TAPRIO: return vsc9959_qos_port_tas_set(ocelot, port, type_data); case TC_SETUP_QDISC_MQPRIO: - return ocelot_port_mqprio(ocelot, port, type_data); + return vsc9959_qos_port_mqprio(ocelot, port, type_data); case TC_SETUP_QDISC_CBS: return vsc9959_qos_port_cbs_set(ds, port, type_data); default: diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index 2fa833d041ba..56ccbd4c37fe 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -2927,7 +2927,6 @@ int ocelot_init(struct ocelot *ocelot) mutex_init(&ocelot->mact_lock); mutex_init(&ocelot->fwd_domain_lock); - mutex_init(&ocelot->tas_lock); spin_lock_init(&ocelot->ptp_clock_lock); spin_lock_init(&ocelot->ts_id_lock); diff --git a/drivers/net/ethernet/mscc/ocelot_mm.c b/drivers/net/ethernet/mscc/ocelot_mm.c index fb3145118d68..f3c0e6c32934 100644 --- a/drivers/net/ethernet/mscc/ocelot_mm.c +++ b/drivers/net/ethernet/mscc/ocelot_mm.c @@ -89,17 +89,14 @@ void ocelot_port_change_fp(struct ocelot *ocelot, int port, { struct ocelot_mm_state *mm = &ocelot->mm[port]; - mutex_lock(&ocelot->fwd_domain_lock); + lockdep_assert_held(&ocelot->fwd_domain_lock); if (mm->preemptible_tcs == preemptible_tcs) - goto out_unlock; + return; mm->preemptible_tcs = preemptible_tcs; ocelot_port_update_active_preemptible_tcs(ocelot, port); - -out_unlock: - mutex_unlock(&ocelot->fwd_domain_lock); } static void ocelot_mm_update_port_status(struct ocelot *ocelot, int port) diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 22aae505c813..eb5f8914a66c 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -863,12 +863,12 @@ struct ocelot { struct mutex stat_view_lock; /* Lock for serializing access to the MAC table */ struct mutex mact_lock; - /* Lock for serializing forwarding domain changes */ + /* Lock for serializing forwarding domain changes, including the + * configuration of the Time-Aware Shaper, MAC Merge layer and + * cut-through forwarding, on which it depends + */ struct mutex fwd_domain_lock; - /* Lock for serializing Time-Aware Shaper changes */ - struct mutex tas_lock; - struct workqueue_struct *owq; u8 ptp:1; From patchwork Wed Jul 5 10:44:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13301945 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AD976FA1 for ; Wed, 5 Jul 2023 10:44:47 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2042.outbound.protection.outlook.com [40.107.21.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B1D5E63; Wed, 5 Jul 2023 03:44:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=no0rrri9gPW9IKXp6PL7VoDNz2eFWsEoX6BtKVht/8YDvVd6Mpb18kXbKyP8i+zKlo5qQGvyFHuz2Sd5AOXa8mqkk0IURUTCKg/VF+Z5uj8Y7HApi58Hez8jUtBDFQ1rpplj9sxYZMzEDE+Xu8zSy0pWRjbeEZGAZzB0uo2PPU4oErP66x4rPaiJ1swmamZmhUJepjHznWqvUXvXfbqEpsm0mJlTQ9S7+LdwQia4D/CniQxZnr+lfv8PleV9qjGjGsAZmr/LNeHc5tQsL+0ukundPlIZRg3jf1PmYn8vwXo4xOelwrJhaV1l/D5px/9oR4ZS+vjHkFzJQfhcmJbiHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5vjzePaioeTsDkh9vjTg1zeoZRJlJBcp/yfubCCw9Ns=; b=fm09asZsksxRB/BdvCVPl9+M3vQFYXC1XsVI+eIMTTojXUtjHgKNMIXMziCWLBdC4l4jCVobnxmN5eG1FCFXh5hlmSxry6GMa4WEhh149JsDGNtipKt3evtt4jajLT4s6Nyot1L4MiTY6KwisIH7k4Uj65DYecmvtReJ9cRjGfpd5Z2pLMtWyb3u+KRGUjXj51n2yjrlVcpOXQWTyca1aos8Wxl+ds6YbBmAU+MeX7YoaNQqEw4eGNRfAMa0i+83EyEmy0LHqFzgdaQw/HMGsPAdWc84W0zE+VByjy5kSUGf7a9UR6Xlaypi/RgVzTjZokabxi1fK1Nxxl4RjB6oKQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5vjzePaioeTsDkh9vjTg1zeoZRJlJBcp/yfubCCw9Ns=; b=pnogOtat1wY0GBKzZPspmhWeqKPNUNQadE083n077gA9RNy/NRFPbnnQXDahsoA+9mjyHyAdSAczJXXyd+U9rg0xc5v6HlkwgimhTEVPQRs4dk1dvtWYDcyq5KCnxZ9V/fNnJNXRUSsaV17+8YKb0H2DFJY5CyUKWCoeNNQtudQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DBBPR04MB7658.eurprd04.prod.outlook.com (2603:10a6:10:20d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 10:44:42 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850%6]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 10:44:42 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Xiaoliang Yang , linux-kernel@vger.kernel.org Subject: [PATCH net 2/3] net: dsa: felix: make vsc9959_tas_guard_bands_update() visible to ocelot->ops Date: Wed, 5 Jul 2023 13:44:21 +0300 Message-Id: <20230705104422.49025-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230705104422.49025-1-vladimir.oltean@nxp.com> References: <20230705104422.49025-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P190CA0066.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::9) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DBBPR04MB7658:EE_ X-MS-Office365-Filtering-Correlation-Id: cc0a1e53-e54f-43d9-3c0d-08db7d44d6d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zpev193K449akDb2N9kN8sFmFW7unvvv7Q+GZt3eS3t4UzlvTt+AM5LmSXXS8dhlQJXx6alXIiZ1ok7tKl2Nm47w/UL4wA5Xr2z3axWmbq3g2nsmrVM4en+b6E8q7ljwGDFlTxwjSIobZKbSNPSE3xurJtF6GrsdKaL8cIXkNkeF0HL69Z2lOwPfm5SgQ52EH33zpMZxo1H9SeG3VHZuXgioz1GTWvWtaWftIEzwccl+yiQaZ+hWZxOcWgWGQ0aNM6Yq2+WiSyYyCkJiG9mGJ3tgtt9THgE7ChcsOX0IblA1WngZbMCiq1cKqdz15c5GqUZQoW+2nZ7UY+Kh+5mEA3wT16X2dVvBo4ddeW9VyEnTg2JfyLMong0qOVuIUrG62NivEo/bIb656/DJ3ZF6hBYGHJ31v4mQwliQN7ojmcYpzS1QniL18fYbQ9uZRehLkVeNzkIz8oHn5+wtKbYtI80j0L73th+gYbK2YKC0Iuhss/mT8diflKIgC+4rsOOcgSBzlfwPTAGFBjplvJqMm91rzUxD7fACyYCewj7gsI/madktmDCt+cBl7Q+0jqU6a3rRJa6wpnVp/USh/KlianjHogHBsZO9j/F6nVmXLm8/SE6XXWj+PXk9nmJvFv32 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(451199021)(41300700001)(478600001)(6512007)(54906003)(86362001)(52116002)(38350700002)(38100700002)(6666004)(6486002)(4326008)(36756003)(316002)(83380400001)(6916009)(66946007)(66556008)(66476007)(2906002)(8936002)(8676002)(2616005)(5660300002)(186003)(7416002)(44832011)(6506007)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U6kN95WUdoQaRfnPk9N1cG0MqnlWCthLsboOX5TzwvnzgH025iOVXfpRGyo95VaniIO5BYYYELzNIoMW1HNshXFFaVm7pL5UsO6nT2jmQwdiJKtvlIPp7FVDe4fHYZgUXGGNGrlhhs1mNTCG0nZcDOag7GA9A2nD7ac8jNjNepLNp0YS3jJolX//XX1lRS7Tp3Gq/EOusSQgn7IhxQqkSwYBgEnYE6zjw1wfRZd8mpDgYWfiY753JRbQZzMy7XJhc7KB3e13lXBGu/rffgXfRBfzcm1714qcT6EQ4dA0VjBQba3+O5GUraZpOvyvuuzH3eag0bFLHUd1pRCaPYaOR0Zi5pcFnTTdfcf+tEFuT8+lP3tGWELSZ8YqSomiJVpkAC0FGpaccfLtXe68zE11Ppxi4OHVamurVE3/M7gme8pmhiiI8medUZnyo2+ZcCdptK6y3KLk4CoWCwyTrpJ8OaY34yvfvUc8TqcViDVVkO/dMiCocJEsoR5rZmMgabjjk7EznDwUQhKWm13T2m29CmUovx3Lzdfh7cBCUfiTC0rnegWudxl4iPeMPHza6nYLHbDipUsByyxF2QnEOnpHZlBbpIfKG6va0xOaPJ4VofWV8jOFivprw+KnxJfM0s5S9GgcqdXtk1MBKeLJwLnuglKYJ2HVb98bnO6gnZ4mf6Xw7k5eZy/WvWSU8tXY1uFVq46CO2kzvgwE+97ZtN5U1/b6VmnEvbDQ3xIyi9VHSl0edMNvlTQue6Mg2SwVJWuiVTsk/40CKCnoHXP5X21vdRekFZNPLfszuZ3aanBiKLU7hBJEiqb2x1RvdnuduBnL45HgEw5LXWgmROxWD0Or2jqLODK8qFrcN6p571kxqTSXem/nt/2xanO2wJs27ev/pwLZ+jZmt0Mi6EGQonlsdEBD8gce7Q+bSikgZDRM7vg05zBo6+3EbtJic9NGogDlE7U9tZK0tJfAon9pjzkTIsrbonpgwsxGkngq4K+Vo9M9krndpNJwt8z3+23m6PTX4bd4eO6nv7aHOX/4Cq6m49uJ/MxI9WKsuczSQwjgriuDWECosyojNpD7b0k55PoDdCG+ynGHfFFFLQ1q0303KpD4rYOPRkZKbNqfKTock2BvfTgOGU6+eu5dCU6FXixz7eKcsENiGqI2uCRvNn1vCvJ8bIiHqmE05ut3Kq6BrpoL+j2TxxURt3Cuk84UXz90C6ke8gMw4JHHcdejnO3J3j2vacWmK+5syfiR2gxZBDE7/qR6oh26zigxq2753X1IlfmH15eBv5OZ4Ib6yeRXbw2hGG4SQW0IkbOUm+fMH6WVEQpeOxhQrfzJz8gqyDIaM25dRd48tuKovsU64BgFlGfFM6KfmnK28556kKnHOYO/7WHKwYC9tOq7v5G9pZTA5SHH6MVdfJS0YW66P73yYUqz0b/PfeisMydL1IhjYFeMsC9Xv8E2XgN4ADSYM0qcUNUXrwCQTlHkiun4u8G3B1b+UnHeDeI/3iDZxGVPdO+XfvJcIf8cygDbf1HHcmepFaWBVtOeLJq3opXY6RRISaANlh7PqSzOeqJtexUCE1eHBGuUiM0P7kQpekvU4lLiEHj1QpMMyn/IB2HckJyiwg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cc0a1e53-e54f-43d9-3c0d-08db7d44d6d8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 10:44:42.0507 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hWOioqcXfO2wSud8BaycCwvmEbKqpPMKPs38bteWHyw0xRZySJM0VKp/7kUFrTRWq5Fxr6tCBz17jSrZnx1FTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7658 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 X-Patchwork-Delegate: kuba@kernel.org In a future change we will need to make ocelot_port_update_active_preemptible_tcs() call vsc9959_tas_guard_bands_update(), but that is currently not possible, since the ocelot switch lib does not have access to functions private to the DSA wrapper. Move the pointer to vsc9959_tas_guard_bands_update() from felix->info (which is private to the DSA driver) to ocelot->ops (which is also visible to the ocelot switch lib). Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix.c | 5 ++--- drivers/net/dsa/ocelot/felix.h | 1 - drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +- include/soc/mscc/ocelot.h | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 0c1207613aa4..dee43caee19e 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1786,14 +1786,13 @@ static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct ocelot *ocelot = ds->priv; struct ocelot_port *ocelot_port = ocelot->ports[port]; - struct felix *felix = ocelot_to_felix(ocelot); ocelot_port_set_maxlen(ocelot, port, new_mtu); mutex_lock(&ocelot->fwd_domain_lock); - if (ocelot_port->taprio && felix->info->tas_guard_bands_update) - felix->info->tas_guard_bands_update(ocelot, port); + if (ocelot_port->taprio && ocelot->ops->tas_guard_bands_update) + ocelot->ops->tas_guard_bands_update(ocelot, port); mutex_unlock(&ocelot->fwd_domain_lock); diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 96008c046da5..1d4befe7cfe8 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -57,7 +57,6 @@ struct felix_info { void (*mdio_bus_free)(struct ocelot *ocelot); int (*port_setup_tc)(struct dsa_switch *ds, int port, enum tc_setup_type type, void *type_data); - void (*tas_guard_bands_update)(struct ocelot *ocelot, int port); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); void (*phylink_mac_config)(struct ocelot *ocelot, int port, diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 56b8bcac9690..d7caadd13f83 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2599,6 +2599,7 @@ static const struct ocelot_ops vsc9959_ops = { .cut_through_fwd = vsc9959_cut_through_fwd, .tas_clock_adjust = vsc9959_tas_clock_adjust, .update_stats = vsc9959_update_stats, + .tas_guard_bands_update = vsc9959_tas_guard_bands_update, }; static const struct felix_info felix_info_vsc9959 = { @@ -2624,7 +2625,6 @@ static const struct felix_info felix_info_vsc9959 = { .port_modes = vsc9959_port_modes, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, - .tas_guard_bands_update = vsc9959_tas_guard_bands_update, }; /* The INTB interrupt is shared between for PTP TX timestamp availability diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index eb5f8914a66c..a8c2817335b9 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -663,6 +663,7 @@ struct ocelot_ops { struct flow_stats *stats); void (*cut_through_fwd)(struct ocelot *ocelot); void (*tas_clock_adjust)(struct ocelot *ocelot); + void (*tas_guard_bands_update)(struct ocelot *ocelot, int port); void (*update_stats)(struct ocelot *ocelot); }; From patchwork Wed Jul 5 10:44:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13301946 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4629F6FA1 for ; Wed, 5 Jul 2023 10:44:49 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2042.outbound.protection.outlook.com [40.107.21.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83F7710E2; Wed, 5 Jul 2023 03:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D0uWuHWY15ZZpX/2mcaOfFbA01Dq6oa0Mukyxwvum4Gvzz3+7JWrIGXVmBRiguferjfp0sLfEjno/9+FNWIXPm/mr6X9Yr02ZNY6BUlexq7qBF1FW/xoTm5DtOOD98vOhjgEGVg8UwyuhkhD3tM2lZeAoHyY7l/Cd5z4Fli54Sq4P1njVdhIdi6Y9CWdR3VpavhH+7GCEvZFkRyfUFWEaYH6OxgU6mhpJo7OCwgdAuHP+1wfVksO6r2P/iS5IAqBmvS8wa1RIHAptlp62kPvkyMWhSJDBgZiVGU2CVuJCyEbabJ+wKlWNJbQ3MiFYrshmrlJ8n8pdzPg+BtonnAptQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+S/P45oboQINAOfQiR6wVqrvX/Lkqn1Qt+9oFesH5U4=; b=DU7UKTQwcXeQqYxyqH19qG/p8lbyd+YM4qYUT8QAaw1+2q9zLcFT+/y/lCbPEQxOJxAuM6BQrdG4C18pZ/7MfmtPtj3e7UXreshjgBmiycoNcgzdSPnIbOsNkHee5/SDcJ4ApL88bpNL503Rk1IlVQNTY34bN2wZaGxx97rW5I4yUR3JUFkWHWyhqco8pss+IcAfN9131I3BWimcRTDNCP9VXh4ZVXbcF1zk0xrimdzwkOsG07sXE5Gol9tQ2B4qp5w7LEXVrklYDqARGHogwHyOOCY9IuW9QwguPshYJuo2O6iQe3siqsyh71i8bgvGpt0OxHccqmX3JtMZFaTc7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+S/P45oboQINAOfQiR6wVqrvX/Lkqn1Qt+9oFesH5U4=; b=mBN+Yt2/ex/wIEOtG5SRfOQE4RszUCIB4e0/D+A5PH/DTVVIeY5a5xmLlTEiQdpo8J0NWMl0csSZZfbo8RX6MwXgJhin7JSjthBO1FmPecNWbPAZP/5tOPYyscoOMdwSTzzOVbAwHQQibf3zwe1gJ0pcauzz+RXdnPZVgJtlvL8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by DBBPR04MB7658.eurprd04.prod.outlook.com (2603:10a6:10:20d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.17; Wed, 5 Jul 2023 10:44:43 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::cc2a:5d80:9dbd:d850%6]) with mapi id 15.20.6565.016; Wed, 5 Jul 2023 10:44:43 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Xiaoliang Yang , linux-kernel@vger.kernel.org Subject: [PATCH net 3/3] net: mscc: ocelot: fix oversize frame dropping for preemptible TCs Date: Wed, 5 Jul 2023 13:44:22 +0300 Message-Id: <20230705104422.49025-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230705104422.49025-1-vladimir.oltean@nxp.com> References: <20230705104422.49025-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AS4P190CA0066.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:656::9) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|DBBPR04MB7658:EE_ X-MS-Office365-Filtering-Correlation-Id: 1f3895ad-6a93-4458-a980-08db7d44d769 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MnO4cYYxHZpCmzjwwT7eOjxX16STFyUq7+X/WzpdzE79kbWjBW3R9KC/5Tli4rD6ucDa+c16k37LXgAl4kDlqiccUQ1YazS3/mB+ZZGr1Y4G64AGrongQ7GWuSg/fQSU3Jr/UwCPTkZfJjCUw8SBPsauoC1ZQJw+x5qa2pa+wepf+ud9EkGOzsCFvgBck0ufZQwTIni7j17x9Zd1wjXjsocsHGh/o+UspXo3T7/7HFUaH1Q6RTimVw3IKfur6aho8SZZUCejUwF2SxKuJqgN3XqlQoMCgX/FLd7MHFLxwv8q/hGHaJvxDflChSlrylp7FUBDRC23D3qTI4xbBdmhgXQF5c39cmcUc4bYMyiT5dfVzhOLvZ4HuaHxjCOEubq8+yjFM8Kef9DekB1PH57mM262pvrvWJ8pr4MnNFybTP972cLq6yAUIry3ixOCOl2X4DMIxvb0fR8PPTQb3+UgadDfCWFQcMHnR8MtlustSOdBhOIQPBsXFGdAq5Hm7sPueo6Ar2fTwpFyZ8AKmtZHpPxvyDodmf8kgM2eXqoC+k0Cn/GhQy89jTgdZ4QkL3yJefchrVbcrGZmRnRczv31AtmdYh91h3Akd7RbiXHcHjpWefnnz6pA1YPuaGLvvTrK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(346002)(396003)(376002)(366004)(136003)(39860400002)(451199021)(41300700001)(478600001)(6512007)(54906003)(86362001)(52116002)(38350700002)(38100700002)(6666004)(6486002)(4326008)(36756003)(316002)(83380400001)(6916009)(66946007)(66556008)(66476007)(2906002)(8936002)(8676002)(2616005)(5660300002)(186003)(7416002)(44832011)(6506007)(1076003)(26005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bozBtAznxQavjlYlTIx4njmLTwTMKAvCCSJFLFwprUjgvTFN/sNJ+B06t65+HZpTzSeDQmXv474SfmtGpPrfE20WPKaBO0tGLfVvOfWUkaJMGKGYaNbKDThh5m95+WTw5u3V802vzNxqrwuAOa2u8vmNME9cN6Rjfsl5r387oHRLhIR1srRwM7scsTKElAZgqL5uIAljjJJfDAdVGx+76nJB9dDUnzuFYjQ5hAJQBUg8CokZs170lj6slsKCufN+4Utevf4ItTsDulrnbdLnAhJ0qOTvRzCjNmu47Ky0f+Nuj2I7HasZ6xxtvYjGlfziT8dAOtOqrRvbS2RDSM8qqmZfEuZtFZ3QnQnWx9f+SyNalDhHUmcRGZ+uAIxUrRik+U5NI3eN9lEozVo5MPpb16LTbSZzMSxpE/3OOAqHgG9wrq0cfFWlORjPZN5bWlWyupWMZsgAkMnvjR1G7yluZzYTzBviUr/tcQi3aOwpM/9jh9dSIjrLoKFVCOJ8VAPRxPWRCRMyYmDdnreKS/K+M9CeEZmz7odY9Al3RBtSoAcHAg0Cd1ZoobmnoS8Wh5zkFg3NX0sLvP96ymN8XI48bdwWli6+TJZuVBIVRMKxSHgxHDHXpbLwhGHder1Nrz/6I4PQfkxFu8wobIDJxMm05v5SsOMXZmLQWKIjDRmW6o7W8mbjZFcVCTaKf1DHcN2880RaTmOcO8YTSNHub23ubVsJ7sSK2Q3HvNJzP4XXE4ffSJBta+bjQ8H1vZAfANfKcwU2MNDSBqXVtb2JjPQpYf6l6J380Afg8mlY2glrsBxSYQyHIEhWulpWWhN+p22mLj2cJTyQuZu3SWJjGFbOcccJeP1Qo5r5Ng+YtTv5nUHkT3OoGFlpyvdifGz4JVYqWaxYlVlY7cnYPsEzVGrgz1yExGuLy6zcq+CqWe1Au7a7tCbagfb3EsbYZICNcSjWGgIzPad2FWVG89YrQx1NTmCFqTOR8S848osTxYMKZE1rZe72VQc7knYixDTmBMUQGtj4zeRWYT+40JeTUz/jQRfevbRk1j1Gfu7M6sHJ7ZLEQxMllJaddlLm8wu5R8u1g8mYuCaTh0kcrH5GRYT8FJdQJd+rQbhAHcPhqwJpBhJKhgwtDBCddPqR/IBZXaVYlq6PVDDnmia1lJyj2V9DBPhL/uK+vwwwRMe9uWOJ63Wb5LvoRg/QXkZmODTMrbfcV6zaLPHccpfHGQolI56B+z3OSkoriKso+n0TJwh3b6MmTnuJU9qXk1vhGpTOESRjQLXDXtskUcvz4VxEachYTKDdVNhQfLr2MrH1ljO2tUkF5Wovu5sxMl2pGUen3c9FuusH4l6YxWJTOp+DC18Wq1VgMl45XhPOqKTgMcLGme1EyHVo5GUIuUQ4w3f8+7blXL5YkD92eww+iIc1DuTYskuH203/PJhMTG9kOz40OgMSLWQfqHZdgENI4ZdIrte42ALyuswlAN6JyllNUBEviEqChiD7hk8g6JGqPPmNWjJK0QMxBxNXfBRjF9+X4wCe22ETndLDPpCvtY+1lfr5D4thVoK4KfiJU0oaD7W7VdTV2WpPS5y50wVh2+3kwUpdqB/EnhJjerpAIUNcnRLXXQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f3895ad-6a93-4458-a980-08db7d44d769 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2023 10:44:43.0061 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ipq2SoAIFfjYJHNZjSDDidiJYfyV8/qViY+3r7Tc7Bl6bociWJJ+w8qisRejM0zGm5+2hUQ+JphIYz+Dk7+Ylw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7658 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 X-Patchwork-Delegate: kuba@kernel.org This switch implements Hold/Release in a strange way, with no control from the user as required by IEEE 802.1Q-2018 through Set-And-Hold-MAC and Set-And-Release-MAC, but rather, it emits HOLD requests implicitly based on the schedule. Namely, when the gate of a preemptible TC is about to close (actually QSYS::PREEMPTION_CFG.HOLD_ADVANCE octet times in advance of this event), the QSYS seems to emit a HOLD request pulse towards the MAC which preempts the currently transmitted packet, and further packets are held back in the queue system. This allows large frames to be squeezed through small time slots, because HOLD requests initiated by the gate events result in the frame being segmented in multiple fragments, the bit time of which is equal to the size of the time slot. It has been reported that the vsc9959_tas_guard_bands_update() logic breaks this, because it doesn't take preemptible TCs into account, and enables oversized frame dropping when the time slot doesn't allow a full MTU to be sent, but it does allow 2*minFragSize to be sent (128B). Packets larger than 128B are dropped instead of being sent in multiple fragments. Confusingly, the manual says: | For guard band, SDU calculation of a traffic class of a port, if | preemption is enabled (through 'QSYS::PREEMPTION_CFG.P_QUEUES') then | QSYS::PREEMPTION_CFG.HOLD_ADVANCE is used, otherwise | QSYS::QMAXSDU_CFG_*.QMAXSDU_* is used. but this only refers to the static guard band durations, and the QMAXSDU_CFG_* registers have dual purpose - the other being oversized frame dropping, which takes place irrespective of whether frames are preemptible or express. So, to fix the problem, we need to call vsc9959_tas_guard_bands_update() from ocelot_port_update_active_preemptible_tcs(), and modify the guard band logic to consider a different (lower) oversize limit for preemptible traffic classes. Fixes: 403ffc2c34de ("net: mscc: ocelot: add support for preemptible traffic classes") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix_vsc9959.c | 21 +++++++++++++++++---- drivers/net/ethernet/mscc/ocelot_mm.c | 7 +++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index d7caadd13f83..1c113957fcf4 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1209,11 +1209,13 @@ static u32 vsc9959_tas_tc_max_sdu(struct tc_taprio_qopt_offload *taprio, int tc) static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) { struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct ocelot_mm_state *mm = &ocelot->mm[port]; struct tc_taprio_qopt_offload *taprio; u64 min_gate_len[OCELOT_NUM_TC]; + u32 val, maxlen, add_frag_size; + u64 needed_min_frag_time_ps; int speed, picos_per_byte; u64 needed_bit_time_ps; - u32 val, maxlen; u8 tas_speed; int tc; @@ -1253,9 +1255,18 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) */ needed_bit_time_ps = (u64)(maxlen + 24) * picos_per_byte; + /* Preemptible TCs don't need to pass a full MTU, the port will + * automatically emit a HOLD request when a preemptible TC gate closes + */ + val = ocelot_read_rix(ocelot, QSYS_PREEMPTION_CFG, port); + add_frag_size = QSYS_PREEMPTION_CFG_MM_ADD_FRAG_SIZE_X(val); + needed_min_frag_time_ps = picos_per_byte * + (u64)(24 + 2 * ethtool_mm_frag_size_add_to_min(add_frag_size)); + dev_dbg(ocelot->dev, - "port %d: max frame size %d needs %llu ps at speed %d\n", - port, maxlen, needed_bit_time_ps, speed); + "port %d: max frame size %d needs %llu ps, %llu ps for mPackets at speed %d\n", + port, maxlen, needed_bit_time_ps, needed_min_frag_time_ps, + speed); vsc9959_tas_min_gate_lengths(taprio, min_gate_len); @@ -1267,7 +1278,9 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) remaining_gate_len_ps = vsc9959_tas_remaining_gate_len_ps(min_gate_len[tc]); - if (remaining_gate_len_ps > needed_bit_time_ps) { + if ((mm->active_preemptible_tcs & BIT(tc)) ? + remaining_gate_len_ps > needed_min_frag_time_ps : + remaining_gate_len_ps > needed_bit_time_ps) { /* Setting QMAXSDU_CFG to 0 disables oversized frame * dropping. */ diff --git a/drivers/net/ethernet/mscc/ocelot_mm.c b/drivers/net/ethernet/mscc/ocelot_mm.c index f3c0e6c32934..c815ae64e39d 100644 --- a/drivers/net/ethernet/mscc/ocelot_mm.c +++ b/drivers/net/ethernet/mscc/ocelot_mm.c @@ -67,10 +67,13 @@ void ocelot_port_update_active_preemptible_tcs(struct ocelot *ocelot, int port) val = mm->preemptible_tcs; /* Cut through switching doesn't work for preemptible priorities, - * so first make sure it is disabled. + * so first make sure it is disabled. Also, changing the preemptible + * TCs affects the oversized frame dropping logic, so that needs to be + * re-triggered. And since tas_guard_bands_update() also implicitly + * calls cut_through_fwd(), we don't need to explicitly call it. */ mm->active_preemptible_tcs = val; - ocelot->ops->cut_through_fwd(ocelot); + ocelot->ops->tas_guard_bands_update(ocelot, port); dev_dbg(ocelot->dev, "port %d %s/%s, MM TX %s, preemptible TCs 0x%x, active 0x%x\n",