Skip to content

Commit 822459c

Browse files
committed
Disable memif if queue spread by default
This patch disables memif interface queue spreading on workers by default. Users can enable it again using the debug knob : CALICOVPP_DEBUG='{"spreadTxQueuesOnWorkers": true}'. This is a consequence of the pinning behaviour of VPP by default. When #queues < #workers, queues are shared by default and pinning them removes their sharing rendering them unusable on some workers. When #queues > #workers, the extra queues are unpined by default, rendering multi-tx harder to use. As the latter feature is harder and more niche than the former, we chose to go with a default that suits most usecase, while we work on a better pinning framework. Signed-off-by: Nathan Skrzypczak <[email protected]>
1 parent a3fad49 commit 822459c

File tree

2 files changed

+36
-30
lines changed

2 files changed

+36
-30
lines changed

calico-vpp-agent/cni/pod_interface/memif.go

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -93,39 +93,41 @@ func (i *MemifPodInterfaceDriver) CreateInterface(podSpec *storage.LocalPodSpec,
9393
}
9494
podSpec.MemifSwIfIndex = memif.SwIfIndex
9595

96-
watcher, err := i.vpp.WatchInterfaceEvents(memif.SwIfIndex)
97-
if err != nil {
98-
return err
99-
} else {
100-
stack.Push(watcher.Stop)
101-
}
102-
go func() {
103-
i.log.WithFields(map[string]interface{}{
104-
"swIfIndex": memif.SwIfIndex,
105-
}).Infof("begin watching interface events for: %v", i.Name)
106-
107-
for event := range watcher.Events() {
96+
if *(*config.CalicoVppDebug).SpreadTxQueuesOnWorkers {
97+
watcher, err := i.vpp.WatchInterfaceEvents(memif.SwIfIndex)
98+
if err != nil {
99+
return err
100+
} else {
101+
stack.Push(watcher.Stop)
102+
}
103+
go func() {
108104
i.log.WithFields(map[string]interface{}{
109105
"swIfIndex": memif.SwIfIndex,
110-
}).Infof("processing interface event for %v: %+v", i.Name, event)
111-
112-
switch event.Type {
113-
case types.InterfaceEventLinkUp:
114-
err = i.SpreadTxQueuesOnWorkers(memif.SwIfIndex, memif.NumTxQueues)
115-
if err != nil {
116-
i.log.Errorf("error spreading tx queues on workers: %v", err)
106+
}).Infof("begin watching interface events for: %v", i.Name)
107+
108+
for event := range watcher.Events() {
109+
i.log.WithFields(map[string]interface{}{
110+
"swIfIndex": memif.SwIfIndex,
111+
}).Infof("processing interface event for %v: %+v", i.Name, event)
112+
113+
switch event.Type {
114+
case types.InterfaceEventLinkUp:
115+
err = i.SpreadTxQueuesOnWorkers(memif.SwIfIndex, memif.NumTxQueues)
116+
if err != nil {
117+
i.log.Errorf("error spreading tx queues on workers: %v", err)
118+
}
119+
i.SpreadRxQueuesOnWorkers(memif.SwIfIndex, podSpec.IfSpec.NumRxQueues)
120+
case types.InterfaceEventDeleted: // this might not be needed here, it could be handled internally in the watcher
121+
watcher.Stop()
117122
}
118-
i.SpreadRxQueuesOnWorkers(memif.SwIfIndex, podSpec.IfSpec.NumRxQueues)
119-
case types.InterfaceEventDeleted: // this might not be needed here, it could be handled internally in the watcher
120-
watcher.Stop()
121123
}
122-
}
123124

124-
i.log.WithFields(map[string]interface{}{
125-
"swIfIndex": memif.SwIfIndex,
126-
}).Infof("done watching interface events for: %v", i.Name)
125+
i.log.WithFields(map[string]interface{}{
126+
"swIfIndex": memif.SwIfIndex,
127+
}).Infof("done watching interface events for: %v", i.Name)
127128

128-
}()
129+
}()
130+
}
129131

130132
err = i.vpp.SetInterfaceTag(memif.SwIfIndex, podSpec.GetInterfaceTag(i.Name))
131133
if err != nil {

config/config.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,10 @@ type RedirectToHostRulesConfigType struct {
278278
}
279279

280280
type CalicoVppDebugConfigType struct {
281-
PoliciesEnabled *bool `json:"policiesEnabled,omitempty"`
282-
ServicesEnabled *bool `json:"servicesEnabled,omitempty"`
283-
GSOEnabled *bool `json:"gsoEnabled,omitempty"`
281+
PoliciesEnabled *bool `json:"policiesEnabled,omitempty"`
282+
ServicesEnabled *bool `json:"servicesEnabled,omitempty"`
283+
GSOEnabled *bool `json:"gsoEnabled,omitempty"`
284+
SpreadTxQueuesOnWorkers *bool `json:"spreadTxQueuesOnWorkers,omitempty"`
284285
}
285286

286287
func (self *CalicoVppDebugConfigType) String() string {
@@ -298,6 +299,9 @@ func (self *CalicoVppDebugConfigType) Validate() (err error) {
298299
if self.GSOEnabled == nil {
299300
self.GSOEnabled = &True
300301
}
302+
if self.SpreadTxQueuesOnWorkers == nil {
303+
self.SpreadTxQueuesOnWorkers = &False
304+
}
301305
return
302306
}
303307

0 commit comments

Comments
 (0)