From 87195c9ccca093b15a15c98e5d0263083612d753 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Wed, 7 Aug 2019 14:39:43 -0700 Subject: [PATCH] pci: Fix vector control read/write from/to MSI-X table The vector control offset is at the 4th byte of each MSI-X table entry. For that reason, it is located at 0xc, and not 0x10 as implemented. This commit fixes the current MSI-X code, allowing proper reading and writing of each vector control register in the MSI-X table. Fixes #156 Signed-off-by: Sebastien Boeuf --- pci/src/msix.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pci/src/msix.rs b/pci/src/msix.rs index 2c5ec188d..e38a3e9e1 100644 --- a/pci/src/msix.rs +++ b/pci/src/msix.rs @@ -111,7 +111,7 @@ impl MsixConfig { 0x0 => self.table_entries[index].msg_addr_lo, 0x4 => self.table_entries[index].msg_addr_hi, 0x8 => self.table_entries[index].msg_data, - 0x10 => self.table_entries[index].vector_ctl, + 0xc => self.table_entries[index].vector_ctl, _ => { error!("invalid offset"); 0 @@ -162,7 +162,7 @@ impl MsixConfig { 0x0 => self.table_entries[index].msg_addr_lo = value, 0x4 => self.table_entries[index].msg_addr_hi = value, 0x8 => self.table_entries[index].msg_data = value, - 0x10 => { + 0xc => { old_entry = Some(self.table_entries[index].clone()); self.table_entries[index].vector_ctl = value; }