Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1832747rwd; Tue, 13 Jun 2023 15:09:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5oyYpLv8vymkm5PRvAqeQZ18Dl+lMM/XMTvYEeLBij9nG8341lqa1r4wa3ybF5A2iKNsEO X-Received: by 2002:a05:6a00:14d3:b0:65e:842:7922 with SMTP id w19-20020a056a0014d300b0065e08427922mr199120pfu.16.1686694162139; Tue, 13 Jun 2023 15:09:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686694162; cv=pass; d=google.com; s=arc-20160816; b=fyPsQnTa+OK343zc1r98Y2hKRu7+qSkb/rJEN+tLR5tFIdP3inY5mRtu8/NXAhtWQU WayZfOoJtsFcnndYDUC/NYngZPLiX6fBpqa4PwXe+/ScNZw7Q+l1aT7arVYwEoEWynuY Sb+ZDUAEBw9BIS/edcF/44s5Jd/yQURlJtY3DmIm+yniAWuTFyFRiZHV69BnQqcBUMlU B/iMlloOzcmZ7OJZFCied+wn5BDbtc5KRtiEoDYz+jzVFtfSvUEKGprn2ZDIm5HiHr3W UWGx6vCvxtGj0lKxt2qgVCo7QX9TiNsLgftN4gPYpoIzNE/ElMWPgskigpFFPyvU+Cs9 pi0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wCftp1cdS1FFtKzgmkD68NiDDebqyLyRkx7wErceK48=; b=iErJ+01+3uXovQ0cJhW2Vi5DwBlR/AqbIsholulGGeDbti+vdmXsjIxIHOmNk/kTr+ oPu8zs4b7I/a8ms0+fxp3K5IWm5c7rXyYIpeCduE9XnpYe21Jrnegnwnyxon8xSVxuFd 0AvDakzAC12bX8nr9QAalZVqBgvq3oiUrP9ENbS3RlKIa1NHDUPA7yAD4tfyc5A/tqLd rzVYrMuo1iq01HBtpKZGr5CPT/kfAgvV1ezitfRUBYWS/35SsITXupHWyikrY9gW6t3j zSXI/m2yPwcYNr+fRSGQwVgZlIkKwVM4J9SyN76eDsTsa/RqQKHV+qU+mRSgD6UkgqHg 7q/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lesRV7wb; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a633c52000000b0053f4a727dacsi9829230pgn.251.2023.06.13.15.09.07; Tue, 13 Jun 2023 15:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=lesRV7wb; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231995AbjFMV5V (ORCPT + 99 others); Tue, 13 Jun 2023 17:57:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240627AbjFMV4k (ORCPT ); Tue, 13 Jun 2023 17:56:40 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D3521FF9; Tue, 13 Jun 2023 14:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z4Mw3ua9Kql10f9HCc4eZyzDEUh5DCg30pnHIt93z6VUX8i9DuavNe3rAS4GvNlSvcSH6K6+PtAXkbCZbjQqFTSWsW8ydlP4+9caGUmZkk+zekiHWY7DNYZswyoTAEGJ+pWEJ2OyJIi5QJH3/Nbe+aW3wXXCpnBLMBVggNECrvVUAqdPRmOrUTFbFpE9/RV3xgOpfQia4gGAIMLWinrnH+rWt8f+HaCZpt/xNKVtx3oe8PfGr4EfB8CNxKwiOeajzJVb5LkjEyZLoEos0ag6bHCrH995b6GCbPEqWZ1w3ogsJJCjNxw2+Wcis4420gRjwDYT2N9OYJbO7T/JS9SB+Q== 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=wCftp1cdS1FFtKzgmkD68NiDDebqyLyRkx7wErceK48=; b=Q2zlVP6IUTEQ9StoB9yUtQ7os/vT2vSc2bvT5OqgxDtkB71Csgew76NuJu0yRNX4tSRh0ltUP+6zFNCRrMcDKyJ5k1BfZvMly9g/gxfKdk1Zg/QRhnuLq5mzbAU5MmXlfzWvs1gBoYYTU15IBOH0akEO/im9ZCVRvR99R3OcUD1tJ/kzm79CN5HLpyjwvPIweeIsCicweiVBwm29PX/teDgWRzHdaPk3hMt2TRcpjSo1R0xg94LWUAf2Mk1rJ9EX3Q9U8zl1xrk0RpsS23mair25KrGBZQwMKn/1oTfG7SUdmA83s+LUTovoWfsiQwliOhpOwX0prPQhP3SpytlOUw== 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=wCftp1cdS1FFtKzgmkD68NiDDebqyLyRkx7wErceK48=; b=lesRV7wbEKGpo0hiIRyjtI/jRR7PNNVMWy/VZVcvLVmK2n/WVET94HTpPCh8uTMPz+LWH99bBXV3XD9zUaAMXJtDzUlKea7NhON8Sd222NTjFEJLS/SEQPo17eHfHOcO0YUp7Bpq3LoKPYdk0Sdt+AyvnFynW0yqw6s4OzSAOVs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by AM9PR04MB8081.eurprd04.prod.outlook.com (2603:10a6:20b:3e2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.29; Tue, 13 Jun 2023 21:55:00 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::c40e:d76:fd88:f460%4]) with mapi id 15.20.6455.045; Tue, 13 Jun 2023 21:55:00 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , Vinicius Costa Gomes , linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, Muhammad Husaini Zulkifli , Peilin Ye , Pedro Tammela , Richard Cochran , Zhengchao Shao , Maxim Georgiev Subject: [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload Date: Wed, 14 Jun 2023 00:54:38 +0300 Message-Id: <20230613215440.2465708-8-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230613215440.2465708-1-vladimir.oltean@nxp.com> References: <20230613215440.2465708-1-vladimir.oltean@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: AM0PR04CA0044.eurprd04.prod.outlook.com (2603:10a6:208:1::21) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|AM9PR04MB8081:EE_ X-MS-Office365-Filtering-Correlation-Id: 5ca2572b-edd8-4eb0-e6bb-08db6c58d5a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZtxjQeBDtCe21aO0ERRk53BC1I7ChQEO7R87vzxpyjzkgut3opimk//XO0iDO4WQePgn4hUWtPGrmtlf0Eu3CcJafqkS83QFPWv5UOahGmbUWBQ3Z/c1cxfBQpPP1a3NL/+o7WV5PGeoCbgmzTO+hP/22Gu8LwA2V8Lni9AOrcuAzhz5yys0Spt2HFZf52nRgVQlAi4Rlg7Y8pfFUcZVvsPdie5musXypkmZ6fTai69rBoKbYdrs7d+oY33qykI4PIY6AGheWXTcamL4NOqbyds/vyQIJVR9zxwLZ9AQS8V1dg/WycteexzwdIERz1plqqe7YWFUVLNU4KmZ4uZLSZ8q9cYXm+XcTuVAqe1oVC2RulVkkBRhDwA2QzmSiJv9KH8YXSzyXtvfthGHi4rUtvmg4NG5Yy9UOCFWrKaIh3tpdjkDxIQA6KboLBgzIrR+hlKOJL0L/AkFkzuEvzHp6KqsukPbs4eWfHIrXwsBeB3Xgm601DqVRoimY/EU5ceSq42T9+O+SBmXnuhkD3juMp5WmqjAlYOkBSd+py2mCKcOwhBDN0CLsql0Z9O7SPjj8AK0LQUD0HZsVxyS1QrqZ4CEjRqCFNtGlmbX9ua+wzP3kkfdSc9Xs2Ehgl2De7U8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(39860400002)(366004)(346002)(376002)(451199021)(6916009)(66946007)(4326008)(66556008)(36756003)(186003)(54906003)(478600001)(2616005)(2906002)(66476007)(8676002)(6666004)(316002)(41300700001)(86362001)(6486002)(7416002)(6506007)(1076003)(8936002)(44832011)(83380400001)(26005)(5660300002)(38100700002)(52116002)(38350700002)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?BztnzQfEcaeF1dVlBqysFnL61s9W9G5U48ynJ9PbMtri5q65ZF8O0m+ugjPr?= =?us-ascii?Q?PIbnNOpQ2BoVx7/bOsWmNau97/ow7/QEPR7LZfdEjBGcmXkkjfo8D/X4ieET?= =?us-ascii?Q?h4qDDwx2QI7ZGM6zI1NG1B7oT7yAGyAtGa5R/pFUIjvw4VA7ipYwiNioH6Tv?= =?us-ascii?Q?c7/CaNb2OuWzo3T0BlcY+YOz/bIucgUZQkr0sY+eBv90w0uHIb5OQG05g+my?= =?us-ascii?Q?QjkLDF4bz0h4KNL0Qew0BDoTpADt3MvcpH2RlExpTe0vM6m23BLg907U/DCl?= =?us-ascii?Q?Cn65zK7xyEYQ4ZOuiKd1/+uNsrT51DEjAdeH2kXTE4Lv1NK47JhdTumbxQW4?= =?us-ascii?Q?x6eskU1RcvTkxm7yis02ep+5I8Vrwh+cPjCX2sEVAUqQt6qXPFeH6+97IMAL?= =?us-ascii?Q?u/S3jHTRcNFEZdSq0AX7b5+C7xOup86VnL8XPBRM7Q3MF+B/tKM0tAmvQbSd?= =?us-ascii?Q?PSP35Q3y73gaoK/HJvLk4RKWGKNH23YB9sVPlcSyMZrVMblnd9pj1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CjdyjdB649DR6RbkLRDzI5sNeuAMdrIW6MvJu/GMQ?= =?us-ascii?Q?gIyVSEGeTKgP3kpbo4/zp17itB0sB2cjZLmySAeb+fGhzoWUTxQdoMAd7m6/?= =?us-ascii?Q?lf84Gz+1ma0mf7R4xKAMyF8D3gIHScbwBSljf8nr/TW0hhRPDlXbBrVK8Kp2?= =?us-ascii?Q?mZAaoYLdnD8CoSEE+4L4u38GD/VZK1Rf025PvujV6uTx4U+nofPb9sI41tHS?= =?us-ascii?Q?sw=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5ca2572b-edd8-4eb0-e6bb-08db6c58d5a4 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2023 21:55:00.1857 (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: LPOym2CZD1pFRStEDOT8rs4duLh/7CtBGtB1nmgYsgtc/5UcDPQ0nOMV3MgFveNGvL20GYzxoON/eewsOoQmdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8081 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To be able to use netdevsim for tc-testing with an offloaded tc-taprio schedule, it needs to report a PTP clock (which it now does), and to accept ndo_setup_tc(TC_SETUP_QDISC_TAPRIO) calls. Since netdevsim has no packet I/O, this doesn't do anything intelligent, it only allows taprio offload code paths to go through some level of automated testing. Signed-off-by: Vladimir Oltean --- v1->v2: patch is new drivers/net/netdevsim/netdev.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index 58cd51de5b79..e26be4bd0d90 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -209,6 +209,31 @@ static int nsim_set_vf_link_state(struct net_device *dev, int vf, int state) return 0; } +static void nsim_taprio_stats(struct tc_taprio_qopt_stats *stats) +{ + stats->window_drops = 0; + stats->tx_overruns = 0; +} + +static int nsim_setup_tc_taprio(struct net_device *dev, + struct tc_taprio_qopt_offload *offload) +{ + int err = 0; + + switch (offload->cmd) { + case TAPRIO_CMD_REPLACE: + case TAPRIO_CMD_DESTROY: + break; + case TAPRIO_CMD_STATS: + nsim_taprio_stats(&offload->stats); + break; + default: + err = -EOPNOTSUPP; + } + + return err; +} + static LIST_HEAD(nsim_block_cb_list); static int @@ -217,6 +242,8 @@ nsim_setup_tc(struct net_device *dev, enum tc_setup_type type, void *type_data) struct netdevsim *ns = netdev_priv(dev); switch (type) { + case TC_SETUP_QDISC_TAPRIO: + return nsim_setup_tc_taprio(dev, type_data); case TC_SETUP_BLOCK: return flow_block_cb_setup_simple(type_data, &nsim_block_cb_list, -- 2.34.1