2014-07-28 00:58:07 +02:00
|
|
|
local ethtool = require 'ethtool_stats'
|
2014-06-09 18:48:15 +02:00
|
|
|
|
2014-07-28 00:58:07 +02:00
|
|
|
local fields = ethtool.interface_stats('bat0')
|
2014-06-09 18:48:15 +02:00
|
|
|
|
|
|
|
local traffic = {}
|
|
|
|
for _, class in ipairs({'rx', 'tx', 'forward', 'mgmt_rx', 'mgmt_tx'}) do
|
2014-06-10 15:44:35 +02:00
|
|
|
traffic[class] = {
|
|
|
|
bytes = fields[class .. '_bytes'],
|
|
|
|
packets = fields[class],
|
|
|
|
}
|
2014-06-09 18:48:15 +02:00
|
|
|
end
|
|
|
|
traffic['tx']['dropped'] = fields['tx_dropped']
|
|
|
|
|
|
|
|
return traffic
|