@@ -44,6 +44,7 @@ import (
44
44
"antrea.io/antrea/pkg/agent/route"
45
45
"antrea.io/antrea/pkg/agent/types"
46
46
"antrea.io/antrea/pkg/agent/util"
47
+ "antrea.io/antrea/pkg/agent/util/ethtool"
47
48
"antrea.io/antrea/pkg/agent/wireguard"
48
49
"antrea.io/antrea/pkg/features"
49
50
"antrea.io/antrea/pkg/ovs/ovsconfig"
@@ -81,22 +82,23 @@ var otherConfigKeysForIPsecCertificates = []string{"certificate", "private_key",
81
82
82
83
// Initializer knows how to setup host networking, OpenVSwitch, and Openflow.
83
84
type Initializer struct {
84
- client clientset.Interface
85
- ovsBridgeClient ovsconfig.OVSBridgeClient
86
- ofClient openflow.Client
87
- routeClient route.Interface
88
- wireGuardClient wireguard.Interface
89
- ifaceStore interfacestore.InterfaceStore
90
- ovsBridge string
91
- hostGateway string // name of gateway port on the OVS bridge
92
- mtu int
93
- networkConfig * config.NetworkConfig
94
- nodeConfig * config.NodeConfig
95
- wireGuardConfig * config.WireGuardConfig
96
- egressConfig * config.EgressConfig
97
- serviceConfig * config.ServiceConfig
98
- enableProxy bool
99
- connectUplinkToBridge bool
85
+ client clientset.Interface
86
+ ovsBridgeClient ovsconfig.OVSBridgeClient
87
+ ofClient openflow.Client
88
+ routeClient route.Interface
89
+ wireGuardClient wireguard.Interface
90
+ ifaceStore interfacestore.InterfaceStore
91
+ ovsBridge string
92
+ hostGateway string // name of gateway port on the OVS bridge
93
+ mtu int
94
+ networkConfig * config.NetworkConfig
95
+ nodeConfig * config.NodeConfig
96
+ wireGuardConfig * config.WireGuardConfig
97
+ egressConfig * config.EgressConfig
98
+ serviceConfig * config.ServiceConfig
99
+ enableProxy bool
100
+ connectUplinkToBridge bool
101
+ disableTXChecksumOffload bool
100
102
// networkReadyCh should be closed once the Node's network is ready.
101
103
// The CNI server will wait for it before handling any CNI Add requests.
102
104
proxyAll bool
@@ -122,25 +124,27 @@ func NewInitializer(
122
124
enableProxy bool ,
123
125
proxyAll bool ,
124
126
connectUplinkToBridge bool ,
127
+ disableTXChecksumOffload bool ,
125
128
) * Initializer {
126
129
return & Initializer {
127
- ovsBridgeClient : ovsBridgeClient ,
128
- client : k8sClient ,
129
- ifaceStore : ifaceStore ,
130
- ofClient : ofClient ,
131
- routeClient : routeClient ,
132
- ovsBridge : ovsBridge ,
133
- hostGateway : hostGateway ,
134
- mtu : mtu ,
135
- networkConfig : networkConfig ,
136
- wireGuardConfig : wireGuardConfig ,
137
- egressConfig : egressConfig ,
138
- serviceConfig : serviceConfig ,
139
- networkReadyCh : networkReadyCh ,
140
- stopCh : stopCh ,
141
- enableProxy : enableProxy ,
142
- proxyAll : proxyAll ,
143
- connectUplinkToBridge : connectUplinkToBridge ,
130
+ ovsBridgeClient : ovsBridgeClient ,
131
+ client : k8sClient ,
132
+ ifaceStore : ifaceStore ,
133
+ ofClient : ofClient ,
134
+ routeClient : routeClient ,
135
+ ovsBridge : ovsBridge ,
136
+ hostGateway : hostGateway ,
137
+ mtu : mtu ,
138
+ networkConfig : networkConfig ,
139
+ wireGuardConfig : wireGuardConfig ,
140
+ egressConfig : egressConfig ,
141
+ serviceConfig : serviceConfig ,
142
+ networkReadyCh : networkReadyCh ,
143
+ stopCh : stopCh ,
144
+ enableProxy : enableProxy ,
145
+ proxyAll : proxyAll ,
146
+ connectUplinkToBridge : connectUplinkToBridge ,
147
+ disableTXChecksumOffload : disableTXChecksumOffload ,
144
148
}
145
149
}
146
150
@@ -663,6 +667,16 @@ func (i *Initializer) configureGatewayInterface(gatewayIface *interfacestore.Int
663
667
return err
664
668
}
665
669
670
+ if i .disableTXChecksumOffload {
671
+ if err := ethtool .EthtoolTXHWCsumSwitch (i .hostGateway , ethtool .TXCSUM_OFF ); err != nil {
672
+ return fmt .Errorf ("error when disabling TX checksum offload on %s: %v" , i .hostGateway , err )
673
+ }
674
+ } else {
675
+ if err := ethtool .EthtoolTXHWCsumSwitch (i .hostGateway , ethtool .TXCSUM_ON ); err != nil {
676
+ return fmt .Errorf ("error when enabling TX checksum offload on %s: %v" , i .hostGateway , err )
677
+ }
678
+ }
679
+
666
680
i .nodeConfig .GatewayConfig = & config.GatewayConfig {Name : i .hostGateway , MAC : gwMAC , OFPort : uint32 (gatewayIface .OFPort )}
667
681
gatewayIface .MAC = gwMAC
668
682
gatewayIface .IPs = []net.IP {}
0 commit comments