Skip to content

Commit c993811

Browse files
committed
link: SRIOV: u32::MAX means false
The `u32::MAX` for `VfInfo::SpoofCheck`, `VfInfo::Trust` and `VfInfo::RssQueryEn` mean false. Signed-off-by: Gris Ge <[email protected]>
1 parent 7cec1f1 commit c993811

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/link/sriov/rss_query.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<VfInfoRssQueryEnBuffer<&'a T>>
2626
for VfInfoRssQueryEn
2727
{
2828
fn parse(buf: &VfInfoRssQueryEnBuffer<&T>) -> Result<Self, DecodeError> {
29-
Ok(Self::new(buf.vf_id(), buf.setting() > 0))
29+
Ok(Self::new(
30+
buf.vf_id(),
31+
buf.setting() > 0 && buf.setting() != u32::MAX,
32+
))
3033
}
3134
}
3235

src/link/sriov/spoofchk.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<VfInfoSpoofCheckBuffer<&'a T>>
2626
for VfInfoSpoofCheck
2727
{
2828
fn parse(buf: &VfInfoSpoofCheckBuffer<&T>) -> Result<Self, DecodeError> {
29-
Ok(Self::new(buf.vf_id(), buf.setting() > 0))
29+
Ok(Self::new(
30+
buf.vf_id(),
31+
buf.setting() > 0 && buf.setting() != u32::MAX,
32+
))
3033
}
3134
}
3235

src/link/sriov/trust.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ impl<'a, T: AsRef<[u8]> + ?Sized> Parseable<VfInfoTrustBuffer<&'a T>>
2626
for VfInfoTrust
2727
{
2828
fn parse(buf: &VfInfoTrustBuffer<&T>) -> Result<Self, DecodeError> {
29-
Ok(Self::new(buf.vf_id(), buf.setting() > 0))
29+
Ok(Self::new(
30+
buf.vf_id(),
31+
buf.setting() > 0 && buf.setting() != u32::MAX,
32+
))
3033
}
3134
}
3235

0 commit comments

Comments
 (0)