Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp114925rdg; Wed, 11 Oct 2023 23:47:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyuXmMCL2lAePH6MkdAjyYz7kktRC0B7wpIzInSceJA/h5XToDdTMssMKob3xtFD8ZUb4n X-Received: by 2002:a05:6a20:320b:b0:172:4455:e11b with SMTP id hl11-20020a056a20320b00b001724455e11bmr5828274pzc.61.1697093236858; Wed, 11 Oct 2023 23:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697093236; cv=none; d=google.com; s=arc-20160816; b=nnOxWDBixACHp9hZQ5bltfQb4l2YucTX+ShNywvj1DnP764K6/tLPOwUsI7G24McAs NvYSPHCEF9JRYLYTX7GYjX068dBXKbG1I9B8jOppeK4QsJ81brdlW22cM63ngzTBADez 5ggOxPLFAJW3Kfr5S503YIMBdHeAhZ4cMRXglcOYAXsJzpT7EpYAPJkyS4PTj+x/1/QO bwl/12bE06Z4tCXTF6Ea2H9m1RuNfNUZgA4W9xKP5gNYxmXGjq7qktxSKxQ1ebOQ9/d1 4CiBZMAnAG4rD7NvuER3DUdeMmnrGWzPjLsHTFQdqeGrtYYVzUvD69wWDeTXZmryv6dc vs3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Is7w++Rkxx1cII9J8DEgQ1/plc9LVUG7tLKet8JyB0A=; fh=HgAFuWZhAzZBevQFOeSPTB/pUVpsLSVnray08/ALtf4=; b=VXRHW9IikEAua0q6ErnZJ9pB4uq9IrUa+b2o8WgX7KNq9DmGuP0RpI1bn2pA9rWS1+ SDamGeCHqI8Lyc14LaXjCrbV5IPAy/k5NXZaSdWA7kJlbyU2a0oZO+1hWDsJ5pRX7pIM lhNVdz3+UmY01JFcz9RkUFIvGmGf5ips3SRLi1CzIh0KLPCihB285uYcZ/NvnD7GtOfL yEkEpv1IQINeLhmfJ7SL5//3TZMSy9CnwizA6VxKEULZLyR5QPB53X4rLvFms74un6mN h2YwVDaTUumPsyFBwUmMCRkDgXU1UFoklbhbXXbykOp4Pit47MIY6kLkDhBjdv5OhPI2 hr2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KgwEtSUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id a20-20020a170902ee9400b001c3f96ec6d6si1454874pld.111.2023.10.11.23.47.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 23:47:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=KgwEtSUt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 799FA81FDBB7; Wed, 11 Oct 2023 23:47:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377489AbjJLGqz (ORCPT + 99 others); Thu, 12 Oct 2023 02:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235329AbjJLGqv (ORCPT ); Thu, 12 Oct 2023 02:46:51 -0400 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FE2FE3; Wed, 11 Oct 2023 23:46:48 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 39C6kahW083440; Thu, 12 Oct 2023 01:46:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1697093196; bh=Is7w++Rkxx1cII9J8DEgQ1/plc9LVUG7tLKet8JyB0A=; h=From:To:CC:Subject:Date; b=KgwEtSUtaGRUec0Sv7435q25RFuygqV7AyHVOpu5DJ75IhYztt3BP6nYh6tsDBVjD 6B3HBeTX95AkVFmI4pEUS2pMtnpQhrgAJoPyyrDohWrZlRKxjLRD43BXRc/Z9XCwli SEdBrEvIcbQws2UVVxuaLnwTtAsTywMpy/4lxxQg= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 39C6kaTL007495 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 12 Oct 2023 01:46:36 -0500 Received: from DFLE112.ent.ti.com (10.64.6.33) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 12 Oct 2023 01:46:36 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE112.ent.ti.com (10.64.6.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 12 Oct 2023 01:46:36 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 39C6kaZx102705; Thu, 12 Oct 2023 01:46:36 -0500 Received: from localhost (dhcp-10-24-69-31.dhcp.ti.com [10.24.69.31]) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 39C6kZcs015018; Thu, 12 Oct 2023 01:46:35 -0500 From: MD Danish Anwar To: MD Danish Anwar , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" CC: , , , Vignesh Raghavendra , , Roger Quadros , Andrew Lunn Subject: [PATCH v2] net: ti: icssg-prueth: Fix tx_total_bytes count Date: Thu, 12 Oct 2023 12:16:26 +0530 Message-ID: <20231012064626.977466-1-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 23:47:14 -0700 (PDT) ICSSG HW stats on TX side considers 8 preamble bytes as data bytes. Due to this the tx_bytes of ICSSG interface doesn't match the rx_bytes of the link partner. There is no public errata available yet. As a workaround to fix this, decrease tx_bytes by 8 bytes for every tx frame. Fixes: c1e10d5dc7a1 ("net: ti: icssg-prueth: Add ICSSG Stats") Signed-off-by: MD Danish Anwar --- Cc: Andrew Lunn Cc: Ravi Gunasekaran Changes from v1 to v2: *) Rebased on the latest net/main. *) Changed stats name comparison to stats offset comparison as asked by Andrew. *) Modified commit message as asked by Ravi. v1: https://lore.kernel.org/all/20231011063700.1824093-1-danishanwar@ti.com/ drivers/net/ethernet/ti/icssg/icssg_stats.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/ti/icssg/icssg_stats.c b/drivers/net/ethernet/ti/icssg/icssg_stats.c index bb0b33927e3b..3dbadddd7e35 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_stats.c +++ b/drivers/net/ethernet/ti/icssg/icssg_stats.c @@ -9,6 +9,9 @@ #include "icssg_stats.h" #include +#define ICSSG_TX_PACKET_OFFSET 0xA0 +#define ICSSG_TX_BYTE_OFFSET 0xEC + static u32 stats_base[] = { 0x54c, /* Slice 0 stats start */ 0xb18, /* Slice 1 stats start */ }; @@ -18,6 +21,7 @@ void emac_update_hardware_stats(struct prueth_emac *emac) struct prueth *prueth = emac->prueth; int slice = prueth_emac_slice(emac); u32 base = stats_base[slice]; + u32 tx_pkt_cnt = 0; u32 val; int i; @@ -29,7 +33,12 @@ void emac_update_hardware_stats(struct prueth_emac *emac) base + icssg_all_stats[i].offset, val); + if (icssg_all_stats[i].offset == ICSSG_TX_PACKET_OFFSET) + tx_pkt_cnt = val; + emac->stats[i] += val; + if (icssg_all_stats[i].offset == ICSSG_TX_BYTE_OFFSET) + emac->stats[i] -= tx_pkt_cnt * 8; } } base-commit: 71c299c711d1f44f0bf04f1fea66baad565240f1 -- 2.34.1