diff --git a/link.go b/link.go index 028119b..8943295 100644 --- a/link.go +++ b/link.go @@ -45,6 +45,8 @@ type LinkAttrs struct { NetNsID int NumTxQueues int NumRxQueues int + TSOMaxSegs uint32 + TSOMaxSize uint32 GSOMaxSegs uint32 GSOMaxSize uint32 GROMaxSize uint32 diff --git a/link_linux.go b/link_linux.go index 37682ee..36a1f37 100644 --- a/link_linux.go +++ b/link_linux.go @@ -2070,6 +2070,10 @@ func LinkDeserialize(hdr *unix.NlMsghdr, m []byte) (Link, error) { base.PhysSwitchID = int(native.Uint32(attr.Value[0:4])) case unix.IFLA_LINK_NETNSID: base.NetNsID = int(native.Uint32(attr.Value[0:4])) + case unix.IFLA_TSO_MAX_SEGS: + base.TSOMaxSegs = native.Uint32(attr.Value[0:4]) + case unix.IFLA_TSO_MAX_SIZE: + base.TSOMaxSize = native.Uint32(attr.Value[0:4]) case unix.IFLA_GSO_MAX_SEGS: base.GSOMaxSegs = native.Uint32(attr.Value[0:4]) case unix.IFLA_GSO_MAX_SIZE: diff --git a/link_test.go b/link_test.go index 83e9c10..f7b83c6 100644 --- a/link_test.go +++ b/link_test.go @@ -2148,6 +2148,26 @@ func TestLinkSetGROMaxSize(t *testing.T) { } } +func TestLinkGetTSOMax(t *testing.T) { + minKernelRequired(t, 5, 19) + tearDown := setUpNetlinkTest(t) + defer tearDown() + + iface := &Veth{LinkAttrs: LinkAttrs{Name: "foo", TxQLen: testTxQLen, MTU: 1500}, PeerName: "bar"} + if err := LinkAdd(iface); err != nil { + t.Fatal(err) + } + + link, err := LinkByName("foo") + if err != nil { + t.Fatal(err) + } + + if link.Attrs().TSOMaxSize != 524280 || link.Attrs().TSOMaxSegs != 65535 { + t.Fatalf("TSO max size and segments could not be retrieved") + } +} + func TestLinkSetGSOIPv4MaxSize(t *testing.T) { minKernelRequired(t, 6, 3) tearDown := setUpNetlinkTest(t)