One thing that has annoyed me for a long time on Linux systems is when
the network interface stats overflow at 32bit.  Later versions of the
kernel support 64 bit stats on a 32 bit system to fix this.  However
the current trunk version of openwrt and luci truncate the stats back
to 32 bit.

Not all kernel drivers are updated to support the new APIs but many
are such as the bridge and vlan drivers.  On a typical router with a
just a DHCP connection for the WAN interface this is enough to get 64
bit stats on your LAN (bridge) and WAN (vlan) interface.
Unfortunately the PPPOE driver still only supports 32 bit stats.

To get the luci interface to show 64 bit stats I had to make a couple
small changes to the netifd and luci packages.

For netifd I basically just changed blobmsg_add_u32 to blobmsg_add_u64
in the system_if_stats function and modified types and such
accordingly.

luci was using a function in network.lua named uint on the stats data
from netifd.  However, I think blobmsg_add_u64 actually passes the
data as a string which the uint function cannot handle.  I replaced
the contents of the uint function with simply "return tonumber(x) or
0" to make it work.  This is probably not the best way to fix it but I
know almost nothing about lua.

In the future I plan to look into patching some of the kernel drivers
such as b43, b44 and PPPOE to also support 64 bits stats...  but I
might never actually get around to it.  b44 looked like it might be
relatively easy, PPPOE looked a lot more confusing and I haven't
looked at b43 at all yet.

I am not sure exactly how I am supposed to include the patch files in
this message.  I know the preferred method is to inline the patch but
this is actually two patches to two different packages.  Maybe I
should send them in two separate posts?  For now I will just attached
them to this post.  These patches were tested on x86 and a wrt54gs
with a recent trunk version of openwrt.

Signed-off-by: Kevin Groeneveld <kgroenev...@gmail.com>

---

Attachment: netifd_64_bit_stats.patch
Description: Binary data

Attachment: luci_64_bit_stats.patch
Description: Binary data

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to