Received: by 2002:a05:7412:9c07:b0:fa:6e18:a558 with SMTP id lr7csp79110rdb; Fri, 26 Jan 2024 20:12:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE+OAFYcZYB+rA9VLbqcizW+flftDa5ZEhMoNdSr47s4FvR9cCxApeuFZZEQokKkAMeLISO X-Received: by 2002:a17:902:7d93:b0:1d8:a6c3:aa6c with SMTP id a19-20020a1709027d9300b001d8a6c3aa6cmr933525plm.111.1706328772263; Fri, 26 Jan 2024 20:12:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706328772; cv=pass; d=google.com; s=arc-20160816; b=JybKSv3HHrsm304pUDTP0UMKt0gTCYiTz3fmVXbkimLqN6hS8tJqMQRZq7YyNW/Z0Q NREoGnNg32Dn7MbjLRVFxWfWWS6cnhmaU4pygK0vwDwtFT9aGwPEKgsXpBMuY+R8SH5E iCTTRaRl91RUPThuTg82qjh+E5wjy2k6BnisRdf1C0X5nXByav8VZ39DKEqzmvp69AQb h5Od73adJXuh3Lxt3Rwk0XUrvmHJJLU+MsoZxyyiYw4zBB/AtOC4n2GIFff2SGNjvQQV 9bklwNaedd8PVk51eObbtF6EH9daOTv+C1t5+X8uTcxIh6mBHu5oqP+NfWODXAyCaQ2+ 4WFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EDs6Q+tjD8Vg/l3vkiC4nkIcJPAGVUnfr5JmUA4+NdM=; fh=p36MzhksjyrQP8UVrj/w1y/OYb1NKbvLN3LzitIfoNM=; b=Ks4qfG2JdrXQT3FzDmdc5P8CnD0iH1Of0Bp5584VAp58csoCx4ta2Fqp9hsMD003dG deAxfrn5rIr/pCbiVg+hWZR7elE3zz5AaKzBTkFEQe1p3/QLWJ60qBxeXLtyOV2ucGXi oPDHOCXGKwdNKuRADaTu/CG9i9ia3yUot3jPxtbchf15GVKrEshbvX8BuqLYZwjIsUIM l28RT+pj3chTyCiNtP+EOYidI1nk85h4Drbc5ByH9qxa0z7rteNcOcohnvS1LkcJ+k9N DmQZ/kkDXeqTA5iReBAl3zjj8qxdUVbWMb1f65GZCDA+UsDzXoc+YvVLB8OrBQWd5vz7 CImA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UweUYZW4; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-41056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q8-20020a17090a9f4800b002943cd1b20asi1816333pjv.93.2024.01.26.20.12.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 20:12:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UweUYZW4; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-41056-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41056-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B5E0428CB23 for ; Sat, 27 Jan 2024 04:06:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B9361DA29; Sat, 27 Jan 2024 04:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UweUYZW4" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 954DD1D694; Sat, 27 Jan 2024 04:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328315; cv=none; b=PL765w5WOaB2i2uuX7Vtn6nK7yEFvR8/AnRJ6ZQ1fFafwW87XVqAjWrsozbqRL425LvlkGdANYQ/z6S+dBhIEr4KHiNEAGDU6nEw3Fzw6zPbEJHcIrkyUgURKpk8lvvwWGNqcFe26Pf/OAUv11H0EeKgZooXzzjTe6vAQwPmVOU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706328315; c=relaxed/simple; bh=arnNZFPeOWnn8Q5oQ59hKd7A7dEFpKto5u5vQcBQRZw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hk5SZv0Ymm3uQAdh/t3pi54ED2oIdNeVWXkmhxXPW3XUzV2jZWq7/v5EfWSlOINUjounN10QZ0LsqqFF3WBgqVqCKjg8Q9O30avTSBQ5m5oGSSCZATnPQXYSvlDbeZG0w7OmWsynJ/KoAuBcUCEq4XqrWY8G5bEG/kNJmuQW6jk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UweUYZW4; arc=none smtp.client-ip=192.55.52.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706328313; x=1737864313; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=arnNZFPeOWnn8Q5oQ59hKd7A7dEFpKto5u5vQcBQRZw=; b=UweUYZW4a8vix7R4ZpV8BwbBeByhmxWa6KOFQbUAlluEy+7WbFCx9zwO Fg4n6ggUR7d+wCxCJ39bBXiHRAhNb7ShnkLLNz1fFo08eveZ39n5NXYmd oWKCFvD72eYTMp13u+n9ATdEn78D5I5ntzbOMimNqHrQZvaEx7X2RxqY9 0mOu5VdkXEtd20UagexzeWafbst0aPRFJfwtFDJcu5z/9NZ8RK7yOJAK0 U9XJTupWcoq60+/xkAj90pXbMdqdQiB0Ca9drzwoAZ0JsszBx634Uq2Kk icWSPRz1V6h6P5NRx7QMRvlcEjmwEsScX15j6pIPSUMmqIYAysjE4iOa4 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="402289698" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="402289698" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 20:05:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="787309871" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="787309871" Received: from ppglcf2090.png.intel.com ([10.126.160.96]) by orsmga002.jf.intel.com with ESMTP; 26 Jan 2024 20:05:07 -0800 From: Rohan G Thomas To: "David S . Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Giuseppe Cavallaro , Richard Cochran , Russell King , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Serge Semin Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Rohan G Thomas Subject: [PATCH net-next 3/3] net: stmmac: Report taprio offload status Date: Sat, 27 Jan 2024 12:04:43 +0800 Message-Id: <20240127040443.24835-4-rohan.g.thomas@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20240127040443.24835-1-rohan.g.thomas@intel.com> References: <20240127040443.24835-1-rohan.g.thomas@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Report taprio offload status. This includes per txq and global counters of window_drops and tx_overruns. Window_drops count include count of frames dropped because of queueMaxSDU setting and HLBF error. Transmission overrun counter inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.DWMAC IPs takes care Transmission overrun won't happen hence this is always 0. Signed-off-by: Rohan G Thomas --- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 62 +++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c index 07aa3a3089dc..cce00719937d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c @@ -937,8 +937,8 @@ static void tc_taprio_map_maxsdu_txq(struct stmmac_priv *priv, } } -static int tc_setup_taprio(struct stmmac_priv *priv, - struct tc_taprio_qopt_offload *qopt) +static int tc_taprio_configure(struct stmmac_priv *priv, + struct tc_taprio_qopt_offload *qopt) { u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep; struct plat_stmmacenet_data *plat = priv->plat; @@ -990,8 +990,6 @@ static int tc_setup_taprio(struct stmmac_priv *priv, if (qopt->cmd == TAPRIO_CMD_DESTROY) goto disable; - else if (qopt->cmd != TAPRIO_CMD_REPLACE) - return -EOPNOTSUPP; if (qopt->num_entries >= dep) return -EINVAL; @@ -1102,6 +1100,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv, priv->plat->est->enable = false; stmmac_est_configure(priv, priv, priv->plat->est, priv->plat->clk_ptp_rate); + /* Reset taprio status */ + for (i = 0; i < priv->plat->tx_queues_to_use; i++) { + priv->xstats.max_sdu_txq_drop[i] = 0; + priv->xstats.mtl_est_txq_hlbf[i] = 0; + } mutex_unlock(&priv->plat->est->lock); } @@ -1119,6 +1122,57 @@ static int tc_setup_taprio(struct stmmac_priv *priv, return ret; } +static void tc_taprio_stats(struct stmmac_priv *priv, + struct tc_taprio_qopt_offload *qopt) +{ + u64 window_drops = 0; + int i = 0; + + for (i = 0; i < priv->plat->tx_queues_to_use; i++) + window_drops += priv->xstats.max_sdu_txq_drop[i] + + priv->xstats.mtl_est_txq_hlbf[i]; + qopt->stats.window_drops = window_drops; + + /* Transmission overrun doesn't happen for stmmac, hence always 0 */ + qopt->stats.tx_overruns = 0; +} + +static void tc_taprio_queue_stats(struct stmmac_priv *priv, + struct tc_taprio_qopt_offload *qopt) +{ + struct tc_taprio_qopt_queue_stats *q_stats = &qopt->queue_stats; + int queue = qopt->queue_stats.queue; + + q_stats->stats.window_drops = priv->xstats.max_sdu_txq_drop[queue] + + priv->xstats.mtl_est_txq_hlbf[queue]; + + /* Transmission overrun doesn't happen for stmmac, hence always 0 */ + q_stats->stats.tx_overruns = 0; +} + +static int tc_setup_taprio(struct stmmac_priv *priv, + struct tc_taprio_qopt_offload *qopt) +{ + int err = 0; + + switch (qopt->cmd) { + case TAPRIO_CMD_REPLACE: + case TAPRIO_CMD_DESTROY: + err = tc_taprio_configure(priv, qopt); + break; + case TAPRIO_CMD_STATS: + tc_taprio_stats(priv, qopt); + break; + case TAPRIO_CMD_QUEUE_STATS: + tc_taprio_queue_stats(priv, qopt); + break; + default: + err = -EOPNOTSUPP; + } + + return err; +} + static int tc_setup_etf(struct stmmac_priv *priv, struct tc_etf_qopt_offload *qopt) { -- 2.26.2