Skip to content

Commit

Permalink
Remove check of vlan QoS and Proto for VID 0
Browse files Browse the repository at this point in the history
The sriov network operator sets the values of vlan and vlanQoS
equal to zero when these are not set in the sriovnetwork object.
The check is not needed since qos and proto are ignored when vid
is zero.

Signed-off-by: Marcelo Guerrero <[email protected]>
  • Loading branch information
mlguerrero12 committed Oct 5, 2023
1 parent f0e62c3 commit f8813b8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 10 deletions.
4 changes: 0 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func LoadConf(bytes []byte) (*sriovtypes.NetConf, error) {
return nil, fmt.Errorf("LoadConf(): vlan id %d invalid: value must be in the range 0-4094", *n.Vlan)
}

if *n.Vlan == 0 && (n.VlanQoS != nil || n.VlanProto != nil) {
return nil, fmt.Errorf("LoadConf(): non-zero vlan id must be configured to set vlan Qos and/or Proto")
}

if n.VlanQoS == nil {
qos := 0
n.VlanQoS = &qos
Expand Down
6 changes: 0 additions & 6 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ var _ = Describe("Config", func() {
})

validVlanID := 100
zeroVlanID := 0
invalidVlanID := 5000
validQoS := 1
invalidQoS := 10
valid8021qProto := "802.1Q"
valid8021adProto := "802.1ad"
Expand Down Expand Up @@ -108,14 +106,10 @@ var _ = Describe("Config", func() {
},
Entry("valid vlan ID", &validVlanID, nil, nil, false),
Entry("invalid vlan ID", &invalidVlanID, nil, nil, true),
Entry("vlan ID equal to zero and QoS set", &zeroVlanID, &validQoS, nil, true),
Entry("vlan ID equal to zero and Proto set", &zeroVlanID, nil, &valid8021qProto, true),
Entry("invalid QoS", &validVlanID, &invalidQoS, nil, true),
Entry("invalid Proto", &validVlanID, nil, &invalidProto, true),
Entry("valid 802.1q Proto", &validVlanID, nil, &valid8021qProto, false),
Entry("valid 802.1ad Proto", &validVlanID, nil, &valid8021adProto, false),
Entry("no vlan ID and QoS set", nil, &validQoS, nil, true),
Entry("no vlan ID and Proto set", nil, nil, &valid8021adProto, true),
)

It("Assuming device is allocated", func() {
Expand Down

0 comments on commit f8813b8

Please sign in to comment.