svn commit: r312755 - head/sys/net
John Baldwin
jhb at freebsd.org
Fri Jan 27 19:47:56 UTC 2017
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
More information about the svn-src-all
mailing list