Skip to content

Commit

Permalink
perf: enable tx offload again as upstream already fix it
Browse files Browse the repository at this point in the history
(cherry picked from commit b4ce83a)

# Conflicts:
#	pkg/daemon/controller.go
#	pkg/daemon/ovs.go
  • Loading branch information
oilbeater committed Jul 6, 2021
1 parent f41d574 commit fd51251
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
6 changes: 3 additions & 3 deletions pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ func (c *Controller) getPolicyRouting(subnet *kubeovnv1.Subnet) ([]netlink.Rule,
} else {
for i := range protocols {
rule.Family, _ = util.ProtocolToFamily(protocols[i])
_, rule.Src, _ = net.ParseCIDR(cidr[i])
if len(cidr) == len(protocols) {
_, rule.Src, _ = net.ParseCIDR(cidr[i])
}
rules = append(rules, *rule)
}
}
Expand Down Expand Up @@ -610,8 +612,6 @@ func (c *Controller) Run(stopCh <-chan struct{}) {

klog.Info("Started workers")
go wait.Until(c.loopOvn0Check, 5*time.Second, stopCh)
go wait.Until(c.disableTunnelOffload, 5*time.Second, stopCh)

go wait.Until(c.runSubnetWorker, time.Second, stopCh)
go wait.Until(c.runPodWorker, time.Second, stopCh)
go wait.Until(c.runGateway, 3*time.Second, stopCh)
Expand Down
19 changes: 1 addition & 18 deletions pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,16 +293,9 @@ func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int
if err = netlink.LinkSetTxQLen(hostLink, 1000); err != nil {
return fmt.Errorf("can not set host nic %s qlen %v", util.NodeNic, err)
}
// Double nat may lead kernel udp checksum error, disable offload to prevent this issue
// https://github.com/kubernetes/kubernetes/pull/92035
output, err := exec.Command("ethtool", "-K", "ovn0", "tx", "off").CombinedOutput()
if err != nil {
klog.Errorf("failed to disable checksum offload on ovn0, %v %q", err, output)
return err
}

// ping ovn0 gw to activate the flow
output, err = ovn0Check(gw)
output, err := ovn0Check(gw)
if err != nil {
klog.Errorf("failed to init ovn0 check, %v, %q", err, output)
return err
Expand All @@ -312,16 +305,6 @@ func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int
return nil
}

func (c *Controller) disableTunnelOffload() {
_, err := netlink.LinkByName("genev_sys_6081")
if err == nil {
output, err := exec.Command("ethtool", "-K", "genev_sys_6081", "tx", "off").CombinedOutput()
if err != nil {
klog.Errorf("failed to disable checksum offload on genev_sys_6081, %v %q", err, output)
}
}
}

// If OVS restart, the ovn0 port will down and prevent host to pod network,
// Restart the kube-ovn-cni when this happens
func (c *Controller) loopOvn0Check() {
Expand Down

0 comments on commit fd51251

Please sign in to comment.