From patchwork Mon Nov 7 18:54:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Fietkau X-Patchwork-Id: 16656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2247070wru; Mon, 7 Nov 2022 11:28:40 -0800 (PST) X-Google-Smtp-Source: AMsMyM53PsUW2VwJBis8NSWdmct6Vz+9GdFsa6pnjz5L5i7Gctq3J8UQVdKoR5FAhhJZMjHc0InG X-Received: by 2002:a17:90b:4c07:b0:213:44f5:6073 with SMTP id na7-20020a17090b4c0700b0021344f56073mr53174671pjb.184.1667849319842; Mon, 07 Nov 2022 11:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667849319; cv=none; d=google.com; s=arc-20160816; b=txGeLjdCMmit5XzCUTg6qnXHlk6zzjTqv2gMk8Rm/Ptc20g5zHSMtF9zzeLATHfG5Z w5U0XiRTq0IP8UWjSqeMfmEYDOMP2sw66alRfqgNuO1pn0LIFYFbkfC0r1h5iWmojEDQ mQVOL3/S/qfeg0OjuOIFbNe4s0hSIn1Rg/HPMf5zokVOn+AeUdq5apdeghxRbKETq6NA gTR7+0YSQnGDfMTbwlWvyiqySJyANlDnhTk2WBOaHhmhvcvP8P3srwtaq3YpIduwd2Jw EukbKg1lgKJGjAwJarpflVtNrSq/Lznvl7gV4FACvlY1TF2HFFnfiVJy7OCP8N4Pr4dc Xkig== 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=5ieiAxhifSMyQ4MxSnOsIKCi9Eh84IdHGfPjBjh2Hno=; b=jlSNZ0n+183Yofi3afE7SBzAD46zvMKXkWVLUxuT0qkpgbU1wjsdmiGinBwCY1G8pK iLJ25HHdKKPVWKu5QIZbUydO40fhFMievND3rNseplPA4iTrIFULlVBtmXMSj/pYSJDZ AfKOEIHa/dOiY9em0YeKyc1fq5FzYp7jdWrL9K3xs7MjXRyryvwTL8OPlbo2oGBEbH/m uNQIZAh9F335uBvnPxg1zxelvLZkpzNJPA/jk19VxDtMzaQpXA4II0AtJ4hEQQ73SplV MZLOAJPpqpMXjlv26utRwAz8CohHkLaA73TO+N16Pk7/AJgnbMqXW64u6t5ISUoB8HbX EOGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=fh+rYeK1; 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 g1-20020a17090a708100b00213de6fbf91si13539144pjk.183.2022.11.07.11.28.21; Mon, 07 Nov 2022 11:28:39 -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=fh+rYeK1; 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 S231705AbiKGT0I (ORCPT + 99 others); Mon, 7 Nov 2022 14:26:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232601AbiKGTZz (ORCPT ); Mon, 7 Nov 2022 14:25:55 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB46E2AC73; Mon, 7 Nov 2022 11:25:54 -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=5ieiAxhifSMyQ4MxSnOsIKCi9Eh84IdHGfPjBjh2Hno=; b=fh+rYeK17i703PklQYs1GnZj8Y f5vZfagQdzCt9wXjqfxtHNlZIdAM53JDmm+IwWUapnaFa4G6gsdpTOpbgj6ZtC11spai+rqg8ir6l jNiDa95qAoAoe/9Ydlgi2YCvzf8hPn5twSqDAP+MxbLGHFG63nzZ9/RTqm8v68cWJXHU=; 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 1os7HI-000LCc-Ht; Mon, 07 Nov 2022 19:55:24 +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 14/14] net: ethernet: mtk_eth_soc: drop packets to WDMA if the ring is full Date: Mon, 7 Nov 2022 19:54:52 +0100 Message-Id: <20221107185452.90711-14-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?1748866767989033609?= X-GMAIL-MSGID: =?utf-8?q?1748866767989033609?= Improves handling of DMA ring overflow. Clarify other WDMA drop related comment. Signed-off-by: Felix Fietkau --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 5 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 50756c8aa871..4bd06ab1a2b5 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -3529,9 +3529,12 @@ static int mtk_hw_init(struct mtk_eth *eth) mtk_w32(eth, 0x21021000, MTK_FE_INT_GRP); if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { - /* PSE should not drop port8 and port9 packets */ + /* PSE should not drop port8 and port9 packets from WDMA Tx */ mtk_w32(eth, 0x00000300, PSE_DROP_CFG); + /* PSE should drop packets to port 8/9 on WDMA Rx ring full */ + mtk_w32(eth, 0x00000300, PSE_PPE0_DROP); + /* PSE Free Queue Flow Control */ mtk_w32(eth, 0x01fa01f4, PSE_FQFC_CFG2); diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index bf8c7d11df9f..226022346369 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -124,6 +124,7 @@ #define PSE_FQFC_CFG1 0x100 #define PSE_FQFC_CFG2 0x104 #define PSE_DROP_CFG 0x108 +#define PSE_PPE0_DROP 0x110 /* PSE Input Queue Reservation Register*/ #define PSE_IQ_REV(x) (0x140 + (((x) - 1) << 2))