Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1300781ybp; Fri, 11 Oct 2019 12:03:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxtIx41/0px+RE4OmDQxYf9zshPTEXRBXZzlO73hTGjnfpI41LKVZgwuYoT7LwYu+zBhat1 X-Received: by 2002:a05:6402:7ca:: with SMTP id u10mr15073054edy.20.1570820591042; Fri, 11 Oct 2019 12:03:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570820591; cv=none; d=google.com; s=arc-20160816; b=csLtk/KNtuTdfCPctkYQ/pjvUPnCkOsZ4h5/0IoO6gozrJtDIho9mkRIB07n+lTA9I ptJdvYxx8xJ3e9xY9hOWd96WejJOPGKP3s+i+i/EM2dXZPrIWOayX2ve2LnLYnVjeuBT SxXmAqMuxlHS5OJdr7ltxzV54eyK+sChe84Nnaw7peJWykNEq+H9MlmmJspQP/GngQmF 7UBjBs3OfHHNPAZRCtSBSRyI1go8C/qJ1RCKzHHRA5DpeaYdTbOAef7hpdn1UhO+Jw7N 7oiiZU2270/f26205QUwa+JqwxF/4zv2GTlHkV45PtmrEMvFGGxz5tKsx0LYBSbQFtaN aR7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=Sf6N3zaqXOOU1zchdNL6U+vk71FFjeLunSmfQRKRik4=; b=k1Kx6QreAHHYUp+W87ps0YjyY7sFVjGaK3COXctycaWkQ2UC+AvASB5epK82PbRmH0 y+YtJZjrSoFhXYghvZuwAY1Kz8s2j3+ztkz7pQKgZuQ20JUogB16iXApOJml9Iqdtp2+ vrkkhovZyQGm3sl+JGEq6W7atBO+HbPSw/vwSilvM1PJ5/KmTHX596nKkx+t2eRWZasM pGhun1otHZT7XpM/8IbUvy/GXUb0XNWYxfQkVzFu9Fs5k2voSL86Wx11k2h8PvU/hXg6 RlnEc6rA6+t7MuS5VF7dwwqpsWlf5sOwD6KFrquk2dMvLy5jijTVrI6WFDlSFVEJHZZm kjWg== ARC-Authentication-Results: i=1; mx.google.com; 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 ci22si6133792ejb.162.2019.10.11.12.02.41; Fri, 11 Oct 2019 12:03:11 -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; 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 S1728917AbfJKTBu (ORCPT + 99 others); Fri, 11 Oct 2019 15:01:50 -0400 Received: from mx2.suse.de ([195.135.220.15]:44340 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728738AbfJKTBt (ORCPT ); Fri, 11 Oct 2019 15:01:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5ACA3B43E; Fri, 11 Oct 2019 19:01:47 +0000 (UTC) Message-ID: Subject: Re: [PATCH v1 2/3] net: bcmgenet: use optional max DMA burst size property From: Nicolas Saenz Julienne To: matthias.bgg@kernel.org, Florian Fainelli , "David S . Miller" Cc: linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Stefan Wahren , Matthias Brugger , Doug Berger , bcm-kernel-feedback-list@broadcom.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Date: Fri, 11 Oct 2019 21:01:45 +0200 In-Reply-To: <20191011184822.866-3-matthias.bgg@kernel.org> References: <20191011184822.866-1-matthias.bgg@kernel.org> <20191011184822.866-3-matthias.bgg@kernel.org> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-j2itiBTOH1918e/nyStj" User-Agent: Evolution 3.32.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-j2itiBTOH1918e/nyStj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Matthias! One small comment, I'll test everything later on. On Fri, 2019-10-11 at 20:48 +0200, matthias.bgg@kernel.org wrote: > From: Matthias Brugger >=20 > Depending on the HW, the maximal usable DMA burst size can vary. > If not set accordingly a timeout in the transmit queue happens and no > package can be sent. Read to optional max-burst-sz property, if not > present, fallback to the standard value. >=20 > Signed-off-by: Matthias Brugger > --- >=20 > drivers/net/ethernet/broadcom/genet/bcmgenet.c | 13 +++++++++++-- > drivers/net/ethernet/broadcom/genet/bcmgenet.h | 1 + > 2 files changed, 12 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c > b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > index 12cb77ef1081..a7bb822a6d83 100644 > --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c > +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c > @@ -2576,7 +2576,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *= priv) > } > =20 > /* Init rDma */ > - bcmgenet_rdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE); > + bcmgenet_rdma_writel(priv, priv->dma_max_burst_length, > + DMA_SCB_BURST_SIZE); > =20 > /* Initialize Rx queues */ > ret =3D bcmgenet_init_rx_queues(priv->dev); > @@ -2589,7 +2590,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *= priv) > } > =20 > /* Init tDma */ > - bcmgenet_tdma_writel(priv, DMA_MAX_BURST_LENGTH, DMA_SCB_BURST_SIZE); > + bcmgenet_tdma_writel(priv, priv->dma_max_burst_length, > + DMA_SCB_BURST_SIZE); > =20 > /* Initialize Tx queues */ > bcmgenet_init_tx_queues(priv->dev); > @@ -3522,6 +3524,13 @@ static int bcmgenet_probe(struct platform_device *= pdev) > =20 > clk_prepare_enable(priv->clk); > =20 > + if (dn) { > + of_property_read_u32(dn, "dma-burst-sz", > + &priv->dma_max_burst_length); You set the 'dma-burst-sz' binding as optional, though this assumes that if= a device node is available dma_max_burst_length comes from the device tree. I think you should check of_property_read_u32's return value and on failure default to DMA_MAX_BURST_LENGTH. > + } else { > + priv->dma_max_burst_length =3D DMA_MAX_BURST_LENGTH; > + } > + > bcmgenet_set_hw_params(priv); > =20 > /* Mii wait queue */ > diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h > b/drivers/net/ethernet/broadcom/genet/bcmgenet.h > index 4a8fc03d82fd..897f356eb376 100644 > --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h > +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h > @@ -663,6 +663,7 @@ struct bcmgenet_priv { > bool crc_fwd_en; > =20 > unsigned int dma_rx_chk_bit; > + unsigned int dma_max_burst_length; > =20 > u32 msg_enable; > =20 Regards, Nicolas --=-j2itiBTOH1918e/nyStj Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEErOkkGDHCg2EbPcGjlfZmHno8x/4FAl2g0ZkACgkQlfZmHno8 x/6Mdgf+Pf0ra+FPpx4Ytdj4mRSRpmN2V+b2TBbpbm4JPXpQOV0x1bq7w3QQT7FF KQbKhEoh/nCH1cHZ5ScFWJ3JVQHPRbgPw2c/y/aFHEnDaTkFvg6fYmm2Xjt3ABil kxire7snMF+4oO5l0D/y6PXJICzvPi2ofvPIdB1swteRngtCwL98mDHn9Cd+tRD0 IyB7N9gyHgxMf6mshroxijVvn6XS6yfOV3bhC1AXlCmqTial7BoHFe8LI45Tr9+F w5317a+n8LnOqPVu++FH5rNfoeKLi3n0gxb3kgIGbAUGZp1JmxDJ/W/ZjoGk9gmX gfR2/XmNHojodv60DZs2v8RcTcWT7w== =mp3i -----END PGP SIGNATURE----- --=-j2itiBTOH1918e/nyStj--