Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 Jan 2017 11:28:23 -0800
From:      John Baldwin <jhb@freebsd.org>
To:        Sean Bruno <sbruno@freebsd.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r312755 - head/sys/net
Message-ID:  <6817684.C985jk9qCN@ralph.baldwin.cx>
In-Reply-To: <201701251437.v0PEb5D7047773@repo.freebsd.org>
References:  <201701251437.v0PEb5D7047773@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday, January 25, 2017 02:37:05 PM Sean Bruno wrote:
> Author: sbruno
> Date: Wed Jan 25 14:37:05 2017
> New Revision: 312755
> URL: https://svnweb.freebsd.org/changeset/base/312755
> 
> Log:
>   Add error checking to the pci_find_cap(, PCIY_MSIX,) call that is returns
>   success and a good value.  Only then try to use it and set the MSIX_ENABLE
>   bit.
>   
>   With the current em(4) driver we have observed failures in this case in a
>   specific environment when pci_find_cap() would not return the assumed
>   value, which meant we ended up writing to PCI register 2 (PCI_DEVICE_ID)
>   which is read-only.

Why is this writing directly to the MSIX registers at all?  pci_alloc_msix()
etc. handle those registers for all other drivers and proper suspend/resume
depends on drivers using the existing PCI API for managing MSI and MSI-X.

> Modified: head/sys/net/iflib.c
> ==============================================================================
> --- head/sys/net/iflib.c	Wed Jan 25 13:42:38 2017	(r312754)
> +++ head/sys/net/iflib.c	Wed Jan 25 14:37:05 2017	(r312755)
> @@ -4779,15 +4783,20 @@ iflib_msix_init(if_ctx_t ctx)
>  		uint16_t pci_cmd_word;
>  		int msix_ctrl, rid;
>  
> -		rid = 0;
>  		pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2);
>  		pci_cmd_word |= PCIM_CMD_BUSMASTEREN;
>  		pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2);

This should use 'pci_enable_busmaster()' like other drivers rather than
manipulating registers directly.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6817684.C985jk9qCN>