Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1383323rwr; Thu, 20 Apr 2023 14:18:04 -0700 (PDT) X-Google-Smtp-Source: AKy350aN8dxBy+Wno8akLSAl3ZFr8zbRAOVShmSP6zDQZ3/lHKdp7OBgpDrKw/B311bDpafrAyaF X-Received: by 2002:a17:902:d489:b0:1a9:20be:272c with SMTP id c9-20020a170902d48900b001a920be272cmr3044509plg.67.1682025484456; Thu, 20 Apr 2023 14:18:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682025484; cv=none; d=google.com; s=arc-20160816; b=xtDr7tLEbQehzd7kpcZZjr8VyVBQE/jWjatuU1SKE7snWy62w0rqpPCaOVrCO4+7Fz h34yHshOCr1EQb420tCp+yPkf+NNn6R7pGgR9OHZKM1LJimzJzsj8lduVAw36Me1kGc1 8eYTxC5T8Gl8Yr0hY63/5+bCCIYC4CNV6lMYZcpRIq22O7wpIwbUNcdTT6W+cFVhA36f Wd1NCtksFCZn9fFvK+pAkybMq/Vl1w+QK1W0kEk4A3oVKW8ZZm/q3qlDF9o2h5LF8fW1 WZMNU2WWdj4VY01gC1TBckgDdNfFhOOJPDusI0m+FZ08YKrM2jzfP3sS6FwQZJegDZA/ UBNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:to:from:date; bh=CEIIxz47kughbPq/IHjwOs7hBKb5DVOHOPKww/Vy0Ww=; b=x3+9UQyt2Ze0pX0ZUBTOz2Pv9xCYudQCGHe6G1QXGtJFfPeuyIllunrdqfbqoHZ3s3 lKbdCHqsHQVzQQeqeRHJb6fpnl2rCh7fJA52Eyqi1P5iUYEl0UND7WhIS3FKuXkYomwW dW46zhgo5duu2gX2ztDMjD8zbBG4Nvufahai5xBgJ8O4Q2Mr4ArgT7Gurx1X0Sxuk59d 8w4DIMeKtCD1nB3QyisZBev4TkN05BwfGMu8unpWu0eQPqpQAo26epq091BPo7/vj468 k/FOEmaJPOxHc+LRkSLiVRHhaFvG5GSq4o9dOrkP6+ex5JnG14pws6SI3wxBsLHLnRig cfUA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a170903024d00b001a50a33295esi2968494plh.278.2023.04.20.14.17.50; Thu, 20 Apr 2023 14:18:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232353AbjDTVG6 (ORCPT + 99 others); Thu, 20 Apr 2023 17:06:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbjDTVG4 (ORCPT ); Thu, 20 Apr 2023 17:06:56 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B269D4220; Thu, 20 Apr 2023 14:06:55 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1ppbUP-0002gY-0C; Thu, 20 Apr 2023 23:06:49 +0200 Date: Thu, 20 Apr 2023 22:06:42 +0100 From: Daniel Golle To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Subject: [PATCH net-next] net: mtk_eth_soc: mediatek: fix ppe flow accounting for v1 hardware Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Felix Fietkau Older chips (like MT7622) use a different bit in ib2 to enable hardware counter support. Add macros for both and select the appropriate bit. Fixes: 3fbe4d8c0e53 ("net: ethernet: mtk_eth_soc: ppe: add support for flow accounting") Signed-off-by: Felix Fietkau Signed-off-by: Daniel Golle --- drivers/net/ethernet/mediatek/mtk_ppe.c | 10 ++++++++-- drivers/net/ethernet/mediatek/mtk_ppe.h | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index dd9581334b054..9129821f3ab8f 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -601,6 +601,7 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, struct mtk_eth *eth = ppe->eth; u16 timestamp = mtk_eth_timestamp(eth); struct mtk_foe_entry *hwe; + u32 val; if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; @@ -617,8 +618,13 @@ __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, wmb(); hwe->ib1 = entry->ib1; - if (ppe->accounting) - *mtk_foe_entry_ib2(eth, hwe) |= MTK_FOE_IB2_MIB_CNT; + if (ppe->accounting) { + if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) + val = MTK_FOE_IB2_MIB_CNT_V2; + else + val = MTK_FOE_IB2_MIB_CNT; + *mtk_foe_entry_ib2(eth, hwe) |= val; + } dma_wmb(); diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.h b/drivers/net/ethernet/mediatek/mtk_ppe.h index e1aab2e8e2629..e51de31a52ec6 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.h +++ b/drivers/net/ethernet/mediatek/mtk_ppe.h @@ -55,9 +55,10 @@ enum { #define MTK_FOE_IB2_PSE_QOS BIT(4) #define MTK_FOE_IB2_DEST_PORT GENMASK(7, 5) #define MTK_FOE_IB2_MULTICAST BIT(8) +#define MTK_FOE_IB2_MIB_CNT BIT(10) #define MTK_FOE_IB2_WDMA_QID2 GENMASK(13, 12) -#define MTK_FOE_IB2_MIB_CNT BIT(15) +#define MTK_FOE_IB2_MIB_CNT_V2 BIT(15) #define MTK_FOE_IB2_WDMA_DEVIDX BIT(16) #define MTK_FOE_IB2_WDMA_WINFO BIT(17) -- 2.40.0