From patchwork Fri Sep 23 16:32:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986778 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 539AAC6FA82 for ; Fri, 23 Sep 2022 16:33:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230194AbiIWQdc (ORCPT ); Fri, 23 Sep 2022 12:33:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiIWQd2 (ORCPT ); Fri, 23 Sep 2022 12:33:28 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0459013F281; Fri, 23 Sep 2022 09:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fDro3kwfOGoR79n42Jif69bSh+e82ek1p79uYJCCPSYdM9BhCp32nablZpvvumCSoCBayy2YNFKm/g5Gg351hfVGooea8Tlx4ZPMAHIzxjirKdqbUh22B0bHcMQGC10UyODxvfY/nBBMNlHdVjh4xdFm6tmsxI566KZ+6TlIrf7CTTQbuI+eARcdZnGaJxz18j+YkHNKdN1I1EljUVSZVEK1J5EWct/SjQoFkFFSxrPJqCI8PDgHTrzuir/jmpfAdz2HwuvIIrqJNtS+pRfI08DMp5vfeQUPdFXsNyHbR68jhk7IxKldaahO+odR7hU/mdG3rR4fzLDBKpIaCVO1AQ== 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=c4prPwTUPpFXhVR2H0K6Zwb3DcuwqtlOXy5MI42LeaI=; b=PMZlkSfVDaK60/rl3MUbMfmBGyJeHMKYAuOeqNjXW2gFLuqjsmSpJMJMPcVCPb1wXlz6KUo9yyb4DBFckRD+k+KJVcDVZKCaHHA1wKU1+I37I5xETfnCyZNE8bC0qQXJfVtMNzyg5zU02hhp1YhSNxFcK/voAmiGV7X2/yYt7V9tl87JezMvITmD+aH4DwWvNvrwjer+Pq8SYn+41A+zMS+ZfTWlL9LSVVFfOA1/muK+7WGSb/F40OV7LOMyjuJRmV0lfuzOXQmcFw7N90BD7YOO92UQJahJ8HbVoo0NCMmhTcne7TTxp5M7NP3RaqbluA9MrQXH8ESFLu/Oz3+aUA== 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=c4prPwTUPpFXhVR2H0K6Zwb3DcuwqtlOXy5MI42LeaI=; b=d1CclM2X478XG/4MWdgaNGnntB5tSd7GzjmjURnAoNbU/iaJ4tfc0teqYpnt6t+3n7o4Sbowr7jQudL9VCJML26TtAWRIGsxhm/R6TVewAbcbhWo1IxlKACDb6Fv7lsO5ystIPqjlKDwdIi1/Km4D0KFLbUEo4WDMctDe6WWlvQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:25 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:25 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 01/12] net/sched: taprio: allow user input of per-tc max SDU Date: Fri, 23 Sep 2022 19:32:59 +0300 Message-Id: <20220923163310.3192733-2-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 83edd099-ae5c-46f2-da93-08da9d815695 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8nkA5fNKj6uBDVRUzjnIe0jPh2X2yVFp9OFxsngN2kqiKS1CfXR2Skc9ju72RbanTpDCQBkUrzXA9AtdazT1YvWiaNjird12obGGmktQLpb1bi8hcsgOQ5TTe684oNVBMGZTXq2qr/1yhKCKfPWBOJH/dWH4gu10LXDAm5n/B8Rz+AlQN7+6PfQ5Y4HfGSsd2exnC+3sdQ4/4VMjvHUpFddbXcgp90Clcwi7X2V28talanYjNSEg7uaMQkJyZY7KUbiiY/H7l4mLdjLo8rTARTkeWd9yWKdCfGPAqPTumT8OtuNNqPWQNNNSakNL84EKtiC5J9+2D+BwZo1RkMfgmm5uMUBdbNTkdn+839F6khKPL/buy7UC8C50e3HIkQVaP9TwE4/zOPoh08OqSPBLyIlmGtdyetI9p4JGVyKYF5rnJrYIdmUnE6yDHaPcwlvfJlbgLqL3c9bevyM1OdK4aO04l96VTqnIRi12gynWfeBcKhDL2eDZJS83Zu39nJlfLAJAw609c/hVdt4+vGpHPbxMOi54aPX3PkVSQwadmFeNBJaedaYDESiYOeZTkGkYteKIJjkzEzo5ZsRAooAwpiWKqQRphucK/ZrggZSThlr2NAjhLk01bp6kh5tpdmZ/UR14O8178v6F/DZhiTDAaoU795zlEOmQQF/KKq8PSdr7r+BV3bzLisV+sndb0A2u13Utu+EjI5xoQ47KedldCtWDu9EOwJaCqIOH/PFAFelk1NZDENSY9Jf6sABTlg9lvwFL7jwYtH3bgLUumaguXA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jwFBB4YqtlnOpVO0BErP1d/JhcyBPlkxXgYUB1Ind9dWfnUHgPfpIFQFflE7rQOlHRck+9A1Tq52W3OjTaRy7lR2GaOZLOaF1OlGbTvPBXt5BL+OOUTgKQjcLLmsPz19ga12KCqsQfc5o4XfXU1/9F1vWqFECXvypi6GPygE1IX7h8xpDZiup1fU04E98Kl6yA7Q9+1sXDqI+q10qYmYfgocBBXLE+Sq5wk0yNPs0W3SPjK3pQOYaiFQadBjDMSLuCA8/iNWX74nkr+dL1v5NCkBgx4pGqzTMP800Nab3qIMQTBHM6jByfdms63RfTiHOMsc2UwIbNeC0W1NXzrBO9+ZwK/DEukioQP7UWSS6l7UMtqpQ1lnu92hXXKhASm9nuwsD4BGmw+DU/rZjoQi3R7qGPbK48RZOeaNEPqZXqy8GnMEQ9+ll0P9sJE3O3yUYi3yMcg/udkdKAhykG6G3SqtGnB/skTnx10ti04u/SF42OsM5UO3dsKnxZ2LivhypC7GikCmCtlKy+aKixUv6hjOzOdZAj+ocf/U6Rs+Xif9jQLhRAu/4okjUsZgsy/vAYJ1F3gs8kB1lID0Oyz9kH/0WE7NBSoS/k9wr1WTqXPFBFqkiaz+gtrJjx1qomT1+uinMOGnlhqmFuO6JhWyemOFeLQGATHSBG1IqDJmGqz/aLbXWEb4d9I74dIgudnKScLfJeyHR14fNnnjeEwj7yQSu6eCZA8Ioar3q3RbxzEEt9sgIsV/BP6Ga5WCyJpuV9jxw/UCyiaL6YVpvj4PuHjEEeAkezmokm4xw8WvcMX6aJ9wYDETUg8/H70RDPyUZAPHNO8xTt9CjRs0Wpet+EUaNWi0bVsBhmTCU8dDMX6SFJ2+AVoBhIOMqSMsszvhNTxTon9IrE/Ha4/PCuUoUcSeq4f38u78qPuafRc5o7+7BXFREALUHsCn1Sg1tMf/mbCI0bFkp3x8ELo+7fvYf0XywxWSsjuVhW1SxkEykaUkfiBDj758ffroI5CCARhikeWECICdgLitaZuDs60NfP+mC/V4qzVnuBumOng8khvJj4VGtGN2W9ZAu9HznlkUEGxIKjiAUsJQzzBoTsHpswSF+ao5fqiJtY0BglggUE6brPvtGg0B1wOfLXiDRnGCtExOk4q1TGp9tVPcpjkxacJlsFfHN/dEYDd4NGp04MUrgR/uM25rnm9IWw/0rav3wmLOznsDa4AKOQxW41HiBaPwPf+JRYPshRbaBLsP3QPut7xyzqsOsLVO66k0/WO60sBtpzBGTbM1B5iXUAWM/W/CnzuA0EqZs4wrBq+7AqU+GQpXZXTqhcvI9ZspxDTwzYSfcPyiCPx++9f7dLdQ0fPLORMvkIu1RmM6SJlTL67mB/esu0m9sKKlyVg++czxoMM+fArTUaT+/RJnE2S5kJ6k8a1798wVfeJk94ntwGFHaHud9nPLNfPcazS08l1KrRin7cFw7jKqgBm/2MgISRAjjZ7+5HwTE3mEwiozz1fVJhJjM9TzNEul3RgXaOvis+3GeNnEW2KdBRK7CXQkGtZtJI5EBKQwirUM4Bwf8/m1hijH/6+zJIW1WL03G9M921xiPRnznpDoa9SfAt9OUA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83edd099-ae5c-46f2-da93-08da9d815695 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:25.7537 (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: qLbHAUdFy46otvMN5FtuQn13WbFu5HxRHtApL58IgnifRmbfwWAxxsOkCsT3pZscyJHapUSQF7AAZDXmFu3eGA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org IEEE 802.1Q clause 12.29.1.1 "The queueMaxSDUTable structure and data types" and 8.6.8.4 "Enhancements for scheduled traffic" talk about the existence of a per traffic class limitation of maximum frame sizes, with a fallback on the port-based MTU. As far as I am able to understand, the 802.1Q Service Data Unit (SDU) represents the MAC Service Data Unit (MSDU, i.e. L2 payload), excluding any number of prepended VLAN headers which may be otherwise present in the MSDU. Therefore, the queueMaxSDU is directly comparable to the device MTU (1500 means L2 payload sizes are accepted, or frame sizes of 1518 octets, or 1522 plus one VLAN header). Drivers which offload this are directly responsible of translating into other units of measurement. To keep the fast path checks optimized, we keep 2 arrays in the qdisc, one for max_sdu translated into frame length (so that it's comparable to skb->len), and another for offloading and for dumping back to the user. Signed-off-by: Vladimir Oltean --- v1->v2: precompute the max_frm_len using dev->hard_header_len, so that the fast path can directly check against skb->len include/net/pkt_sched.h | 1 + include/uapi/linux/pkt_sched.h | 11 +++ net/sched/sch_taprio.c | 138 ++++++++++++++++++++++++++++++++- 3 files changed, 149 insertions(+), 1 deletion(-) diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 2ff80cd04c5c..3c65417bea94 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h @@ -168,6 +168,7 @@ struct tc_taprio_qopt_offload { ktime_t base_time; u64 cycle_time; u64 cycle_time_extension; + u32 max_sdu[TC_MAX_QUEUE]; size_t num_entries; struct tc_taprio_sched_entry entries[]; diff --git a/include/uapi/linux/pkt_sched.h b/include/uapi/linux/pkt_sched.h index f292b467b27f..000eec106856 100644 --- a/include/uapi/linux/pkt_sched.h +++ b/include/uapi/linux/pkt_sched.h @@ -1232,6 +1232,16 @@ enum { #define TCA_TAPRIO_ATTR_FLAG_TXTIME_ASSIST _BITUL(0) #define TCA_TAPRIO_ATTR_FLAG_FULL_OFFLOAD _BITUL(1) +enum { + TCA_TAPRIO_TC_ENTRY_UNSPEC, + TCA_TAPRIO_TC_ENTRY_INDEX, /* u32 */ + TCA_TAPRIO_TC_ENTRY_MAX_SDU, /* u32 */ + + /* add new constants above here */ + __TCA_TAPRIO_TC_ENTRY_CNT, + TCA_TAPRIO_TC_ENTRY_MAX = (__TCA_TAPRIO_TC_ENTRY_CNT - 1) +}; + enum { TCA_TAPRIO_ATTR_UNSPEC, TCA_TAPRIO_ATTR_PRIOMAP, /* struct tc_mqprio_qopt */ @@ -1245,6 +1255,7 @@ enum { TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION, /* s64 */ TCA_TAPRIO_ATTR_FLAGS, /* u32 */ TCA_TAPRIO_ATTR_TXTIME_DELAY, /* u32 */ + TCA_TAPRIO_ATTR_TC_ENTRY, /* nest */ __TCA_TAPRIO_ATTR_MAX, }; diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 0bc6d90e1e51..c38ed1861ee7 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -78,6 +78,8 @@ struct taprio_sched { struct sched_gate_list __rcu *admin_sched; struct hrtimer advance_timer; struct list_head taprio_list; + u32 max_frm_len[TC_MAX_QUEUE]; /* for the fast path */ + u32 max_sdu[TC_MAX_QUEUE]; /* for dump and offloading */ u32 txtime_delay; }; @@ -415,6 +417,9 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch, struct Qdisc *child, struct sk_buff **to_free) { struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + int prio = skb->priority; + u8 tc; /* sk_flags are only safe to use on full sockets. */ if (skb->sk && sk_fullsock(skb->sk) && sock_flag(skb->sk, SOCK_TXTIME)) { @@ -426,6 +431,11 @@ static int taprio_enqueue_one(struct sk_buff *skb, struct Qdisc *sch, return qdisc_drop(skb, sch, to_free); } + /* Devices with full offload are expected to honor this in hardware */ + tc = netdev_get_prio_tc_map(dev, prio); + if (skb->len > q->max_frm_len[tc]) + return qdisc_drop(skb, sch, to_free); + qdisc_qstats_backlog_inc(sch, skb); sch->q.qlen++; @@ -754,6 +764,11 @@ static const struct nla_policy entry_policy[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { [TCA_TAPRIO_SCHED_ENTRY_INTERVAL] = { .type = NLA_U32 }, }; +static const struct nla_policy taprio_tc_policy[TCA_TAPRIO_TC_ENTRY_MAX + 1] = { + [TCA_TAPRIO_TC_ENTRY_INDEX] = { .type = NLA_U32 }, + [TCA_TAPRIO_TC_ENTRY_MAX_SDU] = { .type = NLA_U32 }, +}; + static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { [TCA_TAPRIO_ATTR_PRIOMAP] = { .len = sizeof(struct tc_mqprio_qopt) @@ -766,6 +781,7 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = { [TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME_EXTENSION] = { .type = NLA_S64 }, [TCA_TAPRIO_ATTR_FLAGS] = { .type = NLA_U32 }, [TCA_TAPRIO_ATTR_TXTIME_DELAY] = { .type = NLA_U32 }, + [TCA_TAPRIO_ATTR_TC_ENTRY] = { .type = NLA_NESTED }, }; static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb, @@ -1216,7 +1232,7 @@ static int taprio_enable_offload(struct net_device *dev, { const struct net_device_ops *ops = dev->netdev_ops; struct tc_taprio_qopt_offload *offload; - int err = 0; + int tc, err = 0; if (!ops->ndo_setup_tc) { NL_SET_ERR_MSG(extack, @@ -1233,6 +1249,9 @@ static int taprio_enable_offload(struct net_device *dev, offload->enable = 1; taprio_sched_to_offload(dev, sched, offload); + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + offload->max_sdu[tc] = q->max_sdu[tc]; + err = ops->ndo_setup_tc(dev, TC_SETUP_QDISC_TAPRIO, offload); if (err < 0) { NL_SET_ERR_MSG(extack, @@ -1367,6 +1386,89 @@ static int taprio_parse_clockid(struct Qdisc *sch, struct nlattr **tb, return err; } +static int taprio_parse_tc_entry(struct Qdisc *sch, + struct nlattr *opt, + u32 max_sdu[TC_QOPT_MAX_QUEUE], + unsigned long *seen_tcs, + struct netlink_ext_ack *extack) +{ + struct nlattr *tb[TCA_TAPRIO_TC_ENTRY_MAX + 1] = { }; + struct net_device *dev = qdisc_dev(sch); + u32 val = 0; + int err, tc; + + err = nla_parse_nested(tb, TCA_TAPRIO_TC_ENTRY_MAX, opt, + taprio_tc_policy, extack); + if (err < 0) + return err; + + if (!tb[TCA_TAPRIO_TC_ENTRY_INDEX]) { + NL_SET_ERR_MSG_MOD(extack, "TC entry index missing"); + return -EINVAL; + } + + tc = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_INDEX]); + if (tc >= TC_QOPT_MAX_QUEUE) { + NL_SET_ERR_MSG_MOD(extack, "TC entry index out of range"); + return -ERANGE; + } + + if (*seen_tcs & BIT(tc)) { + NL_SET_ERR_MSG_MOD(extack, "Duplicate TC entry"); + return -EINVAL; + } + + *seen_tcs |= BIT(tc); + + if (tb[TCA_TAPRIO_TC_ENTRY_MAX_SDU]) + val = nla_get_u32(tb[TCA_TAPRIO_TC_ENTRY_MAX_SDU]); + + if (val > dev->max_mtu) { + NL_SET_ERR_MSG_MOD(extack, "TC max SDU exceeds device max MTU"); + return -ERANGE; + } + + max_sdu[tc] = val; + + return 0; +} + +static int taprio_parse_tc_entries(struct Qdisc *sch, + struct nlattr *opt, + struct netlink_ext_ack *extack) +{ + struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); + u32 max_sdu[TC_QOPT_MAX_QUEUE]; + unsigned long seen_tcs = 0; + struct nlattr *n; + int tc, rem; + int err = 0; + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) + max_sdu[tc] = q->max_sdu[tc]; + + nla_for_each_nested(n, opt, rem) { + if (nla_type(n) != TCA_TAPRIO_ATTR_TC_ENTRY) + continue; + + err = taprio_parse_tc_entry(sch, n, max_sdu, &seen_tcs, extack); + if (err) + goto out; + } + + for (tc = 0; tc < TC_QOPT_MAX_QUEUE; tc++) { + q->max_sdu[tc] = max_sdu[tc]; + if (max_sdu[tc]) + q->max_frm_len[tc] = max_sdu[tc] + dev->hard_header_len; + else + q->max_frm_len[tc] = U32_MAX; /* never oversized */ + } + +out: + return err; +} + static int taprio_mqprio_cmp(const struct net_device *dev, const struct tc_mqprio_qopt *mqprio) { @@ -1445,6 +1547,10 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, if (err < 0) return err; + err = taprio_parse_tc_entries(sch, opt, extack); + if (err) + return err; + new_admin = kzalloc(sizeof(*new_admin), GFP_KERNEL); if (!new_admin) { NL_SET_ERR_MSG(extack, "Not enough memory for a new schedule"); @@ -1825,6 +1931,33 @@ static int dump_schedule(struct sk_buff *msg, return -1; } +static int taprio_dump_tc_entries(struct taprio_sched *q, struct sk_buff *skb) +{ + struct nlattr *n; + int tc; + + for (tc = 0; tc < TC_MAX_QUEUE; tc++) { + n = nla_nest_start(skb, TCA_TAPRIO_ATTR_TC_ENTRY); + if (!n) + return -EMSGSIZE; + + if (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_INDEX, tc)) + goto nla_put_failure; + + if (nla_put_u32(skb, TCA_TAPRIO_TC_ENTRY_MAX_SDU, + q->max_sdu[tc])) + goto nla_put_failure; + + nla_nest_end(skb, n); + } + + return 0; + +nla_put_failure: + nla_nest_cancel(skb, n); + return -EMSGSIZE; +} + static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) { struct taprio_sched *q = qdisc_priv(sch); @@ -1863,6 +1996,9 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb) nla_put_u32(skb, TCA_TAPRIO_ATTR_TXTIME_DELAY, q->txtime_delay)) goto options_error; + if (taprio_dump_tc_entries(q, skb)) + goto options_error; + if (oper && dump_schedule(skb, oper)) goto options_error; From patchwork Fri Sep 23 16:33:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986779 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51CCBECAAD8 for ; Fri, 23 Sep 2022 16:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbiIWQdg (ORCPT ); Fri, 23 Sep 2022 12:33:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232835AbiIWQdb (ORCPT ); Fri, 23 Sep 2022 12:33:31 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60074.outbound.protection.outlook.com [40.107.6.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA84E13EEA1; Fri, 23 Sep 2022 09:33:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYgC7wM5r6r0EliZOLtmzIE6ziFg7t1vb/C74XIhgRTFkraGfG+2VlvTBGtmk/0YBR4f8Swrreb44lsXzR+TIUTbRjiRCWTl9Pq1ixf5a82njICvCJu5vYZjMc/5RgvFw2M0OyMrqoT+fUj1WH2j/1OgeLSMfSKzuTg0bLsdhQef+tcxxorUKMtbDt1qSqJWQvf3l4VnwWY8k+ZhIFG76X643wonjCo+elO6YuPHCeZszcIvncMmTMA/TRcA/OhvAkc5fDkLCLgaM3yv3doqQ549CL5zOP0X3MFcRvLlFWdXZrMmkN22+HsCCF/gtOgYaPD5r2WLwlwj2RJcgB7HWg== 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=DYmX8GNzk2hhjzacqwVe+rd4e417YN1Rn+qmxJLqH5I=; b=h9l1rs1K9Du1t/f5nKEStmo1d1vkJGQpVa+1523p2FCCT1AzissTOIEdVz/Q+ek2ye/eBnR8bAlSegqGKgCn8ba8kqN2ogas2Yyk5+D1/kTAYqb+rhdElb/QFogSOxIWj1qNAujjNI6wLyUkNTr4yV5XPVf39hbus7jRYmDfzBBKbCeRuvA4YDf9W9MXxc028/AenNt0jantv+uhHvqCf4/kNlzYd0k9SDM1kNpRsiMCh8m+joq4/A+77Ru4sE2fKchGJBLXgdTPjCnvIWksiTwzYH0j+achGWB3JfzGuGz3zoCOrS4KbIwMdtkOl1AdJXpWwBAb6Rz73yxC1/h68Q== 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=DYmX8GNzk2hhjzacqwVe+rd4e417YN1Rn+qmxJLqH5I=; b=T9fVe2hg0RLHicACOzxCvmumbtytuBZPRZelPCgXYp8X8I0GmkggYWZrweoXEAchvlHCF5RmD8/g5NGOseS/3jN77Q4EGgoVf3oyRfpT/4MZ71+loS9UoTNg+7y45myNVR5IQU91f3apRSY4AP9Y02PPIAIxEQu7BvCfwEuzFNw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:28 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:28 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 02/12] tsnep: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:00 +0300 Message-Id: <20220923163310.3192733-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 782b1eb7-0857-4df8-3378-08da9d81585d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p2uq4dGUC4A41Nd4nC1FpPDxpEMiqhEWeDFcQeKjImoj/R3GpiZuD6nmt7iFEfnB2DPwVIUAWo2LksuqXpymvjpe+q4wts/VmrEHRio+wBmj7AOhMYerTo+hwdcrQN6DoVV2+AURCK6wZTvO0KtCCz1uQp/RcMXF5eBgOnMNSmUUnfmHZJbqiGVaj+vFyuNAUGNubwJIX7nzNZ0AsGiwFoVp/mQ3fbAbtXQGLHvmMM515VMAHud1y6JfTW0uKaKTr+qkHGNd9nH1OLLi2cEN6KBmwatta8EAaT9RkeVYjBZaSEPrsVCgs2JM7Jc7ajOJdERNOat7FcRHhxVaHAGAjy0vS4zz0IrK/oCow+AE1HixAn7Jwl7D5GQ9fdaenz+ZDk6AcPGQFMtM1QRJUHTKVQMU5IVJVEkMSituQ/Ihk0AUEAGJpdmJ8wzBuXGbXY80suoxu7JUNhsiAGBkoNXvANtyqWz+J1LEIYUAL6SFJoZsZPoj+3EpZnqOzCK5x3LJ+3tZ0h84pJ7FC50cFJtws/o2bB03l9NGS7C1xno423jbfRGgoJhtGi+m5V/P7oQWE4K0n9RaIDJh1LegWXAIIcELsuEvN//fJOuLl5LWuJiSsrbFZiI4M7F6RjdxD00MBXfa/jmODxZ8OMLFJzV9ZjORVsjFwtccCNDhek3Pz8KPykKm4w3H8BGekEpVeJGoZPqmz8079jvQEjmowa/Hdx6DkCzITTjHyk2zHkQh2cIHgDcKnVD4mH9o3G4KAj+jj/bLEHM2SlJXEBrQal/mFw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(4744005)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NGir6i9IyVOwh93IBTH2rlFe6O1qgE4kiqMU2xB7eilxjjxPvHLp03VNwavGmLlJ+Lnbh0pJN/BJNgzxMz1T0AViSoKJ2ROcW2GT+BJNESY5JZr52EGGgWwBdfV+hqxGsQurrIrAO/cwDj083WR3QIiLg3A2RzqZoKWyS1ePYC9W7QonRtPaQ5jW1GD09HA4Yy6KNNjJBHbwSGXmh1KJA5x+dvQIlaaLHAxD+LFGODwiS/e5mn2xiJ+ebddV4dGiy9ppqj7mNzDbSpxpWn/2syNDmk9YvcttSSRbgBzOoTi3Y9jgrj39sjpsL8JTAy/GrLv64SDvaZGlaKqI9iXxnA9nCDYQz611U6Oqp+ZO9BU2M6ct+aTbAFzjUqPo4UZG1KCr/R99q4h22vcWF8jGyciW2rtOoLcjntP3m8I9vv2l/jVeix9g8W7DOD9QTz9PFSBv29t1+baiYFD7nqX787ISrgFYmmBvaVceB/9d3R/7Hh0UNx8ZSC01RXdj4YZG3xb5QdhWn5PsVVcJJvTzK2oxxWVFf2cmDmIKKEVUGlMuYly2B4AHbi5qejq+jfVDH42d2fXcjFs1c9nVS6HxYP0iLJzlwQAkq9cYesC7686ajBU8yD7Ok83wMkuqlxrSNdXGUcdwh7zKbS0rKJD88Bv1aqobiqvMJ5ki89Ct+VGJYqJ7S1qBTeuOzfnVl3//AgXcRNMM59ybMZmokNV6DQd3yrA37dq+AVcXMHJdCelwO6er0x/UMqWAoH+Qio1ChlI8HG9lv9IxlYeVMRIMq6F4H6WJgHsPdt+qAydHBqXbHk5TV5BE3TuZ4DM4vKfMWZeyoZ4iaYL8SY6JotpPqdizt33Fiy4FqcfhWkdSp0BNmXG2Xjn7LS9cW5cBWvSPo5Or2ttQzwQgDd4Gtulxd5BFY3md/QDzEjVEj0vpxosAGB0HL5jqk8PrtZZUDEovNecaNi3JSE2uL3TyHSldTdblIId3sCivmi5Jw+rYgtM7xCqPH9GGqNNZ+cSfCUnTAVZk+tYphL3r9PFGfyiNxsLQfYo6KOjk5MVVbcAz8Gc7YtGDi1wKsIhgIS+FRQuwj3+Kj496YehP10Uww45BL91HF8uE1z9gvNZp/VbqmNIWyb2yzBarQXWxZVML25BSGeXe4fpFB2YbqQ0W7n1uPsNcDXFE3y6vgPi01qRyMCUP9MwKoZEtkSEee74Xu7MQslJ6Hd0zqbeJdnQnRR27PlHRcOZJf9+s9KnLuFPY8OuvTIVrua/4n9lEgjdnyLwY0HYSwOrHkmIRMMFokCmLnT9nMEMexCPL7qm7jKzsW73Z1vP+ugIKambUNNZyHA35D5GGeG8PqxmSaXF8GdlldidjL6d13nbOim2rOlntqMXSvWv/QbOU2lBVe8XDKRYXwtOtPw0p/ldNQcOOpXdpVX8R4UsO+e3OkdwkPAPBafUaFLqOXzZxemebjVBTmkNH4OvGpLoQ5MKfhrvQnltY1dhOFWTY3dj2ZhkM2t1Sfl5R/i84jsT5ZwIk5jUgwyjVLr7ysE3EGDZUmLL6gAOXHdVJIH39ttVDd6JlpKa2k3IztBclVNbEE3NadllzXujwsSAYlsdov5JmVBSX3vWccA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 782b1eb7-0857-4df8-3378-08da9d81585d X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:28.7847 (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: PFnj+okgWkNX6u8LwttD9vNNK2phhMkn3F0KAW9FFPNHEHQq+eK6cvChYQby16b4mPmGMfqLUGsr1aQsB1BvXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument, deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/engleder/tsnep_tc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/engleder/tsnep_tc.c b/drivers/net/ethernet/engleder/tsnep_tc.c index c4c6e1357317..82df837ffc54 100644 --- a/drivers/net/ethernet/engleder/tsnep_tc.c +++ b/drivers/net/ethernet/engleder/tsnep_tc.c @@ -320,11 +320,15 @@ static int tsnep_taprio(struct tsnep_adapter *adapter, { struct tsnep_gcl *gcl; struct tsnep_gcl *curr; - int retval; + int retval, tc; if (!adapter->gate_control) return -EOPNOTSUPP; + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + if (qopt->max_sdu[tc]) + return -EOPNOTSUPP; + if (!qopt->enable) { /* disable gate control if active */ mutex_lock(&adapter->gate_control_lock); From patchwork Fri Sep 23 16:33:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986780 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ECFC4ECAAD8 for ; Fri, 23 Sep 2022 16:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232068AbiIWQeC (ORCPT ); Fri, 23 Sep 2022 12:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231533AbiIWQdf (ORCPT ); Fri, 23 Sep 2022 12:33:35 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD6013F2A3; Fri, 23 Sep 2022 09:33:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aIC+anRx86GJXY1TzD+7g8IofpyJcxpuWPwACEl4dqkR/IYf27iBgSvTjwKkt2UY5bLaqAXxeN/i1ZSG69JDPLnvRO+5pxY8bIZTnxPXTCGV5wvFjvn+QJHP/D1UXNiKn/63XPlqnNHXKj7TVQrxSSaiwVUrdC/ecTXgajl5/BioU4HVWFJJwrQnug0GMLrdvkLIvOFDcR9O9OVpZfOJY8E71qv4D5/e6BIUPuOEJs7jkPtWQElmOh1eGZLfVdkzV6bZygOqq3SylfYJTXvTpaA5+PpVoexMFdp/F7kqjJuSiKLi1bnzsdoIWZyGZUIr54+fmAOp6VNZDCb62uzjBQ== 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=RUjX/LuUdguQ+awPauiylJgRCMwFHy6EX+2eWNmipac=; b=PN7FP2g+6XH1CdyN9a48VWtv0RpAz4FNtttZCbceCFjCQwo3uJwC1e/34k0UDEXJ8t8z3q/rpGy2Kou76Ycv7HRmn0ntJJET6+86YdEbZOXZNyNavxFtDOMJuLmitKrnlGMk9/E9WaOHwc+CqvhtwEctEuGa/9cY/9gpr8bAL3H6/0p6PsdJhvrC1XYe08G+idqESPysx82Ea2SbdX1Xx4/XVhFY4JiqPee5QQt10p+9erKN2r+B5VI0cK2fq1qbJL32GdXsXMq8cyKQzlg1p7JffglE3858Y13xQmw8ZzNQMCx/M3pbrDGOoFj1k7G4tihNL7hXk9onYWgeR+Fk0g== 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=RUjX/LuUdguQ+awPauiylJgRCMwFHy6EX+2eWNmipac=; b=hLfbnoxZop4B19zXUb8kpl1lxpJu/rbYBAsN5XuimCBk9/kzSrf1A9egFTwF2kovXrJtZRlSPT16JUs+0l4GBeRTE/M6TXuRHcRnSp0H1qmdxdJflqbw0iALUWvFC6RxNV01UQ3q0ckZ+TQW0rpsmilMWqgK7d7QNwDOXy1qhSc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:31 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:31 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 03/12] igc: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:01 +0300 Message-Id: <20220923163310.3192733-4-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: c7e6b287-e209-4f5a-f0ab-08da9d815a07 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YbEuYPVjZT2/zun0SqGqg/StOpP8ojpzteLRL4O3ffJDUJ3bybHSRfaMT7mzmPaaL1WUFr3wk+yqqOB7JU9b6sQhNd8pnXJbuJxfDnYFB3tjl4/TsJGpUVaopkF0HRHsCwLuqQw8oqAecqgRyiM460Ymcn5IRYYzHQ3wb3vTbWeeza7WE4ATu5pOPPaLaRX3NlLok9SsPW26rKCNfnW12lqLhiZAScwRBpgyodJtJHd8xfbLSDqdKuEj8JvGkUgkA/XTEsfMMDzRoAjELU1VEywb3AoWWKn6SxvmHay6tCpEK1vuZ7Ae427/TOq1DQZSgK62go5ETk2ar8RtIWQ4fDfswGaJr5lHmPlMG9CG4vp9fEdoJTdngLvUYZCPEY7sdv52IKyWyxti4olS8jE/wC3jsm9rK/WOBGajNQTjVDoHi+wrQKNZIE0NsmSG03iDCN6eSLXQToCkr8UBoAjRg2D/kFg7nzvHsC5724oLIV2H16IMYfbimN5+1HuEPXiw2V2rJP0BM025JZaaFpVlKGUWQWvi5iUnGQNFuj6r4cfm18bL/eFJLYFpUEvF4BEBTp1IWhG7xn06uMTBBATl/14oFmtjq3OYbTXqy4IdjMRGSdGwGZPrKToEPs30vbSJEZjXFUCEPS/cw6BOh1XTSCl2Mlp3wyUoPN9kE44VDQpkazzHhzvF3PM0Aacnm6/9q6vztBNAA2Sx/Axn2ZCW0szwnEHuGA9YYM91C7h/cphXaj6Ny86r2ASy22HhQe+/fOlSphvi+TbAaJ+c45siMw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: a7kLhEP8n4ApgQnUTUCkoRSUsma9liiE2JJ959kD6rvekXI31V+v905QpcaZ9xS0Qy+PT4X/wNxuDcpGN7Nq0CxLw3eDDKMaKZwO3nLlh3vtlGdtjCXAt/qHgJMi+/S5Xh/vCgLAct/wz6zKFpWYDpHifjOe8BSXg8XCYuZbWwAteEGcCJ+mQRWkW0SnhmVYz1amXg2tFZRj44g6uBn1tfr6Q2orjoQMkx4klGT8wH177Aad5UTkDXR33xHj28af4E2X3rLvFER9zCwTQTEC122XR9+w9sOvn7aQ/m7c7LRNqotMko7MlWj+I5Wx2YpyiS6bMoOQ9sRzMcY2FfRMfwVnKaGwnziHIH+MkbfqxO5H8onht/BKCx+gEqICfOSmyps0cMYWPlYMUdMjeqp+aUUZtTMHvwGcTuJj7T+8+YvsJSy4xG/ad3hKhUO1hEC/c5tmrUApBnNh1Y+YZyTZ3OTTmSV5E2BrlOLRjInB2ypL0/e2JAMnEGkr51PpAFHN6CgTeVIUBwl/U1fB0JE4NeWpT7zVxr19iFY3A8tL5RLBHLUGsxyfvSTW25CoeeTT79rGTtAC/W39gHhfix1GL4p6V/gRRhDdfkx3u4uzgzSOGg5L3tRJEisUB8ymiOPWfqcHF+io9XC5MwNOtxSxX7j2ehfr/dsHX5uU8S5MUScGAN61J1DhXo+F/RSlYVE1+NDFLSTFI4G2+yAHjA/mwK0ZtXavwNMbrmoQsRMptX30eQBBvv3+2Zu4/Ie0BjlMBnxpavR+Qk3c5HlogcndUEm0kmRGm7SaKv4kpjFr1vTJ9QO32eSMFbpsSoHd4TWB8wIVe7Lw+7sTeML+o80KD175uEYYs/+5dCg8geUkYL6MEJGXaBvtW6+nHOtVObnYyw8a46ElHdeVfinYSCdbzHKDEYvFggha0+tiKGyH3NEd5o+UEgENpxJp03opMAybFNWVKupT3Fex0KiOQ1Dlg0DU9JOEigAkZNtwdEt0wOoyJ6Tsqj+TzT4R6QqSWX53CzyKL8mpUskN2hVeQt5qJBT/G7QakcWLz9BJxNA6MWlAco9T0NDn6T+1lMG+8i+vrSmhH8k+G4EYLwIx1nyofpK0l93BONvDfzcfx+628XIzIExvo4zPx8m3c189qDB4Bj4MeB9D+hHBpdYrvYAuRCKn43W8XuW6P9q0oviPsKAOPITAc01Z4ZE9Ucu2NFDxturERB6JEarb/tVYhZfbqjyOd61IYpaeDSZKo8fGVMA0IlYdO22ozGDhskjtVq14tgTLIveWutOOBcSjs3YS3LbthzwIuSK1NEwe9PR9vIzXX2aSby3kxUq8qdobNs76AkJXdQHsTHbKprw1tm6WxHRfhDhQqsgB+253hxGY2kNEYfuzlm9JrACo+BdrW+Z5NZ98hM/CVfFArQfz+dp+cA4V3f1K0Gr6kU0R662O63L5CyU4f4MCcV9GN/spPTsbk3zHObCpUq+p8ksKMmaLsCO+eSf+BFJ91uU1hA+H36mjAmMJjvEqCmytjIw2Tx5yw5F2RfgRNPlL3OED/hcAgSTN6FE/qv/FqznK3J8B4t2Lp6mmqMQghvHsxNA1Z9QiWQu4QfiGVr33HJxAIk0/Ug== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7e6b287-e209-4f5a-f0ab-08da9d815a07 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:31.5189 (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: 0Z2jsUWFg4ulAByrPRNd0zYBHiCISEoxwLUkVQZEzoZBI3WbovDmkXN/8uzkcPLIvaWD4z3uD3UIPmktz43Mcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument, deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/intel/igc/igc_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index bf6c461e1a2a..47fae443066c 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -5965,11 +5965,15 @@ static int igc_tsn_enable_qbv_scheduling(struct igc_adapter *adapter, struct tc_taprio_qopt_offload *qopt) { struct igc_hw *hw = &adapter->hw; - int err; + int tc, err; if (hw->mac.type != igc_i225) return -EOPNOTSUPP; + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + if (qopt->max_sdu[tc]) + return -EOPNOTSUPP; + err = igc_save_qbv_schedule(adapter, qopt); if (err) return err; From patchwork Fri Sep 23 16:33:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986781 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DE68C6FA82 for ; Fri, 23 Sep 2022 16:34:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232905AbiIWQeD (ORCPT ); Fri, 23 Sep 2022 12:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232867AbiIWQdj (ORCPT ); Fri, 23 Sep 2022 12:33:39 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3889413F297; Fri, 23 Sep 2022 09:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kcyYJau8TwwOP5ohWx0OM2yeTJJlAYCNW+BY5LyD9w2bDe3oNqlcencPv/LXES9TX2MUHsVoZWpzaPVJlt8wzw4C/i1WD0+FxSYaB6nnbvAuuODrFpZ3lSLcSw5axNAqhXZGBx73quzqg4cIyNXrr8qVJGMFizxgm+GulEJniRGAx7qGggjxTqgWe+oYGejqQZ3y1jzhr6ywHKyrOLxWq4fwb//lkrbpwcOIbg3ywrOGuFLuzu5JgYJvSPKeAjEp0Jwpq7ZbUOQWnC79fZa9raZNVcQPimgq9HnpD4XrhCJZHGc1JPtNcD/M09jB8uGbegFqFRdaVFumlNPmJKUxUw== 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=PwgRF5vQ31hB0Ud0Xog6REIZGvB26mJcMWzOfBDPXrQ=; b=btLH9y/kl99fqA3CjxWoUSI/IYrkHcnE7Mb8jIdqniOqVDQx7G1GD613Gy++loaL+GUynhvwt0tpX8l7KbO1yLExMG/7m/bCl8MO4GJC39Cs6u0OcchgCLiKz0JZStdbahXl3QVqhTdjBIZpVcQc5JIFCorNOXmxUVemINwxfbyhXovMQr9g1vTurC1gL1k9h+1WZbvLKPea6Qdjn2T8ZYrgqwH8ChK+NeMO5OHZrJUYB7w64Ov/Fhf8suS2jNnh0LJAbT93ptOSY/Tx92EMYyQfBPRcVt5fTiHBe8ymotD9vkj63SnzciMjjk5mZ5Q0KXc4yF0GezTwRIh8WBRNfw== 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=PwgRF5vQ31hB0Ud0Xog6REIZGvB26mJcMWzOfBDPXrQ=; b=STB7vyHE96SUjiTXGHzsNiNRK40qUX2wRY0lwD2C17AIf+Rc09HyEfXOThvSKw1ddQqhBDmDGgAjH5yUZa0HZRsaUp029RWR3HSle4+ZYVhFgjrcWfT9mpZNIORqDKUgr4W2x1NgD498lxLATVAcxUZ7LF3GNbntSz6EqZXknvk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:34 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:34 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 04/12] net: stmmac: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:02 +0300 Message-Id: <20220923163310.3192733-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 88c577e0-05de-4fbb-c24d-08da9d815ba6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bOVOQPy2NVRdD7m+PwKJiXA3t9RrBgAZwV8HmRjTIQU0wa6MtoFbT4UUwZF4BooFtmmUZZedjJllGyn0rhQEnBjGAMXqezVjYyJnxFmhIoEXWYAvihevqHsdye8bEbsjSrhPb3+rZZkLsYlO7vld7nAWwIVz3viieBfir41MAGUTjgUCaoHi3/abB4oWBBBTtOEVskgywfgWh6Vs51sxq2pHJn8tWd//KZnyZSPSJBa/oKEUrr5HDVpaSMSmBrXJ97CFpkRhaoIVvCBQiEFXOL3J/9VRFm08SPvV5JvNZrx3TqYIcqHBPmPFrG0kLgKWdI9Gz/2eUC8G7h1Mh/Attkxxj6YfN16Tmu+UiDpRQ1VojHUMoRCYXGZh2cKIM8No6Mfg4rJUocbslw0yefDI73EmpotKyPKOG88rxElhL4IEH3e8gOA1jYEWcLep1Xl8PZQGe8jpdIU79lFzYGKfu9NBF1pqlF5ZLByZS598s/sd/LoCpYMlmR6Jx8xTbXX/AoNNNuPzSkssENE9Ov4d6VTeblkMxQu0ogNmHJoW5phVFF01fFsRzDBzOlqidm7GdZwnWC9eeTZwlR50tgChMgW12Wa1JyPS+YWVclaA3nJ3+JLHlnI/+P09DDvlmX4JoJqjoGMqceoIsqMlPJXceqrJD0xFWM0oeT1MQ9peYdFSqYlHiTo1DfNYeUVNdF64sqQWXDuifBAB5Ws9ZtXpJ4nbSZ9N8xN1rnStA3ARu326FxZ7efNn3A49RTgZ7Ul6KvZZ2syRGt99Et28DxJDwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zRbpt6asnOwz6iftdEW/NbAnX94ZwOb82y4lBGxCqUpXYX+QoAf6KFrnfTnVId8+O+UiSUvB1SdUBDDVr0EAf3MsqF00iZ1Cd5du9dWwFzkWdPHB94glaBnHIjIyL4+KUBvDriaibRzxPHZGPKhzdrCRPaf1Njv024BvMLfJV3GYDaHIh/5wXTwKQBjRAxXXWdi9msLSJN8ZAN489Js1yJxKaBkC0aP1jCW+YoQpykknf4VflwtN30WgHkxLpqjjpdlSx2A95vfpXf4fi2AKKLwSyDE3s3OMN38ESIec9UAUNZSKqOa6YGfmzx3VBlWeF15mWlg+vWZtKIx+F7YtoYu6muRVgu3+2UWj0pNF/RvHeQdzK3RRjduAp9k41L+G2FmvuePp1shqqNzLS6h0SCeqXfiyzM4JHBH8i3xSxvn7dh6l2oMQQnmo5nlMUJusfw0bE0H4uHWpZPYy5NLW/HRSKvinbyyS0JQrfmLxE+BEhZ+YGUHRzL7fcv0C5245TyyrAFhWWoFiPxCI/lz0w0edm51+dMHUBCmJCt0lZZN0bN64xDxh6bcrTTapelibAwNb9GKpaLujDUaHc4BGPII62aqRkJmn/Oh4NxnjMYbvon73Ygsq9tN4b5luve3PFIj8bKSRAYNSDa/g5q6tKO5Fw3KeEDY7gI8SGvg68pUMjeVxBG2/OwNG+f+Z0mNNMOaVodYO4qitRvPISX8Nw3GKoIw0gasa64zwrkDPXNFJpnUqBJJuVqnfGdPgg5kWgY3VXzcd10DnLtnaZjRLst/d3e6grTliEFV+18upaqPB3/iZRdLUbwLbCpnhMjymrh6Qs8bzTMYGs6ozfNWRCGudpzrDtY09B3ej+aaY4PCcKslEVwK+5rsVpt0NyFAWBbTwmIR9sq6ithCdDKhQN0CRMROEKePQPPh8vvsPDYhtg2k3r9ys7ZffSL0nJu4yduj3fcpXZXQ2SMeml0dRl9CdkBNyFcuRqKxtzZWYFqbx/zTAeFOGW9uBrcE5uiu8EAWjMXJ2bLCU/Rx5mfkCmVgdkkDURqYsQyhDi+nDF7EeCEmLbQmX2SBRTWEjmEBeo3C3kxDJtQAzT6J37rbgwU76vQd3ehCSRlEx35Hif3/OHSgBMpJV2/uYJSYGG2RLDZ2n0kDrXTXa+NuDQzWg0Zgl8TMkiXLvC+kWJ49oM7C8Y6m3TYbxmudR9X5nFapkfTWltFEAbIRb6xRHd7eQb+WzHAz02BS3ZXQ7LHkT8ArGTEYpmBK/HHrkO9E6gwPBpNY9RFalY6eROKUyoY1RxTKlZ+EpO38fyvaKss1VGpY3No9KnICkOLXLZ3WuKpKDXprobaq83nZ+st1CrlzZmP+vkLe5nfp6fizEgEvCY1E8UROzmt/i16f0kD+2xqogDd/5sxD5vf9K1C7o5kKbZeJChDFwv1Xh5kWoqL5iVTU5xaAemwyRskfNuWOK2W2Wlyf05IpZhW87YHwcmCXsH71aqY1VY4I7XpZSNc3bZVwU/IIo2yZk1LJtH5InXCFrS/tiRfMA7cYawcFOL+YXKaTI0XnS6yl9m4oMYwF5c3bnat/pHtjc3Tu9DitE+ZAmwxJe4wc+W77W4NIAy9wnwA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88c577e0-05de-4fbb-c24d-08da9d815ba6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:34.2999 (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: 33HhG0Hzjn+zW5rCLG4BBTgRaMjeGh2aG24GA/uCITygPPOkpI9qEO8Z/gn+vVpcg3i8UktxRPirxmS7kALrVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument, deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 773e415cc2de..8e9c7d54fb4c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -922,13 +922,17 @@ static int tc_setup_taprio(struct stmmac_priv *priv, struct plat_stmmacenet_data *plat = priv->plat; struct timespec64 time, current_time, qopt_time; ktime_t current_time_ns; + int i, tc, ret = 0; bool fpe = false; - int i, ret = 0; u64 ctr; if (!priv->dma_cap.estsel) return -EOPNOTSUPP; + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + if (qopt->max_sdu[tc]) + return -EOPNOTSUPP; + switch (wid) { case 0x1: wid = 16; From patchwork Fri Sep 23 16:33:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986782 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9590EC6FA8B for ; Fri, 23 Sep 2022 16:34:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229765AbiIWQeH (ORCPT ); Fri, 23 Sep 2022 12:34:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232935AbiIWQdl (ORCPT ); Fri, 23 Sep 2022 12:33:41 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60047.outbound.protection.outlook.com [40.107.6.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BF05142E33; Fri, 23 Sep 2022 09:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WRZ72itl8pjv1Nte98BMc6J75wZ9PbPh3T+rx2BsA8c/+sut/ltd0qC3hC+og3RlkOsZEeAunL6+ySpciECGg+wdK6OriM2I573TAdsH5tsfxkwKr2f201gd7R6XhvKVjST0CbOl449VrdSorw3l2yT+6M/qY5nFlR0/94sLdo0G3w9MK3amz1vqMZGJ27kC/vsNgEwLYSVgGVOUgUq0Py0G+yJRaNjKVgfcF0h1MrLtQ1WsjS+UAkZfmSbQ4ayPaZkjZALeKDCwc1YnFtoHfGog2/1bjtkGD1tyvqkMWUh/ttdzqeBnGAptqEqXrIXqtSxGMRuq09GZL4IwSZraZA== 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=lLmnC85YIDZ5DOEopMRA98qQ2hxjkAF0WvLR56REzdw=; b=ADaL9W6OXbs5IH/s2j8+oUFp3viCgFEcwy7oMpbF4ygJw26Ej0dhctNhBPX7D6btPa3YbkwFN1/An/ut6FVxCBV5TxPeR/3l9EzL8HZi2vjbBT05xGGOP6Uz+eWuzGRRUn44nBJyDFLJD+bxSKLX9ybzo3DXeHSc8uTKMJMo4IPysbxSuqTKalCfuIHjT7/c3DgH3pPJlb8V2CtyEEdA/LOrFaRKzffgq76sNqHIZs/1RKD4iW0o3foC9x6EV1tMiDjYot7jRarY2r+JAcH2PlEHxXhJXa3fO85WffRiQSOc1TgEhCk/RG1Aey+/f62+05HROW2ESFq/yNOCDejq8w== 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=lLmnC85YIDZ5DOEopMRA98qQ2hxjkAF0WvLR56REzdw=; b=RNN2sBV2TIRVocQxbCnQn4xw/Aj26bPEhxE9/DFY1kroX45e0hgeXq9yiu+aWWj43EC050Uim6l2MNmDd6jWqYJRH8zwxpxLLnWPZM6fIGTmwsCsg6ZS2CxOCSQ57Y4IHPk3wRkge7KMKPm9JXluHoUw4s4nvAbLIXW65+GAnX4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:37 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:37 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 05/12] net: am65-cpsw: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:03 +0300 Message-Id: <20220923163310.3192733-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 6d2de802-912e-43f4-e1dc-08da9d815d53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ek0LdsXlS8PoDpC+cM63LQ1qnCV6heY46b7xtMS63jrB14uzc0pGzdYZXqjkWVNJmTcHWgDPajEnKi62na5QF6jd8hjQ5G2DaCXJ15+uGLGMa2/WVHTa4k0Rok9h8mdxNQyqSmIZsEDVCiBKzfjO2slc9w4nnRT25KeynEZyaRKx3wXmu+6eUpb+dtMPLFVFNA1uVwM+BMZRQRQU3p49gVabvVwJha1L36ag9Fsrm4PhmW37codDP3t8MVv5kjRolgzAduBw/zVlmMlt0xDEWgTXNX5i6PfAbIP+g+kE5dC7F+IcRy08V18qk1esn5tHtKw1oFdmQ8YZX23w0HF4LDofnzecB8sIgKZ1bzQUOtRORe5PyXy43Ywhtt0zqgI7YGB3oir/5mZuVtefMgwbIS6hdjr/nz4osETwP+80eRkvlxxK+Toz8yBJD61+5gEL2e5B7udtV8vx237pUBRvTNp0VfCDiW5it7+F2NdtJT8XFxyALLc6udfFWYnhD0TopSlJZWZqYYlI8/WYctiRv3uhPXwiSLCAdeV92rJew3KycHZ6H6VfvQrle82XLjXrXEEBbIB8ctAFT0AJl1Rnl5kOPJT3+YjRzN7MIa7oonfSIHjzdr6ifY3kjUvH/AePr89OK+bfdXlWhtIwDlKaUhBVjsCszqY/K/nCnEBrjxcj8EOEHTP+rxvdlvrHQLgNun5924QzwhjeXu0BwjgZAsPkqPjPDuUrSHr+MaGrSznry1PJSeKMZx059DNwHjvdfY5XEs9rAVK443mq451Q3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xPMjtmkQRi/8Y478ngt2lAWnSO3A1yrchPK4ZrMHtMVXmsvtuU4aZ0MLrGEHJ/v+8qoQgSKXzv4DlEVFNnP9zdHpqhjpD5Q8ZLvjvT2UVVoD+TNouZkzR3lAwu1Cj1o4lBk9YzVnfUEkMDYfEhMDbfXPey77Prl8n6GCDzm5dJkIuDIiviGRnJX2xNd62bol/+hWZ19axfngf15TXhyFCzY1AlVC3pGjzC0M0PNDM5tv4gnsvHzL+AlG8h4s778KrO1rXg6p/fAcaMn0lFtuDQXYTRFuFz1KOK+gJ/c4TcgZI0nJugKstr1UFizt0qQp5eAyRPGiUOS06EWkrINpVQRrbWVKh9ZWwxKpV25sADl80GBZu7pGHhXtphNhGpp6mYaDbcJHyOGRNgrlNIGuvE2lB0ehzX/DLtSW4HK7w+AcQ+jb/fHLBw0J86OYW9hQ5mYog29Vv1A7JQ4LbqMXsQU2Vdcna4LjVcY/ohNeSK5p3j/sRs7vHBCwL/KiuX7AzFxRbnoZyfeyeGVmWrc/mASsBh6qn8etoRx7DctY0ooE4QzF5nwoNsuVCEcn83d0qOkh6AkOhnzHhXPqVPthOUG6TGA5LwY988SoSDbBbTSdEyEEmN8G0tqA5gq+ON5zPu/LpaX6mhKgnSfD5sdAZGeGwQZrvPZ0pgGP2e+ldR6K4ECVnyFz8BveX1OfMhQurGMPODokuUQinsC0u5rhdogeCH05cZ7z5czPgcw9LO+ytnvvhTXxAT8q3kz6Rf0gRZwaDkNCL4gWRsoMmAIOwIvCosr+aXSa5svR8tpE/NlU3ElXJJ5WqL6Wu8cUA/Jo0Na0k0+urT+VdioXKxPdhmrIqK98ImzbNSJgE3mM5qyzUgtqfvffuiWQNyht6hT3Em5sUnivdrikt/IIWF9zWXq872IbCYIhISkR4wivIqMf24CRGlrL7QsAQ+ZZOfVq4heKQHx61K82/lagnZpVxREw6Phf/F0/Hu2LAudPjzI+0Twk/IBJZqB2d9rkHgt3lM6KxSe8mwyp2bwr7tw7GUSS3Aei9GHiE7Sf23a5t3lYgLh/i4OAF/McVuaCGzAJO1OthdiAkCf6WtkkaelNpSytIsalXRIQFigdARP9LCEy00cQk/4F7L4hba+kUFW/RB+EHHf90Wd+9WwtM1fHsbGHwi+3VYfxahfgVmYpCEWWSTlPYdyebcapEkqbGC0D29/5TPOHoCKJD1e/ldBfAY2E1xCAQzQeEAXPxNo8nQ+DydtCDIVKDmDbJ2NpQ3+GneQyPXa3TfGrP2vRexd2HvIgqXq9EOW7mzzsZAWXrI61tn1dGXOfkkhb8RKk9aQPYNWKS7NnAcW9bL21VVEmWlWtafoZ5Dbhtia9UMTFVA6uMPqkr0yFMzbXuQEWiAOLYerNCWXgTcnXiAcx3t0zhLCkbrRE8evY4vTQIT9F4gBKohHHZZ8/N1KSd5K6IFkPDYdzW1+1CkLfeIk4vy19Hry+TCg7zfm34PrD2VJvcQkVDpDZfPyeM+Haojhy4EPUMa7HLjQH6ntyuB6+Z8dVlt1w/+KzLdSKisLLBKn5M5GPTpoJgEVqvYn4G9ls4awMaQHIMrDiEBrzS+xRO8NihA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d2de802-912e-43f4-e1dc-08da9d815d53 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:37.0341 (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: 7DgbH6OV8L+dkJHdQTlBK31b41l05p7d27wBqyH6gdN21nYsjQ/8ykHySH4QKSyz44vbCMcmaH+p/2lhZ3ktmw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument, deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/ti/am65-cpsw-qos.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-qos.c b/drivers/net/ethernet/ti/am65-cpsw-qos.c index e162771893af..bd3b425083aa 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-qos.c +++ b/drivers/net/ethernet/ti/am65-cpsw-qos.c @@ -503,7 +503,11 @@ static int am65_cpsw_set_taprio(struct net_device *ndev, void *type_data) struct am65_cpsw_port *port = am65_ndev_to_port(ndev); struct tc_taprio_qopt_offload *taprio = type_data; struct am65_cpsw_est *est_new; - int ret = 0; + int tc, ret = 0; + + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + if (taprio->max_sdu[tc]) + return -EOPNOTSUPP; if (taprio->cycle_time_extension) { dev_err(&ndev->dev, "Failed to set cycle time extension"); From patchwork Fri Sep 23 16:33:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986783 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FB13ECAAD8 for ; Fri, 23 Sep 2022 16:34:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbiIWQeJ (ORCPT ); Fri, 23 Sep 2022 12:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232968AbiIWQdp (ORCPT ); Fri, 23 Sep 2022 12:33:45 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05F4E13EEA1; Fri, 23 Sep 2022 09:33:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IMdaLGaDiaMSfSb65sTDz7TQFCNDCoECtihfGmQ4GXMwfimlJQLU7Nnp5l431We2WR9p+F5nvIFG4qt/lrIM15kckgSxhLMb1if5OPfuQU88Pz56p4Tw4XbR3eyhCH35X3Yz6O2C8eD5ODWf5NunvlgpteN5s6sZyjmN3pEjdM1/umD4wbw0JIcak2OWKX55MxXnEdmhZeS9RXVqlsXXhB6M+oxTdZWRUb9jBVAteJypbTk7sw2J62yHVzVxwcvNk7KX4FOkYIJutk8Wp8+KZ+u7e0kJ95msgdWWb5HIk15KYaWYtCQti3TCNjS6iv/yuWcNLiWqHpXe+yqgIKjeFw== 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=r/qImceEIMGRiCdK0XIGBs64uLrjRqXhcGrYsZfii1U=; b=d5EINESXeSKWSJ/31VnkNOBpOPq7+fG/udKES6LDPilT/PbloX3nzvS/OwButUuAdTkA2muCUsXgPDVR4MXv43wzXQsNTXWsWMRoIDgkJwfHrJEf/Owdn6bVv3qAeF1qVP59Q2LVu0Qni+rBmbPuqdKJEAHSFblUK0zm7nzk4PpU7qj+vHSFFHbkc/OTFti7MXqmIbeChCKL08ldAVRXnHnoQZ/d4FEFTti10oXMG0mu/zIsWpZIARiysH9AvMjZI5zTqHK1UwXYywEkJEdCX4KPngQGyDGZt+ivpT3HX/L2+u5cheBsqLCp/XnwIV56OVRYnAMu2G3Cj4ZyVxpWww== 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=r/qImceEIMGRiCdK0XIGBs64uLrjRqXhcGrYsZfii1U=; b=sTDeD7Cl/M9oc65PMcl+/i8DCK8Bs1+bF4MSDmnE99m0DZxetOTVxMWUnD4Yj49+jME9gqOKgMlALGDRJzE5JMNxih/aN4is+yqTEojvTUyuHfMft7boFZDF83EYTgbtCLG5Q+Er2a84tU9ceR4p5QWXmWH1PMlNCIf9B1zB3y4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:40 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:39 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 06/12] net: lan966x: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:04 +0300 Message-Id: <20220923163310.3192733-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: f3543c90-68b6-4cd0-7816-08da9d815ef7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bZ9VgFzqqptC8sP0vgaMj7k0bl9PtVqAW2ROWzEK5OrbobqHtZ/cgij+abCQ7xcr2hp1igS+o6e/6qsvbTl17aL1uaKc45uJCoNhmhTi2LBUMBh2M0K7U/bc6il2R6i5INcNCloLH7z0j85cQJenkH8l+RH59B6FCwXQG5fujaru0uNYggNZBoIr8FxUyUdudSvckj6+NntdslNwV3Uv2jpTRrp1mwjncL6BYhvHx3/yrR4q3dABW9Xnimy0UPjp+T0/fZ+dm7UxVLEP7Bhl9jQ7TWneSRpZvEci0xqEvO44iudL8i0GShzN3eRytugj/9D8ciXHYCmYy6umY6nxrpECRyvOG4BwcWxvYi6XN+eVYKR2CUBD5OUtgfsY7MRoOHMRaOiHDNkNP1l1ZwVYv+iOa5S4er5I+xmzXFEx26pYgTZ4AVxj/NU8rcQp1hHZbFJ5Vkvntq5BC8qkVnJxCyroHY8HVQ4oWkA5MwNiR8ama+2D/cI8RYffLD8ZwuYAb4HR6LR7IKqfE+XvFZxUmPrrhXhiSpwJTnnPG+yg4m0BtT4XmLqfkWaW8K9eh1pvxvg1x+5D65KP6U4TLWtba0e5YqizKDRoqzOeAn7zZMyXI4y0RRYjrQ5yIItRK0l4e+XUXoEHP3kdxuS4yBy8coEcWDf6epXtC8E17Fd8/fLVaFle7KeoRTu+jsife04y49lDmcbbhtwK90Z5se21OIjD3XsAxT4j8tEryEYcjWiG+myRYiLQDM/vJbXqsm63t5vuSnFzJAkMKY+5UkTiSA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: v6HeFBEM2bwoSoj0j3Ljkyi83g1DTORueW4QSyE4LSxno7bCCFFapvAEXcUqYdzWrJSRJ6lxTWLL46ONeuuC/3dZjLAzaS3UehWAJnqePDcpLY9ygwamPBBO54HvcB3ospB0B8aUBD8fLbbl/tN0QSXnyjJI5gbUROKEC+Y7YxjJds5DNhay7c0u3Z/E+AVQDEPAo0odwndWZP2Er5fpry4IYN1WgKUT+SMxo1BR0QGSnkh9wNxaBQ3nPvapSF71VuunScauFd2JkQo+Dfh+j0laoTwlhNFUJZYXP+ejXSAvL5lE+G5NtqqKklT931gM3ZJ/5UGDrRZpi2IR4hNauA99YaggsY/+dMUhx9/iPrR8gnZgByCfzyhjpPQGeFR6TbbJ0p3Z//NTD8GIMnCLjOagqsdR4Zua4cKUxMQMZhz/CuRnlR3CgGDpSCuIcOTTnnHQsQB6bpCRoucyYRK8Blcrec7SzrttkFYurpVWRzhlMNsZjFlGRc7sSPWXuptUtaTTlps4T484TkVDFD6uRf7CLlXtBuvyZ+j/E+BLfr0QpI8UhMhi781DR2RAsPpyCEw+IpsmGiny61Q54eRklM5s/4//k0PGX9Jr3adwmhbHIitclQe1KKfMdH9k1ajbMWK0S7PMka0idtQ50YIvQzEwpPMj9nG0r1Zi7jxPTmDrYnQskwITvu4TuKUM4H4aLKP3IXPzbRSKBxBOoZ3iIU8Z8MbyxKdfzZW5g8c4G6ltIKhKTNdTiKL6sU2/Ud2JwlNbHK2gYrsLJs3JV4LIKrV3qnbLC7zKPRgYKqtdfBPrHawVWQH0L+6o1C5lpK6HXvWsC5utwrPdnax/CH0BzikAEwP4wlMuVAuzHBo9dsNoAFbMLNjQVU5xHl5ubAGQ7xq6PnGJfIERO0mZrsqeeNFrFuZ2YROthYHDIi7V8gZ0L9t/I9PFpoQ1CYUH1pQd0yv/b5/1RHblMz3fXPDJRR6ECRftli3u8iauJAjysQLgjZFq1sASjRyGcIUHyT0iNPFp/j+4hfXo+VTziD1R6cs9H4XMMrPJFjrsithypdHdwk1n5ZGXiCFBQlzK9xUyTY0VHiNL14X9YdVjMn6BP9HiPA/876hSvLePARYXAax4Tt0hwRIO1vS2c4HK8QZYKsWCIOsMFUI95Baie4kVHgCNAwnlYlKhxDYk9ZRsC0rj3XUB7byWMseSLKlkLTXbQ1ishmxprUxhhVy3ecbw/i9xF0+JdUuvsepYunlMJjTrfSEDaJQ77ZO7NjSbHoZT63UCQkYANwD15sLRVtgnbdKIMA7nzn5+yxtCMwM5F7h/CcPcZRabqX6LYv+dLgKq17Qw051w2MzzAbqr6/jW6wLWWkh3Ho4ijC9/fVXgA9UBtKTOBEYL3gXzuqmTfHcOf9/zzFqE2mEKvAq9Jxbjaf88SxO8+6lN7nlz4TK49Olui2ZCgc6dH10nSVHrQw2bxtYoP92Mu1JEKg/lqnwSWTBpK9PCUGuG/hpvW5SGWWvsAbW3/WWbMPwCe2Y9N47A+POm5CH7KR9zmRgpU0curYAneJXKikXrmseFryz5W6z4+yBTAah1ApIHkqVoxMrH3cSqM28oiXoy3gwp05FItw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f3543c90-68b6-4cd0-7816-08da9d815ef7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:39.7683 (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: Jsp/t3xVyzCCvC/HuDWMQcy1d/FLZSiIJ2ztq5n1tX3iBqI1uOeIZZnHBmqsWfWbDR14ijz/TdMtn0XV3ksIfA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument, deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new drivers/net/ethernet/microchip/lan966x/lan966x_taprio.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_taprio.c b/drivers/net/ethernet/microchip/lan966x/lan966x_taprio.c index 3f5b212066c5..96367819ff96 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_taprio.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_taprio.c @@ -219,8 +219,16 @@ static int lan966x_taprio_find_list(struct lan966x_port *port, static int lan966x_taprio_check(struct tc_taprio_qopt_offload *qopt) { u64 total_time = 0; + int tc; u32 i; + /* Offloading queueMaxSDU is not supported at the moment, + * only accept the default port MTU + */ + for (tc = 0; tc < 8; tc++) + if (qopt->max_sdu[tc]) + return -EOPNOTSUPP; + /* This is not supported by th HW */ if (qopt->cycle_time_extension) return -EOPNOTSUPP; From patchwork Fri Sep 23 16:33:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986784 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9E73ECAAD8 for ; Fri, 23 Sep 2022 16:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231514AbiIWQeO (ORCPT ); Fri, 23 Sep 2022 12:34:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbiIWQds (ORCPT ); Fri, 23 Sep 2022 12:33:48 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45343143291; Fri, 23 Sep 2022 09:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c/3TumIs2HGBqcJLxlRaP7bLOHNFwFS2kRswLb6aQnmkMb4O9z4CHGwFhwD+Cra9Q5/BBWjbqjSsv5ULr41Y4UIEA1HQw4s7DQzvh8BNpHgBsrROX8WYXqsDNSzuzx0dtVeWmFPYl+EijHRZcscwFFsrv87r4iFD/cPWJmAxR+Y18VTFSQ+nOCK+zsq/SkGpQDwBPa9gXUN4HiI9pbtmJ5grp7r/0dm521goHsuTgXWRTRLEDHhqjTzyMehKwlrAbRr/t9BB8MkGpv+GLjj6YdNcEgW3OYNv/mjyO5dwYZ9yUyxFci7Pm5KfM/Z7Kdmv/YH+2qbLaUQVAljIR+IhFQ== 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=TfYGQB86xdKIbx/pdqoAH4P0uYpNwcIp19SBSo2oYUU=; b=YKqFauXbSO1NnkOUDl2Ib4L/P+GH+KEtnu7doBA2iAHV/ZuRtWbuzgKYRZK3hkrZITwxU3saWpXDcxIYKsRgAPAbTzpNdMKfJlSPRCk+VMtoSAtEOhq6FFxHzIUgLuGcObpKwsvw9z2KxkGenMrzoK2sQVm4ifL3NW1KPkq9VNuVDhicfXjNdzrRVuypl4I7eTfnN1p0QBgD+y5sH6WMJjBuFTy1VjQA5F5FXXFn9SuJyTkASHAzLl8Wp28GfN/35Soh8m5/5+RW6cWNkC4dPW8D6Eab3bHMBatdRquZCBw4oIEymKOUaCEBKNerjyYEt37M8w3PfjD1H1+wc2FwhQ== 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=TfYGQB86xdKIbx/pdqoAH4P0uYpNwcIp19SBSo2oYUU=; b=Rn0VcFH/1MulZeDCJn2PghO8BcSHX4praq1xZoVm5kB8aG8TIL/2PxVWBBFsg+B/Qy10vb3eDYo0EJhJDg7/0+YPgLDZbW3TNgDTnQyqs/8+sHDZ500XiQ9So06rS1pG/bBqZgMtt48ynJVKhoZ/0Q7qlHRMO3R1s6FqwRPUBgM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:42 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:42 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 07/12] net: dsa: sja1105: deny tc-taprio changes to per-tc max SDU Date: Fri, 23 Sep 2022 19:33:05 +0300 Message-Id: <20220923163310.3192733-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: d442722d-9d1a-4b5c-e78d-08da9d816093 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9SitFuDSQIRWAAdWT3uaHND+KHiCPl93oVJ9AxF4Lcvw9G/a3GQSCC+JqQTAyFcni4WjyaukJZuP7IJEC60Rj+Y9lNEBo0jHGR8iZrmqZ6iHK83lWiAMnPoHyPSD0rJT0/S1qH7wFTj1NkcJ7B8DJdnBIpO6v2xmIQ6UXl8mXC2j/Lb+M3UBUBfxjvibJJ4FhbGg3XJMQoWLegOPxc6LSKSKR5+dfSzHLqzSRZ0NOoypCsK47+QREvg/TAbTLijuQqIi3eLrGzB6BPr1qbmThu36k16EDAA/6JLsTioJExJz/FhKHRJuy19Dw31FjWcQJdR+ieExuoVmuyxRjF42UtmFhvqFWGVRSFTNLj+ovWWjuR1UlAEEdZsz1BcFml/2er9pJDvKhi6S3++0Bo8yW+VidycLnEgFquMufqLhBOxNe+Py+HAcgImjWMFu7T9CFoFFqxoxtp5bp14BGni9NzhK9Tpi3V169WjV5PlE+gXHZkPQhjHXIu+5dvBxslDNj6QQaBupBzZcL/oMFPUqybliIDYEMN6uWVrSSUGhsUKQLYx6GB/OXJK04Kb/VHZn0oPYUMrOdrjYs6uCRzPXgMEGuKG5853eYea5JeJgEoLm+osKGtDOH7leAKLhrwRhpPJ3HTe33mzyEU5JuAR6WAc8NL/9YrB503S6CiPL18T5bxCBOCG+jV+HWq/fdvRSx7UygE4SyhsDfykJjL29HcOWUniaRnPjAbZzVXf6BwTGXTTZLQPDV/VUY86+L/3NBUu17spFzM1pC4uv+lf4dw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mdp9B6vuBHFVWyiMT+o98J5D/ZjyuyOC+rml8g9x/0kV39MQJQip8o4J16xX7ZkQWlMNhvk3ynzZRR9d+8rA2v5Ca5jiY5285LfRFFBuH0FNADeLThIlVR9gjnRPo3FMiF6ym1L5UCSvlk8nRa7pRusFSbS0TWlii1mb0frE6LVUjpyrRbP+tMj+sGOwE6iFcBfsyPjrPobAV+DGzFKcQSkB7k3I4qjXkQmiy/qCQQHHL1RSTl1DoaubAcA5oYi+u5IYE9pcEcuVBPBNKBW+B7TbbVifIV8buGRO1q+uUqr4R6SweDMpLxZs2fcALhw2sqKlk/4pT+RZOJuMnDK0zhb/SIrN32VhtSMtYP6I6h8GwMtLJWyZBNqlPkf3GP9n/CChSfOjgiMHeXfTeKXWFDAj/B+Kw+RInaigma2UFArNqbzv/dAIN5Qc7oyY8Vhxu8B0t1sV8DpTUlhBbBgVCG3F5oVZhBehYUpGEnaK12BoqqCT3hDyWQtA78Tti5VYrz3StkoR/glrNVt6xYnaVVVmhptQpfkRHpAYajY5QjQp9XifNMGKtlR2zHAXeoQ/HxD9kfnipKTqXWdurcq2nBDzPk2t/ZIsSVFUeflqgduWQ1Yn5CZkRCEHW22dq4RqDLK9s/qkzqyaTI4QTaiqm8rOz2vMz2FYYLfC2sFlInI/B8FhlF4bP6OXzZp0tqe/yQHzuJxS6dBJ5E/RhhWz956CySAseuN07FpKbTRUkJER5g7r0P28y9pkyTG56KuPYDYuIMlhkjZa/PDtRH53OkkELPIr4r0Ryzy99ltir2e+i4pwJlnp9dCfBzLUqKzZpiDZFXJECFAepXL3xAdb8Hqj3CK5Rg022RQ826jjnfFkd34vvRSknBrfhUfMPQGVPKjZi+DwoHgk6YjHRfRVo95J6OIbkIjzNo87d4TLnB+jC7uW2ixCxi9ZfG9OqqfPaax6xrRm9CtPgNRA3OCSACaM5dAyqCBxXXawFpQhEcWuuO7YgKK/LoD+nyoxKb+D14UTKzRyuXbDMJ66RvOBIUHysGn4qXluXdcVv3YzpQ/AfE3T8jhssKsA0X+lRs3CHg87iJzZuRZyYlxsIF4xaKmDIJhcqxrqPDYqTKxMIefIOdOxM4gWhIyOj0mglc4s6M0m6mpBAC2mdPrFKwmc76IJjBlynkSDJJiTEeZSQqj6RUlxrD/37U2Z7Yt3bD2tNyS9QTNvSOR+g7oqS6Ciqne7mtszfDZIZc1O/rcqoJkgzxvyVDMYbWqaW1A9pw6bIEUTRMPdR63DJDa6O1Q2nIlNPISl31UFzOEQ7X/gWGhL3DoViveRm/ZVV5D87SfsPb0K/ZWiXKN/bjDJ/YPnxgWp1r+OPxqbYJvMtZM2LQYo64NexH/JzIj/kjy/ocm7wu9CdKGWQze8c5jx7Lytcu9wFOgC+Cb57Pf0IPlAoF5FHr0DM1zqVgV9V5qc3/5YqaJ0SwEgGSiHJ87NhfWzWxyPwM1HlrsvOuFu/KreDxRILjv49tzLTctJlnXRKPf9S00B3rS3nIpKgLPmWJrlzMP7JGLDTEXYmBEPCmGeZ+Htg/pa1p6rapoC/zTBFLPW/kJonvzN4tQpMUiFHQZqrg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: d442722d-9d1a-4b5c-e78d-08da9d816093 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:42.4869 (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: nWE7ybO5DnvfsyCjZtY/ZvAyFXy0VzjuhfzGfRd0GcCi7iNY5eFrwaVjwyoHl7nXxjsGxJuI/bqgvxAZWyKCBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Since the driver does not act upon the max_sdu argument (which it should, in full offload mode), deny any other values except the default all-zeroes, which means that all traffic classes should use the same MTU as the port itself. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/dsa/sja1105/sja1105_tas.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/sja1105/sja1105_tas.c b/drivers/net/dsa/sja1105/sja1105_tas.c index e6153848a950..607f4714fb01 100644 --- a/drivers/net/dsa/sja1105/sja1105_tas.c +++ b/drivers/net/dsa/sja1105/sja1105_tas.c @@ -511,7 +511,7 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port, { struct sja1105_private *priv = ds->priv; struct sja1105_tas_data *tas_data = &priv->tas_data; - int other_port, rc, i; + int other_port, rc, i, tc; /* Can't change an already configured port (must delete qdisc first). * Can't delete the qdisc from an unconfigured port. @@ -519,6 +519,10 @@ int sja1105_setup_tc_taprio(struct dsa_switch *ds, int port, if (!!tas_data->offload[port] == admin->enable) return -EINVAL; + for (tc = 0; tc < TC_MAX_QUEUE; tc++) + if (admin->max_sdu[tc]) + return -EOPNOTSUPP; + if (!admin->enable) { taprio_offload_free(tas_data->offload[port]); tas_data->offload[port] = NULL; From patchwork Fri Sep 23 16:33:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986785 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDF89C6FA82 for ; Fri, 23 Sep 2022 16:34:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232659AbiIWQeR (ORCPT ); Fri, 23 Sep 2022 12:34:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbiIWQdv (ORCPT ); Fri, 23 Sep 2022 12:33:51 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC09013F291; Fri, 23 Sep 2022 09:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=isOYOL81tN/6AogACX3MN5Wyij6fD7UFEuuTOp8NqlWp/+K4+TAnvfrFHQTv/8L7h1H121LVjslFjUCHlZEsZ6Li8AhhDRvkQkeCpEjaL2MYd//jfoclygivqqJZE6TnFbklrPGlMKArTAIsRxwnuQHYaYitlvT9lBz3zVOEuGmCp2+NoNQO8j+SoqJqe4A6z8HAPMBpoOaYVp9NxwlxwMPrJM95qttxlmttZif7YY2DcIHGwtTtNA3TQfAz2WOPgf6dbH/34kimgkpHwPyN8CaWdXwAAtKYu0rKkLZtPoli3499fBHRXzI+5IbZuEXP3IxxVfgXOw/Bk4PyQqFshw== 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=K0RcaQxoGdsJlvWT4bgEmWkgrK1BjFHKDo/TpUXrvIg=; b=UYq7krPnp1dKkAVl/r1ktIhnayhq19h92alEz0H04RanQQkJzeVxTXV4A4cBop0bYH1dcBSzE5YnRdRn9jZ7qy91PpgJPIAHlL+uu67I1FNfPWlfRdnI9AOIUBCPeak+BFmmkt7uZxutCSbrL2esAH0zYP6/plKpGvmIEOufo+2fEVVJOrV//XAYOVr15O8AohR5GC8adDaSCJtaPSLqMW2IQtedyv463OKMBsr50nA1ppanKXlj4EnwPtkDtbtE/+KmuYGM2WAZ1wl9rIEyLItChwf0oo7vdvxhiX5kjpMNQZPFPjuzQoMDKKtr73jVolgVLLnX04dVFwF1d7LKiw== 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=K0RcaQxoGdsJlvWT4bgEmWkgrK1BjFHKDo/TpUXrvIg=; b=MMA/qpqvqmHLsr8QrDoDda4E0SmzxpvSdtbxTEGD4qixYWd0GIFb83RC8xw31wgpCncZe1Vupe862M9jM1VQIIno4USqqBUpk+pcDzA47647zERU6nUFnbitEvh+Sd+oeYvh1gxcZm9URWiHYQK2g1LMprwZG1kC0s40C656DZ8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:45 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:45 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 08/12] net: dsa: felix: offload per-tc max SDU from tc-taprio Date: Fri, 23 Sep 2022 19:33:06 +0300 Message-Id: <20220923163310.3192733-9-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 48d5a905-5b7e-4547-4263-08da9d81623c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LK03a+bcQvro+SmSvX1QYGfoJ60stu5xSYzoYZ55PVJ8HaBcvmF8sf+iWz6Yn4RXdfV5mEJbaC/7G7/EGzpgTHs6IwabFG/6TWrWXZvrpAXSpzNKSXtos1ZBw6aSe4+7KdT5zCMHJCmbpmptJ6Dm4SNSGVJgimcoPSJxeXaMfSVQQbIG0w80HcyxyBowMtNphCrMBvM54AK+oz8Bo4k52mN//UX6rIRBzxzF2sNNczVe2jyVxxkBPgix0xaAGrhpJb+Cd/2a5zV5OXYXb2eiOHDI3euOcsOuRA8G8ZpceL6G+Ezz74/K/vfuEvvZazuD97WS+z2zHIs7mznwx/NWPMSM4Vg3QGsq2F7F5lds5IdR8zXc2AE9oeWdx8zGrFQFxwlxiOn3kXFZivrXFV6aPPO7JphezTBPFcxesbNdhVwKmm/nCyPrM4RTOjGXY1G0pB+U/o0c8m2pUqpqDVJqiTKt8FaunGLCH+qLZOYV61kGgwpjV2cAl2sEUSjwX4sTIKQLNPIcMrTq/b5aRT64WkcEzg3K/djSElEq8v3J7NHDCrrrqmGz849Jce1obX3sM5zviBcd+Kmj1q70Xvc7BqByOIMIF7x9eSade0YhX9xHJuF/7gy+nluMUMkXOpZmVqz6CdnWNTJgMYpJWknvGix0iWqemwlcyGE+Htt1MfBsBn+r5yHtyjn/YW4dnckj6cDNfBuIFrr4PT/SPtNNJ4aaWSuIwtkFEZXIe7ah1zt9IXFv/tLu/Vw9bwcfYz5Lk/R9eDQL1VH/Uk3TzA0dYA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: M+Cu2f5Bgd6sshPSEcSYR61rlDxqL7AtNnYMVchA6vcy32XOwlgAqulOI1oFoG2y/e3Bk91A6M9UVUvBCQ9LOzjOS3sP2vMnzO+4vP1bPhIbOjI9abdavh9ED7P668mje06Zjd82LlhDNCJ5C1JOJCHSur0clv1Ht9Nscx5SaxKFvhNPd0/twQeOrbbi0tIjYQFCbfkiaWrQEi4XZUBHZ1+Ghe7R/lIlMOMcieikh2l7PeKQhWOeeW6ZaOqSmX1yfbyQ2QjI8pVhZdilSf14Pc3b8AKFJ2AGaGbcmYMYldyefQvhcbrGYE5P2+AZMrJ9gS4zMACQ0fFhALfH0X5MwJgQmP9VDjFfy62mRV6Ig8DkLae/aQirQRuzbicYAHthahnXfkWehmvTlPxC4BGTqnFyy1YiapV/AnhE+o4Lefv8uUk/Vj4aBR9sKZJ/m3nns+6CwTyDlGYrXjdO2IZn/Q9nbJ6ctJGd22t3EjG/SF5RSWRZWrwqjJdZMnHzlyMtRMhZy0aqH86KoNLTpGWue0+ZJQxLPYxQblFZoeBoS6htQDX3KXzMiAQKrl07JwMk/qbw2gsXGJpRLoQNBFS+V1h+Y9XCbANG/bt3d0YuKI6OkuuBcx5LIZxtCkcqAGFxq7cRoYucOZaYZE8lPD+j4zkNikb76Fs/FlMZlSW2VoLIyGWqnFcx7Bp95kz0CYa0EwvHtsgw1+WI3BLZjEPniGqxgHT9w7CJjHWcTYrCGnxITfWhP5wgLARNz/0+gehlRlngB9FSwB7PljJI+LlcgHriemC68B9aBq8SOzFWbEvfZmyY8OOwFGWi/7/8y0vQPDnvyToXBqfRD+TGe9ZI3DKzKSIy2nSmKJoJ1lm3ieOhK0j139NK9vlDIN9k5ATZvH0A+GjhAeo3XUt7MU0hVi4lKmraV32a8mZ9acJ0j7DS16lasWCisZwl3nNTEvlo/7KwVinwki7Cd20Vn6Y2hgwaBybZfjatNLugF+nOiVdpDBQa/AW9e/lGz9B9m4RRCQcdnbJVLbJes8zlzEfaKp9ihPwCG9FnjZy9YkhZUkYbDvw37Va5pqFFGW9Xr8p0ZLnqA4A7GxTIwzfh4I/C5vGqfzUH9+Oxzw5i3V7jtyCfSzDsVmgyHOvMW5w3zFe7XdK0f3Ty2blxRNXLwa4+f5SVFsFoniwLnrFhJ+mbmSZw7oLHlrA5PEGg/c2ku0ZE0o4OzeVSCOf2LGHI4ZFJ1lpUxoWJGqXLJHuwNxLGBZWYlQ2IdeFBKgtruQG39+7Ywobm+3hqCsS2cqzLIPULfC84ZwOnUPFGAultJamg8AhtXPddw8p55T+CS4MPW7W+WNqYD7AA2hO2QBkuKxq7rYZTo2ASYOu4OTnt9yg8tI6hzqyVnIzG50K6qi6uWns7gVyAH938XlR/huHkZJRoKHMjkeYAOHcOZLlBnAJ0N62OSBoShd6/bEp6cJRQniyOxPcN3puDk5QnX8oyGWCziUfCKMbG1QPFAKlcANsnw0Sexq9DoqLBc19yJMIxGFdIrwRm806+fNA26pkyUDijmupUIsSA1by7Dvx7vUMbxcbikH7L4Lw1U+VvFn7oQVL9tV0+wZSxiz2CU6Sbwzr/kA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48d5a905-5b7e-4547-4263-08da9d81623c X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:45.2835 (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: op3Bugjk+k5J+ZVm+tmMEIbMN6pD0H/fSvQX+2biDABrlKpeSapLPd8jsNO0xYxj1Alk/KkAfe9eJWxJTTtm4w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Our current vsc9959_tas_guard_bands_update() algorithm has a limitation imposed by the hardware design. To avoid packet overruns between one gate interval and the next (which would add jitter for scheduled traffic in the next gate), we configure the switch to use guard bands. These are as large as the largest packet which is possible to be transmitted. The problem is that at tc-taprio intervals of sizes comparable to a guard band, there isn't an obvious place in which to split the interval between the useful portion (for scheduling) and the guard band portion (where scheduling is blocked). For example, a 10 us interval at 1Gbps allows 1225 octets to be transmitted. We currently split the interval between the bare minimum of 33 ns useful time (required to schedule a single packet) and the rest as guard band. But 33 ns of useful scheduling time will only allow a single packet to be sent, be that packet 1200 octets in size, or 60 octets in size. It is impossible to send 2 60 octets frames in the 10 us window. Except that if we reduced the guard band (and therefore the maximum allowable SDU size) to 5 us, the useful time for scheduling is now also 5 us, so more packets could be scheduled. The hardware inflexibility of not scheduling according to individual packet lengths must unfortunately propagate to the user, who needs to tune the queueMaxSDU values if he wants to fit more small packets into a 10 us interval, rather than one large packet. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/dsa/ocelot/felix_vsc9959.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 2ec49e42b3f4..aeb52c5c68d9 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1248,6 +1248,14 @@ static u32 vsc9959_port_qmaxsdu_get(struct ocelot *ocelot, int port, int tc) } } +static u32 vsc9959_tas_tc_max_sdu(struct tc_taprio_qopt_offload *taprio, int tc) +{ + if (!taprio || !taprio->max_sdu[tc]) + return 0; + + return taprio->max_sdu[tc] + ETH_HLEN + 2 * VLAN_HLEN + ETH_FCS_LEN; +} + /* Update QSYS_PORT_MAX_SDU to make sure the static guard bands added by the * switch (see the ALWAYS_GUARD_BAND_SCH_Q comment) are correct at all MTU * values (the default value is 1518). Also, for traffic class windows smaller @@ -1257,6 +1265,7 @@ static u32 vsc9959_port_qmaxsdu_get(struct ocelot *ocelot, int port, int tc) static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) { struct ocelot_port *ocelot_port = ocelot->ports[port]; + struct tc_taprio_qopt_offload *taprio; u64 min_gate_len[OCELOT_NUM_TC]; int speed, picos_per_byte; u64 needed_bit_time_ps; @@ -1266,6 +1275,8 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) lockdep_assert_held(&ocelot->tas_lock); + taprio = ocelot_port->taprio; + val = ocelot_read_rix(ocelot, QSYS_TAG_CONFIG, port); tas_speed = QSYS_TAG_CONFIG_LINK_SPEED_X(val); @@ -1302,11 +1313,12 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) "port %d: max frame size %d needs %llu ps at speed %d\n", port, maxlen, needed_bit_time_ps, speed); - vsc9959_tas_min_gate_lengths(ocelot_port->taprio, min_gate_len); + 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; u32 max_sdu; @@ -1317,7 +1329,7 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) /* Setting QMAXSDU_CFG to 0 disables oversized frame * dropping. */ - max_sdu = 0; + max_sdu = requested_max_sdu; dev_dbg(ocelot->dev, "port %d tc %d min gate len %llu" ", sending all frames\n", @@ -1348,6 +1360,10 @@ static void vsc9959_tas_guard_bands_update(struct ocelot *ocelot, int port) */ if (max_sdu > 20) max_sdu -= 20; + + if (requested_max_sdu && requested_max_sdu < max_sdu) + max_sdu = requested_max_sdu; + dev_info(ocelot->dev, "port %d tc %d min gate length %llu" " ns not enough for max frame size %d at %d" From patchwork Fri Sep 23 16:33:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986786 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F587ECAAD8 for ; Fri, 23 Sep 2022 16:34:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbiIWQeU (ORCPT ); Fri, 23 Sep 2022 12:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233014AbiIWQdw (ORCPT ); Fri, 23 Sep 2022 12:33:52 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73DAE13F297; Fri, 23 Sep 2022 09:33:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZPmZ02PR8yWm/pIljTa16j6igOVuXU4K/90e7Pj7rdwW1X81EQdHavxbVAME0e2LQQAHVGuWZk+ks9OK2jZq8Mc5wfs5ZVnfW2UVnikKT5BbgreEDQEYTF6c60lljr5tVx7de47fAmfOMwcAPDq7NmSdF24zJUJCuIzjI/gssQIU0f21JyTP8OZML3v3f4A/LU4SugCxoAFtrP8aDPyZcDg/mHix6Q2SJIsT0szQjNGrg0yLhQBoYHVqwSIzEg2+y/wP75h3KRky6pkIzGdveUlYOcq9MT1pX+rCYO/lLDeuvZlU6PQHKO7hnDu+Aq49EAPzexqVQjnRTwrthbRn6w== 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=ULs5UWzpCq/TwMw2VmeCQlqwqkj6AWDuS6XYrkc8JqM=; b=U3HLjkrFY3ZeVOEHsiwLNLwiQ4CzsKVLrRpFQIxW87V/MJ7gXmR8/0FhFtSZiHJ7SlLky/fsrtyXnoS7eBKJOC5nJBgUvJUYJLg2c2dwoFKfks8P0zqOHW4NtLhWOxDwCSQVSLvpso8irv1bBZr8JfeciSOQp/nnzJzG3sY0kGti4NrRVZ6L0LKCX2NqvbSNyqdRVSdJzv11YRU2VANVsblM0HNbNPf3bYHXTXEwQYWhSZbdapa118qYEI7qx5w7yaYRDzDFUYXoapYHvyyw56xIzzPuE7QQMfEktyKtMvdMwiwBdH4I0bt2zC9hsXEY/OtTJNCFO0E0NbQhXfJyBQ== 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=ULs5UWzpCq/TwMw2VmeCQlqwqkj6AWDuS6XYrkc8JqM=; b=ELtippDpBvSst7rpc4O6deK9CChQCokQmj/hl3knGiWsJV5I0tmTEpi/gYKILL9SZaNc8euViflERshREhEIgSDycZ1tL5yHURzDEjTSKjb3Dd24oKsmhEPyVRdIwDviLQDCMGDUsB2JpzmVn7AT/Hse5xeoq6JfhvZtkefNJ/s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:48 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:48 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 09/12] net: dsa: hellcreek: Offload per-tc max SDU from tc-taprio Date: Fri, 23 Sep 2022 19:33:07 +0300 Message-Id: <20220923163310.3192733-10-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 44256b45-28f1-4441-ff99-08da9d8163e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jfkk18pB9+niOao40TjhFaQBIowQA4f2cxXcWiuIX8Cx2uCEX+DhD202DNHtomEem1IVQ7YMsTHhaUQtr7CCdIS/hpr9YiDOHr0tUvRYj6U07ntGoBKjOj4Vx9mgpn49fP1OzgFt4EjJmpIGeqdOaKp0pUft5+7dCLNpkLZtiIi/cnENRWTArnZej54ChuX/xsDqv8siFjNQqSxmxSZt0ifNs70rZxrjfxWVu6yH9/ytj/Y3MR8zFbDh4U8yTd4LD+mffrUceLUWcOui3n3m/1+R1X7qIQHI8rDN8+Hy3NxIsyqZl/qv51z2JFhGLDE1qPl2pDRna37JWSwgUSJtUNA9X9RKFM/OIEYHLlfhzYhPCjrePuNs2Rd4ew9zsBKlyF++vB/Vx0At2YOZZpQZV9r8EezsdDzRvFbCFGqmHi5pY7wzmNDxW/GXsZK1sxTSFf+I3LO9jRywKzE2qGdumRGOL9fEunGLE4hRQWiQS8wNitNnjXZny63xuMcXFowXyBpYuP27mknwD4tJPwBAK0lmpAlprp0TVTxURTmb8llKw8d3daYlANnplbSHFc21Q78Ekbr7xzFkc6e3ZAdHJg27k0YWeQQ9WDlZlN9abr29xapr6+CXZVMBaqY3BeCDb/ms4oGv4o8FNlKIQHW9u14ficBmriHpm6O22qilZlPq882I02DDhGHLbB7FfOXNKa6x8BO479aR3ESlQURGn1Vpn3qwxU8iZrefyzpEC1N0lrQTnQ6aA1HV0l2mhimNww4bYVy+RiAnfZQTI89VcQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b47pZ3JV3Mug4ZoxZPudwQz+nFDNODFsMTTSSLcVXr1aMFl8VQAbNgRRUeGgMFSHxXIttJTt5YgI8As65g/J21z7ZsIsxkVnnjk0mCv0vCFc2C8BU7IVwpx3l5Hqhg2mHQOrlMMWuuz4nxPeycVM0CeaL45e+g6Q82mqvxCPJW71LuOkwLP9MoHhMOvDK7pYMGHl+mtKzBLnPUMYCp0p/CF2EoYbTc9s6/w7My0Q8SV1XueUFcdqNakp3fy6wX3H8vbnKSsav9sEzDPjeeI7JXQVttvFSn23IxXRmrClqiAIuMLamH1CgeCsyMSeuCHssKVWDlURAMckMANfPHMpCPpKKlZ/uHteY+VDojtZxO9orGzv4kY3nuExcmkH8i3A8ZRyZ489Yk172Ws9GxkC4kI/GYzIff6hELYlGahyIB69KEypWR9hE8tMgz8BR+m2k5LYg8dczQ7IkXrTgBvxpBnwitWpzlFFJ9cQ6+Minguo4fPpZmZYQ3haJHsBmQDXSN75km9gq3wjVHh7zoFvWC4zRxzpqXptpLV4MlXO6EGpbrZNPt6OMcyb3IEBPoC1j6wuzyaTRTxCjz6cMN/DqJgMNReK14C90qB0NW/lZzI01DxyaFk2L98HmuTIO8TeL81KD+ed1Y+NF5w3tV3FNxI30k0oe6KqNiS4Cihae0hCZE7cxwItFTvFyzXWlnj3iluEADZr6f3sSlQayhPAYw+wDZUIZY40We4zzQta9qpT/n0fmoewfqAadqMzMB/cJbzRHH2/WUiIyMv4o8LmblKfvNe6C2DGbnVUxg9+Fufxf8pKH0UhdNFO1+xYQLKzYEm6mFnUXX8gdu1V6R3xfj9wy64diRjTVQ8K6XLzGztXXl9fU/bF6rfI801kRB8WTZvubDCHrfid9+/MwuOtzOojpfBgbn1ki9gIMNT4MydDRRXWAPXo2Ac9Mi5hmWYDahAy4SSKECJdMkdexRzo2HB4cxBzyZjn8ZZIEaHda0mKWTm3NvniHbM5VXarjjlLOXzRzla3BcemPIn+AmGa1yE8v+Ni2vKNR57FWttaZnS5hdU/KEkWYfUoCydqMFVrkgn5nC20N8V9/NLcasjxk3FzRwcXpP0XUx2sRNrpz4cstx1cIBC/y1sT5Jlh/NZBNEuK7nOoP29iluh3Wc5GtNV1TZBxek1rrE4LDlFellAvZTBJMu/AVsJvAQaJUN83KgVNq01MYOHBOGB16m36V65hlrVZQlMAxYed9W8U31dQ1lkFm1wR3PvIrgF8a5sShj+RLlekYNX0WcAiRVaYyzlcRC64f+xKvzmcB/ryB+0JiyvNjiymD0C51aAXy9sL6QYcRXz6GAJa/82r3XuGp9R5HfCZfj/ODMLDxmwlxtOFxG4+UiDwG/nH9XhEd6sczy5PwWWNmn8p9ZW34UyQkVroJITp6VV8h8wYTEUUxO1rsDvTiNq4Pou0fY6jO0RQcNi5zgcYdrDM2HSfP98JYQw5XPsqkqSC3muMsYAM9S7fo0k1TK5AFX+vPtdJ1Fk4RWPVnZuTxhpBUNWhtzo7TK7RbyBzM+plShBQ3RyGtzAPBz9y5df7yLqpEfEOjzGL47qCH1KFEyiEv2JFYHOyiQ== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 44256b45-28f1-4441-ff99-08da9d8163e6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:48.0490 (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: pEfq/CHTx06WJpb+tukl9VWDtFDON+sImw2tjRKGCYqSKfT68Nbl1ytfXIlXojRrjQByFXgdAPkB3kMrxQePfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Kurt Kanzenbach Add support for configuring the max SDU per priority and per port. If not specified, keep the default. Signed-off-by: Kurt Kanzenbach Signed-off-by: Vladimir Oltean --- v1->v2: replace my patch that rejects custom queueMaxSDU values with Kurt's patch that acts upon them drivers/net/dsa/hirschmann/hellcreek.c | 59 +++++++++++++++++++++++++- drivers/net/dsa/hirschmann/hellcreek.h | 7 +++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c index eac6ace7c5f9..ed0bdf0ea6bf 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.c +++ b/drivers/net/dsa/hirschmann/hellcreek.c @@ -128,6 +128,16 @@ static void hellcreek_select_prio(struct hellcreek *hellcreek, int prio) hellcreek_write(hellcreek, val, HR_PSEL); } +static void hellcreek_select_port_prio(struct hellcreek *hellcreek, int port, + int prio) +{ + u16 val = port << HR_PSEL_PTWSEL_SHIFT; + + val |= prio << HR_PSEL_PRTCWSEL_SHIFT; + + hellcreek_write(hellcreek, val, HR_PSEL); +} + static void hellcreek_select_counter(struct hellcreek *hellcreek, int counter) { u16 val = counter << HR_CSEL_SHIFT; @@ -1537,6 +1547,45 @@ hellcreek_port_prechangeupper(struct dsa_switch *ds, int port, return ret; } +static void hellcreek_setup_maxsdu(struct hellcreek *hellcreek, int port, + const struct tc_taprio_qopt_offload *schedule) +{ + int tc; + + for (tc = 0; tc < 8; ++tc) { + u32 max_sdu = schedule->max_sdu[tc] + VLAN_ETH_HLEN - ETH_FCS_LEN; + u16 val; + + if (!schedule->max_sdu[tc]) + continue; + + dev_dbg(hellcreek->dev, "Configure max-sdu %u for tc %d on port %d\n", + max_sdu, tc, port); + + hellcreek_select_port_prio(hellcreek, port, tc); + + val = (max_sdu & HR_PTPRTCCFG_MAXSDU_MASK) << HR_PTPRTCCFG_MAXSDU_SHIFT; + + hellcreek_write(hellcreek, val, HR_PTPRTCCFG); + } +} + +static void hellcreek_reset_maxsdu(struct hellcreek *hellcreek, int port) +{ + int tc; + + for (tc = 0; tc < 8; ++tc) { + u16 val; + + hellcreek_select_port_prio(hellcreek, port, tc); + + val = (HELLCREEK_DEFAULT_MAX_SDU & HR_PTPRTCCFG_MAXSDU_MASK) + << HR_PTPRTCCFG_MAXSDU_SHIFT; + + hellcreek_write(hellcreek, val, HR_PTPRTCCFG); + } +} + static void hellcreek_setup_gcl(struct hellcreek *hellcreek, int port, const struct tc_taprio_qopt_offload *schedule) { @@ -1720,7 +1769,10 @@ static int hellcreek_port_set_schedule(struct dsa_switch *ds, int port, } hellcreek_port->current_schedule = taprio_offload_get(taprio); - /* Then select port */ + /* Configure max sdu */ + hellcreek_setup_maxsdu(hellcreek, port, hellcreek_port->current_schedule); + + /* Select tdg */ hellcreek_select_tgd(hellcreek, port); /* Enable gating and keep defaults */ @@ -1772,7 +1824,10 @@ static int hellcreek_port_del_schedule(struct dsa_switch *ds, int port) hellcreek_port->current_schedule = NULL; } - /* Then select port */ + /* Reset max sdu */ + hellcreek_reset_maxsdu(hellcreek, port); + + /* Select tgd */ hellcreek_select_tgd(hellcreek, port); /* Disable gating and return to regular switching flow */ diff --git a/drivers/net/dsa/hirschmann/hellcreek.h b/drivers/net/dsa/hirschmann/hellcreek.h index 9e303b8ab13c..4a678f7d61ae 100644 --- a/drivers/net/dsa/hirschmann/hellcreek.h +++ b/drivers/net/dsa/hirschmann/hellcreek.h @@ -37,6 +37,7 @@ #define HELLCREEK_VLAN_UNTAGGED_MEMBER 0x1 #define HELLCREEK_VLAN_TAGGED_MEMBER 0x3 #define HELLCREEK_NUM_EGRESS_QUEUES 8 +#define HELLCREEK_DEFAULT_MAX_SDU 1536 /* Register definitions */ #define HR_MODID_C (0 * 2) @@ -72,6 +73,12 @@ #define HR_PRTCCFG_PCP_TC_MAP_SHIFT 0 #define HR_PRTCCFG_PCP_TC_MAP_MASK GENMASK(2, 0) +#define HR_PTPRTCCFG (0xa9 * 2) +#define HR_PTPRTCCFG_SET_QTRACK BIT(15) +#define HR_PTPRTCCFG_REJECT BIT(14) +#define HR_PTPRTCCFG_MAXSDU_SHIFT 0 +#define HR_PTPRTCCFG_MAXSDU_MASK GENMASK(10, 0) + #define HR_CSEL (0x8d * 2) #define HR_CSEL_SHIFT 0 #define HR_CSEL_MASK GENMASK(7, 0) From patchwork Fri Sep 23 16:33:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986787 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0632C6FA90 for ; Fri, 23 Sep 2022 16:34:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbiIWQeW (ORCPT ); Fri, 23 Sep 2022 12:34:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbiIWQdy (ORCPT ); Fri, 23 Sep 2022 12:33:54 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60063.outbound.protection.outlook.com [40.107.6.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD48313F291; Fri, 23 Sep 2022 09:33:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kc3vH990tCLjtas/1uh8p2pxpmD/YQLB+mwoWxnuYiU8ICWFLJQPZjHjLS2zO9Bhw3YoDDnPvt/CUol1LTFow3u5EBrOc/z+Y+cqmBeIjauNFqSQzT5A/VTItsfX+//aA/0IxcGaPrHxWxoF8ZIZf0IPS5RgDcmD6DLNjm485P4pe3oVjX1hwEt6OIjBmalhxUxMC/y40ILC3CHcYYQKgvQ+4MXmFmcVWS+M54BeukfcQ2taI30ATxDLsMB1wzWjKJhmeQ8y06OMmLGSWRAe2BaZ54gewyP6/buYyYrbqy83/wxjd0j4xnRLtYUsjfFOLvZg3BEVDpeHnIDDFpKlGA== 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=iD+qB3/civwY99BrKFFMIwjvQ88kMycvF7XzrouoyFE=; b=b2ohA1UcX8F/9PWYifrym9SNdzf23b37XAvRVOAhDNLNjpEU1XqnfQ6ffBhZ1zlHHq2mK5GYVI28brCnhcfegQx1DWkaRFW3QZOs8NWAtH1ZOteaFj26bPm9vJTn94Z14F1qdIi2MKJxsFVFY0ig6C9b5vo7Tqq+ZPkOz6dTnmnFC9oxEd1Vi2dMGAdLL5vuLEavWgml6LxmK2IZNAMQLdY2RbvkZ7AtC7U0w7kvBuVjOkvaG6TEYvd09PaN4584+g1op2PP643TEDJGRBr5aKD3herUF0Mj1hej8dLIfDx3iVBTw0UFzTlwOS4XadM4MvuIO6Ao502Mc6t2T85KNA== 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=iD+qB3/civwY99BrKFFMIwjvQ88kMycvF7XzrouoyFE=; b=EAxwta3ipLONxnBqq0D56BHTnwgV/tcEfMP9Y0PhzCxaOkP5z0tnqVkgU3hMS6ivCDe+Coo+6OH/p4eNk+iya0csh0a273naTFv1lQzu5gUHZBScfwCieKDKXEUvHLgiIni0pg6E01zLz6pZu6/RgE7X4PRglIVytB2ZYoAIRk4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:50 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:50 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 10/12] net: enetc: cache accesses to &priv->si->hw Date: Fri, 23 Sep 2022 19:33:08 +0300 Message-Id: <20220923163310.3192733-11-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 750cce55-08d4-4ad1-33ad-08da9d816588 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ym50ysa+u8Ligz3zZfuuwwtqACWPBN+ZCwlM0Oq2VON8dJT9lE38wqGEnKq8qv/ZsxvD3lb+RQ/0ItkuXuWjDhEf3NIvLfezN8IXPymf+gTk4jaXJnpzOmY78SwpPZiYFjf52Ee7Ah2PwRzQ8VVTXXaajDGn4VNZVUpTjV55Ly+V4nbHE+lHzMotndbwMTVRX3gV6ibHVFy1k//yt6PL3Jsk9VJ0/q0dJdDCGlUsk6y5NMu5bhRy50RVib1qmWo/cfEbGrHJcm5vSdhImeQrBUlOuqDqBW6zvYcb/rcGIoWHXBK2xcUd4jDDSzUa9mIeanohEwN2zkra3le/E+tykpdN2n3s1uvPU0ly4X8tDM/YKtjoc7Ywv/NMfQPnq9PeAmMiBlpswsfBnxPFWJ579a26b9FN6SIGTe1EN7zAlfCPJmu5bNb+60IsPc2+C21mEWU9/u+RCla74l9gnoGVvLgkIJu4hqrezDSX779CJ5ye3a2a/vYW4UNdg3Et7pQ+KeAbpCx/dC9UYalt44AmbK5avOqjGnUI0mXAp7FjsCN5s6vZCuYIdhrhFWEucioFzeqVFwbTWhepPhkFTAUvD81SeRFc9m0Vogui6O4PLG18jplmX6OebV9d/iXT1dKguJNE8Il46tNYKPPGJVvcI0WFizt1yMmfWc/uTfrZhQv59TqPReNj6zRAvHu9VyJSUGsfT1ZBbY7mBSwKRtOdlV6j46S7n+F/kdCQhj0eLf3ZPHdrN+qdOw+Q+H352dB9EllPIK/Y9z7h2Ijj9+QZ+w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(30864003)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: upcmZq8yXNpVqKL2UHilmAhSaF58ZnEMbyTSeu6p7Z2De+wMqoN0zS572WtQkWEcyedBqjoNhETmTgaPm/2lDYQ6LF6U88n6AYGiAI15XuMQ0rG4gFhoVUKawvu8c5M8kwoopB9PGtr7EG5ZpIWOR14YLvoIk18FHYLMWt2R/0W4nVMu/OcEITRt+rbHBzSI+tX6Xt41bcyJhY4IY1kSS3NjXcOdRVk4uHnj0DC6CRI30UN6/gOYvM92Wjm4wIyNda7nMNJWDQ59kIhPCFd/ZqSSThM3c/JhMAH8LItZdaD4edfvBYAAmGDJoQ57tZiATpel6X5AG9FHiTcO3IkH2+7ConqQjGvaGm5lBpKdrODIMzLNYf8SDvbBoS/UXonw+QPPms4dldxZe4ovNKYLyI+pczxA1MuZkV8dLwaqz6axAotW2TnFPqdUcwxaXCTB23+I6NQiwz/tO+e3q2PVSG7E5uVHEP0Jj6F62cz1slPjev2dubIUH6I50oAt8DcpOV0omNBwCZT74tk/Mh2lIENTW4Idn0SCeSQAhO6UkS5xyfpLmjiyGDghX8Ms1K67NhoNKi/NgTciGeBiWxzQPyN9OoSO/EQY6kc5oCc7f75yopYgn611ymD9ZPY+2n1g5bpEKRsveDRrtFFqRbxipxnGIu4m2MR3qrtMZoAnAIGYeNrGCk43s1HnJym6f7FIZUj3IK0qaqe3KJDcQSFpS7w9ElCXZ5YOn+gwT1J6TUQ+QqBFEJSI+xy14mgGziep2vfipim+QVsHkKZUhjkvDp+MtE+JQ/IR01J7hEWTmDx+zHQHqwoRDOlE8VpPXZii2wrmcXslcPWl6j78FrLJLX35KH/R8YrwrphCwNEgojsJ/Foa3HTblVMVdb48t4+qXUjK37C9p6RBijcum3j7x/Serwx5mYPDGIvoakieWVL2i6/xVOtBchVVhsvL+T9AFfLRvSUQnLyKu+yfG8VNM9G5PNt8mOhRGctWi2iAOIAjh9dt0GOIe6atRvfGMKH0DCU2C6QyNQiJrlbJd5jsZ1pWNXjGeW3jJ32dfzzxX1DGULRIEh1ao0LWKVPP6CB9qybcyft8Vpb7jGju706ihbtgQrbLgxXjHCBeejO9UC5dTO/F1o6nJwc35TJ5RUV9SafVl6GqC5v/YhJvZ7/GH+3Ab3WHmUvTw09yh/J9ulizHSTPL9RuqekLvqZAN5Ys4Uxf4t4YHEf6ptTfneU+wIKfbM3N5HkdzLOPRsvyTIykPWHaCea4tLJaxMQk73io/M9GnPysq9RuOlLeP0RdDsoK9ofDW9h9sSak4yV/+5izPTC/0OV7YBMbw/jSEgz4ACgybtzLb/SrjGoOUdeKHG+oWylg8+qQrPOrMp6wmGrTyFpc4OFTibJ2JgHgzWEdTJiAzILw/xHepE0mjguY+rS+FPZh5Ke2eObFg0X75jHs2IsEJ/IeacPyaROBNusNOpRi6TcJ0sCySYvYYM61DJnDLkEu4rTvnqz3D9D+piXx4uKzmMclhxPyo3nQ7IsFpmeLr0PzRJoRpIRBS4qJE4gyFyZTG58WGNWF9dERz02RqDQjr4GOknxdD68eqzT8G/nnAciLCWNUxBhsGjqj9Q== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 750cce55-08d4-4ad1-33ad-08da9d816588 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:50.8457 (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: JN0Al1cLxJ5AJM+w9fgqTEiGoqpUCK7/ZG3sr0JA+isaRe0VfoLp2cOXbv1TU8xxxtzHhMkE2ttJ2rLqi5WCUA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The &priv->si->hw construct dereferences 2 pointers and makes lines longer than they need to be, in turn making the code harder to read. Replace &priv->si->hw accesses with a "hw" variable when there are 2 or more accesses within a function that dereference this. This includes loops, since &priv->si->hw is a loop invariant. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/freescale/enetc/enetc.c | 28 +++++---- drivers/net/ethernet/freescale/enetc/enetc.h | 9 +-- .../net/ethernet/freescale/enetc/enetc_qos.c | 60 +++++++++---------- 3 files changed, 49 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.c b/drivers/net/ethernet/freescale/enetc/enetc.c index 9f5b921039bd..151fb3fa4806 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.c +++ b/drivers/net/ethernet/freescale/enetc/enetc.c @@ -2116,13 +2116,14 @@ static void enetc_setup_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) static void enetc_setup_bdrs(struct enetc_ndev_priv *priv) { + struct enetc_hw *hw = &priv->si->hw; int i; for (i = 0; i < priv->num_tx_rings; i++) - enetc_setup_txbdr(&priv->si->hw, priv->tx_ring[i]); + enetc_setup_txbdr(hw, priv->tx_ring[i]); for (i = 0; i < priv->num_rx_rings; i++) - enetc_setup_rxbdr(&priv->si->hw, priv->rx_ring[i]); + enetc_setup_rxbdr(hw, priv->rx_ring[i]); } static void enetc_clear_rxbdr(struct enetc_hw *hw, struct enetc_bdr *rx_ring) @@ -2155,13 +2156,14 @@ static void enetc_clear_txbdr(struct enetc_hw *hw, struct enetc_bdr *tx_ring) static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) { + struct enetc_hw *hw = &priv->si->hw; int i; for (i = 0; i < priv->num_tx_rings; i++) - enetc_clear_txbdr(&priv->si->hw, priv->tx_ring[i]); + enetc_clear_txbdr(hw, priv->tx_ring[i]); for (i = 0; i < priv->num_rx_rings; i++) - enetc_clear_rxbdr(&priv->si->hw, priv->rx_ring[i]); + enetc_clear_rxbdr(hw, priv->rx_ring[i]); udelay(1); } @@ -2169,13 +2171,13 @@ static void enetc_clear_bdrs(struct enetc_ndev_priv *priv) static int enetc_setup_irqs(struct enetc_ndev_priv *priv) { struct pci_dev *pdev = priv->si->pdev; + struct enetc_hw *hw = &priv->si->hw; int i, j, err; for (i = 0; i < priv->bdr_int_num; i++) { int irq = pci_irq_vector(pdev, ENETC_BDR_INT_BASE_IDX + i); struct enetc_int_vector *v = priv->int_vector[i]; int entry = ENETC_BDR_INT_BASE_IDX + i; - struct enetc_hw *hw = &priv->si->hw; snprintf(v->name, sizeof(v->name), "%s-rxtx%d", priv->ndev->name, i); @@ -2263,13 +2265,14 @@ static void enetc_setup_interrupts(struct enetc_ndev_priv *priv) static void enetc_clear_interrupts(struct enetc_ndev_priv *priv) { + struct enetc_hw *hw = &priv->si->hw; int i; for (i = 0; i < priv->num_tx_rings; i++) - enetc_txbdr_wr(&priv->si->hw, i, ENETC_TBIER, 0); + enetc_txbdr_wr(hw, i, ENETC_TBIER, 0); for (i = 0; i < priv->num_rx_rings; i++) - enetc_rxbdr_wr(&priv->si->hw, i, ENETC_RBIER, 0); + enetc_rxbdr_wr(hw, i, ENETC_RBIER, 0); } static int enetc_phylink_connect(struct net_device *ndev) @@ -2436,6 +2439,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) { struct enetc_ndev_priv *priv = netdev_priv(ndev); struct tc_mqprio_qopt *mqprio = type_data; + struct enetc_hw *hw = &priv->si->hw; struct enetc_bdr *tx_ring; int num_stack_tx_queues; u8 num_tc; @@ -2452,7 +2456,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) /* Reset all ring priorities to 0 */ for (i = 0; i < priv->num_tx_rings; i++) { tx_ring = priv->tx_ring[i]; - enetc_set_bdr_prio(&priv->si->hw, tx_ring->index, 0); + enetc_set_bdr_prio(hw, tx_ring->index, 0); } return 0; @@ -2471,7 +2475,7 @@ int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data) */ for (i = 0; i < num_tc; i++) { tx_ring = priv->tx_ring[i]; - enetc_set_bdr_prio(&priv->si->hw, tx_ring->index, i); + enetc_set_bdr_prio(hw, tx_ring->index, i); } /* Reset the number of netdev queues based on the TC count */ @@ -2584,19 +2588,21 @@ static int enetc_set_rss(struct net_device *ndev, int en) static void enetc_enable_rxvlan(struct net_device *ndev, bool en) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_hw *hw = &priv->si->hw; int i; for (i = 0; i < priv->num_rx_rings; i++) - enetc_bdr_enable_rxvlan(&priv->si->hw, i, en); + enetc_bdr_enable_rxvlan(hw, i, en); } static void enetc_enable_txvlan(struct net_device *ndev, bool en) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_hw *hw = &priv->si->hw; int i; for (i = 0; i < priv->num_tx_rings; i++) - enetc_bdr_enable_txvlan(&priv->si->hw, i, en); + enetc_bdr_enable_txvlan(hw, i, en); } void enetc_set_features(struct net_device *ndev, netdev_features_t features) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 2cfe6944ebd3..748677b2ce1f 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -467,19 +467,20 @@ int enetc_set_psfp(struct net_device *ndev, bool en); static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv) { + struct enetc_hw *hw = &priv->si->hw; u32 reg; - reg = enetc_port_rd(&priv->si->hw, ENETC_PSIDCAPR); + reg = enetc_port_rd(hw, ENETC_PSIDCAPR); priv->psfp_cap.max_streamid = reg & ENETC_PSIDCAPR_MSK; /* Port stream filter capability */ - reg = enetc_port_rd(&priv->si->hw, ENETC_PSFCAPR); + reg = enetc_port_rd(hw, ENETC_PSFCAPR); priv->psfp_cap.max_psfp_filter = reg & ENETC_PSFCAPR_MSK; /* Port stream gate capability */ - reg = enetc_port_rd(&priv->si->hw, ENETC_PSGCAPR); + reg = enetc_port_rd(hw, ENETC_PSGCAPR); priv->psfp_cap.max_psfp_gate = (reg & ENETC_PSGCAPR_SGIT_MSK); priv->psfp_cap.max_psfp_gatelist = (reg & ENETC_PSGCAPR_GCL_MSK) >> 16; /* Port flow meter capability */ - reg = enetc_port_rd(&priv->si->hw, ENETC_PFMCAPR); + reg = enetc_port_rd(hw, ENETC_PFMCAPR); priv->psfp_cap.max_psfp_meter = reg & ENETC_PFMCAPR_MSK; } diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index f8a2f02ce22d..2e783ef73690 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -17,8 +17,9 @@ static u16 enetc_get_max_gcl_len(struct enetc_hw *hw) void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) { + struct enetc_hw *hw = &priv->si->hw; u32 old_speed = priv->speed; - u32 pspeed; + u32 pspeed, tmp; if (speed == old_speed) return; @@ -39,16 +40,15 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) } priv->speed = speed; - enetc_port_wr(&priv->si->hw, ENETC_PMR, - (enetc_port_rd(&priv->si->hw, ENETC_PMR) - & (~ENETC_PMR_PSPEED_MASK)) - | pspeed); + tmp = enetc_port_rd(hw, ENETC_PMR); + enetc_port_wr(hw, ENETC_PMR, (tmp & ~ENETC_PMR_PSPEED_MASK) | pspeed); } static int enetc_setup_taprio(struct net_device *ndev, struct tc_taprio_qopt_offload *admin_conf) { struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_hw *hw = &priv->si->hw; struct enetc_cbd cbd = {.cmd = 0}; struct tgs_gcl_conf *gcl_config; struct tgs_gcl_data *gcl_data; @@ -61,15 +61,13 @@ static int enetc_setup_taprio(struct net_device *ndev, int err; int i; - if (admin_conf->num_entries > enetc_get_max_gcl_len(&priv->si->hw)) + if (admin_conf->num_entries > enetc_get_max_gcl_len(hw)) return -EINVAL; gcl_len = admin_conf->num_entries; - tge = enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET); + tge = enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET); if (!admin_conf->enable) { - enetc_wr(&priv->si->hw, - ENETC_QBV_PTGCR_OFFSET, - tge & (~ENETC_QBV_TGE)); + enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE); priv->active_offloads &= ~ENETC_F_QBV; @@ -117,14 +115,11 @@ static int enetc_setup_taprio(struct net_device *ndev, cbd.cls = BDCR_CMD_PORT_GCL; cbd.status_flags = 0; - enetc_wr(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET, - tge | ENETC_QBV_TGE); + enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge | ENETC_QBV_TGE); err = enetc_send_cmd(priv->si, &cbd); if (err) - enetc_wr(&priv->si->hw, - ENETC_QBV_PTGCR_OFFSET, - tge & (~ENETC_QBV_TGE)); + enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE); enetc_cbd_free_data_mem(priv->si, data_size, tmp, &dma); @@ -138,6 +133,7 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) { struct tc_taprio_qopt_offload *taprio = type_data; struct enetc_ndev_priv *priv = netdev_priv(ndev); + struct enetc_hw *hw = &priv->si->hw; int err; int i; @@ -147,16 +143,14 @@ int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data) return -EBUSY; for (i = 0; i < priv->num_tx_rings; i++) - enetc_set_bdr_prio(&priv->si->hw, - priv->tx_ring[i]->index, + enetc_set_bdr_prio(hw, priv->tx_ring[i]->index, taprio->enable ? i : 0); err = enetc_setup_taprio(ndev, taprio); if (err) for (i = 0; i < priv->num_tx_rings; i++) - enetc_set_bdr_prio(&priv->si->hw, - priv->tx_ring[i]->index, + enetc_set_bdr_prio(hw, priv->tx_ring[i]->index, taprio->enable ? 0 : i); return err; @@ -178,7 +172,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) struct tc_cbs_qopt_offload *cbs = type_data; u32 port_transmit_rate = priv->speed; u8 tc_nums = netdev_get_num_tc(ndev); - struct enetc_si *si = priv->si; + struct enetc_hw *hw = &priv->si->hw; u32 hi_credit_bit, hi_credit_reg; u32 max_interference_size; u32 port_frame_max_size; @@ -199,15 +193,15 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) * lower than this TC have been disabled. */ if (tc == prio_top && - enetc_get_cbs_enable(&si->hw, prio_next)) { + enetc_get_cbs_enable(hw, prio_next)) { dev_err(&ndev->dev, "Disable TC%d before disable TC%d\n", prio_next, tc); return -EINVAL; } - enetc_port_wr(&si->hw, ENETC_PTCCBSR1(tc), 0); - enetc_port_wr(&si->hw, ENETC_PTCCBSR0(tc), 0); + enetc_port_wr(hw, ENETC_PTCCBSR1(tc), 0); + enetc_port_wr(hw, ENETC_PTCCBSR0(tc), 0); return 0; } @@ -224,13 +218,13 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) * higher than this TC have been enabled. */ if (tc == prio_next) { - if (!enetc_get_cbs_enable(&si->hw, prio_top)) { + if (!enetc_get_cbs_enable(hw, prio_top)) { dev_err(&ndev->dev, "Enable TC%d first before enable TC%d\n", prio_top, prio_next); return -EINVAL; } - bw_sum += enetc_get_cbs_bw(&si->hw, prio_top); + bw_sum += enetc_get_cbs_bw(hw, prio_top); } if (bw_sum + bw >= 100) { @@ -239,7 +233,7 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) return -EINVAL; } - enetc_port_rd(&si->hw, ENETC_PTCMSDUR(tc)); + enetc_port_rd(hw, ENETC_PTCMSDUR(tc)); /* For top prio TC, the max_interfrence_size is maxSizedFrame. * @@ -259,8 +253,8 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) u32 m0, ma, r0, ra; m0 = port_frame_max_size * 8; - ma = enetc_port_rd(&si->hw, ENETC_PTCMSDUR(prio_top)) * 8; - ra = enetc_get_cbs_bw(&si->hw, prio_top) * + ma = enetc_port_rd(hw, ENETC_PTCMSDUR(prio_top)) * 8; + ra = enetc_get_cbs_bw(hw, prio_top) * port_transmit_rate * 10000ULL; r0 = port_transmit_rate * 1000000ULL; max_interference_size = m0 + ma + @@ -280,10 +274,10 @@ int enetc_setup_tc_cbs(struct net_device *ndev, void *type_data) hi_credit_reg = (u32)div_u64((ENETC_CLK * 100ULL) * hi_credit_bit, port_transmit_rate * 1000000ULL); - enetc_port_wr(&si->hw, ENETC_PTCCBSR1(tc), hi_credit_reg); + enetc_port_wr(hw, ENETC_PTCCBSR1(tc), hi_credit_reg); /* Set bw register and enable this traffic class */ - enetc_port_wr(&si->hw, ENETC_PTCCBSR0(tc), bw | ENETC_CBSE); + enetc_port_wr(hw, ENETC_PTCCBSR0(tc), bw | ENETC_CBSE); return 0; } @@ -293,6 +287,7 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) struct enetc_ndev_priv *priv = netdev_priv(ndev); struct tc_etf_qopt_offload *qopt = type_data; u8 tc_nums = netdev_get_num_tc(ndev); + struct enetc_hw *hw = &priv->si->hw; int tc; if (!tc_nums) @@ -304,12 +299,11 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) return -EINVAL; /* TSD and Qbv are mutually exclusive in hardware */ - if (enetc_rd(&priv->si->hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) + if (enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) return -EBUSY; priv->tx_ring[tc]->tsd_enable = qopt->enable; - enetc_port_wr(&priv->si->hw, ENETC_PTCTSDR(tc), - qopt->enable ? ENETC_TSDE : 0); + enetc_port_wr(hw, ENETC_PTCTSDR(tc), qopt->enable ? ENETC_TSDE : 0); return 0; } From patchwork Fri Sep 23 16:33:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986788 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0114ECAAD8 for ; Fri, 23 Sep 2022 16:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232963AbiIWQeX (ORCPT ); Fri, 23 Sep 2022 12:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233045AbiIWQd5 (ORCPT ); Fri, 23 Sep 2022 12:33:57 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60069.outbound.protection.outlook.com [40.107.6.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9200613F2A3; Fri, 23 Sep 2022 09:33:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxNIbbZrm8dLpPaJE37IXh8E5nqP0JIK7CB+Mudw/CrED4Ce92GwEdaLsWGhICurkj2Wl0mq29YaQxsEBb44gk4XvOkJKeYQu7E9iVNN8yifU9yX9j4C92Vc3TwlNHorIzU5RIMNFIf/mg6rOFlLKrfiLzHnBEm2z+HASL73MZaNoCW5cAG9bnOF8D3tOtapRdZDb6tqYawkEe+q/tY2LoXT/b9m3hghc/h9IkucBCWCNbC27WpFsNS2suF18Z6YD1FQJk19WNj2l/+DoG+8WWyDYwgveTbcogE2oPxGa2b3FeNPbcuZOsRFU656ufWjjZdT8LvZQNP4oeB1MSly5Q== 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=Xp1J27hcDCtF1HUstcQHK5fAljx+vmIqXGLXWwbTue4=; b=SJcVEQ6iclqeMDukN+gbdjtmnEhxC5rd9kPYxZoZ+C5hQ86i40zoUjpBfqjnH98/AnM4FLRRlWydLNaBvCGaGtrDlU5Jln91z9L8B5/6VzSpOHmQPMZ78Hvz970xpbmd/1UDw+n2M1lws6M9e1b+0v/N9LFEAwdRxOhHdOoWLFLLc0uueIDGAghBwVcVS2kY56AJLU1wJHwnzyzzdL3q+f1VpsS6qYS9GUOXkY7L0QcZw4S7xwaEOQvNXcXfyOpwUol0oZ7g9nTOc5vwJBcGJCxBGZincNsG0syfdISWZ3+OfkNKa17JEOA9djKW90NOl6hqe9DETn9BKQe4T+C88Q== 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=Xp1J27hcDCtF1HUstcQHK5fAljx+vmIqXGLXWwbTue4=; b=mlJxF2C7ZG6wgH3E8K0NLdBpVGfpckykrxAMAa6aV2BYq9hGjaUsm1R2D1cyCyVXUjY1m+f+xs9fGL+VfNPOqOXO7M+GA1ILdxx0/LMKrfimCJ3HxXvWPk2UlQO0vNzrF5u6ynxDahMmngPCAd8sagbRE5kWWDwDlHNqSsHwfB8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:53 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:53 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 11/12] net: enetc: use common naming scheme for PTGCR and PTGCAPR registers Date: Fri, 23 Sep 2022 19:33:09 +0300 Message-Id: <20220923163310.3192733-12-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aab1d65-86fe-4a14-67a0-08da9d816729 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a+dMqarntZuxFb+uWuAreifqK3cvhwzdJvlfu9+6FTjhKWfjlYsLsRXqUJSF7b0zuEF35EqwwEDCiq/Ub4DWqQjrXvNLrj7sYp0KC1I7cJqxlUk1ef0FkjoqFS6eTLedr5rAzUWMvz5SS4G2mzhpv4J/xVzwNf2pD8W3vdTDZEFmev24l4eemI3BKhwhGc9gxKHLVFcCKfLP8CTu/dHJYAkAzbsuVyuZ0R6LGTcrKS6lSErq88sd/qiOVMCmLmi3X+PVsZZiT41G2prXd5qoAGgyRiytaTGIiF0zt8W041sM6Mbm6KHqdASh9Iv6U2s030sfcPMpbkIMI+ukkClKhkiugj6ddKsS/tuF2tXfIHaBMuYne4vRBHLqu6LUFuA1za2jEDvacLiRhwol0fvZZ/7jQ1oMzePBuv3/kRR+ZwGM808SVbPm69ruOVI0t7C+6aV3MbP3xt1JlioI7bJVAVMfpZLjbn4LMXk7qwwJQEr1W6N1PF8XZZtBSUDrRQy9Jk+u1U/OumIpUC7/oIFTKr9l3Njhzuhn6rX92qnbqG6u6zXk5iN+rCylnMdf9fsp/dgbgW0n5Q7mF5EoMoVXg/TwT0GdknAetTiyVD4bYKukZvktsL97kDNCgEcrvpYp+BwBaglvhR1QcD3wvquSEJ5ylhu1ACLO0dXMuSqz9wdiPnov0L3Xh2WbI89E5EV/C7X+ePLntG6jFirD6Jj+5duF5dpHNx/WJYDpKIDDkGj7j1Bfs45dAD7NbQmGorBLUHSSwfP4+OSRL54YBtUOZy/6xqMbdO1CDzKwlkT6d/c= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(966005)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RIH+cp2Un8ndpEml3aFxX2W/bFQ5Jj80Oo1/XbCmuvQTs4Bi3GRGsi+UlFvPA0O5hoDa8/5XReM1v1Xhig/Uua2BjNwJrSvpiK5R8+/y+L9gJbX5MbyxcFTL2HD1pCFCl8GDBoztk7hHOnpv+sQ4IOChmhScSRkgMlHWsSx6srGYsNEJEXHbAgTj3Vuuca32OR33VlCTFisCnH8A8LfT+rAtinoZzPTho/TCeHhizEWtpLSgvFUS1osC1f4Ek5QX1Yr6ZNBN+td6bdsyveBLAOj5Eyg4lKp34ZmAyDkJVwAUGAN46PXqQ7l/eF5jt68TJwIYMddac1HtaJuwkWlmbfdD+AN54FUKolACpMeSBTgXj7CKmD3rih/qUKvENJhA8ODQp9PultVayvWbSO6PerwoWesymnsmh+eexDEeAtDhBRFmO8lIm08x6TvYMLBSalpriv/b4b9TuKP4ZcEuZq+UmgR35cAKFcksXZXLLsjlldrgNWKiZfhunl8xrbI2VFl/8l6nXkI5M5C0OmrQi65Hetb3WWpWp0tKAgC+T5hn3LTHPTaUnOtoQysBdUWWjf+GXpegyOCnv68caslEiB6D2bM/yyGivhJ/YP7pzA+LjLmzOc+DK4a+YJo74Sm3pB9fglYGLocuIrMOVPAMR3YoyzetX8UH18w1tmYEgORpQtqKN9/hgiThyox9ydhb2BlAAqBwtrantjNniWYOTk2h7FhPXvPZ4F4rAj4n8jkL7mhU3TiLRCJwn1SBQEPgckawbGc4g2RhhJMmeYnfRmP4ylCd7k+s2aAyBBIxeRbXJ7CxozU4F6IbrDMc7EXUzjO828/QWqLHwPJ+gWLFNQcknzQ6GDxWsckDgIuBiS8YDA0pa4wEyAc3NhQEyK6dr/91SgQeUVCR/T2d6kM7JbZmdgp6VDaT8IYgVggdOW2+jBb0TtNXsBi9LlVn/j+Gq4P6qn3F6OXopCxxrmsES7TRfqm1+naRPDyCjPXGzqoiaZsCfXw5AqCEjz3mk551Yw7Wom1ggY8EQHVb5uW59+cw5GkRF+rcAnzRpuZyuPGe1ZP2V3PconC3Zu2Dq85IyNcTWp+6w3rY7lD5WkkwkxKy/IWiQmH8SqZqOpAlEqtJe88l2xTd2KAFXgMvsHI31HWnQHHckVoDNWFg3ZjN32FyBaB8qixiFSOIJIqnSyDFMyUR1x97xS7pf6uCs8HxOI9S7oUFdTFTZ8FSe54U52/UGqUKRCuvyulsQKakL/kOJ46Sgcr+7FvJ4DSHRXhsunDjJv6JAj3BHsngL9kQ7nbAlmwNtsyoMuUAEOlIswyOca0HAD95XCZ7X/sCAV51Evwq6I73yQyfXjal+CSOPGJc7yz4pmwYHl7LqK6vxB6XBxy4TZrG1D/9WCl2pbhbDj2ZaOCuLwfYkLBZqRHfyuV3EQIqeJi0lsHF59SFEEGGuoNvZxhFzkB/e2mApkqQuoeAq0BLBGJBvjGmEBkjXT+CO5dr2tSB3j5c8Ccj9XBpDsW5aZXRlscWtaJBZYQs6F99UycCPWZjuvsJ6hYcJGlSzlahdXcCXoBweVbYPJTRzzWDJmnU3k9BqnmJL7LIBjtViZwlZl97SnXXpzRkjw== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1aab1d65-86fe-4a14-67a0-08da9d816729 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:53.5330 (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: C65rxkPiIfIhQ/eiXD2XMJTY7DOngYMCInKjXx460+CV7e0gkxIAJYL5z4BikurHHn3vBKcnuD+Fc30oHCI1QA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The Port Time Gating Control Register (PTGCR) and Port Time Gating Capability Register (PTGCAPR) have definitions in the driver which aren't in line with the other registers. Rename these. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new (actually taken from the separate preliminary series at https://patchwork.kernel.org/project/netdevbpf/patch/20220921144349.1529150-2-vladimir.oltean@nxp.com/) drivers/net/ethernet/freescale/enetc/enetc_hw.h | 10 +++++----- drivers/net/ethernet/freescale/enetc/enetc_qos.c | 13 ++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_hw.h b/drivers/net/ethernet/freescale/enetc/enetc_hw.h index 0b85e37a00eb..18ca1f42b1f7 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h +++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h @@ -945,13 +945,13 @@ static inline u32 enetc_usecs_to_cycles(u32 usecs) } /* port time gating control register */ -#define ENETC_QBV_PTGCR_OFFSET 0x11a00 -#define ENETC_QBV_TGE BIT(31) -#define ENETC_QBV_TGPE BIT(30) +#define ENETC_PTGCR 0x11a00 +#define ENETC_PTGCR_TGE BIT(31) +#define ENETC_PTGCR_TGPE BIT(30) /* Port time gating capability register */ -#define ENETC_QBV_PTGCAPR_OFFSET 0x11a08 -#define ENETC_QBV_MAX_GCL_LEN_MASK GENMASK(15, 0) +#define ENETC_PTGCAPR 0x11a08 +#define ENETC_PTGCAPR_MAX_GCL_LEN_MASK GENMASK(15, 0) /* Port time specific departure */ #define ENETC_PTCTSDR(n) (0x1210 + 4 * (n)) diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index 2e783ef73690..ee28cb62afe8 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -11,8 +11,7 @@ static u16 enetc_get_max_gcl_len(struct enetc_hw *hw) { - return enetc_rd(hw, ENETC_QBV_PTGCAPR_OFFSET) - & ENETC_QBV_MAX_GCL_LEN_MASK; + return enetc_rd(hw, ENETC_PTGCAPR) & ENETC_PTGCAPR_MAX_GCL_LEN_MASK; } void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) @@ -65,9 +64,9 @@ static int enetc_setup_taprio(struct net_device *ndev, return -EINVAL; gcl_len = admin_conf->num_entries; - tge = enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET); + tge = enetc_rd(hw, ENETC_PTGCR); if (!admin_conf->enable) { - enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE); + enetc_wr(hw, ENETC_PTGCR, tge & ~ENETC_PTGCR_TGE); priv->active_offloads &= ~ENETC_F_QBV; @@ -115,11 +114,11 @@ static int enetc_setup_taprio(struct net_device *ndev, cbd.cls = BDCR_CMD_PORT_GCL; cbd.status_flags = 0; - enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge | ENETC_QBV_TGE); + enetc_wr(hw, ENETC_PTGCR, tge | ENETC_PTGCR_TGE); err = enetc_send_cmd(priv->si, &cbd); if (err) - enetc_wr(hw, ENETC_QBV_PTGCR_OFFSET, tge & ~ENETC_QBV_TGE); + enetc_wr(hw, ENETC_PTGCR, tge & ~ENETC_PTGCR_TGE); enetc_cbd_free_data_mem(priv->si, data_size, tmp, &dma); @@ -299,7 +298,7 @@ int enetc_setup_tc_txtime(struct net_device *ndev, void *type_data) return -EINVAL; /* TSD and Qbv are mutually exclusive in hardware */ - if (enetc_rd(hw, ENETC_QBV_PTGCR_OFFSET) & ENETC_QBV_TGE) + if (enetc_rd(hw, ENETC_PTGCR) & ENETC_PTGCR_TGE) return -EBUSY; priv->tx_ring[tc]->tsd_enable = qopt->enable; From patchwork Fri Sep 23 16:33:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 12986789 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B30ECAAD8 for ; Fri, 23 Sep 2022 16:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233016AbiIWQeZ (ORCPT ); Fri, 23 Sep 2022 12:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233050AbiIWQd6 (ORCPT ); Fri, 23 Sep 2022 12:33:58 -0400 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60069.outbound.protection.outlook.com [40.107.6.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E7613EEA1; Fri, 23 Sep 2022 09:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IIScERnkdRU/Lx7MS4Dhpv56N/84hHiqcRF9/TFLVRugix/9b+SOdNwDZOfErY+WNH5WkPJ9UMs8acoBca7wOaXZKJtcRdaERSD8RouYABs86aeViTYOweCPERahHnAlJa8VDcXPXinFYnvGzFI5fvUg1wSBFXRdm6umPuqRj9Kb74OBbGSvvTY2UBQBDbttlWeDnG/66yvWOUv+Dqgw/DD7JDLuS8DKoVG0z+LT1ttbKcPclJHR1V3hVsktcNNcbUCwV3NjPAOiyrGk4d9wcYaBiGb/Mt6I56jaPWQc800gmqq8wDXIH+hoQ4ZR3W8C+vq0wLJsJ6AvOOKMvKQLbQ== 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=KjrRv+/2Z5PEvV78C1tgl9XWbataohtmabNPuk+XUnA=; b=W8mqhC7ElEJwuFQ0G9nUYux+Q3+o71Z07eOPHZr8EwbxZjXQC2FRts8r4oa1QtSehcE7r81/UaTCEqJXoho9tDbQDwrPixNWzp8oTa6oGbSmWJPDB65DNtRJWprFH9btJO/lDh5KfB472c4ATo8W3r4tYK5S742y/bUwfH/CuLxaZVE9ls5RM3EPqpc7gecih4yXSsBHf/qZLa2mPAzk7gcSWXVK4KuhVMsmwq6fpyhZOTzEkemCTmmx16PaI7ixwC2a8QltLXSxjjD/CPeXCe1KnaIIuYGNKjI4fZ4bgIUSlwp3+4WDQKT+uaBq0b2tE/55Nj0RpXYxFmW6RYdDkA== 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=KjrRv+/2Z5PEvV78C1tgl9XWbataohtmabNPuk+XUnA=; b=j4DLP2LvybvzIsr3WDJXHtwuPM2nAQlf9Q19B6OoaOAymO7DZ+jHLac6+qcvcq8PGUnF4voaI7juGTMqSxQdrg0Itlo0wcIXyv+7OE9rNpjZNK2Syli6bbveeyQJxoSIz0PIwjLtgxh+0gbH+Ftb4R1isnb/LSaVd8Kv/f0qjI8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB7023.eurprd04.prod.outlook.com (2603:10a6:800:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Fri, 23 Sep 2022 16:33:56 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::a67a:849c:aeff:cad1%7]) with mapi id 15.20.5632.021; Fri, 23 Sep 2022 16:33:56 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xiaoliang Yang , Rui Sousa , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Horatiu Vultur , Andrew Lunn , Vivien Didelot , Florian Fainelli , Michael Walle , Vinicius Costa Gomes , Maxim Kochetkov , Colin Foster , Richie Pearn , Kurt Kanzenbach , Vladimir Oltean , Jesse Brandeburg , Tony Nguyen , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Gerhard Engleder , linux-kernel@vger.kernel.org Subject: [PATCH v2 net-next 12/12] net: enetc: offload per-tc max SDU from tc-taprio Date: Fri, 23 Sep 2022 19:33:10 +0300 Message-Id: <20220923163310.3192733-13-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220923163310.3192733-1-vladimir.oltean@nxp.com> References: <20220923163310.3192733-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR10CA0029.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:17c::39) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR04MB5136:EE_|VI1PR04MB7023:EE_ X-MS-Office365-Filtering-Correlation-Id: aa189bbe-fbbe-47ec-d6f9-08da9d8168c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8Ll5WYzOjUwHgL70dJLRg7+jgYkAKNKPX1NRI2DvSFUh/fCbCr0ZpAafG6hyn4Mfm4HjJxENtvXEX8PfKjzHnOYofOGZyqQwy3Sg5kBnjb8cp0UMgPWUq61tjK/AXYEMcAIep6hKkqp18VxozvV8fuC6BcQDb6XEnzGwVvsVQ2E2mJfvouTROud5ufjdozlvlMSYCcUVq7sNUzJ3JHs5R7POpAx0MAshP4hCBvoLeflhowNs3KU347IEb/E73rTUHYIp65s1yaL2iUhbwnOYkccUHU+rCnHo2bYiRWnO5YIaJclXZ+wmHqU3oT8sSDCpbklByS8U1uP5kDYxPkhEEdPdJwwmIbt0HjZiXaaZKA/4zpN2o2xaZPiworOTHEXjivoRRm2Au3sM6fppeuu/sTYHw+Qg/eE/cTRyuslb4onNFMPHxhfS+0lEDtCRw8nBgcu14kgVNAsXNCM0pYSc3Q/IkMJq3nmsvu/MrS+qYWmLjCUkKnp3q35E94wej0S6bsCuZSKUseySsCx4B5xN9Ua9PrvD5mukBmEVqBGbATvHTwAOfN8mUHVlNuTNMZC9Vn0I+O9AfgDdv6DQAyt0dt3DdDAl+TDjEUqvepChee4xgrqXUWs+a3nU3vJS/gW2EyeUZUMQZVM5kT/bNCwWa7FrlhDhoW5stwAAhZBtuswMcFkpWiLPxN+udVtlKxxdam2dgDsVuqIih4FGP0EUarcBhPsVxuGvh4u4w3XCxyh/8LabxbltK4cZjpDYxDwVOtIUWzJ/fPJEXh8fXB2EmA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5136.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(366004)(346002)(39860400002)(136003)(376002)(396003)(451199015)(478600001)(6486002)(54906003)(4326008)(66556008)(66946007)(6512007)(6506007)(8936002)(66476007)(41300700001)(6666004)(26005)(7416002)(44832011)(8676002)(316002)(5660300002)(36756003)(6916009)(186003)(2906002)(2616005)(86362001)(52116002)(83380400001)(38350700002)(38100700002)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: biK1ccJf3aW+UHkhPMaVKCS0tloyblEYFiPOhYuF1lIEliIC3PUxrY4btMGhnyan17wUWT3GAcyXOeHfTy92/fITlNZbdenVuowXF269/yvQzN4Ldmp12Ighy4g+/P3rw9a6YJaw1ZeSKTTXbUcqJ0kwY2dGO+hqY6ersBN9MooKSuv7YQDgXAMA+TvTa5ViXPI4D+IvZCXZz6qLsGACbQWOX5+1gaQDkY0ACB0BLSmxICvIwSTEl+MAgrBTEgNpRzhHQAJODhhYEo60uno2PPD5tLm58h3qhfZjB6bxsXThrNL/oHf5hzjqPpedhYjztJSGTPvYgF2bNiA0P92tbtNjW7ZoXEbCsSn2EFBZSJf/tWzy3lGJnsh0BI1fEubEq9ijgsrC/2uDQSYKQhY/PXcUyJuoT0RTvD5sCMkyfir2hWXZYIpfgFHRVflx4tN8VEbJHkQQnn8COvtndCcJhasmZeKw7TI5wBNjUeUbV46QvCIvnj5qkl0Wz+d+Pdb+7wmjvR+CXdD1VXxcd+9RsNDLHyn49zI/A9UGbJO9uckc4KXLuY0Ket3ix1v+FDFpjifw2yXE3Wp1Aj+sbIREEHEM7t69pTxIoUjSCrpBG0g7W90XYvKXt/we8wWGG7H7Uo/AZReXCB/XAUFSQLu5Jx2Hi7ff8gNnTrR1qG/NEypDRXH4o1jm5stfWPUtJE6/3N7hLkZagcOZk5DIlhZE0IUsE3gnv0SEh/CxnL5Luk63swJf8EW8c/J0995nZd3v0jfpslQUGFeebmavZ4Ac8wV8EKpp32Z4xvPh8bnDmgQruTCtROEi+DvUUE9PzSKjejsYHk+MVfF+e62YiGCmDs8r3wc73F5bozJ7tjwYse+bhYvoBfGSQYdYojhVfyGAWJ+BAlohLmXTlDq/DPQF4Er6k2OITg8prZUNzyiYuTxo1ekK8btGE+t1xLqITytfP1lsqdYTyPtm61s9IzQHF/WdJl9qso6zJY0AP+wguTIl6Zt9RAbDd9pj70ZKETP7MYNA7yzDcol2nHsPkFzK+OUXPiWYQZzQAyhoLREuTJxuJdGzQztHpCy2pqOZGvkDsyyeVBizqcTGdmR5DxJI2j0uYCSmORfU8XmQiskXWMGf1eC5szT25ixQZzbGwbDWIiWqsuCK+TWXALWMyhox0lVDbwW1zZaJoCT8B2yMmvWzzkAYVieWbfTxrGw698WssMSIEypuP6utIFviBU2/p5xEgkGIKqQwRQ7vYYjpjEI9Kxf87AeWh85ABn4Ksx39bw47FOmzjXrC3q252ClmrXcO/k0UJdjPitO1CJXD7b3svgMVJ5pVVlbKrMb2X/jtcuMzlPDj7HttQgOS3c9RoOGYFPvVgAVIyetHvewDj1RessZEDH5Pd2h+nJCRR2RdlypGm5YxdJ0xkj7b4DDBaQgof88BQDYLGg6OKD+Rd900U/wj2Z+Wr971FbrqOsXaDpx1GkGMqU2aZj3sQ2fCwIbOPadY9RtnGnVjVjPsoDnfAStoev8/LEu1dLeJbs35FXpIHgi20C+1G6Qqg+uKQhuvYTqbtr+DZo6nZblh58eJRD/DTAW7WPgYbZeOml8Yne63iaz0araaoWai5I6SXA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa189bbe-fbbe-47ec-d6f9-08da9d8168c5 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Sep 2022 16:33:56.2359 (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: ZplryeaEA6jeQhh7LJNuuse8KPOVu8h5EzUJpDrGPPDWmirS/QckNPY8McYoL/YkDn91JVcpcp5B6exwAIf7Lw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7023 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The driver currently sets the PTCMSDUR register statically to the max MTU supported by the interface. Keep this logic if tc-taprio is absent or if the max_sdu for a traffic class is 0, and follow the requested max SDU size otherwise. Signed-off-by: Vladimir Oltean --- v1->v2: none drivers/net/ethernet/freescale/enetc/enetc.h | 3 +++ .../net/ethernet/freescale/enetc/enetc_pf.c | 25 ++++++++++++++++--- .../net/ethernet/freescale/enetc/enetc_qos.c | 10 +++++--- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h index 748677b2ce1f..d7edc04f4bfc 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc.h +++ b/drivers/net/ethernet/freescale/enetc/enetc.h @@ -453,6 +453,9 @@ static inline void enetc_cbd_free_data_mem(struct enetc_si *si, int size, data, *dma); } +void enetc_reset_ptcmsdur(struct enetc_hw *hw); +void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *queue_max_sdu); + #ifdef CONFIG_FSL_ENETC_QOS int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data); void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c index bb7750222691..de39d9ba7534 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c @@ -516,15 +516,34 @@ static void enetc_port_si_configure(struct enetc_si *si) enetc_port_wr(hw, ENETC_PSIVLANFMR, ENETC_PSIVLANFMR_VS); } -static void enetc_configure_port_mac(struct enetc_hw *hw) +void enetc_set_ptcmsdur(struct enetc_hw *hw, u32 *max_sdu) { int tc; - enetc_port_wr(hw, ENETC_PM0_MAXFRM, - ENETC_SET_MAXFRM(ENETC_RX_MAXFRM_SIZE)); + for (tc = 0; tc < 8; tc++) { + u32 val = ENETC_MAC_MAXFRM_SIZE; + + if (max_sdu[tc]) + val = max_sdu[tc] + VLAN_ETH_HLEN; + + enetc_port_wr(hw, ENETC_PTCMSDUR(tc), val); + } +} + +void enetc_reset_ptcmsdur(struct enetc_hw *hw) +{ + int tc; for (tc = 0; tc < 8; tc++) enetc_port_wr(hw, ENETC_PTCMSDUR(tc), ENETC_MAC_MAXFRM_SIZE); +} + +static void enetc_configure_port_mac(struct enetc_hw *hw) +{ + enetc_port_wr(hw, ENETC_PM0_MAXFRM, + ENETC_SET_MAXFRM(ENETC_RX_MAXFRM_SIZE)); + + enetc_reset_ptcmsdur(hw); enetc_port_wr(hw, ENETC_PM0_CMD_CFG, ENETC_PM0_CMD_PHY_TX_EN | ENETC_PM0_CMD_TXP | ENETC_PM0_PROMISC); diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c index ee28cb62afe8..f89623792916 100644 --- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c +++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c @@ -67,6 +67,7 @@ static int enetc_setup_taprio(struct net_device *ndev, tge = enetc_rd(hw, ENETC_PTGCR); if (!admin_conf->enable) { enetc_wr(hw, ENETC_PTGCR, tge & ~ENETC_PTGCR_TGE); + enetc_reset_ptcmsdur(hw); priv->active_offloads &= ~ENETC_F_QBV; @@ -122,10 +123,13 @@ static int enetc_setup_taprio(struct net_device *ndev, enetc_cbd_free_data_mem(priv->si, data_size, tmp, &dma); - if (!err) - priv->active_offloads |= ENETC_F_QBV; + if (err) + return err; - return err; + enetc_set_ptcmsdur(hw, admin_conf->max_sdu); + priv->active_offloads |= ENETC_F_QBV; + + return 0; } int enetc_setup_tc_taprio(struct net_device *ndev, void *type_data)