From patchwork Mon Nov 7 18:54:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 16645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2234756wru; Mon, 7 Nov 2022 11:03:21 -0800 (PST) X-Google-Smtp-Source: AMsMyM5IP10ePkoAxTqCVzq8k9vwt7+1FuQpLrSzn/GPcJgQIW8BvlEvpCCgkNzU5+QFBHUJXo2c X-Received: by 2002:a50:d5d5:0:b0:461:a30b:67a2 with SMTP id g21-20020a50d5d5000000b00461a30b67a2mr52539969edj.104.1667847800980; Mon, 07 Nov 2022 11:03:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667847800; cv=none; d=google.com; s=arc-20160816; b=IwT6ceRMxCB5E9ihp1jyZWw26E7mP89k7Jp4Pong+qbiFprC+RiyVwYRfOML/1lCY6 cJf4zuhUXN+ZAirRLfGmKpNuNcXrMH0JNLlSQmqdHTP59vp1Pr99M8HWShMEF4ak261n wMeA4nx5gjtw2bLSPkiJADll4cN/Tdv2zvCQosJ+sZL/YsImCMvRKqP4AZ9fE8GhDvvF CS7fjuhYNjbHMbauMaLpAxqK5TuUflpzhIFOCkDYE++GEDbPHASmwzsI/hkuNW4cxBDa WH7ILgOuegnsas7SSDBnZ/PRf8p0+bKOQ/ge+tCA2l0OrL1sLE3sbi96C8nEQQCzzBXb HETQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R2N+jSfSlY43TnrF1h50zfC2H3h4TDeeUUxvXDObycg=; b=Nal5g+Gp9Fyj2nD+woiU9f9VFQ8uMHb9pYriBo0GlG9FKQHe9iuYGuOHDbstL7Svwi U6hXhAWMIenRAgWRfZYWTR5J2RNnqRZ+ndV1K0zNJSRCMKZ8jCuI6xyF2UkIlEAvZc6n tU0gALgCgP2dev/CXM+TPPZmhaCFEu+u1qPbrEVw6w2IA34D/dbha9W1WcXCvVr0N0DE K/z3t+ZNwN3fAhkvcY/iMpSp/Sgjbeg/qd6UEqRBAIycENaQu62qsRPOze+DLS7PR9UR bV4qrLHDmYQk9MZxD7UFWAyA27OxPe2Bubs3TjRfafNnd6CDTGlLLrk2Yzrvo56JKAXu OXIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=C7Bjul4L; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw9-20020a170907a0c900b0078df24be362si9970031ejc.496.2022.11.07.11.02.56; Mon, 07 Nov 2022 11:03:20 -0800 (PST) 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; dkim=fail header.i=@nbd.name header.s=20160729 header.b=C7Bjul4L; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232187AbiKGS4L (ORCPT + 99 others); Mon, 7 Nov 2022 13:56:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232942AbiKGSzn (ORCPT ); Mon, 7 Nov 2022 13:55:43 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69B1B24953; Mon, 7 Nov 2022 10:55:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=R2N+jSfSlY43TnrF1h50zfC2H3h4TDeeUUxvXDObycg=; b=C7Bjul4L+uZ5OTJN4pEVSnqlbL qxyo4As8AlXPlDIoxFGL6JtZIC9DUnL/tZB6t9okWkqhDmncnwapQ626TBPm0Dz0MUDeEqhd6hBbb EU5heDXhPmbjEPt2KSK7tCs5w0nEpSdt9f0WnPmiV/Vd4yssvCnNedGvHg5vdVYP+9OI=; Received: from p200300daa72ee1007849d74f78949f6c.dip0.t-ipconnect.de ([2003:da:a72e:e100:7849:d74f:7894:9f6c] helo=Maecks.lan) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1os7HA-000LCc-5E; Mon, 07 Nov 2022 19:55:16 +0100 From: Felix Fietkau To: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/14] net: ethernet: mtk_eth_soc: avoid port_mg assignment on MT7622 and newer Date: Mon, 7 Nov 2022 19:54:41 +0100 Message-Id: <20221107185452.90711-3-nbd@nbd.name> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221107185452.90711-1-nbd@nbd.name> References: <20221107185452.90711-1-nbd@nbd.name> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748865175842416083?= X-GMAIL-MSGID: =?utf-8?q?1748865175842416083?= On newer chips, this field is unused and contains some bits related to queue assignment. Initialize it to 0 in those cases. Fix offload_version on MT7621 and MT7623, which still need the previous value. Signed-off-by: Felix Fietkau --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++-- drivers/net/ethernet/mediatek/mtk_ppe.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 02a57729db28..9f607c80f49c 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -4243,7 +4243,7 @@ static const struct mtk_soc_data mt7621_data = { .hw_features = MTK_HW_FEATURES, .required_clks = MT7621_CLKS_BITMAP, .required_pctl = false, - .offload_version = 2, + .offload_version = 1, .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { @@ -4282,7 +4282,7 @@ static const struct mtk_soc_data mt7623_data = { .hw_features = MTK_HW_FEATURES, .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, - .offload_version = 2, + .offload_version = 1, .hash_offset = 2, .foe_entry_size = sizeof(struct mtk_foe_entry) - 16, .txrx = { diff --git a/drivers/net/ethernet/mediatek/mtk_ppe.c b/drivers/net/ethernet/mediatek/mtk_ppe.c index 2d8ca99f2467..3ee2bf53f9e5 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe.c @@ -175,6 +175,8 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry, val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT_V2, pse_port) | FIELD_PREP(MTK_FOE_IB2_PORT_AG_V2, 0xf); } else { + int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f; + val = FIELD_PREP(MTK_FOE_IB1_STATE, MTK_FOE_STATE_BIND) | FIELD_PREP(MTK_FOE_IB1_PACKET_TYPE, type) | FIELD_PREP(MTK_FOE_IB1_UDP, l4proto == IPPROTO_UDP) | @@ -182,7 +184,7 @@ int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry, entry->ib1 = val; val = FIELD_PREP(MTK_FOE_IB2_DEST_PORT, pse_port) | - FIELD_PREP(MTK_FOE_IB2_PORT_MG, 0x3f) | + FIELD_PREP(MTK_FOE_IB2_PORT_MG, port_mg) | FIELD_PREP(MTK_FOE_IB2_PORT_AG, 0x1f); }