Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions pkg/consts/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,11 @@ const (
`IMPORT{program}="/etc/udev/switchdev-vf-link-name.sh $attr{phys_port_name}", ` +
`NAME="%s_$env{NUMBER}"`

KernelArgPciRealloc = "pci=realloc"
KernelArgIntelIommu = "intel_iommu=on"
KernelArgIommuPt = "iommu=pt"
KernelArgIommuPassthrough = "iommu.passthrough=1"
KernelArgRdmaShared = "ib_core.netns_mode=1"
KernelArgRdmaExclusive = "ib_core.netns_mode=0"
KernelArgPciRealloc = "pci=realloc"
KernelArgIntelIommu = "intel_iommu=on"
KernelArgIommuPt = "iommu=pt"
KernelArgRdmaShared = "ib_core.netns_mode=1"
KernelArgRdmaExclusive = "ib_core.netns_mode=0"

// Feature gates
// ParallelNicConfigFeatureGate: allow to configure nics in parallel
Expand Down
1 change: 0 additions & 1 deletion pkg/daemon/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ var _ = Describe("config daemon plugin loading tests", func() {
helperMock.EXPECT().IsKernelArgsSet("", consts.KernelArgPciRealloc).Return(false)
helperMock.EXPECT().IsKernelArgsSet("", consts.KernelArgRdmaExclusive).Return(false)
helperMock.EXPECT().IsKernelArgsSet("", consts.KernelArgRdmaShared).Return(false)
helperMock.EXPECT().IsKernelArgsSet("", consts.KernelArgIommuPassthrough).Return(false)

// k8s plugin is ATM the only plugin which require mocking/faking, as its New method performs additional logic
// other than simple plugin struct initialization
Expand Down
14 changes: 5 additions & 9 deletions pkg/plugins/generic/generic_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,11 @@ func NewGenericPlugin(helpers helper.HostHelpersInterface, options ...Option) (p
return nil, err
}
desiredKernelArgs := KargStateMapType{
consts.KernelArgPciRealloc: helpers.IsKernelArgsSet(kargs, consts.KernelArgPciRealloc),
consts.KernelArgIntelIommu: helpers.IsKernelArgsSet(kargs, consts.KernelArgIntelIommu),
consts.KernelArgIommuPt: helpers.IsKernelArgsSet(kargs, consts.KernelArgIommuPt),
consts.KernelArgIommuPassthrough: helpers.IsKernelArgsSet(kargs, consts.KernelArgIommuPassthrough),
consts.KernelArgRdmaShared: false,
consts.KernelArgRdmaExclusive: false,
consts.KernelArgPciRealloc: helpers.IsKernelArgsSet(kargs, consts.KernelArgPciRealloc),
consts.KernelArgIntelIommu: helpers.IsKernelArgsSet(kargs, consts.KernelArgIntelIommu),
consts.KernelArgIommuPt: helpers.IsKernelArgsSet(kargs, consts.KernelArgIommuPt),
consts.KernelArgRdmaShared: false,
consts.KernelArgRdmaExclusive: false,
}

return &GenericPlugin{
Expand Down Expand Up @@ -438,9 +437,6 @@ func (p *GenericPlugin) addVfioDesiredKernelArg(state *sriovnetworkv1.SriovNetwo
hostTypes.CPUVendorAMD: func() {
p.enableDesiredKernelArgs(consts.KernelArgIommuPt)
},
hostTypes.CPUVendorARM: func() {
p.enableDesiredKernelArgs(consts.KernelArgIommuPassthrough)
},
}

if !driverState.DriverLoaded && driverState.NeedDriverFunc(state, driverState) {
Expand Down
7 changes: 0 additions & 7 deletions pkg/plugins/generic/generic_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ var _ = Describe("Generic plugin", func() {
hostHelper.EXPECT().IsKernelArgsSet("", consts.KernelArgPciRealloc).Return(false).AnyTimes()
hostHelper.EXPECT().IsKernelArgsSet("", consts.KernelArgRdmaExclusive).Return(false).AnyTimes()
hostHelper.EXPECT().IsKernelArgsSet("", consts.KernelArgRdmaShared).Return(false).AnyTimes()
hostHelper.EXPECT().IsKernelArgsSet("", consts.KernelArgIommuPassthrough).Return(false).AnyTimes()

hostHelper.EXPECT().RunCommand(gomock.Any(), gomock.Any()).Return("", "", nil).AnyTimes()

Expand Down Expand Up @@ -935,12 +934,6 @@ var _ = Describe("Generic plugin", func() {
Expect(genericPlugin.(*GenericPlugin).DesiredKernelArgs[consts.KernelArgIommuPt]).To(BeTrue())
})

It("should set the correct kernel args on ARM CPUs", func() {
hostHelper.EXPECT().GetCPUVendor().Return(hostTypes.CPUVendorARM, nil)
genericPlugin.(*GenericPlugin).addVfioDesiredKernelArg(vfioNetworkNodeState)
Expect(genericPlugin.(*GenericPlugin).DesiredKernelArgs[consts.KernelArgIommuPassthrough]).To(BeTrue())
})

It("should enable rdma shared mode", func() {
hostHelper.EXPECT().SetRDMASubsystem(consts.RdmaSubsystemModeShared).Return(nil)
err := genericPlugin.(*GenericPlugin).configRdmaKernelArg(rdmaState)
Expand Down