Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp615141rdg; Tue, 10 Oct 2023 23:37:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwKmizdvheKE3W1//AKXyw10r4Tv1A4sD7sRfpgs4Pe2X47HW+qIdJWAeiRQjkUOup+u2b X-Received: by 2002:a05:6a20:3c89:b0:161:2df0:eadf with SMTP id b9-20020a056a203c8900b001612df0eadfmr21172709pzj.24.1697006251231; Tue, 10 Oct 2023 23:37:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697006251; cv=none; d=google.com; s=arc-20160816; b=xHArImC2P5B6V0qsq51hXGHDJg1XS09sHfOBk9QK36JH/RMGb48RkrWRA1IVGojJxI rxvB0wePnIC3/j14Q7peVmAyr8+7KoD2UCtm/iZDJZ4Q4y7FsnGGObdZ7+ZlveBn5T9z 22adQ1RBYA+a7jAGN8tpGSGhaMF48I6KzNuBrLb0zxdG7GFuf/mL19TMnpmkd38mZRIA qGwLacV2jzj5KWoqQ5846o20rDhBkw/vz8TLxBRCG1Uw+pWLxa4bV7pDCJUbFnsq/x8m FypGiKjpjigMAPpzV0+x/tehTMdcH47dW/qr3hupG6NmukxtAWzus5hzKYC1nez7c4UL f+iQ== 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=ibJxl3VqApgkwXcPcBAZdilAPVeZ+ZobbrYoKmgyyBU=; fh=PCOD5Mx1BxjAyBqmfn2OU7KrDQG1pcEp1P+E9HIl8qw=; b=nSrAwjC47JOZNLOrXDgeesd2mVzN4mLcEELfDyQlmtF8P8PtWGt9+4BXsGdmLSu4bB OHKlw14tkoqwbOE5ozRneGQXZCaYpZ6kBbGV/319OXeyc8xr1jgPiuYGRCIFDN/XEIRa j+Ym/Y0H3FaNaaT8ySssjEL7wY/5z1KkZvtorkAgIQN+UdxIyzPslSHruOcvAbsN54cp gW1kAC1jMWqGhFV92UQrYmf15yLsnCAt8+h8Hh3sxcy8aLfSDPCFdUUYnrSYM+mfCBKq oke6P+z6TZdWAJRzwvmcYhaZCIrvUhdYB/qVIVit9qAtBzScyO1Qyz6dLPn3+tbpm2hs DZfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=s8naaFuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l22-20020a17090b079600b002719ad11d97si214130pjz.137.2023.10.10.23.37.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 23:37:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=s8naaFuY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 6457981890BA; Tue, 10 Oct 2023 23:37:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345344AbjJKGh2 (ORCPT + 99 others); Wed, 11 Oct 2023 02:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344555AbjJKGh1 (ORCPT ); Wed, 11 Oct 2023 02:37:27 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6092C9B; Tue, 10 Oct 2023 23:37:24 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 39B6bA1p113973; Wed, 11 Oct 2023 01:37:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1697006230; bh=ibJxl3VqApgkwXcPcBAZdilAPVeZ+ZobbrYoKmgyyBU=; h=From:To:CC:Subject:Date; b=s8naaFuYdAU+pPhK26H3cr/k2QuGyMYXKafJA97M2iSkBzh/Lj368qfPhBRDFv/4V JJVp2RQy2OoBBDdOcTVLgRUtP7CiWGw7XLpeAJhcUXJCSYeGH7dTmq5BzSModAnc0d /W+PAT4Fsbm1FlCq9uhyvDa8cUDSgiW9YAgKYf/k= Received: from DFLE102.ent.ti.com (dfle102.ent.ti.com [10.64.6.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 39B6bAnf121517 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 11 Oct 2023 01:37:10 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 11 Oct 2023 01:37:10 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE110.ent.ti.com (10.64.6.31) 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; Wed, 11 Oct 2023 01:37:10 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 39B6bAUS003485; Wed, 11 Oct 2023 01:37:10 -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 39B6b9tg008250; Wed, 11 Oct 2023 01:37:09 -0500 From: MD Danish Anwar To: MD Danish Anwar , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" CC: , , , Vignesh Raghavendra , , Roger Quadros Subject: [PATCH] net: ti: icssg-prueth: Fix tx_total_bytes count Date: Wed, 11 Oct 2023 12:07:00 +0530 Message-ID: <20231011063700.1824093-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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 23:37:30 -0700 (PDT) ICSSG HW stats on TX side considers 8 preamble bytes as data bytes. Due to this the tx_total_bytes of one interface doesn't match the rx_total_bytes of other interface when two ICSSG interfaces are connected with each other. There is no public errata available yet. As a workaround to fix this, decrease tx_total_bytes by 8 bytes for every tx frame. Fixes: c1e10d5dc7a1 ("net: ti: icssg-prueth: Add ICSSG Stats") Signed-off-by: MD Danish Anwar --- drivers/net/ethernet/ti/icssg/icssg_stats.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/ti/icssg/icssg_stats.c b/drivers/net/ethernet/ti/icssg/icssg_stats.c index bb0b33927e3b..dc12edcbac02 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_stats.c +++ b/drivers/net/ethernet/ti/icssg/icssg_stats.c @@ -18,6 +18,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 +30,12 @@ void emac_update_hardware_stats(struct prueth_emac *emac) base + icssg_all_stats[i].offset, val); + if (!strncmp(icssg_ethtool_stats[i].name, "tx_good_frames", ETH_GSTRING_LEN)) + tx_pkt_cnt = val; + emac->stats[i] += val; + if (!strncmp(icssg_ethtool_stats[i].name, "tx_total_bytes", ETH_GSTRING_LEN)) + emac->stats[i] -= tx_pkt_cnt * 8; } } -- 2.34.1