All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Robert Jones <rjones@gateworks.com>,
	netdev@vger.kernel.org, Tim Harvey <tharvey@gateworks.com>,
	linux-kernel@vger.kernel.org,
	Robert Richter <rrichter@marvell.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	David Miller <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net] net: thunderx: workaround BGX TX Underflow issue
Date: Thu, 30 Jan 2020 13:07:30 +0100	[thread overview]
Message-ID: <20200130120730.GA60572@ranger.igk.intel.com> (raw)
In-Reply-To: <20200130091055.159d63ed@cakuba>

On Thu, Jan 30, 2020 at 09:10:55AM -0800, Jakub Kicinski wrote:
> On Wed, 29 Jan 2020 14:36:09 -0800, Robert Jones wrote:
> > From: Tim Harvey <tharvey@gateworks.com>
> > 
> > While it is not yet understood why a TX underflow can easily occur
> > for SGMII interfaces resulting in a TX wedge. It has been found that
> > disabling/re-enabling the LMAC resolves the issue.
> > 
> > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > Reviewed-by: Robert Jones <rjones@gateworks.com>
> 
> Sunil or Robert (i.e. one of the maintainers) will have to review this
> patch (as indicated by Dave by marking it with "Needs Review / ACK" in
> patchwork).
> 
> At a quick look there are some things which jump out at me:
> 
> > +static int bgx_register_intr(struct pci_dev *pdev)
> > +{
> > +	struct bgx *bgx = pci_get_drvdata(pdev);
> > +	struct device *dev = &pdev->dev;
> > +	int num_vec, ret;
> > +
> > +	/* Enable MSI-X */
> > +	num_vec = pci_msix_vec_count(pdev);
> > +	ret = pci_alloc_irq_vectors(pdev, num_vec, num_vec, PCI_IRQ_MSIX);
> > +	if (ret < 0) {
> > +		dev_err(dev, "Req for #%d msix vectors failed\n", num_vec);
> > +		return 1;
> 
> Please propagate real error codes, or make this function void as the
> caller never actually checks the return value.
> 
> > +	}
> > +	sprintf(bgx->irq_name, "BGX%d", bgx->bgx_id);

Another quick look: use snprintf so that you won't overflow the
bgx->irq_name in case bgx->bgx_id has some weird big number.

> > +	ret = request_irq(pci_irq_vector(pdev, GMPX_GMI_TX_INT),
> 
> There is a alloc_irq and request_irq call added in this patch but there
> is never any freeing. Are you sure this is fine? Devices can be
> reprobed (unbound and bound to drivers via sysfs).
> 
> > +		bgx_intr_handler, 0, bgx->irq_name, bgx);
> 
> Please align the continuation line with the opening bracket (checkpatch
> --strict should help catch this).
> 
> > +	if (ret)
> > +		return 1;
> > +
> > +	return 0;
> > +}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Robert Jones <rjones@gateworks.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	Robert Richter <rrichter@marvell.com>,
	David Miller <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, Tim Harvey <tharvey@gateworks.com>
Subject: Re: [PATCH net] net: thunderx: workaround BGX TX Underflow issue
Date: Thu, 30 Jan 2020 13:07:30 +0100	[thread overview]
Message-ID: <20200130120730.GA60572@ranger.igk.intel.com> (raw)
In-Reply-To: <20200130091055.159d63ed@cakuba>

On Thu, Jan 30, 2020 at 09:10:55AM -0800, Jakub Kicinski wrote:
> On Wed, 29 Jan 2020 14:36:09 -0800, Robert Jones wrote:
> > From: Tim Harvey <tharvey@gateworks.com>
> > 
> > While it is not yet understood why a TX underflow can easily occur
> > for SGMII interfaces resulting in a TX wedge. It has been found that
> > disabling/re-enabling the LMAC resolves the issue.
> > 
> > Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> > Reviewed-by: Robert Jones <rjones@gateworks.com>
> 
> Sunil or Robert (i.e. one of the maintainers) will have to review this
> patch (as indicated by Dave by marking it with "Needs Review / ACK" in
> patchwork).
> 
> At a quick look there are some things which jump out at me:
> 
> > +static int bgx_register_intr(struct pci_dev *pdev)
> > +{
> > +	struct bgx *bgx = pci_get_drvdata(pdev);
> > +	struct device *dev = &pdev->dev;
> > +	int num_vec, ret;
> > +
> > +	/* Enable MSI-X */
> > +	num_vec = pci_msix_vec_count(pdev);
> > +	ret = pci_alloc_irq_vectors(pdev, num_vec, num_vec, PCI_IRQ_MSIX);
> > +	if (ret < 0) {
> > +		dev_err(dev, "Req for #%d msix vectors failed\n", num_vec);
> > +		return 1;
> 
> Please propagate real error codes, or make this function void as the
> caller never actually checks the return value.
> 
> > +	}
> > +	sprintf(bgx->irq_name, "BGX%d", bgx->bgx_id);

Another quick look: use snprintf so that you won't overflow the
bgx->irq_name in case bgx->bgx_id has some weird big number.

> > +	ret = request_irq(pci_irq_vector(pdev, GMPX_GMI_TX_INT),
> 
> There is a alloc_irq and request_irq call added in this patch but there
> is never any freeing. Are you sure this is fine? Devices can be
> reprobed (unbound and bound to drivers via sysfs).
> 
> > +		bgx_intr_handler, 0, bgx->irq_name, bgx);
> 
> Please align the continuation line with the opening bracket (checkpatch
> --strict should help catch this).
> 
> > +	if (ret)
> > +		return 1;
> > +
> > +	return 0;
> > +}

  reply	other threads:[~2020-01-30 19:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 22:36 [PATCH net] net: thunderx: workaround BGX TX Underflow issue Robert Jones
2020-01-29 22:36 ` Robert Jones
2020-01-30 17:10 ` Jakub Kicinski
2020-01-30 17:10   ` Jakub Kicinski
2020-01-30 12:07   ` Maciej Fijalkowski [this message]
2020-01-30 12:07     ` Maciej Fijalkowski
2020-01-30 20:26   ` Bobby Jones
2020-01-30 20:26     ` Bobby Jones
2020-01-30 21:45 ` Heiner Kallweit
2020-01-30 21:45   ` Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200130120730.GA60572@ranger.igk.intel.com \
    --to=maciej.fijalkowski@intel.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjones@gateworks.com \
    --cc=rrichter@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.