From patchwork Tue Jul 9 08:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C66DC3DA41 for ; Tue, 9 Jul 2024 08:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kG7XBsQlE3wteyMVxAgB3FeKItlmk44xoPu+CQNnd0w=; b=fZMbJ3GtcCeRAkRxZg2NCV4P+5 KXYy2y4BBstoSwH5uFYsLUEgSIdymAjjWEb714tvf68DY8EaxzKzFuNDDtabkkRCAoyemirRFTC0G o2foh5rBndTl0Ki96ylbCVr1xjKMMjBsQzowJKaLMD9L3kbTwkQMBq6Xv1qZDmjSIbgZKggLSaX9l mnwjrvSK5YCPx9ivBTXrueCyYGrNm+Ltcml7VzC+DuDHHJyLk1SJRwOIqlaH+xMxotNcXJKyx0Gnz XSXjBLjLWzX5TQv9HGJtKUWnBoviawhhhbQKLpmKyBM3VxudmoaTUwQFvl3RavAqRVee8wRGBu1fX VkCCn6qg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR67q-00000006NpF-1x0h; Tue, 09 Jul 2024 08:23:02 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR67Y-00000006NhP-1fS8 for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:22:45 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2c9df3eb0edso1954281a91.3 for ; Tue, 09 Jul 2024 01:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513363; x=1721118163; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=kG7XBsQlE3wteyMVxAgB3FeKItlmk44xoPu+CQNnd0w=; b=eu6Zmgo4cUtxadf6XLbgNgNlqhi292UAEATYGRsa8HIYc4smMmXX2bUmtnfLJMV0rc PUFvK4XPJDN/SInM7zxIu1zS5Z43WqPglfwo1IoFIef3CTdyRtS+LFUL7SIITRLahU+C 44P9q7oQWD4Ptuccg8Suv9nDZ0Eug8tZxO0VGcsyiBwD9ijl6HuhLpXLkui7QVcpNj4k 6EoFRqvoFEMgkxU2zVo4AS2gdr6Jd/jZ+1mdpTxtIJmFrxLfoIDcqlRwd/Fqa0rAu/4l w/+uu91sygDCFEtq8qykx6wKLs9j2sWQ5JHv1jsW60BM4CQBl2BrWfFYjr5gf3d4wRsA dSHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513363; x=1721118163; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=kG7XBsQlE3wteyMVxAgB3FeKItlmk44xoPu+CQNnd0w=; b=vuBDyC5FBMKlNe/AS9/hHsdTgaSku+JNjZhAEo+I+NAZDpcZAdChNs4Ys5S6OgH5Qf qqDES3X3pmxuJPJLrdB0TNPaGL/xd9bGiyi9idzcXgJbu7P0UMIJzLU5cXMq+vyBI8IO B/+2xzcRLyDpfDPsWLEZwAH4/L5F/JolXDB9MGY9PP3FIitePqFvEibUllyM/D3y/50Q 5fS9G/trwPIBKLfsALyYiWnuUSUngdBIMxLdHCWi68B7icoohiKCTU5mN8W1zDLNfdnk aJlIIeROONh8ywTn98KxFzXFIbQlZA4Nni407AfzM9KaB+BILMLeUfcCGG8dZaQ9PKE4 JAow== X-Forwarded-Encrypted: i=1; AJvYcCUOumvcAzb1N1yALzh0LW5s0saeXaFDg1DRv17rYEN6cwjKTDJ22BIpEn3mGkDVtytH03mlh+AUMY4eqUbLsSllTn9MR0F5dn8uWLkH3yOkqUyUs1g= X-Gm-Message-State: AOJu0Yzd5PiLSdq0S35WbDfK+B1jVyHpNi3ywxT0aDRtR1eeFbXbYWW6 mpIE9axkRC+q1PBgTQFMVFYTLayClAqUtMs6BBt64Tz8DxANLG0T X-Google-Smtp-Source: AGHT+IFgGL6RTLzIY5jdRBvv34mJdpYMSNbt5TDn2M3+NI7ogAZwEyXUqJrg0iTQS9IS1HL8eNA2Bw== X-Received: by 2002:a17:90a:4966:b0:2bd:d42b:22dc with SMTP id 98e67ed59e1d1-2ca35d533b9mr1624494a91.43.1720513362881; Tue, 09 Jul 2024 01:22:42 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.22.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:22:42 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 1/7] net: stmmac: xgmac: drop incomplete FPE implementation Date: Tue, 9 Jul 2024 16:21:19 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012244_460915_3F01F472 X-CRM114-Status: GOOD ( 11.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The FPE support for xgmac is incomplete, drop it temporarily. Once FPE implementation is refactored, xgmac support will be added. Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 -- .../ethernet/stmicro/stmmac/dwxgmac2_core.c | 27 ------------------- 2 files changed, 29 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 6a2c7d22df1e..917796293c26 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -193,8 +193,6 @@ #define XGMAC_MDIO_ADDR 0x00000200 #define XGMAC_MDIO_DATA 0x00000204 #define XGMAC_MDIO_C22P 0x00000220 -#define XGMAC_FPE_CTRL_STS 0x00000280 -#define XGMAC_EFPE BIT(0) #define XGMAC_ADDRx_HIGH(x) (0x00000300 + (x) * 0x8) #define XGMAC_ADDR_MAX 32 #define XGMAC_AE BIT(31) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index 6a987cf598e4..e5bc3957041e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -1505,31 +1505,6 @@ static void dwxgmac2_set_arp_offload(struct mac_device_info *hw, bool en, writel(value, ioaddr + XGMAC_RX_CONFIG); } -static void dwxgmac3_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - u32 num_txq, - u32 num_rxq, bool enable) -{ - u32 value; - - if (!enable) { - value = readl(ioaddr + XGMAC_FPE_CTRL_STS); - - value &= ~XGMAC_EFPE; - - writel(value, ioaddr + XGMAC_FPE_CTRL_STS); - return; - } - - value = readl(ioaddr + XGMAC_RXQ_CTRL1); - value &= ~XGMAC_RQ; - value |= (num_rxq - 1) << XGMAC_RQ_SHIFT; - writel(value, ioaddr + XGMAC_RXQ_CTRL1); - - value = readl(ioaddr + XGMAC_FPE_CTRL_STS); - value |= XGMAC_EFPE; - writel(value, ioaddr + XGMAC_FPE_CTRL_STS); -} - const struct stmmac_ops dwxgmac210_ops = { .core_init = dwxgmac2_core_init, .set_mac = dwxgmac2_set_mac, @@ -1570,7 +1545,6 @@ const struct stmmac_ops dwxgmac210_ops = { .config_l3_filter = dwxgmac2_config_l3_filter, .config_l4_filter = dwxgmac2_config_l4_filter, .set_arp_offload = dwxgmac2_set_arp_offload, - .fpe_configure = dwxgmac3_fpe_configure, }; static void dwxlgmac2_rx_queue_enable(struct mac_device_info *hw, u8 mode, @@ -1627,7 +1601,6 @@ const struct stmmac_ops dwxlgmac2_ops = { .config_l3_filter = dwxgmac2_config_l3_filter, .config_l4_filter = dwxgmac2_config_l4_filter, .set_arp_offload = dwxgmac2_set_arp_offload, - .fpe_configure = dwxgmac3_fpe_configure, }; int dwxgmac2_setup(struct stmmac_priv *priv) From patchwork Tue Jul 9 08:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8074AC3DA41 for ; Tue, 9 Jul 2024 08:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=x4bF8onLf0sdE3t3KB8zz6I+NlPIzXeOdYuUooT+xDk=; b=goHVapcSbhKA8gEArQIXT9Nv7E oXYDq2jUDHuRl0P/igfP4SKNQ/tuMu0nqMTIcj4GAQIZPnDZdjq2TUu7Gns7JVZ7SlQbBgMiCDvI8 IpgV2LLLB1wZJSaZTXkJcUiEn4hSkLxkTn4zUJvCtkIe7VBRPlHEly8TipYS0kt3JeVc65QGcyamc WJw7R0tN4E4zAv4KF/ZwSL99W58459a6QqOQXpOy3bwDEKl0YT1ACV+eIaVMvPMmUpaFTF1hJpirQ yatsRJs+b8yHCU5BjUxA71pr3mimGLPQzprO+2GN7ks1CwYMWTmk89HEYymt7lb8P7HrsRCwjBeJC NbzqD4Rg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR683-00000006NuV-3S42; Tue, 09 Jul 2024 08:23:15 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR67i-00000006Nl4-0efm for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:22:56 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70b42250526so798813b3a.1 for ; Tue, 09 Jul 2024 01:22:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513373; x=1721118173; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x4bF8onLf0sdE3t3KB8zz6I+NlPIzXeOdYuUooT+xDk=; b=XquFhhtm5QFruK4b6njFi+5KQAwOMoyy0PQxbJeWV9aRp2IaD6nj8yIE5HAoUw9PH+ qyIHaxkErPKNiY3UfsFeVSa5x6F4ARGffu4Gvs/7qIi808j4Dg6cJjNSoZFIbDmew8r6 vatOieqXhM+3ywekh5jM3OtBSKmho/Q9fK3epbGnYS9NuKPASKqXLqM6xd7yfL44gXge h0V7lke7yfRXEA8MVcugYqqb+VX5pR2Brhbdw4ph4PAkMEtO/HIe3zRZF8Rolnjy/wrU oMXvM5s12X4/wzabitlBsrVWkcqpr35hoGXkWYlXd/XsO+jBQvYYvD+BXRk2jX/1pFCf lQ0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513373; x=1721118173; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x4bF8onLf0sdE3t3KB8zz6I+NlPIzXeOdYuUooT+xDk=; b=Kmrcl+wxYusFfRivLQzESCw59oSV5rJRxfCCcbt9MlJCBhRPOw5QGSkmza1IS7GCHg G9EK+PxCRHJS0Y3US0odkYnDensYdjQykWwTwbUECf5wNN/Qqer6cnYGJFdGo/BZEaRM Ws5Q1UdKmTNXrzEYJM5mMdtomzg/YJAi4jByjpaYfEEbsfyCPAYRoGXVLds5arb+mO4x g5/U2LbGMT6ZAzrmCswrxk1dQrEUIJOi+3GARPw9TQGauUQH6K08d+phplUvp5wpyYon +Ggy+ZNqRo3l/L2E+HOIuB77IYU7D/0UJSJTNG/RSGkBLdkLEe1cSkdYrdlj/DHnoFJ2 kE+A== X-Forwarded-Encrypted: i=1; AJvYcCVXUdiqAySqZeqfWt2eD0FHAdweCZZXOXTBzwsGVpSmmxjx2Vc27FVlNgR3gdQy4V8LqgOSjGi47lk6DuXdQ65g0W495IQzPZhQMrbSfDYXRYbzupE= X-Gm-Message-State: AOJu0Yx+atYxe/5H0rL3ybel2t36q3vRUliKY4JUvQtU1KkEyVOWEFiv F9l1j26d/79f5uKWYWMi07ITK2p6cFtcgmLshtX3qpLQZL5f05cg X-Google-Smtp-Source: AGHT+IHdf/+Sw63Qfm2YgFi6J6SIA2YjPniRp27/Dn9i48xVvX5kBw2EaQzrGqnejAwaX/tV/o1qkg== X-Received: by 2002:a05:6a20:c70b:b0:1c0:f20c:5bae with SMTP id adf61e73a8af0-1c2983983b4mr2047130637.47.1720513373172; Tue, 09 Jul 2024 01:22:53 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.22.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:22:52 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 2/7] net: stmmac: gmac4: drop FPE implementation for refactoring Date: Tue, 9 Jul 2024 16:21:20 +0800 Message-Id: <98183e72d59cc8ce71dd9fd25a65983ff69dfcd1.1720512888.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012254_270453_1B3A16B4 X-CRM114-Status: GOOD ( 16.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The FPE support for gmac4 is complete, still drop it temporarily. Once FPE implementation is refactored, gmac4 support will be added. Signed-off-by: Furong Xu <0x1207@gmail.com> --- .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 -- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 66 ------------------- drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 16 ----- 3 files changed, 88 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index dbd9f93b2460..1505ac738b13 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -1265,9 +1265,6 @@ const struct stmmac_ops dwmac410_ops = { .set_arp_offload = dwmac4_set_arp_offload, .config_l3_filter = dwmac4_config_l3_filter, .config_l4_filter = dwmac4_config_l4_filter, - .fpe_configure = dwmac5_fpe_configure, - .fpe_send_mpacket = dwmac5_fpe_send_mpacket, - .fpe_irq_status = dwmac5_fpe_irq_status, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, @@ -1317,9 +1314,6 @@ const struct stmmac_ops dwmac510_ops = { .set_arp_offload = dwmac4_set_arp_offload, .config_l3_filter = dwmac4_config_l3_filter, .config_l4_filter = dwmac4_config_l4_filter, - .fpe_configure = dwmac5_fpe_configure, - .fpe_send_mpacket = dwmac5_fpe_send_mpacket, - .fpe_irq_status = dwmac5_fpe_irq_status, .add_hw_vlan_rx_fltr = dwmac4_add_hw_vlan_rx_fltr, .del_hw_vlan_rx_fltr = dwmac4_del_hw_vlan_rx_fltr, .restore_hw_vlan_rx_fltr = dwmac4_restore_hw_vlan_rx_fltr, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c index e02cebc3f1b7..1c431b918719 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c @@ -572,69 +572,3 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, writel(val, ioaddr + MAC_PPS_CONTROL); return 0; } - -void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - u32 num_txq, u32 num_rxq, - bool enable) -{ - u32 value; - - if (enable) { - cfg->fpe_csr = EFPE; - value = readl(ioaddr + GMAC_RXQ_CTRL1); - value &= ~GMAC_RXQCTRL_FPRQ; - value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; - writel(value, ioaddr + GMAC_RXQ_CTRL1); - } else { - cfg->fpe_csr = 0; - } - writel(cfg->fpe_csr, ioaddr + MAC_FPE_CTRL_STS); -} - -int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) -{ - u32 value; - int status; - - status = FPE_EVENT_UNKNOWN; - - /* Reads from the MAC_FPE_CTRL_STS register should only be performed - * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" - */ - value = readl(ioaddr + MAC_FPE_CTRL_STS); - - if (value & TRSP) { - status |= FPE_EVENT_TRSP; - netdev_info(dev, "FPE: Respond mPacket is transmitted\n"); - } - - if (value & TVER) { - status |= FPE_EVENT_TVER; - netdev_info(dev, "FPE: Verify mPacket is transmitted\n"); - } - - if (value & RRSP) { - status |= FPE_EVENT_RRSP; - netdev_info(dev, "FPE: Respond mPacket is received\n"); - } - - if (value & RVER) { - status |= FPE_EVENT_RVER; - netdev_info(dev, "FPE: Verify mPacket is received\n"); - } - - return status; -} - -void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - enum stmmac_mpacket_type type) -{ - u32 value = cfg->fpe_csr; - - if (type == MPACKET_VERIFY) - value |= SVER; - else if (type == MPACKET_RESPONSE) - value |= SRSP; - - writel(value, ioaddr + MAC_FPE_CTRL_STS); -} diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h index bf33a51d229e..00b151b3b688 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.h @@ -11,15 +11,6 @@ #define PRTYEN BIT(1) #define TMOUTEN BIT(0) -#define MAC_FPE_CTRL_STS 0x00000234 -#define TRSP BIT(19) -#define TVER BIT(18) -#define RRSP BIT(17) -#define RVER BIT(16) -#define SRSP BIT(2) -#define SVER BIT(1) -#define EFPE BIT(0) - #define MAC_PPS_CONTROL 0x00000b70 #define PPS_MAXIDX(x) ((((x) + 1) * 8) - 1) #define PPS_MINIDX(x) ((x) * 8) @@ -102,12 +93,5 @@ int dwmac5_rxp_config(void __iomem *ioaddr, struct stmmac_tc_entry *entries, int dwmac5_flex_pps_config(void __iomem *ioaddr, int index, struct stmmac_pps_cfg *cfg, bool enable, u32 sub_second_inc, u32 systime_flags); -void dwmac5_fpe_configure(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - u32 num_txq, u32 num_rxq, - bool enable); -void dwmac5_fpe_send_mpacket(void __iomem *ioaddr, - struct stmmac_fpe_cfg *cfg, - enum stmmac_mpacket_type type); -int dwmac5_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev); #endif /* __DWMAC5_H__ */ From patchwork Tue Jul 9 08:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727423 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00004C2BD09 for ; Tue, 9 Jul 2024 08:23:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VbCdNehdkqlQo0sbLo5ceHBxjJlaQK9zcub8z/dtnZ8=; b=efUhOjE3uWrOhkuif/V3GkRWwU DhGOb2+XthIwwzwN0DrulWEol3AHGcoOCt1Bf8iXuMD1pjEBcI4HKFyybUMYuN2QCnEgynLpg3Ved ysLMxxvh3P/WhZOGJ4gSckz6Cb2sgmquVTfe/FPZ+oaqeiDSfRid92QdkLtVzWPrkb9Q5bFHWfsky DnYbeq0CnKcU9NyuNl2/8VfPt/uwHXqP5afd2Cfu829BtXVI42Q/Ga2XG1Gb5HcRqe+TLgojql9/0 XqXgvndM7W9iySVbux3odk4KDzbtKl2jOTev/QBt9LekIzWZt4yINOnG7kHF5WbtJqSL5s8SjneXF zYdMCzyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68H-00000006O0k-3kfl; Tue, 09 Jul 2024 08:23:29 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR67t-00000006Nq8-2O6R for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:23:07 +0000 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1f9de13d6baso29061915ad.2 for ; Tue, 09 Jul 2024 01:23:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513384; x=1721118184; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VbCdNehdkqlQo0sbLo5ceHBxjJlaQK9zcub8z/dtnZ8=; b=dEJ/2T/vM2zhpERegtFmzbP8mU71D26bsFomYypGntHFTV92ouioxqpY4Z36nKFFFN gyfC09LO2lA3k2t5u313CCrnQfu31VCCu/f/Y/9w7fOM8TP2mwRNpSpLMcfKGSLLieHx +wW1Sm6lytchiWNiq0U0gQedtZqgK0wf+5uLFnYV1wC1hTb4sARQ9QqV4X8s8w2YRTKU U/UkuCwQK+naaVPfDm1lclG/r9eVsky1ASzq0KiSLkF6f+cKmvTZqUieQCdwvfQxneKq 45VANqXdD3xsG+7Kj1q7U7vzM/c2jZ0NFscF/15GKy8O+MslkIeykL6hcILN1V4fKy5m B0fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513384; x=1721118184; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VbCdNehdkqlQo0sbLo5ceHBxjJlaQK9zcub8z/dtnZ8=; b=P3zwpx8WRF7TqucMQP5i0SsFuPuYVDOvIHP9OQC3mX58MnbojmJ+Tv70z0L71bE1Hr pa3IpGjHiqWK1axEgCf9gb99iOkSDSF6nmJVVtRuBSzXfjIXnqxlfhfT5xpEd1dT9E6G EgRpyTj6sJlv3uDFJak+YLojEP/g7xSkrrrhwJuiwlyTrROPxYhB7gmAzPwowHzxaJ8K 877ZCUL1u7F+F1RXrEC+HByYuKPSk5+HMb6mZZNDCkKKuZ7NDUoZMQjaKHv5SMSlmwhL gn1SJEB/xYBpFFKlxxwkbD2VgyxDPHJfJwXe+YlIqrO1nbjJ0rqgvqpu4jwz8axAyFJH iWbQ== X-Forwarded-Encrypted: i=1; AJvYcCVFuRD5YtSIa8ALq03vLVWPT2yvWVOO5jVjC6l0W7c92xFEumFTyDoNQGwsHdwiZb0T88Wwz9wRHr6cZfiyj6XRmmwfNLd1y/MqZgmkKJf/DVqAgP8= X-Gm-Message-State: AOJu0YyqZX2Mm98KtxU8ScJ8K5o9CyGkZjda7ERAP7jAC4fMun7WGWqS D3l9zzpfWFTswQGd8Bh6MaCMqb3nSUBKOY3FK6XE/d0vkiIy3TVy X-Google-Smtp-Source: AGHT+IFEmIk4Fnua+udZbbg4a2Wno8OJPoEc2MEYng2DzfsTfKmBeu2Kld3lgrUK1ZzT7Ajm2ycsmQ== X-Received: by 2002:a17:90b:3804:b0:2c7:43c5:f2dc with SMTP id 98e67ed59e1d1-2ca35d86e39mr1275183a91.47.1720513383553; Tue, 09 Jul 2024 01:23:03 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:23:03 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 3/7] net: stmmac: refactor Frame Preemption(FPE) implementation Date: Tue, 9 Jul 2024 16:21:21 +0800 Message-Id: <4820163fc24ad809aa4d90467debd41f068908ca.1720512888.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012305_634300_437A7E85 X-CRM114-Status: GOOD ( 18.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refactor FPE implementation into a separate FPE module. Interfaces only, implementations for gmac4 and xgmac will follow. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/Makefile | 2 +- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 3 ++ drivers/net/ethernet/stmicro/stmmac/hwif.h | 28 ++++++++++--------- .../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 9 ++++++ .../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 13 +++++++++ 6 files changed, 42 insertions(+), 14 deletions(-) create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile index c2f0e91f6bf8..7e46dca90628 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Makefile +++ b/drivers/net/ethernet/stmicro/stmmac/Makefile @@ -6,7 +6,7 @@ stmmac-objs:= stmmac_main.o stmmac_ethtool.o stmmac_mdio.o ring_mode.o \ mmc_core.o stmmac_hwtstamp.o stmmac_ptp.o dwmac4_descs.o \ dwmac4_dma.o dwmac4_lib.o dwmac4_core.o dwmac5.o hwif.o \ stmmac_tc.o dwxgmac2_core.o dwxgmac2_dma.o dwxgmac2_descs.o \ - stmmac_xdp.o stmmac_est.o \ + stmmac_xdp.o stmmac_est.o stmmac_fpe.o \ $(stmmac-y) stmmac-$(CONFIG_STMMAC_SELFTESTS) += stmmac_selftests.o diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index cd36ff4da68c..73c145dda11a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -591,6 +591,7 @@ struct mac_device_info { const struct stmmac_tc_ops *tc; const struct stmmac_mmc_ops *mmc; const struct stmmac_est_ops *est; + const struct stmmac_fpe_ops *fpe; struct dw_xpcs *xpcs; struct phylink_pcs *phylink_pcs; struct mii_regs mii; /* MII register Addresses */ diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 29367105df54..fc9f58f44180 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -8,6 +8,7 @@ #include "stmmac.h" #include "stmmac_ptp.h" #include "stmmac_est.h" +#include "stmmac_fpe.h" static u32 stmmac_get_id(struct stmmac_priv *priv, u32 id_reg) { @@ -116,6 +117,7 @@ static const struct stmmac_hwif_entry { const void *tc; const void *mmc; const void *est; + const void *fpe; int (*setup)(struct stmmac_priv *priv); int (*quirks)(struct stmmac_priv *priv); } stmmac_hw[] = { @@ -351,6 +353,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->tc = mac->tc ? : entry->tc; mac->mmc = mac->mmc ? : entry->mmc; mac->est = mac->est ? : entry->est; + mac->fpe = mac->fpe ? : entry->fpe; priv->hw = mac; priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 97934ccba5b1..bd360f3ea784 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -418,13 +418,6 @@ struct stmmac_ops { bool en, bool udp, bool sa, bool inv, u32 match); void (*set_arp_offload)(struct mac_device_info *hw, bool en, u32 addr); - void (*fpe_configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, - u32 num_txq, u32 num_rxq, - bool enable); - void (*fpe_send_mpacket)(void __iomem *ioaddr, - struct stmmac_fpe_cfg *cfg, - enum stmmac_mpacket_type type); - int (*fpe_irq_status)(void __iomem *ioaddr, struct net_device *dev); }; #define stmmac_core_init(__priv, __args...) \ @@ -523,12 +516,6 @@ struct stmmac_ops { stmmac_do_callback(__priv, mac, config_l4_filter, __args) #define stmmac_set_arp_offload(__priv, __args...) \ stmmac_do_void_callback(__priv, mac, set_arp_offload, __args) -#define stmmac_fpe_configure(__priv, __args...) \ - stmmac_do_void_callback(__priv, mac, fpe_configure, __args) -#define stmmac_fpe_send_mpacket(__priv, __args...) \ - stmmac_do_void_callback(__priv, mac, fpe_send_mpacket, __args) -#define stmmac_fpe_irq_status(__priv, __args...) \ - stmmac_do_callback(__priv, mac, fpe_irq_status, __args) /* PTP and HW Timer helpers */ struct stmmac_hwtimestamp { @@ -660,6 +647,21 @@ struct stmmac_est_ops { #define stmmac_est_irq_status(__priv, __args...) \ stmmac_do_void_callback(__priv, est, irq_status, __args) +struct stmmac_fpe_ops { + void (*configure)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable); + int (*irq_status)(void __iomem *ioaddr, struct net_device *dev); + void (*send_mpacket)(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type); +}; + +#define stmmac_fpe_configure(__priv, __args...) \ + stmmac_do_void_callback(__priv, fpe, configure, __args) +#define stmmac_fpe_irq_status(__priv, __args...) \ + stmmac_do_callback(__priv, fpe, irq_status, __args) +#define stmmac_fpe_send_mpacket(__priv, __args...) \ + stmmac_do_void_callback(__priv, fpe, send_mpacket, __args) + struct stmmac_regs_off { u32 ptp_off; u32 mmc_off; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c new file mode 100644 index 000000000000..f6701ba93805 --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c @@ -0,0 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2024 Furong Xu <0x1207@gmail.com> + * stmmac FPE(802.3 Qbu) handling + */ + +#include "stmmac.h" +#include "stmmac_fpe.h" + diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h new file mode 100644 index 000000000000..84e3ceb9bdda --- /dev/null +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2024 Furong Xu <0x1207@gmail.com> + * stmmac FPE(802.3 Qbu) handling + */ + +#define FPE_CTRL_STS_TRSP BIT(19) +#define FPE_CTRL_STS_TVER BIT(18) +#define FPE_CTRL_STS_RRSP BIT(17) +#define FPE_CTRL_STS_RVER BIT(16) +#define FPE_CTRL_STS_SRSP BIT(2) +#define FPE_CTRL_STS_SVER BIT(1) +#define FPE_CTRL_STS_EFPE BIT(0) From patchwork Tue Jul 9 08:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B09BC3DA41 for ; Tue, 9 Jul 2024 08:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=29S9tCNcE/YwkqoQYa1nGmQDJhmHQQbSPi7L9uy3DQY=; b=eAtlI1cMiiYmNm5EmPeNRaGvzu euC+3syrKkzj36B2BYAs2qIT+ZhFjU/ZlJ7x4Ysq8dxlhvj6kNBEHTMIq3n0xa80e5X+gcTx53P7b HKqdn4X4wzYsCRuLoFbzzH7JV1YDKXOycQwqTYi6SQs5doyEockj+8eW3YhVAXZp5rOS93D96ERvA RHsNVwO5TlQSRjRJ4vw3gMDYcL2rmC2ur0YLaQVVNKMNDEFLGuJcjayXJP2O7XsC5vpC/SGLMtx33 RagJrx4mUgtRFgZLR6otMD5zhKSH1jZxucIIFDPT7fxYULCSxrk0MtGqSSGDYtCrsTR6+rnZJCZ2O BjN8020Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68W-00000006O7j-0aZL; Tue, 09 Jul 2024 08:23:44 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR683-00000006Ntq-0LuY for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:23:16 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-70df2135426so2453564a12.2 for ; Tue, 09 Jul 2024 01:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513394; x=1721118194; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=29S9tCNcE/YwkqoQYa1nGmQDJhmHQQbSPi7L9uy3DQY=; b=bV9msQhchK0mUsmR3z57jI6mk0HhGyuVv2NN9y9ssox9D/QdpiA90o9ZkdJAe8OCD7 h50aR8g7GyCJ8CSrs4bVCzx/yexcU6pz+2SpGycAh82X6FJ0Oq4F4LHNuU7gj8qzfb/4 27t+r64mjopUOuFPTDSiwsrl6QfaSWt0vmN+9A/4eb6z0wg/bfWSjAkdjH8EUruZ3SPS TY43UgR1NYJAmjjl6j/6h4K/OFkqN8mdZc1Jspw6gC/MiOSdEutBzow3mj4h60UagRvo co9jbF17TQMI72HDkzKYqxzm6eevYeSlBZlu4jo5eUIfRQin2Qb+5DyHlGyxgJmvlsN/ 5hkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513394; x=1721118194; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=29S9tCNcE/YwkqoQYa1nGmQDJhmHQQbSPi7L9uy3DQY=; b=IxgjguLbND50Qmu5hlb0DmUkkJ9urHU51ZaWla2LcG2BGXesYyiGclYKjV9i/fedDP 8RGaXYghWm0c9boWY7Fsdd/VeSiu2roH+OKZN8WL9FSkY96RubSIUj7K1FS2drxzJsOH htb392F3v6jRdJJCLav7+A0TWDGgaWZO6eah9Z5DC+ymvGpMdMNOl6/2Vtb05z/lPKz9 vM1sxKT2PnzmohDKrFsxcqOUwY84GixNF/B28S7ruDYlGCXEpkutLKxRk7UY4r2/N5fN dJrnAGC0W3TL6ZqkMaLWj9RpwxxqqeMlDOijOwiI3TOJ29DhV10h3mrbgtjpb6sJ70VL Z6LQ== X-Forwarded-Encrypted: i=1; AJvYcCU0Pa32nACScfqXmDBfOhSuApRmuPdStk2XIOpkrXmChLSIyDgPy2YZtkx3asouoxxADbPcXY4sAky32d/5jSRnUQp+BQZO/PAlbWNSgECBkPpSkZY= X-Gm-Message-State: AOJu0Yze5G0/2h8gt17+xFiF5JVWZ1ROFJiyKzYxmWjXPCleV4RrAnKa gOeWYwqGRIU4QpNMj2PGs0pMQx9i8aPRy4dgNF0rGsZpgznvB19+ X-Google-Smtp-Source: AGHT+IFP7v9XA+038juiIKo9wMYKaZosf3yLoyyuExumRzoZB0Txu2gnsXX83zEVAqRtpk376wQ+bg== X-Received: by 2002:a05:6a20:db0c:b0:1c2:93a7:2541 with SMTP id adf61e73a8af0-1c29822d122mr1658758637.24.1720513393543; Tue, 09 Jul 2024 01:23:13 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:23:13 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 4/7] net: stmmac: gmac4: complete FPE support Date: Tue, 9 Jul 2024 16:21:22 +0800 Message-Id: <7cc2f0bd9216a4d34b6a937c22a14acc7e6cc5b2.1720512888.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012315_146567_FCB0C13A X-CRM114-Status: GOOD ( 18.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce dwmac4_fpe_ops to complete the FPE implementation for DWMAC4 Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 + .../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 85 +++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 2 + 4 files changed, 90 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index fc9f58f44180..655012ffbc0a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -216,6 +216,7 @@ static const struct stmmac_hwif_entry { .tc = &dwmac510_tc_ops, .mmc = &dwmac_mmc_ops, .est = &dwmac510_est_ops, + .fpe = &dwmac4_fpe_ops, .setup = dwmac4_setup, .quirks = NULL, }, { @@ -236,6 +237,7 @@ static const struct stmmac_hwif_entry { .tc = &dwmac510_tc_ops, .mmc = &dwmac_mmc_ops, .est = &dwmac510_est_ops, + .fpe = &dwmac4_fpe_ops, .setup = dwmac4_setup, .quirks = NULL, }, { diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index bd360f3ea784..7b19614c611d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -685,6 +685,7 @@ extern const struct stmmac_desc_ops dwxgmac210_desc_ops; extern const struct stmmac_mmc_ops dwmac_mmc_ops; extern const struct stmmac_mmc_ops dwxgmac_mmc_ops; extern const struct stmmac_est_ops dwmac510_est_ops; +extern const struct stmmac_fpe_ops dwmac4_fpe_ops; #define GMAC_VERSION 0x00000020 /* GMAC CORE Version */ #define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c index f6701ba93805..97e404fac56a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c @@ -6,4 +6,89 @@ #include "stmmac.h" #include "stmmac_fpe.h" +#include "dwmac4.h" +static int __fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) +{ + u32 value; + int status; + + status = FPE_EVENT_UNKNOWN; + + /* Reads from the MAC_FPE_CTRL_STS register should only be performed + * here, since the status flags of MAC_FPE_CTRL_STS are "clear on read" + */ + value = readl(ioaddr); + + if (value & FPE_CTRL_STS_TRSP) { + status |= FPE_EVENT_TRSP; + netdev_info(dev, "FPE: Respond mPacket is transmitted\n"); + } + + if (value & FPE_CTRL_STS_TVER) { + status |= FPE_EVENT_TVER; + netdev_info(dev, "FPE: Verify mPacket is transmitted\n"); + } + + if (value & FPE_CTRL_STS_RRSP) { + status |= FPE_EVENT_RRSP; + netdev_info(dev, "FPE: Respond mPacket is received\n"); + } + + if (value & FPE_CTRL_STS_RVER) { + status |= FPE_EVENT_RVER; + netdev_info(dev, "FPE: Verify mPacket is received\n"); + } + + return status; +} + +static void __fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type) +{ + u32 value = cfg->fpe_csr; + + if (type == MPACKET_VERIFY) + value |= FPE_CTRL_STS_SVER; + else if (type == MPACKET_RESPONSE) + value |= FPE_CTRL_STS_SRSP; + + writel(value, ioaddr); +} + +static void dwmac4_fpe_configure(void __iomem *ioaddr, + struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable) +{ + u32 value; + + if (enable) { + cfg->fpe_csr = FPE_CTRL_STS_EFPE; + value = readl(ioaddr + GMAC_RXQ_CTRL1); + value &= ~GMAC_RXQCTRL_FPRQ; + value |= (num_rxq - 1) << GMAC_RXQCTRL_FPRQ_SHIFT; + writel(value, ioaddr + GMAC_RXQ_CTRL1); + } else { + cfg->fpe_csr = 0; + } + + writel(cfg->fpe_csr, ioaddr + FPE_CTRL_STS_GMAC4_OFFSET); +} + +static int dwmac4_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) +{ + return __fpe_irq_status(ioaddr + FPE_CTRL_STS_GMAC4_OFFSET, dev); +} + +static void dwmac4_fpe_send_mpacket(void __iomem *ioaddr, + struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type) +{ + __fpe_send_mpacket(ioaddr + FPE_CTRL_STS_GMAC4_OFFSET, cfg, type); +} + +const struct stmmac_fpe_ops dwmac4_fpe_ops = { + .configure = dwmac4_fpe_configure, + .irq_status = dwmac4_fpe_irq_status, + .send_mpacket = dwmac4_fpe_send_mpacket, +}; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h index 84e3ceb9bdda..efdb5536e856 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h @@ -4,6 +4,8 @@ * stmmac FPE(802.3 Qbu) handling */ +#define FPE_CTRL_STS_GMAC4_OFFSET 0x00000234 + #define FPE_CTRL_STS_TRSP BIT(19) #define FPE_CTRL_STS_TVER BIT(18) #define FPE_CTRL_STS_RRSP BIT(17) From patchwork Tue Jul 9 08:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727425 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 36282C2BD09 for ; Tue, 9 Jul 2024 08:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=P8/7znqqkBhNFJlanRTa4ag0D5o5jL152q+Urfiz2A8=; b=LPFmfQkHDYWROz1N6R5ixJGcgY aBM0lKDu4oRDYB8dP0PCWtVybBCcWjTVMZXwwcOTs9RpctpEn903KCBglCJWUGehuYsh/9q1aqaw5 kOSGg6rvdTcBy6bILPkJjHh/GrUtZJSH59L9ZbYEq94oJo5a2i1L4yHykobA79HFhEHnhZHEHxxGV EMLnwVQ39o/VeFGDzrNnM5sJd+7cVKEhpUOAhYiMBP6WxyzUkZlC1j+IysH6dxJz0ixTVgFSVV56o iHOANhuCOe8AnSBHj5T+2rumiBMq4Y8Ow0H02VU16OdachG6JrqCFiRJiGTO6UmfI23cv4B3a0qMB c1WPILpA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68j-00000006ODz-1gAv; Tue, 09 Jul 2024 08:23:57 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68C-00000006NyU-33UG for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:23:26 +0000 Received: by mail-pg1-x52e.google.com with SMTP id 41be03b00d2f7-70df213542bso2486091a12.3 for ; Tue, 09 Jul 2024 01:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513403; x=1721118203; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P8/7znqqkBhNFJlanRTa4ag0D5o5jL152q+Urfiz2A8=; b=NVYcz+PQBktdtzTUlK/LH7+yhFwqT0J90R/FsOhYbMLA8Rb+7kZqYDHjp9y/VvYmRe JpFeF17RViOzcJOJZ/GGAhuRV3/XGD/+udXP8LKMZaUC9worxSDmE2/NvL1vumbiTFoo QklbYncS8/3lmz8RUx+UYf72ssoojYqAJpfzalc/ivlJgA5f4NqjfyuyH2GMUPj/smJq FbhbNrfxtgQZt5rpfCv1DQze4CPLoz34LHw7w424fONsf71ghetSvuGPSWU3QxNiw27h gllrZyZqOkm9iuwvXGXBYR1a2aWZAelXDkBjVXr1FpF8S3UTEfTZSNIK2C5IjPUc89WB imfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513403; x=1721118203; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P8/7znqqkBhNFJlanRTa4ag0D5o5jL152q+Urfiz2A8=; b=Jn03rWz5VeXLfl3I9CiQ9K8HWWl+LwfYfZENn0VhG3BX6StTc82OHO0iIVRvQIDWTG Q3oixewq50GI+FG02Y2cBCSYckTrXavtO2QGYT7zIieBGfxf+s1yReFi0ttvgA+qnjWd alW6VovE046yZK1JqZpngSXQ0AHm3fxcQPdplZAMB+oC6rbSmyx3+FdA/kT3bHt5wtFO Uy6lGuz9QLwpbQgkfN98aq8xm8aF3OCYWgI4yLuJO5Q9PDBl6U862KduXwXmMSYyV9KS KB39IMOMn/1FjtJ+WG/L8RyAmL77AV/rZ8BJm21IfA2baYEgI9e42nuZW4jk6SJGW9Gn YrxQ== X-Forwarded-Encrypted: i=1; AJvYcCWdrFyoaR4BHR4SXzJ+yVREstRnliAZhIC239js6fsN/MGlTdugpUIoOyieC8k8fedX+uufWQ3asGqUKn2nYOqojRr/3sAIuaukLXTH3LHzADui6SY= X-Gm-Message-State: AOJu0YwRUd50eROWwwGCqyeMCpmLHP0tWDvsQ4Ck1GaBuBjJ2eD6Thbn uhAbEq8eqGWojGtmP/uePyHNQLC1jX1yTfvRW/EB1O8BDVtO6qPo X-Google-Smtp-Source: AGHT+IHsqtsn6gyOtXLL7y6Rzws8PcIlR1wfJvphBhSBBRCCn9DI8cbMl/kEnHnZ4m8DDm7Ae1Wzhg== X-Received: by 2002:a05:6a20:2588:b0:1be:ffe4:b2a2 with SMTP id adf61e73a8af0-1c298203941mr1960899637.7.1720513403354; Tue, 09 Jul 2024 01:23:23 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:23:22 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 5/7] net: stmmac: xgmac: rename XGMAC_RQ to XGMAC_FPRQ Date: Tue, 9 Jul 2024 16:21:23 +0800 Message-Id: <8e719b6c4c1fad64eedb0faad15d7920f708b736.1720512888.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012324_789035_0CDDB8E3 X-CRM114-Status: GOOD ( 11.64 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Synopsys XGMAC Databook defines MAC_RxQ_Ctrl1 register: RQ: Frame Preemption Residue Queue XGMAC_FPRQ is more readable and more consistent with GMAC4. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 917796293c26..c66fa6040672 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -84,8 +84,8 @@ #define XGMAC_MCBCQEN BIT(15) #define XGMAC_MCBCQ GENMASK(11, 8) #define XGMAC_MCBCQ_SHIFT 8 -#define XGMAC_RQ GENMASK(7, 4) -#define XGMAC_RQ_SHIFT 4 +#define XGMAC_FPRQ GENMASK(7, 4) +#define XGMAC_FPRQ_SHIFT 4 #define XGMAC_UPQ GENMASK(3, 0) #define XGMAC_UPQ_SHIFT 0 #define XGMAC_RXQ_CTRL2 0x000000a8 From patchwork Tue Jul 9 08:21:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B3A6DC3DA41 for ; Tue, 9 Jul 2024 08:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eP0LjrMRjIFsgCTgIBPUz0T81YiHTsFBk9I0t0JMtzc=; b=ZqCK07+qWnFGtgAQkxi1M2exWY ko4ydQVBdzF856h6O0nDoVsn2SHNbWw2ogp4atW85ABS3BX5S/iGRFsDa9AehAipq6XCtR1Vebbbl yKKz+ucXYyVz8fXTeK7tvjuGWOxgcKgK2dyWac7SGDhdAPtF0dogy34WyKhEDGqbNTEuoP6ESKRv2 e9M1QuxJ1LfKlx3htovW1+X9mnkzD09eTPo1bZQpCiRssacCYVbmfQ8/OLdnur3SQeAnUTThbUS7n ItyswylBpBy9qvGl1HxcYdSfc3L8X6lleRfknWK8xNdwaTlGRnRQPPJb27xlw4+EPw7MsX79NQ4BY Gv5jjXVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68y-00000006OL9-2pN3; Tue, 09 Jul 2024 08:24:12 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68M-00000006O2g-3MCH for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:23:36 +0000 Received: by mail-pj1-x1033.google.com with SMTP id 98e67ed59e1d1-2c980b55741so2862827a91.2 for ; Tue, 09 Jul 2024 01:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513413; x=1721118213; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eP0LjrMRjIFsgCTgIBPUz0T81YiHTsFBk9I0t0JMtzc=; b=CAT0d/ZQ/w0t10AIs2mP+uFwNTCnyfFcvgqj5QFlcMonF8gWJn7aV5C4nwZ9k6nOWX l1o7clEA+Rkl5RBapaA3umqAC/TjpnsUpK3rFy0HD4h74UHTKoWVkC3qOpHfPnsVgRBW 478jWZ6Md11s2XHj3q/cESxIlaAX5CssbUWYcULINQ4xW+oz8gPezYJPdUoJNfVM423p XZep2gHRwvyzFhp5IKvIPDvu5yhmkeD9RzpG9BMOk0ZDhzv8Yir9Xy+EET0pZeLyfUlg YCZjXmWbIAuzWi+yV7BAkg8KSVoFtJTpfNavOL+jbI6QJh/urOhTWOjmTn5bcleFMr5y Nq0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513413; x=1721118213; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eP0LjrMRjIFsgCTgIBPUz0T81YiHTsFBk9I0t0JMtzc=; b=QvsNbUwaaqFugRzdENhyBOPUCh4lqc40e7xgz/dZKQuxRD+YIqkc+R3eFWE+WV8+ml eGCGauTRD26IRljbt5MxmBfiW/75Cl+wZfNKyy8jonSROiRZuZkmm4pj/mlYr9xj8Jr3 0oO7plKcqgW851a9TgLqD0/D2b1VnLSTOn1IE3tdXEPuCf+2iYrT2C5OcQWGB9AGEFiN C2KFqxeQFTU87prI5+lnS8Tx3H5f7mFfRBpsz3rdNr3aYcNz7HP1fsleyDWHdfpfXPsx V0RiYn7zV4pSJiVvjeqnvunjkAqokiBkDBgEGwVZK9mndcriQvHgvQUmYkEUtqceVO6+ LKaQ== X-Forwarded-Encrypted: i=1; AJvYcCVFii++mzBORfTH3L4vGBmLHiAFxeNjmlC+8gH8ekKHZPOM4NjxJ+t0Ud6lqIHqQl/TQe5Lq6vUBmsZJQ0W255isBnEzf7OJe+uot9SFFDd4AHCz4s= X-Gm-Message-State: AOJu0Ywju/vF+PrJy+lrpuFB/NZ7FHirM0APAuRDZMMUtAY893e2wcd4 WlrHPpPjN5JnBdpK2bdj/nICuTTH4DI65p5YmYfz98CPUK3jARDu X-Google-Smtp-Source: AGHT+IEsA/J8BKGkc+qhPKYByQIdxwFS8gpklEmLtJM7nUypk4CDvh/2Q/FxDq9p43lqdv9itrHpzw== X-Received: by 2002:a17:90a:db58:b0:2c9:8d5d:d175 with SMTP id 98e67ed59e1d1-2ca35d59cedmr1492273a91.48.1720513413478; Tue, 09 Jul 2024 01:23:33 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:23:33 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 6/7] net: stmmac: xgmac: complete FPE support Date: Tue, 9 Jul 2024 16:21:24 +0800 Message-Id: <36336e43ee530596d77b15b80e3afac7bfd3319a.1720512888.git.0x1207@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012334_877655_4E13820A X-CRM114-Status: GOOD ( 16.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org FPE implementation for DWMAC4 and DWXGMAC differs only for: 1) Offset address of MAC_FPE_CTRL_STS 2) FPRQ(Frame Preemption Residue Queue) field in MAC_RxQ_Ctrl1 Introduce dwxgmac_fpe_ops to complete the FPE implementation for DWXGMAC. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/hwif.c | 2 + drivers/net/ethernet/stmicro/stmmac/hwif.h | 1 + .../net/ethernet/stmicro/stmmac/stmmac_fpe.c | 37 +++++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_fpe.h | 1 + 4 files changed, 41 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 655012ffbc0a..f13ed91b498f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -259,6 +259,7 @@ static const struct stmmac_hwif_entry { .tc = &dwmac510_tc_ops, .mmc = &dwxgmac_mmc_ops, .est = &dwmac510_est_ops, + .fpe = &dwxgmac_fpe_ops, .setup = dwxgmac2_setup, .quirks = NULL, }, { @@ -280,6 +281,7 @@ static const struct stmmac_hwif_entry { .tc = &dwmac510_tc_ops, .mmc = &dwxgmac_mmc_ops, .est = &dwmac510_est_ops, + .fpe = &dwxgmac_fpe_ops, .setup = dwxlgmac2_setup, .quirks = stmmac_dwxlgmac_quirks, }, diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.h b/drivers/net/ethernet/stmicro/stmmac/hwif.h index 7b19614c611d..81ce8ede2641 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.h +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.h @@ -686,6 +686,7 @@ extern const struct stmmac_mmc_ops dwmac_mmc_ops; extern const struct stmmac_mmc_ops dwxgmac_mmc_ops; extern const struct stmmac_est_ops dwmac510_est_ops; extern const struct stmmac_fpe_ops dwmac4_fpe_ops; +extern const struct stmmac_fpe_ops dwxgmac_fpe_ops; #define GMAC_VERSION 0x00000020 /* GMAC CORE Version */ #define GMAC4_VERSION 0x00000110 /* GMAC4+ CORE Version */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c index 97e404fac56a..c6894d5263c9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.c @@ -7,6 +7,7 @@ #include "stmmac.h" #include "stmmac_fpe.h" #include "dwmac4.h" +#include "dwxgmac2.h" static int __fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) { @@ -92,3 +93,39 @@ const struct stmmac_fpe_ops dwmac4_fpe_ops = { .irq_status = dwmac4_fpe_irq_status, .send_mpacket = dwmac4_fpe_send_mpacket, }; + +static void dwxgmac_fpe_configure(void __iomem *ioaddr, + struct stmmac_fpe_cfg *cfg, + u32 num_txq, u32 num_rxq, bool enable) +{ + u32 value; + + if (enable) { + cfg->fpe_csr = FPE_CTRL_STS_EFPE; + value = readl(ioaddr + XGMAC_RXQ_CTRL1); + value &= ~XGMAC_FPRQ; + value |= (num_rxq - 1) << XGMAC_FPRQ_SHIFT; + writel(value, ioaddr + XGMAC_RXQ_CTRL1); + } else { + cfg->fpe_csr = 0; + } + + writel(cfg->fpe_csr, ioaddr + FPE_CTRL_STS_XGMAC_OFFSET); +} + +static int dwxgmac_fpe_irq_status(void __iomem *ioaddr, struct net_device *dev) +{ + return __fpe_irq_status(ioaddr + FPE_CTRL_STS_XGMAC_OFFSET, dev); +} + +static void dwxgmac_fpe_send_mpacket(void __iomem *ioaddr, struct stmmac_fpe_cfg *cfg, + enum stmmac_mpacket_type type) +{ + __fpe_send_mpacket(ioaddr + FPE_CTRL_STS_XGMAC_OFFSET, cfg, type); +} + +const struct stmmac_fpe_ops dwxgmac_fpe_ops = { + .configure = dwxgmac_fpe_configure, + .irq_status = dwxgmac_fpe_irq_status, + .send_mpacket = dwxgmac_fpe_send_mpacket, +}; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h index efdb5536e856..b74cf8f2c2f2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_fpe.h @@ -5,6 +5,7 @@ */ #define FPE_CTRL_STS_GMAC4_OFFSET 0x00000234 +#define FPE_CTRL_STS_XGMAC_OFFSET 0x00000280 #define FPE_CTRL_STS_TRSP BIT(19) #define FPE_CTRL_STS_TVER BIT(18) From patchwork Tue Jul 9 08:21:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Furong Xu <0x1207@gmail.com> X-Patchwork-Id: 13727427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F146CC3DA41 for ; Tue, 9 Jul 2024 08:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ETQ1Az9wlQRIwVfJaj8s9DEGWwFkHYmCUfhq50YE6H8=; b=EfSm33E5xGAXWf8+1ClqhnMrdm r18yvsjJkvHrTD50oH5s2W/BAVl7EkflXTedvL9LY1JyPGu754ISnGTolwRLMIF4FHRh+y25qYoG9 6BJztUc6Utd5EJ9fxl+FPES9Ekg9PNWS2poiFeFhTJzavhnvclSfEhGjIUQVjUQGvI1pMf9XUvgD9 5QHX40oik93G3HO4+FK6hd2ToLNgJCU6SAeCjRSGvjOI8s/xpQC9048VJha6LpOI0h7daXVgJSWaL ar+nEgkdP89zO+Ru+3pfKsjdX3G+HAJHEllQ6dCBzp5kJiS6mrO3l7TwvvaSgqoypIRlmlBazVMaK VdLgz43A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR69B-00000006OSL-3qHS; Tue, 09 Jul 2024 08:24:25 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sR68W-00000006O7g-3j7S for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 08:23:46 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-2c9e37bdd6fso1792415a91.3 for ; Tue, 09 Jul 2024 01:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513423; x=1721118223; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ETQ1Az9wlQRIwVfJaj8s9DEGWwFkHYmCUfhq50YE6H8=; b=D+4oeR8SwMHXD7jyBbs6Z4+MKXsXNeKEtpwcSuDINA7dhYriaVhEaPMpE9CZ069R9Q pZinfcCQjmUcqz1u7itOvZ/dzyoEaQhzINZKffbYDGkZ63QQbbsBtqvv+0VLAhIDNURP ZOiRnfJ/rZx2ThfR1g6Dz88H/DBqpuANDbZtlKPwY+EO9gf9/rXyuEWl+XAKzwAnLOII YFOV49FMeVojkJHQDlXifzr+qcetletrQ4N3rF9FAKCamN77bdgAHbQM11L5sXJgMJpY QzxkQND5n0etdoR/ioFEf+6Wx6dlAG74qVsdxwBuZ0o2/8heDnoG+r++nXKnwN6Y97zo IACw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720513423; x=1721118223; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ETQ1Az9wlQRIwVfJaj8s9DEGWwFkHYmCUfhq50YE6H8=; b=sd44GHHXx1/4v1f8U3nj4iEEu/exS4wGH+sDeVP/V80X1digbWWwA3nAfJwqvPYmR/ R1UVHJAF421oTHthBdqdQ97nNnmypbpvMN44FkKowfxJsISM2xceSntf0rzNd66KpWLn KGDvyMRWZiJUSmxgrdceEnjW4ZZZB81zZaXtalKzSwA3zxXbP+JmfJiXSWr2ZtcS8bNK 2s/cb+3sUCnvVsCJFNEr+ooQ5/d1F/6KteiFnv+kgBN5ZVF0MjCK6y5GALkYDNdrhTpw RvHA7de5iVPSR3h7Dfm3gIhmGeIjMLXTxClU2ZM+Emmu9byO8P3wBBWTF0pihThlPNGg 7vRA== X-Forwarded-Encrypted: i=1; AJvYcCWvt4gyl1MagdRxV+FtBNqj3dMkvBLkeOaRaWjQygwzXccn20/l6wdz5f6pPeYf4p9W3pEzCXQp+3gQmo9rup1OAOYSJCLAgHdPPWMo/tB1y0drdXs= X-Gm-Message-State: AOJu0Yyqf+fRLkMCltcEQbyGEG2CQ/oJhvvu5wLsGRW1xpvrFc+PnQH9 0boPVzxA3b5LzaHTh4neI1iKT3eik7ohWaqhClKv1GS99Y2EgRLS X-Google-Smtp-Source: AGHT+IEVYnLUHa1kgLdWSapSU4Nr9l01XJ3I7VWvMs6KV7BVQGoIhoK6qMFuFZbgFcihFFyg/q6Bbw== X-Received: by 2002:a17:90b:110:b0:2c4:d00a:15cb with SMTP id 98e67ed59e1d1-2ca35c69723mr1851012a91.21.1720513423275; Tue, 09 Jul 2024 01:23:43 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id 98e67ed59e1d1-2c99a92a430sm9588929a91.4.2024.07.09.01.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 01:23:42 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Andrew Lunn , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, xfr@outlook.com, rock.xu@nio.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v1 7/7] net: stmmac: xgmac: enable Frame Preemption Interrupt by default Date: Tue, 9 Jul 2024 16:21:25 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_012344_952739_89560686 X-CRM114-Status: GOOD ( 11.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Frame Preemption Interrupt is required to finish FPE handshake. XGMAC_FPEIE is read-only reserved if FPE is not supported by HW. There is no harm that we always set XGMAC_FPEIE bit. Signed-off-by: Furong Xu <0x1207@gmail.com> --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index c66fa6040672..f359d70beb83 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -96,10 +96,11 @@ #define XGMAC_LPIIS BIT(5) #define XGMAC_PMTIS BIT(4) #define XGMAC_INT_EN 0x000000b4 +#define XGMAC_FPEIE BIT(15) #define XGMAC_TSIE BIT(12) #define XGMAC_LPIIE BIT(5) #define XGMAC_PMTIE BIT(4) -#define XGMAC_INT_DEFAULT_EN (XGMAC_LPIIE | XGMAC_PMTIE) +#define XGMAC_INT_DEFAULT_EN (XGMAC_FPEIE | XGMAC_LPIIE | XGMAC_PMTIE) #define XGMAC_Qx_TX_FLOW_CTRL(x) (0x00000070 + (x) * 4) #define XGMAC_PT GENMASK(31, 16) #define XGMAC_PT_SHIFT 16