Use tcpip.NICID when get/set-ing GRO timeout

PiperOrigin-RevId: 529535113
This commit is contained in:
Ghanan Gowripalan
2023-05-04 15:47:28 -07:00
committed by gVisor bot
parent 0f2cdb3d9f
commit 8b0c4c6408
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -511,12 +511,12 @@ func (s *Stack) SetPortRange(start uint16, end uint16) error {
}
// GROTimeout implements inet.Stack.GROTimeout.
func (s *Stack) GROTimeout(NICID int32) (time.Duration, error) {
timeout, err := s.Stack.GROTimeout(NICID)
func (s *Stack) GROTimeout(nicID int32) (time.Duration, error) {
timeout, err := s.Stack.GROTimeout(tcpip.NICID(nicID))
return timeout, syserr.TranslateNetstackError(err).ToError()
}
// SetGROTimeout implements inet.Stack.SetGROTimeout.
func (s *Stack) SetGROTimeout(NICID int32, timeout time.Duration) error {
return syserr.TranslateNetstackError(s.Stack.SetGROTimeout(NICID, timeout)).ToError()
func (s *Stack) SetGROTimeout(nicID int32, timeout time.Duration) error {
return syserr.TranslateNetstackError(s.Stack.SetGROTimeout(tcpip.NICID(nicID), timeout)).ToError()
}
+4 -4
View File
@@ -710,11 +710,11 @@ func (s *Stack) SetPortRange(start uint16, end uint16) tcpip.Error {
}
// GROTimeout returns the GRO timeout.
func (s *Stack) GROTimeout(NICID int32) (time.Duration, tcpip.Error) {
func (s *Stack) GROTimeout(nicID tcpip.NICID) (time.Duration, tcpip.Error) {
s.mu.RLock()
defer s.mu.RUnlock()
nic, ok := s.nics[tcpip.NICID(NICID)]
nic, ok := s.nics[nicID]
if !ok {
return 0, &tcpip.ErrUnknownNICID{}
}
@@ -723,11 +723,11 @@ func (s *Stack) GROTimeout(NICID int32) (time.Duration, tcpip.Error) {
}
// SetGROTimeout sets the GRO timeout.
func (s *Stack) SetGROTimeout(NICID int32, timeout time.Duration) tcpip.Error {
func (s *Stack) SetGROTimeout(nicID tcpip.NICID, timeout time.Duration) tcpip.Error {
s.mu.RLock()
defer s.mu.RUnlock()
nic, ok := s.nics[tcpip.NICID(NICID)]
nic, ok := s.nics[nicID]
if !ok {
return &tcpip.ErrUnknownNICID{}
}