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
  • Loading branch information
oilbeater committed Jul 6, 2021
1 parent c27c764 commit b4ce83a
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 31 deletions.
1 change: 0 additions & 1 deletion dist/images/install-pre-1.16.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1654,7 +1654,6 @@ spec:
- --iface=${IFACE}
- --network-type=$NETWORK_TYPE
- --default-interface-name=$VLAN_INTERFACE_NAME
- --hw-offload=$HW_OFFLOAD
securityContext:
runAsUser: 0
privileged: true
Expand Down
1 change: 0 additions & 1 deletion dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,6 @@ spec:
- --iface=${IFACE}
- --network-type=$NETWORK_TYPE
- --default-interface-name=$VLAN_INTERFACE_NAME
- --hw-offload=$HW_OFFLOAD
securityContext:
runAsUser: 0
privileged: true
Expand Down
3 changes: 0 additions & 3 deletions pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ type Configuration struct {
NetworkType string
DefaultProviderName string
DefaultInterfaceName string
HwOffload bool
}

// ParseFlags will parse cmd args then init kubeClient and configuration
Expand All @@ -62,7 +61,6 @@ func ParseFlags() (*Configuration, error) {
argNodeLocalDnsIP = pflag.String("node-local-dns-ip", "", "If use nodelocaldns the local dns server ip should be set here, default empty.")
argEncapChecksum = pflag.Bool("encap-checksum", true, "Enable checksum, default: true")
argPprofPort = pflag.Int("pprof-port", 10665, "The port to get profiling data, default: 10665")
argHwOffload = pflag.Bool("hw-offload", false, "Enable hw offload, default: false")

argsNetworkType = pflag.String("network-type", "geneve", "The ovn network type, default: geneve")
argsDefaultProviderName = pflag.String("default-provider-name", "provider", "The vlan or vxlan type default provider interface name, default: provider")
Expand Down Expand Up @@ -111,7 +109,6 @@ func ParseFlags() (*Configuration, error) {
NetworkType: *argsNetworkType,
DefaultProviderName: *argsDefaultProviderName,
DefaultInterfaceName: *argsDefaultInterfaceName,
HwOffload: *argHwOffload,
}

if err := config.initKubeClient(); err != nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/daemon/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,6 @@ func (c *Controller) Run(stopCh <-chan struct{}) {

klog.Info("Started workers")
go wait.Until(c.loopOvn0Check, 5*time.Second, stopCh)
if !c.config.HwOffload {
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
2 changes: 1 addition & 1 deletion pkg/daemon/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func InitNodeGateway(config *Configuration) error {
}

ipAddr = util.GetIpAddrWithMask(ip, cidr)
return configureNodeNic(portName, ipAddr, gw, mac, config.MTU, config.HwOffload)
return configureNodeNic(portName, ipAddr, gw, mac, config.MTU)
}

func InitMirror(config *Configuration) error {
Expand Down
22 changes: 1 addition & 21 deletions pkg/daemon/ovs.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func waitNetworkReady(gateway string) error {
return nil
}

func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int, enableOffload bool) error {
func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int) error {
ipStr := util.GetIpWithoutMask(ip)
raw, err := ovs.Exec(ovs.MayExist, "add-port", "br-int", util.NodeNic, "--",
"set", "interface", util.NodeNic, "type=internal", "--",
Expand All @@ -300,16 +300,6 @@ func configureNodeNic(portName, ip, gw string, macAddr net.HardwareAddr, mtu int
return fmt.Errorf("can not set host nic %s qlen %v", util.NodeNic, err)
}

if !enableOffload {
// 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)
if err != nil {
Expand All @@ -321,16 +311,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
1 change: 0 additions & 1 deletion yamls/kube-ovn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ spec:
- --iface=
- --network-type=geneve
- --default-interface-name=
- --hw-offload=false
securityContext:
runAsUser: 0
privileged: true
Expand Down

0 comments on commit b4ce83a

Please sign in to comment.