link, veth: remove useless call to retrieve ethtool strings

It's not needed for retrieving the veth peer ifindex, and we already
get the set count via earlier ETHTOOL_GSSET_INFO call. Both are copying
veth_get_sset_count() up to user space in veth case (which is the only
user of this anyway).

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This commit is contained in:
Daniel Borkmann 2019-11-06 09:49:17 +01:00 committed by Vish (Ishaya) Abrams
parent aad0baef28
commit b9fd9670a1
2 changed files with 1 additions and 20 deletions

View File

@ -56,14 +56,6 @@ type ethtoolSset struct {
data [1]uint32
}
// ethtoolGstrings is string set for data tagging
type ethtoolGstrings struct {
cmd uint32
stringSet uint32
length uint32
data [32]byte
}
type ethtoolStats struct {
cmd uint32
nStats uint32

View File

@ -2933,20 +2933,9 @@ func VethPeerIndex(link *Veth) (int, error) {
return -1, fmt.Errorf("SIOCETHTOOL request for %q failed, errno=%v", link.Attrs().Name, errno)
}
gstrings := &ethtoolGstrings{
cmd: ETHTOOL_GSTRINGS,
stringSet: ETH_SS_STATS,
length: sSet.data[0],
}
ifreq.Data = uintptr(unsafe.Pointer(gstrings))
_, _, errno = syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), SIOCETHTOOL, uintptr(unsafe.Pointer(ifreq)))
if errno != 0 {
return -1, fmt.Errorf("SIOCETHTOOL request for %q failed, errno=%v", link.Attrs().Name, errno)
}
stats := &ethtoolStats{
cmd: ETHTOOL_GSTATS,
nStats: gstrings.length,
nStats: sSet.data[0],
}
ifreq.Data = uintptr(unsafe.Pointer(stats))
_, _, errno = syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), SIOCETHTOOL, uintptr(unsafe.Pointer(ifreq)))