mirror of https://github.com/vishvananda/netlink
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:
parent
aad0baef28
commit
b9fd9670a1
|
@ -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
|
||||
|
|
|
@ -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 := ðtoolGstrings{
|
||||
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 := ðtoolStats{
|
||||
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)))
|
||||
|
|
Loading…
Reference in New Issue