Skip to content
Snippets Groups Projects
Commit 21f8ec98 authored by Artee Roy's avatar Artee Roy Committed by Sukru Senli
Browse files

libethernet: Support for 64 bit counters.

parent 95aea2e2
No related branches found
No related tags found
No related merge requests found
...@@ -222,14 +222,14 @@ int bcm_eth_reset_phy(const char *name, int phy_id) ...@@ -222,14 +222,14 @@ int bcm_eth_reset_phy(const char *name, int phy_id)
static int bcm_eth_get_stats_from_proc(const char *ifname, struct eth_stats *s) static int bcm_eth_get_stats_from_proc(const char *ifname, struct eth_stats *s)
{ {
unsigned long rx_bytes, rx_packets, rx_err, rx_drop; uint64_t rx_bytes, rx_packets, rx_err, rx_drop;
unsigned long rx_fifo, rx_frame, rx_comp, rx_multi; uint64_t rx_fifo, rx_frame, rx_comp, rx_multi;
unsigned long tx_bytes, tx_packets, tx_err, tx_drop; uint64_t tx_bytes, tx_packets, tx_err, tx_drop;
unsigned long tx_fifo, tx_coll, tx_carr, tx_comp; uint64_t tx_fifo, tx_coll, tx_carr, tx_comp;
unsigned long tx_mcast_packets = 0, rx_mcast_bytes = 0, tx_mcast_bytes = 0; uint64_t tx_mcast_packets = 0, rx_mcast_bytes = 0, tx_mcast_bytes = 0;
unsigned long rx_ucast_packets = 0, tx_ucast_packets = 0; uint64_t rx_ucast_packets = 0, tx_ucast_packets = 0;
unsigned long rx_bcast_packets = 0, tx_bcast_packets = 0; uint64_t rx_bcast_packets = 0, tx_bcast_packets = 0;
unsigned long rx_err_unknown = 0; uint64_t rx_err_unknown = 0;
char cmdbuf[512] = {0}; char cmdbuf[512] = {0};
char *ptr; char *ptr;
int ret; int ret;
...@@ -243,8 +243,14 @@ static int bcm_eth_get_stats_from_proc(const char *ifname, struct eth_stats *s) ...@@ -243,8 +243,14 @@ static int bcm_eth_get_stats_from_proc(const char *ifname, struct eth_stats *s)
ptr = cmdbuf + strlen(ifname) + strlen(":"); ptr = cmdbuf + strlen(ifname) + strlen(":");
ret = sscanf(ptr, ret = sscanf(ptr,
" %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu" " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
" %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu", " %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
" %" SCNu64 " %" SCNu64 " %" SCNu64 " %" SCNu64
" %" SCNu64 " %" SCNu64 " %" SCNu64
" %" SCNu64 " %" SCNu64
" %" SCNu64 " %" SCNu64
" %" SCNu64,
&rx_bytes, &rx_packets, &rx_err, &rx_drop, &rx_bytes, &rx_packets, &rx_err, &rx_drop,
&rx_fifo, &rx_frame, &rx_comp, &rx_multi, &rx_fifo, &rx_frame, &rx_comp, &rx_multi,
&tx_bytes, &tx_packets, &tx_err, &tx_drop, &tx_bytes, &tx_packets, &tx_err, &tx_drop,
......
...@@ -109,21 +109,21 @@ enum eth_callstatus { ...@@ -109,21 +109,21 @@ enum eth_callstatus {
}; };
struct eth_stats { struct eth_stats {
unsigned long tx_bytes; uint64_t tx_bytes;
unsigned long rx_bytes; uint64_t rx_bytes;
unsigned long tx_packets; uint64_t tx_packets;
unsigned long rx_packets; uint64_t rx_packets;
uint32_t tx_errors; /* error packets */ uint64_t tx_errors; /* error packets */
uint32_t rx_errors; uint64_t rx_errors;
unsigned long tx_ucast_packets; /* unicast packets */ uint64_t tx_ucast_packets; /* unicast packets */
unsigned long rx_ucast_packets; uint64_t rx_ucast_packets;
unsigned long tx_mcast_packets; /* multicast packets */ uint64_t tx_mcast_packets; /* multicast packets */
unsigned long rx_mcast_packets; uint64_t rx_mcast_packets;
unsigned long tx_bcast_packets; /* broadcast packets */ uint64_t tx_bcast_packets; /* broadcast packets */
unsigned long rx_bcast_packets; uint64_t rx_bcast_packets;
uint32_t tx_discard_packets; /* no error packets dropped */ uint64_t tx_discard_packets; /* no error packets dropped */
uint32_t rx_discard_packets; /* no error packets dropped */ uint64_t rx_discard_packets; /* no error packets dropped */
uint32_t rx_unknown_packets; /* unknown protocol packets */ uint64_t rx_unknown_packets; /* unknown protocol packets */
}; };
/* struct eth_vlan - vlan over eth_link */ /* struct eth_vlan - vlan over eth_link */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment