1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT. No part of dpdk, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
// Copyright © 2016-2017 The developers of dpdk. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT.
/// Virtual Function IO ('vfio') interrupt mode.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(Deserialize, Serialize)]
pub enum VirtualFunctionIoInterruptMode
{
/// Interrupts are delivered to a physically signalled pin by the Advanced Programmable Interrupt Controller (APIC).
///
/// This is the original scheme used to support PCI.
///
/// The APIC usually only supports 24 interrupt request lines ('IRQs'), although many of these are hardcoded for specific purposes.
Legacy,
/// Message Signalled Interrupts.
///
/// The PCI bus (as of version 2.2) writes a very small message to a known location.
///
/// Up to 64 IRQs are supported.
Msi,
/// Message Signalled Interrupts, Extended.
///
/// Most modern PCIe equipment should be capable of this mode.
///
/// Up to 2048 IRQs are supported.
MsiX,
}
impl VirtualFunctionIoInterruptMode
{
/// As DPDK value.
#[inline(always)]
pub fn to_rte_intr_mode(self) -> rte_intr_mode
{
use self::VirtualFunctionIoInterruptMode::*;
use self::rte_intr_mode::*;
match self
{
Legacy => RTE_INTR_MODE_LEGACY,
Msi => RTE_INTR_MODE_MSI,
MsiX => RTE_INTR_MODE_MSIX,
}
}
/// From DPDK value.
#[inline(always)]
pub fn from_rte_intr_mode(dpdk_value: rte_intr_mode) -> Option<Self>
{
use self::VirtualFunctionIoInterruptMode::*;
use self::rte_intr_mode::*;
match dpdk_value
{
RTE_INTR_MODE_NONE => None,
RTE_INTR_MODE_LEGACY => Some(Legacy),
RTE_INTR_MODE_MSI => Some(Msi),
RTE_INTR_MODE_MSIX => Some(MsiX),
}
}
/// An an initialisation argument.
#[inline(always)]
pub fn as_initialization_argument(self) -> ConstCStr
{
use self::VirtualFunctionIoInterruptMode::*;
match self
{
Legacy => ConstCStr(b"legacy\0"),
Msi => ConstCStr(b"msi\0"),
MsiX => ConstCStr(b"msix\0"),
}
}
}