Skip to content

Commit 69e9d8d

Browse files
committed
Add VFIO interrupt support for ixy driver.
1 parent 08548ad commit 69e9d8d

File tree

13 files changed

+587
-19
lines changed

13 files changed

+587
-19
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ include_directories(
1717
${CMAKE_CURRENT_SOURCE_DIR}/src
1818
)
1919

20-
set(SOURCE_COMMON src/pci.c src/memory.c src/stats.c src/driver/device.c src/driver/ixgbe.c src/driver/virtio.c src/libixy-vfio.c)
20+
set(SOURCE_COMMON src/pci.c src/memory.c src/stats.c src/interrupts.c src/driver/device.c src/driver/ixgbe.c src/driver/virtio.c src/libixy-vfio.c)
2121

2222
add_executable(ixy-pktgen src/app/ixy-pktgen.c ${SOURCE_COMMON})
2323
add_executable(ixy-fwd src/app/ixy-fwd.c ${SOURCE_COMMON})

src/app/ixy-fwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ int main(int argc, char* argv[]) {
3232
return 1;
3333
}
3434

35-
struct ixy_device* dev1 = ixy_init(argv[1], 1, 1);
36-
struct ixy_device* dev2 = ixy_init(argv[2], 1, 1);
35+
struct ixy_device* dev1 = ixy_init(argv[1], 1, 1, -1);
36+
struct ixy_device* dev2 = ixy_init(argv[2], 1, 1, 0);
3737

3838
uint64_t last_stats_printed = monotonic_time();
3939
struct device_stats stats1, stats1_old;

src/app/ixy-pktgen.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ int main(int argc, char* argv[]) {
7272
}
7373

7474
struct mempool* mempool = init_mempool();
75-
struct ixy_device* dev = ixy_init(argv[1], 1, 1);
75+
struct ixy_device* dev = ixy_init(argv[1], 1, 1, 0);
7676

7777
uint64_t last_stats_printed = monotonic_time();
7878
uint64_t counter = 0;

src/driver/device.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "driver/virtio.h"
66
#include "pci.h"
77

8-
struct ixy_device* ixy_init(const char* pci_addr, uint16_t rx_queues, uint16_t tx_queues) {
8+
struct ixy_device* ixy_init(const char* pci_addr, uint16_t rx_queues, uint16_t tx_queues, int interrupt_timeout) {
99
// Read PCI configuration space
1010
// For VFIO, we could access the config space another way
1111
// (VFIO_PCI_CONFIG_REGION_INDEX). This is not needed, though, because
@@ -23,6 +23,6 @@ struct ixy_device* ixy_init(const char* pci_addr, uint16_t rx_queues, uint16_t t
2323
return virtio_init(pci_addr, rx_queues, tx_queues);
2424
} else {
2525
// Our best guess is to try ixgbe
26-
return ixgbe_init(pci_addr, rx_queues, tx_queues);
26+
return ixgbe_init(pci_addr, rx_queues, tx_queues, interrupt_timeout);
2727
}
2828
}

src/driver/device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
#include "log.h"
88
#include "memory.h"
9+
#include "../interrupts.h"
910

1011
#define MAX_QUEUES 64
1112

@@ -42,9 +43,10 @@ struct ixy_device {
4243
uint32_t (*get_link_speed) (const struct ixy_device* dev);
4344
bool vfio;
4445
int vfio_fd; // device fd
46+
struct interrupts interrupts;
4547
};
4648

47-
struct ixy_device* ixy_init(const char* pci_addr, uint16_t rx_queues, uint16_t tx_queues);
49+
struct ixy_device* ixy_init(const char* pci_addr, uint16_t rx_queues, uint16_t tx_queues, int interrupt_timeout);
4850

4951
// Public stubs that forward the calls to the driver-specific implementations
5052
static inline uint32_t ixy_rx_batch(struct ixy_device* dev, uint16_t queue_id, struct pkt_buf* bufs[], uint32_t num_bufs) {

0 commit comments

Comments
 (0)