From mboxrd@z Thu Jan 1 00:00:00 1970 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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9A36AEB64D8 for ; Thu, 15 Jun 2023 00:06:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 1D8FF83C42; Thu, 15 Jun 2023 00:06:32 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 1D8FF83C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1686787592; bh=jcEEa2hLpeyHDPzaxRdszf/5GOxB0W+6CR6Ee/iMS9I=; h=From:To:In-Reply-To:References:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Cc:From; b=tUzxVg/xRq5gDs5FoBaHghQgiSaNLkiX89lLCDxGKM21yvaaJo3RV/nvjGut0ZwT1 If9ZphX71RgD5F0IUcAEkdVSEYePt302jH9fFRvDCjAnhIyTWPd6LzuUelQRPy6A3g Zyyf00cz37cn2bKxGqjQo9cGicSJbCVEZAHw4dWzDP5VA5aSxkgfFK3CDkOSmbFowF 8JnLmqkxoz+tuurTmaLWwCnOIdhRtWBMRGOEW7YRyfGBf9b+SQDFISyt7zg4LPSDX0 sjv1Tp1IhN3tQez/SMH/W2b3ctz/bduKMBe663B0jN0vKGL6xCCcCH6xnccoMiVhHE F+SUW1xLceqsw== X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qFW8WPGB2z-w; Thu, 15 Jun 2023 00:06:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id 06DEC83C48; Thu, 15 Jun 2023 00:06:31 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 06DEC83C48 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 8E87E1BF836 for ; Thu, 15 Jun 2023 00:06:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6413D41E7A for ; Thu, 15 Jun 2023 00:06:29 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 6413D41E7A X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IuxTNNaFJiIs for ; Thu, 15 Jun 2023 00:06:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1A22041E76 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1A22041E76 for ; Thu, 15 Jun 2023 00:06:27 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="424658780" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="424658780" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 17:06:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="856706141" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="856706141" Received: from gjgambo-mobl2.amr.corp.intel.com (HELO vcostago-mobl3) ([10.212.235.28]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 17:06:24 -0700 From: Vinicius Costa Gomes To: Vladimir Oltean , netdev@vger.kernel.org In-Reply-To: <20230613215440.2465708-8-vladimir.oltean@nxp.com> References: <20230613215440.2465708-1-vladimir.oltean@nxp.com> <20230613215440.2465708-8-vladimir.oltean@nxp.com> Date: Wed, 14 Jun 2023 17:06:24 -0700 Message-ID: <877cs5twqn.fsf@intel.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686787588; x=1718323588; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=djJPb93h9IgIoHTp34Q6aT2YGUU7mv3dQuXgsAsIWCM=; b=TqSRuzsT4GNXfH04KPx1sb7FYTjAoqt9P1lW6X32PJ03p8CjiBaxYLBa mLgiZSriFg+/F4O3v2U8abllNuZDq/qyza1u55n2/srQGKEvL2SkdWvXj wMmjdXxWFPvtqpZmUVd83zZM+WPD8DfPBS9AqXmgmqwlAgw7V2+vyLpoj +vToIBzGC6AWq8yUQljwCufBktQr6jG/6gJj85OmnMB4NOHp05cr+sQmE 79gZOkNf4XE9977e2J3YszFR8GwOcgAr2e/H7FIiXmmkVd7uIL3Pzdsww iLXIKzB84OD3ZAg9DANms1gOZmzvc3KHzAC0y/f2tXyuhqFtTXshTgGNM A==; X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=TqSRuzsT Subject: Re: [Intel-wired-lan] [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jiri Pirko , Pedro Tammela , Richard Cochran , Jamal Hadi Salim , linux-kernel@vger.kernel.org, Eric Dumazet , intel-wired-lan@lists.osuosl.org, Maxim Georgiev , Cong Wang , Peilin Ye , Jakub Kicinski , Zhengchao Shao , Paolo Abeni , "David S. Miller" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-wired-lan-bounces@osuosl.org Sender: "Intel-wired-lan" Vladimir Oltean writes: > 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; I was thinking about how useful would proper validation of the parameters be? Thinking that we could detect "driver API" breakages earlier, and we want it documented that the drivers should check for the things that it supports. Makes sense? > + 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 > Cheers, -- Vinicius _______________________________________________ Intel-wired-lan mailing list Intel-wired-lan@osuosl.org https://lists.osuosl.org/mailman/listinfo/intel-wired-lan From mboxrd@z Thu Jan 1 00:00:00 1970 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 B206FEB64D8 for ; Thu, 15 Jun 2023 00:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235056AbjFOAGd (ORCPT ); Wed, 14 Jun 2023 20:06:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230017AbjFOAGa (ORCPT ); Wed, 14 Jun 2023 20:06:30 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C78291FFA; Wed, 14 Jun 2023 17:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686787587; x=1718323587; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=djJPb93h9IgIoHTp34Q6aT2YGUU7mv3dQuXgsAsIWCM=; b=d4HQnM45qTuJn8XGhOgT6ZfVUc8sRwE3YUwbkYNsjvD1+5m45t6KHSEW my+vxUPtceKAh6gyH7cnY7m06krixYtSOLxLzWwjZgKwk3b7ocPuYSylR 8h2G85o9DsjvOu88nk45AmdfkwhYBnsXU79R87WsOzW9s9jEN0pVs0ILm bBEFkZUjVRo4M4Trheo5KXNsDY8Ru4x6ppY8ObmIMMczk9MZ6T5H1DpFw CgOO3Bc/D2czS/Pc7FbQJRSme/Z5lFWz8bZd506aFRrLZu36dF3qva/It QwjvpDblt8PpywgMzL+avHHNENX8MfIbLrbfZpOZFeNYYTclj9uQZzWuM g==; X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="424658773" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="424658773" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 17:06:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10741"; a="856706141" X-IronPort-AV: E=Sophos;i="6.00,243,1681196400"; d="scan'208";a="856706141" Received: from gjgambo-mobl2.amr.corp.intel.com (HELO vcostago-mobl3) ([10.212.235.28]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jun 2023 17:06:24 -0700 From: Vinicius Costa Gomes To: Vladimir Oltean , netdev@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , 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: Re: [PATCH v2 net-next 7/9] net: netdevsim: mimic tc-taprio offload In-Reply-To: <20230613215440.2465708-8-vladimir.oltean@nxp.com> References: <20230613215440.2465708-1-vladimir.oltean@nxp.com> <20230613215440.2465708-8-vladimir.oltean@nxp.com> Date: Wed, 14 Jun 2023 17:06:24 -0700 Message-ID: <877cs5twqn.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Vladimir Oltean writes: > 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; I was thinking about how useful would proper validation of the parameters be? Thinking that we could detect "driver API" breakages earlier, and we want it documented that the drivers should check for the things that it supports. Makes sense? > + 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 > Cheers, -- Vinicius