#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum ReceiveSideScalingHashFunctionKeyData
{
EthernetDeviceDefault,
Forty(Array40<u8>),
FiftyTwo(Array52<u8>),
}
impl ReceiveSideScalingHashFunctionKeyData
{
pub const EthernetDeviceDefaultKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::EthernetDeviceDefault;
pub const MicrosoftKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::Forty
(
Array40
([
0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2,
0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0,
0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4,
0x77, 0xCB, 0x2D, 0xA3, 0x80, 0x30, 0xF2, 0x0C,
0x6A, 0x42, 0xB7, 0x3B, 0xBE, 0xAC, 0x01, 0xFA,
])
);
pub const SymmetricFortyKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::Forty
(
Array40
([
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
])
);
pub const SymmetricFiftyTwoKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::FiftyTwo
(
Array52
([
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A, 0x6D, 0x5A,
0x6D, 0x5A, 0x6D, 0x5A,
])
);
pub const DefaultMellanoxKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::Forty
(
Array40
([
0xD1, 0x81, 0xC6, 0x2C, 0xF7, 0xF4, 0xDB, 0x5B,
0x19, 0x83, 0xA2, 0xFC, 0x94, 0x3E, 0x1A, 0xDB,
0xD9, 0x38, 0x9E, 0x6B, 0xD1, 0x03, 0x9C, 0x2C,
0xA7, 0x44, 0x99, 0xAD, 0x59, 0x3D, 0x56, 0xD9,
0xF3, 0x25, 0x3C, 0x06, 0x2A, 0xDC, 0x1F, 0xFC,
])
);
pub const DefaultIntelI40eKeyData: ReceiveSideScalingHashFunctionKeyData = ReceiveSideScalingHashFunctionKeyData::FiftyTwo
(
Array52
([
0x44, 0x39, 0x79, 0x6B, 0xB5, 0x4C, 0x50, 0x23,
0xB6, 0x75, 0xEA, 0x5B, 0x12, 0x4F, 0x9F, 0x30,
0xB8, 0xA2, 0xC0, 0x3D, 0xDF, 0xDC, 0x4D, 0x02,
0xA0, 0x8C, 0x9B, 0x33, 0x4A, 0xF6, 0x4A, 0x4C,
0x05, 0xC6, 0xFA, 0x34, 0x39, 0x58, 0xD8, 0x55,
0x7D, 0x99, 0x58, 0x3A, 0xE1, 0x38, 0xC9, 0x2E,
0x81, 0x15, 0x03, 0x66,
])
);
#[inline(always)]
pub fn length(&self) -> u8
{
match *self
{
ReceiveSideScalingHashFunctionKeyData::EthernetDeviceDefaultKeyData => 0,
ReceiveSideScalingHashFunctionKeyData::Forty(_) => 40,
ReceiveSideScalingHashFunctionKeyData::FiftyTwo(_) => 52,
}
}
#[inline(always)]
pub fn as_ref(&self) -> Option<&[u8]>
{
match *self
{
ReceiveSideScalingHashFunctionKeyData::EthernetDeviceDefaultKeyData => None,
ReceiveSideScalingHashFunctionKeyData::Forty(ref data) => Some(&data.0),
ReceiveSideScalingHashFunctionKeyData::FiftyTwo(ref data) => Some(&data.0),
}
}
#[inline(always)]
pub const fn receiveSideScalingHashFunctionConfiguration(self, hashFunctionFlowApplicability: ReceiveSideScalingOffloadFlowTypeSet) -> ReceiveSideScalingHashFunctionConfiguration
{
ReceiveSideScalingHashFunctionConfiguration
{
key: self,
hashFunctionFlowApplicability: hashFunctionFlowApplicability
}
}
pub fn tldkRssKeyData(numberOfReceiveQueues: u16, receiveSideScalingHashKeySize: ReceiveSideScalingHashKeySize) -> ReceiveSideScalingHashFunctionKeyData
{
let n = numberOfReceiveQueues.next_power_of_two() as u8;
match receiveSideScalingHashKeySize
{
ReceiveSideScalingHashKeySize::Forty => ReceiveSideScalingHashFunctionKeyData::Forty
(
Array40
([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, n,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, n,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
])
),
ReceiveSideScalingHashKeySize::FiftyTwo => ReceiveSideScalingHashFunctionKeyData::FiftyTwo
(
Array52
([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, n,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, n,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
])
)
}
}
}