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: 13727413 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC9D7152790; Tue, 9 Jul 2024 08:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513365; cv=none; b=khHOh+7q3B6Zw2QunLBlyE2U5WH4OfPvntP8NzNFSawO2zFBt3k0Rjpd6yELXumvjI5U++D1c6DvRzLU5lWDABUEVyuJQzS3QlV9RYtWfxig9QOu2A6US+2SuUpE18i0vshtIlsMFlwLvpcWGxESUuOJxKmkvT5eVPv8+eMazzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513365; c=relaxed/simple; bh=pukf2ZFmWYgdgj+I+fGtKpAhSns8eXa/8zLwp4d/F34=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l2Va7q7g0vfh/GK5HkXPKyA46nTGt8tUxUSgNFVV6/3QIE8vb6zLd8R6Oh9ZBA2EKvRkc5tDqz4SuVQSSA3Z7UerRkIRtVY6bkb0WNsN9h+RY/hUxY785SZXApK9q6DGlBEULYB/6kNXoSLY+LVR1bkPSrnaLkk22zQMWqfpYgM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=YX3fUXYW; arc=none smtp.client-ip=209.85.216.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YX3fUXYW" Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2c97aceb6e4so3353521a91.2; 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=vger.kernel.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=YX3fUXYWc0c6OT973d2Mwwg1eIMIBtiEfIWffJTntgchgRdcoI+VI5NhGdAs1+24G/ syjKikwGM0Tr9cBX2IKK/j+sZJz9JgzMSwEWxc9tNYRRq3NSiYH9kj2PsxDL1+FqZ0b0 +hO+X4F7QVDsUcSAg4uIPx9drzBbY2aOIXQ56nFivj8oNFBddTApn/Nqi+Qy9KKORVXH I+K9XtmLEFUl4eit7Orv4Sr1p05yb+ODqKimtEXJy70EAqqW6iTHqRLw+ntkC22FXU18 YogLOy3iLn1QNZeOF6rsMyOY/UcqgSHzGtSherietnRhQjhNFiZ+SyVWxhilsRE+4LiG odGQ== 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=on0FBokciThfYjT1SVO0hKk4R4uBORZgh6HykjEIoBFh/xCqf3/+lRGlx806hdNZCa 2rHG/KQOuDN9rm5p2z7XjM6DN18zPjUorSDoRIDm1wZk/E5b0Rv6luE+0oqpMx3NXooa Xy7R1R+9LuFpJE6FTEdcYyCTOd/lWPysMoqdLkCL7S/Et653pJP4mVJobGy5DfPegNS5 Y040jLyh1x44CEIZQA1lR+6HyAXJijR3gN4yyRt76MGIYNaDtzd4s+kwQ+Km8mRKhaMa 3LHQp1K9Epm1/T8555SbUX3wHnK8QIVBMBqnmmRy0PTtgpb7zefSuNLOY4sS/aXlJ22w YVTA== X-Forwarded-Encrypted: i=1; AJvYcCUZSqTusp54Y6XwNFjr9/ExywX9rneqTmAiIdyfl8uds7ou7lCvk3RIH4IYNg9Cqx+0JwnZMQ/+sZjBjIGg/6Ub0Lw6RuIXXMWxYvHR X-Gm-Message-State: AOJu0Ywu18KWEZnB1BkPg/qz8X2EMCyl7dqzQsCYlSLWalf0040PWatz jT8VfuBVzer255mRhw237VkcU/qzp0txNiYlwhBxTbXKse114A9Fb4fS5Q== 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727414 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A3DF152790; Tue, 9 Jul 2024 08:22:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513375; cv=none; b=Vo+Z4x3+PXk9ZmKeX5XTR9aEGN2Yu+kx9bVjDpdg8vGLGEI/wMlhTIh9OzM8zvaqSpBM7g2SI3oIPDVlaNBIneAjzV8pqKt2nqTCZ2buvHEvGK+2BrNzemcGjPZcmkHVxYDdcaay/GtejNB0ve76YYS3U/E1uj3d/4wew6VGcdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513375; c=relaxed/simple; bh=Hanol2veyTqozQGRSLQJV2JVIrrmZ4vWOOE5XIcf1PE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mLOnNxtrDPjTD1NdNWVlyTAHO5T0KXaZfSwkcVJrudJurTU5xWcZipMNgQTVTXJz83ikkLBo1ZJMUsHWimy4wXA593fmHtb3DAI/OS2lwnakqnPvezFl7d6Rr8Mwdj6gUgWEnExijOtpZFe3PJkpuF64WwKxn+MxGKsAVZi0CDA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DXv6RFOy; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DXv6RFOy" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-707040e3017so3243235a12.3; 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=vger.kernel.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=DXv6RFOyl2+rglc0ZxQRjxkS3FWtoyvxs9HLPSNQcoXUBejQoSlF3+UxEF6PyyMGaB 7iefTSeA0sJ+pwARoe8lB0OduE9bZ6E2hKBuF5Rb4NXQ1Pozd82y75YxPIxjn8czYz5u Ij3zk7nqwwIwVuUaJXEdV/LmzmQZ6B2vEt8JT03iS5DmZfHtfa6GI64F3llEzaFcBBT6 dM0cEEzVW9tYwLPUzTGNNKnxSFPhqz/farFk/CFtdJxsuvfEI5OreUMJSoySVa5mkcYX X3nnmX6+2HOhnh8x9412TxZ+pJcsW0ukTyzaE+dRGSmqL/Q8ovLFxdiT2a7h3PtR0Rsk j2RA== 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=wlcI0zO50tJl7B9qs2EPolT3xHBx9LS5JfnjBkGAH6Exhwqfu4pmgTqNDErJCiSPEU XhQtlnz8clIzCWg0PjXxmBkWq3a1bgM2wGFeMXtwaiiECYQFI58MRLRFhpXQoruapwZ9 6ufwcYwNj3YuPnjDO9w+WvY5FeSOCv2N6efCxhdyTMK7fn1vyrTHQiD+lLSSiPrSWcLr kke9isgamv/4n8D/1uwReGcqNDAqE8H2A8WeAcM/g/9UtuEHIg5uegb2PN3aka0CIRzr 6BDt7HKMIRx26EQBHeQgKeP1pS5+VwIr2XCzu3UyIxLP33O8mmXZqdws/Ek2DJYbD+i9 C78A== X-Forwarded-Encrypted: i=1; AJvYcCVWUyYY5wwn+ZcpSpPLWDYpZ0Fydy8Vpb7zzdmF2cjfKh7C40qyG6EXVIhlV0e/HSglEvB3sTX5CS77+lrrQOyb1KptCewOiq0dDhq7 X-Gm-Message-State: AOJu0Yxu9gZImC9CS1XVALPksb26zMNM+eFfXn6Bqyfmp/5/xYSI38Jq CyrqP1af2ImMtTgIGLZYcmeaG6i/qxathqobl7NZl7nYq8DBHZFv 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727415 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f44.google.com (mail-pj1-f44.google.com [209.85.216.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 723A515252D; Tue, 9 Jul 2024 08:23:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513385; cv=none; b=kTz+Oy5fLYIAn/LrDL253iQmAk7rPEPb0A74j0bpUFlAOoA5I1PuVLq/2oATuELaH8K1OIxjpoBAYQV3vfREICFew3rp84V5Cp02bdcna7+pqPGZ/wj7uhC1at7LrVArol6zS4TVZd8gkWyczPoEsEloSgQS9YFdV8F3mSuRvOc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513385; c=relaxed/simple; bh=PF04ATtnNRqM/BWo/fqGDFpvk1WaS+H8YY782xKK+UM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ui6yDgPQnyCuwo3oLAHHexBHBe6rvh3GKwqcGV8vfTTK5qyruizrIUR2WD0xSGQ8zfalGA6Y9HiEH8wJj8Keqx59rl65LuenXMAAnk8/JB76dGKprmdIjmDaMxPOA/2XJSdQG8hYF3NKxlsQEqLyL5zN4AkX/0lmfIVfDBCEe4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HEikvHgQ; arc=none smtp.client-ip=209.85.216.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HEikvHgQ" Received: by mail-pj1-f44.google.com with SMTP id 98e67ed59e1d1-2c2c6b27428so2777909a91.3; 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=vger.kernel.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=HEikvHgQNMjPv2cQGX0xhOejHUGqMY7teuXaL/PS9OkFQkmXbgCAX6+mADmq/deLlr 7hojfoNPkKI5qU0QSy1vjz4P9NMsXSP0voiMaX0xLlEC5UK/IgBxX0ZzTNSXoFM3xXyn c6mHWfjdc2Ngj6gEQQFPX+uAqGxggRjZDtQ0E2tGkb3a0lTfX/ofHdgXmWnZ/N+j6pdb jWmkWuARTIAp9W+dI5R860Plt04hiotsLulf2QNIQQ2bjjLhgp8ZzHUrtXzbhgxp8vK/ vfQpLjC88rh4bG5g1zkk8ttHlAH1mwzT3ZabCu2dR+buYSJynCe+8yDRxlk6JLRJRFMD xBEw== 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=JQdkBAQBWJAPy4CtJ8MneefghDikQf3aNEKaabGaX9EMrM0fB4TD9JM7ZuveKAr9fg 633db12Is20ERz1jxQi3X09sPAM+PYzOXIs5LLk2vr5yu3erN6dJeWQZymhs/QAoU/Yp B6dz9g37kTWRFTazl5uJLjS/4+rBGFQPJJMtq9ensm2xKPbPa2e4TDqUZe/QqN3iW0Zt BsPh3JpQwmVpc7/OFtQab/g2SxkKMcoKoFp3UcH9U89ACz0MoE2nYHrJqeKsdUpXinp2 t7S44yFXl/ky8c2WlLi+JsfXxNGYvjPL0xd6AXCKt9FY2iGKk/AXx2RzB10QEKdmywRQ yAJg== X-Forwarded-Encrypted: i=1; AJvYcCW4dexOgwmF5PMfK+5a79oIFO+lf2tHCK1opv7e6a8nPlPIHDXPQvm476n4dxMW3in9Q/J1WarcZS/jY5eXiyoAPNAzu0qCEqRZlJ7U X-Gm-Message-State: AOJu0YzcCFwVS6mCX7+lA16O3/8YS/NLBrNfpwjGVriznwXIExBUB2VN FG3tu8XWhcW2Rp1RqRZE3iHEx2rv2Yqq8M2BBE3sXWBtsNSINVRz 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727416 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7342B154BFF; Tue, 9 Jul 2024 08:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513395; cv=none; b=Ob4dkFFhYmLWROmsSIL8QQ8FyHXeAl3iqmo9hOgxi+UFnIjcglbslDXteQEiGHcipzwComG4kSZMcNI+Ol5+CyDVxmR/OulxMvlmWREWqqin8m4O9JExhhHSvKbewXrWUplC5ZutzUjhrmgYg3YWXh2VtE/BVbF8PUAlvtvLZE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513395; c=relaxed/simple; bh=j3+Fqcv4SuXIX+AP4voaXbaU8e6nuOk+mCcXfqpFsQA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F8ioURXyyBvVkvEZmJ1h8+5blPbKdUsSkypK4C8IljDlCVoGsIevG7GJ5wobkKv9g7/6w/mpd/0aQD3gdxeEAuVdVkzrIqwjnWE8HGalkhsP8cRsEyNcu2fJAvMQvAFIEbsPyc+p7Vgjs0IL5Q63pXuPOkPOz+JL7AQIGcPEVH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IRqZBPEJ; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IRqZBPEJ" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-70af8128081so3025011b3a.1; 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=vger.kernel.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=IRqZBPEJFY9RXYKtf/Qc4MLqdEnwUMyA59bFP5qIDPy6vnwxz7BnwazBoX1UrBAj8C Gp+PaAbs4dd7U1us62rSyvtyK+6yttsf02/+CVjJlb7o5c538me8Bxuh+hG8F4DhtqTx mU0AI9KUx5rG+4sY5X/ZLM/NWaFTvE6nLZGzAsgA8zQbRdkmLaxHPwHLjY0lyyHij2lP DYyDfBzfcmUgVu1gtT+MypEG1rGe1StN0ktBpuPSVFeXzYp6HQx7WLnqj6ajOJA67Ldt hotnOhydiKTAhiPGH0EkYKk8QWMFkBvXoVEM9zAnC4VS7t7Uc050rT6/DC1Uq6/d8HxE KWFA== 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=cut0SCz/fxk0bjHxHEhK3mXT54ZCMRihRdBvL/0+9Wig9f2RonENcLUjkKv32F+uhy EpkhrxdoLlALhfGvsZ0qi5IN7X5RiwbdJpLSIBVeEShllZQjXi/3W5cGynjT5OSVsKhS oADpjxDqn4iaSQIwaWELC9QUq5r9574BGYleX0nuDXGlKccFOOS5l63DVyHaO61PcxyB Av499nTTwW+YX/W3YC0SP6my4Rc/pikf1Pz8sS9vw7p1duELEuGzLx0AyS3wPb0wCZyi ba72PhwnZpTjrbj7fglqjCz1QPWDp2OChGMT6Y1CqWTma/1wSGTNGNHRniWD5alAg8PV OLRA== X-Forwarded-Encrypted: i=1; AJvYcCXCXzAiwzOToQpWS9SR2PvmGFwkghXs6PCnN13YXnASkh++ce0YgfV2x67DxtHNRP2PpfAaL0IjKtoAFj1jgOe2a1VJv0mC8++SpEcu X-Gm-Message-State: AOJu0YzJb6X6jCcrLaYG9v5ZcimFsj3sBgv5mar8q3kXid1UxehQNF+g ImEIPbDDd0F4+nSUJzE+XgnqHgr1BioV/u9PQazBmIIjDPJqBJq1f4LQbw== 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727417 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26A131527AA; Tue, 9 Jul 2024 08:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513405; cv=none; b=cHvHNQeOnOcbRvUxLKOis2dwIYlWbLQD6dLI3JVwW6vBh2b4K9H71z3jddeIre7uBoWv5B5p35gBKC61MNPB3umQKlv/NGnLLqR26utQZHUaKa2gBMmYHxo1WERrv3BkPUyJw8YEVawLzNq34GUZnxl+10xK96XulDzRHIhmn7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513405; c=relaxed/simple; bh=oEiQb2bvaGSOSuz6qMe7NADDXyIGC4xctDpoDBC1Ibw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TbnxZOG3CjLWjfnIUAndfBbya6CFZkM1igLNMH6pqC1CdqzCwze4IaOCg2KVnh9WbbSuMCNfjI3EF6IEMC6adGDpP49YqBvp+da0A18lOazacY8aq6Jf5x7uZrm2fP2ED/EwXr3vJAaSCf3YJbu132tTJRPx7S4I9fu90dwPHwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H6njLnKa; arc=none smtp.client-ip=209.85.215.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H6njLnKa" Received: by mail-pg1-f169.google.com with SMTP id 41be03b00d2f7-75c3afd7a50so2442912a12.2; Tue, 09 Jul 2024 01:23:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513403; x=1721118203; darn=vger.kernel.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=H6njLnKaala6TMtivNJ84MY6f/hJF9FuKR7XGwwXZ5HgRBEIbmBjnoansBY7SvluwM ZhVkblaUSB0a6vGTVX1qvGNgrdouPVAT2awATsgjy8bNnmEVXKMHF+BoUn77aJNmayV1 z1kBO6LPWW9pTXHQri7Q+v/HqZT//B4ApJQ4bP+PmwVQM5JSeZsn6kdUcgZQYl8PB0f5 9BUrZoMAjvTy+kQ7rTESG/IbIH4RhoNfEJtjNdz6vBnR5ftKAmcI73piNwo0piRqFAdd 9caQIHIk4Q1n5BtPnMEXCU6uIUbyp1X68+l/jYWCbAFlp15cYZUE/J7aPCUQh5RtBO+z g53g== 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=vPum1uvzil70c1vHVBbeX5e4NpxX6p8+qUaxBQEQc0VwmGJ7jIWJTQXXTOU6I8mhQn xeo+XbZXIHyjxhZ/0IJaI/dqRhsjfSw4Ub+Pz4g17PosatxIA+4v694B5ENeRbdG4niJ eR7dy6dhoWsTKlg+69aQPXeP/avsO4/vlGHEtKjY+yAx+RFn5xfvedIJcOFBkQOHYTm1 ixZybNOvCibK+ch7XXKCrwlkuJdcGlzoYddP8nGGaP1T72ZEFDZUpFJe7dVJWFqywIny 09tZlBMDCPurJ7OY7koRf3R4Bu0obw7bI4SWNOz+jPdrtU+/ANo6ES4QKh+KW8GStkah 4olQ== X-Forwarded-Encrypted: i=1; AJvYcCUnbcp+qzWC8kb2FO2Y1sIgLGduEqlMcY1i7QCTcLC1crbPzz/af2rshlYjDtMH9o8llY13epsFUGMKmt4iHALq4WGqxthCxXRxK1NW X-Gm-Message-State: AOJu0YwE2rl+T2AyoTPBzV57xXNhfSF7JcFlnKs1iLQWuDngtEFvAqMf 0wt/EJGIaWUy/N+amoxJMjtAW7MCs80DTY+bXpuKKnjcsN37TDAf 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727418 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2FEBD1527AA; Tue, 9 Jul 2024 08:23:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513415; cv=none; b=YmkhufpDP5B90p0CNJfvD+9Xo8tcHe/3PwmejhvOjbcJcnbcbW8sOZv9mi8qv6igb+s7UfRsz0jvzK+AmT918LlSd/Na7K/W+1IHbjpq44dOBXZD8JfsA/O/oWPKqS0O4Ov/wSZzL5Ly4XaRNbRZ62YLExKbUV85J+h4mFCzrPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513415; c=relaxed/simple; bh=sOT4iTDzWIfLs9UA0R4XOev6spnQG9gjkKs4PSXQU0o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NHqdjgS2eCYr7fTajly0NydcasqGdwBahs+/UUqUHy5JgKk0/70UKDYc0UCuu71YdQFi3Dmos44cNEGmrgDDwPwOmQTcZc37oPDUqIl0MNtLvcoTWHAgJe5WfMavx/HiFsjXUXRNurHGIDrmA4qsXa5Qdx7DblE57g1w4nvYe8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gOhYVyN4; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gOhYVyN4" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-2c95ca60719so2862087a91.3; 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=vger.kernel.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=gOhYVyN4HWShWBlYHn7n1c1X/AqYC7dfJQs4aZ+KOWbnrVzyCbF3iaMbzu7pVkscBl yITWh+9YAATUoRweC52CVrPU2S43glCdep2vdjA+MhMrWXIroY4I2TSa/X3lLjFu0ZwR 4DqluLUSeT5gp/2Sz8l/IrgMAcLipLjvi0c/qKBkwVgiS6tw4dN5UFyAyEqxpKuWGSRb 48w3Ikgz2iEwW+lJVU92oD3qUhxZKSxdP42h7pmWiSiwqAKNJyb4F9vALb64IkPu6285 e0KbwUxWiMlLvOQk4YCmgrrGO8cWHOK+pIjOU0DUlLRSjf3Tkiq2UWPwzHbMRi16fyzx XwuA== 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=tC8D9fm5nX25M2uh74HuIl9tZdR/hcsd/A/FF2KoL6BON3zNGDYIomI4QDLBCf0+ZN QXsnOleErvgZpALNuWziyoZNU4VE9CxGk/iGciHgLdYjOQobNRPG7uVuYK5iwiEpyiOw F2HcxRQqrU0H4iX14+R6JnIy4i7diFtZw/yA+O/0pLx0qp5YitO6Rm3/MPp5OGnyyFXl V8zwH8V/rq3dajdgePi9MuzJmjjJfhcw3Qzr1+4OaTDw2LH2iK+aYy/skoku34RRgplH vGvUK7GeATNMBBoNe2wNtiSclLQuwLPYQYfgSuA/5+vT42FfKshpIGoZJ3H8gZi0/yxD zH9w== X-Forwarded-Encrypted: i=1; AJvYcCXadAVlQuKuJlXOvwAWdkIiywlaauEK1nsEyztXSdngX9QyL7VWr9+ilKeDfRbwtW74U8Qo6EImqb0Hihas7uRDydnZa/Jcd6eka58Z X-Gm-Message-State: AOJu0Yy8kcpNe17bAPQZccCEMBDb+NE7wfOFPnBJ5jkRKZbb7H9kcfP3 cfhy90InjL9edrcWJRTISxspMPhx8rlBNFXVd/RausCpQ95uyOxo 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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: 13727419 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0A8991527AA; Tue, 9 Jul 2024 08:23:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513425; cv=none; b=Dkd+szTnWsAXcSowRIwvdCCTkxxFBzUXGRBCQ0F+pdMKAMeNlV2avfDS1saE4PJQIsfZBG4aiNScHRAo2lfpPMks6y8bXjShFuLVLS4SwyDoU1KCn9zj73TtA4agYFpecROjuMMgah39xmTaF+dYbOquK7uFsWPCeH8Ck8OilQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720513425; c=relaxed/simple; bh=SmezAz6lx/b6Wh0eCBWbS/9CX/6rhZ5RMEV0HZ8cgKo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ue76WzxjX6EYVwX2v2s/xyu335cZIQ/EWyEglCbEhMZ/WTJajSQ22/U5OCDBDVjcq8vxQQU1WQlrVQv5HBD39imONj+v4Lagbb5+tuqLoItBSHMsWg+cFCg13J5wauBXjPYaTc0p46CbwF94wAKGaS3jUexyVP8b+Pio5WZu69E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Sdv4cS0+; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Sdv4cS0+" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2c97ff39453so3303606a91.0; Tue, 09 Jul 2024 01:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720513423; x=1721118223; darn=vger.kernel.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=Sdv4cS0+M7i8JyLl4uzC9RI6jk9PvEcNqBwviGATIfsV6NLFSaW6ZCHIp0IYfk6zaA 9r67Pa15dDI8XKvfeNjM8N085Z+80gFgt2gDILledKFcVru+Sc3W6kKjGwNygxs7iweT 2lfwyhj65J8/FedF7nsCWi+u86PCIi9M3liHb6r8d0Uy6zOpbU1J/5U6bVp+cY+YGRTK nc0rQw+HBJKy4vRwixTQi17q4RQG7VqGGLceox0XvXygqLvaN3PhghFMonivGtpNvqAS TYVgjd6rjYPDgJ+DsEJP5Itj7ZpNUCoNR3eIofI4SVmzP03t5TZqSds2QUqdylPbDu36 IUxw== 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=bjsT4+jFEFDGjnOQD8IVG+G4bP/8XcsIMR69jhaDr6R8D7LxIP1NXOe9xfni2d5UGq K/0BowzbHbHLci0HCjspazscfFFxYSqQ1fnQymFHbS/A4cyl7DpLWwvjCTTUXetQKCzk n4AmOM3hqB6hrovRbMrIzvJllaF9ey/uCcgiEBWubhuM5reXfrNRjUckYUacZBSbQjN0 yNPSI7Zx4XkhQt633BkXE+8gxduxU6SGSD9X1H8mwySrt5U2O1UNpMgWbjVkLDjnoEb4 6yTkrSGQ+HT7Jgbgum1A+aC+634rOhPJV1sDeKlEZmDflhG1PqOcc4KXj/0wVg5FWPe6 gp4Q== X-Forwarded-Encrypted: i=1; AJvYcCXUG+NAnuD44WnVR3t38FZJ4Wf175qHoAerap9mVTG1QgKBP/eL6vV7nzP1PJseMNwyCg8w3g80Zdi82sSNVNrQixT2SzQ7Gdm1/4SC X-Gm-Message-State: AOJu0YxloAve8nwuL7WLyirZvoKN2DBQxJcAp0qJPyEhiD6xaddoBwj7 m4/mTRx1RdgNQ7Vd1dBZSLhHvcT51ung030N9JfxYO0Mynghpi4p 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: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.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