Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp172185ybi; Tue, 18 Jun 2019 20:07:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfnHeV/BT/rsXgGKTho22sQTSFTKpqmvBoYDrK3PctcRyQWFDG5cjWssqsQY6ZqYD7/HHg X-Received: by 2002:a63:fa0d:: with SMTP id y13mr5672133pgh.258.1560913679723; Tue, 18 Jun 2019 20:07:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560913679; cv=none; d=google.com; s=arc-20160816; b=rM5HTZUWVVNJ2bguz4xw6pbzNeRlJeIeM/TLHBLTvyiCczfCuL/a7SKtI6CjW59167 htj2wZgH6KeN9jptTW2q0z4woh8UWEdkHXOD523sSuDmRnjAY2933yNeasY4ziKG0NZs bAkxE/DgLv8fPXYsttXSW2qEL3jdeXJmitfgDzaZpuce3dUEVTHI78q7G8KYlmmbqb9u 8TcWgcvUgYDgHp+5mX52AH75CF+CAIs4LkaV1kgwri2DuV0/oQASPDg4UvlI1gm5hS8Z 6g0Kxdm4hMhoKvRPwZB+xzEGOPwFMgD3YCyPjM7Fe0heSqxC6XhAnFlb8dh8xdJB4KZs 7yFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AixH9ESZvfDH28I8mSEmpRr0X0vbsD2WpNmHZWsXSvo=; b=iMZC3JqBHzEbm9JAxwEM3xBTpa56SmbI5D/dLCQOpNmXq7t65lZ7tacmI8xG8NaNnq KfkkAagDfTbKOo7s8iOmG/pmXt49diTT3FLZ4MptPyCWdtfhL+9Wv4IMJaSlZ1E604er +vTWr3aZiOCrNHmboFzgqk3DrmUr/Pkbw/8IhK33AixQdwD2SFEppi+/vyUl5l5JWaTP vgo0ID8MeWft+xBREDnl/hQiDGGfl4lH6DblGPKu8cEmdJ/ZbbYPPDul9gvqWD8jwdR1 ITT3cqD66cMxnndrn9T7PTIZZT5yL58HXcKMTBunbbunuk0vnrm0rdtUr3FZ0G3PQXTD 45yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="G096vJ/m"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si14197716plr.83.2019.06.18.20.07.42; Tue, 18 Jun 2019 20:07:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lunn.ch header.s=20171124 header.b="G096vJ/m"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730147AbfFSDHg (ORCPT + 99 others); Tue, 18 Jun 2019 23:07:36 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:38822 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbfFSDHg (ORCPT ); Tue, 18 Jun 2019 23:07:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=AixH9ESZvfDH28I8mSEmpRr0X0vbsD2WpNmHZWsXSvo=; b=G096vJ/mvORPe5syshMT/McfRZ GQp7+YgCBOxqh8/3F+cgK5JMNRkAEoQwr4UecZfmws1MCx8AnFA2l2UY08LjW4wTUP2jgHHHggG7Y bkPv+0VdzdcqH1BxqcBzDu6koTwDzPi62OvZG1Sm9S5M2jSnXoXOT5equNJ/KCaur08M=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1hdQwb-000725-Ue; Wed, 19 Jun 2019 05:07:29 +0200 Date: Wed, 19 Jun 2019 05:07:29 +0200 From: Andrew Lunn To: Voon Weifeng Cc: "David S. Miller" , Maxime Coquelin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jose Abreu , Giuseppe Cavallaro , Florian Fainelli , Alexandre Torgue , Vinicius Costa Gomes , Ong Boon Leong Subject: Re: [RFC net-next 1/5] net: stmmac: introduce IEEE 802.1Qbv configuration functionalities Message-ID: <20190619030729.GA26784@lunn.ch> References: <1560893778-6838-1-git-send-email-weifeng.voon@intel.com> <1560893778-6838-2-git-send-email-weifeng.voon@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1560893778-6838-2-git-send-email-weifeng.voon@intel.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 19, 2019 at 05:36:14AM +0800, Voon Weifeng wrote: Hi Voon > +static int est_poll_srwo(void *ioaddr) > +{ > + /* Poll until the EST GCL Control[SRWO] bit clears. > + * Total wait = 12 x 50ms ~= 0.6s. > + */ > + unsigned int retries = 12; > + unsigned int value; > + > + do { > + value = TSN_RD32(ioaddr + MTL_EST_GCL_CTRL); > + if (!(value & MTL_EST_GCL_CTRL_SRWO)) > + return 0; > + msleep(50); > + } while (--retries); > + > + return -ETIMEDOUT; Maybe use one of the readx_poll_timeout() macros? > +static int est_read_gce(void *ioaddr, unsigned int row, > + unsigned int *gates, unsigned int *ti_nsec, > + unsigned int dbgb, unsigned int dbgm) > +{ > + struct tsn_hw_cap *cap = &dw_tsn_hwcap; > + unsigned int ti_wid = cap->ti_wid; > + unsigned int gates_mask; > + unsigned int ti_mask; > + unsigned int value; > + int ret; > + > + gates_mask = (1 << cap->txqcnt) - 1; > + ti_mask = (1 << ti_wid) - 1; > + > + ret = est_read_gcl_config(ioaddr, &value, row, 0, dbgb, dbgm); > + if (ret) { > + TSN_ERR("Read GCE failed! row=%u\n", row); It is generally not a good idea to put wrappers around the kernel print functions. It would be better if all these functions took struct stmmac_priv *priv rather than ioaddr, so you could then do netdev_err(priv->dev, "Read GCE failed! row=%u\n", row); > + /* Ensure that HW is not in the midst of GCL transition */ > + value = TSN_RD32(ioaddr + MTL_EST_CTRL); Also, don't put wrapper around readl()/writel(). > + value &= ~MTL_EST_CTRL_SSWL; > + > + /* MTL_EST_CTRL value has been read earlier, if TILS value > + * differs, we update here. > + */ > + if (tils != dw_tsn_hwtunable[TSN_HWTUNA_TX_EST_TILS]) { > + value &= ~MTL_EST_CTRL_TILS; > + value |= (tils << MTL_EST_CTRL_TILS_SHIFT); > + > + TSN_WR32(value, ioaddr + MTL_EST_CTRL); > + dw_tsn_hwtunable[TSN_HWTUNA_TX_EST_TILS] = tils; > + } > + > + return 0; > +} > + > +static int est_set_ov(void *ioaddr, > + const unsigned int *ptov, > + const unsigned int *ctov) > +{ > + unsigned int value; > + > + if (!dw_tsn_feat_en[TSN_FEAT_ID_EST]) > + return -ENOTSUPP; > + > + value = TSN_RD32(ioaddr + MTL_EST_CTRL); > + value &= ~MTL_EST_CTRL_SSWL; > + > + if (ptov) { > + if (*ptov > EST_PTOV_MAX) { > + TSN_WARN("EST: invalid PTOV(%u), max=%u\n", > + *ptov, EST_PTOV_MAX); It looks like most o the TSN_WARN should actually be netdev_dbg(). Andrew