Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow user to set vxlan_sys_4789 tx off #4543

Merged
merged 5 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ base-arm64:
docker buildx build --platform linux/arm64 --build-arg ARCH=arm64 --build-arg GO_VERSION=$(GO_VERSION) -t $(REGISTRY)/kube-ovn-base:$(RELEASE_TAG)-arm64 -o type=docker -f dist/images/Dockerfile.base dist/images/
docker buildx build --platform linux/arm64 --build-arg ARCH=arm64 --build-arg GO_VERSION=$(GO_VERSION) --build-arg DEBUG=true -t $(REGISTRY)/kube-ovn-base:$(DEBUG_TAG)-arm64 -o type=docker -f dist/images/Dockerfile.base dist/images/


.PHONY: build-kit
build-kit: build-go
DOCKER_BUILDKIT=1 docker build -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/

.PHONY: image-kube-ovn
image-kube-ovn: image-kube-ovn-debug build-go
docker buildx build --platform linux/amd64 -t $(REGISTRY)/kube-ovn:$(RELEASE_TAG) --build-arg VERSION=$(RELEASE_TAG) -o type=docker -f dist/images/Dockerfile dist/images/
Expand Down
1 change: 1 addition & 0 deletions charts/kube-ovn/templates/ovncni-ds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ spec:
- --ovs-vsctl-concurrency={{ .Values.performance.OVS_VSCTL_CONCURRENCY }}
- --secure-serving={{- .Values.func.SECURE_SERVING }}
- --enable-ovn-ipsec={{- .Values.func.ENABLE_OVN_IPSEC }}
- --set-tx-off={{- .Values.func.SET_TX_OFF }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--set-vxlan-tx-off is more clear

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

securityContext:
runAsUser: {{ include "kubeovn.runAsUser" . }}
runAsGroup: 0
Expand Down
1 change: 1 addition & 0 deletions charts/kube-ovn/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ func:
ENABLE_NAT_GW: true
ENABLE_OVN_IPSEC: false
ENABLE_ANP: false
SET_TX_OFF: false

ipv4:
POD_CIDR: "10.16.0.0/16"
Expand Down
6 changes: 6 additions & 0 deletions cmd/daemon/cniserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ func main() {
util.LogFatalAndExit(err, "failed to do the OS initialization")
}

if config.SetTxOff && config.NetworkType == util.NetworkTypeVxlan {
if err := setVxlanNicTxOff(); err != nil {
util.LogFatalAndExit(err, "failed to do the OS initialization for vxlan case")
}
}

ctrl.SetLogger(klog.NewKlogr())
ctx := signals.SetupSignalHandler()
stopCh := ctx.Done()
Expand Down
18 changes: 17 additions & 1 deletion cmd/daemon/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import (
"github.com/kubeovn/kube-ovn/pkg/daemon"
)

const geneveLinkName = "genev_sys_6081"
const (
geneveLinkName = "genev_sys_6081"
vxlanLinkName = "vxlan_sys_4789"
)

func printCaps() {
currentCaps := cap.GetProc()
Expand All @@ -30,3 +33,16 @@ func initForOS() error {
// disable checksum for genev_sys_6081 as default
return daemon.TurnOffNicTxChecksum(geneveLinkName)
}

func setVxlanNicTxOff() error {
if _, err := netlink.LinkByName(vxlanLinkName); err != nil {
if _, ok := err.(netlink.LinkNotFoundError); ok {
return nil
}
klog.Errorf("failed to get link %s: %v", vxlanLinkName, err)
return err
}

// disable checksum for vxlan_sys_4789 as default
return daemon.TurnOffNicTxChecksum(vxlanLinkName)
}
5 changes: 5 additions & 0 deletions cmd/daemon/init_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ func initForOS() error {

return nil
}

func setVxlanNicTxOff() error {
// TODO: implement this function
return nil
}
2 changes: 2 additions & 0 deletions dist/images/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ ENABLE_COMPACT=${ENABLE_COMPACT:-false}
SECURE_SERVING=${SECURE_SERVING:-false}
ENABLE_OVN_IPSEC=${ENABLE_OVN_IPSEC:-false}
ENABLE_ANP=${ENABLE_ANP:-false}
SET_TX_OFF=${SET_TX_OFF:-false}

# debug
DEBUG_WRAPPER=${DEBUG_WRAPPER:-}
Expand Down Expand Up @@ -4494,6 +4495,7 @@ spec:
- --ovs-vsctl-concurrency=$OVS_VSCTL_CONCURRENCY
- --secure-serving=${SECURE_SERVING}
- --enable-ovn-ipsec=$ENABLE_OVN_IPSEC
- --set-tx-off=$SET_TX_OFF
securityContext:
runAsUser: ${RUN_AS_USER}
runAsGroup: 0
Expand Down
3 changes: 3 additions & 0 deletions pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Configuration struct {
UDPConnCheckPort int32
EnableTProxy bool
OVSVsctlConcurrency int32
SetTxOff bool
}

// ParseFlags will parse cmd args then init kubeClient and configuration
Expand Down Expand Up @@ -114,6 +115,7 @@ func ParseFlags() *Configuration {
argEnableTProxy = pflag.Bool("enable-tproxy", false, "enable tproxy for vpc pod liveness or readiness probe")
argOVSVsctlConcurrency = pflag.Int32("ovs-vsctl-concurrency", 100, "concurrency limit of ovs-vsctl")
argEnableOVNIPSec = pflag.Bool("enable-ovn-ipsec", false, "Whether to enable ovn ipsec")
argSetTxOff = pflag.Bool("set-tx-off", false, "Whether to set vxlan_sys_4789 tx off")
)

// mute info log for ipset lib
Expand Down Expand Up @@ -173,6 +175,7 @@ func ParseFlags() *Configuration {
UDPConnCheckPort: *argUDPConnectivityCheckPort,
EnableTProxy: *argEnableTProxy,
OVSVsctlConcurrency: *argOVSVsctlConcurrency,
SetTxOff: *argSetTxOff,
}
return config
}
Expand Down
1 change: 1 addition & 0 deletions pkg/daemon/ovs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1839,6 +1839,7 @@ func TurnOffNicTxChecksum(nicName string) error {
elapsed := float64((time.Since(start)) / time.Millisecond)
klog.V(4).Infof("command %s %s in %vms", "ethtool", strings.Join(args, " "), elapsed)
if err != nil {
klog.Error(err)
return fmt.Errorf("failed to turn off nic tx checksum, output %s, err %s", string(output), err.Error())
}
return nil
Expand Down
Loading