make GRO/GSO variable names more consistent with Go style

PiperOrigin-RevId: 622294934
This commit is contained in:
Kevin Krakauer
2024-04-05 15:24:04 -07:00
committed by gVisor bot
parent ea1a15131f
commit 336193e33a
11 changed files with 35 additions and 35 deletions
+5 -5
View File
@@ -66,7 +66,7 @@ type linkDispatcher interface {
type PacketDispatchMode int
// BatchSize is the number of packets to write in each syscall. It is 47
// because when GvisorGSO is in use then a single 65KB TCP segment can get
// because when GVisorGSO is in use then a single 65KB TCP segment can get
// split into 46 segments of 1420 bytes and a single 216 byte segment.
const BatchSize = 47
@@ -201,8 +201,8 @@ type Options struct {
// disabled.
GSOMaxSize uint32
// GvisorGSOEnabled indicates whether Gvisor GSO is enabled or not.
GvisorGSOEnabled bool
// GVisorGSOEnabled indicates whether Gvisor GSO is enabled or not.
GVisorGSOEnabled bool
// PacketDispatchMode specifies the type of inbound dispatcher to be
// used for this endpoint.
@@ -315,8 +315,8 @@ func New(opts *Options) (stack.LinkEndpoint, error) {
e.fds = append(e.fds, fdInfo{fd: fd, isSocket: isSocket})
if isSocket {
if opts.GSOMaxSize != 0 {
if opts.GvisorGSOEnabled {
e.gsoKind = stack.GvisorGSOSupported
if opts.GVisorGSOEnabled {
e.gsoKind = stack.GVisorGSOSupported
} else {
e.gsoKind = stack.HostGSOSupported
}
+1 -1
View File
@@ -29,7 +29,7 @@ var _ stack.QueueingDiscipline = (*discipline)(nil)
const (
// BatchSize is the number of packets to write in each syscall. It is 47
// because when GvisorGSO is in use then a single 65KB TCP segment can get
// because when GVisorGSO is in use then a single 65KB TCP segment can get
// split into 46 segments of 1420 bytes and a single 216 byte segment.
BatchSize = 47
+1 -1
View File
@@ -515,5 +515,5 @@ func (e *endpoint) GSOMaxSize() uint32 {
// SupportsGSO implements stack.GSOEndpoint.
func (e *endpoint) SupportedGSO() stack.SupportedGSO {
return stack.GvisorGSOSupported
return stack.GVisorGSOSupported
}
+4 -4
View File
@@ -1370,9 +1370,9 @@ const (
// non-networking data layer.
HostGSOSupported
// GvisorGSOSupported indicates that segmentation offloading may be performed
// GVisorGSOSupported indicates that segmentation offloading may be performed
// in gVisor.
GvisorGSOSupported
GVisorGSOSupported
)
// GSOEndpoint provides access to GSO properties.
@@ -1384,6 +1384,6 @@ type GSOEndpoint interface {
SupportedGSO() SupportedGSO
}
// GvisorGSOMaxSize is a maximum allowed size of a software GSO segment.
// GVisorGSOMaxSize is a maximum allowed size of a software GSO segment.
// This isn't a hard limit, because it is never set into packet headers.
const GvisorGSOMaxSize = 1 << 16
const GVisorGSOMaxSize = 1 << 16
+3 -3
View File
@@ -311,10 +311,10 @@ func (r *Route) RequiresTXTransportChecksum() bool {
return r.outgoingNIC.NetworkLinkEndpoint.Capabilities()&CapabilityTXChecksumOffload == 0
}
// HasGvisorGSOCapability returns true if the route supports gVisor GSO.
func (r *Route) HasGvisorGSOCapability() bool {
// HasGVisorGSOCapability returns true if the route supports gVisor GSO.
func (r *Route) HasGVisorGSOCapability() bool {
if gso, ok := r.outgoingNIC.NetworkLinkEndpoint.(GSOEndpoint); ok {
return gso.SupportedGSO() == GvisorGSOSupported
return gso.SupportedGSO() == GVisorGSOSupported
}
return false
}
+1 -1
View File
@@ -3197,7 +3197,7 @@ func (e *Endpoint) initHostGSO() {
func (e *Endpoint) initGSO() {
if e.route.HasHostGSOCapability() {
e.initHostGSO()
} else if e.route.HasGvisorGSOCapability() {
} else if e.route.HasGVisorGSOCapability() {
e.gso = stack.GSO{
MaxSize: e.route.GSOMaxSize(),
Type: stack.GSOGvisor,
+7 -7
View File
@@ -98,8 +98,8 @@ type FDBasedLink struct {
Addresses []IPWithPrefix
Routes []Route
GSOMaxSize uint32
GvisorGSOEnabled bool
GvisorGRO bool
GVisorGSOEnabled bool
GVisorGRO bool
TXChecksumOffload bool
RXChecksumOffload bool
LinkAddress net.HardwareAddr
@@ -135,7 +135,7 @@ type XDPLink struct {
LinkAddress net.HardwareAddr
QDisc config.QueueingDiscipline
Neighbors []Neighbor
GvisorGRO bool
GVisorGRO bool
Bind BindOpt
// NumChannels controls how many underlying FDs are to be used to
@@ -148,7 +148,7 @@ type LoopbackLink struct {
Name string
Addresses []IPWithPrefix
Routes []Route
GvisorGRO bool
GVisorGRO bool
}
// CreateLinksAndRoutesArgs are arguments to CreateLinkAndRoutes.
@@ -312,10 +312,10 @@ func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct
Address: mac,
PacketDispatchMode: dispatchMode,
GSOMaxSize: link.GSOMaxSize,
GvisorGSOEnabled: link.GvisorGSOEnabled,
GVisorGSOEnabled: link.GVisorGSOEnabled,
TXChecksumOffload: link.TXChecksumOffload,
RXChecksumOffload: link.RXChecksumOffload,
GRO: link.GvisorGRO,
GRO: link.GVisorGRO,
})
if err != nil {
return err
@@ -408,7 +408,7 @@ func (n *Network) CreateLinksAndRoutes(args *CreateLinksAndRoutesArgs, _ *struct
RXChecksumOffload: link.RXChecksumOffload,
InterfaceIndex: link.InterfaceIndex,
Bind: link.Bind == BindSentry,
GRO: link.GvisorGRO,
GRO: link.GVisorGRO,
})
if err != nil {
return err
+4 -4
View File
@@ -121,12 +121,12 @@ type Config struct {
// HostGSO indicates that host segmentation offload is enabled.
HostGSO bool `flag:"gso"`
// GvisorGSO indicates that gVisor segmentation offload is enabled. The flag
// GVisorGSO indicates that gVisor segmentation offload is enabled. The flag
// retains its old name of "software" GSO for API consistency.
GvisorGSO bool `flag:"software-gso"`
GVisorGSO bool `flag:"software-gso"`
// GvisorGRO enables gVisor's generic receive offload.
GvisorGRO bool `flag:"gvisor-gro"`
// GVisorGRO enables gVisor's generic receive offload.
GVisorGRO bool `flag:"gvisor-gro"`
// TXChecksumOffload indicates that TX Checksum Offload is enabled.
TXChecksumOffload bool `flag:"tx-checksum-offload"`
+7 -7
View File
@@ -77,7 +77,7 @@ func setupNetwork(conn *urpc.Client, pid int, conf *config.Config) error {
func createDefaultLoopbackInterface(conf *config.Config, conn *urpc.Client) error {
link := boot.DefaultLoopbackLink
link.GvisorGRO = conf.GvisorGRO
link.GVisorGRO = conf.GVisorGRO
if err := conn.Call(boot.NetworkCreateLinksAndRoutes, &boot.CreateLinksAndRoutesArgs{
LoopbackLinks: []boot.LoopbackLink{link},
}, nil); err != nil {
@@ -277,7 +277,7 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string, conf *con
Neighbors: neighbors,
LinkAddress: linkAddress,
Addresses: addresses,
GvisorGRO: conf.GvisorGRO,
GVisorGRO: conf.GVisorGRO,
})
} else {
link := boot.FDBasedLink{
@@ -312,12 +312,12 @@ func createInterfacesAndRoutesFromNS(conn *urpc.Client, nsPath string, conf *con
args.FilePayload.Files = append(args.FilePayload.Files, socketEntry.deviceFile)
}
if link.GSOMaxSize == 0 && conf.GvisorGSO {
if link.GSOMaxSize == 0 && conf.GVisorGSO {
// Host GSO is disabled. Let's enable gVisor GSO.
link.GSOMaxSize = stack.GvisorGSOMaxSize
link.GvisorGSOEnabled = true
link.GSOMaxSize = stack.GVisorGSOMaxSize
link.GVisorGSOEnabled = true
}
link.GvisorGRO = conf.GvisorGRO
link.GVisorGRO = conf.GVisorGRO
args.FDBasedLinks = append(args.FDBasedLinks, link)
}
@@ -430,7 +430,7 @@ func createSocket(iface net.Interface, ifaceLink netlink.Link, enableGSO bool) (
func loopbackLink(conf *config.Config, iface net.Interface, addrs []net.Addr) (boot.LoopbackLink, error) {
link := boot.LoopbackLink{
Name: iface.Name,
GvisorGRO: conf.GvisorGRO,
GVisorGRO: conf.GVisorGRO,
}
for _, addr := range addrs {
ipNet, ok := addr.(*net.IPNet)
+1 -1
View File
@@ -216,7 +216,7 @@ func prepareRedirectInterfaceArgs(bind boot.BindOpt, conf *config.Config) (boot.
Neighbors: neighbors,
LinkAddress: linkAddress,
Addresses: []boot.IPWithPrefix{addr},
GvisorGRO: conf.GvisorGRO,
GVisorGRO: conf.GVisorGRO,
Bind: bind,
}
args.XDPLinks = append(args.XDPLinks, xdplink)
+1 -1
View File
@@ -231,7 +231,7 @@ func newNetstackImpl(mode string) (impl, error) {
// PacketDispatchMode: fdbased.RecvMMsg,
PacketDispatchMode: fdbased.PacketMMap,
GSOMaxSize: uint32(*gso),
GvisorGSOEnabled: *swgso,
GVisorGSOEnabled: *swgso,
})
}
if err != nil {