From mboxrd@z Thu Jan 1 00:00:00 1970 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 54C9FCE7AA3 for ; Fri, 6 Sep 2024 12:42:26 +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:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=j2oDWupgCB0EJEDFj7Qxwn+hUjKM6noFGnO8rTsV9Zk=; b=g0Y5JOUzuigSrXhqKjROlUnq4/ 6bTZZoiTX23T7cGR5fNhdwkvZbyt00UvZaYzcUeLb9yByO5x0Zh9U309GWvDrNPvIhCFdwz9RsWzo NZ9RyA5jWsqwIxs1SFESPgBbu5IU0dcoc5OE7jBAbqrYnblk7JhGH9EMXQig8pGKzSDRYpFf8/e2v OfIYFU4XITegniea+fnzg3/eqp1PJZHMo7tdqY9hNdKeDlpEf9HtwQ63IZ7PE5R6rN4RNX7x8fqPb 0FZ7AW0LeiZFx9A48UMiE1JG8VRf68wlhTtC275f+Wmj8O0TaWa2clY9xJCZwMkdsgEHAhB0s1yOh 9uuXfwYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYI4-0000000CCQ7-1mqj; Fri, 06 Sep 2024 12:42:16 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smYH5-0000000CCHk-2EID for linux-arm-kernel@lists.infradead.org; Fri, 06 Sep 2024 12:41:16 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5c24648e280so180792a12.0 for ; Fri, 06 Sep 2024 05:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725626473; x=1726231273; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=j2oDWupgCB0EJEDFj7Qxwn+hUjKM6noFGnO8rTsV9Zk=; b=Rz15Zeb526pGgfR1ObCl6Cci/oWCGs0chXrLqpxA1xanx1nUrQD0eEuld65TulhMEB DaEBXUsIxrQE9p8tT3rqFnlYpg3DMn4jOYqII6Zi/OTu67IJWaF8VfvpNoZW+vHIzEvm VgEj+vwtglC49HXUYKh1yjTDJHDXTZLnXm/mtPkg/UF34s4AHaanYbY59Ny7RmTTBCyf 3/zrjo5vGiBpcpjY8MJLfm//mleZbcNx4Q+WGfHjslGoMJV746pCmMQLWUVPwXLPLqAB c2yB1myk8yVr/sOCiyrXhtyoDXTiBnkfqeypOCmmaGh4SDkVd2XthYNcsEuDAvj3+/r1 BnWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725626473; x=1726231273; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=j2oDWupgCB0EJEDFj7Qxwn+hUjKM6noFGnO8rTsV9Zk=; b=oEWLUTEciRTBLcFKmC5PPKUS1Jy1ynxTKNuQSUS6A/PwfrE3FzaREDsMWBbyvuVvqU yML+aVhCB6Db13+ljzv5NLlGSuBLY13jamUsydsA7iTTXw/xy3i3k9heTYC3QjwikV8b oCApDHe+jCNK/L3lWX4tHiVhT1c0SOhtd+uOM+8nqzXp0q5BVjfIlE4kw88EMkjoNJoY gvsFMIyXjHTLS3ElYQbrYSD8XbK2y4oh6sLT4xoUuJ1RUguSoqxUMrkqki+7vDiOzNsu ww/2hiNHw9tZ5+16ooMcuz1kRigzNwPZoa3Kw3srcy8waQqxQcLXpe4xtS04pNuO1BCL 8txQ== X-Forwarded-Encrypted: i=1; AJvYcCWR+pwG3YijBBQun5a9R2rAJxstg7L8hq3bTC6xSu4ZEDcXAbm7oKGfBWAnGFUhsrnHt/xc4SdHBIrYG5NRVzFw@lists.infradead.org X-Gm-Message-State: AOJu0YwQNAM7xWEdo/Xbjdh8E8lWxm9+HfSdIHcdv5uvEzx8xJGZViKQ yoDZQkuOHUQbrrzf/b4OjBPuZjIvwDlUgb0bzD8po3AkCWHtU/oF X-Google-Smtp-Source: AGHT+IFM2B8brZFs+Lrn+MmgYrIC5y+ofetm/PeWuFXvo6OEHyA10imDyPZrf3L0Ib3cEXormlIhXw== X-Received: by 2002:a17:907:971d:b0:a80:a23e:fbf9 with SMTP id a640c23a62f3a-a8a88845be5mr83712366b.6.1725626472582; Fri, 06 Sep 2024 05:41:12 -0700 (PDT) Received: from skbuf ([188.25.134.29]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8aeacb588bsm54664566b.78.2024.09.06.05.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Sep 2024 05:41:11 -0700 (PDT) Date: Fri, 6 Sep 2024 15:41:09 +0300 From: Vladimir Oltean To: Furong Xu <0x1207@gmail.com> Cc: Serge Semin , "David S. Miller" , Alexandre Torgue , Jose Abreu , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Joao Pinto , 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, Vladimir Oltean Subject: Re: [PATCH net-next v9 3/7] net: stmmac: refactor FPE verification process Message-ID: <20240906124109.s4p7lgrycfgr62vp@skbuf> References: <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> <13f5833e52a47895864db726f090f323ec691c62.1725597121.git.0x1207@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240906_054115_594680_DC87B650 X-CRM114-Status: GOOD ( 15.91 ) 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 On Fri, Sep 06, 2024 at 12:55:58PM +0800, Furong Xu wrote: > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -969,17 +969,30 @@ static void stmmac_mac_config(struct phylink_config *config, unsigned int mode, > static void stmmac_fpe_link_state_handle(struct stmmac_priv *priv, bool is_up) > { > struct stmmac_fpe_cfg *fpe_cfg = &priv->fpe_cfg; > - enum stmmac_fpe_state *lo_state = &fpe_cfg->lo_fpe_state; > - enum stmmac_fpe_state *lp_state = &fpe_cfg->lp_fpe_state; > - bool *hs_enable = &fpe_cfg->hs_enable; > + unsigned long flags; > > - if (is_up && *hs_enable) { > - stmmac_fpe_send_mpacket(priv, priv->ioaddr, fpe_cfg, > - MPACKET_VERIFY); > + timer_shutdown_sync(&fpe_cfg->verify_timer); > } > > static void stmmac_mac_link_down(struct phylink_config *config, > @@ -4091,10 +4068,10 @@ static int stmmac_release(struct net_device *dev) > > stmmac_release_ptp(priv); > > - pm_runtime_put(priv->device); > - > if (priv->dma_cap.fpesel) > - stmmac_fpe_stop_wq(priv); > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer); > + > + pm_runtime_put(priv->device); > > return 0; > } > @@ -7372,53 +7334,88 @@ int stmmac_reinit_ringparam(struct net_device *dev, u32 rx_size, u32 tx_size) > +static void stmmac_fpe_verify_timer_arm(struct stmmac_fpe_cfg *fpe_cfg) > +{ > + if (fpe_cfg->pmac_enabled && fpe_cfg->tx_enabled && > + fpe_cfg->verify_enabled && > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_FAILED && > + fpe_cfg->status != ETHTOOL_MM_VERIFY_STATUS_SUCCEEDED) { > + timer_setup(&fpe_cfg->verify_timer, stmmac_fpe_verify_timer, 0); > + mod_timer(&fpe_cfg->verify_timer, jiffies); > + } > +} > @@ -7875,15 +7874,8 @@ int stmmac_suspend(struct device *dev) > } > rtnl_unlock(); > > - if (priv->dma_cap.fpesel) { > - /* Disable FPE */ > - stmmac_fpe_configure(priv, priv->ioaddr, > - &priv->fpe_cfg, > - priv->plat->tx_queues_to_use, > - priv->plat->rx_queues_to_use, false); > - > - stmmac_fpe_stop_wq(priv); > - } > + if (priv->dma_cap.fpesel) > + timer_shutdown_sync(&priv->fpe_cfg.verify_timer); > > priv->speed = SPEED_UNKNOWN; > return 0; Calling timer_setup() after timer_shutdown_sync() is a bit unconventional, but I don't see why it shouldn't work. Reviewed-by: Vladimir Oltean