safchain / ethtool

A simple ethtool "like" library for GO
Apache License 2.0
116 stars 69 forks source link

Update MAX_GSTRINGS to 32768 #48

Closed Stephenxf closed 2 years ago

Stephenxf commented 2 years ago

As stated in Issue #45, the number of entries from ethtool stats can go beyond the current MAX_GSTRINGS limit with some firmware versions from certain NIC vendors. One example is Mellanox MT27800 ConnectX-5 with the following firmware.

$ ethtool -i enp1s0f0
driver: mlx5_core
version: 5.1-2.3.7
firmware-version: 16.28.4512 (DEL0000000016)
expansion-rom-version:
bus-info: 0000:01:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: yes

Before the change (with added logs to show the error and # of entries):

[stephen@ld1 ethtool]$ go test -run TestStats -v
=== RUN   TestStats
 Interface lo, err: operation not supported
 Interface em1, len(stats) 72
 Interface enp1s0f0, err: ethtool currently doesn't support more than 16384 entries, received 19338 <<<<<
 Interface enp1s0f1, len(stats) 5910
--- PASS: TestStats (0.00s)
PASS
ok      _/export/home/stephen/ethtool     0.006s

After the change:

[stephen@ld1 ethtool]$ go test -run TestStats -v
=== RUN   TestStats
 Interface lo, err: operation not supported
 Interface em1, len(stats) 72
 Interface enp1s0f0, len(stats) 19140
 Interface enp1s0f1, len(stats) 5910
--- PASS: TestStats (0.01s)
PASS
ok      _/export/home/stephen/ethtool     0.015s
Stephenxf commented 2 years ago

@safchain Thanks a lot for merging the PR. Can you please add a tag, say v0.2.0, to the latest commit? That would make it very easy for us to integrate.

safchain commented 2 years ago

@Stephenxf I just created a new tag

Stephenxf commented 2 years ago

@safchain Thank you for helping out. However, it seems the new tag was not created against the latest commit which I'm looking to integrate. Instead, it overlaps with the previous v0.1.0 tag. Can you please fix it?

commit 8cbc1a9536b0e99914348297afc675c6150e283c (HEAD -> master, origin/master, origin/HEAD)
Merge: 00502cf 532e6d1
Author: Sylvain Afchain <safchain@gmail.com>
Date:   Tue Mar 8 22:01:47 2022 +0100

    Merge pull request #48 from Stephenxf/master

    Update MAX_GSTRINGS to 32768

commit 532e6d132c2edb4629c2164d83eb5f130ad6ffeb
Author: Stephen Xu <xufeng8333@gmail.com>
Date:   Sat Mar 5 02:26:49 2022 -0800

    Update MAX_GSTRINGS to 32768

commit 00502cff1260786ff251766033363dfd631d9c2f (tag: v0.2.0, tag: v0.1.0)
Merge: 2c3de5d 4f1d71a
Author: Sylvain Afchain <safchain@gmail.com>
Date:   Wed Oct 27 15:15:06 2021 +0200

    Merge pull request #40 from bdrung/c-string

    Fix converting zero-terminated string to Go string
safchain commented 2 years ago

Sorry for that. I updated the tag, it should be OK now

Stephenxf commented 2 years ago

Awesome! Thank you very much, big help!