Skip to content

Commit

Permalink
PCI MSI capability is now a hardware verified feature and is enabled …
Browse files Browse the repository at this point in the history
…by default.

- By default MSI-X remains disabled because it is still an experimental feature that has not been verified with real hardware testing. To use it the command-line options -e must be used.
- Added helpful warning for when the user attempts to start a second instance of the driver.
  • Loading branch information
Deniz-Eren committed Dec 27, 2023
1 parent d769e4d commit f79bceb
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 56 deletions.
25 changes: 9 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ Options:
e.g. -d 13fe:00d7,0x11 -d 13fe:00d7,0x05
-e vid:did,cap
- Enable PCI/PCIe capability cap for device,
e.g. -e 13fe:00d7,0x05
By default all capabilities are disabled and require enabling to
be activated (EXPERIMENTAL).
e.g. -e 13fe:00d7,0x11
By default MSI capability is enabled and MSI-X is disabled,
and requires enabling to be activated (EXPERIMENTAL).
-r delay - Bus-off recovery delay timer duration (milliseconds).
If set to 0ms, then the bus-off recovery is disabled!
Default: 50ms
Expand Down Expand Up @@ -579,7 +579,7 @@ Current version output:

## PCIe MSI and MSI-X Capability Devices

These capabilities are currently disabled by default. They are experimental and
Some capabilities are currently disabled by default. They are experimental and
have not been verified with real hardware.

For PCIe devices that support capability 0x05 (MSI) and/or 0x11 (MSI-X), both
Expand Down Expand Up @@ -645,27 +645,20 @@ This shows the file `etc/profile` defining the needed environment variables so
that the user console have them defined for dev-can-linux to find the PCI
modules.

For advanced user, if you wish to enable the 0x11 (MSI-X) capability or the
the 0x05 (MSI) capability (if it's available), simply specific device and
capability number with `-e` option program options to the `dev-can-linux` driver.
For advanced user, if you wish to enable the 0x11 (MSI-X) capability (if it's
available), simply specify device and capability number with `-e` option program
options to the `dev-can-linux` driver. Note that capability MSI is enabled by
default since it has been verified with real hardware, MSI-X is still unverified
and experimental.

To force MSI-X to be used:

dev-can-linux -e vid:did,0x11

To force MSI to be used:

dev-can-linux -e vid:did,0x05

Note it is NOT recommended to enable capabilities, in production until we release
a hardware tested and verified version. However this ability is provided for
advanced users to adopt at their discretion.

One final note on legacy MSI, PCI 3.0 onwards allow each interrupt to be masked
individually. If this feature is not available on the device, that is, if Per
Vector Masking (PVM) isn't supported, then currently the driver will revert to
regular IRQ operation.


## Hardware Test Status

Expand Down
2 changes: 1 addition & 1 deletion config/PROGRAM_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.2.0
1.2.1
8 changes: 6 additions & 2 deletions src/pci-capability.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,14 @@ pci_err_t msix_init (struct pci_dev* dev) {
int i;

/*
* By default both MSI and MSI-X are disabled
* By default MSI-X is disabled because it is still an experimental feature
* that has not been validated with real hardware testing. To use it the
* command-line options -e must be used.
*
* MSI is a hardware verified feature and is enabled by default.
*/

bool disabled_msi = true;
bool disabled_msi = false;
bool disabled_msix = true;

pcie_init(dev);
Expand Down
38 changes: 4 additions & 34 deletions src/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ pci_err_t pci_enable_device (struct pci_dev* dev) {
if (dev->hdl == NULL) {
log_err("pci_device_attach error: %s\n", pci_strerror(r));

log_warn("only a single instance of the driver is allowed\n");

return r;
}

Expand Down Expand Up @@ -204,23 +206,7 @@ pci_err_t pci_enable_device (struct pci_dev* dev) {
* Load capabilities
*/

bool device_cap_enabled = false;

int i;
for (i = 0; i < num_enable_device_cap_configs; ++i) {
if (enable_device_cap_config[i].vid == dev->vendor &&
enable_device_cap_config[i].did == dev->device &&
enable_device_cap_config[i].cap != -1)
{
device_cap_enabled = true;

break;
}
}

if (device_cap_enabled) {
msix_init(dev);
}
msix_init(dev);

/*
* Process bar info
Expand Down Expand Up @@ -378,23 +364,7 @@ void pci_disable_device (struct pci_dev* dev) {
return;
}

bool device_cap_enabled = false;

int i;
for (i = 0; i < num_enable_device_cap_configs; ++i) {
if (enable_device_cap_config[i].vid == dev->vendor &&
enable_device_cap_config[i].did == dev->device &&
enable_device_cap_config[i].cap != -1)
{
device_cap_enabled = true;

break;
}
}

if (device_cap_enabled) {
msix_uninit(dev);
}
msix_uninit(dev);

if (dev != NULL) {
if (dev->hdl != NULL) {
Expand Down
6 changes: 3 additions & 3 deletions src/prints.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ void print_help (char* program_name) {
printf(" e.g. -d 13fe:00d7,0x11 -d 13fe:00d7,0x05\n");
printf(" \e[1m-e vid:did,cap\e[m\n");
printf(" - Enable PCI/PCIe capability cap for device,\n");
printf(" e.g. -e 13fe:00d7,0x05\n");
printf(" By default all capabilities are disabled and require enabling to\n");
printf(" be activated (EXPERIMENTAL).\n");
printf(" e.g. -e 13fe:00d7,0x11\n");
printf(" By default MSI capability is enabled and MSI-X is disabled,\n");
printf(" and requires enabling to be activated (EXPERIMENTAL).\n");
printf(" \e[1m-b delay\e[m - Bus-off recovery delay timer length (milliseconds).\n");
printf(" If set to 0ms, then the bus-off recovery is disabled!\n");
printf(" The netif transmission queue fault recovery is also set to this\n");
Expand Down

0 comments on commit f79bceb

Please sign in to comment.