From patchwork Fri Sep 6 14:30:05 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: 13794278 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 70160CE7B1C for ; Fri, 6 Sep 2024 14:31:59 +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: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:In-Reply-To:References:List-Owner; bh=MmOkWe3bWYqlIPHasXuyjR6OTIRVg7CwkvkDyagLUMA=; b=qRDak+LymuQAeqFxhfIgH3HWIf Sj7sVAVJx1Gim6RSlvhurE2aRigm8LqGHwiGaWyYnESqB1VtvvelnJmELRgECkav3hC5B1vKnSm8v 5YnwUzxD540cLwxQsLqm+VsKcrIlzuiwS4KphxJPgGClngVzmOVQPT2dxKHQFs5oiefuCYGrG9iTa f5kLDuQRrX9lYofnhi7qVDfpoa7q50Stg391mbZ5zgHKh3/qbM4KmjL9pdb8TOe1Tz56g/+8KAEo0 TX5UF8SKx399R+8MLA//n7ddw8h7efvywZ63cqhK10CFtJP1VP8dXM0XVqUuvUczPjwy/6TdVomHK Y86nIgNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZzz-0000000CXMy-0MIf; Fri, 06 Sep 2024 14:31:43 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smZyx-0000000CX3l-33lM for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 14:30:41 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-2068acc8a4fso21824235ad.1 for ; Fri, 06 Sep 2024 07:30:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725633038; x=1726237838; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=MmOkWe3bWYqlIPHasXuyjR6OTIRVg7CwkvkDyagLUMA=; b=fOlBQoExKSjZ7uYtyeA8ASq7nXsPQIuRGF/9hlu1uWufFdenW0SsuDO0DmOl6Kcluo q6zlYL5vpSqEaTWjSflboPCAR8EEOKL2xAEF6RhRibx9ril4hImNrrXvayzKc224LGIr tlC9F/QM3pORDlzimLgttvCQ4Z2d07UQ9929PyYYKnRsqYDknH2tdP8qjuVzsFIPymYs STgGLWFRU0DAZ3rRwMXZw+cmRKz/+3Dvr2VPk6VHfEHR1078+ZtWoBkpHoQ+LiB/IXmm 7P4jFkceL9xhyeoYy8oo1xmzjrCRPvWtFzJePIGLPm0l5tAFHbg3j6xG2/zyQr5LqTH3 uu1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725633038; x=1726237838; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=MmOkWe3bWYqlIPHasXuyjR6OTIRVg7CwkvkDyagLUMA=; b=AGlb7bMmUFnE4527HWnGAY86cB/hPvZef0Ru5KqML6qT+zd1c5huRtPaQ/V6crKAxI srjpVS0vQUrsyP8ucV5yT2BQ1WNRdblhc1j9N9hdcKLRMjEjnXB8V+BmktV+9rstXp6q rgpiNSVahGBjBgpwZU/h3ROaguDr8xMngCBnRdZnegQ5GYhlu47WIStz0PkUM/JWfW4q PCeSbSKiv+0hiHPNESlCNDAqX3l2uUyHgqU9t4OBBHQLDEYQWpga3OS6wwMEaCkmXA3T D3Z6VfeU2SNGyGzrlReWSWIIBLyTV2NZ9wSNfkg+C/whxOffQ4HxagS823GaHovT0wuU k/rQ== X-Forwarded-Encrypted: i=1; AJvYcCXsf1rAY3zjFQ4396C5otUj2QxxcPYwtLiZ5WoTfMcsEZqg8y02i+wI6Ick7ocqGlVIUZcLpWIT1rymk0fqm9lK@lists.infradead.org X-Gm-Message-State: AOJu0YyAYjwJx65NNokShrO7ZwEZfCmuZH78bKL+BNJ4vwB6GzjRkt3y 31txQjG/h6zbSrPEaSHuSbPuBJ8LFruy4tsuHLd9qqA2eSpspXPq X-Google-Smtp-Source: AGHT+IH6os/wJqKxaUijZ7r4QxSPQPk3BXwla9T3Qa9yn+zWQ8nBWAVCPpLlT6hUmihDvM4+R20QHQ== X-Received: by 2002:a17:902:f682:b0:206:a935:2f8 with SMTP id d9443c01a7336-20706f02a27mr681585ad.2.1725633037708; Fri, 06 Sep 2024 07:30:37 -0700 (PDT) Received: from localhost.localdomain ([129.146.253.192]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-206ae94dcf3sm43951975ad.80.2024.09.06.07.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 07:30:37 -0700 (PDT) From: Furong Xu <0x1207@gmail.com> To: Vladimir Oltean , Serge Semin , "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, rmk+kernel@armlinux.org.uk, linux@armlinux.org.uk, xfr@outlook.com, Furong Xu <0x1207@gmail.com> Subject: [PATCH net-next v10 0/7] net: stmmac: FPE via ethtool + tc Date: Fri, 6 Sep 2024 22:30:05 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_073039_793094_C5A8230A X-CRM114-Status: GOOD ( 12.66 ) 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 Move the Frame Preemption(FPE) over to the new standard API which uses ethtool-mm/tc-mqprio/tc-taprio. Changes in v10: 1. fixed a stacktrace caused by timer_shutdown_sync() on an uninitialized timer 2. ignore FPE_EVENT_RRSP events if we are not in the ETHTOOL_MM_VERIFY_STATUS_VERIFYING state Changes in v9: 1. drop redundant netif_device_present() since ethnl_ops_begin() has its own netif_device_present() call 2. open-code some variables of struct ethtool_mm_state directly in struct stmmac_fpe_cfg 3. convert timer_delete_sync() to timer_shutdown_sync(), thus the timer will not be rearmed again 4. fixed variable declarations in the middle of the scope Changes in v8: 1. use timer_delete_sync() instead of deprecated del_timer_sync() 2. check netif_running() to guarantee synchronization rules between mod_timer() and timer_delete_sync() 3. split up stmmac_tc_ops of dwmac4, dwmac4+ and dwxgmac to give user more descriptive error message 4. fix wrong indentation about switch-case 5. delete more unbalanced logs Changes in v7: 1. code style fixes and clean up warnings reported by patchwork netdev checks, no functional change intended Changes in v6: 1. new FPE verification process based on Vladimir Oltean's proposal 2. embed ethtool_mm_state into stmmac_fpe_cfg 3. convert some bit ops to u32_replace_bits 4. register name and function name update to be more descriptive 5. split up stmmac_tc_ops of dwmac4+ and dwxgmac, they have different implementations about mqprio 6. some code style fixes Changes in v5: 1. fix typo in commit message 2. drop FPE capability check in tc-mqprio/tc-taprio Changes in v4: 1. reorder FPE-related declarations and definitions into clean groups 2. move mm_lock to stmmac_fpe_cfg.lock 3. protect user configurations across NIC up/down 4. block stmmac_set_mm() when fpe_task is in progress to finish 5. convert to ethtool_dev_mm_supported() to check FPE capability in tc-mqprio/tc-taprio 6. silence FPE workqueue start/stop logs Changes in v3: 1. avoid races among ISR, workqueue, link update and register configuration. 2. update FPE verification retry logic, so it retries and fails as expected. Changes in v2: 1. refactor FPE verification process 2. suspend/resume and kselftest-ethtool_mm, all test cases passed 3. handle TC:TXQ remapping for DWMAC CORE4+ Furong Xu (7): net: stmmac: move stmmac_fpe_cfg to stmmac_priv data net: stmmac: drop stmmac_fpe_handshake net: stmmac: refactor FPE verification process net: stmmac: configure FPE via ethtool-mm net: stmmac: support fp parameter of tc-mqprio net: stmmac: support fp parameter of tc-taprio net: stmmac: silence FPE kernel logs .../net/ethernet/stmicro/stmmac/dwmac4_core.c | 10 +- drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 96 +++++- drivers/net/ethernet/stmicro/stmmac/dwmac5.h | 12 +- .../ethernet/stmicro/stmmac/dwxgmac2_core.c | 9 +- drivers/net/ethernet/stmicro/stmmac/hwif.c | 6 +- drivers/net/ethernet/stmicro/stmmac/hwif.h | 22 +- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 35 ++- .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 96 ++++++ .../net/ethernet/stmicro/stmmac/stmmac_main.c | 273 ++++++++---------- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 153 +++++++--- include/linux/stmmac.h | 28 -- 11 files changed, 497 insertions(+), 243 deletions(-)